Saturday, December 15, 2007

My blog has moved

I acquired a new domain recently, and I hosted my blog there.
http://krishnamurthy.net.in
Have not administered a website before, but it was fun. I bought the domain from rediff. Got some hosting space from freehostia, and publishing software from wordpress. Some configuration, some uploading, and its up.

Thanks to the import feature of Wordpress, I could get all my old posts from my original blog to the new site.

Saturday, December 08, 2007

Bomb scare

It was the usual friday evening. I left early from work and met my friends at Mocha, Powai. After a typical friday evening lazy chatter over some coffee, we decided to go eat at KFC. We ordered a fried chicken bucket, french fries, and pepsi (and a zinger for my friend with an especially good appetite). Dinner with friends on a friday evening is something I really enjoy. Good food, good stories......keeps me happy.

When we were deep into our fried chicken, an attendant walked over to our table and asked "Is that your bag sir?". We turned and saw that he was pointing at a bagpack placed on a chair adjacent to our table. It was a good looking bag, one big enough to stuff a laptop into it...the kind we usually carry to work or college. We replied that the bag did not belong to any of us. The attendant nodded and walked away.....probably to ask some other people.

Typical of a bunch of guys spending a lazy evening, we started making jokes about the bag holding explosives, left there by someone with ill intentions. We started debating why someone would like to blow up a joint like KFC with such a low population. Someone said that a bag of that size can hold enough explosives to blow up more than just KFC. After a while the security guy also walked up to the bag and stared at it for a while. We looked at each other and muttered that we should get out of the place now. We were joking earlier, but now it was over 10-15 mins and the owner of the bag was still not found. I ate hurriedly and rushed into the washroom to wash my hands and take a leak (hey, I know there was a bomb ticking in there, but like I said I had to take a leak). I was planning on how I would move when I get out of the washroom, take up bag and rush out. I cursed myself because I did not ask my friends to take my bag and move out.

When I walked out into the dining area again, I saw two guys walking out of the door: one of them was carrying a big bagback. I walked closer to our table and saw that the bag that was sitting so conspicuously was now gone. I went over to my friends and asked them whether the owner of the bag was found. They smiled and replied in the affirmative. I was relieved, but now disappointed that I had to rush through my last piece of chicken without being able to savor it properly.

Bomb scare

It was the usual friday evening. I left early from work and met my friends at Mocha, Powai. After a typical friday evening lazy chatter over some coffee, we decided to go eat at KFC. We ordered a fried chicken bucket, french fries, and pepsi (and a zinger for my friend with an especially good appetite). Dinner with friends on a friday evening is something I really enjoy. Good food, good stories......keeps me happy.

When we were deep into our fried chicken, an attendant walked over to our table and asked "Is that your bag sir?". We turned and saw that he was pointing at a bagpack placed on a chair adjacent to our table. It was a good looking bag, one big enough to stuff a laptop into it...the kind we usually carry to work or college. We replied that the bag did not belong to any of us. The attendant nodded and walked away.....probably to ask some other people.

Typical of a bunch of guys spending a lazy evening, we started making jokes about the bag holding explosives, left there by someone with ill intentions. We started debating why someone would like to blow up a joint like KFC with such a low population. Someone said that a bag of that size can hold enough explosives to blow up more than just KFC. After a while the security guy also walked up to the bag and stared at it for a while. We looked at each other and muttered that we should get out of the place now. We were joking earlier, but now it was over 10-15 mins and the owner of the bag was still not found. I ate hurriedly and rushed into the washroom to wash my hands and take a leak (hey, I know there was a bomb ticking in there, but like I said I had to take a leak). I was planning on how I would move when I get out of the washroom, take up bag and rush out. I cursed myself because I did not ask my friends to take my bag and move out.

When I walked out into the dining area again, I saw two guys walking out of the door: one of them was carrying a big bagback. I walked closer to our table and saw that the bag that was sitting so conspicuously was now gone. I went over to my friends and asked them whether the owner of the bag was found. They smiled and replied in the affirmative. I was relieved, but now disappointed that I had to rush through my last piece of chicken without being able to savor it properly.

Friday, November 23, 2007

Books….

I thought I might mention some of the books I have read that I could recommend to others who read fiction. Maybe you, the reader could recommend me some of the good books you've read? So feel free to post comments. Today I write about two of the greatest books I have read.


To Kill a Mockingbird: Harper Lee

ToKillAMockingbirdCoverPulitzer Prize winner published in 1960. One of those very few books I've read whom I could actually call "English Literature” and "novel" at the same time. Written in the first person, this book shows the world from the perspective of a small girl - Jean Lousie "Scout" Finch, and as a grown woman reflecting on her childhood. The author has acknowledged that this character is loosely based on her own childhood. After I read this book, I learned that this novel is widely taught in schools in english speaking countries; and I was surprised at the same time because I never thought I would like a book that was actually taught as literary text. This entertaining and extremely well written novel is tied to the themes of tolerance and prejudice. The character of Atticus Finch, the narrator's father is one of the most enduring fictional images of integrity. Atticus is certainly one of my heroes in the literary world.


 


Catch 22: Joseph Heller

Catch22CoverResulting from its specific use in the book, the phrase "Catch-22" became a term of common usage in the English language meaning a “no win situation”. When I picked up this book, all I knew about the book was that it was based on humor. As I finished the book, I realized that it is also a general critique of bureaucracy and human reasoning.


The writing style of the book was unlike anything I had read before. The prose is circular and paradoxical, something you get used to soon. Normally one would think that such a kind of writing won’t be funny, but the author’s majestic control over the language and the words he chooses makes it a real winner. A lot of the events in the book have been repeatedly described from different points of view at different times; and the description is as if the reader already knows about them. So, with each iteration, we learn a little more about the story.


The way the characters have been developed (and a lot of them), is simply majestic. I think each character represents one facet of human nature. Yossarian, the protagonist of the story is one of my favourites in the literary world.


Books....

I thought I might mention some of the books I have read that I could recommend to others who read fiction. Maybe you, the reader could recommend me some of the good books you've read? So feel free to post comments. Today I write about two of the greatest books I have read.


To Kill a Mockingbird: Harper Lee

Pulitzer Prize winner published in 1960. One of those very few books I've read which I could actually call "English Literature” and novel at the same time. Written in the first person, this book shows the world from the perspective of a small girl - Jean Lousie "Scout" Finch, and as a grown woman reflecting on her childhood. The author has acknowledged that this character is loosely based on her own childhood. After I read this book, I learned that this novel is widely taught in schools in english speaking countries; and I was surprised at the same time because I never thought I would like a book that was actually taught as literary text. This entertaining and extremely well written novel is tied to the themes of tolerance and prejudice. The character of Atticus Finch, the narrator's father is one of the most enduring fictional images of integrity. Atticus is certainly one of my heroes in the literary world.


Catch 22: Joseph Heller

Resulting from its specific use in the book, the phrase "Catch-22" became a term of common usage in the English language meaning a “no win situation”. When I picked up this book, all I knew about the book was that it was based on humor. As I finished the book, I realized that it is also a general critique of bureaucracy and human reasoning.

