Power of Unix on Windows
I am an ardent admirer of console commands. For a very fast execution of the most simple tasks, I rely on cmd. About an year back I saw my tech architect using Grep on windows. Until then I didn't know how effective it could be on Windows platform. At that very moment I downloaded unix-utilities for windows. I have realized its power many times in my profession. Very often it is required to find a few pieces of information from a pile of XML logs occupying around 20 Megs on my system. I wonder if I could have done it if I were not having the power of unix on windows. A variety of utilities are available for most of the tasks. Undoubtedly, my favourite is grep because of its splendid blend of simplicity and power.
I like powershell too, but for simple tasks it seems like an overkill. I am not an expert of powershell but for simple task of finding some information recursively, I think grep is great. The command is simple and execution is very fast.
With the evolution of powershell, it seems micrososft is empowering users with powerful console commands. WMI is good but still it was not a general purpose scripting platform. Powershell leverages both its potential for managing windows and perform quick one line commands. I like a few of the commandlets available in powershell like "ps" is a quick way to dump all the available processes with relevant information. Powershell becomes really fun when one has the PowerShellPlus which is an interactive scripting environment for powershell which also has intellisense support.
If you do not like default appearance and behaviour of Command prompt, which has not changed much since the DOS era, then go for Console. It is an excellent piece of open source creativity which gives better control on command prompt as Linux users have always enjoyed. It allows multiple tabbed console prompts, coloured background with custom picture and true alpha blending.
Please share your experiences and suggestions.
Quick script in C#/VB and validate LINQ Expressions
I have been trying to push myself for learning LINQ and Lambda expressions for quite some time now. I try to create some dummy projects sometimes but since our current project is being developed in .NET Framework v2.0 so these very new things get out of touch very soon. Also, there is so much happening around in the field of technology that keeping track of technological innovations in .NET field alone gets tough with the given schedule.
I was looking for ways to get chance to work on LINQ in the office itself. Recently I found a great utility for that purpose. It is called LINQPad.

It is a very good utility which could be used to evaluate LINQ expressions on the fly. It can also be used for quick scripting in C# and evaluate the outcome. To do a quick analysis of some syntax I normally use Immediate Window in Visual Studio but it is only applicable for one liner simple statements.
If you need to write a snippet and evaluate it then Immediate Window will not be very helpful. LINQPad can do that job for me. I can write quick code snippets and evaluate the output very quickly. Currently it supports both C# and VB.NET. It can also give you the SQL and Lambda expressions for the LINQ queries provided.
Interestingly, you can also integrate nHibernate with LINQPad. Follow this link.
It indeed is a great utility which meets my objective very precisely. Happy LINQing!
Reasons to write bad code !!
Do you write bad code ? I hope not. I also do not write bad code. Are you trying to guess what the topic is about ? Ok here goes the story...
I was new in organization. Probably around 3 months or so. It was like any other day at office. We all were working on our modules. Suddenly something struck me. I saw a very poorly written piece of TSQL Script. The script was meant for data cutover and since the size of database was mammoth so the script was required to be efficient. However, I found so many issues. It was highly inefficient in performance.
Some of the critical issues I found were -
- New variables being declared and assigned unnecessarily where a single base value could have worked with reassignments and manipulations.
- Multiple temporary tables created and dropped for each table under process.
- No error handling or transaction. Single failure would make the database inconsistent.
Luckily, it was our own Dev Db which we were working on and I found this issue before it went to production. The guy who wrote this piece of code was senior to me and was a friend of mine. I talked to him and asked the reason for this inefficient design. He replied promptly saying this is the best he can do. He asked me to redo it if I could do better. I was dumb struck.
I thought why would someone write a crappy piece of code knowingly ? Either the person is incapable of this kind of job which requires a fair amount of creativity, or the person is having some serious issues. I asked him later why he is doing like that. The explanation he gave was even more disturbing.
He told me that he used to be like me once (say about an year ago). He said he was amazed to see other guys writing crappy piece of code which somehow were meeting the functionality but were nightmare for support guys and fellow coders. He further elaborated that now since he is doing the same so he understands the reason. Ahh!! the reason was that they were frustrated and overstressed of the project deadlines and work timings. He said that he releases his stress on the code. I think this is the only way he can take his revenge from the organization for stressing him out.
However, I disagree completely from this kind of approach. I believe that programming is an art and writing good code not just enhances your own skills but also helps you keeping a good practice. If you start writing bad code consistently then you would pick up that way of coding which would bite you certainly in long run.
Another aspect is the attachment with your work. I like to write good code and I make sure that every piece of creativity I apply meets the best industry standards and reflects the level of professionalism I keep striving for. Writing bad code simply because you are stressed out shows that you are not a true professional. There are ways to deal with frustration and anger but this is certainly not the correct way. Having an open discussion with the teamlead and the manager is always welcome. Bending to certain degree for the work occasionally is something that is considered quite common in our industry but if you are being pushed consistently beyond your limits then you can raise the voice instead of writing dirty code.
I learnt lessons from this experience. It would help me certainly to prevent myself from such a mental fatigue and would also prevent me from pushing my juniors to the limit where they start writing bad code !
I am sure you would have encountered such an issue in your organization or might have been the victim of pressure yourself. Feel free to share your experiences.


