David Grant's blog

He-Man Sings

I saw this "He-Man sings 'what's going on'" video when it first came out and recently discovered it again. I was a huge He-Man fan when I was a kid. I enjoyed seeing my old friends Man-At-Arms and Skeletor. The over-dubbing and editing is masterfully done. Love the IM chatting between He-Man and Man-At-Arms and Skeletor's entrance.

If you get really nostalgic you might enjoy watching the intro:

I can't believe I actually watched that show.

Tags: 

Top 10 Reasons to Choose Linux over Vista

Some people have asked me if they should upgrade to Vista. I usually suggest that they instead switch operating systems completely. Especially if they are the types that use their computer for web browsing and email. Here are ten reasons why I think all Windows users should at least think about Linux this time instead of Vista.

  • Digital Rights Management - Why cripple your computer and yourself with DRM when you can just use Linux?
  • Security - No more worms, viruses (look at this very short list of Linux viruses), virus scanners, spyware, pestware.
  • Beryl - Totally kick-ass effects and Mac OS X expose-like feature. Compared to Microsoft's Aero product, it is a lot better and is getting better all the time.
  • Ubuntu - I would be reluctant to recommend Linux to the general public if it were not for Ubuntu. It has truly made the "Linux Desktop" a reality.
  • Google - Google has given us the best mail application, a decent word processor and spreadsheet application, a feed reader, a Calendar, and so much more, all over the web so not only are these applications not tied to any particular computer, they also don't tie you to any particular OS. (Also, Google ported Picasa, the best photo management software to Linux recently).
  • Firefox - How could one use all those applications from Google and others if it were not for Firefox, the cross-platform IE-killer?
  • OpenOffice - For all your old Microsoft Office documents and new documents, this does the job. No need to be tied to Windows and Microsoft Office anymore.
  • Software choice - Tons more applications. Linux has a huge variety of choice when it comes to applications. There is even choice when it comes to your desktop environment (KDE, Gnome, etc...).
  • Cost - Linux is free, Windows is expensive. As hardware prices have come down (while the price of Windows hasn't), this expense is becoming a larger percentage cost.
  • Linux (no matter what flavour you get) is updated multiple times per year with the latest and greatest. With distributions like Ubuntu these updates can be installed seamlessly, never needing a clean install again. Don't settle for crap from Microsoft, a company that took 5.5 years to deliver a marginally better OS than the last one.

Ok, clearly 10 isn't enough, here are some more...

  • Software Installation - With Linux with the press of a button you can install a program and all its dependencies. Not only that but smart package managers like apt-get can remove dependencies that are no longer required by any other program.
  • Stability - There is no such thing as the blue screen of death in Linux. Actually the blue screen is now a rare occurrence in XP but I saw it happen twice on two different machines in the past month, so it is definitely still there. Linux users are known to brag about their computer's "uptime" -- the amount of time their computer has been turned on since the last reboot. Linux lock-ups or crashes can occur but it is generally agreed that these are far less likely to occur than with Windows.
  • Minimal Hardware Requirements - You can run Linux on almost anything. I run it on a 500MHz laptop with 256MB RAM just fine. I just chose a lighter desktop manager. If you are running Windows XP right now, your computer will only get slower with Vista. Switching to Linux might allow you to keep the hardware you have now for another few years comfortably.

(Update 2007/02/23) Wow, my first time on digg. A lot of the comments on digg were pretty negative but at least 88 people dugg it (actual number was higher since surely some people buried it). The audience was not really techies but more people like my grandma, parents, sister people who would actually learn something from the article and can mostly understand the gist of it. So I don't really care if some geeks are pulling their hair out. Someone even insulted my website, another took a jab at my credibility because I blogged about the new Canada Food Guide. Another had some comments about my resume which is at least 4 or 5 years out of date. Anyways, this says way more about the digg readership or at least a vocal minority of it. It was fun to get on digg though in a significant way.

Tags: 

New Canada Food Guide

The Canadian Government just released a new Canada Food Guide a while ago. It made me realize I don't eat nearly enough fruits and vegetables. Although I have been eating a lot more of them since New Year's (you know because of resolutions). We might start doing one of those vegetable delivery services like spud.ca. Maybe if it comes to the door every week I'll be forced to eat it. On the weekend I had a cupcake and tried to argue that it counted as one grain product. Some people didn't agree with me, as if the sugar somehow cancelled out the grain product. Sorry it doesn't work that way. There is flour in a cupcake so it counts.

Tags: 

D-Wave Systems Slashdotted and on Digg Twice in One Day

Huge buzz on the web today about D-Wave:

Here's my original post about our upcoming demo.

Best Astronut Headlines

According to Google News there are 3,226 stories on the astronaut who went psycho and drove 900 miles in a diaper to mace co-worker. Along with crazy stories come some funny headlines. Here are some of the best (or worst):

  • "Astro-nut's fixation out of this world"
  • "From high-flying career to 'astro-nut'"
  • "Lust in space: Shuttle astronaut held over attempt to murder love rival"
  • "Moonstruck astronaut’s mission improbable to murder her rival"
  • "Lust in space"
  • "Strobel: What makes an astronaut a stalking, vengeful space cadet?"
  • "'Robochick' aimed to kill rival in love triangle, police say"
  • "Astronut girl wore a nappy"
  • "Astronaut's wild arrest orbits around Alaskan"
  • "Houston, we seem to have a problem"
  • "Fallen Astronaut Returns To Texas"
  • "With Discipline Honed by Training, Police Say, Astronaut Set Out to Kill"
  • "Space community shocked by love-struck astronaut"
  • "When the 'right stuff' goes wrong for an astronaut"
  • "Arrest mars stellar career of US astronaut"
  • "Astronaut's descent casts doubt on NASA screening"
  • "Shocking descent for a woman of high achievement"
  • "Astronaut's Life Took Swift Nosedive"
  • "When love goes wrong -- a bizarre mission"
Tags: 

Awesome Talk by Adrian Holovaty at Vancouver Python User Group

Adrian Holovaty gave a talk to the Vancouver Python User's Group tonight. Really nice, funny presentation. His plane was late so while we waited for him we watched his talk at Snakes and Rubies. He showed us some of the new features coming in Django. The neatest thing for me was this new thing he's been working on called "databrowse". It's really awesome. Also the forms stuff is a lot nicer now in the newforms library. Someone asked about migration with Django and how to modify the schema once your app is up and running. It was neat to watch him add a column to his database and watch how he did it. It's unbelievable how many apps this guy has written and with Django it is so fast. Some of the stuff he has been doing for the Washington Post is pretty cool.

Tags: 

Why Gentoo is Still Better than Ubuntu

So I am on a Kubuntu edgy laptop at work and I am trying to get WPA wireless networking working before the upcoming demo that we are putting on. Since I have no idea what kind of networking is set up at both demo locations I am making sure all options work. WPA is the last one to take care of.

I finally found a front-end for wpa_supplicant that actually works. It's called kwlan and it is currently at version 0.5.8. Ubuntu edgy only has version 0.4.7. I really want 0.5.8 because 0.4.7 has some glaring bugs. Feisty actually has 0.5.8. There is no way I am upgrading this entire box to feisty. Because of ubuntu's binary nature, in order to get kwlan-0.5.8 installed I might actually have to bump a lot of packages to feisty just to get it working. Even if I just want kwlan-0.5.8, how to I get it? I'll have to add some sources to /etc/apt/sources.list and possibly jump through a few more hoops to be able to install one package from feisty without apt-get upgrade wanting to upgrade everything to feisty. If kwlan-0.5.8 wasn't available in feisty, my only option would be to make my own deb package. Good luck with that (I maintained a debian package once, called camserv a long time go. Way harder than ebuilds.)

In gentoo it is as simple as coping the ebuild to my /usr/local/portage folder, renaming it to kwlan-0.5.8.ebuild, creating the digest and then emerging the 0.5.8 version. Assuming the upstream developer did not make massive changes to the build process, simply renaming the ebuild name from kwlan-0.4.7.ebuild to kwlan-0.5.8.ebuild should work. Like a lot of things, it's a hell of a lot easier in Gentoo.

Sure that's just one reason why Gentoo is better than Ubuntu. There are many others. Just look at Ubuntu Guide. A whole friggin' guide to install a lot of things that can be easily installed in Gentoo (mplayer, acrobat, java, flash, etc...). Not to mention that eix rocks compared to anything apt has, and paludis is awesome. Every time I think Ubuntu is better than gentoo, I end up taking that back soon after.

Firefox/Opera Shootout

I've been getting really pissed off lately at how much memory Firefox is using up. I decided to give Opera a try. I opened up the exact same tabs in Opera (about 10 of them) and I got about the same memory consumption. I disabled all the Firefox extensions except for the del.icio.us one (because last time I disabled it and re-enabled it, it totally screwed up the bookmarks menu, and I had to create a new profile from scratch to get it back to normal).

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 9152 david     15   0  214m 105m  19m S  1.7 10.4   0:24.86 opera
 9057 david     15   0  211m 100m  24m R  3.7  9.9   0:32.72 firefox-bin

This is a big improvement for Firefox by the way, after disabling the extensions. One of the extensions much be leaking memory big time because the memory usage usually climbs to 250MB. Looks like I will have to go and buy some more RAM. I only have 1 Gig right now. with tw 512MB modules. Looks like there is a third slot. Maybe a new 1G module then.

Adrian Holovaty Talk and Django Jam in Vancouver

This Sunday, the Vancouver/Zope User's Group (maybe the Zope part should be removed? sorry guys) is having a "Django Jam", a hands-on session where you can see how to create some simple applications or perhaps here some people talk about things they have developed in Django. Unfortunately the two applications I am working on are immature right now and I don't have a laptop, but I'll be there checking out what other people have done.

Tuesday is even more exciting as Adrian Holovaty, the lead Django developer/founder is going to give a talk to the Python User's group while he is in town for another conference. If you are interested in web frameworks (especially simple ones done in a cool language) come and check it out.

Vancouver DjangoJam.

Full invite text follows:

Django is the Python-based web framework used at companies like
Google, the Washington Post and St. Joseph Media (publishers of
Canadian Life magazine).

"Vandjangojam" is a great opportunity to learn Django or learn more
about it. In addition to a quick introduction to Django, the jam will
feature a Q&A; session with the lead programmer of it.

----

Introduction to The Django Web Framework : Sunday, February 4, 2007, 1-4

We'll discuss the basics of creating applications in Django, walking
through some simple applications hands-on.

Location: Most likely Sophos Vancouver or Uniserve. RSVP to
paul@prescod.net if you intend to come and we will inform you of the
location when it is confirmed.

-----

Adrian Holovaty: The Django Web Framework: Tuesday, February 6, 2007, 7-9

Adrian will offer some thoughts about its unique features and answer
questions from the audience.

Adrian Holovaty is the lead developer of the Django Web Framework.
Adrian and his peers invented Django while working at World Online, a
highly-renowned news Web operation in Lawrence, Kansas. His team's
pioneering work on interactive journalism won numerous awards and was
described in The New York Times, NPR and IT Conversations. Currently,
Adrian is editor of editorial innovations at Washingtonpost.Newsweek
Interactive (washingtonpost.com). His job involves coming up with
ideas for site improvements and special projects, and implementing
them.

My New 320G Hard Drives using RAID and LVM

I just bought two new 320G hard drives last weekend and they are finally up and running with my same old Gentoo Linux OS. I wanted to put them in a RAID1 configuration and this was my first experience with software RAID.

The first time I did it I just made took one third of the new drive (about 120G) and made it a RAID1, then copied the old hard drive over. I purposefully chose not to use LVM because I have used it before and although it is extremely handy I have always been worried about the difficulty of recovering data from a bricked drive when the data is scattered all about. After copying data over to this one big partition I realized that it wasn't so easy to resize a RAID. I also read about how bad it was to have everything all on one partition (/home, /, /var, etc...). So I did a complete 180 and decided to use LVM.

Here is my partition layout:

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1         1       13      104422   fd  Linux raid autodetect (/boot, in /dev/md1)
/dev/sda2        14      622     4891792+  fd  Linux raid autodetect (empty, for Xen later, in /dev/md2)
/dev/sda3       623      866     1959930   fd  Linux raid autodetect (/, in /dev/md3)
/dev/sda4       867    38913   305612527+   5  Extended
/dev/sda5       867     5730    39070079+  fd  Linux raid autodetect (for LVM, in /dev/md5)
/dev/sda6      5731    10594    39070079+  fd  Linux raid autodetect (for LVM, in /dev/md6)
/dev/sda7     10595    15458    39070079+  fd  Linux raid autodetect (for LVM, in /dev/md7)
/dev/sda8     15459    20322    39070079+  fd  Linux raid autodetect (for LVM, in /dev/md8)
...
lots of free space
...
/dev/sda9     38670    38913     51657007   82 Linux swap / Solaris (in /dev/md9)

/dev/sdb looks exactly the same of course, which you can do very easily with:

sfdisk -d /dev/sda | sfdisk /dev/sdb

Basically /dev/sda5 onward are all 40G physical partitions. I'll RAID1 them with the corresponding partitions on /dev/sdb. I have also RAID'ed the /boot partition and the root partition, and the sdb2/sda3 partitions for future use. So far, I have 7 raids:

-(~:$)-> cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid6] [raid5] [raid4]
md8 : active raid1 sdb8[1] sda8[0]
      39069952 blocks [2/2] [UU]

