Deploying Services in C#

In case any of you have ever written a Windows Service in C#, I am quite sure you have deployed the service via a setup and deployment project in Visual Studio .NET. In any case writing and deploying such a service is quite an easy task. You can find instructions on how to write a service and get it installed via a setup file on MSDN.

Now this works fine for the ideal case where you perform only two actions on your service, namely Install and Uninstall. However if you have worked on Windows and installed as many programs as I have, you might have noticed that under Add / Remove programs almost all apps have an option – Repair. Now a repair merely reinstalls the application. In case of the above mentioned setup project, the re-installation fails with the error

“The specified service already exists”

This occurs because a reinstall includes running custom actions, and so the Installer class tries to install the service all over again. This can be prevented by adding a Condition of NOT REINSTALL on the Install and Commit custom actions in the setup project. This way these won’t get called during a repair / reinstall.

Technorati tags:  ,  ,  

Obtain the DNS while on DHCP on Mac OS X

Just the other day I needed to look up the DNS on my Mac. Now if you look at network preferences and if you are connected to the net via DHCP, Mac OS X provides you with a quite unhelpful looking window.

network preferences
Network Preferences

Of course there is a CLI to obtain this information. All you need to do is hit

ipconfig getpacket en1

(en1 is the network interface you are interested in). Voila, you have what you need.
I was pretty surprised that ipconfig works on *nix too. I always thought that ifconfig was for *nix and ipconfig was for Windows.

Technorati tags:  ,  ,  ,  

Directshow … No longer available?

I use Directshow quite a bit in my work, and quite like the way it works. Anyway since the November, Directshow headers, samples and include files are no longer shipped as a part of DirectX SDK. It turns out that Directshow has been moved to the Extras portion of the SDK. So in case any of you use Directshow and wanna grab a copy, you can do so by downloading the DirectX SDK extras. Also Mike Wasson provides some further information. Looks like directshow is being moved into Platform SDK. So I guess in the future you will be able to download it from here

Technorati tags:  ,  ,  

W3C XHTML Compliance Woes

As you might have noticed almost all pages in my website are valid XHTML 1.0 Transitional. However there is a catch in this compliance. I have total control over my posts. In fact, I went so far as to edit all my previous posts (I know there are not too many, but 32 is still quite a big number), just to make sure they meet the XHTML standards. However I have comments on my website, over which I have little control. As in all I can do with the comments is delete / add. Now almost all these comments have a <BR> instead of a <br>, which is not valid XHTML. So unfortunately almost all my pages with comments on them are not valid XHTML. So I have decided that I am not going to bother with those. I will continue to take pains to ensure that all my posts are valid XHTML. But for things beyond my control, I shall not care :).

Technorati tags:  ,  

Combo Boxes in Safari and Firefox

Hmm I was seeing how my website renders on different browsers, namely

  • Safari
  • Firefox on Mac
  • Firefox on Windows
  • Opera on Mac
  • Opera on Windows
  • Internet Explorer on Windows

I really like the combo-boxes produced by Safari. I think it uses the native Aqua UI to produce those, and do they look nice. Opera does produce native UI on the Mac, but Firefox doesn’t. It would be really nice if we could get similar looking web UI on other platforms too.
Here is an image of a combo box on different browsers and platforms.


Combo boxes on various browsers and platforms
Combo boxes on various browsers and platforms

Technorati tags:  ,  

Site search up

Yeah, I got a site search running. I know you think it is a small thing, and you might say that I should have used Google site search right? Well trust me, it is not a small matter, and I too wanted to use Google but decided not to. Let me explain why. I looked at the services that Google provided. I wanted a solution that would return the search results in my own template. As in the resulting page should be hosted on my website and not on someone else’s. Google did seem to have a solution, however my guess is the service is down. According to the description, I should be able to customize Google for my site. However, when I tried to do so, I got an error that my website had not been indexed by Google yet. I found this kinda odd, coz I get a lot of hits from people who are directed to me via Google. So then I checked if ASU was indexed, and guess what Google said it wasn’t. Same result with Stanford, Google and Yahoo. Here is a sample error message.

Google site search error

