Wednesday, August 12, 2009

Do you want undefined?

It was nice and calm day, when suddenly MSN Explorer opened up its window. I've never seen anyone using this MSN-Explorer-thingie, and I haven't even heard of what's the point of that program, so I thought I'll at least give it a try.

But before I could use it I had to configure it, which brings us to this dialogue:

Well... I figured that I already have a completely functional internet connection, so I chose the last option and clicked "Continue":

Emm... of course I have undefined undefined!

To complete the story I have to mention, that I wasn't able to complete the configuration of MSN Explorer, I got stuck to that last screen that didn't let me pass no matter which option I chose. The purpose of MSN Explorer still remains mystery to me.

Friday, March 6, 2009

Where Have All the Blog Posts Gone?

On previous month I wrote only four articles to this blog. Quite a bit less than the eleven I wrote in January. So, what’s happening? Am I becoming satisfied with Windows? Has Microsoft eaten my soul?

I really started to wonder that I might be transforming into one of those happy Windows users... a scary perspective, you know.

A Day in Windows

After thinking about it for a while, I came to the conclusion that I have unconsciously sneaked away from actually using Windows. You see... most of my computing time is spent using only three fine applications:

I use the mighty Opera browser to surf the web and test the site I’m developing.

I use Emacs, the mightiest of editors, to write the code I need.

And I use the faithful Putty SSH client to log in to our server, which does not run Windows, but is driven by the mighty Free BSD.

Therefore most of the time I am actually using a holy free GNU operating system, not the unholy Windows system, that this blog should be about.

The Light at the End of a Tunnel

Finally, I feel that my days of using Windows are coming to an end. My broken leg has healed considerably and I’m thinking about going back to Tartu, where my Linux-box already waits for me.

So yes, there really is a light at the end of the Windows tunnel – it’s the thought that a day will come, when you leave it all behind and start using a real operating system again.

But there is also a sadness in leaving Windows. It’s the same sadness you feel when you arrive home from a long and tough journey... it’s not like you would want to go back, but you are still kind of sad that it all has come to an end.

Where Have All the Blog Posts Gone?
Long time passing
Where Have All the Blog Posts Gone?
Long time ago
Where Have All the Blog Posts Gone?
Switched to Linux from Windows 3.1
When will they ever learn?
When will they ever learn?

Image credit goes to Robert Marschelewski.

Thursday, March 5, 2009

Stuck in Skype

I mostly write about Microsoft here, but Microsoft isn’t the only proprietary software vendor, and neither is it the only one that tries to lock you into their products. Today I would like to speak about another company – right here in Estonia.

Skype at Work

At work I use Skype for all my instant messaging needs. It’s a company policy – we all do. And I must say, that it does a pretty good job at it. I really like some of its features:

  • You never have to worry about closing the conversation window – when you open it again, your previous conversation will still be there and you can continue from where you left off.

  • When you log in from another computer, your settings will be there. For example when I change my display picture at home, then I don’t have to change it again when I log in at work.

  • And when you make a spelling error, you can just press up arrow and correct it.

These features aren’t nothing sort of astonishing, but you know, often it’s the small things that matter. And all together they make Skype a really nice piece of software.

But it’s not good enough...

The World of IM Protocols

If the web browsers were like instant messaging clients, then instead of all browsers being able to display HTML pages, each browser manufacturer would only support its own proprietary format. IE would only display Microsoft Word documents, Safary would only support Quicktime, Adobe would have it’s own Flash-browser, and only Firefox plus a few other niche browsers would support open HTML standard.

It looks crazy and stupid, but that’s totally how the world of instant messaging looks today.

MSN Messenger uses its own proprietary protocol, AOL Instant Messenger uses another and Skype uses yet another. There also exists a free protocol called Jabber, but it’s mostly used by free software apps – it’s not supported by MSN, AOL or Skype. And therefore the users of MSN can only chat with MSN users and AOL users with AOL users and Skype users with Skype users and so on...

Clearly, this kind of situation can’t last forever. One protocol must ultimately win the competition and the others shall die. So, lets see our main contestants (rough numbers based on Wikipedia):

Tencent QQ 320 mln active (in China)
MSN 300 mln active
Yahoo 250 mln active
Skype 300 mln total
AOL 100 mln total
Jabber 90 mln total
ICQ 15 mln active

Jabber looks like a total loser in this comparison, but that’s not the full picture because Jabber supports transporters. Transporters are the middlemen who allow Jabber users to communicate with the users of other protocol. For example when Jabber user wants to talk with MSN user, then all he needs is to register his MSN account with some available Jabber-to-MSN transporter and voilà – he appears at the buddy list of his friend just like any other MSN user.

This way a Jabber user can talk to MSN, AOL, ICQ, Yahoo and some more. So, when you use Jabber your network of friends is not limited to just a single protocol – the users of Jabber can talk to more people than the users of any proprietary protocol out there. Jabber is the clear winner and the only wise move any proprietary IM vendor can do is to jump on the Jabber bandwagon. AOL has already done that and Google did it with its Talk from the beginning. Others are destined to follow or die out.

What about Skype

When I spoke about Jabber transporters, I didn’t mention the one for Skype – that’s because there isn’t one. There have been some projects for making one, but so far these haven’t been successful.

This is because the developers of Skype have worked hard to make reverse engineering of Skype as hard as possible. In fact it is so hard, that there has been extensive scientific research on various aspects of Skype.

The makers of Skype would like you to believe that by using Skype you can communicate with the whole world, while in fact it’s quite the opposite – they want to lock you down to their small proprietary world, so that you can only talk to other Skype users and no-one else.

And I’m not the only one complaining here. The Free Software Foundation also dislikes Skype and finding a replacement for it is one of its top priorities.

Escaping Skype