The writing style of the book was unlike anything I had read before. The prose is circular and paradoxical, something you get used to soon. Normally one would think that such a kind of writing won’t be funny, but the author’s majestic control over the language and the words he chooses makes it a real winner. A lot of the events in the book have been repeatedly described from different points of view at different times; and the description is as if the reader already knows about them. So, with each iteration, we learn a little more about the story.

The way the characters have been developed (and a lot of them), is simply majestic. I think each character represents one facet of human nature. Yossarian, the protagonist of the story is one of my favourites in the literary world.

Thursday, November 15, 2007

Skype woes with IIS

I had installed JBoss on my machine to get Scrumworks Basic working. Somehow that stopped my IIS from working on port 80. So I uninstalled Scrumworks. For some unknown reason, the default website on IIS still wont start. There was this red icon beside default website in IIS. When I tried to start it, it kept giving me the error: Doesnt start -> Unexpected error 0x8ffe2740 occurred. I restarted IIS a number of times, even uninstalled and reinstalled it, but of no avail. I figured that some other application was listening on port 80 which was causing a conflict. But I uninstalled JBoss, then what was causing the issue? Couldnt figure out what application was listening on port 80.....did a google search and found that skype (of all things) could be a culprit....


I did not even bother to look inside the 2nd link (which mentioned the skype). I just exited the thing, and my default website started! Then I read a little further and made a small little change in the skype connection settings as shown.

Skype woes with IIS

I had installed JBoss on my machine to get Scrumworks Basic working. Somehow that stopped my IIS from working on port 80. So I uninstalled Scrumworks. For some unknown reason, the default website on IIS still wont start. There was this red icon beside default website in IIS. When I tried to start it, it kept giving me the error: Doesnt start -> Unexpected error 0x8ffe2740 occurred.

I restarted IIS a number of times, even uninstalled and reinstalled it, but of no avail. I figured that some other application was listening on port 80 which was causing a conflict. But I uninstalled JBoss, then what was causing the issue?

Couldnt figure out what application was listening on port 80.....did a google search and found that skype (of all things) could be a culprit....

http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=cannot+start+default+website+%2B+unexpected+error&btnG=Search&meta=

I did not even bother to look inside the 2nd link (which mentioned the skype). I just exited the thing, and my default website started! Then I read a little further and made a small little change in the skype connection settings as shown.

Friday, October 05, 2007

Viruses, worms, creepy crawlies…

I was about to leave for college to get some documentation work done. I insert my pen drive into the USB port and double click on a folder. What do I notice? It only looks like a folder, but its actually an executable. I instantly realized my terrible mistake, when an IM window popped up on my screen and I saw that a junk message was sent to one of my contacts from my account. It was the irritating and notorious W32/Yahlover.worm. I immediately sent an apology message to all my contacts and logged off.

I tried to clean up all files from my USB drive but it won't let me delete the infected files, which had not replicated itself in each folder in the drive. I started a full system scan and found that there is a file called SSVICHOSST.exe in my system32 folder. This file also tried to access the internet which thankfully my McAfee firewall was able to block.

It all started when I used this same pen drive at a cyber cafe in Matunga to get a print out. When I inserted the stick on my home machine, McAfee said that the autorun.ini file is infected and has been cleaned automatically. I thought that was the end of the story. But somehow the infection had persisted and had spread to my physical machine now. I could not format the pen drive, could not delete the infected file from my comp even though my antivirus did detect the infection. It simply said that it was unable to clean/delete/quarantine the file.

I thought that I would simply deal with the problem later after I get back home and I can simply avoid using Yahoo till the time I fix it. When I got back, I realized that the problem was not just with Yahoo messenger. The rogue files were actually hidden files and the folder options in the tools menu of windows explorer was missing. So there was no way to view hidden files (I always keep this setting to show hidden files). I could not navigate using command line as the command window simply kept disappearing as soon as I open it. Task manager and Regedit won't open. It kept saying that these have been disabled by the Administrator. Even if I get to the files, I won't be able to delete it cos' a rogue process called SSVICHOSST was already running.

At this point there was really something easy that I could have done, but somehow I did it a more geeky way. I first booted into linux and tried to see if I could delete the file, but somehow I had some read/write permission issues, so I just dropped the idea there. I wrote a program in C# to list all the currently running process.

Process[] processes = Process.GetProcesses();foreach (Process process in processes)
{
Console.WriteLine(process.ToString());
if (process.ToString().Contains("SSVICHOSST"))
{
process.Kill();
}
}

That is what actually showed me that there are multiple instances of a process called SSVICHOSST running on my machine. I could not even view the results of my console application till I actually set a breakpoint and debugged into it. Finally I just added a line of code which would kill the process of the above said name. Thankfully the process got killed.

Once that happened, I was able to open the command window, and my antivirus was able to delete the dirty file. Now I also opened msconfig and saw that the file was set to start at bootup, so I unchecked that option too. I still did not have my taskman, regedit, and folder options. But the infected files I thought were gone.

Booted the comp in safe mode, and logged in as Administrator (which should have been the first thing I should have done). I ran the virus scan again and it caught another instance in another folder. This one was attached to the winlogon.exe. I was able to quarantine it so that it does not launch itself everytime with winlogon. Turned off system restore, installed AVG AntiRootkit utility. I searched for malicious instances in the registry and deleted them. (found one in yahoo messenger, and one in msconfig related keys)

Logged back in normal mode and ran the AntiRootkit utility which found nothing. So finally I think the infection was gone, but the damage still remained. To get regedit working, I opened gpedit.msc -> User Configuration | Administrative Templates | System. There was an option pertaining "disable registry editing tools". It was set to "Not configured". Nevertheless I enabled it once, and then set it back to "Not configured". Doing this ensures that the DisableRegistryTools registry value is removed successfully. Now I could open the registry editor.
Next I navigated to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies\ System and deleted the DisableTaskMgr key. This got my taskman back.
Finally made another small change in group policy to get back the folder options. The last thing I did was to disable autorun on all drives using TweakUI.

As I write this, my machine is being scanned by the Kaspersky online AV scanner. I hate people who use their programming skills to create malicious software that causes pain and misery to others.

Viruses, worms, creepy crawlies...

I was about to leave for college to get some documentation work done. I insert my pen drive into the USB port and double click on a folder. What do I notice? It only looks like a folder, but its actually an executable. I instantly realized my terrible mistake, when an IM window popped up on my screen and I saw that a junk message was sent to one of my contacts from my account. It was the irritating and notorious W32/Yahlover.worm. I immediately sent an apology message to all my contacts and logged off.

I tried to clean up all files from my USB drive but it won't let me delete the infected files, which had not replicated itself in each folder in the drive. I started a full system scan and found that there is a file called SSVICHOSST.exe in my system32 folder. This file also tried to access the internet which thankfully my McAfee firewall was able to block.

It all started when I used this same pen drive at a cyber cafe in Matunga to get a print out. When I inserted the stick on my home machine, McAfee said that the autorun.ini file is infected and has been cleaned automatically. I thought that was the end of the story. But somehow the infection had persisted and had spread to my physical machine now. I could not format the pen drive, could not delete the infected file from my comp even though my antivirus did detect the infection. It simply said that it was unable to clean/delete/quarantine the file.

