Letters to avoid in creating passwords for non-english keyboard layouts

I had an interesting issue arise where I sent a computer to a customer located in Germany. I had created a password for them, but they had problems logging in with it. It turns out that the password I had created contained the letters Z and Y. These two keys are swapped on German keyboards so when they plugged in their own German keyboard they ended up entering the wrong password as the computer was still set to the English keyboard layout.

I have looked into the most common keyboard layouts used in Europe (QWERTY, QWERTZ & AZERTY) and you can avoid key swapping problems like mine if you avoid using the letters Z, Y, A, Q, M & L in any password or user name.

Update. Here is a simple one liner to generate a random alpha numerical password of 8 characters that avoids these letters. You can of course change the password length by changing the -c switch on the head call. This should work on any *nix based system (including MacOS X) that has openssl installed. One warning is the password will visible at generation time to other local users on shared systems if the other users are watching for process list changes. This doesn’t matter to me too much as I generate the passwords on my Mac laptop, but it is something to keep in mind if you are on an shared system.

 openssl rand -base64 25 | tr -dc 'BCDEFGHIJKNOPRSTUVWXbcdefghijknoprstuvwx0123456789' | head -c8; echo ""

Solved: Problem with Skype number always engaged (busy)

I decided to get a skype number as a replacement for my landline number. I found that no matter what skype setting I used on my mac laptop the phone number was always engaged (busy). It turns out that the problem is due to the fact that I also had skype installed on my windows box. It seems that if you are logged in on two different machines skype will always take the settings from windows over osx. Any changes you make on the osx side are overridden by whatever settings you have on the windows box. As soon as I changed the settings on the windows box everything started working.

Now all I need to do is figure out how to get the 2 hours of my life back that I wasted on working this out :)

New iPad

On a bit of a impulse I decided to try my luck getting a new iPad at BigW on Friday morning (I was driving past around the time they open). While there were quite a few apple desperadoes ahead of me in the queue (I was last in line), I thought it might be worth the wait. Luckily they still had the model I wanted (32G wifi black) by the time they got down to me so I bought it.

I didn’t get much chance to play with it yesterday (work), but I have had a bit of a chance today. I already have the version 1 iPad. I can say the only important difference between the two is the screen. While this might not seem that important the new screen is immaculate – so much that it makes the old iPad seem like something out of the 80s. I can’t stress enough how much better the new screen is than the old. If like me you use your iPad mostly to read then the new iPad is not just an incremental upgrade, it is revolutionary. It is a shame that Steve didn’t live to see it released as I am sure this is what he always had in mind what the iPad should be – maybe Apple’s stock will reach $700 yet.

Installing Windows 7 on Mac Mini without a MacOS X Lion Partition

The Apple Mac Mini make a rather nice silent and quite powerful Windows box (there just isn’t any other hardware out there as good). The first problem is if you install Windows 7 you have to keep a Mac OS partition if you use BootCamp which is a waste of drive space. The second problem is the new mac minis don’t have a DVD drive anymore so it is not possible to install from a Window 7 DVD. The final problem is you need all the drivers that Apple supplies, so even if you manage to install from an image it would not work.

It occurred to me that it might not be necessary to keep the MAC OS X partition if I installed from the BootCamp created USB installer. This would allow me to remove the Mac OS X partition in the Windows install process. I gave it a go and it worked. The basic procedure is as follows:

  1. Boot into Mac OS X Lion and use BootCamp to create the USB installer with the Apple drivers. You will need a Windows 7 .iso image and a USB drive. I am not sure of the capacity you need for the drive, but the drive I used was 16 GB. Make sure you don’t have anything you want on the USB drive as it will be deleted in the process of creating the installer.
  2. Restart the Mac Mini holding down the option key and select to boot from USB drive.
  3. Windows 7 should start up and take you through the installation process. Select Custom Installation and when it shows the hard drive delete all the Mac partitions and create a new partition for Windows. Continue with the installation as per normal.
  4. Once you are in Windows 7 go to the USB drive and install the Apple drivers.
  5. Now you have the drivers installed you can download and install all the Windows updates – so much fun :)

Installing CentOS 5.5 on a Intel Mac Mini

