Torben Rahbek Koch

Soft dabblings

Addicted to nostalgia?

clock November 13, 2011 14:10 by author Torben Rahbek Koch

IEEE Computer August 2011 has some articles describing the history the IBM PC. Intriguing reading! Highly recommended!



Worth reading in MSDN Magazine November 2011

clock November 13, 2011 14:04 by author Torben Rahbek Koch

Thread Pool Synchronization

Part of an ongoing series "Windows with C++" by Kenny Kerr. Also applicable for .NET developers who wonder what goes on under the hood.

What the Heck Are Document Databases? 

Together with the Embedding RavenDB into an ASP.NET MVC3 Application it gives an introduction to the pros and cons of document databases and uses RavenDB as a concrete example.

Greedy Algorithms and Maximum Clique

My favorite series by James McCaffrey. These articles contain real computer science! Refreshing!



Worth reading in MSDN Magazine August 2011

clock August 23, 2011 10:56 by author Torben Rahbek Koch

I'll highlight three articles from this MSDN Magazine:

Building Apps with HTML5: What you need to know.

The first article in a, probably longer, series. Lays the ground work for understanding what HTML5 is all about.

The Past, Present and Future of Parallelizing .NET Applications

How to do parallel work in .NET then, now and in the future. Pretty good.

Particle Swarm Optimization

Particle Swarm Optimization. I like that this kind of article has found its way to MSDN Magazine. Keep them coming, please!

 

 



Dansk Dvorak

clock December 15, 2010 05:51 by author Torben Rahbek Koch

Hvis man skulle få den særprægede lyst at bruge Dvorak layout med danske tegn vil man hurtigt bemærke manglen på understøttelse i Windows. Jeg har derfor med hjælp fra Dansk Dvorak og The Microsoft Keyboard Layout Creator lavet layouts med tilhørende installer.

 

Installer: dkdvorak.zip (252.92 kb)

Hos http://www.4keyboard.com kan man købe selvklæbende mærkater, så man kan ændre sit yndlingstastatur til Dvorak.

Når man har skiftet vil man se sjove ting ske med short-cut-taster. F.eks. CTRL-C (copy). Den hedder nu CTRL-J, så den fysiske placering er altså den samme.

I Firefox (og nogle IE) kan man normalt bruge ALT-D for at komme op i adresselinjen. Det virker ikke mere. ALT-D åbner i stedet Help menuen.

Er Dvorak bedre? Umiddelbart føler jeg, at jeg bevæger fingrene væsentligt mindre, hvilket er den primære grund til at skifte. Om jeg holder ud må tiden vise...

PS. Dette er selvfølgelig skrevet på mit Dvorak-tastatur.



Visual Studio 2010 with an SSD - still bad

clock May 24, 2010 04:28 by author Torben Rahbek Koch

We finally got new computers: Core i7 Quad core, 6GB RAM, Intel X25 Mainstream 160GB SSD's - and believe it or not. VS2010 is still slow, but it has now reached a usable state, simply because the compile times have now been reduced enough so we don't forget what we were doing when the compiler finally finishes ;-)

We have discovered that if we set the MSBuild logging level to quiet the IDE doesn't lock up as much as before. So it seems that the IDE is being locked each time the output windows is being written to. Weird.

My old Core2 laptop with a 5400RPM disk still runs VS2008 faster in a VirtualBox VM than this new baby runs VS2010. Nice move, Microsoft. I am not impressed - or amused ;-)

To be honest I had expected more from the SSD than I got. Its definitely faster than an ordinary disk - but unless you cough up the coins for a SLC (Single Level Cell), which I didn't - you won't get a really amazingly fast system. Our compile times probably went down 50% due to the SSD and another 50% due to the CPU. Which means we are somewhere around 25% of the original machines - some slow Core2 HP Office Desktops with 2GB and 5400 RPM disks.

The one major benefit to an SSD, though, is the absolute silence it gives. I love that...

I am thinking of replacing my old 5400RPM disk in my laptop with the Intel X25 Mainstream 160GB SSD. I'm pretty sure it will work wonders for that computer, simply due to the fact that the existing disk is blazingly slow ;-)



Visual Studio 2010 - even worse than Word 2007?

clock May 3, 2010 11:20 by author Torben Rahbek Koch

I started on a new assignment at Thomas Cook Airlines Scandinavia in Kastrup Airport, Copenhagen, roughly two months ago. A very exciting job I must say. Very visionary people on the team, all of which really like a high code quality.

