Hello OpenGL World in Ocaml

I swear, if I read one more programming tutorial that starts with a recursive factorial function instead of a simple “Hello world” I’ll pray for perpetual nigerian spam on their inboxes. So, I was delighted to try out some Ocaml stuff today that didn’t involve factorials. Continue reading

What’s your history|awk…

Via Bill de hÓra. Run this from the command line:

history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s ",a[i],i}}'|sort -rn|head

I get:

108 ls
78 cd
53 sudo
29 python
13 cap
9 django-admin.py
9 ruby
8 vim
6 easy_install
3 bzr
1 ex
1 python2.5
1 ln
1 mksir
1 cat
1 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

In short:

  • I have trouble with my default python installation.
  • I am trying Django for small project.
  • I was hit by the Leopard keyboard repeat freeze bug.
  • I am poor at spelling simple commands.

Prism – web apps as desktop apps

When people started making applications available in the browser a number of interaction challenges appeared. How do you launch a web app compared to a desktop app? How do you prevent people from navigating away from your app? The Mozilla people have been hard t work with Prism – basically a customized version of Firefox, which lets you create desktop apps pre-configured to load a certain URL at startup. The desktop app is launched like any other application. Pretty sweet as the user experience becomes more consistent. You can also customize the application icon and other parameters. Continue reading

Keeping software up-to-date in OS X

I often install apps to try if they work the way I like. Some stay, some I delete almost immediately. Some of them have built in functionality that alerts you when there is an update available. I find that very annoying. If you have many apps these little reminders tend to pop up all the time.

So, I was looking for something to keep tiny apps up to date and found AppFresh. AppFresh will scan your programs folder when you want it to and alert you of any updates it can find. Downloading and installation is automated for most apps as well.

It will also tell you when you lasted used an application – nice if you want to clean you programs folder from unneccessary apps.

You can download AppFresh here.

Fixing OS X Leopard menu bar transparency

Leopard transparency fixUpdate: As many readers now noticed, as of 10.5.2 there is now a preferences setting for the menubar transparency.

For some reason Apple decided to make the menu bar in Leopard transparent. With my background image this means that the menu bar will be in a shade of blue. It doesn’t look good and makes my computing environment less comfortable (I’m picky, I know…).

Someone created a software hack to remove the transparency. There is also a system setting (thank you Johan) to trick the window manager into thinking it is in older hardware. I am not sure of the side effects so I’m not that keen on installing that. Here is the pragmatic fix: take your background image and paint a white stripe, 21 pixels high, at the top. Problem solved. My menu bar is now easy to read with black text on white background (see picture above).

Before painting the white stripe you may have to resize the picture to the exact size of your desktop, otherwise the OS will resize it and it won’t fit the size of the menu bar.

Leopard black menuUpdate: As Peter points out in the comments below, if you use black instead of white the menu will look similar to the default ash grey style of other Leopard apps.

Installing an e-ID in 47 Simple Steps (Not Counting the Eternal Loop)

(Please note that this post is from 2007 and things have become much better).

When you are on parental leave you have to register which days you are away fro work with the Swedish Social Insurance Agency. To access the online services of an agency you have to have an electronic ID. In Sweden this is a locally installed certificate issued by your bank or large telecom provider.

In my case my identity is checked by my bank and then I am forwarded to Telia, which handles the process of generating the ceritificate and installing the appropriate software on my computer. What could have been a simple well guided procedure is instead an exercise in ambiguity and a complete lack of usability:

  • The process involves 47 (!) steps,
  • an eternal loop (yes, really),
  • require you to install a new browser,
  • configuring the same browser to run in Rosetta mode and
  • a revoked server certificate (for the server that generates my certificate!).

