Monday, June 30, 2008

Right of (Non)Believing

Following is a collection of thoughts I gathered reading a column letter published in the Sinhalese newspaper 'Ravaya'. This piece is written by popular Sinhala novelist Gamini Viyangoda. It's one of the few writings I've seen in Sinhalese about Atheism rights. Some of the other interesting reference material in this area are the book 'God Delusion' and the BBC documentary 'Root of All Evil' by Richard Dawkins.

‘The right to express, hold and publish my ideas should not challenge the right of the other to criticize the same’. This is a well accepted practice in politics and in all social matters in general. If law comes up and defends my right to protect my idea from being criticized, that law will be grabbing the right of freedom of expression from the other. Although such laws are not common place, strangely enough, most of the countries have similar laws when it comes to religion. Although the right to criticize any sort of political opinion is well accepted at a principal level (practice can be different) the same right is not even accepted at a principal level for religion. If I go ahead and try to criticize a religion I most probably be accused of a legal offence.

Including Sri Lanka, many countries generally agree that you should not ‘look down’ upon religions. Actually looking down upon anything be it religion, people or anything at all is not appropriate. But the religious societies misinterpret any sort of criticism towards them as a ‘looking down’ scenario and all of us have got used to accept it as an eternal practice. There could be exceptions when the main religion of a country goes ahead and criticize other religions, but in principal criticism towards any religion is considered as non-ethical in any country. But what is the need to have such a ‘critic-proof’ shield only for religion?

Any religious person does NOT like others criticizing his/her religion. So he himself imposes a self-ban on criticizing other religions due to very obvious effects of throwing stones from a glass room. Preventing from criticizing other religions to prevents one’s own religion from getting attacked is a well understood self-preservation mechanism that cannot be criticized J. But what about an atheist, someone who does not believe in any traditional religion? It is not correct to say that an atheist does not have a religion. Not believing in any religion IS his ‘religion’. So as much as the right of a established believer to rise for his religions correctness and atheist should have the same right for his ‘religion’. On the other hand if the religion is a way of self liberation an individual should have the freedom to decide whether he wants to liberate that way, not the majority or state. Similar to a Buddhist rejecting the Islam liberation and a Christian refusing the Buddhist liberation and atheist should have the right to say that he does NOT want any religious liberation.

If someone claims that the refusal for religious liberation is harming the established religions, the same logic should apply against any religious person by another religion. We should not forget that if someones (non)belief in some way harms the society at a more physical level (murder, theft, sexual misconduct etc…) the civil and criminal law is there to handle that as for any other social misconduct. There have been recent developments in the world promoting this right to non-belief at least at a principal level.

While the world progresses on this aspect we as Sri Lankans seem to accelerate backwards. Religion is been continuously used as a way of forcing or isolating people from the mass recently. It’s still very much a taboo to say that you are an atheist here. Also lots of social and personal tensions rise up due to total myths and traditions which are part and parcel of established religions. At a time when scientists and so called intellectuals come and spread myths about science and religion in media round the clock, even the law seem to be very distant from protecting the innocent public, both believers and non-believers.

PS : The photo is of 'Dr. Richard Dawkins', the famous Atheist and great biologist.

Monday, May 12, 2008

Kite Runner - For you thousand times over

I recently had to stay behind at home due to me being sick. I used up the time to watch some good movies. The one which caught most of my attention and my appreciation afterwards was 'Kite Runner'. Kite Runner tries to capture the guilt and tormentation of an Afghan writer living in America tries of the betrayal of his childhood friend. He decides to 'be good again' by rescuing the son of his then killed friend from the Taliban. This is an adaptation of a novel by the Afghan-American writer 'Khaled Hosseini'. The film brought me back memories of feelings I got after watching English Patient some time back. The strong feelings of friendship runs through the film and binds the viewer like the Kite is bind via the string to the little boys.