Therefore it seemed as a pretty good ide to use Code Contracts and StyleCop to the (almost) fullest extend. And of course we would go with Visual Studio 2010, especially since the GUI is going to be WPF, and the WPF should be much better in this version.

Starting Visual Studio 2010 for the first time does not feel that different from starting Visual Studio 2008 - it does take quite a while longer, though. And on first sight - well, I know this is very subjective - but I think its pretty close to ugly. Apart from that it does not, on the surface at least, seem that different from VS 2008.

I know there are a lot of fancy new features in VS2010 - a MSDN Magazine article by Doug Turnure: "Better Coding with Visual Studio 2010" article some of them: http://msdn.microsoft.com/en-us/magazine/ee336135.aspx. One of them made me laugh a bit, though. He toots the vertical block selection as a new feature. I do not want to install a VS6 to check, but I am pretty certain that this feature has been available since that version, which was the first Visual Studio I used. It is definitely available in VS2008, which I of course already have installed.

If you are using more than one monitor, you are going to love the possibility to tear of tabs and drag them to another monitor. Multiple monitors does not work that well for me; I prefer one large screen. That’s probably something to do vith personal habit.

But what’s with this "even worse than Word 2007?". Well, the "feature" in Word 2007 I hate the most is of course ribbons. At first I simply hated it, but as time has gone by I kind of like the idea that is supposed to be behind ribbons. Its just a pity that they managed to, to be blunt, fuck it up entirely. The ribbons themselves does not work very well, it is of course hard to figure out where what command is. They could have saved me a lot of trouble if they had kept the menu, to ease the transition. But they didn’t. This single fact have made Word 2007 so hard for me to use that I simply hate it. And then I haven’t even started on all the various bugs that have crept in - and I really do not want to waste my life writing about those.

Visual Studio 2010 does not have ribbons. It does have a lot of toolbars, though. So many that its clear why they have chosen to try something else in Word. Toolbars are pretty neat and small and works very well when you have, let’s be generous, at most 20 icons to choose from. More than that and you simply cannot remember what icon does what, and you can’t usually spot it from the icon without hovering the mouse over it. Ribbons mostly fix that. If they are done right.

As Word 2007 has this one feature which makes me hate it, so does Visual Studio 2010. Just one, single thing, wich makes it a show stopper for me personally. It is so simple: I cannot use the IDE when compiling. It isn’t actually locked - it’s just totally unresponsive. And note: This is not just me. We are several people on my team who really would like to go to VS2008 - if it weren’t for the WPF-stuff. It’s on different hardware, as well. It is even hard to break the compile (CTRL-BREAK).

This is so annoying! On my own projects I will not move to VS2010 before I really have to! A buddy of mine really would like to move to VS2010 because of the new C++ stuff. I fully understand him. But not being able to use the IDE while compiling simply makes it a no-go.

This single problem is such a big blunder that this - in my eyes - makes Visual Studio 2010 the biggest software blunder ever from Microsoft. Period.



EAC - Exact Audio Copy on Windows 7

clock April 30, 2010 16:45 by author Torben Rahbek Koch

When recently upgrading to Windows 7 I had no idea that ripping my CD’s would cause me any trouble. For years I have had the EAC, flacattack.exe and flac.exe files in a directory, making it easy to backup the configuration by simply zipping it.

Moving the package unto Windows 7 - unzipping it into Program Files - I simply fired up EAC and then close to nothing worked. EAC did rip the CD, but flacattack consistently failed to do anything.

This took me by surprise. I spend a couple of hours on it, part of the time in the company of Process Monitor from SysInternals (now part of Microsoft). And finally I figured it out.

The flacattack.ini file was conveniently located in the same directory as flacattack itself, but Windows 7 seems to be pretty strict about any program whatsoever writing anything in Program Files, which is fair enough by itself. Windows 7 then tries to redirect the file write to a so-called VirtualStore (look it up, its probably neat). This means that all my settings were never saved in the actual flacattack.ini that I called flacattack.exe with. Bummer.

When having figured this out I simply moved the ini-file to my Documents directory and would then simply give the entire path (as I did before) on the command line options (they are setup in EAC).

But it still did not work! My Additional command line options in EAC looked like this:
"C:\Users\Torben\Documents\Flac\flacattack.ini" %s "%a" "%t" "%g" "%y" "%n" "%m" %o