I thought that I would simply deal with the problem later after I get back home and I can simply avoid using Yahoo till the time I fix it. When I got back, I realized that the problem was not just with Yahoo messenger. The rogue files were actually hidden files and the folder options in the tools menu of windows explorer was missing. So there was no way to view hidden files (I always keep this setting to show hidden files). I could not navigate using command line as the command window simply kept disappearing as soon as I open it. Task manager and Regedit won't open. It kept saying that these have been disabled by the Administrator. Even if I get to the files, I won't be able to delete it cos' a rogue process called SSVICHOSST was already running.

At this point there was really something easy that I could have done, but somehow I did it a more geeky way. I first booted into linux and tried to see if I could delete the file, but somehow I had some read/write permission issues, so I just dropped the idea there. I wrote a program in C# to list all the currently running process.

Process[] processes = Process.GetProcesses();

foreach (Process process in processes)
{
Console.WriteLine(process.ToString());
if (process.ToString().Contains("SSVICHOSST"))
{
process.Kill();
}
}



That is what actually showed me that there are multiple instances of a process called SSVICHOSST running on my machine. I could not even view the results of my console application till I actually set a breakpoint and debugged into it. Finally I just added a line of code which would kill the process of the above said name. Thankfully the process got killed.

Once that happened, I was able to open the command window, and my antivirus was able to delete the dirty file. Now I also opened msconfig and saw that the file was set to start at bootup, so I unchecked that option too. I still did not have my taskman, regedit, and folder options. But the infected files I thought were gone.

Booted the comp in safe mode, and logged in as Administrator (which should have been the first thing I should have done). I ran the virus scan again and it caught another instance in another folder. This one was attached to the winlogon.exe. I was able to quarantine it so that it does not launch itself everytime with winlogon. Turned off system restore, installed AVG AntiRootkit utility. I searched for malicious instances in the registry and deleted them. (found one in yahoo messenger, and one in msconfig related keys)

Logged back in normal mode and ran the AntiRootkit utility which found nothing. So finally I think the infection was gone, but the damage still remained. To get regedit working, I opened gpedit.msc -> User Configuration | Administrative Templates | System. There was an option pertaining "disable registry editing tools". It was set to "Not configured". Nevertheless I enabled it once, and then set it back to "Not configured". Doing this ensures that the DisableRegistryTools registry value is removed successfully. Now I could open the registry editor.
Next I navigated to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies\ System and deleted the DisableTaskMgr key. This got my taskman back.
Finally made another small change in group policy to get back the folder options. The last thing I did was to disable autorun on all drives using TweakUI.

As I write this, my machine is being scanned by the Kaspersky online AV scanner. I hate people who use their programming skills to create malicious software that causes pain and misery to others.

Friday, September 07, 2007

Getting Pidgin, getting Gtalk

I installed Ubuntu 7.04 which has Gaim preinstalled in it. For some reason I was not able to get Gtalk working on gaim. I checked up the google support page and found that there weren't any instructions specific to gaim, and now there is Pidgin. So I decided to get Pidgin hoping that GTalk would work on it.

First I downloaded the Pidgin source from http://pidgin.im/ because that seemed to be the preferable thing to do. I realized that I will first have to install some prerequisites before I compile the source. So I did this:

sudo apt-get install libgtk2.0-dev libxml2-dev gettext libnss-dev libnspr-dev

The first package libgtk2.0 dev installs GTK2.0 development headers. I also installed the build-dep gaim package which installs the list of dependencies on your machine that the ubuntu developers used for gaim. After that I uninstalled gaim and gaim-data using synaptic.

Once you are done with that, you are ready to compile the Pidgin source code. First extract the source from the tar archive. Then run ./configure. My friend told me that a regular ./configure won't suffice here because things like google talk may not work. So I configured it with the following switches:

./configure --enable-dbus --enable-nm --enable-mono --enable-gnutls=yes --enable-nss=yes --enable-gtkspell=yes --enable-plugins

That it:
make
sudo make install

That installs Pidgin on the system. To get GTalk working on my Pidgin, in addition to the instructions listed on the google support page, I also had to click on the advanced tab of the account setting and check the "Force old (port 5223) SSL", set connection port to 5223 and connect server to talk.google.com.

Getting Pidgin, getting Gtalk

I installed Ubuntu 7.04 which has Gaim preinstalled in it. For some reason I was not able to get Gtalk working on gaim. I checked up the google support page and found that there weren't any instructions specific to gaim, and now there is Pidgin. So I decided to get Pidgin hoping that GTalk would work on it.

First I downloaded the Pidgin source from http://pidgin.im/ because that seemed to be the preferable thing to do. I realized that I will first have to install some prerequisites before I compile the source. So I did this:

sudo apt-get install libgtk2.0-dev libxml2-dev gettext libnss-dev libnspr-dev

The first package libgtk2.0 dev installs GTK2.0 development headers. I also installed the build-dep gaim package which installs the list of dependencies on your machine that the ubuntu developers used for gaim. After that I uninstalled gaim and gaim-data using synaptic.

Once you are done with that, you are ready to compile the Pidgin source code. First extract the source from the tar archive. Then run ./configure. My friend told me that a regular ./configure won't suffice here because things like google talk may not work. So I configured it with the following switches:

./configure --enable-dbus --enable-nm --enable-mono --enable-gnutls=yes --enable-nss=yes --enable-gtkspell=yes --enable-plugins

That it:
make
sudo make install

That installs Pidgin on the system. To get GTalk working on my Pidgin, in addition to the instructions listed on the google support page, I also had to click on the advanced tab of the account setting and check the "Force old (port 5223) SSL", set connection port to 5223 and connect server to talk.google.com.

Monday, September 03, 2007

Development man pages

I was doing some elementary IPC programming on linux, and was looking for the man pages of the library calls that I was using in my programs (for functions like "perror", "execlp" etc.) 'cos its been a while since I have done anything in C. The way to get the manual page for these calls is:

kv$ man 3 "functionName"

where the number 3 specifies section number 3, which stands for library calls.

Now, it so happens that the development man pages are excluded by default in Ubuntu linux. A quick google search told me that the name of the package I was looking for is "manpages-dev.

Do:
kv$ sudo apt-get install manpages-dev

and you get the documentation for all the methods that you want!

Development man pages

I was doing some elementary IPC programming on linux, and was looking for the man pages of the library calls that I was using in my programs (for functions like "perror", "execlp" etc.) 'cos its been a while since I have done anything in C. The way to get the manual page for these calls is:

kv$ man 3 "functionName"

where the number 3 specifies section number 3, which stands for library calls.

Now, it so happens that the development man pages are excluded by default in Ubuntu linux. A quick google search told me that the name of the package I was looking for is "manpages-dev.

Do:
kv$ sudo apt-get install manpages-dev

and you get the documentation for all the methods that you want!

Sunday, August 19, 2007

SQL Server Reporting Service woes

I just installed SQL Server 2005 on my home PC. When I opened http://localhost/reports to check out if my Reporting Service is working properly, I got the following error:

The report server has encountered a configuration error. See the report server log files for more information. (rsServerConfigurationError)

  • Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\RSReportServer.config' is denied.


