What is FOR XML AUTO,XMLDATA and ELEMENTS

August 12, 2008

Hi,

As biztalk developer, when in begining of developing you may face problem understanding  what is  difference between FOR XML AUTO,XMLDATA and ELEMENTS.

here in this note i’ll explain you one by one.

  • FOR XML AUTO : is used to represent the actual data in xml format.
  • FOR XML AUTO , XMLDATA : is used to represent the actual data in xml format while generatiing schema.
  • FOR XML AUTO , ELEMENTS : is used to represent the actual data in xml element type which is most suggested method of generating of xml from SQL.
  • FOR XML EXPLICIT : is used to generate complicated XML message where you want result from different tables at that time you can format the result set in correct XML structure via FOR XML Explicit.

for simplify to understand the above please feel free to mail me(vkas_in_guj@hotmail.com) or post me.

Happy coding,

Vikas.


Postback in TreeView Select Node Click

July 12, 2008

if you are facing problem of POSTBACK while working with TreeView Selected Node click, here with this post i provide you one alternative which will work on all three browsers.

follow is the sample code which you can change with your respective code.

TreeNode node = new TreeNode();

node.Text = “<span onclick=’return false;’>”+YourText+”</span>”;

this will force browser to <a href=”javascript:webform_doPostback”…….

please drop your commnet how and in what situation above code helpful to you.


?? operator (C#)

April 2, 2008

The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand. For example:

int? x = null;

// y = x, unless x is null, in which case y = -1.

int y = x ?? -1;

The ?? operator also works with reference types:

//message = param, unless param is null

//in which case message = “No message”

string message = param ?? “No message”;


PreRequesthandlerExecute and Global.asax

February 26, 2008

PreRequesthandlerExecute event is raised before the Init() method of Page or Service called. but it is not true that each and every need session and do not want to utilize their session on the same event when it is raising..

to solve this problem just single line code will helpful..

protected void Application_PreRequestHandlerExecute(Object sender, EventArgs
e)

{

if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState)
{
// your code over here
}

}


A software “build” is a lot more than just compiling the solution - By pressing just F5

January 18, 2008

Many developers don’t use source control and don’t use any automated tools.  This is extremely inefficient and troublesome.  Those on teams are forced to use source control in an effort to share the latest code with all members of the team.  In the source control environments, there is a tacit agreement not to commit any code to the repository that will break the build.  If the build breaks, it hinders the velocity of the other developers on the team because they cannot move on while the build is broken.

What does “build” mean?
Some folks use the term “build” to mean compile, and that is incorrect.  On the teams that use no automated tools, the compile might be the only step in their build process, but the two are still different.  The “build” is a process of taking the source of a software system and making it ready for deployment.  Some teams will manually compile the source and stop before deploying to a development environment.  These teams are short-changing themselves because the only feedback they’ve obtained about the current bits is that there are no syntax or linking errors.  There is no verification that any part of the software functions as intended.  Next, they may manually perform some steps to get all the bits and configuration in order to deploy the system to a development environment.  Then after some manual testing, they’ve obtained some level of feedback.

Let’s compare the above with an Agile build.
Here are some steps that are often performed in the build process of an Agile team - these steps are always automated so they run fast and are repeatable:

update latest code _and dependencies_ from source control.  (automated process will get latest code from the SCC repository)

compile solution (standard compile and link)

copy application files to test location (output binaries moved to location to prep for automated testing)

run automated unit tests. (automated tests produced through TDD or otherwise - give immediate feedback on the state of the system)
automated environment setup to prepare for an integrated test of the system

run integration tests. (gives even more feedback that the integration points of the system are functioning correctly - might include a database)
run regression tests (if you have them - verifies that all past functionality is still working as before - this is a type of integration test)
tag source control with build number if successful (only tag successful builds - discard unsuccessful ones)
Notify development team members of success or failure
Some teams add more steps depending on their needs, and some teams don’t have integration or regression tests suites yet.  Each build process should be developed by the team and tailored to the system.  The above are some of the more common steps that Agile teams include in a build process.

The point of an automated build process is to transform the current code into a working system and get feedback on the current quality as fast as possible.  If the entire process is fast, you will run it often and obtain feedback often.  If it’s slow, you won’t do it often.  The only requirement for the developer is to start the build.  Many Agile teams even automate that step by having a program kick off a build after every commit to the SCC repository.  That process is called “Continuous Integration”. 

At the end of a build, the team should be confident that if they deployed these bits to an environment, it would work.  There still may be bugs discovered, but they are confident that old bugs haven’t resurfaced and the system works at least as good as it did on the last build.  The extra testing steps in the build process ensure that the state of the software is always moving forward.  Without these steps, developers have no way of knowing if a change broke an existing feature.

