C# Programming guidlines

c#消除通知区域死程序图标 前两天在csdn上看到有人问这个问题,以前就弄过,不过没出结果,今天用spy++终于找到了,哈哈哈贴代码最直接!  转载请注明作者!  #region 常量和结构体定义  private const int WM_MOUSEMOVE = 0x0200;   [StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]   阅读详情

C# Programming guidlines
source:

Thinking in C#

Larry O’Brien  and Bruce Eckel

Prentice Hall
Upper Saddle River, New Jersey 07458
www.phptr.com

begin:


This appendix contains suggestions to help guide you in performing low-level program design, and in writing code.

Naturally, these are guidelines and not rules. The idea is to use them as inspirations, and to remember that there are

occasional situations where you need to bend or break a rule.

Design
0.Elegance always pays off. In the short term it might seem like it takes much longer to come up with a truly
graceful solution to a problem, but when it works the first time and easily adapts to new situations instead of requiring hours, days, or months of struggle, you’ll see the rewards (even if no one can measure them). Not only does it give you a program that’s easier to build and debug, but it’s also easier to understand and maintain, and that’s where the financial value lies. This point can take some experience to understand, because it can appear that you’re not being productive while you’re making a piece of code elegant. Resist the urge to hurry; it will only slow you down.


1.First make it work, then make it fast. This is true even if you are certain that a piece of code is really important and that it will be a principal bottleneck in your system. Don’t do it. Get the system going first with as simple a design as possible. Then if it isn’t going fast enough, profile it. You’ll almost always discover that “your” bottleneck isn’t the problem. Save your time for the really important stuff.

2.Remember the “divide and conquer” principle. If the problem you’re looking at is too confusing, try to imagine what the basic operation of the program would be, given the existence of a magic “piece” that handles the hard parts. That “piece” is an object—write the code that uses the object, then look at the object and encapsulate its hard parts into other objects, etc.

3.Separate the class creator from the class user (client programmer). The class user is the “customer” and doesn’t need or want to know what’s going on behind the scenes of the class. The class creator must be the expert in class design and write the class so that it can be used by the most novice programmer possible, yet still work robustly in the application. Library use will be easy only if it’s transparent.

4.When you create a class, attempt to make your names so clear that comments are unnecessary. Your goal should be to make the client programmer’s interface conceptually simple. To this end, use method overloading when appropriate to create an intuitive, easy-to-use interface.

5.Your analysis and design must produce, at minimum, the classes in your system, their public interfaces, and their relationships to other classes, especially base classes. If your design methodology produces more than that, ask yourself if all the pieces produced by that methodology have value over the lifetime of the program. If they do not, maintaining them will cost you. Members of development teams tend not to maintain anything that does not contribute to their productivity; this is a fact of life that many design methods don’t account for.

6.Automate everything. Write the test code first (before you write the class), and keep it with the class. Automate the running of your tests through a makefile or similar tool. This way, any changes can be automatically verified by running the test code, and you’ll immediately discover errors. Because you know that you have the safety net of your test framework, you will be bolder about making sweeping changes when you discover the need. Remember that the greatest improvements in languages come from the built-in testing provided by type checking, exception handling, etc., but those features take you only so far. You must go the rest of the way in creating a robust system by filling in the tests that verify features that are specific to your class or program.

7.Write the test code first (before you write the class) in order to verify that your class design is complete. If you can’t write test code, you don’t know what your class looks like. In addition, the act of writing the test code will often flush out additional features or constraints that you need in the class—these features or constraints don’t always appear during analysis and design. Tests also provide example code showing how your class can be used.

8.All software design problems can be simplified by introducing an extra level of conceptual indirection. This fundamental rule of software engineering[1] is the basis of abstraction, the primary feature of object-oriented programming.

9.An indirection should have a meaning (in concert with guideline 9). This meaning can be something as simple as “putting commonly used code in a single method.” If you add levels of indirection (abstraction, encapsulation, etc.) that don’t have meaning, it can be as bad as not having adequate indirection.

10.Make classes as atomic as possible. Give each class a single, clear purpose. If your classes or your system design grows too complicated, break complex classes into simpler ones. The most obvious indicator of this is sheer size: if a class is big, chances are it’s doing too much and should be broken up.
Clues to suggest redesign of a class are:
1) A complicated switch statement: consider using polymorphism.
2) A large number of methods that cover broadly different types of operations: consider using several classes.
3) A large number of member variables that concern broadly different characteristics: consider using several classes.