I found this post by Teo Lachev that shed some light on the problem. I figured that the rsreportserver.config file must be accessible by the MACHINE\ASPNET user. From Lachev's post, I figured I could right click on the file and simply add another user to the ACL (I remember doing that sometime). But when I click on the file, I dont find any security tab anywhere. I went up to the folder "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer" and right clicked on it:

So I was fretting that I cannot edit the ACL for the file or the folder. I dont know if this is just my machine, or if this is generic. I somehow remember right clicking on a file/folder and adding another user to the ACL of that particular file/folder. But I have done that on my work machine which is part of a domain. Is it not possible to edit ACLs on a stand alone machine which is not part of a domain? Somebody please tell me that.

Meanwhile I was desperate to get my SSRS running, so I wrote this small code snippet in C# to add the ASPNET user to the ReportServer folder:
DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer");

DirectorySecurity dirSecurity = directoryInfo.GetAccessControl();

try

{
DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();
FileSystemAccessRule newAccessRule = new FileSystemAccessRule(new System.Security.Principal.NTAccount("MYCOMP", "ASPNET"), FileSystemRights.FullControl, AccessControlType.Allow);

directorySecurity.AddAccessRule(newAccessRule);
Directory.SetAccessControl(directoryInfo.FullName, directorySecurity);
}
catch (System.Runtime.InteropServices.SEHException sehException)
{
Console.WriteLine(sehException.Message);
}

catch (Exception e)

{
Console.WriteLine(e.Message);
}

After that when I viewed the ACL for this folder, I saw that ASPNET user was successfully added. But this still did not solve my problem. So I wrote a similar piece of code to allow full permissions to the ASPNET user for every file inside the ReportServer folder.

try
{
foreach (FileInfo fileInfo in directoryInfo.GetFiles())
{
FileSystemAccessRule newAccessRule = new FileSystemAccessRule(new System.Security.Principal.NTAccount("MYCOMP", "ASPNET"), FileSystemRights.FullControl, AccessControlType.Allow);
fileSecurity = fileInfo.GetAccessControl();
fileSecurity.AddAccessRule(newAccessRule);
File.SetAccessControl(fileInfo.FullName, fileSecurity);
}
}

catch (System.Runtime.InteropServices.SEHException sehException)
{
Console.WriteLine(sehException.Message);
}

catch (Exception e)
{
Console.WriteLine(e.Message);
}

After this when I tried to access the ReportServer website, it worked!! Anyway, this was just a one time fix. If I reinstall SQL Server again, then I might have run this code again. Is there some way to edit ACLs for a particular file/folder? Maybe I have not done enough searching.

Update: Found this link for the security tab: http://www.mydigitallife.info/2006/07/19/missing-or-no-security-tab-found-in-windows-xp-professional/

SQL Server Reporting Service woes

I just installed SQL Server 2005 on my home PC. When I opened http://localhost/reports to check out if my Reporting Service is working properly, I got the following error:

The report server has encountered a configuration error. See the report server log files for more information. (rsServerConfigurationError)
  • Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\RSReportServer.config' is denied.
I found this post by Teo Lachev that shed some light on the problem. I figured that the rsreportserver.config file must be accessible by the MACHINE\ASPNET user. From Lachev's post, I figured I could right click on the file and simply add another user to the ACL (I remember doing that sometime). But when I click on the file, I dont find any security tab anywhere. I went up to the folder "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer" and right clicked on it:

So I was fretting that I cannot edit the ACL for the file or the folder. I dont know if this is just my machine, or if this is generic. I somehow remember right clicking on a file/folder and adding another user to the ACL of that particular file/folder. But I have done that on my work machine which is part of a domain. Is it not possible to edit ACLs on a stand alone machine which is not part of a domain? Somebody please tell me that.

Meanwhile I was desperate to get my SSRS running, so I wrote this small code snippet in C# to add the ASPNET user to the ReportServer folder:

DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer");
DirectorySecurity dirSecurity = directoryInfo.GetAccessControl();
try
{
DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();
FileSystemAccessRule newAccessRule = new FileSystemAccessRule(new System.Security.Principal.NTAccount("MYCOMP", "ASPNET"), FileSystemRights.FullControl, AccessControlType.Allow);

directorySecurity.AddAccessRule(newAccessRule);
Directory.SetAccessControl(directoryInfo.FullName, directorySecurity);
}

catch (System.Runtime.InteropServices.SEHException sehException)
{
Console.WriteLine(sehException.Message);
}

catch (Exception e)
{
Console.WriteLine(e.Message);
}


After that when I viewed the ACL for this folder, I saw that ASPNET user was successfully added. But this still did not solve my problem. So I wrote a similar piece of code to allow full permissions to the ASPNET user for every file inside the ReportServer folder.

try
{
foreach (FileInfo fileInfo in directoryInfo.GetFiles())
{
FileSystemAccessRule newAccessRule = new FileSystemAccessRule(new System.Security.Principal.NTAccount("MYCOMP", "ASPNET"), FileSystemRights.FullControl, AccessControlType.Allow);
fileSecurity = fileInfo.GetAccessControl();

fileSecurity.AddAccessRule(newAccessRule);
File.SetAccessControl(fileInfo.FullName, fileSecurity);
}
}

catch (System.Runtime.InteropServices.SEHException sehException)
{
Console.WriteLine(sehException.Message);
}

catch (Exception e)
{
Console.WriteLine(e.Message);
}


After this when I tried to access the ReportServer website, it worked!! Anyway, this was just a one time fix. If I reinstall SQL Server again, then I might have run this code again. Is there some way to edit ACLs for a particular file/folder? Maybe I have not done enough searching.

Update: Found this link for the security tab: http://www.mydigitallife.info/2006/07/19/missing-or-no-security-tab-found-in-windows-xp-professional/

Wednesday, August 01, 2007

Why my friends dont do business with ICICI

Many of my friends got ICICI accounts; mostly because it is the into which our monthly salary is credited. All of my friends then move their money into their respective primary accounts with other banks. One of them uses UTI, another uses SBI, while a third one uses HSBC. I always wondered why. I always kept my money in the same account cos I thought that its easier having centralized control over your money.....having a S/B account, a credit card account, and a demat account integrated....having access to your money from so many ATMs, 24 hour telephone access and so many branches.

When I studied elementary distributed systems, I read that it is not a good idea to have a single point of failure. Unfortunately for me, and also for ICICI, we both learned it the hard way. All this while, when I kept a large part of all my money with a single bank, I did not pay much attention to the theory I studied in college earlier.

Today I ordered for a Demand Draft from ICICI (over phone banking) which was for a pretty big amount. I need it urgently as my brother needs to pay his university fees tomorrow. I was told by the phone banking officer that the DD will be ready in 1 hour and that I may collect it from any branch I wish. I decide that I will pick it up from the Mulund (W) branch.

When I reach the branch, I am told that ICICI bank systems are down and that they cannot access any information and hence cannot process my DD. Apparently none of the people at ICICI's operations and computer systems department knew anything about distributed systems and fault tolerance. They thought that having their back end servers at one location would be fine, and that their customers will be fine if a fire breaks out and if all their servers go down. The customer relationship officers at the bank are noncommittal: I wait for over two hours; but no avail. Oh and since even I have a single point of failure i.e. all my money in a single bank, I cannot withdraw money so that I could get the DD done from another bank.

