ailon's DevBlog: Development related stuff in my life

No-CSS fallback for IE5.5 and earlier

5/30/2008 10:43:22 AM

I'm working on a project where I have to support modern versions of Firefox, Opera, Safari and IE6 and higher (hell I wish MS forced upgrade to IE7 through Windows Update) which is standard approach these days. Today I downloaded the excellent IETester and out of curiosity decided to look at how my project looks in IE5.5.

As expected it was a total mess. I have no plans nor requirements to support IE5.5 but I decided to do one simple thing: just skip the CSS file in IE5.5 and earlier so the site looks like it's 1995 but consistent and it's useable.

I've used conditional comments like this

    <![if gte IE 6]> 
    <link href="style.css" rel="stylesheet" type="text/css" />
kick it on

Tags: ,

Spread amMap

5/29/2008 11:57:05 AM

Download Day 2008Mozilla is aiming at Guiness record by trying to force as much people as possible to download Firefox on a certain "Download Day" with actual date not set yet. The idea is brilliant marketing move and lame flashmob in general but that's not important. What's important is that the use my friend's Antanas' amMap interactive map control on the site's front page.

I bet he's biting his elbows right now guestimating how much pageviews/downloads/sales he would get if they've used a free version (with link back to rather than bought a commercial license :)

Tags: , ,

What's Wrong with this?

5/29/2008 9:55:30 AM

Every time I read a C# book or an article or just a code sample in MSDN I can't stop wondering why don't people (and by people I don't mean just average Joe's but respected authors, MSDN documenters, etc.) use this qualifier unless it's absolutely required to distinguish between identically named local variables and object fields?

I use this all the time and I think it's way easier to understand your own code. And don't get me started on someone else's code. Let me show you an example.

Yesterday I was implementing a SiteMapProvider for a project I'm working on. I looked  at the sample in MSDN. The main "meat" is in BuildSiteMap method. I'll paste it here in full. It's a little long but that's exactly the point.

// Build an in-memory representation from persistent // storage, and return the root node of the site map. public override SiteMapNode BuildSiteMap() { // Since the SiteMap class is static, make sure that it is // not modified while the site map is built. lock (this) { // If there is no initialization, this method is being // called out of order. if (!IsInitialized) { throw new Exception("BuildSiteMap called incorrectly."); } // If there is no root node, then there is no site map. if (null == rootNode) { // Start with a clean slate Clear(); // Select the root node of the site map from Microsoft Access. int rootNodeId = -1; if (accessConnection.State == ConnectionState.Closed) accessConnection.Open(); OleDbCommand rootNodeCommand = new OleDbCommand("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection); OleDbDataReader rootNodeReader = rootNodeCommand.ExecuteReader(); if (rootNodeReader.HasRows) { rootNodeReader.Read(); rootNodeId = rootNodeReader.GetInt32(0); // Create a SiteMapNode that references the current StaticSiteMapProvider. rootNode = new SiteMapNode(this, rootNodeId.ToString(), rootNodeReader.GetString(1), rootNodeReader.GetString(2)); } else return null; rootNodeReader.Close(); // Select the child nodes of the root node. OleDbCommand childNodesCommand = new OleDbCommand("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid = ?", accessConnection); OleDbParameter rootParam = new OleDbParameter("parentid", OleDbType.Integer);
rootParam.Value = rootNodeId;
childNodesCommand.Parameters.Add(rootParam); OleDbDataReader childNodesReader = childNodesCommand.ExecuteReader(); if (childNodesReader.HasRows) { SiteMapNode childNode = null; while (childNodesReader.Read()) { childNode = new SiteMapNode(this, childNodesReader.GetInt32(0).ToString(), childNodesReader.GetString(1), childNodesReader.GetString(2)); // Use the SiteMapNode AddNode method to add // the SiteMapNode to the ChildNodes collection.

AddNode(childNode, rootNode);

} } childNodesReader.Close(); accessConnection.Close(); } return rootNode; } }

I've highlighted one line in the method:

AddNode(childNode, rootNode);

By glancing at that line could you tell me right away is rootNode a local variable or a field of the object? Wouldn't it be much more obvious if it was

AddNode(childNode, this.rootNode);

