Tuesday, May 31, 2005

Fate or Luck?

Isn't it funny that everytime something bad happens in life it's fate & everytime something good happens it's luck? Isn't anything supposed to happen good in life by fate?

Thursday, May 26, 2005


One of the funny things that I find about life is whenever you are doing something "trivial" (trivial things vary person by person: for some watching TV might be trivial whereas for someone online chatting might be) you get the guilt feeling that you're wasting away your time and perhaps you should be doing something worthwhile, the problem atleast with me is if am not doing the "trivial" stuff I dont even know how to kill time. Anywez all the gyaan apart here are few things that I do to kill time when I'm not working these days:
a. Read books (I don't consider this to be at all immaterial, I *think* reading opens your mind).
b. Play minesweeper (I owe this to Subbu who got me hooked on to this crap).
c. Play TextTwist on Yahoo! Games : This is my new found interest.
d. Listen to music: I love music.
e. Aimlessly watch TV.

More or less that's how I kill my free time, I am still trying to figure out though who is killing who!

Friday, May 20, 2005

and when all the wars are done...

Sumit wrote this excellent review on Ruskin Bond's "Time Stops at Shamli" at mouthshut.com (http://www.mouthshut.com/review/Time_Stops_at_Shamli_and_Other_Stories_-_Ruskin_Bond-70645-1.html). Very very recommended if you haven't read Ruskin Bond's work yet.

Thursday, May 12, 2005

Unit Testing with nUnit

In case you're into unit testing: TestDriven .Net(www.testdriven.net) is an addin for VS.Net which allows running of nUnit test cases from within the IDE without having to run the nUnit GUI. A nice tool which saves you a lot of debugging time along with nUnit. Another add-in which is a must have atleast for VS.Net 2003 and below is Resharper (http://www.jetbrains.com/resharper/), makes refactoring a lot more easier.

Dot Net (.Net)? Not Yet

UPDATE: I've posted the VB.Net code sample in another post.

Off-late I've learning quite a few things about .net (mostly asp.net) the hard way (actually that is true as of now for almost everything in life). Anywez here are few more things that I found out.....
One of the requirement in this project is to show a list of RadioButtons within a DataGrid (could be a DataList or Repeater for that matter). Now the user gets to see the list of conferences in a grid and he can choose one (only one) from that list. So basically all I had to do was define a templatecolumn in the grid, include a RadioButton within the template and give it a groupname (the groupname ensures that the radiobuttons rendered are mutually exclusive). Seems to be a 5 mins job but guess what? I did exactly the same and when I ran the code, I could select all of the radio buttons within the grid at the same time. I checked the source html and found out that all the radio buttons rendered had unique names, thought I did something wrong so I debugged and debugged but couldn't figure out what was wrong so I resorted to my ol' faithfull friend: Google and voila MS has confirmed it to be a bug (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316495)! (aside: while typing I sowehow lost the entire content after this so have to type in everything again!!, very very bugged!). Googling further I found a workaround on CodeProject, the code basically creates a custom RadioButton which derives from the RadioButton and overrides Render method to ensure that same html name is rendered (using the GroupName property) and implements IPostBackDataHandler to persist the state of attributes on postback. The only problem was that the code was in C# and my current project is on VB.Net, converting C# code to VB.Net or vice-versa is a pretty trivial matter and generally does not take more than a minute per line of code or so I thought! this is where I learn another subtle but very big difference between C# and VB.Net, though C# allows you to re-implement an interface(in my case IPostBackDataHandler) already implemented in the base class (RadioButton), VB.Net does not and generates compile time errors!
(end aside) I really don't understand why such a feature would be only supported in one language and not another when MS is pushing both the languages equally now!! So this option was also ruled out but not to be deterred I thought of inheriting the custom control from one level up than RadioButton and then perhaps I could re-implement the IPostBackDataHandler well no luck, cause RadioButton inherits from CheckBox which actually implemnts the interface, so had to go one more level up: WebControl..now creating a RadioButton by inheriting from WebControl is no trivial matter..that's when suddenly a tool amazing tool called Reflector(www.aisto.com/roeder/dotnet/) came to my mind, basically Reflector allows you to reverse-engineer .Net Assemblies. Downloaded it and installed it and reverse engineered the code for radiobutton and checkbox and with few tweakings here and there, I had my custom radiobutton control ready which were mutually exclusive when placed within the grid or for that matter any container which implements INamingContainer in VB.Net! And am I pleased about my feat, you bet.

Saturday, May 07, 2005

A tech post at last!

ASP.Net 1.x flames:
I've been working on a asp.net web-site project which has to be cross browser compatible (it is supposed to support IE 5.x+ and Netscape 6.x+) and it is something which I never had chance of working on before on .net. Few things that I found out, the client side validation for asp.net validation controls don't work on Netscape or for that matter on any other browser except IE! (including Mozilla & FireFox) not that these "new" versions of mozilla based browsers don't support the latest Javascript standards but it's due to the way these validation controls spit out Javascript which is very very IE specific (and that btw doesn't follow any standard!). First of all the client script by these controls is only thrown if the browser is listed in Machine.config as a "supported" browser (even though mozilla based browser do support latest JS standards, the config file only has IE listed). Second problem is the way WebUIValidation.js is written which uses document.all (a feature only supported by IE, the standard is to use document.getElementById) to find a control on the form. Fixing these two is easy but that doesn't make the client script validation run on mozilla based browsers! the biggest problem is the little script block that is emitted by the base validator control (all the validation control extend it) on the OnRender event, which again uses document.all! So basically it's impossible to add client side validation for non IE browsers unless you're willing to extend the base validator control, override its OnRender method and write validation controls which extend from the custom validation control!
Second thing that I hate about ASP.Net 1.x is the Postback feature, I think GMail revolutionized the way postbacks are handled by using remote scripting. It's really illogical for the entire page/form to post itself back if the user changes a value in a dropdown list (can you believe it ASP.Net also has a server event for TextBox.Text_Changed, imagine the user typing a character and the page posts back, nice way of making sure that the users don't visit your site ever!!!). The good news is that MS has finally woken up with ASP.Net 2.0 and most of the control support remote script callbacks for e.g. the GridView (successor of DataGrid in 1.x) uses remote scripting to refresh the grid for sorting/paging. ASP.Net 2.0 uses XmlHTTP for remote scripting and the irony is all Mozilla based browsers have XmlHTTP built in whereas in IE 6.0 you have to use an ActiveX control. Hopefully IE 7 would have XmlHTTP implemented w.o having to use ActiveX and praying users would lower their security settings to allow ActiveX controls so that the page can function properly....MS are you listening?
Apart from the flames read a nice article on Google vs MS (http://www.fortune.com/fortune/technology/articles/0,15114,1050065-2,00.html) and the popularity of GDS, infact I myself am trying to build a plug-in for Yahoo!IM Archive: more or less there just have few frills to add..hope to have it rolled out at Sourceforge by next week some time.
PS: When would google wake up and add Category support for blogger?