Monday, May 31, 2010

A pocket camera!

Canon S90

I've had the Nikon D80 for more than two years now; even though I lust the D3s, I haven't really outgrown the D80 yet. The only drawback with the D80 however is that, with my regular 18-200 VR Nikkor attached, it's not that portable. It doesn't fit in my pocket and I'm unable to keep a low profile. I've been asked whether I'm a reporter more than I'd have liked to.

Then there are instances when I really don't want to hang couple of kilograms around my neck. Or, when I don't want to change the Nikkor 70-300mm VR just to take a single wide angle shot.

So for 101 excuses as such to treat myself to a new toy, I bought this Canon PowerShot S90.

I've been toying with it for few minutes so far and am loving it already. The two control rings in the front and the back are really pro features that even the entry level dSLRs of Canon does not have (D80, being Nikon, has them :) ). The F/2 lens coupled with 3200 ISO really give great results in low light. It shoots real RAW too on it's "biggest in class" 10MP CCD sensor. And, as a pleasant surprise, it's Made in Japan!! How many Japanese cameras do we get these days, eh?

Later this week; I will compare it's performance with the D80. And post the comparison results. I fear for the D80 that this small culprit would out perform it in low light conditions. But, otherwise, D80 has nothing to fear. :)

Friday, May 28, 2010

Update: Is there something wrong in google app hosting?

Found out the cause; If you are using SLT ADSL; you cannot reach any of the google hosted contents using a custom domain name. SLT as usual; has screwed it up.

May be they are taking advise from China and are in the process of blocking out Google.. or whatever. In all accounts.. fuck SLT; they seem to even block the Google's DNS server IPs.. I was using and as my DNS settings and I was experiencing a lot of failures in DNS resolving. Didn't suspect SLT. I just switched to SLT DNS servers and lot of things got corrected. But who knows.. may be they are monitoring my internet usage too.

You could use a custom proxy for now to access all those unreachable blogs with custom domains.

But long term... complain to SLT. Make demands. Or let's just switch ISPs.. Dialog?

Is there something wrong in google app hosting?

I host two blogs with blogger and google apps with custom domain names. From yesterday onwards; the two blogs aren't loading up.

Anyone else experiencing this? Did you manage to contact Google? Or do you know a solution?

Wednesday, May 26, 2010

Did you format your memory card?

I did; Last night.

I had given the camera to Buddhi for him to use as an extra at a wedding shoot. He didn't had an assistant so he ended up using only his camera. Halfway through he ran out of storage in his card and swap the SD cards with mine.

Yesterday; I collected my camera, and was putting it and the lenses in the desiccator when I got the urge to shoot few shots; I turned the camera on, and it said the memory card needs formatting; So I did format it, shot some random photos and placed it in the desiccator.

Then I go switch on the laptop; in a while, in gtalk, Buddhi goes

oh fuck
  the photos
  are in the disk
11:00 PM hope you didn't format any :)
 me: the one you gave me?
 buddhi: yup
 me: in my cam??
 buddhi: yup
 me: fuck me sideways
 buddhi: damn

So we start the search for recovery tools... Most tools were commercial products; price ranging from $10 to $400 or so.. We downloaded a few trials and did test runs on spare memory cards. And then Budhhi found this:

It's a free life-saver data-recovery tool developed by Dmitry Brant.

So; we finished our adventure later...

me: guess i'll hit the bed now
  usual time
 buddhi: :
  so there seems to be a curse
  not letting us sleep early
2:05 AM me: yeah
 buddhi: :)

Wednesday, May 19, 2010

Are you still coming here for photos?

So Are you? Really?

I already told you guys that I started a separate photo blog right?

But, I'm still publishing my old photos there.. 9 photos per day.. If you've already seen them, and wish to see some new stuff, you can hop over to

BTW; The image to the left was captured using my phone; not the D80 (Ravi borrowed it for few days). Reminds me of the old days when the only camera I had was a mobile phone :)

XML Validation error: Data at the root level is invalid. - could be a UTF BOM issue

UTF has an optional Byte Order Marker at the beginning of the file. The UTF encoding classes included in the .NET Frameworks previous to 4.0 by default did not write this BOM. Hence, most applications we wrote to read UTF files does not handle the BOM. :)

I recently wrote a tool using Visual Studio 2010  to generate a UTF8 encoded XML file to be consumed by another application which read the XML file using PowerShell. That app failed with an error "XML Validation error: Data at the root level is invalid. Line 1, position 1." Of cause, opening the file in Notepad2 didn't show any suspicious characters. Some educated colleagues pointed us at the possibility of BOM; which proved to be the case.

