Programmer's Heaven

Programmer's Heaven
Picture

Wednesday, January 19, 2011

Trainees are Clever than A PM

A lady manager of a big reputed office noticed a new man one day and told him to come into her office.




"What is your name?" was the first thing she asked the new guy.

"John," the new guy replied.


She scowled, "Look... I don't know what kind of a namby-pamby place you worked before, but I don't call anyone by their first name. It breeds familiarity and that leads to a breakdown in authority.




I refer to my employees by their last name only ... Smith, Jones, Baker ...that's all.


I am to be referred to only as Mrs. Robertson. Now that we got that straight, what is your last name?"


The new guy sighed, "Darling............ My name is John Darling."


"Okay John, the next thing I want to tell you is . . .." J








Not ALL rules can be followed!!!






Monday, June 7, 2010

.NET 4.0 New Features

Hi,



This article is an introduction to some of the new features in ASP.NET 4.0 Along with VS2010.


New Profiles


We have seen different development profiles in previous versions of .NET. Like VB, C#, Web Development, and General Development. We select a profile based on our priorities. These are selected after the first installation of Visual Studio or from the Import Export option.

In VS2010, two more profiles are introduced and both support HTML developers. Those are:
1. Web Development


2. Web Development (Code Optimized)


Note:


The Web Development profile hides the client objects and events bar on top in HTML mode.


In Code Optimized, you will find the HTML editor without code, and the designer tabs. So, it provides a more bigger area on the screen to play with HTML.


Generate From Usage


In previous versions of ASP.NET, Microsoft introduced code refactoring to generate methods and identifiers from existing code. In ASP.NET 4.0, there is a new concept of Generate From Usage - generates properties, methods, classes, and other types based on existing code.


Write some code, select it and right click on the left most character, and you will get options to change it to a property or method etc. This option is shown only if you do not define an identifier. For example, in intellisense, it will not show the options to extract a property if you right click on the variable i.(i as a Variable)


Multi Targetting


In VS2008, it is possible to create a project in version 2.0 or 3.0, rather than developing in default 3.5. Also, there is an option to change a developed project's target framework version.


The same option is available in VS2010, but with one improvement. In the previous versions, if you create a project in framework 2.0, intellisense will still show you the types and members of 3.5 version as well, so there are more chances of error if you cannot identify the member of the chosen framework. But in VS2010, the intellisense will show you options for the appropriate framework only.So there is no chance of error based on Framework even you have 'N' numbers.

Code Snippets


Code snippets are pre-developed code templates which can save time spent on thinking about the syntax. There are already a lot of built-in code snippets in VS2005 and VS2008. However, those are only available for the code-behind. Code snippets in VS2010 are introduced for:


JScript


HTML

ASP.NET markup as well. In the screenshots below, we can see different snippet context menus for JScript and HTML.


Multi Monitoring


Visual Studio 2010 provides us facility to move windows of the IDE outside of the Visual Studio IDE and place them on the desktop area. It also supports having different IDE windows on multiple monitors. If we close Visual Studio and open it again, we will find all the windows on the same places where we finished them last time.So the Comparison also Easy.


Improvement in Intellisense


In VS2008, on selecting properties for an object, intellisense will show you the properties based on the alphabetical order as you type.


In VS2010, it shows you the properties based on groups. For example, if you type text for a text box, it will show you the members based on the word text, like Text, TextChanged, TextMode. It also supports Pascal case intellisense. For example, if you type TC, it will navigate to the TextChanged member.


Enable Persist Selection
On selecting a row in controls like DataList or GridView, if we move to another page index, it selects the same numbered row on the newly selected page, although we selected it only on the first page.


To avoid this, ASP.NET 4.0 has introduced a new property for these controls, called EnablePersistedSelection. If you set it to true, it will not select the same numbered row on other pages, and on navigation to the original page, for example, the first page, it will show the initially selected row as selected.


Web.Config
Normally, we set some values in web.config for the development environment, and then we change those values manually at the time of deployment or testing.


For example, if we have a connection string or any key value combination in the web.config file, and we want to replace those at the time of project publishing or deployment, then we can use the new web.config transformation. It is an automatic way to perform this operation.


Web.config settings can be overridden by other config files like web.release.config, web.debug.config etc., at the time of debug, release. These values are not overridden in the original web.config but in the published web.config.


Compressing Session Values:


ASP.NET session out-of-process state values are saved in a database or on the server. These are saved in a serialized format. Bigger session values consume more resources to be sent to the server. Now, those can be compressed with a new built-in property compressionEnabled. This attribute for the sessionState element can be mentioned in the web.config, like this:


sessionState mode="SQLServer" stateConnectionString="connectionstring goes here" compressionEnabled="true"


This option avail for out-of-process sessions.


In C#


C# in .NET Framework 4.0 has some more things to offer. These are:




Dynamic Lookup
There is a new static type named dynamic. We can use it as object of any type. If there is any error on its usage, we would get it on runtime only,