11.Watch for long argument lists. Method calls then become difficult to write, read, and maintain. Instead, try to move the method to a class where it is (more) appropriate, and/or pass objects in as arguments.

12.Don’t repeat yourself. If a piece of code is recurring in many methods in derived classes, put that code into a single method in the base class and call it from the derived-class methods. Not only do you save code space, you provide for easy propagation of changes. Sometimes the discovery of this common code will add valuable functionality to your interface.

13.Watch for switch statements or chained if-else clauses. This is typically an indicator of type-check coding, which means you are choosing what code to execute based on some kind of type information (the exact type may not be obvious at first). You can usually replace this kind of code with inheritance and polymorphism; a polymorphic method call will perform the type checking for you, and allow for more reliable and easier extensibility.

14.From a design standpoint, look for and separate things that change from things that stay the same. That is, search for the elements in a system that you might want to change without forcing a redesign, then encapsulate those elements in classes. You can learn significantly more about this concept in Thinking in Patterns with Java, downloadable at www.BruceEckel.com.

15.Don’t extend fundamental functionality by subclassing. If an interface element is essential to a class it should be in the base class, not added during derivation. If you’re adding methods by inheriting, perhaps you should rethink the design.

16.Less is more. Start with a minimal interface to a class, as small and simple as you need to solve the problem at hand, but don’t try to anticipate all the ways that your class might be used. As the class is used, you’ll discover ways you must expand the interface. However, once a class is in use you cannot shrink the interface without disturbing client code. If you need to add more methods, that’s fine; it won’t disturb code, other than forcing recompiles. But even if new methods replace the functionality of old ones, leave the existing interface alone (you can combine the functionality in the underlying implementation if you want). If you need to expand the interface of an existing method by adding more arguments, create an overloaded method with the new arguments; this way you won’t disturb any existing calls to the existing method.

17.Read your classes aloud to make sure they’re logical. Refer to the relationship between a base class and derived class as “is-a” and member objects as “has-a.”

18.When deciding between inheritance and composition, ask if you need to upcast to the base type. If not, prefer composition (member objects) to inheritance. This can eliminate the perceived need for multiple base types. If you inherit, users will think they are supposed to upcast.

19.Use data members for variation in value and method overriding for variation in behavior. That is, if you find a class that uses state variables along with methods that switch behavior based on those variables, you should probably redesign it to express the differences in behavior within subclasses and overridden methods.

20.Watch for overloading. A method should not conditionally execute code based on the value of an argument. In this case, you should create two or more overloaded methods instead.

21.Use exception hierarchies—preferably derived from specific appropriate classes in the standard Java exception hierarchy. The person catching the exceptions can then catch the specific types of exceptions, followed by the base type. If you add new derived exceptions, existing client code will still catch the exception through the base type.

22.Sometimes simple aggregation does the job. A “passenger comfort system” on an airline consists of disconnected elements: seat, air conditioning, video, etc., and yet you need to create many of these in a plane. Do you make private members and build a whole new interface? No—in this case, the components are also part of the public interface, so you should create public member objects. Those objects have their own private implementations, which are still safe. Be aware that simple aggregation is not a solution to be used often, but it does happen.

23.Consider the perspective of the client programmer and the person maintaining the code. Design your class to be as obvious as possible to use. Anticipate the kind of changes that will be made, and design your class so that those changes will be easy.

24.Watch out for “giant object syndrome.” This is often an affliction of procedural programmers who are new to OOP and who end up writing a procedural program and sticking it inside one or two giant objects. With the exception of application frameworks, objects represent concepts in your application, not the application.


25.If you must do something ugly, at least localize the ugliness inside a class.

26.If you must do something nonportable, make an abstraction for that service and localize it within a class. This extra level of indirection prevents the nonportability from being distributed throughout your program. (This idiom is embodied in the Bridge Pattern).

27.objects should not simply hold some data. They should also have well-defined behaviors. (Occasionally, “data objects” are appropriate, but only when used expressly to package and transport a group of items when a generalized container is innappropriate.)

28.Choose composition first when creating new classes from existing classes. You should only used inheritance if it is required by your design. If you use inheritance where composition will work, your designs will become needlessly complicated.

29.Use inheritance and method overriding to express differences in behavior, and fields to express variations in state. An extreme example of what not to do is inheriting different classes to represent colors instead of using a “color” field.

