Friday, September 18, 2009

Reference URL :

Capitalization Styles Defined

The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized.

Example:

BackColor, DataSet

Camel case

The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized.

Example:

numberOfDays, isValid

Uppercase

All letters in the identifier are capitalized.

Example:

ID, PI

Hungarian Type Notation Defined

Hungarian notation is any of a variety of standards for organizing a computer program by selecting a schema for naming your variables so that their type is readily available to someone familiar with the notation. It is in fact a commenting technique.

Example:

strFirstName, iNumberOfDays

There are different opinions about using this kind of type notation in programming nowadays. Some say that it’s useful, and it should be used everywhere to enhance clarity of your code. Others say it just obfuscates your code, because it has no real advantage in modern programming environments.

Our point of view is a moderated one: use it wisely, meaning, we only use Hungarian notation for private or local variables, that are only accessible and interesting to the programmer of the class.

Don’t use it with public variables, properties or parameters in methods, because they are exposed to the outside world. Someone who uses your classes and accesses properties of your class, is not interested in type, but just wants to use them.

In the .NET framework, there are a lot of types, so we extended and adapted the Hungarian notation with our own type notation.

The general rule for naming namespaces is to use the company name followed by the technology name and optionally the feature and design as follows:

CompanyName.TechnologyName[.Feature][.Design]

Prefixing namespace names with a company name or other well-established brand avoids the possibility of two published namespaces having the same name. Use a stable, recognized technology name at the second level of a hierarchical name.

Example:

Akadia.Traffic, System.Web.UI, System.Windows.Forms

Case guidelines

Use Pascal case as a general rule, or uppercase for very small words.

Example:

System.Windows.Forms, System.Web.UI

4). Class Naming Guidelines

Naming guidelines

Use a noun or noun phrase to name a class.Do not use a type prefix, such as C for class, on a class name.Do not use the underscore character (_).

Case guidelines

Use Pascal case. Example:

FileStream, Button

5). Interface Naming Guidelines

Naming guidelines

Prefix interface names with the letter "I", to indicate that the type is an interface.Do not use the underscore character (_).

Case guidelines

Use Pascal case. Example:

IServiceProvider, IFormatable

6). Parameter Naming Guidelines

Naming guidelines

Use descriptive parameter names. Parameter names should be descriptive enough that the name of the parameter and its type can be used to determine its meaning in most scenarios. To distinguish parameters from other variables the prefix "p" should be used.

Do not prefix parameter names with Hungarian type notation.

Do not use a prefix for parameter names of an event handler and exceptions.

Case guidelines

Use camel case. Example:

pTypeName, pNumberOfItems

7). Method Naming Guidelines

Naming guidelines

Use verbs or verb phrases to name methods.

Case guidelines

Use Pascal case. Example:

RemoveAll(), GetCharAt()

8). Property / Enumerations Naming Guidelines

Naming guidelines

Use a noun or noun phrase to name properties.Do not use Hungarian notation.

Case guidelines

Use Pascal case. Example:

BackColor, NumberOfItems

9). Event Naming Guidelines

Naming guidelines

Use an EventHandler suffix on event handler names.

Specify two parameters named sender and e. The sender parameter represents the object that raised the event. The sender parameter is always of type object, even if it is possible to use a more specific type. The state associated with the event is encapsulated in an instance of an event class named "e". Use an appropriate and specific event class for the e parameter type.

Event handlers in Visual Studio .NET tend to use an "e" parameter for the event parameter to the call. To ensure we avoid a conflict, we will use "ex" as a standard variable name for an Exception object.

Example

catch (Exception ex){ // Handle Exception}

10). Constant Naming Guidelines

The names of variables declared class constants should be all uppercase with words separated by underscores. It is recommended to use a grouping naming schema.

Monday, September 14, 2009

What is Editor part and why do we need them?Well for this question to answer, basically all webparts will have a property pane when we select modify this webpart. This tool/property pane allows to set properties to webparts.

Now what if we need to customize this property pane? Say client needs to have a set of controls where user can select values from these controls which inturn feeds to webpart, so that webpart takes these properties changes.

Let me give you an example,

I am writing a editor part which has couple of dropdownlists. These drop down list will get infomration from differetn field values from from list/document library. Now user can select the required values/fields in the dropdownlist, and webpart will take these values.

So without wasting any moments,lets get the ground running,

1. Create a webpart in a normal mode with all web browasable properties and get this up & running.2. Once it is ok, now to appreciate the purpose of editor part,

3. create a class inherting EditorPart. You can see this class as a normal webpart. Here you need to create controls to be rendered by using same old createchildcontrols, RenderContents and so on.

4. Now there are two methods which you need to take a bit care.

(*) Applychanges(*) SyncChanges

Applychanges is the method which takes all the information from the editor part controls/properties and passes it to WebPart in question's Property.SyncChanges - as name signifies, it synchronies the values between Editor Part and Webpart.

Now Lastly, in the webpart class, override EditorPart method basically creates a object of your custom editor part and sends it to webpart manager/framework. Basically this method tells that when ever a users click on modify this webpart, then instead of displaying a normal property panel create a custom property panel with this object. One more caveat is that, make all webbrowsable property false in the webpart.

Friday, September 11, 2009

You have to make 2 changes in the right .vmc file:A. Disable the time synchronization:Under the following mouse configuration:

true

Add this:falseB. Set the desired date/time:You have to find the time_bytes value inside the .vmc file, which looks like this one:27003200110001201008After finding it, set the desired date/time value according to the following specification:Digits 1 - 2 contain the seconds value.Digits 5 - 6 contain the minutes value.Digits 9 - 10 contain the hours value.Digits 15 - 16 contain the day value.Digits 17 - 18 contain the month value.Digits 19 - 20 contain the year value.In the above example, the date/time value is 11:32:27, 20/10/2008After making the above 2 changes, save the .vmc file, and the guest operating system will start in the same date/time that you set in the time_bytes value.

Total Pageviews

Search inside Jay's Blog Posts

About Me

Professional:
I'm 10 Years experienced IT professional, Right now in Microsoft as consultant. Previously with Capgemini, Honeywell and HCL. I have done freelancing. My basic profession is Software Architect. My interests are Graphics design and Photography.
Certifications:
I hold PMP, Six Sigma Green Belt, Microsoft and CCNA Certifications.
Academic:
All my schooling life was spent in Coimbatore and I have good friends for life. I completed my post graduate in computers(MCA). Plus a lot of self learning, inspirations and perspiration are the ingredients of the person what i am now.
Personal Life:
I am a simple person and proud son of Coimbatore. I studied and grew up there. I lost my father at young age. My mom is a proud home-maker and the greatest cook on the earth. My wife and sister are proud home makers. My kiddo in her junior school.
Finally:
I am a film buff and like to travel a lot. I visited countries United States of America, Norway and United Kingdom. I believe in honesty after learning a lot of lessons the hard way around. I love to read books & articles, Definitely not journals. :)