So, how could I escape Skype? As I already said, it’s a company policy, but it might be even more than that, because the main investors of our little software-house are also the founders of Skype. I don’t think I’m able to convince other developers not to use Skype.

Another option would be to use free IM client that is able to speak with Skype, but as I said, currently there aren’t any. Not even a tiny little Jabber transporter.

The only remaining option is to develop a Jabber-Skype transporter by myself. But I really doubt I’m up for this task. Many have failed already.

So far Skype sucks even more than Windows, because I can easily escape Windows, but I still have to find a way to escape Skype.

Wednesday, February 25, 2009

Running multiple versions of Internet Explorer

IE sucks – that’s an indisputable fact. And all the different versions of IE suck in different ways. Therefore you need to test your web app not in only one bad IE, but in multiple ones. And to make the life of web developers even harder, Microsoft doesn’t provide a way to install multiple versions of IE on the same Windows box.

Of course, Microsoft would like you to think, that to run IE is central piece of Windows kernel and the only way to have multiple versions of it is to have multiple Windows installations... of course with all the required licenses. This is good for Microsoft, but similarly to all things that are good for Microsoft, it’s not good for you.

Luckily at least IE6 and below are available as stand-alone versions. Of course not from Microsoft, but from browser archive. And to make the process of installation as easy as possible, there exists a special installer from Tredosoft that allows you to install IE3, IE4.01, IE5, IE5.5 and IE6 with just a few clicks. It’s not maintained any more, but it works just fine.

Not even a restart required...

Sunday, February 8, 2009

FUD Over JavaScript and GPL

Far Side comics about CAT FUD Recently I published a tiny JavaScript library jintervals for doing formatting of time intervals. At first I published it under GPL license, thinking this is the rightest thing to do. After all, the Free Software Foundation itself suggests that you do.

But then some said, that using GPL for my library is far too restrictive, and by doing so I would ban all the potential commercial uses of my library.

This can’t be true, I thought. But then I did some research and decided to change my license to LGPL. Not because I was wrong, but because too many other people were wrong.

The Misinterpretation of GPL

GPL v3 logo Everybody knows that GPL is viral. But what most people doesn’t know, is how infective it exactly is.

It's the same with real world viruses. Most people are afraid of coming to contact with person who has HIV, although you won’t get infected by just touching. But the fear, uncertainty and doubt are all there, saying, that you better stay away.

Similarly many people are afraid of using GPL-ed components when building their website. They think that then they have to release all the code of their website also under GPL.

They are totally wrong, because all free software licenses allow you to use and modify the program how ever you may please. These are the freedoms 0 and 1:

The freedom to run the program, for any purpose (freedom 0).

The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.

GPL will only concern you, when you want to distribute your software. And running a website powered by GPL-licensed software is not distributing. There is even a FAQ about this on GNU homepage:

A company is running a modified version of a GPL'ed program on a web site. Does the GPL say they must release their modified sources?

The GPL permits anyone to make a modified version and use it without ever distributing it to others. What this company is doing is a special case of that. Therefore, the company does not have to release the modified sources.

And contrary to what most people think, GPL is not the most restrictive free software license. If you want a really restrictive license, then you should choose GNU Affero GPL – running a website powered by AGPL-ed software, does require that you publish all your sources. The same GNU FAQ goes on to suggest using AGPL:

It is essential for people to have the freedom to make modifications and use them privately, without ever publishing those modifications. However, putting the program on a server machine for the public to talk to is hardly “private” use, so it would be legitimate to require release of the source code in that special case. Developers who wish to address this might want to use the GNU Affero GPL for programs designed for network server use.

Most people haven’t even heard of AGPL, they only know about GPL. And because GPL is the only viral license they know about, they think, that it must be the most infectious thing on the planet.

Ext JS GPL Controversy

Ext JS logo Some time ago the licensing of Ext JS framework was changed to GPL and a whole hell broke loose. Hundreds of users wrote to a fairly long Ext forum thread, seeking answers to their questions about the new licensing model.

Ext JS licensing has been a mess. Previously Ext JS was seemingly licensed under LGPL, but with several extra restrictions:

Ext is also licensed under the terms of the Open Source LGPL 3.0 license. You may use our open source license if you:

  • Want to use Ext in an open source project that precludes using non-open source software

  • Plan to use Ext in a personal, educational or non-profit manner

  • Are using Ext in a commercial application that is not a software development library or toolkit, you will meet LGPL requirements and you do not wish to support the project

Many users were unhappy about it, claiming either, that Ext JS is not free software at all, or that because of some clauses in LGPL, users are allowed to freely remove the extra clauses added to LGPL.

Anyway, most people were quite happy, because they knew that LGPL is a light version of GPL and therefore harmless.

Then came the license change, people saw the terrible viral GPL and went completely nuts. They were wondering, do they have to publish all the source code of the web site they were using GPL-ed Ext JS on, or do they have to buy a commercial license for that?

Given that most people aren’t experts in GPL, this was completely normal. But it wasn’t normal that the authors of Ext JS didn't gave any clear answer to these questions. They pointed people to the Licensing FAQ, which for some reason doesn't provide answer to the real most frequently asked question: Can I use the GPL licensed Ext JS on my website without publishing all the source code of my site?

This kind of attitude received huge amounts of criticism from the community. Authors of Ext JS were blamed to be stupid and greedy.

The license change from false-LGPL to true GPL was certainly step in the right direction, but it was presented to the community with a great dose of FUD. Not a nice thing to spread Jack, not a nice thing to spread...

Is GPL Worth the Trouble?

Ext JS isn’t the only JavaScript library licensed under GPL, there are more, and none of those seems to suffer under similar issues that Ext JS is. The reason? Honesty. Just look at how GPL-licensed jQZoom Evolution describes itself (emphasis added):