md7 : active raid1 sdb7[1] sda7[0]
      39069952 blocks [2/2] [UU]

md1 : active raid1 sdb1[1] sda1[0]
      104320 blocks [2/2] [UU]

md2 : active raid1 sdb2[1] sda2[0]
      4891712 blocks [2/2] [UU]

md3 : active raid1 sdb3[1] sda3[0]
      1959808 blocks [2/2] [UU]

md5 : active raid1 sdb5[1] sda5[0]
      39069952 blocks [2/2] [UU]

md6 : active raid1 sdb6[1] sda6[0]
      39069952 blocks [2/2] [UU]

unused devices: 

I then made md5, 6, 7, and 8 LVM physical volumes and then shoved into an LVM volume group using pvcreate, vgcreate, and vgextend:

# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/md5   vg   lvm2 a-   37.26G      0
  /dev/md6   vg   lvm2 a-   37.26G 528.00M
  /dev/md7   vg   lvm2 a-   37.26G      0
  /dev/md8   vg   lvm2 a-   37.26G  29.52G
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     4   5   0 wz--n- 149.03G 30.03Gsonata opt # vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg     4   5   0 wz--n- 149.03G 30.03G

Then I created some LVM logical volumes using lvcreate:

# lvs
  LV   VG   Attr   LSize  Origin Snap%  Move Log Copy%
  home vg   -wi-ao 80.00G
  opt  vg   -wi-ao  2.00G
  tmp  vg   -wi-ao  2.00G
  usr  vg   -wi-ao 20.00G
  var  vg   -wi-ao 15.00G

