Tuesday, June 02, 2009

Browser Wars - Under a New Set of Rules

It's not a secret to know that there are hundreds of browsers. The cold war between the main players is no lesser secret.

With the industry joining the HTML 5 bandwagon the browser war has entered a new dimension. HTML 5 is the next generation HTML standard which is 'work in progress' by the way. As in the past the software developers have overtaken the standards bodies and started implementing this and some have even done beta releases. Google has also announced their willingness to fully join the club with Chrome at recently concluded Google I/O.

Some cool features of HTML 5 which caught my attention was,
1. The new video and audio tags
This enable application authors to create their own interface for video/audio players. This means that the browsers can also provide their own players. There is still conflicts as to which encoding/decoding mechanism to use as the standard.
2. More support for offline web applications
3. API exposing the browser history
This will be very welcomed by all the developers who had 'Back Button' problems
4. API for Background worker threads
This is a method to perform highly expensive computational tasks without interrupting the user interface.

Two main objectives of the HTML 5 standard are,
1. To foster interoperability of browsers
2. Introducing new APIs and Markup for emerging web usage patterns while being backward compatible with already deployed content

It is really fascinating to see that the user experience on top of the browsers is reaching a level very close to the desktop experience. With new communication platforms like 'Google Wave' we will be taken in to a whole new range of web applications. Below chart from O'Reily shows how the native client and web user experience is merging in the future. (Is Chrome in front of Firefox...duh..may be in terms of release date only)

What I would be interested in next few months is how Google Chrome would fair up with Firefox. Chrome did not came out well in it's first version. But I just feel that they will come with a bang next time around although the current news is not encouraging for Chrome.

Saturday, May 16, 2009

Pickups II

Here are few things I came across which caught my interest

1. Indika sent me this great article about something we have know for a long time, but conveniently ignored even longer.
"Characterizing people as non-linear first-order components in software development"

2. Saminda, a former work colleague at Eurocenter, who works for WSO2 now, has created this firefox add-on which enables seamless transition between English and Sinhalese based on 'Singlish' scheme. Specially useful for Sinhala users who do not want to learn the typical Sinhalese keyboard.

3. Rang Di Basanti is one of the best hindi movies I've seen (Better than slumdog). The song 'Lukka Chuppi' is a hypothetical dialog between the recently dead soldier son and his mother. The son is treated as a hero by everyone (And he himself conside himself to be one), but does it erase the void set in mothers heart ever? Facinating lyrics, music, vocals...and really relevant for the current times in Sri Lanka.

Video
Lyrics with Meaning

I suggest you watch the video along side the lyrics/meaning. Even better if you could watch the whole movie.

Friday, April 03, 2009

Keeping Web Sites Alive (IIS/ASP.Net)

Problem:
IIS recycles app pools periodically and the first request which comes after a recycle takes too much time to process because the whole app needs to be loaded and compiled. By default the idle time is 20 minutes.

Solution:
1. Configure App Pool to recycle when you need it to
2. Setup a ping service which will act as the first request to reach the web site after a recycle

Method & Details:

1. IIS App Pools
IIS App Pool concept is a very useful thing in keeping web sites in same server seperate from eachother. App Pool recycling is also an important activity which cleans up left overs from your application runings.

But default IIS App Pool recycle options are not suitable for a highly responsive site. It can recycle
  • Every n minutes
  • After m requests
  • At specific times of the day
  • If consuming M amount of virtual or physical memory
  • If idle for p mins
  • If kernel request queue (where http requests are kept before dispatching to IIS) has more than x requests
You have to change the default settings to suit your requirement while making sure that recycling actually happens as well. I recommend using the specific time of day approach to force a recycle at a low traffic time.

2. Keep Alive Services
A Keep Alive Service will send a dummy request to your site just to make sure that it won't go to sleep (recycle). One other important attribute of a keep alive request is that it should not make the current logged in user count to go up. So typically Keep Alive services will send a request to a 'KeepAlive' web page of the site which is specifically made so that the user statistics are not screwed up. Following keep alive page will show the current time,

<html>
<head><meta http-equiv="refresh" content="300"></head>
<p>Current Time Is : </p><%=now%>
</html>

There are 2 kinds of Keep Alive services
  1. Web based services - siteuptime.com, host-tracker.com
  2. Standalone Applications - Siteup by Xequte
The standalone applications is useful but it has a heavy dependancy on the machine that you install it. If the machine is down or the application is shutdown by someone you have a risk. I recommend the usage of web based service (for a nominal fee). They provide much more features as well as releasing you the burden of keeping the keep alive service alive.

Sunday, March 29, 2009

Sinhala Blogs

There's a growing upward trend I noticed recently in Sinhala Blogging. 'Sinhala' or 'Sinhalese' is the unique language the Sinhalese (Nice recursive definition btw) people in Sri Lanka and it has never been the language for the computers or Internet in Sri Lanka. Times are changing though!