We loose readability by omitting this so we must gain something in return, right? What are we gaining? Do I miss something other than saving 5-10 bytes in source file and 5 extra keystrokes? And the keystroke argument isn't always true.

Suppose you have a class defined like this:

class test
    public XmlNode XmlNodeHolder;
    public test()
        XmlNodeHolder = null;

To type that XmlNodeHolder in the constructor with the help of IntelliSense I had to press 8 keys (x-m-l-n-o-d-e-h) before I got the right line in IntelliSense. Now I would use this

class test
    public XmlNode XmlNodeHolder;
    public test()
        this.XmlNodeHolder = null;

I could type this.XmlNodeHolder in 4 key presses (t-h-.-x). So the only argument that I see and can't argue with is saving bytes in the file. But who cares about 10 bytes in the source file these days? 100 bytes? 1kb anyone?

So either I miss something important in functionality, performance or something else or I just can't understand the trend.

kick it on

Tags: ,

Book Preview: Essential Silverlight 2 (Up-to-Date)

5/28/2008 12:30:24 PM

Essential Silverlight 2 Got a copy of Christian Wenz's "Essential Silverlight 2" (Up-to-Date) I ordered from Amazon. It arrived in 20 days which is quite fast provided that Amazon predicted it would take 4-6 weeks. Obviously I haven't read it yet but I just wanted to blog about the "Up-to-Date" concept from O'Reilly.

With Up-to-Date books you get a book looking like binder and once book's subject is updated the book is updated and you can download new/changed pages, print them (or order pre-printed updated pages from O'Reilly) and add/replace pages in the binder. Looks good on paper.

As I wrote the book is essentially a binder. There are about 200 printed pages (100 sheets) and about 100 sheets of plain pre-punched paper to print updates on. I went right to O'Reilly site and registered my book. There was an update already with 80 pages of new and updated content based on Silverlight 2 Beta 1. You can download 4 versions of PDF pages: 2 to print on provided sheets (either single-side or double-side) and 2 for standard Letter/A4 with cut-out and punch markers.

My first question was can I use prepunched paper with our HP LaserJet 1300? After some RTFM'ing I found a statement in HP's user guide saying

Do not use paper with cutouts or perforations other than standard 3-hole punched paper.

whatever "standard" means in this context. And what would happen if I had a 2 or 4-hole punched paper? Anyway I decided that it would be ok.

IMAG0017 The next challenge was to fit the content perfectly to the page. The title of the PDF for precut pages says "Pre-cut 7x9 Single-sided". But in reality the paper is 7.17"x10.12" (182mm x 257mm) which is actually B5. It took me some time to figure this out. But even when I knew the right size I couldn't make it fit perfectly. All the new pages have printed tabs saying "Update 1 (Beta 1)" and I couldn't make these fit.

Maybe that was my fault, maybe O'Reilly's, maybe Adobe's, maybe HP's. Who knows? It is not a very crucial information but I decided to not take a risk losing useful info on some pages and just shrink the pages a little to make them fit. The font on "my" pages is a little smaller now than on original pages but it's ok.

All-in-all I've spent about 2 hours updating the book. Since my printer can't print on both sides automatically I had to use single-side approach and spent like 80% of bundled paper. So I don't think I'll have enough paper for another update.


Btw, the holes on the blank paper are not exactly at the same distance from the edge as on original pages so it was a little difficult to assemble the binder back and it doesn't look very pretty.


And why use B5 for these series? I know it looks like a real book this way but I doubt I can get punched or even not punched B5 paper here in reasonable quantities and for reasonable price. And when using Letter/A4 you have to cut from all 4 sides which is a total overkill. And shipping of pre-printed updates to Lithuania is $19+. Add $4 for the updates themselves and you get the price of the whole book.