I really loved the score of the movie. The English hymn played when Amir's search for little Shorab becomes in vain and when he goes to mosque is heart warming. And I'd love to know the meaning of the song played at the wedding festival. I will start an Internet search to get the soundtrack and post as soon as I find it. Also I started an affection towards the language (Dari Persian). The songs as well as the tones of speech were really warm and touching and rich. The mono-tone view of the Arab world by people like us who really see the Arabs through American lenses is another aspect of my perceptions that can change over time due to this movie. The official movie web site is also very attractive (Don't forget to listen to soundtrack excerpts). I highly recommend any one of you to watch this movie. I know I'm going to watch it again with my wife this weekend.

Wednesday, April 30, 2008

Fight for disk space


I'm sure all of us encounter the disk space problem in C drive with Windows more often than not. I encountered the same problem recently. Of course I've tried the usual tricks of uninstalling all software I don't need and using windows disk clean etc...But still I was left with around 500 MB of free space from my 12 GB size C drive. Then I set out to find out how to solve this more methodically. Following are the steps I took and I feel some of them will be helpful to anyone out there when they need to gain some breathing space in the C drive in quick time. (I have a hp compaq nx7010 laptop running windows XP SP2) 1. First thing is to find out where exactly all u'r space has gone. Right clicking on each suspecting folder and finding out the size is not a scalable option. So I found 2 very easy to use freeware.
  • TreeSiz - Gives u a chance to scan the folder of u'r choice and provides a break down of how each folder had consumed space.
2. Using these two tools I found that there are 2 files consuming around 5GB of my hard disk space
  • hiberfil.sys
  • pagefile.sys
hiberfil.sys is used by the windows hibernation feature. It uses up roughly around 3GB of disk space and my feeling was that I prefer to have more disk space instead of hibernation which anyway gives me weird problems with my hp laptop. So I disabled hibernation and got the space back from hiberfil.sys. In the same windows you should be able to find some information which gets rid of all fancy XP animation stuff which can provide you with better performing OS. Try those too.

Now to the page file. The pagefile is an integral part of windows and you can't get rid of it. What you can do however is to have a minimum size page file running on your C drive while you have the bulk of the page file running on a different disk (or at least a different partition). You first need to know what you are doing by reading this. Then you can find out how to do it by reading this. After carrying out the above 2 tasks I was able to gain nearly 4 GB of my disk space and the mere fact of having your page file in a non-frequently accessed drive is bound to make your system perform better. Please share any un-common ways to gain disk space in windows and in the process improving the system performance.

Tuesday, April 22, 2008

SQL Express - Usability Improvement















I'm currently in Norway deploying a portal product we have built. This is spring time in Norway and the weather is just starting to be Colombo friendly :). It's amazing how the environment has changed from the autumn, which was when I last visited Norway. The same trees which used to be in various colors in the Automn is now has gone in to complete hibernation. The church in the picture was not to be seen in summer/autumn but now we can clearly see it from the apartment.

Our customer is a debt collection software vendor and the portal is the product he will sell for collection companies. The product is based on DotNetNuke (DNN) and the DNN DB used is SQL Express. With SQL Express we have several limitations when using the product.

1. DB Size limitation - 4 GB. Since the DNN database we are using is not expected to grow in heaps and bounds this is not really an immediate problem. But any client who has an increasing DB is encouraged to migrate to SQL 2005 server.

2. CPU Limit - 1 CPU

3. RAM Limit - 1 GB. Does not use the maximum RAM which is available in the machine.

4. Practical Problems
  • The administrators can NOT open the SQL Express DB from SQL Management studio for maintenance work while the portal is up. Since the SQL Express DB we're using is used as a file the portal gets an access violation when the DB is opened up from the management studio.
The above was the main problem we had during development. But during the deployment I came across an article which describes how u can set up a file based SQL Express Database to overcome the window file access limitation. This is a very good find since one of the problems we found hard to place the product for new customer could have been this limitation.

Wednesday, March 26, 2008

HTTP requests from the future


These days I'm working on a DotNetNuke (DNN) based Portal development. Our development env is IIS 5.1/XP while our deployment env is IIS 6/Win 2003. During our past 2 deployments we encountered a strange error on IIS 6/Win2003. Soon after the deployment every page in our portal solution spits a java script error 'Sys is undefined'. This is an error related to the ScriptManager.js which is needed in Ajax pages. There were dozens of google search results for this error pointing fingers to IIS, web.config file settings, axd file handlings, Ajax java scripts etc...but we just couldn't figure out the solution quickly enough. After a late night struggle we gave up and decided to check it the day after. When we came and check next day, the problem has got fixed by itself overnight :).