jQZoom Evolution is a new release of jQZoom with full featured. It is a javascript image magnifier built at the top of the popular jQuery javascript framework. jQzoom Evolution is a great and a really easy to use script to magnify what you want. It is easy to customize and it works on all modern browsers. This software is licensed under GPL. You can have your jQZoom in your website, eCommerce sites or whatever you want.

However most JavaScript libraries prefer more permissive LGPL, MIT and BSD licenses. And for a very good reason – no damn confusion whatsoever.

And this is the reason, why my jintervals library is also licensed under LGPL – to avoid needless confusion.

Thursday, February 5, 2009

Finding Synergy Between Emacs and SFTP

I needed a solution to edit files over SFTP connection. In Linux I could have just used SSHFS on top of FUSE, but I was stuck in Windows.


I was suggested to use proprietary software called SftpDrive. And not just proprietary, but a shareware with trial period of six weeks. I agreed, thinking, that I won't be needing it for any longer.

But the program didn't fulfill my expectations. It failed to cooperate with my text editor, making Emacs complain all the time that the file I'm editing has been changed on disk. The reason seemed to be, that changes to the file attributes (particularly the modification time) aren't immediately available to emacs after saving the file (as explained in this Q&A site).


From the same site I found a suggestion to use Dokan SSHFS instead. It appears that Dokan is a library similar to FUSE in linux. And Dokan SSHFS similarly sits on top of that.

At first I got a bit puzzled over the Licensing of Dokan, because although Dokan project page in Google Code says it's licensed under LGPL, the installer displayed me the following message:

WARNING: This computer program is protected by copyright law and international treaties. Unauthorized duplication or distribution of this program, or any portion of it, may result in severe civil or criminal penalties, and will be prosecuted to the maximum extent possible under the law.

Later I found out that this installer message had been automatically generated by Microsoft Visual Studio. How nice of Microsoft to have a happy little default licensing scheme.

Dokan SSHFS isn't as easy to install as SftpDrive – I had to download and install three different software packages to make it work. But it is free software. And it seems to do everything SftpDrive does. Plus achieving synergy with my Emacs.

Windows likes proprietary

I'm starting to wonder, why the proprietary alternative had been suggested to me at the first place?

But then... How could I have expected a free software suggestion from a Windows user?

Sunday, February 1, 2009

Getting Rid of the Caps Lock Key

Photo of caps lock key physically removed from keyboard

The Caps Lock key is the most annoying key on your keyboard. It’s of no use whatsoever and it's always right at your fingertips, waiting for you to accidentally click on it. Therefore one of the greatest favors any computer user can do to himself, is to disable the Caps Lock key. All the major operating systems allow you to do it, even Windows...


Clearly the winner here, if you want to do it from command line:

$ xmodmap -e "remove lock = Caps_Lock"

Just type it in to try out and then place into your .bashrc file to make the setting permanent.


Although a real Mac user would find it more intuitive to drag the Caps Lock key to trashcan, this time they have to resort to simple list boxes:


And in Windows the same thing is done in the typical Windows way.

You modify the registry and restart your computer.

Images: For the first image, the credit goes to dipurinku, and for the second thanks to Carla216.

Thursday, January 22, 2009

The Last Browser to Pass Acid2

Acid 2 test reference rendering combined with IE8 logo as its nose So, I installed beta 2 of IE8. And it indeed passes Acid2 test... at least when you don’t press the Compatibility Mode button.

But I shouldn’t share this information with you, because the EULA of IE8 states:

You may not disclose the results of any benchmark tests of the software to any third party without Microsoft’s prior written approval;

But while I will be waiting for Microsoft troops break through my door, you can read on about the “innovations” in Internet Explorer 8.


IE8 comes with two layout engines: the old one from IE7, and the new one, able to pass Acid2.

Initially Microsoft decided, that by default all sites will be shown in IE7-mode, and only when the author of the page explicitly requests, then, and only then, will the page be displayed in IE8-mode. This thing had already happened once and was called the Doctype Switch, and it seemed that Microsoft was introducing yet another one. A huge noise broke out among the supporters of web standards. Nobody wanted another broken Doctype Switch.

Finally Microsoft took notice and reverted their decision. In IE8 beta 2 the default is IE8-mode. But when site relies on the quirks of previous IE versions, then it can send the following HTTP header:

X-UA-Compatible: IE=EmulateIE7

Additionally IE8 has a special button right next to address bar to switch IE7 compatibility mode on and off – a nice little interface clutter, just because of being IE.

Some sites have already started to use the X-UA-Compatible header. Most notably and the IE Blog – which shows how “ready” Microsoft itself is for their own IE8.

The Sloppy Copy Principle

The photocopiers of Redmond are famously known for their sloppiness. Whenever Microsoft copies another software product it first makes a blatant copy without thinking much and then introduces his own improvements, which usually make it even worse.

Classical example is the copying of Mac OS user interface. Mac has the menu bar of each application displayed at the top of the screen, and for a very good reason – because of Fitts’ law it is easier to reach with a mouse this way. But Microsoft saw just another opportunity to “innovate” and placed the menu right below title bar, making it as hard to reach as possible.

In IE8 we see this sloppy-copy-principle applied again and again.

Some Tabs

Before IE7 came along, IE was the only browser without tabbed browsing. All they had to do, was just to copy the damned thing. But Microsoft wanted to “innovate”. Other browsers had the tab bar running from one edge of the browser window to another – to make room for as many tabs as possible (and it’s still getting pretty tight, if you have more than ten tabs open). Somehow Microsoft didn’t get it and combined menu bar with tab bar:

Comparison of maximum amount of tabs in IE 8, Firefox 3 and Opera 9

