Tuesday, November 18, 2008

Now blogging at the official trg tech blog

I have recently started blogging on the official blog of my company; trg tech.

We plan to share the experiences of trg techies at trg tech on the official trg tech blog. Other than the technical stuff, you will also find words from the recruiters and others at trg tech in order to get to know about the lifestyle of trg techies at their very own company i.e. trg tech.

Hope you would like the posts over there too. Its http://trgtech.blogspot.com.

Wednesday, September 03, 2008

Google Chrome – Web Browser for the Next Generation of Web Apps

Google Chrome is available for download from today!

It’s a brand new web browser by Google for those who love GMail, Google Docs and other JavaScript centric web applications; applications which have truly proved the very essence of Web as a Platform.

Google Chrome is yet another examplification of the simplicity and elegancy of Google’s User Interfaces. It’s fast, it’s speedy and it’s yet another innovation on part of Google in terms of its memory management and JavaScript execution. It considers every tab and every website as a separate process. Google has definitely created a benchmark in Web Browsers.

It has got features that are very useful for Web2.0 Engineers. It has got built in DOM Inspector, JavaScript Debugger, Network Traffic Analyzer, Memory / CPU / Network Profiler so that you can precisely know which web app or web page is taking more memory, CPU or bandwidth.

Google has not just engineered this whole thing but have presented the whole concept behind it in an equally superb way. Read the full story of Google Chrome at http://www.google.com/googlebooks/chrome/# to explore what it actually is.

Sunday, August 17, 2008

How To: Setup JavaScript IntelliSense for ExtJS in Visual Studio 2008 (SP1)

One of the much awaited features incorporated in Visual Studio 2008 Service Pack 1 is the JavaScript IntelliSense support for 3rd Party JavaScript Frameworks like ExtJS, jQuery, Prototype etc.

Now you can add references to your 3rd party libraries in you JavaScript files and JavaScript blocks, and Visual Studio 2008 (on installation of Service Pack 1) will start recognizing the classes and functions defined in those libraries.

In order to setup ExtJS JavaScript IntelliSense you just need to add the following lines (/// reference tags) in your JavaScript files or script blocks to make it work. (Adjust the relative paths to the two JavaScript files as per your website hierarchy)

And here is the outcome; ExtJS based classes are now available in IntelliSense

Moreover a variable that’s initialized as with ExtJS based Store is now showing the respective methods of Ext.data.Store class in IntelliSense

I have updated the ASP.NET AJAX with ExtJS sample to incorporate this JavaScript IntelliSense feature. You can download the updated code sample from here.

What I can say about this feature is; it is simply a superb addition in Visual Studio feature set and will definitely increase the popularity and penetration of JavaScript based frameworks and libraries.

Wednesday, July 02, 2008

TRG Tech Talk Series: “AJAX – Inside Out”

I gave a presentation at my company in connection to the new Tech Talk series initiated by TRG TECH. I was honored to be the very first one to have a Tech Talk in this connection. The topic I chose for this first Tech Talk was “AJAX – Inside Out”. The reason for choosing this topic was to build the foundation for our upcoming Tech Talks on engineering rich, interactive user experiences over the web which me and my team will be conducting in a month or so.

My presentation covered everything related with AJAX including
  • Web 2.0
  • XMLHTTPRequest
  • Hidden Frames
  • ASP.NET AJAX
  • JSON
  • Programming Model of ASP.NET AJAX
  • Server Centric Programming Model
  • Client Centric Programming Model
  • Trade Offs of the two Programming Models
  • Supporting tools for Web 2.0 developers for analyzing the network traffic created by your web app, manipulating DOM, styles and other aspects of your web app and browser.

The supporting tools for the debugging and analysis included the following

I also gave three demos/code walkthroughs during the course of this presentation one on each of the XMLHttpRequest, UpdatePanel and PageMethods.

The feedback and response was overwhelming and the hall remained jam packed till the end :)

You can download my presentation from here so as to have a deeper look at it and get better insight of AJAX really from inside out.

Sunday, June 29, 2008

Emprise JavaScript Charts with ASP.NET AJAX