I always know when problems starts to get fixed by themselves it's a warning sign for worst things ahead. But I just could not reproduce the problem to study it that day. So we went happily in to our final deployment yesterday and here we again had the good old error 'Sys is undefined'. This time around we dig down and went in to analyzing this in depth. When we looked at the HTTP response for a page 2 requests for a ScriptResource.axd files were having HTTP 500 codes. (Read about .axd files here ). When I used fiddler to analyze the HTTP response in detail we caught up with the message
"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.Parameter name: utcDate". Eureka!!!

Now we knew that the problem has to be something to do with the time. In every ScriptResource.axd request there are 2 parameters being sent. Eg : ScriptResource.axd?
d=8fBiB6-cb_63xIkOjfdl6BCL-uzAt8lEaJgT8GHfNac0VUzhoOSl_j9ebDYDA0Ao0
&t=633420390180000000
The 'd' param is relevant to data it is asking for and the other 't' reflects the time which the resource was built. (Use this tool to decrypt axd requests). The problem was that our win 2k3 servers time was not accurate and it actually resided in the past ( A few hours). Thus the axd request was seen by the server as requests coming from something which was built in the future.
After the problem was identified the root cause finding was not difficult. Our win2k3 time synchronizing service had a problem. Now we were able to think back and understand why this problem got fixed on it's own the last time :). The problem just slept over it till the server time difference was consumed. Isn't that a nice way to solve problems....just sleep over it :)

Labels:

Sunday, March 09, 2008

Continuous Documentation cont...

As it usually happens, after going through all the troubles to have a continuous documentation happening (see previous post) in my project I found out a much easier way to achieve the same. While the previous post concentrated on purely using the native sandcastle xsl files to apply several xml/xsl transforms using Nant, the new easier method will rely on the very useful tool 'Sandcastle Help File Builder' or SHFB as it's also known. You need to download and install SHFB in both your local machine and the build machine. ( It would be better to breeze through my previous post before you go through this)

Let me run through the simple steps involved in this method.
1. Open up SHFB in your local machine and configure it to generate the documentation to your project.
2. Some important steps in configuring the SHFB are,
  • Adding the assembly and the documentation xml (Generated from the Nant -doc attribute as mentioned int he previous post) for documentation
  • Adding the dependent assemblies needed to build the main assembly
  • Choose the helpfile format (I choose Help2xAndWebSite)
  • Set HtmlHelp2xCompiler Path (Where you have installed HTML Help Workshop, see previous post)
  • Set output path
3. Build the SHFB project and let the documentation to generate
Now you will have the documentation files (html, chm) in your local machine, which is not our target. We want the documentation to build periodically, automatically in our build machine. Patience....2 more steps.
4. Now save your SHFB project and you will find a SHFB configuration file. Get it copied to your build machine.
5. Now include the following task tag in to your ccnet documentation project (other project tags are not mentioned here) and you are ALL SET to have continuous documentation running in your project.

<tasks> <exec> <executable>C:Program FilesEWSoftwareSandcastle Help File BuilderSandcastleBuilderConsole.exe</executable> <baseDirectory>D:WorkDirSandcastleWorkDirSPNPortalDocumentation</baseDirectory> <buildArgs>"D:WorkDirSandcastleWorkDirSPNPortalDocumentationDocumentationSettings.shfb"</buildArgs> <buildTimeoutSeconds>10800</buildTimeoutSeconds> </exec>

</tasks>

Pay attention to the 'buildArgs' element where you specify where the shfb configuration file can be found.

Labels: ,

Friday, January 18, 2008

Continuous Documentation















Continous Integration (CI) is not a new topic anymore. It has been a proven method to make sure your code works as expected every single time you do a change to it. Usually a CI process focused on building a project (Deployment might involve more steps) involves steps like,

1. Detect changes to the source
2. Download the updated source from source control to the build machine
3. Compile the source and build the binaries
4. Run the unit test suite
5. Publish the result to relevant people