So is it a positive trend? I think it of course is. Your mother tongue is the best possible means of communication among your country men (and women of course, තව පොඩ්ඩෙන් ගුටි). And there are always unique stuff to discuss among your country men., beside the usual blog attractions like Holywood movies or technical developments. At a time when the traditional means of mass communication like print media and TV/Radio are meeting their (natural?) limitations and showing signs of being completely irrelevant and useless, I'd expect progressive advancements like Sinhala blogging to go a long way.

On the other hand Sinhala is not going to take us outside the country. So it's equally important for Sri Lankans to blog in English. Currently its taken as a fashion as well, but I guess the 'Kick' out of it will ware off with time when people realize it's own boundaries.

There's also an official body behind driving this initiative. You can get lots of useful information regarding Sinhala Blogging in their web site.
'සිංහල බ්ලොග් කරුවන්ගෙ සංසදය'

If you want to check out a few different kinds of Sinhala Blogs,
1. සුපුන්ගේ අන්තර්ජාල සටහන
2. කාලිංගගේ බ්ලොග් සටහන
3. මගේ මරණය

ප:ලි
මම සිංහල ලිවීම සදහා භාවිතා කලේ මෙතන

Tuesday, March 24, 2009

Pickups

Thought of sharing a few things I picked up during the last week from Internet/Blogs.

1. TED - http://www.ted.com
A very useful site which you should visit every week.

2. Predictable Irrationality
Is the idea which challenged the classical economist view that all human decision making is rational (Can be minimized to a Cost Benefit Problem).
Picked it up from TED and then viewed a few more video of Prof. Dan Ariely, who is the man behind the idea. See it here.

3. Everythin's amazing, nobody's happy
Picked up from Dr. Sanjiva's blog. A very simple yet a truthful view of the current generations ungratefulness towards the things that we enjoy for granted. See it here.

Thursday, March 12, 2009

Backup Essentials

Everyone of us has to format our hard disks once in a while. After switching to Vista I did that many times :). Although the usual data backup is done by most of us, I thought of putting down a list of things that we tend to overlook.

Outlook
1. Outlook Mail files (pst)
2. Outlook rules
3. Outlook personal contacts

Firefox
1. Favorites
2. Scrapbook
3. History
4. Passwords

Go here to find an easy way to backup complete firefox profile.

Anti-Virus
1. Settings (Special Blocks like TCP ports/Applications etc..)

Windows
1. Odbc DSNs
2. hosts file
3. Special gateway settings / TCP-IP (Eg: routes)

IM
1. Message History

IIS
1. All web sites and their settings in local IIS
Backing up IIS differs from one version to another. You have to do some googling and some tests to figure it out for your version of IIS.

A shortcut for all this could be to backup your windows profile directory. But it won't be a complete solution as some of the above could be saved in other locations.



Monday, January 19, 2009

Exceptions Revisited

Exceptions are an integral part of any modern programming language. AS a mover from Java to .Net I have had my fair share of exception handling changes. In Java you have both checked and unchecked exceptions and the throws exception clause is part of the method signature. In .Net (C#) all exceptions are unchecked which was kind of weird to me at the start. But after programming with .Net for over 2 years now I'm pretty convinced that the unchecked exceptions are the way to go. But I came across Spec#, an experimental extension language to C# by Microsoft has decided to give checked exceptions another go and thus I thought I'd revisit the whole argument again.

When the chief architect of C# language,
Anders Hejlsberg was asked why they opted to keep checked exceptions (which he recalls as 'handcuffs' on programmers ) he sighted 2 main reasons.
  1. Scalability
  2. Versioning
What he meant by scalability is the fact that when you write programmes which interacts with a whole bunch of other subsystems and APIs the number of exceptions the programmer is forced to handle grows out of control. When you just deal with the IO namespace in .Net framework this is not so much of an issue as you only have to handle a few IO exceptions but in large systems you can end up having to handle tens and hundreds of exceptions. So what happens is that the programmer gets tired of this and writes a big catch Exception clause which completely defeats the purposes of having checked exceptions in the first place. Or even worst they have the empty curly braces for each catch clause which is basically a planted time bomb. Another valid tactic people use is catching all checked exceptions and to wrap them as Runtime exceptions making sure that they no longer obstruct the users on top of the chain.

Under 'Versioning' the problem is that the throws clause is part of the method signature. So when you release a second version of an API or class library you can not introduce new exceptions or change existing ones since it will break client code. You are now left with having to declare a new method with a different set of exceptions which makes the API messy and unclean.

On the other hand one of the main arguments against unchecked exceptions is that the client programmer has to solely depend on the documentation of the API method to know what exceptions can be thrown by the function. But you can have a tool do this analysis for you like the 'Exception Hunter' from RedGate Software. According to Hejlsberg the most important thing about exceptions is not how you handle them, but how you release resource upon encountering one. This is perfectly handled by the try-finally blocks or using blocks in C# (Disposable pattern). The reason is that only a fraction of exceptions caught really need or can be handled by client code. The proven practice of dealing with unchecked exceptions is to let them propagate to the top of your call stack and handle them in a single place. By handling what is usually being done is a message to the user and graceful termination of the programme. We do this in very simple way in ASP.Net applications by using the Global.asax Application_Error handler.