30.Watch out for variance. Two semantically different objects may have identical actions, or responsibilities, and there is a natural temptation to try to make one a subclass of the other just to benefit from inheritance. This is called variance, but there’s no real justification to force a superclass/subclass relationship where it doesn’t exist. A better solution is to create a general base class that produces an interface for both as derived classes—it requires a bit more space, but you still benefit from inheritance, and will probably make an important discovery about the design.

31.Watch out for limitation during inheritance. The clearest designs add new capabilities to inherited ones. A suspicious design removes old capabilities during inheritance without adding new ones. But rules are made to be broken, and if you are working from an old class library, it may be more efficient to restrict an existing class in its subclass than it would be to restructure the hierarchy so your new class fits in where it should, above the old class.

32.Use design patterns to eliminate “naked functionality.” That is, if only one object of your class should be created, don’t bolt ahead to the application and write a comment “Make only one of these.” Wrap it in a singleton. If you have a lot of messy code in your main program that creates your objects, look for a creational pattern like a factory method in which you can encapsulate that creation. Eliminating “naked functionality” will not only make your code much easier to understand and maintain, it will also make it more bulletproof against the well-intentioned maintainers that come after you.

33.Watch out for “analysis paralysis.” Remember that you must usually move forward in a project before you know everything, and that often the best and fastest way to learn about some of your unknown factors is to go to the next step rather than trying to figure it out in your head. You can’t know the solution until you have the solution. Java has built-in firewalls; let them work for you. Your mistakes in a class or set of classes won’t destroy the integrity of the whole system.

34.When you think you’ve got a good analysis, design, or implementation, do a walkthrough. Bring someone in from outside your group—this doesn’t have to be a consultant, but can be someone from another group within your company. Reviewing your work with a fresh pair of eyes can reveal problems at a stage when it’s much easier to fix them, and more than pays for the time and money “lost” to the walkthrough process. Implementation

35.In general, follow the Microsoft coding conventions. These are available at #ref# (the code in this book follows these conventions as much as I was able). These are used for what constitutes arguably the largest body of code that the largest number of C# programmers will be exposed to. If you doggedly stick to the coding style you’ve always used, you will make it harder for your reader. Whatever coding conventions you decide on, ensure they are consistent throughout the project.

36.Whatever coding style you use, it really does make a difference if your team (and even better, your company) standardizes on it. This means to the point that everyone considers it fair game to fix someone else’s coding style if it doesn’t conform. The value of standardization is that it takes less brain cycles to parse the code, so that you can focus more on what the code means.

37.Follow standard capitalization rules. Capitalize the first letter of class names and non-private methods and properties. The first letter of private fields, methods, and objects (references) should be lowercase. All identifiers should run their words together, and capitalize the first letter of all intermediate words. For example:
ThisIsAClassName
thisIsAPrivateMethodOrFieldName
Capitalize all the letters of static final primitive identifiers that have constant initializers in their definitions. This
indicates they are compile-time constants.

38.Don’t create your own “decorated” private data member names. This is usually seen in the form of prepended underscores and characters. Hungarian notation is the worst example of this, where you attach extra characters that indicate data type, use, location, etc., as if you were writing assembly language and the compiler provided no extra assistance at all. These notations are confusing, difficult to read, and unpleasant to enforce and maintain. Let classes and packages do the name scoping for you.

39.Follow a “canonical form” when creating a class for general-purpose use. Include definitions for equals( ), hashCode( ), toString( ), clone( ) (implement Cloneable), and implement Comparable and Serializable.  

40.Use the JavaBeans “get,” “set,” and “is” naming conventions for methods that read and change private fields, even if you don’t think you’re making a JavaBean at the time. Not only does it make it easy to use your class as a Bean, but it’s a standard way to name these kinds of methods and so will be more easily understood by the reader.

41.For each class you create, consider including a static public test( ) that contains code to test that class. You don’t need to remove the test code to use the class in a project, and if you make any changes you can easily rerun the tests. This code also provides examples of how to use your class.

42.Sometimes you need to inherit in order to access protected members of the base class. This can lead to a perceived need for multiple base types. If you don’t need to upcast, first derive a new class to perform the protected access. Then make that new class a member object inside any class that needs to use it, rather than inheriting.

43.If two classes are associated with each other in some functional way (such as containers and iterators), try to make one an inner class of the other. This not only emphasizes the association between the classes, but it allows the class name to be reused within a single package by nesting it within another class.