So this ruled Google out of the picture. I surely didn’t want to use the normal search because the results were displayed on Google’s webpage and hence I had no control over the format. So I looked up the internet and hit upon this porject called phpDig. Nice php and MySql based application. It runs a spider on your website and is HIGHLY customizable. So I jumped at the opportunity and incorporated it into my website. So the search you see running is powered by phpDig. Thanks you guys!! I will make a donation to the project tomorrow, I promise.
Now phpDig works fine, but another issue is running the spider at regular intervals. If I did have root access on the server, it would have worked out fine. Unfortunately the server is not owned by me and hence I cannot schedule a cron job. This is where fake-cron stepped in. Quoting from their document

Fake Cron is a script which has been designed to simulate the cron process on webservers. It is useful where cron is not permitted or where you would like an easy admin interface to control your various cron activated scripts.

So I got that too installed and wrote a small shell script that runs my spider and voila I am good to go. Customizing the search page took a while, but now I am quite happy with the way it looks. So thats my saga of the search. If anyone needs any help setting up a similar setup, lemme know.

Technorati tags:  ,  ,  ,  

Access Keys in HTML

I adapted the current template for my website from the great guys at CSSZenGarden. Now CSSZenGarden ensures that their page is accessible by people who use screen readers. One of the things they use in their HTML markup is access keys. The purpose of these access keys is to allow people who use a screen reader to navigate between links with more ease. Hence I thought it would be a pretty smart idea to include the same in my markup and I initially did. However it was pointed out by Anantha that by enabling these keys, I killed the Alt+D shortcut (Open Location or go to address bar) on windows, since the modifier for access keys on windows is the Alt key, and I had assigned the D key to my photogallery. This was something I had not taken into account while using these keys. Anyway I was reading this article and the author mentions that people using screen readers often hit the same roadblock since almost all keyboard shortcuts are already used by their screen-readers (Jaws etc.). Quoting from the website

Disappointingly, our research discovered that all but 3 keys were previously “claimed” by one technology or the other:

AccessKey / (slash)
AccessKey (backslash)
AccessKey ] (right square bracket)

At that point it was then pointed out that even these keys would be inaccessible to users not using a North American Standard (QWERTY) keyboard. So while it seems that Accesskeys is a great idea in principle, implementation brings with it the possibility that it either will not be available to all users, or that the keystroke combination encoded within the web page may conflict with a reserved keystroke combination in an adaptive technology or future user agent.

So in conclusion, it seems there is really no point using access keys on a website. Hence I have now done away with all access keys. I do plan to make my website accessible and will work that out sometime soon.

Technorati tags:  ,  ,  

Adding RSS/ATOM feed autodetection to your website

For all you people who use Firefox, you might have noticed that Firefox automatically detects RSS / ATOM feeds. When you are on a site that is syndicated via a news feed, Firefox shows a small orange icon on the bottom right corner. Now almost all blogging services automatically produce these feeds, but unfortunately there is not too much information out there on how to make a browser automatically detect these feeds. Anyway long story short, it is just a matter of adding a small little line in your HTML head.

<link rel=”alternate” type=”application/rss+xml” title=”Atom feed” href=”link+to+your+feed”/>

That’s about it, Firefox, Opera all will now auto-discover your feed.

Technorati tags:  ,  ,  

My Calendar using iWebCal and iCalFtp

I got my Calendar running too, thanks to a couple of really nice open source solutions. First and foremost, I use iWebCal to convert my .ics files into a nice looking html page. However there is a caveat here. The source code doesn’t work out of the box. There seem to be a few errors in the source code. However these are pretty easy to fix. Here are the changes you need to make

index.php, line 68:
modify path i.e: “../data/tagada.ics”

iwcMain.php, lines 104, 105, 106
modify with:
include “Property.php”;
include “CalItem.php”;
include “Calendar.php”;

iWebCal.php, line 35
modify with:
$ical_LOCAL_PATH = “”;

iWebCal.php, line 42
modify with:
$iWebCal_URL_PATH = “iWebCal”;

iWebCal.php, line 137
modify with:
include “iwcMain.php”;

Once this is done, it works like a charm. Then in order to publish my ics to my website, I use iCalFtp. Nifty piece of software, though all it does is publish an ics file via ftp. This is needed since iCal supports only webdav folders and my hosting service charges me for that. So that’s it. I am wondering whether to make my calendar public though, maybe I should password protect it. I will make a decision sometime soon.

Technorati tags:  ,  ,  ,