Partial Classes

Out of several enchancements available in .NET 2.0 partial classes is one of them. Partial classes simply means that you can break your class and write them separately (as if they were separate entities). This becomes a useful feature when you have a large class that does more than one thing. If you open a software engineering book, you are likely to find statements like: “…your function/classes should do one thing and do it well”....

<span title='2005-06-24 23:48:19 +0000 UTC'>June 24, 2005</span>&nbsp;·&nbsp;2 min

XMLHttp

XMLHttp is the future of web application development. It allows threaded communication between the client and the server without ever leaving the page. If more advanced JavaScript features are standardized this might mean that a web application will act and feel very much like a regular windows application. Up until now, one of the major differences between a windows application and a web application was statelessness. However, with XMLHttp this is reduced much further because a state will no longer be round-trip from the server, it will be when the user enters a page does several thousand things and leaves the page (when they leave the page the state is lost) however during those thousand events all the state will be maintainted – this can be done using XMLHttp....

<span title='2005-06-11 02:11:40 +0000 UTC'>June 11, 2005</span>&nbsp;·&nbsp;2 min

The trailing slash

Sometimes a simple change as adding a slash may improve the performance of your web-applications. Consider this: the link www.salmanq.com is slower than www.salmanq.com/ (the only difference being the trailing slash). They will both work but the latter is faster. When this link: www.onupol.com is followed the web-server returns a 301 (Moved Permanently) pointing to www.salmanq.com/ that’s one extra round trip to and from the server per link. If you have a site that’s running without the trailing slash and you have 10K+ visitors you will certainly start to feel the consequence....

<span title='2005-04-28 00:47:36 +0000 UTC'>April 28, 2005</span>&nbsp;·&nbsp;1 min

Old bugs are harder to catch

About three years ago I worked on an application that in-part had to blend in with several other applications. Among many features one of them was to automatically generate something known as deadlines. The actual details are far to complicated to explain in details here, so I will use a simpler example. Assume that you have four types of documents each have their own specific way of computing deadline. One of them follows a rule like:...

<span title='2005-04-20 03:18:49 +0000 UTC'>April 20, 2005</span>&nbsp;·&nbsp;3 min

MySQL version information

You can use this simple command to find the MySQL version you are running: select Version() as Version; Hope that helps.

<span title='2005-03-31 07:32:22 +0000 UTC'>March 31, 2005</span>&nbsp;·&nbsp;1 min

ValueType Boxing

In .NET an interesting phehomenon occurs known as “boxing”. Let me illustrate the problem and then we will look at the possible solutions: using System; using System.Collections; class Test { struct BankAccount { /* A simple BankAccount structure */ public float Balance; /* Balance in the account */ public BankAccount(float _Balance) { /* overloaded-contructor */ Balance = _Balance; } /* A method to charge the account */ public void ChargeAccount(float Fee) { Balance-=Fee; } } public static void Main() { ArrayList Accounts = new ArrayList(); /* An array */ Accounts....

<span title='2005-03-08 00:49:21 +0000 UTC'>March 8, 2005</span>&nbsp;·&nbsp;2 min

Uncertaintly Principal and Software Engineering

Uncertainty Principal is a principle of quantum mechanics postulated by Nobel laureate Werner Heisenberg in the 1920s which states that it is not possible to determine both the position and the momentum of a particle at the same instant. The reason he argued, was that the act of “observing” the particle changes its behavior with respect to what is being measured. He was one of the first scientists to bring in probability into the predictable science of physics....

<span title='2005-02-28 23:06:14 +0000 UTC'>February 28, 2005</span>&nbsp;·&nbsp;2 min

Form posts and CacheControl

Let’s say you have an HTML form which posts to another page, and that page in turn posts to other page(s) (maybe even to itself). Consider what happens in a very common scenario such as this: User visits page 1 Types in username and password Posts to page 2 (valid user) User sorts a column in page 2 which posts the column name and the order to page 2. Page 2 reloads....

<span title='2005-02-25 23:56:02 +0000 UTC'>February 25, 2005</span>&nbsp;·&nbsp;2 min

Option Groups

Not many people know about this. In a HTML dropdown (select) there is a option group tag that groups your options together. For instance: <select name="cars"> <optgroup label="Honda"> <option>Honda Accord DX</option> <option>Honda Accord LX</option> <option>Honda Accord EX</option> </optgroup> <optgroup label="BMW"> <option>BMW 530iL</option> <option>BMW 640iL</option> <option>BMW 740i</option> </optgroup> </select> If you run the code above you will notice users can’t even select the option group (which is perfectly valid). And the automatic indendation within the sub-groups is very useful also....

<span title='2005-02-25 01:50:47 +0000 UTC'>February 25, 2005</span>&nbsp;·&nbsp;1 min

Why run as doesn’t work on explorer.exe?

You will notice in windows no matter how you want to “Run as” explorer.exe it will not work. Almost all programs you can right-click or hold CTRL and right click to get the run as option but with explorer this doesn’t seem work. You cannot even use the command line tool runas /u:administrator to run explorer. Explorer.exe is a special task. It actually runs all the time and is responsible for the taskbar and other features on the Windows desktop, press CTRL+ALT+DEL right now and you will see explorer....

<span title='2005-02-23 20:54:39 +0000 UTC'>February 23, 2005</span>&nbsp;·&nbsp;2 min