I am a big fan of ExtJS for engineering rich interactive user interfaces for all the data centric web2.0 based applications, but one of the components that’s missing in ExtJS is the charting component. I consider ExtJS as a comprehensive java script based UI Framework but still they haven’t focused on providing Java Script based charting controls so far.

Most of the charting controls I came across are server centric and require the chart image to be transmitted to the web browser; others require some plug-in (Flash Player etc) to be installed on every client machine or some other limitation.

I came across EJS Charts (Emprise Java Script Charts) some time back and found it really useful in fulfilling the gap in the graphical data presentation needs over the web by presenting these charts in an equally responsive fashion like the data.

The good things about them are

  • They are purely Java Script based charting controls, doesn’t require any plug-in to be installed on client machines
  • They are pretty much interactive; provide features like zooming, mouse hints etc.
  • Just provide them with the data in java script (arrays, xml, csv) and they will render the specified chart at the client end.
  • Series can be added to / removed from an already rendered chart so as to get the affect of a continually updating chart.
  • Minimizes the overall network traffic generated by the web app, they require transfer of just the data between the server and web browser and not the complete chart in image format.
  • Programming model is fairly simple.
  • Works with all the modern browsers i.e. Internet Explorer 6 and above, FireFox 1.5 and above etc.

The bad things about them are

  • They don’t provide extensive range of chart types as provided by other server side charting controls, but I hope that they will mature over the period of time.
  • They are not widely spread so far; people are really un-aware that this thing can happen at the client end too.

Here is the simple sequence of steps you need to follow in order to utilize these web2.0 Java Script based charts in ASP.NET AJAX.

  • Call the server method to get the data (e.g. List<keyvaluepair<string,int>>) from the ASP.NET PageMethod (if required, otherwise use the data got from the last call to the server method) and hook the callback for it.
  • In the callback function, check if the EJS based 'Chart' object is already defined, if not then define one. The constructor of that EJS Chart takes a div id where it needs to render the generated chart. You can optionally specify other properties in the constructor for the chart in order to customize title, captions, hints, legend, gridlines and other visual and behaviour related properties of the chart. If a series is already added in the previosuly generated chart, remove it so that the new series as per the user selection can be added to the same chart instance.
  • Transform the data returned from the Server (e.g. List<keyvaluepair<string,int>>) to an ordinary 'Java Script Array'
  • Define the EJS based 'Chart Series' (LineSeries, BarSeries or AreaSeries etc) as per the user selection and supply the array you have just created as the datasource for the chart.
  • Add this 'Chart Series' instance to the 'Chart' instance

Here are the images of the charts generated from the sample code I have uploaded for you to have a look at and experiment.



You can download the sample code that uses EJS with ASP.NET AJAX (that present different graphical representations of data based on user selected chart type) from here. Please note that the sample code uses ASP.NET 3.5 (December Extensions Preview) and EJS Personal Edition (EJS personal edition has got a few limitations too, read more about those from here).

Tuesday, April 22, 2008

FxCop – Automated Code Review for .NET Assemblies

I have been using FxCop on and off, for quite some time now, for the automated static code review of .NET Assemblies for possible design, security and performance issues (inefficient string manipulation / comparisons, unused utility functions, unnecessary casting, security vulnerabilities etc).

I would recommend it to all those, who want to cross check their .NET Assemblies conformance, with the Microsoft’s Best Practices and Design Guidelines. What it actually does is that, it has a rule base of more than 200 rules organized in different categories, against which it inspects your .NET Assembly. You can selectively check your assembly for performance and security issues or you can specify whether you want to skip the Naming Rules conformance for a particular code analysis run or not.

Once installed and opened, you only need to do is ‘Add Target’ to your new project; target is the .NET Assembly (dll / exe) you want to inspect. Once you have added the Target(s), press ‘Analyze’ button in FxCop toolbar. Once the analysis is done, it will provide you with a granular report, drilled down to function level for the possible issues in your code. The good thing is that, it won’t only report the issue but will also report the reason and possibly the recommended fix for it!

Once you will start using it, you will eventually learn from it and will definitely avoid making those mistakes in future development. You can download latest release of FxCop from here.

Saturday, February 09, 2008

How To: “Getting Started with C# 3.0”