44.Anytime you notice classes that appear to have high coupling with each other, consider the coding and maintenance improvements you might get by using inner classes. The use of inner classes will not uncouple the classes, but rather make the coupling explicit and more convenient.

45.Don’t fall prey to premature optimization. This way lies madness. In particular, don’t worry about writing (or avoiding) native methods, making some methods final, or tweaking code to be efficient when you are first constructing the system. Your primary goal should be to prove the design, unless the design requires a certain efficiency.

46.Keep scopes as small as possible so the visibility and lifetime of your objects are as small as possible. This reduces the chance of using an object in the wrong context and hiding a difficult-to-find bug. For example, suppose you have a container and a piece of code that iterates through it. If you copy that code to use with a new container, you may accidentally end up using the size of the old container as the upper bound of the new one. If, however, the old container is out of scope, the error will be caught at compile-time.

47.Use the containers in the .NET Framework SDK. Become proficient with their use and you’ll greatly increase your productivity.

48.For a program to be robust, each component must be robust. Use all the tools provided by C#: access control, exceptions, type checking, and so on, in each class you create. That way you can safely move to the next level of abstraction when building your system.

49.Prefer compile-time errors to run-time errors. Try to handle an error as close to the point of its occurrence as possible. Prefer dealing with the error at that point to throwing an exception. Catch any exceptions in the nearest handler that has enough information to deal with them. Do what you can with the exception at the current level; if that doesn’t solve the problem, rethrow the exception.

50.Watch for long method definitions. Methods should be brief, functional units that describe and implement a discrete part of a class interface. A method that is long and complicated is difficult and expensive to maintain, and is probably trying to do too much all by itself. If you see such a method, it indicates that, at the least, it should be broken up into multiple methods. It may also suggest the creation of a new class. Small methods will also foster reuse within your class. (Sometimes methods must be large, but they should still do just one thing.)

51.Keep things as “private as possible.” Once you publicize an aspect of your library (a method, a class, a field), you can never take it out. If you do, you’ll wreck somebody’s existing code, forcing them to rewrite and redesign. If you publicize only what you must, you can change everything else with impunity, and since designs tend to evolve this is an important freedom. In this way, implementation changes will have minimal impact on derived classes. Privacy is especially important when dealing with multithreading—only private fields can be protected against un-synchronized use.

52.Use comments liberally, and use the comment-documentation syntax to produce your program documentation. However, the comments should add geniune meaning to the code; comments that only reiterate what the code is clearly expressing are annoying. Note that the typical verbose detail of Java class and method names reduce the need for as many comments.

53.Avoid using “magic numbers”—which are numbers hard-wired into code. These are a nightmare if you need to change them, since you never know if “100” means “the array size” or “something else entirely.” Instead, create a constant with a descriptive name and use the constant identifier throughout your program. This makes the program easier to understand and much easier to maintain.

54.When creating constructors, consider exceptions. In the best case, the constructor won’t do anything that throws an exception. In the next-best scenario, the class will be composed and inherited from robust classes only, so they will need no cleanup if an exception is thrown. Otherwise, you must clean up composed classes inside a finally clause. If a constructor must fail, the appropriate action is to throw an exception, so the caller doesn’t continue blindly, thinking that the object was created correctly.

55.If your class requires any cleanup when the client programmer is finished with the object, make your class implement IDisposable tk.

56.When you are creating a fixed-size container of objects, transfer them to an array—especially if you’re returning this container from a method. This way you get the benefit of the array’s compile-time type checking, and the recipient of the array might not need to cast the objects in the array in order to use them.

57.Choose interfaces over abstract classes. If you know something is going to be a base class, your first choice should be to make it an interface, and only if you’re forced to have method definitions or member variables should you change it to an abstract class. An interface talks about what the client wants to do, while a class tends to focus on (or allow) implementation details.

58.Inside constructors, do only what is necessary to set the object into the proper state. Actively avoid calling other methods (except for final methods) since those methods can be overridden by someone else to produce unexpected results during construction. (See Chapter 7 for details.) Smaller, simpler constructors are less likely to throw exceptions or cause problems.

59.Watch out for accidental overloading. If you attempt to override a base-class method and you don’t quite get the spelling right, you’ll end up adding a new method rather than overriding an existing method. However, this is perfectly legal, so you won’t get any error message from the compiler or run-time system—your code simply won’t work correctly.