I keep /home, /opt, /tmp, /usr and /var separate. That's why my root (/) partition on /dev/md3 only needs to be 2G.

The reason I made a bunch of RAID's and put them in the LVM rather than just one big RAID is because it means I haven't tied my entire drive down to anything. I can always move data off of one partition later using a few LVM commands and install another OS if I have to. Few people do this, but I think it is a good idea. On my computer at work, I did something similar. I split my hard drive into chunks of 40G and then threw into an LVM. Splitting your hard drive into multiple physical partitions is very useful.

The other thing I did was put the swap drive at the end of the hard drive. It is easy to make it bigger that way. So many people make one of their primary partitions at the beginning of the hard drive into a swap partition, which I can never understand. I almost always end up adding more RAM to my computer and thus needing to make my swap partition bigger. When it is at the beginning of the drive, it means you have to add a new one at the end, where you have free space. Putting my swap at the end of the drive in the first place means I don't have to have 2 swaps later. Given the complexity of my drives as it is, this swap thing is a minor concern.

I also plan on putting Xen on /dev/md2 later. I hope to be able to boot into an OS on /dev/md2, then start up the Gentoo Linux on /dev/md3. If I ever need to restart my Linux on /dev/md3 I can reboot it without turning off the computer. It would also allow me to run Windows XP under Xen rather than under VMWare as I do know. From what I hear Xen has better performance.