Here is my suggested approach on how to get started with C#3.0. This strategy is advised to be followed by those who are seasoned programmers in .NET 1.1 / 2.0, and now they want to get their hands on C#3.0. It’s quite an easy migration as far as the core language enhancements in C#3.0 are concerned. One can get a good know how as well hands on experimentation of the new features in a matter of hours.

So here go the steps on how to get started with C#3.0.

C#3.0 Language Specifications
Go through the C# 3.0 Language Specifications. It’s just a 26 page document, containing each of the new feature definition as well as the code samples. If you have been working in C# 2.0, you can go through it in a matter of 3 hours.

I don’t want to reproduce what ever is in the above document, but just to give you an idea that there are only a few additions in C# 3.0 and those are the implicitly typed local variables, extension methods, lambda expressions, object initializes, anonymous types, implicitly typed arrays, query expressions and the expression trees. These additions serve as the foundation for LINQ (Language Integrated Query) and make the code concise.

You can download the C# 3.0 Language Specifications document from here.

C#3.0 Language Enhancements Hands On Lab
There is a comprehensive hands on lab exercise outlined by Microsoft, and that’s too isn’t that long, and would only take a few hours to go through and experiment, for a seasoned programmer.

You can grab the complete script of the Hands on Lab from here.

Friday, February 08, 2008

“Best Developer” Award by TRG; The Resource Group

I have been recently awarded the “Best Developer” accolade by my company, TRG; The Resource Group at the Annual Employee Appreciation Day 2007 on 3rd Feburary 2008.

It was a total surprise for me and unfortunately I missed the ceremony (was out of town) :( but still it’s always a good feeling, to be the one amongst the hundreds :)

Thursday, January 17, 2008

The much awaited .NET Framework source code is finally available

The source code of .NET Framework is finally available under a read only reference license, enabling programmers to browse the source code and debug their programs more deeply and effectively.

It seems that now the code of .NET Framework is so mature that they are releasing it for public. Let’s see how the proponents of open source perceive it.

Currently the following libraries have their source code available for browsing and debugging.

  • NET Base Class Libraries (including System, System.CodeDom, System.Collections, System.ComponentModel, System.Diagnostics, System.Drawing, System.Globalization, System.IO, System.Net, System.Reflection, System.Runtime, System.Security, System.Text, System.Threading, etc).
  • ASP.NET (System.Web, System.Web.Extensions)
  • Windows Forms (System.Windows.Forms)
  • Windows Presentation Foundation (System.Windows)
  • ADO.NET and XML (System.Data and System.Xml)

More and more libraries are said to be included in the above list.

You can refer to the the post by Shawn Burke on how to configure your Visual Studio 2008 to debug the .NET Framework Source Code.

Wednesday, January 09, 2008

FireBug + YSlow for Mozilla Firefox: A must use tool for all Web2.0 developers

I have been very keen in improving the response time of web applications and used to postmortem the web applications from the perspective of their initial load time, overall network traffic created, number of requests sent and the overall network traffic created to perform an action and a number of other parameters.

In order to perform this postmortem, the Mozilla add on in the name of Firebug comes in picture and really provide very useful and good enough information on the overall network traffic created, contents of each of the user request / server response, runtime inspection and modification in the CSS, HTML and Javascript of the currently viewed web page, JavaScript Debugger support for the java script statement “debugger;”, DOM Inspector and much more.

Thus, using this tool (Firebug; Mozilla Firefox Add-on), a Web 2.0 developer can very easily analyze which user action creates how much traffic behind the scenes using AJAX, which user action is performed at the client side, how much requests are generated for each user action, what’s the size of request / response for a user action and other such stuff related with the debugging of Java Script, modification in CSS and DOM Inspection. So, I would recommend every web developer who is involved in evaluating the different UI controls to be used in web applications or other such tasks related to improving the overall user experience of a web application to try this add-on; FireBug on FireFox. A snapshot of this tool, is shown below.



There is in add-on in FireBug in the name of YSlow. That provides information on how to improve the performance of your website. This add-on is by Yahoo Developer Network and automates the verification of all the Consideration for High Performance Websites in this single tool. This not only verifies and ranks the website against the said Best Practices for High Performance websites, but also provides information on what’s wrong and what you can do to improve the performance. A snap shot of the YSlow Addon of Firebug is shown below.