I seriously doubt that non-programmers manage to install and use one of these certificates. Let’s go through the steps required to install an electronic ID in Sweden:

  1. We start at the the Social Insurance Agency and choose the login link.
  2. To login you need an electronic ID. Fair enough. I am redirected to the electronic ID information page.
  3. The electronic ID info page tells me to get an ID through my bank.
  4. I visit my bank and login.
  5. My bank seems to have done their homework. It is easy to find the e-ID link.
  6. To prove my identity I use the device provded by the bank.
  7. After proving my identity my bank informs me that they will redirect me to Telia, the once-was state-run monopoly telco.
  8. Telia greets me with a wizard-like interface that looks like a standard Windows 98 dialog window. It is, however, a regular HTML page that someone forgot to test in Safari.
  9. Clicking the “Next” button displays a text informing me that I have the wrong web browser. This service only works with Firefox. Okidokee.
  10. I visit the Mozilla website and download Firefox for my platform.
  11. We start again by visiting the bank with Firefox this time.
  12. History repeats itself.
  13. I once again prove my identity to the bank and…
  14. …get forwarded to Telia.
  15. The welcome page looks familiar. However, someone forgot to test this in Firefox. The text is now in Times Roman and barely readable.
  16. Telia asks me to accept their tems and conditions. Ok.
  17. I am now informed that I am using an Intel Mac. For my e-ID to work I have to “activate Rosetta”. A step by step instruction tells me to set Firefox to run in Rosetta mode and then restart Firefox. Am I supposed to do this now? The instructions continue and tell me that “software for Linux has to be installed manually”. And then there is a “Next” button. Thank you for narrowing ot down to three choices in this step. I decide to go with the first instruction.
  18. I set Firefox to run in Rosetta mode.
  19. And then I restart Firefox as per the instructions.
  20. Firefox is restarted (rather sluggish due to running it in Rosetta mode) and page is displayed. The page says that an “unexpected error has occurred. Try again in 10 minutes”. I wait 10 minutes and reload the page, same result. No further instructions. Maybe I have to start the proccess again?
  21. So, I go back to the bank for the third time.
  22. I prove my identity o them again and get redirected to telia again.
  23. Hello! You look familiar.
  24. I accept the terms and conditions again and click the “Next” button.
  25. A new page appears and a warning message from Firefox asking me if I want to install a security module named Net ID. The text in the wizard talks about downloading stuff for Linux to my desktop. Do I have to do both? I accept the Net ID install question even if “libiidp11.dylib” sounds scary.
  26. After clicking OK Firefox displays an alert informing me that a “new security module has been installed”. I click OK. There is still a text that tells me to download something to my desktop and run it there. Should I, or was it just installed for me? I decide to skip that and click the “Next” button instead.
  27. Ok, now I have to choose a password for my e-ID. Looks like everything was alright in the previous step then. I enter a password and click the “Next” button.
  28. A progress bar appears. My e-ID is being created it seems. When the progressbar completes I click the “Next” button.
  29. A message appears saying that my ID and the required software was successfully installed. Sounds nice. It also tells me that since I am using Firefox I have to restart the browser. There is also a button which says “Complete process”. Should I restart the browser now or click the button? I choose to click the “Complete process” button.
  30. The layout tells me that this isn’t part of the previous wizard. The text starts with an introduction to what e-IDs are and then goes on to tell me that I have to “upgrade” my e-ID. There is also a button that says “upgrade”. I click the “upgrade” button.
  31. Bang! Firefox displays a certificate warning. Has the site been hijacked? Hard to say. What are the odds that a certificate issuer is using untrusted certificates on their own site? Low I guess. I decide to go with Firefox’ recommendation and trust the site for this session.
  32. I am back in the fake Windows dialog interface again. This time it says that it will guide me through an “upgrade” of my e-ID and software. Sounds ok. I click the “Next” button.
  33. The next dialog looks familiar. The text tells me to download software to my desktop for installation if I am using Linux but the Firefox confirmation dialog asks if it is OK to install a security module. Must be the software upgrade so I click OK even if “libiidp11.dylib” sounds scary.
  34. Firefox displays an alert: “the security module already exists”. Does this mean the upgrade wasn’t needed? What do I have to do? I click OK and then I click the “Next” button.
  35.  Getting tired of describing each step…
  36. Win!

Automated iPhoto backups to Amazon S3

The combination of parental leave, a Sony A100 10 Mpix camera and the 80 Gb HD of my Mac mini server has resulted in a lot of zeroes and ones needing a place to live. I have realized that a lof of valuable photos are only stored on the HD. Should it fail the family will be really disappointed. Hence, the need for a backup solution.

I was planning to get a small RAID solution for the home network, but they are fairly expensive, need electricity and space. So, I had a look at the Amazon Simple Storage Service (S3). If you haven’t heard of S3 before:

Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites.

I was expecting S3 to be fairly expensive with the redundancy and all, but it turns out that it is cheap. Really cheap. To calculate what it would cost me to backup my iPhoto library I threw together an iPhoto backup to S3 calculator.

Turns out that starting with 2000 photos at around 2 megs each, adding 100 photos each month willcost me $10/year. Hard to beat if you are trying to build your own RAID solution.

Backup software

Here is the setup I use. I tried some of the S3 client libraries available, but the only one that was persistent enough to do the initial 2000 file sync was jets3t. It is a java library that comes with some easy to use command line synchronization scripts. After setting up jets3t with your S3 API key, all you do is tell the synchronize script to check your iPhoto folder.

Currently, I run it as a scheduled job once a month, but depending on your photography habits you may want to trigger it differently. It works like a charm and last month’s bill from Amazon was $1.23.

Try the calculator and see what your cost would be.