But luckily for me, I dont claim to have thousands of satisfied customers, and that I can correct my situation of a single point of failure by moving bulk of my transactions to other banks. The service and policies of ICICI also motivate me to do that. A bank loses its credibility the moment it does not allow its customers to access their own money. That happened today. It was certainly because of a technical problem, but they should have done their homework better. It is going to cost them a lot more, maybe even a few customers like me.

My travails dont end here. I finally am able to withdraw the maximum amount of money allowed by their ATMs (some of them are working incidentally), but this amount is far lesser than the total amount of the DD. I still need to withdraw the rest of the money tomorrow. All this in the hope that I can give the money to my brother and that he can get the DD done from some other bank tomorrow. I was told at the bank that I will be able to cancel the DD using phone banking as that is the medium I used to place the order. Wonder of wonders.....when I call up, the phone banking officer tells me that the transaction is now in the scope of the branch now, and that I cannot cancel over telephone. I will actually have to walk into the same branch again and beg them to cancel the DD now as it is of no use to me any more, and plead with them to not charge me any cancellation fee. Sometimes just getting a particular service is not everything; it is important that you get it on time.

Well, all this made me recall my the fault tolerance chapter from distributed systems. I am certainly going to apply it in real life by moving my transactions to some other banks that really work when you need them to.

Why my friends dont do business with ICICI

Many of my friends got ICICI accounts; mostly because it is the into which our monthly salary is credited. All of my friends then move their money into their respective primary accounts with other banks. One of them uses UTI, another uses SBI, while a third one uses HSBC. I always wondered why. I always kept my money in the same account cos I thought that its easier having centralized control over your money.....having a S/B account, a credit card account, and a demat account integrated....having access to your money from so many ATMs, 24 hour telephone access and so many branches.

When I studied elementary distributed systems, I read that it is not a good idea to have a single point of failure. Unfortunately for me, and also for ICICI, we both learned it the hard way. All this while, when I kept a large part of all my money with a single bank, I did not pay much attention to the theory I studied in college earlier.

Today I ordered for a Demand Draft from ICICI (over phone banking) which was for a pretty big amount. I need it urgently as my brother needs to pay his university fees tomorrow. I was told by the phone banking officer that the DD will be ready in 1 hour and that I may collect it from any branch I wish. I decide that I will pick it up from the Mulund (W) branch.

When I reach the branch, I am told that ICICI bank systems are down and that they cannot access any information and hence cannot process my DD. Apparently none of the people at ICICI's operations and computer systems department knew anything about distributed systems and fault tolerance. They thought that having their back end servers at one location would be fine, and that their customers will be fine if a fire breaks out and if all their servers go down. The customer relationship officers at the bank are noncommittal: I wait for over two hours; but no avail. Oh and since even I have a single point of failure i.e. all my money in a single bank, I cannot withdraw money so that I could get the DD done from another bank.

But luckily for me, I dont claim to have thousands of satisfied customers, and that I can correct my situation of a single point of failure by moving bulk of my transactions to other banks. The service and policies of ICICI also motivate me to do that. A bank loses its credibility the moment it does not allow its customers to access their own money. That happened today. It was certainly because of a technical problem, but they should have done their homework better. It is going to cost them a lot more, maybe even a few customers like me.

My travails dont end here. I finally am able to withdraw the maximum amount of money allowed by their ATMs (some of them are working incidentally), but this amount is far lesser than the total amount of the DD. I still need to withdraw the rest of the money tomorrow. All this in the hope that I can give the money to my brother and that he can get the DD done from some other bank tomorrow. I was told at the bank that I will be able to cancel the DD using phone banking as that is the medium I used to place the order. Wonder of wonders.....when I call up, the phone banking officer tells me that the transaction is now in the scope of the branch now, and that I cannot cancel over telephone. I will actually have to walk into the same branch again and beg them to cancel the DD now as it is of no use to me any more, and plead with them to not charge me any cancellation fee. Sometimes just getting a particular service is not everything; it is important that you get it on time.

Well, all this made me recall my the fault tolerance chapter from distributed systems. I am certainly going to apply it in real life by moving my transactions to some other banks that really work when you need them to.

Monday, June 11, 2007

Safari for windows?


So, Apple has launched its Safari browser for windows. Somebody told me that Safari claimed that it was the fastest browser running on windows: 1.6x faster than Firefox and 2x faster than IE7. I dont know; the difference isnt that obvious on first use. The pages load just fine.
The user interface of the browser is exactly the same as that found on the Mac. It looks fine.

The first question that was raised in my mind is that who will actually use the Safari browser on windows when you have IE7 and FF2? Unless there is some real compelling reason, I dont think a firefox loyalist like me will move on to use Safari. There are a couple of things about Safari that irritate me you see. First of all, it doesn't support the hotkeys that have been support on IE and Firefox for quite a while.
Type "google" and hit ctrl+ enter on Safari: nothing happens, and you are left with an irritating surprise. There is another kind of URL completion feature on the Safari though. You type a URL, and the browser somehow guesses the .com or .org part of the URL.

The only use I see now is that testing web applications will be easier. Applications that are also targetting the Safari browser can be tested on a windows machine instead of setting up a dedicated Mac machine like we have been doing till now.



By the way, read this post on slashdot which talks about a couple of bugs found on the first day in the windows version of Safari. Oh and one more thing to note: when I checked the plugins installed in the browser by default, look what I found.

Thats the Windows Genuine Advantage plugin bundled right into Safari!

Safari for windows?


So, Apple has launched its Safari browser for windows. Somebody told me that Safari claimed that it was the fastest browser running on windows: 1.6x faster than Firefox and 2x faster than IE7. I dont know; the difference isnt that obvious on first use. The pages load just fine.
The user interface of the browser is exactly the same as that found on the Mac. It looks fine.

The first question that was raised in my mind is that who will actually use the Safari browser on windows when you have IE7 and FF2? Unless there is some real compelling reason, I dont think a firefox loyalist like me will move on to use Safari. There are a couple of things about Safari that irritate me you see. First of all, it doesn't support the hotkeys that have been support on IE and Firefox for quite a while.
Type "google" and hit ctrl+ enter on Safari: nothing happens, and you are left with an irritating surprise. There is another kind of URL completion feature on the Safari though. You type a URL, and the browser somehow guesses the .com or .org part of the URL.

The only use I see now is that testing web applications will be easier. Applications that are also targetting the Safari browser can be tested on a windows machine instead of setting up a dedicated Mac machine like we have been doing till now.

By the way, read this post on slashdot which talks about a couple of bugs found on the first day in the windows version of Safari. Oh and one more thing to note: when I checked the plugins installed in the browser by default, look what I found.

Sunday, May 27, 2007

Cooking for pleasure

