Archive for September, 2009

LogParser : Parse your log files easily

September 25, 2009 Leave a comment

Download location.

This simple utility given by Microsoft comes in handy at crucial times. I thought of blogging about this after I saw this Scott Hanselman’s list of power tools for 2009.

This utility helps to query the log files like system log, event log, IIS logs or for that matter any custom log files that are in the format of CSV: comma separated or tab separated. Other custom formats are supported too.

For example:

Lets say I have a file with the following comma separated entries.






And the name of the file is “namelist.log”

I can use logparser.exe to just query the text file.

List all records

logparser “select * from namelist.log” –i:CSV

The above command will result in the list of all values in the text file. See the below image.


The query engine used in this logparser is equivalent to SQL engine so that you can use where, group by and order by clauses

List selected fields with where clause:

If we want to list the records that have age greater than 20, we could just use this query

logparser “select firstname,lastname,age from namelist.log where age>20” -i:CSV 


List selected fields with where clause and output to a CSV file:

The following query lists the same records as the previous query but this also saves the result to a CSV file.

logparser “select firstname,lastname,age into agegrt20.csv from namelist.log where age>20” -i:CSV                                                          


The output will be written to the physical drive (the same path from where this utility is being run).

This utility is extremely useful to parse and read the clumsy log files that are both custom created by us and created by the system. Since the query engine is more powerful it is easier to use the queries directly on the file with out having to dump the file to a table in database. We had a 7 MB log file that had number of entries on user action. We had to extract the list of actions done by the user on a particular file. We will need to use like statement more than once in the query. This log parser parsed the file and gave us the exact result with in 11.2 seconds.

Nice handy tool! Happy parsing!

Gorilla holding banana

September 24, 2009 Leave a comment

Today I read a blog entry from Joel Spolsky about Coders at Work. Joel says that the content he blogged is the first chapter from this book. I like Joel’s writing a lot. I love his book Joel On Software. If you have never read it, now go buy it! I highly recommend it.

After his introduction about this book Coders At Work, I did some search and found that it is not available in Kinokuniya-Singapore, Border-Singapore and Singapore Library.

So I did even more search to know more about this book and then I found this one.I cannot stop laughing when I read Joe Armstrong’s comment about Object Oriented Languages:

“The problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.”—Joe Armstrong

Ha! Ha! Ha! Laugh your  heart out! What would Martin Fowler reply to this? I really want to know.

Categories: BOOKS Tags: ,

WebSiteSpark: Spark of hope for Small companies in this downturn

September 24, 2009 2 comments

Today Scott Gu announced yet another cool program from Microsoft called WebSiteSpark.

What is WebsiteSpark?

WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others.  It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the open source applications built on top of them.

Technology Offering

For design, development, testing and demonstration of new websites – for a total of up to three users per Web design and development company:
• Visual Studio Professional
• Expression Studio 2 or 3 (1 user) and Expression Web 2 or 3 (up to 2 users)
• Windows Web Server 2008 or R2 (when available)
• SQL Server 2008 Web Edition
For production use – that is, to deploy and host new websites developed using Program software – using a total of up to four processors per Web design and development company, of the following (physical or virtual) dedicated servers:
• Windows Web Server 2008 R2 (when available)
• SQL Server 2008 Web Edition
Deployments may be on 4 servers or VMs of 1processor each, on 2 servers or VMs of 2 processors each, or on 1 server or VM of 4-processors.

Note:This includes up gradation of latest software. For example if VS2010 is released you will get VS2010.

Responsibilities of the company or individual

Companies participating in WebsiteSpark must:
• Enroll on the WebsiteSpark website and maintain an up-to-date profile on the WebsiteSpark website.
• Renew their membership on an annual basis.
• Report the new websites they deploy using Program software (including at least one within six months of joining the Program).
• Agree to abide by WebsiteSpark terms and conditions, per the:
o Program Web developer and designer (Web Pro) Agreement and Program License Terms
o Microsoft Partner Network (MPN) agreement
o Program website, including Terms of Use and Privacy Statement as well as this Program Guide
o if choosing to self-host their websites, the SPLA (Service Provider License Agreement) Essentials agreement.
• Pay a USD $100 Program Offering Fee at the end of their participation with WebsiteSpark

Support for the software?

It also includes product support (including 2 professional support incidents) and free online training for the products.

Eligibility to join?

WebSiteSpark is available to independent web developers and small web development companies.  The only two requirements to join the program are:

  1. Your company builds web sites and web application on behalf of others.
  2. Your company currently has less than 10 employees.