The main thing left for me to do is to buy another 320G drive and set up an rsync backup from the 320G RAID to the backup drive (probably in a USB adapter case). As most people probably know, RAID does not replace backups. RAID just protects you against hardware failure. It does not protect you against "rm -rf /". These drives were only $110 CAD each, so getting another backup drive is no big deal.

One other thing that I did differently than usual is that I made all my filesystems ext3, rather than reiserfs (as I normally do). One of the reasons is that I had far too many cases where my reiserfs partitions got screwed up. In fact even my old hard drive had a screwed up directory that was not fixable, unless I ran the reiserfsck program with the --rebuild-tree option, which is not a very safe option. It turns out the directory was not an important one. Anyways, I have never had a problem with ext2 or ext3 ever, so I went with those instead.

Anti-Aliasing in Java >=1.3

It's really simple. Just add the a few lines of code at the top of your paintComponent method:

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  Graphics2D g2d = (Graphics2D) g;
  g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
  . . .
  . . .
}

The first is for shapes, the second is for text, and the third is to go for high quality (over speed).

Actually in 1.5 you can just pass -Dswing.aatext=true to the VM, but this didn't work with one of my applications for some reason.

Tags: 

D-Wave Quantum Computing Demonstration

D-Wave Systems (where I work) will be holding two special events on February 13th in Mountain View, California and on February 15th in Vancouver, British Columbia to demonstrate our quantum processor. The date is fast approaching, so I better make extra sure there are no yet-undiscovered bugs in my code!