On a standard 1024 x 768 display IE8 can display only 8 tabs (before they start to scroll out of view). Firefox manages to show 10, and both Opera and Chrome can show unlimited number of tabs – they just shrink smaller and smaller. One could say that IE is only two tabs behind Firefox, but this doesn’t take into account that these 10 Firefox tabs are a lot more readable than those 8 IE tabs.

IE8 also features grouping of tabs. But what do you group, if you only have 8 tabs?

Incrementally Jumping Search

IE8 also features a search bar, that appears when you press Ctrl+F. Again something that was easy to copy from all other browsers, that already had it. In Firefox the search bar appears at the bottom of the page, so that the web page can stay unmoved. In Opera it appears at the bottom left corner and the page doesn’t move. In Chrome it appears at the top right corner and the page doesn’t move. But Microsoft wanted to “innovate” – they placed it at the top and made the page move downwards when it appears.

Nasty search bar in IE8

Doesn’t everybody like when the whole page jumps up and down?

Browse Privately With Microsoft

This is a great feature. Turn on InPrivate Browsing and no-one will find out which pages you are visiting... except some guys in Redmond, as every URL you visit gets first sent to Microsoft to check that it’s secure enough for you to see it.

Few days after installing IE8 I got a critical security update:

This security update resolves a publicly disclosed vulnerability. The vulnerability could allow remote code execution if a user views a specially crafted Web page using Internet Explorer. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.

You really trust Microsoft in matters like security and privacy?

Still Behind

There are many other similar “innovations” whose alone purpose is to hide the painful fact, that IE8 is just a catch-up release, an attempt to not fall too far behind modern browsers that are all busy implementing CSS3, HTML5 and other standards.

By the time IE8 goes public, it will be the only browser that doesn’t pass Acid3.

Tuesday, January 20, 2009

The Cool Wall of Program Names

While using Windows I have discovered, that I'm constantly surrounded with programs that have really uncool names. The main source of the bad names is Microsoft, but the softie isn't the only one to blame here – uncool names are a general tendency in Windows land.

To explain what I mean by cool and uncool names, and in the spirit of the Cool Wall of Top Gear, I'm going to put up the Cool Wall of Program Names.

Seriously Uncool

  • Avira Antivir Personal
  • Microsoft Office Powerpoint Viewer
  • Microsoft Visual FoxPro
  • Windows Internet Explorer
  • Windows Live Messenger

First of all, all these names are really long – at least three words in each.

Secondly, they contain buzzwords like “Visual”, “Office” and “Live”, which don't add any meaning whatsoever. Was an earlier version of FoxPro “Microsoft FoxPro for Vision-Impaired”? And was the previous version of Messenger “Windows Dead Messenger”? And is there a PowerPoint that is not for office? These are pure marketing buzzwords, nothing more.

Additionally all these names also have a company name inside them, which in itself is uncool, but this is already the topic of the next part of the wall.


  • Command Prompt
  • Google Chrome
  • Microsoft Excel
  • Mozilla Firefox
  • Windows PowerShell

Uncool names usually have company name added to the actual program name. But this addition rarely adds any value. How many other Excels do you know of? How many other Firefoxes? At least I don't know of any. So why do we have Microsoft Excel and Mozilla Firefox instead of just Excel and Firefox? That's just uncool.

For extra credit to Microsoft – half of their program names begin with “Microsoft” and the other half with “Windows”, so you can not even sort them and expect to find all Microsoft programs grouped together.

Additionally there are uncool program names like “Command Prompt”, showing that the creator of them had absolutely no imagination.


  • Gimp
  • Opera
  • Notepad
  • Paint
  • Skype

Finally the cool ones. These are short. That's the main thing. No extra buzzwords, no company names. To quote the already overquoted Antoine de Saint Exupéry:

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”

Note that even Microsoft can come up with pretty cool program names. However primitive Notepad and Paint are as programs, their names are cool – no doubt.

In perfect world you would have most of the programs belonging to this group – this should be the norm. In Windows-reality the norm seems to be uncool names.

Sub Zero

  • bison
  • less
  • tac
  • wc
  • wine

So, finally the sub-zero zone. Initially I tried to compile the whole wall with program names found from my Windows XP box, but as hard as I searched, I couldn't find a single Windows program with a really sub-zero-cool name. So I had to seek help from good-old UNIX. Let's look at each of these really cool names in detail – they all deserve it.

bison is the free software alternative to yacc, which stands for Yet Another Compiler Compiler and is in itself already quite cool. yacc sounds similar to yak, to which bison is a close relative. Additionally yaks have been domesticated animals for a long time, but bisons have always been free (similarly the software bison is free, but yacc is proprietary).

less – the opposite of more. At least that's what the manual of less says. Actually less is a descender of even older UNIX program more. They both are pagers, but while in more you can only go through text in one direction, less allows you to scroll both up and down. Therefore less is better than more. This is hell-of-a-cool.

tac is cat in reverse. Cat is a simple program that takes a file and prints it to standard output. Actually it can take several files and concatenate them all. Tac does the same, put prints the lines in reverse order. Seriously cool.

wc stands for Word Count, but it also happens to stand for Water Closet. UNIX users send often stuff through pipes to wc. This program name is clearly sub-zero cool.

Wine Is Not an Emulator. A recursive acronym, a common theme in UNIX, which is already cool. And yes, although Wine acts as an emulator for Windows, it's not actually an emulator, but instead implements a compatibility layer for Windows apps. This name also works on second level. When you drink too much wine, you will get drunk. When you use Wine to run too many Windows applications, you're poisoning yourself with proprietary software. Again, seriously sub-zero cool.

If you don't agree with my Cool Wall, then your comments are always welcome. But please, don't use a chainsaw.

Disclaimer: This Cool Wall was about program names, not about the programs themselves. Clearly Mozilla Firefox as a program is a lot more cool than Notepad – it's just the name that kinda sucks.