60.Watch out for premature optimization. First make it work, then make it fast—but only if you must, and only if it’s proven that there is a performance bottleneck in a particular section of your code. Unless you have used a profiler to discover a bottleneck, you will probably be wasting your time. The hidden cost of performance tweaks is that your code becomes less understandable and maintainable.

*Comment* 

Remember that code is read much more than it is written. Clean designs make for easy-to-understand programs, but comments, detailed explanations, and examples are invaluable. They will help both you and everyone who comes after you. If nothing else, the frustration of trying to ferret out useful information from the online Java documentation should convince you

超分辨率重建:ESPCN与SRGAN技术对比 超分辨率重建:ESPCN与SRGAN技术对比​ 人工智能,计算机视觉,大模型,AI,超分辨率重建是一种通过技术手段,将低分辨率图像转换为高分辨率图像的过程。它的目的是恢复低分辨率图像中丢失的细节信息,使图像具有更高的清晰度和视觉质量。 阅读详情

相关推荐

PLC期末速成——顺序功能图转梯形图

一、根据顺序功能图写出梯形图程序 顺序功能图: 梯形图: 1、程序段1,系统运行标志M0.0的启-保-停控制电路。 2、程序段2,PLC上电与逆行,初始化脉冲M1.0激活初始化步M2.0。 3、程序段3,当M2.0初始化步为活动步,并且M0.0系统运行标志位为1时,置位M2.1步,复位M2.0步。 4、当M2.1为活动步,并且I0.3中液位传感器为1时,置位M2.2步,复位M2.1步。 5、程序段5,当M2.2为活动步,并且I0.2高液位传感器为1时,置位M2.3步,复位M2.2步。 6、程序段

qq_52251819的博客 1万+

ASP.NET页面生命周期描述

在以前写个一篇关于ASP.NET页面生命周期的草稿,最近又看了看ASP.NET,做个补充,看看页面初始过程到底是怎么样的下面是ASP.NET页面初始的过程:1. Page_Init();2. Load ViewState;3. Load Postback data;4. Page_Load();5. Handle control events;6. Page_PreRender();7. Page

Vigor's Blog 1万+

有限时间 vs 固定时间 vs 预定时间滑模:稳定性分析与仿真验证方法对比(中)

有限时间滑模控制(FTSMC)和固定时间滑模控制(FixTSMC)是两种重要的控制策略,旨在实现系统状态的快速收敛。FTSMC通过设计滑模面和控制律,确保系统状态在有限时间内收敛到原点,但其收敛时间与初始状态相关。FixTSMC则进一步优化,使收敛时间与初始状态无关,适用于高动态环境,具有更强的鲁棒性和更平滑的控制信号。两种方法均通过李雅普诺夫函数证明其稳定性,并通过仿真验证其有效性。FixTSMC在工程应用中更为可靠,尤其适合安全关键系统。

Lyajpunov的博客 3224

Delphi 参数传递

1.数值参数  变量和结构被完全拷贝到堆栈中,调用函数接受到的只是一个副本.数值参数传递方式是Delphi的默认方式,也是其他大部分语言的默认参数传递方式(比如C++,VC,java...).形式: function  myFunc(object:TObject):Byte;          procedure myProc(object:TObject);PS:堆栈可以这样理解,每次函数或过程

Vigor's Blog 4562

别再只盯着CXL协议了,聊聊CXL.mem里那个能动态调优内存性能的‘QoS遥测’到底怎么用

本文深入解析CXL.mem协议中的QoS遥测功能,探讨如何通过DevLoad指标动态调优内存性能。文章详细介绍了QoS遥测的核心机制、多QoS类别设备的实战配置,以及AI训练、金融交易和视频处理场景中的优化案例,帮助数据中心实现高效内存资源管理。

weixin_33725722的博客 436

Pi0 项目复现及项目问题解决方案(全网抢先发布~)

Pi0 项目复现及项目问题解决方案(全网抢先发布~)

m0_68167062的博客 2261

ASP.Net页面生命周期

