Firefox 3.0 Memory Consumption Greatly Improved

Last time I blogged about Firefox (2.x), I was complaining about how much memory it was sucking up. I have read about how many memory leaks were supposed to have been fixed in Firefox 3 but I had to see it to believe it. So after suffering again from low memory while running VMWare and Firefox (whose memory consumption regurarly climbs to 500MB) at the same time, I decided to upgrade and leave Firefox 2.0 for good. Firefox 3.0beta5 is blazingly fast and I have yet to see it use more than 170MB of memory. Thanks to the all the Firefox developers for finally fixing what was probably the biggest problem with Firefox 2.0.

Update: I also installed it on my Linux machine at home and memory usage and performance with many tabs open is far better than Firefox 2.

Rockstar Energy Drink

I had one of those Rockstar Energy Drinks today. I was in 7-Eleven and none of the usual drinks looked very appealing. I also felt a bit tired and so drinking an "energy drink" seemed like a good idea at the time. A while later I found myself at work getting very little accomplished. I was fidgety, uncomfortable, and overall, in a weird state of mind. For some reason I had no idea it was the energy drink that was the culprit. I had attributed my uncomfortable feeling to my new ergonomic keyboard and a new chair that I was test driving. Later at night I was telling my wife about it and then I remembered the Rockstar energy drink I had before work. I also remembered having a similar day many months ago, a day in which I had consumed a can of Rockstar. Apparently Rockstar contains 160mg of caffeine, twice as much as a Red Bull and more than the average cup of coffee. Since I never drink coffee (I've had one cup in my life) or tea, or consume any significant amount caffeine from any source the 160mg I had today must have felt like even more to my body. Stay away from Rockstar kids, unless you are used to caffeine.


Stupidest Political "Debate" I've Ever Seen

All this time I've been taking the political debates in Canada for granted. No matter how bad they might be, they're actually not half bad compared to the debates in the US. Last night's Obama/Clinton debate on ABC was one of the worst. Crooks and Liars has a great video highlighting some of the worst moments of the debate.


Python Tips

This will be a dumping ground for Python tips that I would like to share with others.

  • Command-line parsing: Use the optparse library (pre-Python 2.7) or the argparse library (Pyton 2.7 and greater). I would stay away from getopt. It's too old and the code requird to use it is unreadable and requires more effort to use.
  • print statments: Don't use them. Use the logging module. Doesn't apply to Python 3.x where you can use the print function and easily replace it later with a call to a logging command. Even in Python 3.x though, I recommend not using print statements but setting up logging early on.
  • Always make your module importable: Enclose all the logic in functions and the main entry point inside a "def main():" function block. Use a block like this at the bottom of your file to call main():
    def main():
    if __name__ == "__main__":

    If your python script is called like this:
    then __name__ will be set to __main__. If you are importing your module, it won't. So if you import your module, no code will be executed, which is usually what you want.

  • Use tools like pylint, pyflakes, and pychecker: These tools are awesome as they will find simple syntax errors and make sure that you are using proper naming conventions, and adding documentation to your code.

Dual Boot Ubuntu and Vista on Dell Inspiron 1720

I just got a new Dell Inspiron 1720. A little background information on why we got this laptop... Previously we had one Desktop computer and a MythTV server/frontend and a TV in a separate room. The TV was a huge CRT TV, but not only that, the TV and couch took up en entire room. We recently got a 24" LCD for the desktop computer and decided that we could use that as our "TV" and computer and get rid of the TV room and use it for something else. We then found ourselves in the situation where one of us wants to watch TV and the other wants to use the computer so we definitely needed another computer. A laptop was the best idea as it allow us to use it as a MythTV frontend and watch TV from bed or any other place in the house. So in summary, we replaced a TV room, massive CRT TV and couch with a 17" widescreen laptop.

Unfortunately, the Dell Inspiron 1720 only comes with Vista. I thought about installing XP, but then I read about how I would have to get SATA drivers and slip stream them into the Windows XP CD and that Dell didn't have XP sound drivers for the 1720. In other words installing XP would be a huge PITA. Since I don't plan on using Windows that much anyways, I figure I can live with Vista. I will tweak it a bit anyways to get rid of its annoyances and I can live with the slightly worse gaming performance (which should improve over the next few years anyways, I suspect).

Here are all the steps I took to get Linux and Vista working on my Dell 1720.

Prepare for Linux:

  • Tell BIOS to boot from CD. Reconfigure BIOS to try booting from CD first so I don't have to remember to hit F12 while booting.
  • Reinstall Vista without Dell crap. I popped the Vista CD in the drive and booted to the CD. I deleted all 4 existing partitions (recovery partition, EISA partition, Windows Vista C: partition, and Dell media direct partition). I don't need the media direct and EISA junk. I then had to add the SATA driver from the Drivers and Utilities CD or else the installation would hang later on. I created one 120 GB partition for Vista.
  • Install Vista drivers. With the freshly installed Vista, all the drivers will be missing, most notably, the NVIDIA video drivers. I downloaded these from the Dell website along with a bunch of other drivers (sound driver required for microphone to work).
  • I downloaded Ubuntu 64-bit Live CD and burned it on another computer.

Installing Ubuntu: After selecting the first boot option from the Live CD it started to boot, but then the screen went completely blank (not just black but completely-turned-off-black. It turns out this is because the splash screen fails. X never did load. I pressed CTRL-ALT-F1 and then pressed Enter and the login prompt appeared (you may just see "running local boot scripts", until you press Enter. This is because the boot sequence steps run in parallel and the login prompt already started above). I then typed "startx" and X/Gnome loaded (I can't remember if it worked right away...I may have fiddled with the "Driver" setting in the "Device" section, by setting it to "nv"). I then installed Ubuntu and told the installer to automatically partition and use up all the remaining free space on the drive. When it came time to reboot, the screen went dead again on shut down and although I waited a long time, the computer never restarted and I had to power it down manually, then power up.

Fixing the "dead screen" on boot up and shutdown/reboot: Open up /boot/grub/menu.lst and remove all occurrences of the word "splash" and "quiet". Getting rid of the splash screen makes bootup a bit more interactive (rather than seeing a blank screen), but more importantly it allows the it to shut down properly.

Wireless/wi-fi: When ordering the laptop from Dell's website I chose the "Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)" which I had heard had better Linux support (without using ndiswrapper), but wireless still did not work out-of-the-box. I changed two things at once, so I am not sure which made it work. The first thing I did was update all packages and brought in upgrades from gutsy-updates and gutsy-proposed repositories (of course you need to plug into a wired network to do that)). I installed and upgraded all linux-restricted-modules* packages. The second thing I did was to copy and paste my WEP key, rather than typing it out by end. Now wireless works great. The Network Manager applet is so easy to use.

Wireless Update: wireless seems to lock up after a while and a process called "ipw3945" uses 100% cpu. Using the laptop as a MythTV frontend requires a stable network connection so the fact that the wireless doesn't work sucks. I've tried using the MythTv Player in Vista and it does the job but it just doesn't compare to MythTV's own frontend. I have heard that the ipw3945 module that comes with Gutsy is basically deprecated and has been replaced with the iwlwifi module from Intel. The easiest way to get it is to use kernel 2.6.24 which comes from with the next release of Ubuntu, Hardy Heron (currently in Beta, to be released in a few weeks).

Sound: Sound didn't work out-of-the-box. I installed the "linux-backports-modules-generic" package from gutsy-backports and now it works. Since Ubuntu's volume control and the button on the laptop case both control the Master volume, I used "alsamixer" to increase the PCM volume to max.

Video: My screen was stuck in 800x600 mode. Running sudo dpkg-reconfigure -phigh xserver-xorg created an xorg.conf file that gave me maximum 1920x1200 resolution. The nvidia driver doesn't work though, it complains that my GeForce 8600M GT is not supported. After updated some kernel packages in previous steps, now when I enable the nvidia driver in the "Restricted Drivers Manager" it works.

DVD: I followed these instructions for DVD playback in Ubuntu.

Hardware Sensors: I ran sensors-detect and no hardware sensors were detected.

That's about it! I'll update this page with any other tips or tricks as I find them.


I Failed My Bank's Security Questions

A couple days ago, my PC Financial debit card stopped working and I was unable to make bill payments online. The error was "Card Use Limited" rather than the "Insufficient Funds" message that I am somewhat familiar with. I called them and apparently there was some "suspicious activity", such as possible card-scanner use at an ATM that I had used, and so they de-activated my account. I called them and answered some minimal security questions which were easy to answer because I was in front of my computer and logged in to my bank's website. I was told to go to a bank ATM within 2 hours and set a new PIN. Evidently I missed the part about going "in 2 hours" and went the next day instead. Oops. I called them back, this time from the ATM, not my office. I couldn't answer any of the questions. It was a bit ridiculous and went something like this:

PC: Sir can you tell me the last 3 digits of an account of a bill that you have set up with PC Financial?
Me: Um, yeah , uh.. XXX.
PC: Thank you. Can you tell me the amount of a recent cheque that had been drawn from your account?
Me: I'm not sure, my wife has written some cheques recently and our account is joint. I have no idea what the amounts are.
PC: Can you guess?
Me: Oh wait, I think she wrote a cheque for around $1000 recently to an interior decorator. Actually she just told me that so maybe it didn't go through yet. Oh wait, actually she might have paid for that in cash, you know, under-the-table.
PC: Can you tell me the amount of a recent deposit into your account, like a paycheque?
Me: I dunno, $1500?
PC: Can you be more specific?
Me: It isn't always the same, I dunno, $1600, $1700?
PC: Can you hold for a minute sir while I get a supervisor?
Me: Sure, whatever
PC Supervisor: Can you tell me the amount of a pre-authorized debit that you have set up with PC Financial?
Me: Um, E*Trade. Oh no wait, that's an automatic bill payment, umm, ING Direct? $1000
PC Supervisor: Can you tell me the amount of a recent transaction with this company?
Me: I dunno, maybe $1000? I change it sometimes. And I usually don't pay attention to it (that's the point, it's an automatic savings program that I don't need to think about).
PC Supervisor: Can you tell me the amount of a recent debit purchase you have made.
Me: No, sorry I haven't been able to use my card for a few days. I eat lunch often and it is usually $5.75 or $6.25
PC Supervisor: I'm sorry some of the answers you are giving just don't match up. There is nothing I can do for you right now.
Me: I would have gotten all of these questions correct if I was just sitting at a computer logged in to my PC Financial account.
PC Supervisor: Sorry sir.

These security questions are pretty dumb when you think about it. They can all be answered correctly just by logging in to my online banking account. Why not ask me something only I would know (or that someone who was just logged into hacked into my account most likely would not know), like my social security number, my driver's license number, my eye colour, whether or not I have a mole on my right temple, etc... a much better system would be if there was a computer system over the phone that asked me a bunch of questions upon account creation. Real personal stuff. You then repeat it into the telephone/mic/whatever and it records it. Later, when the bank needs to verify your identity, you provide the answers and the computer recognizes not only the answers but your voice (or rather it wouldn't recognize the answers if they voice wasn't close). Simple voice recognition stuff. Asking about recent transactions or about what automatic bill payments I have set up is stupid and if you don't receive print statements and have also lost access to your online account for any reason it becomes a pretty difficult question to answer.


The Funniest Spam Ever

I was just going through some messages that were in Thunderbird and moving them over to Gmail using Gmail IMAP. Here is the only spam e-mail I have ever saved:


I'm a time traveler stuck here in 2003. Since nobody here seems to be able to get me what I need (safely here to me), I will have to build a simple time travel circut to get where I need myself. I am going to need an easy to follow picture diagram for a simple time travel circut, which can be built out of (readily available) parts here in 2003. Please email me any schematics you have. I will pay good money for anything you send me I can use. Or if you have the rechargeable AMD dimensional warp generator wrist watch unit available, and are 100% certain you have a (secure) means of delivering it to me please also reply. Send a separate email to me at:

Do not reply back directly to this email as it will only be bounced back to you.

Thank You

mqwzr fg
tjzv ceed


Kayak and weirdness

I just noticed something very strange with Kayak and CheapTickets. I noticed that sometimes when I was doing the same search as I had done a day previously the cost of the fare changed drastically. I figured out that it wasn't just the prices that were changing but the flights were different. This kept happening over and over again. I finally realized last night what was going on. It turns out that I wasn't doing the same search day after day. I was sometimes selecting 1 passenger and sometimes selecting 2. It turns out that this can have drastic effects of the results. For example, I was planning a multi-city trip (city A->city B->city C->city A) and when I select one passenger I am able to find a flight with no stops whatsoever. When I select two passengers that flight disappears and some entirely different flights show up with stops in them. I thought maybe the flights I got using one passenger had only one seat remaining. That's not the case as I proceeded through to the seat selection (even using 2 browser windows, 1 for each passenger) and there are tons of spaces on the flights.

It's really strange, and I'm not sure if the problem is isolated to multi-city flights but I'm going to make sure to try selecting 1 passenger instead of 2 from now on.


Securing ssh

I finally secured my ssh server after I got hacked twice. The first time was because I had a user named vmware with the password "vmware". The second time was because I had a user named test with the password "test". Yeah I know, not smart. Luckily both those users were not in the wheel group so they were fairly isolated. It looks like the just wanted my box to do port scans and cracking of other machines.

Here are a few things to add to your /etc/ssh/sshd_config file to make it more secure (in addition to the standard defaults):

#Change your port to something other than 22 (security by obscurity).
Port 22
#Limit which users can log on
AllowUsers david
#Not sure what this does but it is "turned on for security"
UsePrivilegeSeparation yes
#Enable key authentication
PubkeyAuthentication yes
#Fairly obvious
PermitEmptyPasswords no
#Disable passwords (force key authentication)
PasswordAuthentication no
ChallengeResponseAuthentication no

A couple other things I did was to install libpam_cracklib and set a better password for myself. Secondly I installed denyhosts which dynamically adds bad behaving clients to the /etc/hosts/deny list. Beware that it will add svn-over-ssh clients to this list (because svn often makes multiple ssh logins in succession) so you'll need to add the host that you're using svn from to the /etc/hosts.allow list.


Bye Bye Ogg Vorbis, hello VBR mp3

Part of my music collection is stored as *.mp3 and part of it as *.ogg files (vorbis encoded). We have a portable Samsung YP-T9 which, when we purchased it at Future Shop about 4 months ago was one of the few devices that played ogg files (which is why I bought it). Even then, I had to update the firmware so that it would play oggs, and although it plays ogg files perfectly well, it does not recognize the ogg tags! So all the files get thrown into the "Unknown" artist and "Unknown" track basket. It sucks. I tried all sorts of tricks like embedding id3 tags in the files as well as the ogg tag and renaming the files to mp3s but nothing works. Apparently others have had problems with their ogg tags not being recognized as well. I got really pissed off. Partly at Samsung and partly at myself for encoding these CDs into ogg format in the first place.

What is the advantage of ogg format anyways? Better quality than mp3 for the same file size is how it can be explained most simply. But who gives a damn about filesize these days with 0.5 TB hard drives going for $115. If you want high quality forget disk space and go with Flac or use VBR mp3 or 320kbps CBR mp3. If you're tight on disk space your encoding is going to be lossy no matter what and it will sound like crap. The only reason I can think for using ogg many years ago when I did was that VBR was fairly new at that time and was not fully supported by all players and hard drive space must have been more expensive.

I also just bought a Squeezebox Receiver and Controller and I don't want to discover some flaw in its ogg tag support when I'm hosting a party and trying to play some oggs.

Luckily most of my oggs were ripped off of CDs that I still have in storage. I am in the process or re-ripping those CDs into mp3s. I knew nothing about mp3 conversion before so I did some reading about it. This list of recommended LAME settings was the most helpful in addition to the lame man page. I eventually decided upon the following:

lame --preset fast standard *.wav *.mp3

A couple notes, the "fast" option adds the --vbr-new setting, the "standard" option is equivalent to "-V 2" and the -h option is not necessary with VBR. This gives a target bitrate of 190 kbps which is good enough for me. I did think about using flac but I don't care that much about audio quality, and I would rather not to have to upgrade my hard drive in order to be able to use flac for everything.

For some CDs that I really care about, such as Pink Floyd, I rip it using

lame --preset fast extreme *.wav *.mp3

which gives an average bitrate of around 245 kbps.


Just Pre-Ordered a Squeezebox Duet

My wife and I just pre-ordered a Squeezebox duet today that should be arriving here at the end of February. It's a device that will allow us to access the mp3/ogg library on our PC from another room in the house (without requiring a laptop). Before the introduction of the display-less Squeezebox Receiver and Squeezebox Controller, the only choice was the Squeebox unit, which comes with a simple remote. I don't have much use for a display like that on the original Squeezebox. For me it is much more useful to have one nice remote with a display and multiple display-less receiver units.

The Squeezebox line is similar to Sonos' devices, and they are now in direct competition with the introduction of the Squeezebox controller. The only problem with Sonos is that it is so god damn expensive, not to mention that their devices are much bigger. Sure it is more powerful, allowing you to connect to up to 16 devices with Samba shares or Windows shares on them and one of their devices has an amplifier whereas all the Squeezebox devices require a separate amplifier or powered speakers. Fortunately we don't have any good speakers of our own already so we'll just buy a few nice Bose powered speakers. Then maybe buy a couple more along with another Squeezebox Receiver and expand our network.

Squeezebox has the advantage that it's SlimServer software is open source so it is constantly being updated and improved and it is written in Perl so it is totally cross platform. It's unfortunate that it is written in Perl actually, but I guess they could have chosen an even worse language.

Avoid UPS Like the Plague

I found out the hard way why UPS sucks (as least for shipping from the US to Canada). I bought an audio cable online and here is the breakdown:

  • Subtotal: $29.95
  • Shipping: $10.74
  • Tax: $0.00
  • Total: $40.69

Now here is where is gets ugly. After 8 working days the package finally arrives. Of course, they try to deliver it in the middle of the day when most of the world (including myself) is at work. So I got a sticker on my door today that says I owe $22.01 in Brokerage C.O.D. charges . WTF? $22.01, that's 73% of the original price of the cable and 54% of the total cost of the cable including the $10.74 I already paid to UPS in shipping costs.

These are most likely UPS's "Entry Preparation Charges" and apparently I must have fallen into the $40.01 - $100 range, hence the $19.45 charge plus taxes and whatever else that might have made it come to $22.01. My best guess is that the $2.45 difference is the actual duty itself, charged by the Canadian government. The $19.45, goes straight to UPS.

Apparently I'm not alone. A quick Google search turned up many stories of similar experiences with UPS:

Why was I the last to find out about this?

It looks like USPS is the way to go. I plan to have the package returned to sender, which is fairly easy to do as C.O.D. shipments are automatically returned to sender the same day the final delivery attempt is made (according to the yellow slip). I have already warned the sender and told them to re-ship with USPS. I am guessing that USPS shipping + customs (I have read it is $5 max) will be less than $22.01 so although I have wasted $10.74 in shipping it via UPS at least I didn't give them any more of my money.

Apparently You CAN challenge the brokerage fee! Pay customs yourself! and this person did it at Vancouver's UPS facility, which is where I would be going. I would try it if I had a car and a few hours of spare time... The CBC also ran a story about how to avoid paying the brokerage fee.

There is a also a pending class-action lawsuit against UPS:

The lawsuit claims that on the purchase of goods from the US, UPS fails to obtain consumers’ consent to act as customs broker; or to disclose the existence or amount of the brokerage fee which they charge; or to provide consumers with the opportunity to arrange for customs clearance by themselves. It also claims that the amount of the brokerage fee charged is grossly excessive.


Spam Finally Gone Thanks to Captchas

Looks like I have finally banished spam from this site forever thanks to the Drupal CAPTCHA module. Apparently this captcha is not readable by software yet, or maybe no one has tried. There are so many sites out there without any captcha or spam filters that the spammers probably don't even need to resort to captcha-deciphering. I almost don't even need the Akismet module anymore.


Make Outlook Behave Like GMail

There are a couple sources of information out there on how to do this:

  • describes how to "Make Outlook Work Like GMail" however it does not explain how to get sent messages to go into the inbox and not be marked as read (this is explained in the comments, however)
  • explains how to "Sort your mail in Outlook" which makes it look a bit more like GMail except he sorts by date rather than by Conversation Index (which is better).

Here's how to do it all (at least for Outlook 2003), all documented for you here in one place:

The first thing you need to do is make messages you send get put in the Inbox. An additional thing you need to do is make them get marked as read (otherwise you'll always have tons of un-read messages from yourself in your inbox).[img_assist|nid=277|title=Outlook Gmail Rules and Filters|desc=This is what my "Rules and Alerts" look after after adding a "CC send messages to inbox" rule and a "Mark messages from self as read" rule.|link=none|align=center|width=435|height=335]

The next thing you need to do is make your e-mails show up in something that somewhat resembles GMails conversations. I set "Group By..." to "Conversation (ascending) and "Sort..." to Conversation (index).[img_assist|nid=278|title=Outlook Gmail Customized View Options|desc=This is what my customized view options look like after grouping by conversation and sorting by conversation index.|link=none|align=center|width=477|height=326]

Now your inbox should look a lot nicer now and finally, click on the column "Newest on top" to have them sorted by date properly and your Inbox should look as shown in the image.[img_assist|nid=279|title=Outlook Gmail Final Result|desc=This is what my inbox looks like|link=none|align=center|width=496|height=599]


Subscribe to David Grant RSS