The additional step I'm going to focus in this posting is documentation. i.e To generate the documentation for the complete source automatically using the CI tool, which I prefer to call 'Continuous Documentation'. My focus will be on ways and technologies to achieve this in the Microsoft technology domain.

The most popular documentation generation tool for .Net is Sandcastle. The way to achieve our target is to write a Nant target which produces the documentation in either html or chm format and to call this Nant target at an appropriate time from CruiseControl.Net (CruiseControl.Net is the build scheduler while Nant is the actual builder).

Most of the learnings on how exactly to do this is from this article on code project. There were some discrepancies in that article with respect to latest SandCastle version and I'd like to emphasize on those points. (To keep the post short only important nant extracts are mentioned in the post it self. The complete Nant target will be attached for your convinience)

1. Compile your source with the additional 'doc' attribute to 'csc' (C-Sharp compile) nant target.
Eg:

<csc target="library" debug="${debug}" output="${foo.dll.dir}\foo.dll" doc="${foo.dll.dir}\SPN.PredatorAPIDoc.xml" >

2. Copy a Sandcaslte configuration file from the default configurations that comes with Sandcastle. You just have to replace the default documentations comments xml with your own doc xml 'fooDoc.xml' generated from previous step. Sandcastle comes with 3 default configurations hana, vs2005 & prototype. I'm using vs2005 here. (Instead you can have the required sandcastle config file in your source and refer it as well)


3. Run the MrefBuilder to generate a basic reflection XML by introspecting on the assemply

<exec program="${sandcastle.mrefbuilder.exe}" workingdir="${sandcastle.workingdir}">
<arg value="..\${foo.dll.dir}/foo.dll" />
<arg value="/out:reflection.org1.xml" />
<arg value="/dep:..\foo.Lib/*.dll" />
</exec>



4. Next step is to run a step of xmltransformations (using xsl) on this basic reflection xml from the preivious step
<exec program="${sandcastle.xsltransform.exe}" workingdir="${sandcastle.workingdir}">
<arg value="reflection.org1.xml" />
<arg value="/xsl:"{sandcastle.applyvsdocmodel.xsl}" />
<arg value="/out:reflection.org2.xml" />
</exec>

Similar to above you need to run a few more transformations and you can also run some additional transformations as you wish. (Eg : FriendlyFileNames.xsl). There are many presentation transformations in ProductionTransforms subfolder in Sandcastle installation directory. I faced some difficulties getting all these transformation mentioned in the code project article to work. My approach was to refer the example MS Build script (<SandCastle_Install_dir>\Examples\sandcastle\build.proj) which was shipped with Sandcastle and to convert the transformations mentioned there to Nant.

This step (or series of steps) should result from a final reflection file called the reflection.xml

5. Now copy the other presentation helper directories (scripts, icons, styles) from Sandcastle_installation_dir/Presentation/vs2005 in to a subdir inside ${sandcastle.workingdir}.

6. Next you need to create some source files for Help compiler which generates a chm file. These files are

* hhp file - Html Help Project file
* toc.xml - Table of Contents file
* hhc file - Chm contents file out of toc
* hhk file - Chm index file from the final reflection xml

For all the above you will be using some kind of xml transformation (xsl) which comes with sandcastle.

7. And the grand final step is to use Html Help Workshop's hhc.exe help compiler to compile all above files in to a single chm file


<exec program="${hhc.exe}"
commandline=".\test.hhp"
workingdir="${sandcastle.output.dir}"
failonerror="false"/$gt;

Finally you will have a chm file which is the compiled help file which can be distributed with your application.

Since documentation generations is usually a time-taking process I suggest you run this nant target as a nightly task. So you have the documentation getting updated each day as opposed to each check-in. Use the <triggger> block of CC.Net to schedule this documentation task as a separate CC.Net project which runs every night.


Having the documentation up-to-date like this helps your project in several ways.

1. You have a ready to pack deliverable without any extra effort at the end of the project
2. You can send the documentation for review very early
3. The development team can readily refer the documentation as and when new parts are added to the system
4. Encourages developers to document as and when they code

PS : The complete Nant script can be found here.

Labels: , , , ,