Thursday, July 23, 2009

Globalization Best Practices

I wrote an artical on my previous experince on localizing applications.
It's hosted at code project...this is the link.

Monday, May 4, 2009

Action Delegate in .Net

Something that comes with the .Net 2.0 and above is the Action<T> delegate; this delegate can be used when ever a delegate is needed that takes in no argument or just one argument etc…Especially in GUI application it is cumbersome that you need to create delegates here and there even for simple functions, but with this new delegate defined in the System namespace you no longer need to do that, Imagine the method Show, below needs is called from a different thread then the UI thread, because you are updating UI controls created in the UI created you would need to switch back to the UI thread in order to do this (the actual reason for this?. some goggling around would do J); the code could be written like this.

private void Show(int i, string j) {

if (InvokeRequired) {

Invoke(new Action<int,string>(Show),new object[]{i,j});

return;

}

button1.Enabled = true;;

}

Notice how the Action delegate is used, as it is a generic type, the required type could be passed in. There is also an overload that does not take any parameter that can be used as follows

Invoke (new Action(Show), null);

It is also interesting to note that the Action delegate can take up to 4 generic types as parameters as shown below

Invoke (new Action(Show), new object[]{I,j,k,l});

Note: the Invoke method is a member of the Control class, and does not have any relation to the Action delegate, the Invoke method here is show just for the sake of using it with the Action delegate.

Thursday, April 30, 2009

Running Rhino Mock Under FxCop

I wanted to try out Rhino Mock, and I downloaded it and tried it out and it was better then NUnit Mock, I was playing around it a little bit and well, ran fxCop on it,

And gosh, I found 640 defects.

Well, this is not a critic, but it just brings out the fact the amount of static code analysis we do on our code.

I for real, run fxCop on the code I develop before checking it in to the repository, although this is not possible some times, most of the time I spent some time dedicated for this task.It is important to know the standard of the code you develop and running static code analyzer or review through a peer make sure that your code is healthy.

Sunday, April 5, 2009

Knuth-Moris-Pratt (KMP) algorithm on CodeProject

Whoo...Its been kind of 3 month since I had my last post, mainly due to assignments, exams and work.
These days, its kind of low work and the 2nd semister is yet to start. I was just going through some of the assignments I did for my MSc , and though of posting one on codeproject.
You can find my artical
here. Its on a string matching algorithm, KMP, one of the fastest I would say. I have made the library available on code project, so any one can play around with it.

Friday, January 9, 2009

Windows 7 Beta Out...

Windows 7 is the new operating system built on top of Vista, unlike Vista, more emphasis is given to performance, reliability, security and multimedia experiance.
One feature that I heard about Windows 7 being cool is it's task bar.
You can find more on Windows 7 and also try out the beta
here.

Thursday, December 25, 2008

The "Dot" Behaviour

Its just my opinion about dynamic languages, so no need to be harsh.
Something that I miss in dynamic languages is IDE support, even if it exists, the "dot" behaviour is likley to be not there.
I mean that thing I like about Java and .Net editors is that you can easily make use of it for a quick dirty tool you need to implement, even though you might not no a thing about where to find which APIs, you hit the "dot" and you get a list of APIs supported by the class.
Now this behaviour is hard to find in dynamic langauge editors (for the reason the language type are dynamic), although you can write quick code using dynamic languages compared to Java or .Net, its not easy as every one says it is.
Either you have to go through the whole documentation to find out what your are looking for or try all possibilities.
Yes, you would have to do this sometimes in languages in .Net or Java (and strongly recommend the you read the documents before your use APIs for the sake of knowing what you will use) but for quick and dirty programs , it just a matter of hitting the "dot", and I would not go through the pain of going through documentation for thsi purpose.
Another case that is frustrating is when you know what your supposed to call but you dont really remember the name of the method to call !, .Net and Java editors do much better here then dynamic laguages.

Saturday, November 29, 2008

Back to The Desk

Well, last 2 weeks went in a jiffy, I was on annual leave for 2 weeks and was hopping to spend some time with my family, but it turned out to be that I had to submit 4 assignments and had spend most of my time reading. I have backlogged so much of lectures that I thought its time for me to catch up, and it was boring some times, just proofs, theorm and out of the world ideas, but I think I am kind of liking this Masters.
Anyway, my desk at home is filled with thick books, Networks, Algorithams, Database systems, Coding theory etc...
I am proud to note that, we had some guest lectures from Virtusa to do some presentations and the one that happened last was by Sabri Sawad, Sr S/W Archectect, he did a presentation on Software Archetecture and some times back a presentation from Riza Wadood. Sr Business Consultant.
At office, I'll be doing a training on UML next week for some junior collegues, that better be good. Also had some time to download a tool that was pretty cool, but don't really remember the name of it, I'll be posting something on it very soon.