If you want to install centos 5.5 on an intel mac mini it is pretty easy. My guess is the same process applied to other Apple computers, but I have not tried it on anything other than a mac mini. The mac mini is a really nice little server that takes up no space and is totally silent – much better to live with than the dual xeon space heater I had to move out of my office.

  1. Boot off the Mac OS X Install DVD or from an external drive (I have a firewire drive with Mac OS X installed on it so this it is what I did). Go to the  Utilities folder in Applications and launch Disk Utility if booting off an external drive, or if booting off the Install DVD select  Disk Utility from the Utilities menu.
  2. Click on the disk you want to install CentOS on to, then select Partition tab, then select 1 partitions and choose MS-DOS (FAT) as the format. Then click options and select Master Boot Record. Then click on Apply when you are done. Don’t click outside of this tab before pressing Apply or you will lose the MBR setting.
  3. Once the partitioning is complete insert the first CentOS CD and reboot the mac mini.
  4. Go through the standard centos install as per normal.

On tip to watch for if you are behind a proxy like me is to not select to install the CentOS extras packages. What happens if you do is you get hung at this point of the install and will have to start over again from scratch. You can always install the extras latter by modifying the yum.conf file in /etc.

Installing Splint on Mac OSX

Splint is a really useful utility to check your source code, but it doesn’t seem to be installed by default on MacOS X. It is not too difficult to download the source and install except for the minor issue that it doesn’t build. The good news is it doesn’t take much to fix the build problem. Here are the instructions.

  1. Download the source from http://www.splint.org/downloads/splint-3.1.2.src.tgz
  2. Open the .tgz file by double clicking.
  3. Open a terminal window and cd to the splint-3.1.2 folder
  4. Configure by using sudo ./configure and enter your password
  5. Open the osd.c file using nano src/osd.c
  6. Scroll down to around line 500 and change the line __pid_t pid = getpid (); to pid_t pid = getpid (); then save the file (control-x).
  7. Type sudo make install to install splint

You should now be able to use splint (eg splint foo.c) and have a look at how many little issues are in your code :) It will fail a few of the tests, but it appears to still work.

Edit Sept 2017. This is a pretty old post. My advice is use brew to install splint.

Removing large numbers of duplicate emails from Mac OSX Mail

I was faced with the problem of having duplicate emails in some of my very large folders in Mail (some of my mail boxes have over 80,000 messages). There are applescripts for finding and removing duplicate messages, but they are very slow (~100 messages a minute) and so are not really viable on very large mail boxes – at this rate it would take more than 5 days to process one of my large email folders.

One simple solution is to archive the mailbox and then use formail to strip out the duplicate messages, then importing the cleaned mbox back into Mail. This approach retains all the meta information like flags and attachments and is actually quite fast. The basic procedure is:

1. Rebuild the mail box. This is probably a good idea anyway.
2. Archive the mail box. This will save a copy of your mailbox in standard mbox format which then formail can process.
3. Open a terminal window and cd to the folder containing the new mbox archive.
4 . Run the following formail command. This will create a copy of the mbox (mbox_new) with the duplicate messages removed. This will take around 5 minutes to process 80,000 messages.
formail -D 100000000 idcache < mbox -s > mbox_new
5. Open Mail and Import Mailboxes. Select the mbox_new mbox. Once it finishes importing you will now have a new folder under Import with all the non-duplicate messages. It is a good idea to rebuild the folder before moving it back to where you want.
6. Delete the archive.

This approach is much,much faster and has the advantage of working on a copy of your email data so if anything goes wrong you won’t mess up your current mailboxes.

Mac OS X compatible external web camera

I use my macbook with an Apple 23 inch monitor at work and so I can’t use the inbuilt iSight camera. Since Apple stopped selling the external iSight camera there is not much choice for Apple compatible web cams since most of the web cameras on the market don’t come with Mac OS X drivers.

One surprisingly option is the xbox360 web cam. This external usb camera works without any drivers and just plugs straight in and works. I managed to pick up a brand new one on eBay for A$35. The quality is pretty good and it sits without any problems on top of my monitor. Nice work microsoft.

Apple Bootcamp 2.1 and Windows XP SP3

There is a problem with Bootcamp 2.1 in that you can’t install the Apple drivers under Windows XP SP3. I recently bought a new MacBook Pro and installed Windows XP SP3 from an image and then tried to update the XP hardware drivers using bootcamp 2.1. This didn’t work an instead gave a nice cryptic error 2762. It seems it is not possible to install the drivers manually either as windows can’t install the drivers for the wireless network, iSight camera, and trackpad.

The solution is to install XP from a SP2 image (luckily I had kept one), then install the drivers, and then upgrade to SP3. I hope this saves someone a bit of time.

Update. This has apparently been fixed in snow leopard. I guess another reason to update.