For example:
dynamic integerValue = 5; dynamic stringValue = " string"; dynamic Result = integerValue + stringValue;






Output: 5 string


But if you change the last line like,
dynamic Result = integerValue & stringValue;
You will get an Error message at Run time.










Optional Parameters


Optional parameters, we used to create overloaded functions before ASP.NET 4, but now, optional parameters are no more a restriction in C#. Like VB, optional parameters must be mentioned last.


Example,


public void FunctionOptionalParam(string Name, int Age, string Country = "")
and we can call them without mentioning the value for the optional parameter.










Named Parameters


Named parameters allow you to ignore the parameter order and mention parameters with names in a different order. For example:


public void FunctionNamedParam(int x, int y , int z)


On function call


FunctionNamedParam(x:1, z:3, y:2);


Although we are sending a value for the parameter z before its order in the function declaration, but these would be equal to x=1, y=2, z=3.




Meta Tags


The HtmlMeta class can be used to add HTML meta tags dynamically. HTMLMeta's Name, Content properties can be used to add any meta tag name and its values dynamically on runtime.


There are many more New Concepts available in VS2010.

Cold Fusion - Array and Structures

COLDFUSION MARKUP LANGUAGE (CFML) is ColdFusions own set of tags that makes up the bulk of the dynamic functionality found on ColdFusion pages. CFML has two different parts that make ColdFusion work: tags and functions. In this chapter we cover a whole bunch of CFML tags and also some basic functions. Chapter 4 shows you how to use some of the more advanced functions and teaches you about variable scopes and different data types.


Tags are used to carry out operations, such as looping over Recordsets, uploading files to a web server by way of a web form, dumping the contents of a variable to the screen for debugging, and grabbing the contents of a remote page on the Web. Functions within ColdFusion are used to manipulate data or perform calculations. For example, ColdFusion has a function called #ArrayAvg()#, which calculates the average of the numeric values within an array. You often must use tags and functions together to build a completely functional site.

HTML and ColdFusion tags can exist together within a document that is requested from a web server. All ColdFusion tags start with


Whenever using ColdFusion tags within a document, you must save it as a.cfmfile for it to be recognized and interpreted by the ColdFusion server.