Monday, January 19, 2009

Why Frank Hates Windows

Another day when I was doing a cleanup in my browsers bookmarks, I discovered an old bookmark to a site where Frank van Wensveen explains in a lengthy essey why he hates Windows. I barely remember bookmarking it, so it must have been many years ago.

But the truly great thing about this essey is, that unlike many others, this one has been kept up to date. So you don't have to think, "does this really hold any more in Vista?" As Frank van Wensveen explains – most of flaws in Windows stand the test of time.

Clearly a suggested reading:

Thursday, January 15, 2009

Upgrade to PowerShell V2

After I had cursed the command line completion of PowerShell for being so utterly powerless, PowerShell developer Lee Holmes commented:

Thanks for the feedback. Much of this behavior has been improved in the latest CTPs of PowerShell V2.

And he pointed me to CTP3 of PowerShell V2. Well, I thought, if these things really have been improved, then I'm most certainly going to try it out.

I downloaded the CTP3 ("Community Technology Preview 3" – this is Microsoft saying "Alpha"), and was going to install it and see, what has changed. But you know, it couldn't be that easy... even with Microsoft developer pointing you in the right direction... it's still Windows...

Installing and Uninstalling

The download page contained a small paragraph, hidden between the others, instructing me to uninstall the previous version of PowerShell first - I chose to ignore it, thinking it was just another measure to help save Microsoft his ass when something goes wrong.

I started up the installer, clicked next and next... everything was going fine. Until I was confronted with this:

Cannot install this version of the product. You must first remove any earlier versions of Windows PowerShell before you can install this version. Refer to install notes for uninstalling previous versions.

Alright, I thought, if that's really what you want, then I uninstall it.

  • I opened up Add/Remove Programs to uninstall it and... it wasn't there. I scanned the list for quite some time, wondering if it's named "PowerShell", "Windows PowerShell", "Microsoft Windows PowerShell" or even something else. Nope... not in that list.
  • I went to the Start menu entry of PowerShell... no uninstall option there.
  • I went to c:\Program Files\PowerSh... nothing like that over there. Where is the damn thing!?
  • Finally found it from c:\Windows\System32\WindowsPowerShell\v1.0. I removed these files, restarted installer, and was greeted with the already familiar error message.
  • I tried several more things, which didn't helped either.
  • I even searched around the registry, but didn't felt comfortable enough to modify it.

Finally I found uninstall instructions, hidden away inside one Windows PowerShell Blog post.

It appeared, that PowerShell was actually installed not as a separate program, but as a Windows update. And in the Add/Remove Programs dialog I had to check the "show updates" option to be able to see and uninstall it.

After that the installation of PowerShell V2 worked out just fine.

A Miracle Has Happened

It appears that the two things I complained about in the Powerless Completion of PowerShell have indeed been fixed.

Completion now also works with executable files in my $PATH and also with aliases. Additionally to complete cmdlet name like Join-Path I can just type jo and press TAB, instead of being only able to complete the part after the dash. Although I would prefer fir to be completed to firefox not firefox.exe, I'm quite satisfied.

On the filename completion side cd foo\bar is no more expanded to cd 'C:\Documents and Settings\Rene\Desktop\foo\bar'. Although it is still expanded a bit, to .\foo\bar, but this is still a big win in brevity.

So yes, a miracle really has happened. First time in this blog a truly happy end.

Tuesday, January 13, 2009

Smoking PowerShell Pipes

Everybody likes pipes. Starting from 1972 on when Douglas McIlroy introduced the concept, pipes have been an unreplacable tool for hooking programs together. Pipes just work. Well... at least in UNIX. But you know, this is a blog about me being stuck in Windows.

Real Pipes in UNIX

The main idea of a pipe is that you take the output of one program and connect it to the input of another program. The pipe itself does nothing more than just forwards data. When the output of one program does not fit into the input of another program, then you can pipe it first through a filter program, that transforms the data as needed. But the pipes themselves remain only as a transport layer, carefully carrying data from one program to another and not changing a bit on the way.

The same holds true for real-world pipes. A good pipe is one that doesn't change the aroma on its way from bowl to your mouth. It's the tobacco you want to smoke, not the pipe.

I had a PHP script that generated test data for MySQL database. In UNIX I would have used it as follows:

php create-test-data.php | mysql dbname

I thought that this should also work with PowerShell.

Water Pipes in PowerShell

PowerShell pipes work more like water pipes. The smoke that comes in is sucked through water, changing it's aroma, softening the bitter taste. Water pipes are great, but you shouldn't try to sell them labeled as normal pipes.

When I ran the above code in PowerShell, the data generated by the script wasn't exactly the same that MySQL database received. If it even received it, because the thing crashed along its way.

Actually I didn't even had to pipe it to another program, just redirecting the output to a file changed it considerably:

php create-test-data.php > test-data.sql
Let Me Encode This for You

The first problem was encoding. The output of the script was in UTF-8 encoding. PowerShell wanted to convert the text into his internal UTF-16 representation and then convert it to another encoding when saving to file, because for PowerShell the > operator is equivalent of piping your output to Out-File cmdlet:

php create-test-data.php | Out-File test-data.sql

Luckily Out-File takes -Encoding parameter, which can have the following values: unicode, utf7, utf8, utf32, ascii, bigendianunicode, default and oem. I tried all of them, and the only one that preserved my encoding was oem – which designates single-byte encoding.

Let Me Correct Those Lines

The philosophy of UNIX has been: it's all text. The input of every program is text and the output of every program is text. Except when it's not, and when it's not, then you can't use all the common UNIX text-processing tools on it. Instead you have to use separate tools specific to your binary format. For example you can use ImageMagick to apply all kinds of transformations for images.