错误:    每个页面的生命周期为用户的访问开始到结束,也就是说程序中的全局变量同时生存到用户的访问结束.正确:    每个页面的生命周期为用户的每一次访问,也就是说每一次客户端与服务器之间的一个往返过程.全局变量的生命周期在此之间.例:string gb_string;void Page_Load(){    if(!IsPostBack)    {       //第一次被访问的代码     

Vigor's Blog 4377

ChatGPT启蒙之旅:弟弟妹妹的关键概念入门

本文主要介绍了ChatGPT启蒙之旅:弟弟妹妹的关键概念探险,希望能对初学大模型的同学们有所帮助。 文章目录 1. 背景 2. GPT是个什么样的人? 3. GPT使用的核心思维 4. GPT使用的场景介绍

herosunly的博客 16万+

.NET类型对象的判等(Equals)

申明::本文内容来自>    .NET类型分为:基元类型(Primitive type),引用类型(Reference type),值类型(Value type),所有这些类型的祖先是System.Object,System.Object提供了四个成员函数:Equals GetHashCode GetType ToString ,以确保每个继承类型都有一个最小的操作集合,但是在我们设计.NET类型

Vigor's Blog 2730

图数据库Neo4j面试内容整理-Neo4j的性能

在执行复杂关系查询时,Neo4j 通过图结构的高效存储和查询机制,能够比传统的关系型数据库提供更快的性能,尤其是在涉及深层关系的查询时。通过合理的配置、优化查询和使用合适的硬件,Neo4j 可以处理大规模的数据集和高并发的查询请求,满足企业级应用的需求。Neo4j 在处理图数据时,通过优化图的存储、查询和遍历等方面,提供了高效的性能,特别适合用于需要处理复杂关系和多层次连接的应用场景,如社交网络、推荐系统、知识图谱等。:Neo4j 会根据查询的结构和数据的分布自动选择最优的查询计划。

不务正业的猿 585

Simulink开发项1000例实战专栏--实例52:基于Simulink开发一个超导磁储能控制系统,实现对SMES系统的精确控制和优化

需求分析超导磁储能系统(Superconducting Magnetic Energy Storage, SMES)是一种利用超导线圈储存和释放电能的高效储能技术。SMES系统具有响应速度快、能量密度高、循环寿命长等优点,广泛应用于电力系统的调峰填谷、频率调节、电压稳定以及紧急备用电源等领域。本项目将基于Simulink平台,开发一个完整的超导磁储能控制系统,实现对SMES系统的精确控制和优化。我们将详细讲解如何设计和实现该系统,并结合实际应用案例进行说明。

xiaoheshang_123的博客 236

From 验证Webservice怎么调用service

  关键字 : ASP.NET mode="Forms"  Web Service   项目种遇到这么个问题,在用Form认证的ASP.NET程序内调用同一虚拟目录下的web service,这样也需要有认证信息,网上找了很久没结果,都说Form认证不适合webservice,但是我就需要嗒~~,后来仔细想了想,form认证就是用cookie来传递的,于是测试了以下代码,搞定~~   As

Vigor's Blog 2591

Qt C++ 串口调试助手

1. **串口配置**:支持自动检测可用串口,可配置波特率(9600~921600)、数据位(5~8)、校验位(无/奇/偶/标记/空格)、停止位(1/1.5/2)。- HEX 模式发送时,输入格式需为十六进制字符(0-9、A-F),可带空格(如 `01 A3 FF`)或不带空格(如 `01A3FF`)。// 发送模式:true=HEX,false=ASCII。// 字符串转HEX字节数组。ui->parity->addItems({"无", "奇校验", "偶校验", "标记校验", "空格校验"});

寒寒豆豆软件公司的博客 145

递归法选取树子节点 + 控件拖放

递归法选取树子节点 + 控件拖放适合N层树,通用.pasunit treeRecursion;{ 标题: 递归法选取树子节点 + 控件拖放 作者: vigor 时间: 2004.3.26}interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, Button

Vigor's Blog 2103

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

创建型模式

创建型 创建型模式提供了多种不同的方法从实例化它们的代码中除去了对这些具体类的显示引用。 1.1 抽象工厂(Abstract Factory)结构图代码实例    public class ScrollBar //Abstract Product    {       public ScrollBar()       {}    }   

Vigor's Blog 1677

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

SQL存储过程

在这里做个备份/*AutoInitProc** Create for autoInit * by vigor 2005.2.14**/USE chargeDB/********创建视图******************************************************************/IF EXISTS (SELECT name FROM sysobjects WH

Vigor's Blog 1582

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

【JVM】对象内存布局

HotSpot JVM 中,Java 对象内存布局由对象头(12字节,含Mark Word与压缩Klass Pointer)、实例数据及对齐填充构成,总大小为8字节倍数。对象头支持锁状态动态复用,指针压缩使引用仅4字节,但堆超32GB时失效。实例字段按类型优先级重排序以减少间隙,最小对象大小为16字节。通过JOL工具可精准验证布局,理解锁机制、GC、伪共享等底层行为。

2301_79732484的博客 149

Lua 与 ToLua:运行机制及热更新原理

本文解析 Lua 与 ToLua 在 Unity 中的运行机制及热更新原理。Lua 作为可嵌入语言,通过编译字节码由虚拟机执行,支持运行时加载新脚本;ToLua 实现 C# 与 Lua 的双向调用,通过生成 Wrap 代码注册类型接口;热更新依赖于宿主动态加载并执行新脚本,结合资源管理、版本控制与状态处理机制。关键点包括:table 共享引用、函数值不随重定义更新、闭包捕获状态、元表实现类逻辑,以及对象跨语言传递的生命周期管理。完整热更新需独立设计补丁分发与回滚策略。

2503_90324697的博客 132

使用lxml操作 Word 的 OpenXML 底层

本文综合介绍了使用lxml操作Word底层OpenXML文档的基础知识,并给出了一个效率远超VBA的提取Word文档中的表格的HTML表结构的实例,演示了用lxml获取及修改部分Word文档组成部件的文本、属性的方法。

yivifu的专栏 400

C#使用opencv和Yolo模型识别车牌号

本文基于OpenCVSharp与OnnxRuntime,结合YoloV8n-pose_plate模型(检测车牌位置)和OCR模型(识别车牌文字),实现高效车牌识别。通过预处理、目标检测、NMS筛选及文字识别流程,最终输出车牌框位置与识别文本。代码封装良好,支持自定义路径与置信度阈值,具备实际应用价值。

lweiyue的专栏 163

C# NAFNet 图片去模糊

基于NAFNet与ONNX Runtime的C# WinForms图片去模糊工具,支持DirectML GPU加速与CPU回退,实现一键去模糊、大图分块处理、并排对比及拖拽打开。具备高DPI适配、自绘圆角界面、命令行批量处理等功能,适用于Windows 10/11系统,可灵活配置模型路径与分块大小,解决显存不足与边缘接缝问题。

hixiong123的博客 250

使用C#代码提取、修改或删除 Excel 中的超链接

通过 C# 和 VB.NET,可以方便地管理 Excel 文件中的超链接,包括提取、修改和删除等操作。提取超链接: 获取工作表中的超链接集合,读取每个超链接的地址和类型,并将相关信息保存到文本文件中。修改超链接: 更新超链接的显示文本和目标地址,确保链接信息准确。删除超链接: 移除指定的超链接,同时可以选择保留单元格中的原有显示文本,或清除单元格的全部内容。这些操作可以帮助开发人员更高效地管理 Excel 文档中的链接信息,减少重复的手动操作,也便于在数据迁移、文档维护和自动化报表处理等场景中使用。

2501_93070778的博客 228

C#: 控件不支持透明的背景色

把透明度固定为255。

海天鹰 34

week11-词云图

核心逻辑:词频越高,文字字号越大;适合快速看文本高频关键词(影评、评论、摘要文本非常适配 CommentInfo.csv)

m0_66244637的博客 136

C# 基于OpenCv的视觉工作流-章115-单节点条件

本章介绍C#基于OpenCv的视觉工作流中单节点条件的设置,涵盖列表值范围判断(支持“与”“或”逻辑)、模块结果参数匹配判定,以及结果显示图像与字体配置。通过灵活设定条件,实现检测结果的OK/NG自动判定,提升视觉系统智能化水平。配套工具“VisionTool 探迹”已更新,新增海康相机、PC相机采集及多类通讯优化功能,助力工业视觉应用。

sali-tec的博客 245

基于 OPC UA 的半导体工厂化学气体传输 SCADA 监控系统:架构设计与 C# MVVM 实现

本文提出一套面向半导体化学气体传输的可演进SCADA系统,基于OPCUA统一信息模型与C#+WPF+MVVM技术栈,实现从气源到机台的全链路实时监控、安全联锁与追溯。通过资产树建模、分层解耦架构与标准对齐(SEMI E30/E95/S2),确保系统可扩展、可维护、可审计,满足高安全、高可靠要求,支持快速落地与持续演进。

ponygame的博客 331
上一篇: SQL存储过程
下一篇: 递归法选取树子节点 + 控件拖放
Vigorcsdn
博客等级 码龄23年 0粉丝 28原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值