One particular point to notice is that %s (the source wav file) is not encapsulated in quotes. Weird. Again I fired up Process Monitor which amongst other stuff gives me information about the command line parameters of a program. Here I could see that the %s, when expanded by EAC, actually DID contain quotes.

I was in trouble here. Because of the move to my Documents folder I needed to pass the full path to the source wav file (%s). I tried various ways of putting "C:\Users\Torben\Documents\Flac\Rip" in front of the %s, but with no luck. I needed to get rid of the initial quote first.

Google to the rescue. I found this website: http://www.dostips.com/DtTipsStringOperations.php which shows how to do more or less simple string operations in a dos batch file. And one of the operations is to remove the start and end characters of a string.

This made me end up with a batch-file (called RunFlacAttack.bat) to call from EAC:

@set inputfile=%2
@set inputfile=%inputfile:~1,-1%
"C:\Program Files (x86)\Exact Audio Copy\flacattack\flacattack.exe" %1 "C:\Users\Torben\Documents\Flac\Rip\%inputfile%" %3 %4 %5 %6 %7 %8 %9


And to call it from EAC the setting "Program, including path, used for compression" is configured to:

C:\Windows\System32\cmd.exe

And the "Additional command line options":


/C C:\Users\Torben\Documents\Flac\RunFlacattack.bat "C:\Users\Torben\Documents\Flac\flacattack.ini" %s "%a" "%t" "%g" "%y" "%n" "%m" %o

And finally I was home free. I did also discover, though, that the directory whereto EAC rips the wavs and the directory where flacattack stores the flac-files should not be the same. This causes flacattack to delete the cue-file before it have used it, causing it to fail. Weird.

Now I can finally rip my backlog of CD’s.



A trip down memory lane - the Commodore 64 (3)

clock February 14, 2010 10:37 by author Torben Rahbek Koch

I think I was about 15 or 16 – in 85-86 when I became the proud owner of a Commodore 64 - today I really cannot recall how much I had to bleed for it, but I believe it must have been around 2000 DKK, at that time that must have been somewhere around 200 USD.
The C64 may seem as a small step forward compared to the Vic20, but to me it was a huge leap.

I had lots of fun with it. I enjoyed some Infocom games and a friend and I stayed up late several nights to try and solve the Valhalla adventure game. For some reason we never succeeded. Maybe we should have a Valhalla reunion and have another go at it ;-)

There were a lot of cool shoot’m’up games, as well. Who doesn’t remember Commando? And who doesn’t remember Manic Miner and Monty on the Run? I’ve actually seen Manic Miner coded as a JavaScript game in a browser. Cool ;-)