The fix is relatively easy. The UTF encoding class constructors takes in a boolean parameter encoderShouldEmitUTF8Identifier. Just pass false in to that.

        // Summary:
        //     Initializes a new instance of the System.Text.UTF8Encoding class. A parameter
        //     specifies whether to provide a Unicode byte order mark.
        // Parameters:
        //   encoderShouldEmitUTF8Identifier:
        //     true to specify that a Unicode byte order mark is provided; otherwise, false.
        public UTF8Encoding(bool encoderShouldEmitUTF8Identifier); 

Example using a XML writer:

XmlTextWriter writer = new XmlTextWriter(exportPath, new UTF8Encoding(false));

Monday, May 17, 2010

How to drive in the floods

Be warned, this post is going to contain a some swearing.

Colombo is flooded. Fuck us all sideways but that's how it's going to be when ever it rains in the years to come. You can't drive to work without driving through a pool of water at least 6 inches deep, sometimes, about two feet. Not many have 4X4s and even those who have 4X4s act as if they are driving a fucking go-cart. But the reality is, most cars can be maneuvered in a little over a feet of water if properly handled. Here's how.

Before you drive in to the flood

  1. If you fucking don't want to get your fucking car wet, leave it fucking home.
  2. If you are fucking afraid, just fucking pull over and let the others go instead of blocking the whole fucking traffic.
  3. Be considerate about other drivers, don't fucking be selfish on the road.
  4. Don't fucking drive on the wrong fucking lane.
When you get yourself into the flood
  1. Don't stop at any cost.
  2. I repeat. Don't fucking stop. If you stop; you are increasing the chance of getting water in your engine and electronics.
  3. Be it automatic transmission or manual, jam it in to the 2nd gear and keep your feet off the breaks and the clutch.
  4. Drive as fast as you can; you have a better chance of getting through if you maintain a good speed, even if it's like two feet deep. If you stop, chances are you'll get water in your system and the engine will die on you.
  5. Keep to a straight line, you could lose control if you try to steer a lot.
  6. If the vehicle in front of you stops, and you have to stop, keep the engine running at a high RPM - Manual transmission - press the clutch and accelerate; automatic, put the gear leaver at N and keep your left foot on breaks and the right on the accelerator.
If your engine stops
  1. This could probably be because you didn't fucking stick to above rules; if so; fuck you!
  2. Now you have no option but to be selfish; don't try to start the engine again.
  3. Repeat; don't fucking try to start the engine, it tries to suck air in to start the ignition and instead suck water from the silencer, and if your main air intake is placed real low; from that too. And that would really screw things up for you.
  4. If you have company, or if the fellow drivers are good enough to get in the flood and help you, push you car over and wait for assistance. If you are lucky, the car should start once it's dried up.

Wednesday, May 12, 2010

Why Google search is still the best

I use GhostDoc for code documentation.

Today, I was working on a different machine and found that it doesn't have ghost doc installed. I opened up a browser and typed ghostdoc in the search box and hit enter. For my surprise, I couldn't find the SubMain site on the first page of search results. Puzzled; I looked what's wrong to find out that the search engine was Bing...

Open up google and search GhostDoc and the first hit is the correct download site.

Search Google for "Mahasen" and the first hit is this blog.. it even suggest "Mahasen Bandara"; Bing doesn't fetch this seven year old blog till the 9th page; But it fetches my  two weeks old site in the first page.

I don't see myself using Bing anytime sooner...

Monday, May 10, 2010

Wordpress acts Linux (or worse?)

Our team decided to start a group blog to write about tech stuff. After spending at least couple of hours deciding on the domain name (I'll refrain from posting the name now as it's not in proper shape yet) we spent only a few minutes in deciding on the host (blogger/wordpress) to finally deciding to use wordpress.

If you own a blogger blog, you know that Google offer a domain name and Google Apps (docs, email, sites, chat and so much more) for your blog for just $10 per month. If you already have a domain name, everything above is free. Yes, FREE.

Wordpress on the other hand is charging 9.97$ for using a custom domain name (No. That's not for the domain name. That's just for using a custom domain name on the blog) But of cause they offer the domain name for a subsidized price of $5. What do they offer for 9.97$? Just the blog of cause. No email, no nothing. Just the blog. You have control over DNS so, if you do have an email hosting account somewhere, you could add a MX record.

How do you customize your Google profile in blogger? You just go there and change things right? It's all intuitive. Wordpress, on the other hand haven't heard of the concept of intuitiveness. It's all a mess there.

So what's with Linux you ask? it's like this. Linux is secure, powerful and so on; but the effort and the learning curve it takes a beginner to accomplish a very common task like installing a printer is quite high. So it is in Wordpress; but worse; this is a paid service.