Archive

Author Archive

Migrate MoinMoinWiki to Redmine.

August 2nd, 2009 No comments

Today I switched a small wiki from MoinMoin to a new Redmine setup. I couldn’t find any existing scripts to convert the wiki pages over. For a moment I thought I could do MoinMoin to Trac and Trac to Redmine but I thought better of it. It’d be a lot of work and the wiki syntax would probably be completely mangled in the process.

Instead I hacked up Carl Nygard’s MediaWiki to Redmine script. It’s an awful hack really but it worked for the pages I needed, and it does preserve revision history.

  • Download the script: migrate_from_moinmoin.rake
  • Edit the source and enter your own email address instead of admin@example.com.
  • Place the file in lib/tasks/ in your Redmine installation.
  • Run the command with
    rake redmine:migrate_from_moinmoin RAILS_ENV="production"

  • Enter a project identifier.
  • Enter an absolute path to the data/pages folder of your MoinMoin install.
Categories: Programming Tags: , , , ,

Problem with jQuery 1.3 and :eq in a complex selector

August 1st, 2009 No comments

While trying to recreate this XPath as a jQuery selector I ran into some unexpected difficulties:

/html/body/table[3]/tbody/tr/td/table/tbody/tr

My first attempt to convert it looked something like this:

$("body > table:eq(2) > tbody > tr > td > table > tbody > tr")

This gave no results. I simplified it a little bit,

$("body > table:eq(2) tr tr")

Still no luck. After experimenting for a while it looked to me like :eq wasn’t playing well in this expression. The following worked:

$("body > table").eq(2).find('tr tr')

Weird.

Improved Cygwin Terminal

July 30th, 2009 1 comment

The standard terminal in Cygwin is not very good. It can’t be made wider, you can’t select text normally using the mouse without first accessing the context menu and selecting ‘mark’, the default font is thick and ugly, etc. When you are used to the Mac OS X Terminal the Cygwin console is not fun.

Here’s the solution: puttycyg. It’s a modification of putty which allows it to act as a cygwin terminal in addition to the normal ssh and telnet functionality. Very cool!

Found it through this blog post. Thank you Andreas Hochsteger!

Pipe into the clipboard on OS X: pbcopy

July 27th, 2009 1 comment

I just discovered this handy command in OS X: pbcopy. It lets you pipe the output of a command right into the clipboard (or the ‘pasteboard’) so you can paste it into some non terminal application next. A convenient way to avoid having to scroll up and select the text in the terminal by hand.

Example:

cat myfile.txt | pbcopy

Categories: Mac OS X, Programming Tags: , ,

New blog about technology and music

July 20th, 2009 No comments

My lifelong friend Kristján just put up a new blog musing about tech and music. I bet it’ll be interesting so check it out here!

Categories: Site Tags:

Signing code (Authenticode) in OS X with a Thawte Certificate

July 16th, 2009 No comments

Just some quick notes on signing Windows executables using a Mac. First, get Mono:

Download mono

I used version 2.4. Next, take a look at Mozilla’s code signing guide and work around the problems you run into using Zillabit Notes on Mono Authenticode.

It boils down to something like this:

  • Open your Thawte issued .SPC file in Windows using certmgr (just double click it).
  • Expand the certificate view in the left pane and click on Certificates.
  • The components of your SPC file will be displayed, normally consisting of your company certificate and then some signer root certificates.
  • For each of the certificates, go to Action / All Tasks / Export... and export the certificate as a DER .cer file.
  • Bring the exported files to your Mac and join them with cert2spc. E.g.:
    cert2spc cert1.cer cert2.cer cert3.cer my_fixed_certificate.spc
  • Use the newly generated SPC file to sign your code:
    signcode -spc my_fixed_certificate.spc -v my_private_certificate_key.pvk -a sha1 -$ commercial -n MyProductName -i http://www.mycompany.com -t http://timestamp.verisign.com/scripts/timstamp.dll MyProgram.exe
  • Verify by trying to run the executable in Windows.

A final note: don’t try to verify the signing using mono’s chktrust command. At least for me it always tells me the exe doesn’t have a signature.

Categories: Site Tags: , , , ,

Spotify Label Search Feature – WTF?

July 2nd, 2009 6 comments

Recently Spotify has been running an advertisement about a new feature allowing you to search for music by record label. That seems about as useful as searching for music by street name or color. Who cares what label produced a certain record? Labels don’t make music. In fact labels don’t make anything at all, they just put money on the table – they are an increasingly irrelevant fragment of the past when a recording studio was something fancy and printing a record cost involved a huge factory instead of an on demand print with shipping at $4.95.