Switched from Portage to Paludis

I switched to Paludis yesterday. For those who don't know what Paludis is, it's an alternative Gentoo package manager, or a Portage/emerge replacement. It has not all been smooth. I had to fight with it for a while, re-installing a bunch of packages that thought they depended on an installed package that no longer existed. I think this was because Portage left some cruft around that made it think that. The problems were mainly to do with kdelibs-3.4* (which a lot of installed packages thought they had a block on) and with guile (which moved to a new category but some packages weren't aware of the switch). Re-installing worked in most cases.

The other wrinkle was that the portage2paludis.bash script that I used according to the migration instructions didn't bring all my repositories over, including my /usr/local/portage and a few others. The second annoyance was that a few repositories didn't have profiles/repo_name and profiles/categories files in them (which paludis requires) and this causes a bunch of warnings about how paludis is "faking it." I finally got it to the point where I could do "paludis -ip world" and I got no warnings and no errors.

The only remaining problem is that the gentoo java packages are mostly unusable with paludis because none of the hooks in the java gentoo eclasses get installed into paludis' hooks system (and paludis doesn't call the hooks in the java eclasses). Apparently the Gentoo Java team was "abusing the [portage] hooks in [their] eclasses." They should be installing the hooks into the paludis hooks directories. Paludis hooks are similar to subversion's hooks system. They allow you to do a lot of fancy things.

Overall I am impressed with Paludis. Running "paludis -ip world" is a lot faster than "emerge -uva world" or "emerge -uvaDNt world" but more important than speed is that it was designed from scratch, without all of portage's warts and messy hard-to-change code. In a way, paludis is to portage what svn is to cvs. You can read all about the differences between Paludis and portage here.

One more thing happened yesterday, that was a little bit scary. I tried to reboot to try out a new kernel and I noticed the "reboot" and "shutdown" commands were no longer there. I rebooted anyways but hitting the reset button but the system wouldn't load, it stopped right after the kernel was done starting up. It turned out Paludis had uninstalled sysvinit when I ran "paludis --uninstall-unused" and I didn't notice. Reinstalling it fixed everything but I got really scared that the reboot and shutdown binaries were missing due to dataloss.

Bilingualism Delays Onset of Dementia

According to a study appearing in the February 2007 issue of Neuropsychologia (Vol.45, No.2), bilingualism can delay the onset of dementia by about 4 years. This is probably because if you speak two languages, when you get older and people start calling you crazy you can fall back on your second language and start babbling away. Nobody will know the difference because they won't understand what you are saying! "Dave doesn't have dementia, he just likes speaking in French now."

Anyways, I thought this result was kind of interesting. I wonder if knowing 10 programming languages, or knowing how to read music has the same effect. Are verbal languages special? Or will any "language" do? Furthermore, is it not languages at all that delays dementia but instead some of general "brain exercise" that delays it. Maybe the brains' of people who speak more than 1 language get more exercise than other people. You know, kind of like if you exercise your heart/body it will work better and last longer. Or, is this just one of those things where it is not specifically an extra language that delays dementia but that the type of person who would learn two or more languages (or to have acquired two or more languages) and maintain fluency is the type of person who would have lived longer anyways for some other reason? Kind of like the type of person who drinks 1 glass of wine per day is the same type of person who can afford regular purchases of bottles of wine, and can thus also afford a gym membership, thus maintaining a healthy body and extending their lifespan (yes I don't buy the glass-a-day makes you live longer crap).

Credit goes to Slashdot for pointing me to this article.

Drag & Drop from Linux (KDE, Gnome) File Managers (Konqueror, Nautilus) to Java Applications

I tried a few months ago to get drag & drop working from Konqueror to a Java application but it didn't work. Two programmers (myself and another) each had a crack at it and couldn't get it to work. I found one link through Google that seemed to be promising (see reply 23 or 23) but that didn't work. Then finally today by using slightly different keywords in my Google searching, I managed to find this link, which led me to this bug report. It turns out the "workaround" works great and I got it working. Works with Konqueror as well as Nautilus. Haven't tried any other Qt/KDE or GTK applications. Should work with Windows as well of course. I am attaching a trimmed down version of the workaround version with only the essentials to get this working. It it a lot nicer looking than the forum.sun.com link above. I had such a tough time finding the solution to this online, I hope others find this blog post and thus have an easier time at it than I did.

AttachmentSize
Plain text icon TestDragDropLinux.java_.txt3.46 KB

Pages

Subscribe to RSS - David Grant's blog