I love food, and I love cooking for pleasure. I am always on the lookout for easy to do recipes that I can try on weekends. Nowadays, if I don't try cooking something new on a weekend, I feel a little disappointed; especially after I got a new microwave oven.
Microwave ovens are real cool things. They make cooking nice and fun, and owning one opens you to a completely new vista of dishes that you normally cannot do without one. Only last week I tried baking a couple of pizzas, and it came out pretty good for a first time. I could never try out things like pizzas and muffins without an oven. Besides being able to bake, you can really speed up your cooking when you microwave.
Now today is a typical sunday. I wake up and find that there is nothing for breakfast. Typical opportunity to notch up something nice. So, I decided to make a grilled sandwich variation today for breakfast.
Now there are some things that you must always have at home if you want to avoid the irritation of actually going down to the grocery shop when you want to cook something: potatoes, tomatoes, and onions are an absolute must. Even if you are not trying to do something fancy, these things are required almost everyday at home. Since I wanted to make sandwiches, I wanted bread, butter, cheese and capsicums. Thankfully my brother got these things for me while I did my initial chopping and frying. This is when I realized that one should always have butter and cheese at home (atleast I should).

I wanted sprouted moong dal, but there was no time for that. I checked my fridge and I luckily found boiled potatoes. Good. You always need some good binding agent when making sandwich. So, I peeled the potatoes, mashed them and put them in a wok. Added a dash of salt, red chilly powder, and a little oil. Then I fried this mixture for a while cos I don't like the raw smell of boiled potatoes.
I chopped the tomatoes, onions, and capsicum into small equal sized pieces. Added a dash of salt and pepper and microwaved them for 1 minute at 100% power. (Boy I really like the smell of those crisp capsicums when they are very slightly cooked.)
Next I applied some butter on a bread slice and spread some of my boiled potato mixture on it. Topped this with some of my tomato, capsicum, and onion mixture and sprinkled some grated cheese on it. Note that this is an open sandwich, in the sense that it is only a single slice of bread without one on the top of my stuffing (?) mixture.
Now this was ready to be grilled for about 10 minutes (or till the cheese melts). Boy, when the 10 minutes were over, and when I opened the door to the oven, I was greeted by an inviting smell of crispy capsicums and melted cheese. It turned out pretty good....crispy bread with a nice topping of veggies bound by the layer of mashed potatoes, topped by melted cheese.
Served with some ketchup and accompanied by some coke....a perfect start to a nice Sunday.

Cooking for pleasure

I love food, and I love cooking for pleasure. I am always on the lookout for easy to do recipes that I can try on weekends. Nowadays, if I don't try cooking something new on a weekend, I feel a little disappointed; especially after I got a new microwave oven.
Microwave ovens are real cool things. They make cooking nice and fun, and owning one opens you to a completely new vista of dishes that you normally cannot do without one. Only last week I tried baking a couple of pizzas, and it came out pretty good for a first time. I could never try out things like pizzas and muffins without an oven. Besides being able to bake, you can really speed up your cooking when you microwave.
Now today is a typical sunday. I wake up and find that there is nothing for breakfast. Typical opportunity to notch up something nice. So, I decided to make a grilled sandwich variation today for breakfast.
Now there are some things that you must always have at home if you want to avoid the irritation of actually going down to the grocery shop when you want to cook something: potatoes, tomatoes, and onions are an absolute must. Even if you are not trying to do something fancy, these things are required almost everyday at home. Since I wanted to make sandwiches, I wanted bread, butter, cheese and capsicums. Thankfully my brother got these things for me while I did my initial chopping and frying. This is when I realized that one should always have butter and cheese at home (atleast I should).

I wanted sprouted moong dal, but there was no time for that. I checked my fridge and I luckily found boiled potatoes. Good. You always need some good binding agent when making sandwich. So, I peeled the potatoes, mashed them and put them in a wok. Added a dash of salt, red chilly powder, and a little oil. Then I fried this mixture for a while cos I don't like the raw smell of boiled potatoes.
I chopped the tomatoes, onions, and capsicum into small equal sized pieces. Added a dash of salt and pepper and microwaved them for 1 minute at 100% power. (Boy I really like the smell of those crisp capsicums when they are very slightly cooked.)
Next I applied some butter on a bread slice and spread some of my boiled potato mixture on it. Topped this with some of my tomato, capsicum, and onion mixture and sprinkled some grated cheese on it. Note that this is an open sandwich, in the sense that it is only a single slice of bread without one on the top of my stuffing (?) mixture.
Now this was ready to be grilled for about 10 minutes (or till the cheese melts). Boy, when the 10 minutes were over, and when I opened the door to the oven, I was greeted by an inviting smell of crispy capsicums and melted cheese. It turned out pretty good....crispy bread with a nice topping of veggies bound by the layer of mashed potatoes, topped by melted cheese.
Served with some ketchup and accompanied by some coke....a perfect start to a nice Sunday.

Tuesday, May 22, 2007

New venue for WGA notifier


My brother: "Hey, my friend is getting a weird popup; it says that his copy of windows is not genuine. What to do?."

Me: "Ask your friend to turn off windows updates."

Bro: "What will happen if windows updates is turned off?"

Me: "Nothing!"

Yup, if you want nothing to happen, then turn off your windows updates. I am no supporter of piracy, but I feel that the cost of a genuine copy of Windows XP is a little too high in India.

The problem with most Indian users is that they don't know whether their copy of windows is genuine or not. Most of them have their windows updates ON by default. This went fine till the time Microsoft decided to push the WGA (Windows Genuine Advantage) notifier through the windows updates service. This is when the notifier got installed on user PCs and it started pestering people saying that their copy of windows is not genuine. Well, the ideal thing to do when you find out that your copy is not genuine is to click on the Get Genuine button and get a licensed version. But that doesnt seem to be a viable option for poor people who cannot afford one . Well, the good thing is that Microsoft doesn't do much more than just inform the user of the status of his/her operating system, i.e. genuine, non-genuine etc. This doesnt cause you much more trouble than the occassional irritation of looking at the notifier popup (which can also be avoided using some hacks). Thankfully Microsoft isn't taking legal action against the erring users (as yet). So the situation is fine for now.

Consider this: The windows xp service pack 3 is underway. It will be available in a couple of months. Now imagine what happens if the WGA notifier is integrated inside the service pack 3? All users who install SP3, get the pesky notifier on every boot up (unless you work around it). This move will not be unanticipated since Microsoft already has GenuineCheck.dll integrated with most of its downloads.

So basically the users need to be aware that they are using pirated operating systems, and that windows updates and the service packs are not meant for them.

Where did I get this idea of WGA notifier integrated with SP3? Dont ask me.

New venue for WGA notifier


My brother: "Hey, my friend is getting a weird popup; it says that his copy of windows is not genuine. What to do?."

Me: "Ask your friend to turn off windows updates."

Bro: "What will happen if windows updates is turned off?"

Me: "Nothing!"

Yup, if you want nothing to happen, then turn off your windows updates. I am no supporter of piracy, but I feel that the cost of a genuine copy of Windows XP is a little too high in India.

The problem with most Indian users is that they don't know whether their copy of windows is genuine or not. Most of them have their windows updates ON by default. This went fine till the time Microsoft decided to push the WGA (Windows Genuine Advantage) notifier through the windows updates service. This is when the notifier got installed on user PCs and it started pestering people saying that their copy of windows is not genuine. Well, the ideal thing to do when you find out that your copy is not genuine is to click on the Get Genuine button and get a licensed version. But that doesnt seem to be a viable option for poor people who cannot afford one . Well, the good thing is that Microsoft doesn't do much more than just inform the user of the status of his/her operating system, i.e. genuine, non-genuine etc. This doesnt cause you much more trouble than the occassional irritation of looking at the notifier popup (which can also be avoided using some hacks). Thankfully Microsoft isn't taking legal action against the erring users (as yet). So the situation is fine for now.