For more information visit WebSiteSpark now!

This will surely help small start-up companies in some developing countries. At least, I guess this will help small companies to come out of their illegal usage of pirated software. They must use this opportunity.

This reminds me of what Reliance did few years back in India. Some 10 years back there was only BPL which provided cell phone services in India and they were charging for incoming calls too. Then all of a sudden, after 2 years, Reliance came in to the market and offered cell phones for just Rs 500 and most interestingly didn’t charge for incoming calls. This changed the way how the cell phone market worked for ever in India. Needless to say that Reliance did all these things, not on good will but to get dominance in the cell phone market.

Anyway, tricky things apart, this cool announcement looks highly motivating for small companies. What do you guys say?

Microsoft’s CodePlex Foundation

September 24, 2009 Leave a comment

Microsoft announced the CodePlex Foundation yesterday.

The CodePlex Foundation, a non-profit foundation formed with the mission of enabling the exchange of code and understanding among software companies and open source communities, launched today, September 10, 2009.

So what’s the difference between CodePlex Foundataion and

CodePlex Foundation is an extension of the CodePlex brand established by has not only built a strong community, with more than 10,000 projects now hosted on the site, but has steadily built a recognized brand. launched in June of 2006 out of a need for a project hosting site that operated in a way that other forges didn’t – with features and structures that appealed to commercial software developers. The next chapter in solving for this challenge is the CodePlex Foundation ( The Foundation is solving similar challenges; ultimately aiming to bring open source and commercial software developers together in a place where they can collaborate. This is absolutely independent from the project hosting site, but it is essentially trying to support the same mission. It is just solving a different part of the challenge, a part that isn’t designed to solve.

Well, I didn’t get it exactly. But one thing is clear Microsoft, after years of learning right from the release of .Net beta in 2001, has finally learnt the importance of open source projects.

I still remember the fight I had with my manager in 2005 to implement ajax using the open source project Ajax.Net for framework 1.1. My manager was so skeptic about this third-party not so professional (in his eyes!) framework. But I won finally and we used it in a major project. That project was a success and it is still running fine.

But this is long back. Now the situation is changing rapidly. Organizations are opening up to open source projects; else how would NHibernate and Spring.Net would have been embraced like this? Let alone ASP.NET.MVC, we’ll have to wait.

What I like most with open source projects is this: Open source projects can be influential up on Microsoft. They make Microsoft to learn and adopt to the trends.

Scott Bellware says Microsoft has donated one million dollars to this foundation. In all perspectives, Microsoft’s change in direction looks promising. And this change is for good I hope.

Best books for .Net development – My Recommendations

September 24, 2009 Leave a comment

Today my manager asked me to list some good technical .net books on which our management had planned to invest.

I always had a wish list for technical books; I could easily  arrive at a list.

I categorized the books as follows:

  1. Programming.Net (That helps core programming. Mostly on C# core and ASP.NET core)
  2. Design/Architecture/Guidelines (Design Patterns, Best Practices, Modeling Patterns)
  3. Concepts (General concepts for programming, UI design)
  4. Source control / Build & deployment

I didn’t cover books on WCF/WPF/Silver Light/RESTful services/ASP.NET MVC/Entity Framework as I don’t have enough knowledge on those books.

Programming .NET

  1. CLR via C# by Jeffery Richter
  2. Programming Microsoft Visual C# 2005: The Base Class Library by Francesco Balena
  3. Professional ASP.NET 3.5: In C# and VB by Bill Evjen
  4. Programming .NET Components by Juval Lowy
  5. Debugging Microsoft .NET 2.0 Applications by John Robbins
  6. Professional ASP.NET 3.5 AJAX by Matt Gibbs

Design / Architecture / Guidelines

  1. Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries by Krzysztof Cwalina
  2. Microsoft® .NET: Architecting Applications for the Enterprise (PRO-Developer) by Dino Esposito
  3. UML Distilled: A Brief Guide to the Standard Object Modeling Language (3rd Edition) by Martin Fowler
  4. Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives by Nick Rozanski
  5. Practical Guidelines and Best Practices for Microsoft® Visual Basic® and Visual C#® Developers  by Francesco Balena
  6. Agile Software Development, Principles, Patterns, and Practices by Robert C. Martin


  1. Don’t Make Me Think: Common Sense Approach to Web Usability, 2nd Edition by Steve Krug
  2. The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt
  3. Code Complete: A Practical Handbook of Software Construction by Steve McConnell

Source Control / Build

  1. Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build by Sayed Ibrahim Hashimi
  2. Professional Team Foundation Server by Jean-Luc David

Any other suggestions guys, particularly for web services, security and unit testing?

Architect: Solutions and Leadership

September 23, 2009 Leave a comment

One of the teams I know had some problem with file storage implementation in their project. The problem was very clear: they need some kind of algorithm that helps the user to upload and store some files in a physical location in the server. However there are few constraints in this requirement. After landing in the screen the user may choose to modify the screen and therefore he comes to EDIT mode. Only in this mode the user will be able to upload a file – a file as new one or a file that replaces the old one. The user may cancel the EDIT mode and go back to VIEW mode. Here comes the problem. When the user clicks cancel and comes back to VIEW mode, the new files uploaded by him during this short session VIEW-EDIT-VIEW must be deleted from the server. The files he replaced must be reverted back.

The developers had used datasets to persist data (files) between postbacks. So when the user clicks cancel the un-committed data can easily be discarded. They have used cache too. Cache behaves weirdly at times. For this kind of storage one must never use cache. Cache must be used to cache the application data and not user specific data. Since this is out of our topic we will deal with this later.

Since the cache started to behave weirdly, as a quick solution, one of them had changed the implementation from Cache to Session. At least session does not behave weirdly. This solution clearly would downgrade performance if the number of user increases and each one of them tries to upload file and might lead to crash.

Of course developers knew this. So after that test release, the developers called on a meeting with their architect and asked for a new solution. The architect was very furious at first when he heared that the developers had used Session to store the file. Then he proposed a solution.

Just store the file name in session and save the actual file only when the user clicks SAVE when he is in EDIT mode. Use javascript to read the file from the client machine. Doh! And when the developers asked for another solution; the architect didn’t have one. He was saying that is the only possible way.

Javascript requires special permission to read the file from client machine. Even though this application is only for intranet users, still this would require a change in user browser settting which will subsequently create a hole in company’s security policy. Developers rejected the solution just like that.

Here the architect said “As far as I know that is the only possible way”. For every problem in the world there are surely more than one solution.If the architect does not know other solutions then he must look for them.

An architect is a leader. He must earn the respect of his fellow programmers. If he didn’t earn the respect, the developers will lose confidence in him and will continuously reject his solutions. When the developers reject architect’s solution then it is a career-limiting thing not for the programmers but for the architect. The architect has to sell his ideas – to the development team and to other stake holders or he must give “sellable” ideas.

Categories: Architect, Architecture

Programming for Beginners

September 22, 2009 Leave a comment

Really there are cool changes happening in Microsoft.

Today I learnt about this exiting new site for beginner programmers (from Scott Hanselman ) which was created to educate the beginner programmers. I know quite a few beginner programmers to whom I would send this link. If you guys know some kids/beginners, do the same.

As expected there are different tracks waiting for the beginners to choose from
1. Web Track: This track covers everything the beginners need to learn about how the internet works and how to create great (!) web applications. There are some tips and tricks too that would give more insight.
2. Windows Track: Great place to learn windows programming, graphics etc.
3. Aspiring Professional: After mastering basics of programming, the beginners can utilize this place to gain more in depth knowledge. There are some advertisements and tricks done here to make beginners spend money on training and upgrading to professional visual studio from free visual studio express.
4. Kids Corner: Why the kids always get the corner? No don’t think this corner is only for kids. This also includes video tutorials for Parents and Teachers who wants to teach the kids.

Beginners can choose either tracks 1 and 3 (web developer) or 2 and 3 (windows developer) or 1,2 and 3 (know-it-all, web-windows developer).

Beginners must install Silverlight to watch and learn all these videos; which is free and can be installed by clicking on the “Silverlight: Click to install the required version”.I think, Microsoft is violently marketing Silverlight. Cannot blame them, they are actually running out of time. They need all the machines to have Silverlight, only then they will be able to tackle the fierce competition from flash. Anyway this is out of our current topic.

There are really quite a lot of learning resources available now for kids and students who really want to do some programming. It is not like the time when I studied programming in my college. Few weeks before I and my friend Sajid were talking about this problem.

One of Sajid’s friends was doing a part-time job of “helping” university students to develop their projects. Actually he is not just helping; he is developing the whole project and selling it for a cost. This is not helping really. This actually spoils the kid and never gives him a chance to learn on his own.

@“Helpers”: Never and ever develop and sell projects to university students. If you have free time try to educate them and give pointers to learning resources.

@“Kids / Beginner Programmer”: Don’t rely on the “helpers”; there is lot of resources available now in the internet. Use them and build your own career. Happy programming!

Categories: .Net, ASP.NET