And since we are using Spotify, printing CDs is even less relevant. Why would I care about a record label? A better related music feature or a better genre based radio feature would be a much better expenditure of time.

Categories: Site Tags: , ,

Strange OS X SWT Table bug: scrollbar position wrong compared to content

June 8th, 2009 No comments

Today I saw a strange SWT bug which I couldn’t find much on when I searched for it online. In Mac OS X with a Table widget, sometimes pressing the Home or End keys on the keyboard would make the scrollbar move without the content actually moving. So for instance maybe you were scrolled towards the bottom and hit the Home key to get to the top: the bug would make you still see the same table rows even that the blue scrollbar marker would hop to the top. Even weirder, if you scrolled with the mouse wheel after that the scrollbar would snap right back to where you started and scroll like if you had never hit Home to begin with.

The solution was to add an SWT.KeyDown listener on the table and intercept any Home or End keyboard events. Set e.doit = false, then use table.setTopIndex() to change the viewing position in the table by hand. E.g. just reimplement the Home and End keys in your own code.

This worked fine for me.

Valve Steam Payment Bug: billing address does not match “current country”

June 7th, 2009 2 comments

Valve’s badly programmed Steam software has problems accepting credit cards in certain situation. The following message may appear when trying to pay:

Your billing address doesn’t look like it matches up with your current country. Please contact support for assistance or use a payment method registered to your current address.

It seems to be caused by more bad programming on Valve’s part:

  1. The software incorrectly believes it can detect what country you are in based on your IP address.
  2. The software incorrectly believes the country you are in affects the validity of your credit card.

Unfortunately there is no easy work around. The first time this happened to me the solution was to change my IP address. I suppose you could also use PayPal instead to pay but PayPal sucks in its own right (their terms of services basically give them carte blanche to rip you off seven ways to Sunday.) A third solution, one which I haven’t tried, could be to sign up for a disposable CC number and set your billing address to something the software approves off. I don’t know if this works.

The second time it happened, some months later, I just put my credit card back in my wallet. I’m not going to fight to spend my money.

I really want an idea like Steam to work but after my experiences so far I think I have to move on. Steam is not a new product – they have had plenty of chances to fix these shortcomings. Maybe Direct 2 Drive is better?

Categories: Games Tags: , , , , ,

Valve Steam Can’t Follow Simple Commands

May 24th, 2009 5 comments

Valve’s Steam software is one of the few programs that allows you to download games online and play right on your computer. Downloading to play with unlimited redownloads makes perfect sense. Why kill trees and make paper boxes with plastic discs you’re just going to lose next time you move anyhow? Downloading is the only acceptable distribution model for bytes in the 21st century. Unfortunately, Valve’s Steam software sucks.

I’m not even talking about the customer hostile DRM or the constant calling home annoyance. No, it’s the program’s basic functionality I have got a problem with. Today I booted up Windows for the first time in months to try to get an hour of Fallout 3 before going to bed, something well deserved after a long work day. Alas, it was not to be. Without asking me Steam began downloading an enormous update for Fallout the moment I started the computer.

I checked online and found out that there were no updates to Fallout 3 I needed. The most recent update did fix a few bugs, but nothing critical enough that it couldn’t wait until next time I played.

So naturally I right clicked the update in Steam and selected “Pause update”. That didn’t seem to work too well – Steam showed me a permanent “Download stopping…” indicator while in the background it continued to download the update anyhow.

I clicked “Launch Game”. Got a popup saying the game will be ready to play in “approximately 40 minutes”. Apparently Steam didn’t get the message when I paused the update. Okay, so I thought I would be a little more clear. I right clicked the game and selected “Properties” and then turned off automatic updates for the game. That froze the software. I killed it and restarted it. The setting had saved when I checked in properties again but the download continued anyhow.

So in my infinite patience I went into “Offline” mode. Surely it would give up on the idea of downloading updates if it wasn’t even online. I restarted. Tried to launch the game and it told me the game couldn’t be run.

I opened up the Steam folder and deleted a random “AppUpdateStats” file. No dice. Steam still refused to start the game.

At the end of the day all I got to do was to write an angry blog posting instead of getting to play even a minute – the update still isn’t done – because of an update I don’t even want and ultimately because Valve has managed to create the first downloader program in history without a working cancel button.

As a user I have to say it’s enormously frustrating when a computer program does not do what I tell it to. As a software developer I have to say I’m disappointed that a program that could have been such a natural success and fit right into the 21st century is being developed with so little common sense. How hard is it to write a downloader?

Categories: Games Tags: , , , ,