Something similar but with relatively lesser features is the IE Developer Toolbar, which Internet Explorer centric Web 2.0 developers, should definitely have a look at and experiment with. [Added: 22nd April 2008]

Another easy to use tool out there for Internet Explorer to perform a similar analysis of web applications (a bit buggy on I.E 6 at least on my machine) is the Web Development Helper by Nikhil Khotari. Below is the snapshot of that.

Tuesday, January 08, 2008

ASP.NET 3.5 Extensions Preview: Dynamic Data Websites Part 1, Engineering Data Centric Web Application from End-to-End

I hope you have gone through my last post that lists all pre-requisites for this tutorial and have prepared the development environment, on how to get hands on with these tutorials and walkthroughs on the newly added features in ASP.NET 3.5 Extensions Preview.

Here comes the very first tutorial in the series that’s on the Dynamic Data Websites. The reason for starting the ASP.NET 3.5 Extensions Preview tutorial series with this Dynamic Data Websites feature is to demonstrate how quickly you can engineer a data centric web application with the newly added features of ASP.NET 3.5 Extensions Preview. You will learn that the overall code required to be written by the end developer is reduced to the extent that one merely needs to write a few lines for any custom business rules or any customized view of the data which one may require as per the custom needs.

The pre-requisite, the portion I will not be covering in this tutorial for engineering a data centric web application from end-to-end is the designing of the database. I will assume that you have your database designed, tables and relationships with Primary and Foreign Keys created. The database I will be using for my tutorials as stated in the last post is the well known, Microsoft provided “Northwind” database.

So let’s start with the step by step walkthrough, in this part of Dynamic Data Website walkthrough I will be covering on how to engineer a web application with the built-in templates and features as provided by Microsoft in the ASP.NET 3.5 Extensions Preview. In the next post I will demonstrate on how to customize the generated web application by incorporating custom business rules and designing custom views as per the custom needs of your business. So, let’s get started with the step by step procedure.


  1. Create a new website, by clicking the “New Web Site” item in the “File” Menu. A dialog box titled “New Web Site” appears. Select the “Dynamic Data Website” from that “New Web Site” dialog box and set the location for that new Dynamic Data Website. Here I name the website “DDWDemo” i.e. Dynamic Data Website Demo.


  2. A new website containing the files/structure as shown below is created.


  3. Now we need to add database to our web application, for that I create the App_Data folder in my web application and drag n drop the mdf file of the “Northwind” database to it.


  4. Now we have our database added to our web application. I will start with generating the Business Entities for my Northwind database, so that I map my data in the Relational World to my Object Oriented World, and doing so is facilitated by the “LINQ to SQL Classes” feature of the ASP.NET 3.5 Extensions Preview. I will create a new LINQ to SQL Classes instance, which are internally mapped to relational objects, by right clicking on my website and selecting Add New Item. I select the LINQ to SQL Classes template and name it SCM.dbml (here SCM stands for Supply Chain Management and not the Software Configuration Management) and click Add. A prompt appears asking me to automatically put the files in the App_Code folder; I click on ‘Yes’ for it, and my LINQ to SQL Classes files is added in my project. This file provides me an Object Relational Designer through which I can easily generate my DataContext Class as well as the ADO.NET Entity Classes.



  5. Now what we do is that I double click on my Northwind database in the App_Data folder, it will open the database in the Database Explorer. I expand all the tables under it, select all the tables and drag and drop them on the left pane of the SCM.dbml file, that’s the object relational designer surface to auto generate my Data Classes for all the tables I have dropped on it. It will also automatically create the relationships among the generated classes by improvising them form Primary / Foreign Key Relationships in the Database. You can view the code generated by this action by expanding the SCM.dbml file and browsing the SCM.designer.cs file. The SCM.designer.cs file will contain the definition of SCMDataContext that allows access to all tables and handles the CRUD operations on the Business Entities through LINQ queries, moreover the SCM.designer.cs file contains definition of all the business entities, which are actually the ADO.NET Entities. One thing to note about them is that these generated business entities are defined as partial classes and also provides some extensibility methods (we will learn using them in part 2 of this tutorial).

  6. So, by now we have our Business Entities defined which are directly mapped to the Tables. Now we need to present them in a good way to the user so that User can perform the CRUD (Create, Read, Update and Delete) operations on these. This is facilitated by the use of templates defined in the Dynamic Data Website template. What we need to do is to set the enableTemplates attribute of the dynamicData section in web.config file to true. I can also optionally set the dataContextType attribute of dynamicData to SCMDataContext. So here, what I have done is that I have enabled the templates for the List and Details view of all the Business Entities defined in the SCMDataContext. By default it will use the ListDetailsTemplate.aspx for all the business entities. The ListDetailsTemplates.aspx is defined in the subfolder App_Shared/DynamicDataPages so that I can customize it to give a personalized look and feel. This template uses the master page defined in the website as MasterPage.master which I can customize too for the personalized look and feel; here I customize the main heading of the website to be ‘Supply Chain Management’ instead of dynamic data controls site. Just a food for thought that the ListDetailsTemplates.aspx uses the newly introduced Dynamic Data Controls and I would recommend having a look at these templates to get some idea on how it’s utilizing the features of ASP.NET 3.5 Dynamic Data Controls behind the scenes.


  7. Now, start the web application by clicking on the Start Debugging button in the toolbar of Visual Web Developer 2008. A prompt stating the Debugging isn’t enabled, simply click OK button on it to enable debugging and a web application with the default templates appears in front of you.