My aforementioned friend was a huge fan of Simon’s Basic (http://www.atarimagazines.com/creative/v9n11/60_Simons_Basic.php). For a Coca-Cola competition he programmed a cool commercial, about a guy swimming towards an island with a volcano, which erupted with Coca-Cola. Gotta be a mess. Unfortunately he didn’t get it finished on time.

One of my first major undertakings was to code a symbolic assembler on my C64. At first it was entirely in Basic, which gave me some head aches. The strings in Commodore Basic were garbage collected (yes, really!), but unfortunately the garbage collector was unwittingly slow. It probably used some n^3 algorithm.

I clearly remember that for each 12 lines of assembly code I could easily wait half an hour for the computer to come back “online”. As fast as possible (which obviously was very slow) I programmed the essential parts in machine code, instead.

Another of my bigger adventures on that computer was, in fact, a text-based adventure game. Not brilliant, but still quite okay. It had interacting characters - even a so called negroe - today that would probably be a politically very incorrect designation. All in all the game was comprised of 800 lines of Commodore Basic. Quite impressive – at least to me at the time! And the game had the most original title: The Adventurer. Ah, well – those were the days

The purchase of the 1541 disk station was yet another huge leap forward. Instead of waiting for 10-15 minutes for some things to save (not considering turbo tapes) it took merely seconds instead. And it opened up for games like Summer/Winter Games. Most fascinating what that computer were capable of.

And that computer also ran my first graphic OS: GEOS – it used the disk quite a lot, but later I invested in a 256Kbytes (whee) extension module, which helped quite a bit. Read about Geos:  http://toastytech.com/guis/c64g.html.

I purchased my C64 after starting after school classes and I was inspired by the schools Comal-80 cartridges. So fascinated that I even invested in one my self. There is no doubt that my main interest in computers was in programming them.

Whereas my friends typically made the change to an Amiga I, for some reason which seems a bit hazy to me, took the slight step forward to a Commodore 128. I did not actually end up using much of the advanced features in it. I had it for a couple of years before entering my PC era.



Ethics and loyalty – two opposing forces?

clock February 3, 2010 22:23 by author Torben Rahbek Koch

Reading “The public is the Priority: Making decisions using the Software Engineering Code of Ethics” from the June 2009 issue of IEEE Computer magazine reminded me of one particular incident a few years back.


I’m am by no means an expert in “The Code”, but the article outlines the basic principles of which I will mention these two:


1. Public - Software engineers shall act consistently with the public interest.
2. Client end employer - Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest.


The article goes on to discuss three specific scenarios to exemplify some of the principles and how to weigh them against each other.
My particular incident appeared when I worked as a full-time employee for a company developing output management software. When creating a solution for a customer we usually needed some sample data for getting the layout right.


I was - not pleasantly - surprised, when the sample data for the customer in question arrived. The customer is a loan/credit-company and therefore of course handles highly sensitive data about their customers.
The sample data firstly contained a full dump of their customer database – this is not a huge problem in itself, where it not for the kind of business that the customer conducted. And since most names and addresses are - in  Denmark anyway - publicly available, no real harm were done.


For each customer, though, there were to additional pieces of information. The cpr-number (CPR = Centrale PersonRegister = a central database of all people living in Denmark) was included. To my knowledge the cpr-number can be compared to the social security id in the US. The cpr-number is expected to be kept a secret (which is silly in itself, but leave that be), since it effectively gives you access to all information about that person. It is therefore considered to be a highly sensitive piece of information.


The second piece of information was the exact amount of money that the customer owed to the loan-company. In some countries - Sweden for example, this is mostly publically available information, but it is definitely a no-go situation in Denmark.


As a developer in this situation what was I to do? There was no question about the legality of the company’s actions. They were simply breaking the law. And even though we as a supplier should be considered able to keep their secrets, it was information that people really do not like other people to possess.


In Denmark we have an institution called Datatilsynet (something like: The Data Inspection Agency) whose primary responsibility is to make sure that the laws about cpr-numbers are upheld and take action when they are not.


I would have been right (or at least: not wrong) to contact them and inform them about the situation. This would have put my employer in an awkward situation, though. The loan company would wonder why we did not contact them and explain the delicacy of the situation. It was probably just a single employee in that company who took the easy way out. Imagine the amount work it would have taken to anonymize all that data.


My first (and only, it now seems) reaction was to inform my boss. And at the time I really expected him to do something relevant about it. In hindsight that was naive.
I have thought about this situation several times. But I am still not sure about what the right action would have been. My first action was correct - to inform my boss. But what should I have done when I found out that he did nothing about it?


Let me for a moment assume that he would stay passive even if I prompted him for action (he probably would). Should I then have informed the customer myself? Should I have contacted Datatilsynet myself? Both actions would most likely be considered disloyal by my employer.


Today I believe I should have contacted Datatilsynet myself (when I realized that my boss did not). A blunder this size should not go unnoticed by the proper authorities. But I am no longer employed there and I do not have any warm feelings left for the company so that might certainly blur my judgment.


Doing the right thing and still being loyal to your employer may not be easy, but I believe it has a lot to do with your actual employer. I hope for you that you have a decent boss when you eventually stumble into a situation like this.



Tail-recursion - that was new for me

clock January 12, 2010 22:40 by author Torben Rahbek Koch

Yesterday (Jan 12th 2010) I went to Trifork's Geek Night about Erjang, which is Kresten Krab Thorups attemt (and a successful one it seems) at implementing Erlang in the Java VM.

I cannot say that I was very familiar with Erlang or functional programming before this, but I do find both interesting so I do have some knowledge.

What I did not know about, though, was tail-recursion. A clever way to avoid eating up stack space when you write recursive functions. The idea is that if you make a recursive call at the end of your function (the end = the tail - I guess) you are essentially done with the current instance of the function. You might therefore just as well deallocate any local variables and parameters by removing them from the stack. You then proceed to putting the new (if any) parameters on the stack and then basically do a GOTO to the start of the function. I find things like this insanely clever ;-)

This way of allowing infinite recursion is probably also used when creating lists of infinite length? I have to investigate this on occasion ;-)

 

 



About me

40 year inordinary guy with profound interest for all aspects of software engineering and development. I'll write about what I find interesting, fascinating, funny, weird, whatever, whenever I feel like it.

Feel free to comment, I may choose to ignore your comments or I just might include them in further postings.

Sign in