Saturday, October 03, 2009

Doloto – Download time optimizer for web 2.0 apps

Doloto is an AJAX application optimization tool, useful for large and complex Web 2.0 applications that contain a lot of code. Doloto analyzes AJAX application workloads and automatically performs code splitting of existing large Web 2.0 applications. After being processed by Doloto, an application will initially transfer only the portion of code necessary for application initialization.

Requirements

  • Minimum: .NET Framework 3.5 (in US English only)

Doloto reduced the amount of initial downloaded JavaScript code by over 40%, or hundreds of kilobytes resulting in startup often faster by 30-40%, depending on network conditions

Download and Install Doloto.

Walkthrough Doloto

Thursday, October 01, 2009

Microsoft Security Essentials (MSE), its free!!

Microsoft today officially announced Microsoft Security Essentials (MSE), its free, real-time consumer antimalware solution for fighting viruses, spyware, rootkits, and trojans. Currently being tested by Microsoft employees and a select few testers, MSE is Microsoft's latest offering intended to help users fight the threats that plague Windows PCs.

Its absolutely free and can be used in Windows XP, Vista and 7. Both 32 and 64-bit versions are available.

Features:

  • Remove most-prevalent malware
  • Remove known viruses
  • Real-time anti-virus protection
  • Remove known spyware
  • Real-time anti-spyware protection

Minimum system requirements:

Operating System: Genuine Windows XP (Service Pack 2 or Service Pack 3); Windows Vista (Gold, Service Pack 1, or Service Pack 2); Windows 7

  • For Windows XP, a PC with a CPU clock speed of 500 MHz or higher, and 1 GB RAM or higher.
  • For Windows Vista and Windows 7, a PC with a CPU clock speed of 1.0 GHz or higher, and 1 GB RAM or higher.
  • VGA display of 800 × 600 or higher.
  • 140 MB of available hard disk space.
  • An Internet connection is required for installation and to download the latest virus and spyware definitions for Microsoft Security Essentials.
  • Internet Browser:
    • Windows Internet Explorer 6.0 or later.
    • Mozilla Firefox 2.0 or later.
  • Microsoft Security Essentials also supports Windows XP Mode in Windows 7. For more information see the system requirements for Windows XP Mode in Windows 7

Download Microsoft Security Essentials (MSE)

Sunday, September 20, 2009

Force Validation Using ASP.NET Validation Controls

ASP.NET comes in with a set of validation controls that automatically validate the data entered by a user. Though this validation controls are very powerful and easy to use, they have a small draw back in the sense that they require the entire page to be valid before it's submitted back to the server. There is no direct way to validate only a particular section of the page. This article will explain some circumstances where validating a particular section of page will be required and how to accomplish it.
While validation controls is a great tool for validating user input before data is being submitted there are some situations where we might either want the data to be submitted without validation or we want to validate only particular fields in the form.
A typical example for when we may want the data to be passed through without validation is when a page has both submit and cancels server buttons. When the user clicks the submit button the data has to be validated whereas when the user clicks the cancel post back has to happen without any validation.

The solution for by passing validation on server button click is fairly easy. All we have to do is set the CausesValidation property of the button control to false. Once the CausesValidation property is set to false no validation will happen both on the client side and server side.
The syntax for doing it in the design time is
<asp:button id="cmdCancel" runat="server" Text="Cancel" CausesValidation="False"></asp:button>
This can also be done in runtime using the following code
cmdCancel.CausesValidation = false;

To disable a particular validation control we can use the ValidatorEnable function as shown in the script below
<script language="javascript">
ValidatorEnable(nameofvlaidationcontrol, false)
</script>
To disable all the validation control we need to loop through Page_Validators array and disable each validator as shown in script below
<script language="javascript">
for(i=0;i< Page_Validators.length;i++)
{    ValidatorEnable(Page_Validators[i], false);
}
</script>
In order to enable validation only for particular set of controls when a submit button is clicked we need to combine the above two scripts and call it from the client click event of the button as shown in sample below
<script language="javascript">
function enableValidators()
{
  for(i=0;i< Page_Validators.length;i++)
  {

    ValidatorEnable(Page_Validators[i], false)
  }
  ValidatorEnable(rvState, true);
}
</script>
Attaching the function to the client click event of a submit button
cmdSave.Attributes.Add("onclick","enableValidators();");
When the cmdSave submit button is clicked all the other validators will be disabled and only the validator named rvState will be enabled. If the validation of rvState is successful then the page will be submitted. The code we have used so far will disable the validatiors only on the client side, so the validation will still happen on the server side and error messages will be shown. To disable particular validators on the server side the following code has to be added to the button click event
validationcontrolname.IsValid=true;

Tuesday, September 15, 2009

IE 8: Developer Tools

We definitely start loving IE 8 a lot more than we expected and as we discover newer features in it.

IE 8 includes a add-in called Developer Tools, which will allow you to analyze websites much more better than earlier versions of the browser.

These developer tools can be accessed by going to Tools –> Developer Tools or simply pressing F12 key.

Here are few built in developer tools that are available,

  • Debugging of HTML & CSS
  • Code Search
  • Source viewing
  • Outline elements on screen
  • Controlling caching and cookies
  • Browser Modes.

More information watch this webcast

File Monitoring in .NET

File monitoring applications can be easily developed in .NET using the FileSystemWatcher class. This class listens to changes in files system and raises events whenever changes happen. This article explains how to monitor changes in files and subdirectories of a directory using the FileSystemWatcher class.
The FileSystemWatcher is available within the System.IO namespace. We need to include the System.IO namespace for accessing the FileSystemWatcher class. In order to specify the folder to monitor we have to set the Path property of the FileSystemWatcher as shown below:

FileSystemWatcher fsw = new FileSystemWatcher();
fsw.Path = "c:\\fileWatcher";
If you want to monitor changes to a specific file then the Filter property should be used along with the Path property. The Filter property should be set to file name and the Path property should be set to the path of the folder as shown below
fsw.Path = "c:\\fileWatcher ";
fsw.Filter = "TestWatchFile.txt";
Wild card characters can also be used to specify set of files as shown below
fsw.Filter = "*.txt";
The FileSystemWatcher to begin monitoring we have to set the EnableRaisingEvents property to true
fsw.EnableRaisingEvents = true;

As mentioned before the FileSystemWatcher raises events whenever changes like creation, deletion etc happens to the specific folder or file. The events that are raised by FileSystemWatcher are Changed, Created, Deleted, Error and Renamed.

We need to write appropriate event handlers to handle these events. The FileSystemEventHandler has an argument named FileSystemEventArgs, which provides useful event data. The data provided by the FileSystemEventArgs are ChangeType which gives the type of change that occurred and Path which gives the full path of the affected file or folder.

A sample Changed event handler is given below
fsw.Changed += new FileSystemEventHandler(fsw_changed);
fsw.Deleted += new FileSystemEventHandler(fsw_changed);
fsw.Created += new FileSystemEventHandler(fsw_changed);
private void fsw_changed(object Sender,FileSystemEventArgs e)
{
MessageBox.Show("The file" + e.FullPath+ " was " + e.ChangeType.ToString() + " on " + System.DateTime.Now.ToString());
}

FileSystemObject class can be used to monitor files or folders by setting appropriate properties and handling the events raised by the class.