Thursday, April 30, 2009

How I installed Ubuntu 9.04 in a Dell Vostro 1510 notebook

Update: My pains to this day with Ubuntu 9.04:

  • Reboots some times when plugging in the USB mouse / keyboard (maybe 3 times a week)
  • VirtualBox (for running a few Windows XP programs): Reboots some times when starting (rare), and more often the virtual machine can't be resumed, so it must be forcefully reset (the guest, not the Ubuntu host). The sound is very choppy in the virtual box. Could use the paid VMWare workstation, but it doesn't work with sound. 
  • Video playback in sites like Youtube is so-so (particularly full-screen; it gets choppy)
  • Have yet to find a program that can speed up video playback reliably like I used to do with BSPlayer on XP (VLC and MPlayer both have the capability, but it doesn't work well in my Ubuntu)
  • Skype is not worth using. It often times consumes 100% of the CPU, audio is bad, it's a pain to configure, and chat works only some times.
  • OpenOffice.org takes 3-4 seconds to open even a small document, even when OpenOffice is already open and no physical disk access is needed (vs. Office 2003, that takes 1s).
  • Hibernation takes about a full minute to resume! Stand by takes almost a full minute to shut off (but resumes quickly, though some times it does not resume at all!)
  • Can't play videos in one particular site that uses WMA codec (spent a couple of hours trying, even with Medibuntu)
  • Applications like Firefox and OpenOffice seem to take a bit too long to update the screen, such as when switching between applications.

Pros:

  • Very RAM frugal! I like the fact that I can work with two instances of the bloated Eclipse suite and other heavy-weight programs running and only consume a paultry 1.4 GB of RAM (whereas Vista would be at twice that much or more).
  • Linux command line ;-)

Conclusion: I like Linux, but if I had to choose now an OS, I would go for XP: it's 8 years old, unsafe and much more, but it generally works out of the box with most software, and forum answer hunting nights are a foreign experience. It's a matter of productivity.

To Install Ubuntu 9.04 in a Dell Vostro 1510 notebook

First of all, don't download the official ubuntu 9.04 CD. Download the Dell one: http://linux.dell.com/files/ubuntu/jaunty/iso-images/ubuntu-9.04-dell-reinstall.iso (from http://linux.dell.com/wiki/index.php/Ubuntu_9.04 ). With the Dell one, apparently, sound works off the shelf.

Wireless: I have Dell 1505 Wireless-N. Follow https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx/Feisty_No-Fluff    with step 2d


Audio: (Because I installed the official Ubuntu CD, not the Dell one)

(Option 1. Described below. I started with this, got it to work, and a few days after (lots of system tweaking action in the middle), it stopped working, so I did Option 2 below. So my advice is, forget about option 1.)

Option 2.

You can use this to reload the alsa config: sudo alsa force-reload   

I got the following by booting from the Dell live cd (using usb-create). Put the following into /etc/modprobe.d/alsa-base.conf


# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7

# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
#
# Workaround at bug #499695 (reverted in Ubuntu see LP #319505)
install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; }
install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }
#
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }
# Cause optional modules to be loaded above sound card driver modules
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; }
install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }

# Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)
install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options saa7134-alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio index=-2
options snd-usb-us122l index=-2
options snd-usb-usx2y index=-2
options snd-usb-caiaq index=-2
# Ubuntu #62691, enable MPU for snd-cmipci
options snd-cmipci mpu_port=0x330 fm_port=0x388
# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2


(Option 1. 

With the following I made it possible to play music in linux while having VirtualBox running on ALSA and playing sound (you must configure the VirtualBox sound setting to ALSA).

From http://www.stupent.at/2008/06/18/dell-vostro-1510-with-ubuntu-804/
added to administration->software sources->updates, this: pre-released updates & unsupported updates. From: http://linuxtechie.wordpress.com/2007/10/19/getting-intel-ich8-family-rev-3-sound-card-to-work-in-gutsy/ (this is referenced by the first URL)
sudo apt-get install linux-backports-modules-jaunty
Also: “inserting the following line to /etc/modprobe.d/alsa-base did a great job for now:
options snd-hda-intel model=toshiba position_fix=0 enable=yes

“)

Wednesday, April 15, 2009

How I Solved my Python, Django & jQuery Javascript Unicode Problems

JavaScript:

The JavaScript encode() function doesn't handle Unicode. See http://xkr.us/articles/javascript/encode-compare/ for alternatives.

The jQuery serialize() function works well with Unicode.

Python:

urllib.urlencode(), urllib.quote() and urllib.quote_plus don't handle unicode strings. So instead of

urllib.urlencode(u'a unicode string')

... do:

urllib.urlencode(u'a unicode string'.encode('utf-8'))

In the above case I'm assumming that the string is already Unicode (which seems to be the case when you got it off Django, maybe from a GET parameter). If it's in another encoding, you must previously do:

'a byte string encoded in X'.decode(encoding_goes_here).encode('utf-8')

Thursday, April 2, 2009

": needs update fatal: Entry '' not uptodate. Cannot merge."

I got this error when trying
git pull
": needs update
fatal: Entry '' not uptodate. Cannot merge."

Solution:
git commit