Consider this: The windows xp service pack 3 is underway. It will be available in a couple of months. Now imagine what happens if the WGA notifier is integrated inside the service pack 3? All users who install SP3, get the pesky notifier on every boot up (unless you work around it). This move will not be unanticipated since Microsoft already has GenuineCheck.dll integrated with most of its downloads.

So basically the users need to be aware that they are using pirated operating systems, and that windows updates and the service packs are not meant for them.

Where did I get this idea of WGA notifier integrated with SP3? Dont ask me.

Monday, May 14, 2007

ब्लोगगींग इन hindi

I just discovered this feature in blogger where you could post in Hindi. The good thing is that it works on phoenetics, which makes it easier to transliterate words into Hindi from English. Just type words like they would sound in hindi, and the software attempts to convert it into the hindi word. Its not perfect yet, but a pretty good attempt I would say. And whats more? It remembers the corrections you make; so you dont need to do them again and again.

अब सोचने कि बात यह है के कितने लोग हिंदी में पोस्ट करना पसंद करते हैं

Yup, I see the spelling mistake above. Shows that its not perfect yet. Still some kinks to iron out, but it feels good to be able to post in my national language.

ब्लोगगींग इन hindi

I just discovered this feature in blogger where you could post in Hindi. The good thing is that it works on phoenetics, which makes it easier to transliterate words into Hindi from English. Just type words like they would sound in hindi, and the software attempts to convert it into the hindi word. Its not perfect yet, but a pretty good attempt I would say. And whats more? It remembers the corrections you make; so you dont need to do them again and again.

अब सोचने कि बात यह है के कितने लोग हिंदी में पोस्ट करना पसंद करते हैं

Yup, I see the spelling mistake above. Shows that its not perfect yet. Still some kinks to iron out, but it feels good to be able to post in my national language.

Thursday, April 12, 2007

WiX

I got to work on something cool today. Windows Installer XML toolset (WiX) is a set of tools and specifications that help you build Windows installation packages (.msi and .msm) from an XML document. WiX is released by Microsoft under the Common Public License.
WiX brings into setups, the traditional compile and build model to create executables from a source code file. It is written in C# and requires the .NET Framework to be installed on your machine.


A google search on WiX yields a couple of good resouces that tell you what exactly it is, so I am not going to delve much into that. I spent quite a bit of time today trying to get this thing to create an installer that would execute a TSQL during the installation when I found that WiX has a built in support for executing TSQL scripts directly without you having to invoke the sqlcmd utility. (In normal circumstances you would include a custom action in your setup project that would execute scripts using sqlcmd). Obviously, you can do a lot more in WiX than just that.


A good practical scenario of this requirement is when you have to create patches and bugfixes to an existing hosted build of your application. The advantage of creating a patch in the form of an msi file instead of an exe is that an msi is an installer database file which is tracked by your operating system. Later on, you can easily find out what patches you have applied simply by going to you add/remove programs menu.

Anyway, coming back to my purpose of writing this post; there are hardly any good resources online that give you a complete working example and/or tell you what exactly to do when you have to deal with SQL scripts while using WiX. Here is a sample working .wxs file that creates an msi. When the msi is installed, the TSQL script in two .sql files are executed.




<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="
http://schemas.microsoft.com/wix/2003/01/wi
">
<Product Id="24B6D4E2-2FC2-448F-B4E3-C7FBC8790C50" Name="MyProduct" Language="1033" Version="1.0.0.0


" Manufacturer="kvsoft">

<Package Id="3B54E578-A304-437E-91A8-4299246848DE"
Description="Description of your product" Comments="This will appear in
the file summary stream." InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
<User Id="SqlUser" Name="sa" Password="somepassword"></User>
<SqlDatabase Id="MySqlDatabase" Database="TryOuts" Server="krishnamurthyk" User="SqlUser" /><Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="MyAppDir" LongName="My Application Directory">

<Component Id="ProductComponent" Guid="AA0225A7-F189-47CC-9D22-D84A577BB431">
<SqlScript Id="CreateTableScript" BinaryKey="DatabaseScriptBin"
ExecuteOnInstall="yes" SqlDb="MySqlDatabase" />
<SqlScript Id="SecondScript" BinaryKey="SecondScript" ExecuteOnInstall="yes" SqlDb="MySqlDatabase"><
/SqlScript>
</Component>
</Directory>

</Directory>
</Directory>
<Binary Id="DatabaseScriptBin" src="Test.sql" mce_src="Test.sql" />
<Binary Id="SecondScript" src="SecondScript.sql" mce_src="SecondScript.sql"/><Feature Id="ProductFeature" Title="Feature Title" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
</Product>
</Wix>


Today I was repeatedly getting an error:



Unresolved reference to symbol 'CustomAction:ConfigureSql' in
section 'Product:0780EA99-9329-47AD-8CF5-C2274939FC85'.


This error disappears when I comment the SqlDatabase tag. The problem, as it turned out was funny: a missing reference. In order to get this working, you need to include a reference to sca.wixlib if you are using the Visual Studio WiX project.


If you are working with the command line utilities, then this is what you do:


> candle.exe Product.wxs
At this step, you will have an intermediate file called
Product.wixobj.


> light.exe -o MySetup.msi Product.wixobj "E:/WiX/sca.wixlib"


Voila, you have the require msi file. I hope this helps all the developers out there.
Maybe when I learn more of this, I would do a more descriptive tutorial.

WiX

I got to work on something cool today. Windows Installer XML toolset (WiX) is a set of tools and specifications that help you build Windows installation packages (.msi and .msm) from an XML document. WiX is released by Microsoft under the Common Public License.
WiX brings into setups, the traditional compile and build model to create executables from a source code file. It is written in C# and requires the .NET Framework to be installed on your machine.

A google search on WiX yields a couple of good resouces that tell you what exactly it is, so I am not going to delve much into that. I spent quite a bit of time today trying to get this thing to create an installer that would execute a TSQL during the installation when I found that WiX has a built in support for executing TSQL scripts directly without you having to invoke the sqlcmd utility. (In normal circumstances you would include a custom action in your setup project that would execute scripts using sqlcmd). Obviously, you can do a lot more in WiX than just that.

A good practical scenario of this requirement is when you have to create patches and bugfixes to an existing hosted build of your application. The advantage of creating a patch in the form of an msi file instead of an exe is that an msi is an installer database file which is tracked by your operating system. Later on, you can easily find out what patches you have applied simply by going to you add/remove programs menu.

Anyway, coming back to my purpose of writing this post; there are hardly any good resources online that give you a complete working example and/or tell you what exactly to do when you have to deal with SQL scripts while using WiX. Here is a sample working .wxs file that creates an msi. When the msi is installed, the TSQL script in two .sql files are executed.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="
http://schemas.microsoft.com/wix/2003/01/wi
">
<Product Id="24B6D4E2-2FC2-448F-B4E3-C7FBC8790C50" Name="MyProduct" Language="1033" Version="1.0.0.0