Why not just use Letter/A4? I know the book would be a little clunky this way but it would make life of the customers who bought this book to be able to update it themselves (which is the idea, isn't it?) much much easier.


The concept is interesting and it's really nice to have an actual book on the product that is still in beta and know that you can update the book to the latest version. But the "maintenance" of the book is too painful to my taste.

kick it on

Tags: , ,

Podcasts on Windows Mobile

5/27/2008 3:53:55 PM

Couple of years ago I had to walk 25-30 minutes to work. I listen to music while I work (can't work otherwise) so I was kind of tired of music to listen on the go too. That's when I discovered audiobooks.

But 2 years ago we've moved our office closer to my place and now I have to walk for 10-12 minutes only and that's too short for audiobooks. As far as I remember average book is about 600 minutes long so I would've had to listen to it for more than a month. So I stopped and walked in silence (read "city noise"). And I actually enjoyed it for some time.

Recently podcasts became really popular but I couldn't project the idea onto my daily routine. I can't listen to someone talking while programming and simply sitting staring at the wall listening to some podcast is ridiculous. But then an idea hit me that podcasts would be a nice replacement for my audiobook addiction.

The player - S2P

podcast_s2p I'm totally satisfied with HTC Audio Manager and/or Windows Media Player on my HTC Touch for occasional music listening. I never watch videos on my phone. So I didn't have any 3rd party players on my device. But podcasts/audibooks require at least one additional feature that neither Audio Manager nor WMP have - ability to resume your last played file from the same position. So I started a quest for the right player.

There is only one 3rd party player name that I had embedded in my head - CorePlayer. Based on feature set and recommendations this is considered the best media player for Windows Mobile. However it has way more features than I need (actually I needed a very tiny addition to WMP), costs $25 and there's no trial download. So I decided to look for alternatives.

Then I found PocketMusic Bundle ($20). It supports bookmarks which is most likely a more advanced version of what I needed. There's also a free version of PocketMusic (requires registration though) which I tried. There are no bookmarks in free version but options dialog has a checkbox labeled "Continue from last position on start". But either it doesn't work or I misunderstand it's purpose.

After looking at some other alternatives which had no mention of the feature I was after in their feature lists, I found S2P (pictured). The player looks nice (a bit rough around the edges and a little too inspired by iPhone though) and resumes from where it was closed.

So the quest is over for now.

Getting podcasts on your device

I've tried 2 apps to automatically download podcasts from their RSS feeds. One for desktop Windows - FeedStation. And one for Windows Mobile - HubDog. Both worked fine but I realized almost immediately that the nice thing about podcasts is that you don't have to listen to every episode of every show and so you definitely don't have to download every episode of every show.

So I ended up manually subscribing to RSS feeds in my RSS reader and downloading episodes I want manually. Then I created an automatic playlist in WMP11 based on "Podcast" genre and set up automatic synchronization of this playlist with my phone. Works like a charm.


Currently I'm catching up on only 2 shows:

  1. Hanselminutes by Scott Hanselman. Very nicely produced podcast mainly focusing on Windows and web development related issues with occasional forays in other areas. Episodes are 20-40 minutes long which I think is quite optimal size. I would say 25-30 minutes would be perfect for me (one day's walk to and from work)
  2. DotNetRocks with Carl Franklin and Richard Campbell. As the title implies it's focused on .NET and related stuff. The episodes are too long for my taste (usually a little longer than 1 hour) and the flow is not as good as Hanselman's but interesting and educational nevertheless.

I'm not looking for many more (since I have up to 25 minutes a day for podcasts) but once I finish with "back catalogs" of these two I think I'd like to add a couple more to this list. So, your recommendations are welcome and highly appreciated. Subjects I'm interested in (in no particular order): programming in general and web development in particular, windows mobile software, photography, popular culture (music, movies, books, etc.). So if you know a really good podcast along these lines, please, let me know.

Tags: , ,

ASP.NET and Oracle Setup

5/27/2008 10:37:40 AM

Got hit by this error today.

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

I remember getting it earlier but forgot the cause and the solution, so I want to document it now.

Basically this happens because IIS user has no permissions to read & execute files in Oracle's directory. So the solution is to manually grant the permissions.

Details in this Roy Tore Gurskevik's post.

Tags: ,

Choose Your Open Source License Wisely and Stick to It

5/19/2008 5:50:48 PM

os_main Recently there was quite a storm in web development community about a move by popular JavaScript framework ExtJS. They've changed their licensing scheme from LGPL/commercial to GPL/commercial. And as this quite radical post by Paul Duncan title "Don't Use ExtJS" suggests earlier Ext was released under very permissive BSD license.

I've never used ExtJS and don't know much about it except the name and that it's quite popular, but the controversy concerns me as I'm a lead developer of an open source project released under the same GPL/commercial scheme. I assume some (or maybe even most) of the ExtJS attackers wouldn't call my project open source as they refuse to call ExtJS open source now.

ExtJS's situation is not as straightforward as mine. In 5 years since the first public SPAW Editor release we've never changed the licensing scheme. And we don't use any third party code (maybe some small parts from Mozilla's or Microsoft's documentation). But the fact that I'll be attacked if I ever decide to change the scheme (not that I plan to) saddens me.

The Root of all Evil

From my perspective the problem arises when people starting open source projects don't have a vision of what they are trying to achieve in the long run. This is very understandable cause sometimes you think you just have a small library on your hands that you would like to share with the world. In the early days of project's life you are totally satisfied by positive feedback from your users and don't think of anything else. But as days go by supporting the project becomes a routine, you get less and less satisfaction from working on it and unless you are a total programming junky you gradually loose all interest. At this point you either have to find a new "owner" for the project, let it die or start getting financial motivation.

Getting Paid for Open Source

Getting paid for your open source project is a tricky thing. Getting small donations from lots of users doesn't work as far as I can tell. You might get lucky and get a couple of major donations but I don't think that you can get those by placing a passive "Donate" button on your site. Getting VC money for your small-to-medium open source project is way too complicated for small development teams and not everyone dreams of selling their freedom and making their "baby" just another full-time job. Selling support for your project is a tricky thing too. I believe that open source project owners should provide support to all the users and not only those who paid for it.

All of the above methods could work but require quite aggressive "sales" activities to succeed. So, this leaves us (commercially passive OS developers) pretty much with the only option - dual licensing.

It seems that differentiation between who should be able to use your code under open source license and who should buy a commercial one is pretty simple:

  • open source projects and non-commercial projects should be able to get your product under the OS license;
  • commercial projects should buy a commercial license.

The problem is that there's no such standard open source license that let's you implement the above scheme. GPL is closest: it allows usage in other GPL projects and prohibits distribution in closed source and other non-GPL compatible open source projects. The last part is the cause of all the issues developers of non-GPL open source projects have with GPL and in this case with ExtJS. But unfortunately I'm not aware of any other open source license that comes closer to implementing this fairest (in my opinion) paradigm. Or did I miss some new advancements in those five years since I was actively looking for a licensing concept for SPAW?

Moral of the Story

I understand that I'm not a true open source developer and most likely neither is Jack Slocum (lead Ext developer) but I hope that by releasing my code under GPL I contributed my share to the community. I was lucky to think about such situation before releasing my software and though I understand Jack's motivation I agree with "whiners" that changing licenses as you go sucks. Though I can't see why those complaining can't fork from an earlier LGPLed or even BSDed ExtJS version and build a "truly open source" alternative.

So, the point is that it's very important to understand what are you trying to achieve by releasing your software as open source. If your goal is to make the world a better place, or you want to get community credibility to get paid more in the future, or you have some "alternative" business plan - go with permissive open source licenses like BSD, MIT, etc. But if you feel that you'll be upset that someone profits from your work while you're buying junk food with your last pocket change do yourself a favor and think about this before you release anything.

In any case I think it's important to make a wise, well thought out decision and stick to it. In my opinion it's better to have fewer but satisfied users then lots of unhappy ones.

kick it on


Naming HTML Objects: Use Some Imagination

5/16/2008 9:48:47 AM

While answering questions about strange issues with SPAW Editor I notice that people often give name/id to their html objects like "body" or "text" or something like this. And this works for them until they try doing some manipulations with these objects using JavaScript. And then crazy things happen randomly.

I don't know if this is officially forbidden somewhere. But it's always a good idea to think twice every time you get an urge to name your textarea holding your post body just "body". "postBody" is only 4 keypresses longer but it will save your hours later when you sit irritated, scratching your head, trying to figure out why a simple javascript doesn't work or produces crazy side-effects.

kick it on

Tags: ,


5/12/2008 10:25:43 AM

twhirl-twitter I was contemplating about starting twitting for some time but lagging. Lately there were numerous post in the blogs I read on the subject and on Sunday morning I was wasting my time waiting for my wife to get ready to go and read this blog post by Rick Strahl. I had about half an hour to waste so I registered my Twitter account and the rest is history... Follow me on Twitter under ailon.

So, honey, you are the one to blame for the additional time I waste ;)

Language dilemma

I speak, read and write (more or less) in 3 languages all the time: Russian at home and with friends, Lithuanian at work and with other friends and English mostly for the technical stuff. So, deciding in which language to twitt is not an easy thing to do. I have 2 blogs: one in Russian for personal non-geeky stuff and this one in (crappy) English for technical stuff. Sometimes I have to decide to which blog (and in what language) to post about subject that border between the two (like the post on Parental Control) and that wastes additional brainpower.

But since twitting should be something less mind consuming I decided I don't want 2 separate twitter accounts. I'll twitt to one account mostly in English but switching to Russian or Lithuanian when I find it more appropriate.


There are so many Twitter clients that I definitely must write another one! (just kidding)


I had Adobe's AIR installed so I decided to try twhirl since it seems to be the most popular. It looks nice and works fine so far. However I plan to try Witty in solidarity with fellow .NET developers.

Windows Mobile

I've seen ceTwit popup several times in's RSS feed so I went and installed it and it seems to work just fine, too. I'd like to try Kevin Daly's Twitula too, but there's very limited information on it's page and I had no time yet to just download and try it.


I also activated twitting through Jabber/GTalk/Miranda and tried to activate twitting by SMS but it doesn't seem to work for me for now. Anyone knows what's the catch?

So, start following me on twitter right now or else...

Tags: , , ,

Why is it so Difficult to Buy Visual Studio!?

5/8/2008 5:59:04 PM

I remember going through something like this with Visual Studio 2005 but back then I've swallowed my pride and called my local "pusher" and got the VS2005 old fashioned way. Now, 3 years later, I want to buy Visual Studio 2008. Let's see how this goes...

Note: I live outside of USA and any other "major market" for that matter

Upgrading through the Trial

I've download and installed Visual Studio 2008 Professional 90-day Trial. Now I go to Help->About and see the "Upgrade..." button. Hooray!


When I click it my browser opens a page saying  "Content not found".


How crazy is that!? This is a current product by a MAJOR corporation so how could something like this happen?

Other ways

OK, let's swallow some pride again and go through the product page. Closest to the words "buy" or "purchase" is Pricing - let's go there. First link there is Worldwide Purchase Information. Hooray again. When I go there I see information about buying an MSDN Subscription but I only want a standalone VS2008 Standard or Professional. OK, there's a section:

Additional Purchasing Options

[Skeptical] hooray. So now we get to this page. Looks promising. I click "Buy or upgrade now" and get to Windows Marketplace page where all of the online merchants listed ship to USA and Canada only. And I would actually prefer a simple license key (which must be an option (see below)). Dead end again.

Now I remember that there was something about upgrading from Trial on the Trial download page. Here it is:

Upgrading from Trial Editions

When you are ready to upgrade from an installed trial edition of Visual Studio or Team Foundation Server (or the Workgroup Edition of Team Foundation Server), you don't have to completely uninstall and reinstall those products. For more information, see How to: Upgrade from Visual Studio Trial Edition (a Visual Studio 2005 topic, but still accurate).

The "how to" page has the following:

To obtain a product key
  • Purchase a copy of Visual Studio 2005 Professional Edition at a retail location. The product key is listed on the sleeve of the DVD or CD.


    Order a Visual Studio 2005 Professional Edition product key online at The product key is sent to you in an e-mail message.

Click on the - "Content Not Found"

Our local Microsoft website has a list of "old-school" companies who can order you a hard copy from the warehouse and you'll get it in couple of weeks or months (which was what I tried to avoid and was supposed to succeed).

I hope that someone at Microsoft reads this and at least fixes all the "not found" issues and specifies accurate information. At the very least tell me that there's no way for me to buy this online but don't make me waste half a day trying to find a correct way to navigate your website! Theoretically I wasted more time (equals money) looking for a way to make a simple transaction than the transaction is worth. Very frustrating.

kick it on

Tags: ,

Copyright © 2003 - 2017 Alan Mendelevich
Powered by BlogEngine.NET