In text strings, all text is considered literal unless it is within a set of pound/hash (#) signs.


ColdFusion elements (the opening and closing tags, and everything in between) are called blocks. For example, if you were using aelement in your code, it would be called theblock.


To add comments inside ColdFusion tags, you must use CFML comment delimiters:. Notice that these are similar to HTML comments, but have three dashes instead of two. If you use HTML comments inside your CFML, they will not be ignored by the ColdFusion server as expected, and you will either get errors or will dynamically create HTML comments. Also, CFML comments will not send text back to the users browser like HTML comments do.


Array and Structures:


Structures are everywhere in the ColdFusion world. As of ColdFusion 4.5, form, application, session, server, request, and URL variables are stored in structures. Allaire Spectra makes extensive use of structures and associative arrays. But what are they and why should you care?


1.Structures and Their Benefits
2.Structures and Arrays: A Dynamic Duo


3.Extracting Data from Arrays and Structures
4.Nested Arrays


Simply, structures are used to refer to related values as a unit rather than individually. They provide a way to group variables logically. Also, with built-in structure related functions and the ability to nest functions and arrays, variables become much more powerful.
This article presents an introduction to structures, how they're coded, and how to capitalize on some of their features. In addition, the concept of nesting structures and arrays - one of the most exciting and powerful uses of data in a ColdFusion application - will be introduced.

Structures and Their Benefits:



Simple variables on a given page are just there, blissfully ignorant of any other variables and happy to store their value. The benefit of structures lies in the logical grouping of the variables. For example, an album on compact disc is an item with several unique values, such as title, artist, and genre. Although each value is unique, they are part of a logical unit: the CD itself.


A structure represents the CD and a number of properties, or keys, within it. By logically grouping the variables in structures, they can be used as members of a cohesive unit. For example, examine the following structure:

CD=StructNew(); CD.Title = "Cookin at the Plugged Nickel"; CD.Artist = "Miles Davis"; CD.Genre = "Jazz";

To view this structure, the following script can be used:


We have a #CD.Genre# CD called #CD.Title# by #CD.Artist#










Resources » Articles » ASP.NET/Web Applications »





Cold Fusion - Array and Structures



Posted Date: 31 May 2010 Resource Type: Articles Category: ASP.NET/Web Applications

Author: Manigandan Member Level: Gold

Rating: Points: 8







Introduction about Cold Fusion,Array and Structures concepts .









COLDFUSION MARKUP LANGUAGE (CFML) is ColdFusions own set of tags that makes up the bulk of the dynamic functionality found on ColdFusion pages. CFML has two different parts that make ColdFusion work: tags and functions. In this chapter we cover a whole bunch of CFML tags and also some basic functions. Chapter 4 shows you how to use some of the more advanced functions and teaches you about variable scopes and different data types.



Tags are used to carry out operations, such as looping over Recordsets, uploading files to a web server by way of a web form, dumping the contents of a variable to the screen for debugging, and grabbing the contents of a remote page on the Web. Functions within ColdFusion are used to manipulate data or perform calculations. For example, ColdFusion has a function called #ArrayAvg()#, which calculates the average of the numeric values within an array. You often must use tags and functions together to build a completely functional site.



HTML and ColdFusion tags can exist together within a document that is requested from a web server. All ColdFusion tags start with

Whenever using ColdFusion tags within a document, you must save it as a.cfmfile for it to be recognized and interpreted by the ColdFusion server.

In text strings, all text is considered literal unless it is within a set of pound/hash (#) signs.



ColdFusion elements (the opening and closing tags, and everything in between) are called blocks. For example, if you were using aelement in your code, it would be called theblock.



To add comments inside ColdFusion tags, you must use CFML comment delimiters:. Notice that these are similar to HTML comments, but have three dashes instead of two. If you use HTML comments inside your CFML, they will not be ignored by the ColdFusion server as expected, and you will either get errors or will dynamically create HTML comments. Also, CFML comments will not send text back to the users browser like HTML comments do.





Array and Structures:



Structures are everywhere in the ColdFusion world. As of ColdFusion 4.5, form, application, session, server, request, and URL variables are stored in structures. Allaire Spectra makes extensive use of structures and associative arrays. But what are they and why should you care?



1.Structures and Their Benefits



2.Structures and Arrays: A Dynamic Duo



3.Extracting Data from Arrays and Structures



4.Nested Arrays



Simply, structures are used to refer to related values as a unit rather than individually. They provide a way to group variables logically. Also, with built-in structure related functions and the ability to nest functions and arrays, variables become much more powerful.



This article presents an introduction to structures, how they're coded, and how to capitalize on some of their features. In addition, the concept of nesting structures and arrays - one of the most exciting and powerful uses of data in a ColdFusion application - will be introduced.





Structures and Their Benefits:



Simple variables on a given page are just there, blissfully ignorant of any other variables and happy to store their value. The benefit of structures lies in the logical grouping of the variables. For example, an album on compact disc is an item with several unique values, such as title, artist, and genre. Although each value is unique, they are part of a logical unit: the CD itself.

A structure represents the CD and a number of properties, or keys, within it. By logically grouping the variables in structures, they can be used as members of a cohesive unit. For example, examine the following structure:



CD=StructNew(); CD.Title = "Cookin at the Plugged Nickel"; CD.Artist = "Miles Davis"; CD.Genre = "Jazz";



To view this structure, the following script can be used:



We have a #CD.Genre# CD called #CD.Title# by #CD.Artist#



This produces:


On the other hand, the StructFind function returns the value associated with the specified key in the specified structure:

We have a #StructFind(CD, "Genre")# CD called #StructFind(CD, "Title")# by #StructFind(CD, "Artist")#

Here is the return:



ColdFusion provides a variety of very handy functions for working with structures, including StructFind used in the CD example above. The StructKeyList function can be used to view (or loop through) a list of the related variables, such as:


A cd consists of

#StructKeyList(CD)#

Structures and Arrays: A Dynamic Duo:



Structures and arrays can be combined to create complex, related data sets that are simple and powerful to use. The CD example provided an interesting way to group three variables logically. However, it only dealt with one CD. For a more complicated example, an online music will be used.


Even though "Cookin at the Plugged Nickel" is a fine album, customers will want to buy other albums as well. If a structure can be thought of as holding multiple properties of an object, then arrays can be thought of as holding multiple instances of an object. When combined, the two produce multiple instances of objects with multiple properties.
What is Call by Value and Call by Reference?
Tel it with simple Example.


When you calling a Person,


"Hey Red Shirt" - Call by Reference

"Hey 420" - Call by Value
Teacher : Which is Bigger Elephant or Ant?





L.K.G Student: Madam! First tel there Date Of Birth!




Teacher : ???
A man in USA sees a dog attacking a lady.







He kicks the Dog and it dies.


Next day in Newspapers:-


The man said i am not an American.


Next day in Newspapers:-


Foreign Hero Saves a Lady from Dog


The man said I am From Pakistan.


Next day in Newspapers:-


TERRORIST KILLS INNOCENT DOG!

Saturday, June 27, 2009

Mini Jokes

1. Begger and Software Engr
Two Beggars meet.Two Software Engineers meet..Both asked the same Question to each other..!.. Guess what..??So.? Which platform are you working on..!
2.Good Idea
Employee said to his Manager : If you don't increase my salary then I'll inform all the staff members in the company that you have increased my salary!!
3.Application Filling
An applicant was filling out a job application. When he came to the question, "Have you ever been arrested?" He answered, "No."
The next question, intended for people who had answered in the affirmative to the last one, was "Why?" The applicant answered it anyway: "Never got caught."

Join us:
http://www.dotnetspider.com?ref=manicse