Feedback is key in a build process.  The team should decide what steps can be added to the build process to generate as much feedback as possible.  My team recently inherited a system with a build duration of 25 minutes.  This is way to slow for us, and our initial goal is to reduce that duration to 10 minutes.  We’ll be able to do this by emphasizing fast unit tests more and doing away with some of the really slow integration tests (that have delicate, cumbersome data setup scenarios).


Be Secure form your side with Encrypted Connection Strings in Configuration Files

January 11, 2008

Introduction :

Connection strings contain sensitive resource access credentials such as user names, passwords and server names. Connection strings stored in plaintext are dangerous, because an attacker that can compromise a server will be able to read those connection strings. Even if a machine is not compromised, connection strings stored in plain text are accessible to administrators and any other users with sufficient privileges on the host machine and/or Windows domain.
How to do this everything….!?!

1. Choose the appropriate configuration provider. Under most circumstances DPAPI will suffice, although the RSA protected configuration is the logical choice in web farms where multiple servers are employed.

2. Identify the configuration sections to be encrypted. Encrypting and decrypting data incurs performance overhead. To keep this overhead to a minimum, encrypt only the sections of the configuration file that store sensitive data.  Encrypt the <connectionStrings> element of the Web.config file to protect the database connection string.

3. Choose the machine or user store. The DataProtectionConfigurationProvider supports machine-level and user-level stores for key storage. The choice of store depends largely on whether or not the application shares a server with other applications and whether or not sensitive data must be kept private for each application.

Machine Store

By default, the DataProtectionConfigurationProvider is configured to use DPAPI with the machine store. Use machine-level key storage in the following situations:

The application runs on its own dedicated server with no other applications.
Multiple applications run on the same server and those applications need to be able to share sensitive information.
To encrypt the connectionStrings section with the Machine Store, run the following command from a .NET command prompt:

aspnet_regiis -pe “connectionStrings” -app “/MachineDPAPI” -prov “DataProtectionConfigurationProvider”
User Store

Use user-level key storage if the application runs in a shared hosting environment and the application’s sensitive data should not be accessible to other applications on the server. In this situation, each application should run under a separate identity, and the resources for the application—such as files and databases—should be restricted to that identity.

To encrypt the connectionStrings section with the User Store, run the following command from a .NET command prompt:

   aspnet_regiis -pe “connectionStrings” -app “/UserDPAPI” -prov “MyUserDataProtectionConfigurationProvider”

4.Encrypt the configuration file data.

For those who using IIS

aspnet_regiis -pe “connectionStrings” -app “/MachineDPAPI” -prov “DataProtectionConfigurationProvider”

For those who using physical path.

aspnet_regiis.exe -pef “connectionStrings” C:\Projects\MachineDPAPI -prov “DataProtectionConfigurationProvider”
Note : Encrypting connection strings with Aspnet_regiis does not change the code required to access the string because the decryption occurs automatically.so no need to include any further logic…!!!?


UrlReferrer. what is it…!??!

January 10, 2008

In code you can see from which url the user came in the UrlReferrer property of the Request.. This always show the url of the last roundtrip, whether smartNavigation is switched on or off. So it will be the url of the page itself on a postback. On the first rendering of the page it will contain the intended page the user came from.

Request.UrlReferrer.AbsoluteUri.Contains(”YourpageNameToCheck.aspx”) == true

{

          // your logic for validate the user.

}


Removing the cache ability of a page in the browser even on BACK button click

January 8, 2008

Hi,

Many a times we do not want browser to show data from cache. For example when user hits the back button of the browser, the browser shows the last page from the cache and does not make a post back to the server. (This is why when some one clicks on the back button of the browser the system looks so fast).

But many a times we do not want the browser to show data from the cache. There are requirements where the data is very dynamic and if browser shows the data from the cache then it can give wrong indication to the user.

Controlling the back button of the browser is not such a good idea because we are trying to stop the user at the client end.  But what we can do is ask the browser to not to cache the page in the client end and always make a call to the server before showing the page.

This can be easily done by expiring the response. Here is the code for the same.

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now);

This will make the browser make a request to the server even when the back button of the browser is clicked.

Vikas Mehta


What is MICROSOFT SOLUTION FRAMEWORK(MSF)..!!?

December 26, 2007

 MICROSOFT SOLUTION FRAMEWORK 

  • Microsoft Solution Framework - MSF
  • Microsoft Operations Framework - MOF
  • IT Infrastructure Library - ITIL
  • Project Management Institute - PMI 

Microsoft Solution Framework (MSF) in order to manage project. MSF has been developed as synthesis of all best aspects of previous methodologies and Microsoft experience in managing internal projects. MSF process model has been describing high-level activity schedule in developing and deploying of IT solutions. MSF has been covering solution life cycle from beginning of the project until its deployment. This helps to the project team to focus on business value of the client. MSF has been using milestones to track project progress. Milestones are markers on the project when important deliverables are finished and ready for evaluation.

Team Model