This philosophy was recognized by the PowerShell team as one of the great weaknesses of UNIX pipeline. And therefore the mantra of PowerShell has been: it's not all text. It has been the great promise of PowerShell, that it will enable you to work more easily with all kinds of data, not just text.

And this all works out fine, when your program outputs .NET objects. But when it doesn't, the output is treated as text. But it's a water pipe as you remember, so the text isn't just left alone, it's transformed into .NET array, array of lines.

Doesn't look that bad, does it. But the trick is that when the text is split to lines, the line separators are discarded. And when it is put back together, all lines are joined with \r\n. For example this input:

my name is Rene.\r\n
I'm the author of this blog.\n

...will be converted to this output:

my name is Rene.\r\n
I'm the author of this blog.\r\n

First of all it's dosification - all your nice UNIX file endings will be converted to ugly DOS line endings. Really annoying. Not just annoying – terrible. I think you already know where this is going: binary data.

The SQL generated by my script also included binary data. And you can imagine what this kind of conversion can do to binary data.

There is no built-in mechanism in PowerShell to overcome this problem, although the problem is well known and there exist some ugly workarounds.


At the end of the day PowerShell had failed me. It was the first real job I wanted to do with PowerShell and it failed completely.

If PowerShell really wants to succeed, this behavior has to be corrected. Please, PowerShell, no water inside my pipe.

Thanks to paws22 for sharing the above photo in Flickr under Creative Commons Attribution Noncommercial Share-Alike license.

Sunday, January 11, 2009

Powerless Completion in PowerShell

PowerShell has command line completion. It can complete cmdlets, arguments, methods, properties and probably many more things. Which is great. But because this is Windows, there just has to be something terribly wrong with it...

Command Line Completion Essentials

Completion can be provided for a lot of things, but there are two for which I consider completion to be essential:

  • commands (programs)
  • files and directories

Lets look how the completion of these two essential things is handled in PowerShell.

Program Name Completion

It seems natural, that when we have a command line completion, then we should be able to complete commands. PowerShell doesn't think so. Completion is only provided for the PowerShell-native cmdlets. But simple executable programs are not worthy to receive the mighty PowerShell completion. Completion also doesn't work with aliases.

Actually the completion doesn't even work well with PowerShell cmdlets. For example there is cmdlet Join-Path, which is the only cmdlet starting with letter J. One would think that you just type "J", press TAB and have it completed to "Join-Path". Yeah... but not in PowerShell. Instead you have to type "Join-" and only after that you can press TAB to have it completed.

But as I said in my previous post, in Windows real programs aren't available from command line anyway - so I guess it makes sense to not have completion for these things also.

Filename Completion

But what about filename completion. It did work reasonably well in cmd.exe. It clearly must also work in PowerShell. Well... sort of.

Suppose that you open cmd.exe and want to go to your Desktop directory. You are already in your home directory, so you just type cd and the letter d:

C:\Documents and Settings\Rene>cd d

Then you press TAB and it will be completed to:

C:\Documents and Settings\Rene>cd Desktop

This works the same way in PowerShell. But suppose you want to go two directories with a one step. Suppose you want to go to Desktop\MyDir. So you just type backslash and letter m:

C:\Documents and Settings\Rene>cd Desktop\m

Then you press TAB again and in cmd.exe it will be completed to:

C:\Documents and Settings\Rene>cd Desktop\MyDir

But in PowerShell this will be completed to:

PS C:\Documents and Settings\Rene> cd 'C:\Documents and Settings\Rene\Desktop\MyDir'

PowerShell might call this a feature, but I would certainly call this a regression.

Just Another Day in Windows

PowerShell is nice. In fact it's even quite cool. But like always with Microsoft, they managed to screw up the essentials.

Tuesday, January 6, 2009

Windows from Command Line

In Linux I used command line every day. It was my filesystem explorer. It was my administration interface. It was my programs lauchpad. It was everything.

But in Windows I haven't really made use of the command line so far. Why so? Why do I spend my time clicking around the filesystem? Why do I hunt programs from Start-menu? Have I lost the spirit of command line?

I think not. Actually I really want to use the command line. But there is something really wrong with the whole command line thing in Windows.

The Default Powerless Shell

First I though that the problem is in power, that the default cmd.exe gives you so few possibilities in combining different programs together. So I installed Windows PowerShell.

PowerShell gives you a neat programming environment where you have access to the whole functionality of .NET framework. The command set is well designed and quite easy to learn with the aid of reflection capabilities it provides. It's a lot more UNIX-like than cmd.exe – it even greets you with the familiar UNIX commands like ls, rm, cp, mv, cat, ps and kill.

So the power problem was now solved, and I spent quite a bit of time playing with my new powerful toy, but I still didn't use command line for everyday tasks like I did in Linux.

Command Line Without Commands

The real problem is that in Windows you don't have any commands to run from command line.

I mean, you don't have any interesting commands to run.

Let me explain...

Of course you have commands. Powershell has a lot of built-in commands. But you can't do a whole lot with these commands alone. You really want to invoke real programs (.exe files) to do some hard work.

Again, executables are also available from command line. There are actually a whole bunch of them available. In my system I have 372 programs available from command line:


But these aren't interesting programs. Most of them are used by Windows internally and I have no idea what for, and the ones I know about (like notepad, mspaint, explorer, ping) are of very minimal use.

Most of the programs I actually use every day aren't available from command line. Programs like Opera, Emacs, Skype and Windows Media Player.

In Linux all programs are available from command line. If you aren't on command line – you don't exist. While in Windows the command line seems to be for suckers. Real programs are available from Start-menu.

The Problem With C:\Program Files

All this is not the fault of the programs. It's the architecture of Windows that makes adding command line programs so cumbersome that you really want to avoid it if you can.