" Manufacturer="kvsoft">

<Package Id="3B54E578-A304-437E-91A8-4299246848DE"
Description="Description of your product" Comments="This will appear in
the file summary stream." InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />
<User Id="SqlUser" Name="sa" Password="somepassword"></User>
<SqlDatabase Id="MySqlDatabase" Database="TryOuts" Server="krishnamurthyk" User="SqlUser" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="MyAppDir" LongName="My Application Directory">

<Component Id="ProductComponent" Guid="AA0225A7-F189-47CC-9D22-D84A577BB431">


<SqlScript Id="CreateTableScript" BinaryKey="DatabaseScriptBin"
ExecuteOnInstall="yes" SqlDb="MySqlDatabase" />
<SqlScript Id="SecondScript" BinaryKey="SecondScript" ExecuteOnInstall="yes" SqlDb="MySqlDatabase"><
/SqlScript>
</Component>


</Directory>

</Directory>
</Directory>
<Binary Id="DatabaseScriptBin" src="Test.sql" />
<Binary Id="SecondScript" src="SecondScript.sql"/>

<Feature Id="ProductFeature" Title="Feature Title" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
</Product>
</Wix>

Today I was repeatedly getting an error:

Unresolved reference to symbol 'CustomAction:ConfigureSql' in
section 'Product:0780EA99-9329-47AD-8CF5-C2274939FC85'.

This error disappears when I comment the SqlDatabase tag. The problem, as it turned out was funny: a missing reference. In order to get this working, you need to include a reference to sca.wixlib if you are using the Visual Studio WiX project.

If you are working with the command line utilities, then this is what you do:

> candle.exe Product.wxs
At this step, you will have an intermediate file called
Product.wixobj.

> light.exe -o MySetup.msi Product.wixobj "E:/WiX/sca.wixlib"

Voila, you have the require msi file. I hope this helps all the developers out there.
Maybe when I learn more of this, I would do a more descriptive tutorial.



Sunday, January 14, 2007

God is a computer engineer


“God is a computer engineer”. I have had this phrase as my yahoo status message for a very long time now. Its a funny thought, but somehow, it made some sense to me.

One of the greatest things that we computer engineers have been trying to achieve in all our hardware and software systems is intelligence. Defined formally, it is the ability of a system to act rationally: doing the “right thing”, given what it knows. The Turing test, proposed by Alan Turing, was designed to provide a satisfactory operational definition of intelligence. The system proposed by Turing, needed to possess the following capabilities to be termed as truly intelligent:


  • Natural Language Processing: to enable it to communicate successfully

  • Knowledge Representation: to store what it knows

  • Reasoning: to use the stored information to draw conclusions

  • Machine learning: to adapt to new circumstances, and learn new patterns


Only once we think about these disciplines from the perspective of AI, do we truly understand how difficult it is to achieve them in one of our computer systems. AI has been inspired by the way humans act and behave. The Turing test was designed to simulate a system which was largely human-like. This is hardly surprising, as humans have been the paragons when it comes to AI.

We humans dont think that these functionalities listed above are much of a big deal, because we are so used to them, because of the fact that these properties have been embedded in humans with such an amazing degree of perfection, that it seems completely natural. Only once you think from the perspective of a computer engineer trying to implement intelligence in a system, would you truly understand the complexity involved.

I cannot help but feel amazed at the complex systems that are humans. And I find it meaningful to think that it is not a mere co-incidence that humans are intelligent creatures. This is where my thought comes in where I say that “God is a computer engineer”.

I am not trying to propagate the “theory of intelligent design”. Neither am I trying to argue with atheists. It was just a thought that came to me once, that human beings are probably the perfect example of what we want to achieve with AI one day. After studying a little bit about intelligent systems, I realise how difficult it is to create even moderately intelligent systems; and whatever little success we have had, none of that was by mere co-incidence. None of these systms just sprang up magically out of the air. These systems were the result of years of study, experiment, trial and error, sweat, tears and blood.

Having said that, its a little funny to believe that we, the perfectly intelligent human beings turned out to be intelligent by co-incidence.

I believed that human beings are the result of a similar effort, being created out of primitive creatures, eventually evolving into the current state of intelligence. Today human beings are intelligent enough, not only to exhibit features such as natural language processing, logical reasoning and decision making, learning, and much more; but also make intelligent systems of their own.

I believed that God created man (yes, I can hear the Darwinists scream, but again I say, I am not trying to propagate or debunk a theory here). Like a pioneering computer engineer, God created such intelligent creatures (read humans) that are able to create intelligent creatures of their own.

God is a computer engineer

“God is a computer engineer”. I have had this phrase as my yahoo status message for a very long time now. Its a funny thought, but somehow, it made some sense to me.

One of the greatest things that we computer engineers have been trying to achieve in all our hardware and software systems is intelligence. Defined formally, it is the ability of a system to act rationally: doing the “right thing”, given what it knows. The Turing test, proposed by Alan Turing, was designed to provide a satisfactory operational definition of intelligence. The system proposed by Turing, needed to possess the following capabilities to be termed as truly intelligent:

  • Natural Language Processing: to enable it to communicate successfully
  • Knowledge Representation: to store what it knows
  • Reasoning: to use the stored information to draw conclusions
  • Machine learning: to adapt to new circumstances, and learn new patterns

Only once we think about these disciplines from the perspective of AI, do we truly understand how difficult it is to achieve them in one of our computer systems. AI has been inspired by the way humans act and behave. The Turing test was designed to simulate a system which was largely human-like. This is hardly surprising, as humans have been the paragons when it comes to AI.

We humans dont think that these functionalities listed above are much of a big deal, because we are so used to them, because of the fact that these properties have been embedded in humans with such an amazing degree of perfection, that it seems completely natural. Only once you think from the perspective of a computer engineer trying to implement intelligence in a system, would you truly understand the complexity involved.

I cannot help but feel amazed at the complex systems that are humans. And I find it meaningful to think that it is not a mere co-incidence that humans are intelligent creatures. This is where my thought comes in where I say that “God is a computer engineer”.

I am not trying to propagate the “theory of intelligent design”. Neither am I trying to argue with atheists. It was just a thought that came to me once, that human beings are probably the perfect example of what we want to achieve with AI one day. After studying a little bit about intelligent systems, I realise how difficult it is to create even moderately intelligent systems; and whatever little success we have had, none of that was by mere co-incidence. None of these systms just sprang up magically out of the air. These systems were the result of years of study, experiment, trial and error, sweat, tears and blood.

Having said that, its a little funny to believe that we, the perfectly intelligent human beings turned out to be intelligent by co-incidence.

I believed that human beings are the result of a similar effort, being created out of primitive creatures, eventually evolving into the current state of intelligence. Today human beings are intelligent enough, not only to exhibit features such as natural language processing, logical reasoning and decision making, learning, and much more; but also make intelligent systems of their own.

I believed that God created man (yes, I can hear the Darwinists scream, but again I say, I am not trying to propagate or debunk a theory here). Like a pioneering computer engineer, God created such intelligent creatures (read humans) that are able to create intelligent creatures of their own.