MSF team model emphasizes importance of clearly defined roles, responsibilities and goals of team members for the project success. MSF team model is flexible and can be adjusted to the scope of the project, size of the team and team members capabilities.

MSF team model defines six different roles with clearly defined responsibilities and goals.

Team acts towards one vision and all team members have been participating equally. Each role has equal responsibility for project success.

MSF team model roles are:

1. Program Management. The goal of this role is to deliver solution within project constraints. The main functional areas are: project management, solution architecture, process assurance, administrative services.

2. Development. The goal of this role is to build according to specifications. The main functional areas are: technology consulting, implementation of architecture and design, application development, infrastructure development.

3. Test. The goal of this role is to approve for release only after all solution quality issues are identified and addressed. The main functional areas are: test planning, test engineering, test reporting.

4. Release Management. The goal of this role is to achieve smooth deployment and ongoing operations. The main functional areas are: infrastructure, support, operations, logistics, commercial release management.

5. User Experience. The goal of this role is to enhance user effectiveness. The main functional areas are: accessibility, internationalization, user advocacy, training/support material, usability research and testing, user interface design.

6. Product Management. This role is focused on customer and customer satisfaction. Role cooperates to Program Management role in defining common project vision. The main function areas of this role are: definition of business value, marketing, customer advocacy and product planning.

MSF flow

MSF team model is based on fact that, in order to be successful, any technology project needs to achieve certain number of key goals in specific sequence. Achievement of each of goals requests different skills and knowledge which are related to specific role.One role is not one person. More people can be assigned to same role, as well as one person can be assigned to more roles.

Process Model

Process model defined order of activities related to the project and represent life cycle of the project.

MSF process model describes collection of activities which are needed to develop and deploy complex solutions. The process if flexible and can be adjusted to wide specter of projects.  

MSF process model consists of 5 phases:

1. Envisioning. To goal of this phase is to create high-level view of the project’s goals, constraints and solution. Team is focused on identification of business problem or opportunities, gathering initial requirements, definition of goals, assumptions and constraints, identification of team skills required.

2. Planning. The goal of this phase is to create the solution architecture and design, project plans and schedules. Team is focused on: finding out as much information as possible, as early as possible, definition of clear image of the solution.

3. Developing. The goal of this phase is to complete features, components and other elements described in the specifications. Team is focused on: writing code, development of infrastructure, creating training and documentation, develop market channels and sales aids.  

4. Stabilizing. The goal of this phase is to improve solution quality to meet acceptance criteria for release to production. Team is focused on: improving solution quality, addressing outstanding issues to prepare for release, make the transition for building features for focusing on quality, getting the solution to a stable state, preparing to release.

5. Deploying. The goal of this phase is to place the solution into a production environment. Team is focused on: facilitating the smooth transfer of the solution from the project team to the operations team, securing customer approval that the project is complete.

MSF process  

for more information you can refer the MSF on http://www.microsoft.com/msf.


Changing the style of your TD with javascript

December 21, 2007

below code demonstrate you how to manage the background of your td with the help of javascript

first register your functions with javascript

function ChangeColorTD(obj)
   {
       ChangeColor(obj,”Selected”,”UnSelected”);
   }
   function ChangeColor(obj,SelectedCSSClassName,UNSelectedCSSClassName)
            {
               
                document.getElementById(”tdGenrralInfo”).className = UNSelectedCSSClassName;
                document.getElementById(”tdResumeDetails”).className = UNSelectedCSSClassName;
                document.getElementById(”tdcolorResumeText”).className = UNSelectedCSSClassName;
                document.getElementById(”tdCurrentJob”).className = UNSelectedCSSClassName;
                document.getElementById(”tdEmployementHistory”).className = UNSelectedCSSClassName;
                document.getElementById(”tdEducationHistory”).className = UNSelectedCSSClassName;      
                document.getElementById(”tdTargetJob”).className = UNSelectedCSSClassName;      
                document.getElementById(”tdTragetLocation”).className = UNSelectedCSSClassName;
                document.getElementById(”tdAdditional”).className = UNSelectedCSSClassName;
                document.getElementById(”tdReference”).className = UNSelectedCSSClassName;
                document.getElementById(”tdDisplay”).className = UNSelectedCSSClassName;
               
                document.getElementById(obj).className = SelectedCSSClassName;     
               
            } 

then put somthing like this in html code.

<td align=”center” id=”tdResumeDetails”>
                                    <a href=”#RD” onclick=”ChangeColorTD(’tdResumeDetails’)”>Resume Details</a></td>
                                <td align=”center” id=”tdcolorResumeText”>
                                    <a href=”#RT” onclick=”ChangeColorTD(’tdcolorResumeText’)”>Resume Text</a></td>
                                <td align=”center” id=”tdCurrentJob”>
                                    <a href=”#CJ” onclick=”ChangeColorTD(’tdCurrentJob’)”>Current Job</a></td>
                                <td align=”center” id=”tdEmployementHistory”>