The locations for command line programs are defined by the PATH variable. In UNIX the PATH contains directories like /bin, /usr/bin, /usr/local/bin and maybe a few more. When new program is installed the executable is placed into one of these /bin-directories and through this becomes naturally available in command line.

But when a new program is installed on a Windows machine, it is placed inside a folder of its own. opera.exe goes inside C:\Program Files\Opera and firefox.exe inside C:\Program Files\Mozilla Firefox. To make a program available from command line its location needs to be added to the PATH, making it longer and longer and even longer.

I have about 80 folders under C:\Program Files. To make all these programs available from command line, I would have to add 80 new paths to the PATH variable. And the PATH is quite long already.

Imagine a PATH like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Fil
es\ATI Technologies\ATI Control Panel;C:\ProgramFiles\QuickTime\QTSyst
em\;C:\Program Files\WinSCP3\;C:\Program Files\Smart Projects\IsoBuste
r;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\7-Zip;C:
\Program Files\Acro Software;C:\Program Files\Adobe;C:\Program Files\A
ltiris;C:\Program Files\AMD;C:\Program Files\ArcGIS;C:\Program Files\A
TI Technologies;C:\Program Files\AuthenTec;C:\Program Files\Avira;C:\P
rogram Files\Bentley;C:\Program Files\BitTorrent;C:\Program Files\CCle
aner;C:\Program Files\Common Files;C:\Program Files\ComPlus Applicatio
ns;C:\Program Files\CONEXANT;C:\Program Files\DIFX;C:\Program Files\Di
giDoc;C:\Program Files\DivX;C:\Program Files\DNA;C:\Program Files\Easy
Internet signup;C:\Program Files\emacs;C:\Program Files\eMule;C:\Prog
ram Files\Fingerprint Sensor;C:\Program Files\foobar2000;C:\Program Fi
les\GIMP-2.0;C:\Program Files\Google;C:\Program Files\GPLGS;C:\Program
Files\Hewlett-Packard;C:\Program Files\HPQ;C:\Program Files\Ideelabor
;C:\Program Files\Internet Explorer;C:\Program Files\Internet Explorer
Developer Toolbar;C:\Program Files\InterVideo;C:\Program Files\IT Are
ndus;C:\Program Files\Java;C:\Program Files\jEdit;C:\Program Files\Kar
en's Power Tools;C:\Program Files\KONICA MINOLTA;C:\Program Files\Logi
tech;C:\Program Files\Messenger;C:\Program Files\microsoft frontpage;C
:\Program Files\Microsoft Office;C:\Program Files\Microsoft Script Deb
ugger;C:\Program Files\Microsoft Visual Studio;C:\Program Files\Movie
Maker;C:\Program Files\Mozilla Firefox;C:\Program Files\Mozilla Thunde
rbird;C:\Program Files\Mozilla Thunderbird_new;C:\Program Files\mplaye
r;C:\Program Files\MSN;C:\Program Files\MSN Gaming Zone;C:\Program Fil
es\MSN Messenger;C:\Program Files\MSXML 4.0;C:\Program Files\MySQL;C:\
Program Files\NetDrive;C:\Program Files\NetMeeting;C:\Program Files\No
rton AntiVirus;C:\Program Files\Notepad++;C:\Program Files\Omnikey;C:\
Program Files\Online Services;C:\Program Files\Opera;C:\Program Files\
Outlook Express;C:\Program Files\pgAdmin III;C:\Program Files\Power Ar
chitect;C:\Program Files\Program Shortcuts;C:\Program Files\PuTTY;C:\P
rogram Files\Quest Software;C:\Program Files\QuickTime;C:\Program File
s\RegCure;C:\Program Files\Skype;C:\Program Files\Synaptics;C:\Program
Files\TortoiseCVS;C:\Program Files\TortoiseSVN;C:\Program Files\Visua
lSubSync;C:\Program Files\Winamp;C:\Program Files\Windows Media Connec
t;C:\Program Files\Windows Media Connect 2;C:\Program Files\Windows Me
dia Player;C:\Program Files\Windows NT;C:\Program Files\WinLemm;C:\Pro
gram Files\WinMerge;C:\Program Files\WinSCP3;C:\Program Files\xerox;C:
\Program Files\XP Codec Pack;C:\Program Files\ZTE EV-DO;C:\Program Fil
es\ZyXEL Communications Corporation

This is scary...

So I guess this finally explains why you can't make full use of Windows from command line alone.

Monday, January 5, 2009

Update in 0 Minutes

Another day I was again watching a movie, and when it ended a popup appeared asking, do I want to perform Windows Media Update. I had no reason to say no, so I agreed. The next window informed me, that the update will take approximately zero minutes. I was happy to press "next". Again I forgot, that I was stuck in Windows.

The Fast Ride Begins

Now I have two windows open. One says: "Windows is being upgraded with Windows Media Player 10". Another one says: "Installing Windows Media Player 11". So which one is it. Still running. Zero minutes as predicted...

Now it finally finished saying that I have to restart my computer for the changes to take effect. WTF! This is one hell of a zero-minute upgrade.

And We Shall Continue After a Reboot

After Restart I open Media Player to see the new upgraded version. But instead I get a window asking me again to validate my Windows installation. (I just did it yesterday!)

I click the validate button. Then I get a screen asking me to agree with some license terms, which I probably don't agree with, but click the accept button anyway.

Then I get to choose between Express Settings and Custom Setting. As Express Settings are recommended I choose those and click Finish.

Another progress bar flashes and suddenly I'm confronted with a new Media Player which clearly looks different than the one I had before.


Actually my Media Player with its new skin looks utterly familiar. I have certainly seen it before. I'm pretty sure, I have seen it running inside another XP machine before.