So, here in this tutorial, we have learnt on how to generate a Data Centric Web Application using ASP.NET 3.5 Extensions Preview, in a few clicks. In the second part of this tutorial which I will be posting in a day or two, I will demonstrate on how you can customize the Views for some of the entities, use some other template for some other entities as well as enforcing you custom business rules in the Business Entities.

You can download the complete source code of this walkthrough as a single package from here.

Wednesday, January 02, 2008

ASP.NET 3.5 Extensions Preview: Walkthroughs, Tutorials and Code Samples

Long time, no posts!!!

With the release of ASP.NET 3.5 Extensions Preview a couple of weeks back, I have been busy in experimenting with the new features and controls added in this very first preview of ASP.NET 3.5 Extensions.

The new additions like Dynamic Data Websites, Dynamic Data Controls, LINQ to SQL, ADO.NET Data Services and their invocation using AJAX, LINQ enhancements, ASP.NET AJAX enhancements definitely added sufficient enough data points to the proponents of ‘Using ASP.NET for RAD’.

Having said all that, the ASP.NET 3.5 Extensions Preview also includes the first public preview
of the much awaited built-in ASP.NET MVC Framework as well, the final release of which is expected in first half of this year. The addition of this built-in ASP.NET MVC Framework added a sound Architectural Pattern to the ASP.NET Web Development portfolio and it not only enforces the separation of concerns but also facilitates TDD that’s the need of the hour.

Earlier this week I have been presenting the said new additions in ASP.NET 3.5 Extensions to my office colleagues in successive training / tutorial sessions titled “What’s new in ASP.NET 3.5” on each of the newly added features and they went great and, from now I will be posting the scripts / walkthroughs with code samples of all those sessions over here by this weekend, for my office colleagues in particular and rest of you in general.

I used the well know “Northwind” database in all the tutorials so that I every one has the general idea of the DB Schema. For your convenience I will be including the Database files in the sample codes of each of the tutorial as well, in order to provide you a single code sample package for each of the tutorial.

In the mean time I would recommend all of you to prepare the Development Environment for those tutorials and walkthroughs accompanying the code samples which I will be posting by this weekend. All you need to have on your system is the Visual Studio 2008 and the newly released ASP.NET 3.5 Extensions Preview. If you don’t have Visual Studio 2008 then for the time being you can go with the free Visual Web Developer 2008 Express Edition as well instead of Visual Studio 2008. You can download Visual Web Developer from here and the ASP.NET 3.5 Extensions Preview from here.

Keep your fingers crossed for Walkthroughs + Code Samples on Dynamic Data Websites, ADO.NET Data Services, LINQ and last but not the least the ASP.NET MVC Framework.