I check Windows Media Player 11 entry in Wikipedia and find out, that its latest release was on 30th of October 2006. That's over two years ago!

How can it be, that my computer was just upgraded with software released two years ago? I have been using this Windows machine over two weeks for now – why didn't the upgrade happen earlier? Actually, why didn't it happen two years ago? I'm pretty sure, this machine didn't just sat in the corner picking up dust for two years – somebody certainly used it, but for some strange reason he did not get the upgrade.

This leaves me to wonder whether I was magically chosen to receive this holy upgrade given only to the few of us.

Sunday, January 4, 2009

Installing Windows PowerHell

As every child knows, the command prompt Windows provides is a total piece of crap. cmd.exe is to Bash as MS Paint is to Gimp.

But I had heard that Microsoft has another shell to offer: Windows PowerShell. The name itself sounded promising and so I decided to give it a try. But you know... I was stunk in Windows.

Downloading from

I read a bit of the Wikipedia entry about PowerShell and from there went to the PowerShell homepage.

I clicked on the download link and was presented with a page explaining How to Download Windows PowerShell 1.0. (Although the text on this page didn't really explain anything and sounded more like some marketing gibberish.) I decided that although I have no idea what RTW means, Windows PowerShell 1.0 RTW is probably the version that I need. I chose x86 and English language Package for Windows XP.

On the next page I was informed that the download requires validation that Microsoft has received money for my Windows installation. They really wanted to make the process painful... after all I was running Windows XP (eXtra Painful).

I downloaded GenuineCheck.exe. Ran it. Copied the generated code to the web page. Submitted it. And was finally able to click the download button.

After I had ignored the advice of installer to close all my programs and back up my system, the PowerShell was in my machine.

We'll See What Happens

So now I'm going to use this shell for a while and we shall see what kind of surprises it will bring to our table.

Friday, January 2, 2009

Firefox Annoyances

I have been Opera user for years, long before Firefox came to be. But Opera is a piece of proprietary software, and this keeps bothering me. So time after time I try out the free browsers out there, to see if some of them could replace Opera. This time when I got stuck with Windows I decided, that I will give Firefox another chance.

I spent two weeks using only Firefox, but today I'm leaving it again and going back to Opera. So, what went wrong?

Little Things Count the Most

I don't have any serious issues with Firefox, it's a decent browser, in fact it's a truly great browser. But some small things in Opera are just better:

  • Restoring recently closed tabs. Every now and then I accidentally close a tab, which is perfectly normal, because people make mistakes. In Opera I just press Ctrl-Z like I would when I want to undo any other accidential action. But in Firefox it's Ctrl-Shift-T. I didn't manage to learn this shortcut and always ended up going to History –> Recently closed tabs.
  • Duplicating tabs. Opera allows you to clone a tab along with its history and everything. Every now and then I go from page A to B and discover that actually I want to have both A and B open as separate tabs, so I clone the tab and in the cloned tab press back to get to page A. Haven't found this functionality in Firefox. Sure, I can go back and click on the link so that it opens in another tab, but it's not that convenient.
  • Spatial navigation. Because I have laptop in bed with me, there is no way to use a mouse and using the touchpad is pain, therefore I prefer keyboard wherever I can. But tabbing through the links of a web page is one of the least effective ways to navigate. Opera has spacial navigation, which allows you to move through the links of a page using arrow keys - go to the link below, go to the link at right, etc. Firefox doesn't have it (they have it implemented in CVS, but it's been there for ages).
  • Switching between tabs. I usually have more than two applications open, but most of the time I spend switching between two of them (e.g. from Emacs to browser and back) and Alt-Tab does exactly what I need. Similarly when inside browser I usually have more than two tabs open, but a lot of time is spent switching back and forward between two tabs. In Opera I just press Ctrl-Tab, which behaves like Alt-Tab outside the browser. But in Firefox Ctrl-Tab cycles through all the tabs currently open – rarely useful.
  • Downloads. Every time I download something the nagging Downloads window pops up. There isn't a direct way to disable it, although the download progress is displayed at the status bar and I could click on it instead to pop up the Downloads window when I really need it. In Opera the downloads tab (not window) also appears, but you can easily disable it, and access all your downloads through sidebar.

I'm sure there are more, but these are the ones, that manage to piss me off nearly every day.

Don't get me wrong, I really like Firefox. I would like to have the same kind of extensibility in Opera. And Firebug is a hell of a better than Opera Dragonfly. But I just can't get over those small annoyances.

Firefox is Mainstream

Not IE. At least in the circle of computer-literates Firefox is the actual mainstream browser.

But I am not mainstream. I use a niche operating system. I use a niche editor. I also like programming in niche languages like Lisp. So maybe I'm also better off with a niche browser.

Thursday, January 1, 2009

The Only Good Thing In Windows

To start new year in a positive tone, lets talk about the only good thing in Windows.

As it should be clear from my previous posts, Windows clearly fails as an operating system. When you live with Windows it constantly tries to drive you insane. But of course you want to keep your sanity, because there are other operating systems out there worth living for. But how do you keep your mind sane when everything seems to be against you?

When a programmer is faced with an API that is absolutely awful to work with, then the classical solution is to build another API on top of it, that hides away the ugliness of the bad API and makes it pleasant and maybe even fun to work with. You just create a better abstraction of the same problem.

So how do you hide Windows? Because of the law of leaky abstractions you can't hide it completely – something will always leak out. Even when you run another operating system inside Windows using virtualization, but I don't really want to go there today – one could argue, that then you aren't really running Windows any more.

Another choice is to spend most of your time inside apps that hide Windows away from you. For me, the best app for this is Emacs. And well, it is pretty darn close to an operating system.

So to answer to the question stated: the only good thing in Windows is that you can run Emacs in it.