In The Armchair

Ubuntu 13.10 on a Dell XPS 13

Posted in Computers by Armchair Guy on February 12, 2014

I recently acquired a Dell XPS 13 and installed Ubuntu 13.10 on it.  This is a log of my experiences.  I plan to keep adding to this as things develop.


At the time of this writing (February 2014), the Dell XPS 13 is an Intel Haswell-powered ultrabook sold with either Windows 8.1 or Ubuntu 12.04 LTS.  The Ubuntu version is also called Project Sputnik — Dell made the laptop fully compatible with Ubuntu.  The Ubuntu version is a little cheaper (about $1,550 vs $1,616; no Microsoft tax), but taking the duration of support into account (I wanted 3 years at least), it was cheaper to get the Windows 8.1 version (the $1,550 price only included 1 year).

In general, I liked the look, feel, screen resolution, and build quality of the laptop, though there are several issues.  The annoyances: seems a bit expensive for what I’m getting; the lid can’t be lifted without holding down the base with the other hand; the screen is glossy (apparently this can’t be avoided if it’s a touchscreen); no discrete graphics (this is probably a benefit from a compatibility POV, but I’ve always had discrete graphics); the bottom gets quite warm at the back with extended use so gets uncomfortable on the lap; the laptop’s size and contours feel uncomfortable when using on the lap; no dedicated PgUp/PgDn/End/Home keys (this really bothers me); the position of the trackpad and left Ctrl key makes it hard to press Ctrl+V; the font on the keyboard looks a bit weird and unprofessional to me; there’s a panel on the bottom that has “Windows 8” etched into it; memory is not upgradeable at all (soldered onto motherboard); 256GB SSD was expensive but feels very small; the power cord is in an awkward position; power cord doesn’t have a “charging” indicator led, just a “plugged in” indicator; and battery life of about 5 to 5.5 hours feels very short compared to the MacBook Air’s 12 hours.  Having said that, other ultrabooks with comparable features are equally (or more) expensive.

I’m upgrading from an a Lenovo ThinkPad T61 running Linux Mint 14.  I putzed around with live CDs for a few different Linuxes: Ubuntu 13.10, 12.04, Mint 16, and OpenSUSE 13.1.  I considered Kubuntu 13.10 as well.  In the end I decided to try Ubuntu 13.10 because the XPS 13 has a touchscreen.

Ubuntu 13.10 Installation

Installation of the OS itself had a few complications.  I initially couldn’t figure out how to get the laptop to boot from USB.  The laptop has a “secure” boot feature and uses UEFI.  Turning off the secure boot and switching from UEFI to a legacy booting sequence, ignoring the dire warnings displayed when changing these settings, worked for me.  (I pressed F2 right after turning on the ultrabook, when the Dell logo appeared to be taken to BIOS settings.  Then navigated to Boot and made the changes.) I wrote the Ubuntu 13.10 live ISO to an external USB hard drive using the instructions and script here:  The laptop booted the Ubuntu live USB fine from either USB port  (despite what some reports say about the left side USB).

The first thing I did before installation of Ubuntu was to re-partition the disk.  The XPS 13 came with a 256GB SSD hard drive that was partitioned into a number of tiny partitions, a huge one that had Win 8.1 on it, a recovery partition that was about 8GB and mostly full of data, and another 8GB partition that Win 8.1 presumably uses to hibernate.  I used GParted (comes on the live ISO) to resize the Win 8.1 partition to about 50GB, added a root partition (ext4), a data partition (ntfs), deleted the recovery partition (since it can only be used to restore to factory settings), and created a single 16GB swap partition (the XPS 13 has 8GB RAM; double that).

After partitioning, I ran the installer.  It asked for a few basic items of information and ran with no problems (except it took a long time to download various language packs — not sure I needed them). But after the installation was complete and I rebooted, some weirdness ensued.  First, the ultrabook wouldn’t reboot — it got stuck in an unresponsive state with the screen blank but not turned off.  I shut it down by holding down the power button.  When I rebooted, a GRUB bootloader showed up (I think this was supposed to boot into Ubuntu immediately but somehow got installed with a wait time).  The first couple of times I booted in and shut down, the unresponsive state and other odd problems (no mouse pointer, unable to boot, etc.) recurred.  Rather than try to figure out what the problem was I reinstalled Ubuntu, and things seemed to work fine after that.

The Hardware: Initial Impressions and Tweaks

Things that worked

Most of the basic hardware worked right out of the box (as expected).

  1. Keyboard backlight
  2. Volume buttons
  3. Screen brightness buttons
  4. Basic trackpad functionality (moving a mouse pointer, left and right clicking)

Things that didn’t work

  1. The touchscreen and more advanced trackpad functionality were much more tricky.  The touchscreen didn’t appear to respond to touches initially, but then began working without any intervention, and worked intermittently after that, turning on or off after suspending.  Then, installing the recommended software updates broke something and the touchscreen stopped responding altogether.  This bug report (see steps 1, 2, 3 at bottom of page) supposedly has a solution to problems with both touchscreen and trackpad.  However, the erratic behaviour of the touchscreen persists on my setup after following those steps — it still responds in fits and starts, even when I don’t suspend.  However, when it does work, it works pretty smoothly.  Various troubleshooting discussions that didn’t fix the problem but were informative: 123.
  2. The trackpad worked, but initially without side-scroll or 2-finger scroll. I fixed the problem by following the simple instructions in this bug report (see steps 1, 2, 3 at bottom of page), which seems to have fixed all problems.
  3. WiFi networking is problematic.  After resuming from suspend, it either takes too long to connect or doesn’t work at all.  Using the command: “sudo nmcli nm sleep false” in a terminal seemed to help somewhat; this page lists a more permanent solution.  However, WiFi still keeps cutting out and I frequently have to restart networking (disable and enable networking using the network applet) to get a connection.
  4. Many of the new (late 2013/early 2014) Dell XPS 13 ultrabooks have been widely reported to suffer from an “electric whine” sound that many people find aggravating. Mine has this problem too. The ultrabook makes a high-pitched sound that varies with the keyboard backlight, which is extremely distracting especially in quiet rooms. Turning off the keyboard backlight eliminates the noise. This kind of problem really shouldn’t be present in such an expensive machine.

The Software

Things that work

Here are some notable software features that work well.

  1. Font rendering works beautifully — much better than the font scaling functionality on Win 8.1, even on the same apps.  For example, fonts in Google Chrome look crisp and clean even at very high zoom levels in Ubuntu, while in Windows 8.1 they pixelate. (It’s not a Chrome issue: they also pixelate in Internet Explorer.)
  2. User switching appears to work really well.  This is something that always seemed to be broken in previous versions of linux — switching back and forth between users would cause alarming screen black-outs and flickers and eventually crash X.  Here it appears to work smoothly — so far.

Things that don’t work so well

  1. There is a considerable amount of unstable behavior.
    1. Initially, apps frequently became unresponsive and needed to be forced to quit.  This happened much more frequently than normal. Two months later, this behavior seems to have resolved itself and no longer happens. I’m not sure whether this was due to the few system updates I installed.
    2. Often, I get a popup that says “System program problem detected.”  The popup offers to send a problem report to Ubuntu, which I’m glad to do if it helps improve Linux, but there’s no option to show me any information on what the problem was. This is due to old crash reports in /var/crash/ not being cleared. A quick fix is to clear that directory (“sudo rm /var/crash/*”), but the real problem is a system that provides no information to the user about the crash.
    3. Wifi is decidedly quirky, even with the fix referred to above.  It occasionally drops the connection, and then fails to detect my wifi network (but detects my neighbours’ networks) until I disable and re-enable wifi. Update: this behavior got pretty bad, to the point where I had to reset the network almost every minute. However, it disappeared after I changed my router back to an older one. I haven’t diagnosed the problem. It could be something wrong with the router, or perhaps the driver doesn’t properly handle the latest protocols. Other devices (iPads, other laptops) occasionally had trouble with the newer router too, but not nearly as bad.
  2. The touchscreen is treated as mouse input.  This means that certain tablet-like behaviours are not enabled.  For example, swiping a page in the web browser selects the text, and does not scroll the page, since that’s what would happen if you dragged the mouse across the page.  Still, a lot of things do work.
  3. Unity, Ubuntu’s window manager, is interesting but also has some major oversights.
    1. One of the big ones is that there is no way to start multiple instances of a given program by clicking the icon! Some programs provide an option to open a second window if you right-click the icon, but if a program doesn’t, you’re out of luck — you have to open a terminal and start it from the command line.
    2. There’s also no easy way to ungroup multiple instances of an application when using Alt+Tab. That is, Alt+Tab switches between different types of application only — if you have 3 terminals open, you can’t easily use Alt+Tab to access all three of them. Instead, you use Alt+Tab to select the application and then use Alt+` (key above Tab) to switch between instances of the same app. Maybe this will become natural with some use, but right now it’s pretty frustrating that Unity doesn’t provide a way to ungroup the windows at all. Some solutions are available here but they’re pretty awkward.
    3. A major problem with this laptop is that many applications aren’t designed to work in this resolution.  The default font size selections are too small. To globally adjust font size settings, I installed the “Unity Tweak Tool” from the Ubuntu Software Center, and increased the Window Title Font and Text Scaling Factor.  This fixes some but not all problems — it varies from app to app.  Google chrome, for example, still has very tiny text on its tabs.  Some apps also have a “zoom” setting which is useful.


    1. The battery doesn’t last as long as on some other laptops/operating systems, but it’s not too bad.  I get about 5.5 hours on a charge.  When in a suspended state, it seems to consume about 20% battery every 12 hours.
    2. Ubuntu uses the LightDM display manager to manage logins among other things.  I set the LightDM display manager not to display usernames for users on the system, and to require users to type in their usernames, using the instructions here.  There’s also a feature that lets you hide specific users but as of this writing it doesn’t work due to a bug in Ubuntu.
    3. One of the features I was hoping to see in Ubuntu by now is the ability to stream system audio output to a DLNA receiver over WiFi. This is supposed to be possible using some combination of the packages rygel, pavucontrol, paprefs, and gupnp-tools.  Several sites provide instructions or discussions: 1, 2, 3, 4, 5.  The instructions at this site work, after a fashion.  (I use FLAC instead of WAV encoding for network efficiency.) The result is flaky, though.  There is considerable lag (about 3-4 seconds), and I have to ask the DLNA receiver to restart playback after any pause in audio output (eg., if I’m playing something on YouTube and pause it for a moment, I need to restart playback on my DLNA receiver to begin hearing it again after un-pausing).  Having gotten accustomed to Chromecast, Roku, and Apple TV, this feels very broken.  However, I’m glad this is at least available as an option.
    4. The above problem is now partly resolved thanks to Google’s Chromecast, which is proving to be a breakthrough device for linux.  I can now stream local music to Chromecast using the PLEX application (which is available in the Ubuntu repositories).  PLEX provides a UI through Google’s Chrome browser that allows you to select local music specify that it should be streamed to Chromecast, and stream.  It still doesn’t provide a way to stream system audio.
    5. I usually have a “data” separate partition that holds my data (pictures, documents, work).  If I need to reinstall the OS, I can do so without having to restore the entire data partition.  I like all users on the system to be able to modify anything on the data partition.  If one user creates a file, I want other users to be able to read and write to that file.  Now, this was automatic in the past because I used an NTFS data partition.  This time around, I switched to Ext4, which makes it surprisingly difficult.  However, I could do it using the instructions here, with some modifications:
      $ sudo addgroup datapart # Create new group called "datapart"
      $ sudo adduser USERNAME1 datapart # Add user USERNAME1 to group datapart
      $ sudo adduser USERNAME2 datapart # Add user USERNAME2 to group datapart.  Repeat as needed
      $ sudo chgrp -R datapart /data_partition # Change group of partition (recursively)
      $ sudo chmod g+s /data_partition # Set setuid bit for group
      $ sudo mount -o remount,acl /data_partition # Remount with ACLs enabled; alternatively add ",acl" to /etc/fstab permissions for a permanent solution
      $ sudo setfacl -R -d -m g::rwx /data_partition # Set access control: full access to group
    6. I experienced some occasional weird trackpad behaviour. After resuming from suspend, the trackpad acted as if I was using 2 fingers when I was actually using 1. Ie., it would scroll instead of move the mouse pointer.  I fixed it using the instructions here:
      $ sudo modprobe -r psmouse # Unload trackpad driver
      $ sudo modprobe psmouse # Restart trackpad driver
    7. When using headphones, I hear a loud background hiss, like white noise, underlying any music/sounds I’m playing. It makes the headphone jack pretty un-usable. I haven’t found a fix for this yet.
    8. Pairing with a bluetooth headset is flaky. Sometimes it works as expected, though I still have to go into audio controls after pairing and manually specify that the sound output should be through the headset (it seems natural to have this happen automatically as soon as pairing is complete). At other times, pairing seems to occur but the headset is not shown as an output option. When this happens, following instructions here, the command “pulseaudio -k” seems to make that output option appear again.
    9. Ubuntu has a feature called the HUD, which is basically like a text-based search within the menus of the current application. It looks useful, but uses the Alt key as its shortcut, which interferes with the Alt key bindings in various other applications. I disabled it using instructions here.
    10. The lock-screen functionality is poorly designed in Ubuntu 13.10. When the lid is closed and opened, the screen locks after the lid is opened. Before it locks, you see what was on the screen before the lid was closed for about half a second. And then it locks! This defeats the purpose of a lock-screen mechanism.
    11. Google added Chromecast functionality to the linux version of Chrome sometime in 2014. So, if you have a linux laptop and are trying to decide which media device to use (Chromecast, Apple TV, Roku, Amazon Fire TV, …), the Chromecast is a good option.
    12. Wine runs pretty well under this version of Ubuntu, but I had problems with audio, especially when playing games. This link describes the problem exactly. The solution in the second answer there worked for me. The solution is to run programs using:
    13. $ PULSE_LATENCY_MSEC=60 wine program.exe

      Several other solutions were available on the net, including ones that asked you to edit PulseAudio configuration files in /etc/pulse or ~/.pulse/, but those didn’t work for me.

    14. I upgraded to 14.04 a while ago. I haven’t blogged it and don’t think I will. However, this is a fix for one problem that was bugging me for quite a while. After the upgrade, wakeup from suspend completely stopped working. When attempting to wakeup from suspend, I would be greeted with a blank screen. The keyboard lit up, which seemed to indicate that the OS was running but the screen was just turned off. The solution that worked for me (found here) was to add the following line:
      export CLUTTER_VBLANK=none

      to the file “/etc/environment”. This just seemed to fix the suspend issue completely.


  1. One of the biggest problems plaguing linux is the loss of features over time. Linux is powerful because of the tweakability and the number of features that numerous people have contributed. Once a feature is available, I’m sure it takes a considerable amount of work to make sure it continues to function going forward. Sometimes a feature is viewed as not being in the best interests of a particular distribution. Because of such reasons, useful features tend to get dropped in future versions of linux. An example is the split-screen F3 functionality in Nautilus. This is a critically important feature that Ubuntu developers removed. I feel a distribution like Ubuntu cannot be allowed to be the steward of the featuresets to retain, because their interests are not the broadest possible. There needs to be a better process to determine which features are retained in important software. (Individual distros can tweak/remove features, of course.)

Linux Mint 14.1

Posted in Computers by Armchair Guy on December 6, 2012


I upgraded the memory on my old Lenovo T61 recently, and thought it was a good time to upgrade Linux as well.

When I began looking for candidate distributions, one of the big problems with Linux became apparent: the community struggles to hold on to gains that it has made.  Excellent, painstakingly developed features are often discarded in favor of a “refresh” or new direction.  Many times, it isn’t clear at all that the refresh accomplishes anything.

This happened to Ubuntu, the distro I’ve been using for several years now, with their decision to develop a completely different UI (Unity).  I decided to install a less deviant distro, and went with Linux Mint 14.1.  Not too big a step, since Mint 14.1 is based on Ubuntu 12.10. Linux mint is pretty good, but like most linuxes is a little rough around the edges.  Here are my experiences, which I’ll update as time goes by.

The good:

  • Except for one minor hiccup, the install process was excellently simple and effortless.
  • Lenovo dock integration works with zero tweaking (when placed in the dock, the display switches to the external monitor, and vice-versa).  This is very important.  (This completely stopped working… I’m trying to figure out why and how to make it work again. Update: It seems related to this previous post of mine.)
  • Videos play without too much stutter or jerkiness, even in full screen mode.
  • I don’t have to do anything to get sound to work. (See below for a caveat)
  • The UIs for various settings are very smooth and intuitive without unnecessary clutter.
  • The user interface (panel, menu, desktop) is quite smooth and sleek, most things are placed in intuitive locations, and it is easy to get work done without the UI getting in my way.
  • I had existing home directories for a small number of user accounts.  When I mounted those home directories and added users with the same names as before, the userids were set properly and users were able to immediately begin using their old home directories.  I am not sure whether this was just a coincidence (did I recreate user accounts in the same order that I had done previously, and hence get the same sequence of userids? If I had changed the order, would everything have been messed up?).  I was concerned about this, and it’s great that it worked so smoothly.

The bad:

  • Why create a DVD-size install disk (800-odd MB)?  I didn’t have a USB stick handy, and it was pure luck that I had a blank DVD lying around.  I’d expect CD-size install disks to work better.  But this is a minor problem.  I imagine most people would use a USB stick.
  • The install process is excellently simple.  However, one part of the process gave me some nervous moments.  I have a complicated partitioning scheme.  When I was setting up partitions manually, the “format” option for some partitions was grey, while it was white for others and had an “X” for yet others.  I wasn’t sure what the grey meant and it wasn’t explained anywhere, leading to nervousness because I wasn’t sure whether my data-filled partitions would be formatted.  In the end, they weren’t formatted and it all turned out ok, but I’m still no wiser as to what the grey formatting box means.
  • When logging in, it says something about Run XClient Script.  I installed the Cinnamon version and know about MATE, but what is this XClient Script?  Need to stop referring to things people are unlikely to know about without an explanation.
  • No switch user button in the menu.  I have to lock the screen to get a switch user button.
  • Right after installation, none of the package management software (including synaptic package manager) would start because of a malformed line in the sources list.  I had to manually edit the file to fix this.
  • X is unstable.  Sometimes I log into an account and get blank white squares instead of icons or letters, and various parts of the screen are blanked out or garbled.  Installing the nvidia drivers appears to have fixed this.
  • Nowhere in the manuals or release notes is installation of nvidia drivers mentioned.  You just had to know to install them.
  • Synaptic still hasn’t gained the ability to install selected packages in the background while you continue to browse other packages.
  • The login/logout system is generally unstable.
    • If I switch users or log in and out 2-3 times, the computer crashes and I have to reboot.
    • Even when it works, switching users results in some peculiar behavior.  The screen blanks out, I see a blinking cursor, then the screen blinks a couple of times before the login screen appears.  Sometimes there’s a text login that appears for several seconds before the graphical login window comes back.  An nvidia splash screen also becomes visible sometimes.
    • The login system doesn’t play nice with the docking system.  If I switch users, the new login screen disappears from the external screen and only appears on the laptop screen (which I have to open while it’s in the dock to proceed).  After logging in while docked, attempting to switch users leads to peculiar bugs, including the inability to view programs started, even though they show up on the taskbar (there’s just no window for the program).
  • After installing software, it’s sometimes necessary to log out and back in for the menu search to detect it.  (Other times it is detected right away.)
  • They chose to include a crippled Add Users program.  There is already a program that lets you add users as well as set various permissions through group membership (like the ability to mount CDs or use a printer or VirtualBox).  In Mint they inexplicably discarded the feature-rich version in favor of a program that only allows you to add or delete a user.
  • The alternative package management tool (mintinstall) is a frustrating mix of good and bad.  It has this great feature where you can begin installing some packages in the background while continuing to browse other packages (I can’t believe synaptic still can’t do this).
    • However, it isn’t possible to quickly select or queue multiple packages for installation — there’s no right-click package selection.  To select a package, you have to double-click on it and then click an “install” button.  To then select another package, you have to hit a “back” button, double click on another package, and click the install button.
    • Also, and this is quite important, once an installation is started there seems to be no way to interrupt it or cancel.  The cancel button doesn’t work.  If it is closed during installation, the tool closes the UI but continues to install packages in the background.  During this time it locks the package management system and there is no way to communicate with it.  So I ended up waiting a long time for it to finish downloading and installing packages I had changed my mind about.
  • There still doesn’t seem to be any way to mirror the desktop over DLNA.  And still no way to stream PulseAudio sound output over DLNA or AirPlay.  There are no DLNA control points available that work with any of the music players.  There are supposed to be some programs that enable some of these, like rygel, xmms2-plugin-airplay, pulseaudio-module-raop, and a totem airplay plugin.  None of them works.  C’mon — it’s 2013, for goodness’s sake!  Even my Android cell phone can do these basic things.
  • Caveat Sound seemed to work out of the box.  Then it just stopped working.  I can no longer see the local sound device.  The only device that sound can be sent to is “Dummy Output”, which seems to be like /dev/null for sound.  That is, I can no longer play sound at all.  This problem went away after rebooting, but it’s quite unclear why it occurred and seems likely to recur in the future.
  • Ubuntu One isn’t installed by default.  I don’t buy very much music, but unless it’s much more expensive or lower quality than 320 kbps I prefer to buy on Ubuntu One, as a way of supporting Linux. This is minor (Ubuntu One is easy to install), but since Mint is based on Ubuntu, I feel they should have included Ubuntu One.

Math in R plots

Posted in Computers by Armchair Guy on April 5, 2011

R provides a way (see ?mathplot) to insert math into titles and labels in plots.  An example: plot(1, main=expression(S[A])).  This will create an S with a subscript A (S_A) in the title of the plot.

But what if you have a variable called x, and you want S_A and the value of x in the title?  For example, if the value of x is 3, you want S_A = 3 to appear.

I’m sure there’s a simpler solution, but here’s the simplest one I’ve got:

  1. First, note that it would suffice to type in plot(1, main = expression(paste(S[A], ” = “, 3))).  Of course, we want the value of x there, no matter what it is — not just 3.  If we try plot(1, main = expression(paste(S[A], ” = “, x))), that will result in S_A = x appearing in the title, not what we want.
  2. The solution is to create the string we would have typed if we knew the value of x.  We do this like this: s <- paste(“plot(1, main = expression(paste(S[A], \” = \”, “, x, “)))”). If we now print the string s, it will show “plot(1, main = expression(paste(S[A], \” = \”,  3 )))” (if the value of x is 3).
  3. Now, we “run the string”: eval(parse(text = s)).

There are some more complicated but flexible solutions, like integrating postscript output from latex into R graphs (using psfrag).

Watson and the Singularity – IV

Posted in Computers by Armchair Guy on February 17, 2011

On the last day, Watson was not nearly as dominant as on the second day, but won a big packet on the Final Jeopardy question to take its total winnings to much higher levels than either of its contestants.  For a large part of the third day, Ken Jennings was in the lead.

Watson uses the correctness of previous answers to try to understand what a category means.  For example, in a “Name the Decade” category, Watson wasn’t sure what the category name meant — so it didn’t know that it could restrict its answers to the set {1900, 1910, 1920, …, 1990, 2000}.  When it is unsure in such a manner, Watson uses previous correct answers in that category — possibly by its competitors — to narrow down what the category means.  It was clear on the third day that Watson didn’t understand what certain categories meant, even after observing opponents’ correct responses.  This meant it did poorly on those categories as a whole.

Watson’s natural language processing, I think, is tailored to the task at hand — winning Jeopardy.  Like I said before, it doesn’t understand sentences the same way a human would.  While watching the show, I found that many of the answers were found in the intersections of two or more sets, but Watson didn’t identify all of the sets.

I would classify Watson as a mild sub-Singularity event at this point.  If indeed programs like Watson proliferate the way chess programs have — if Watson clones become much more powerful and lightweight enough to run on the computer as personal assistants, perhaps with some help from the cloud — we will be on our way to real artificial intelligence.  Sequential improvements in such programs will eventually lead to super-human intelligence, much as the Singularity gurus predicted.  Eventually, APIs for NLP and this type of reasoning might become commoditized — unless companies like Google prefer to provide access APIs only, and keep all the computation hidden on their servers.

The question that immediately popped into my head when I heard about this Jeopardy challenge for the first time was “why not Google?”.  IBM has a fantastic record of innovation, of course, but the things Watson does are right up Google’s alley.  Search would be greatly improved if you could ask a question and have it answered in addition to being served a bunch of related pages.  Personally I believe Google has already developed a system like Watson.  So why don’t we know about it?  Two possibilities.

First, Watson needed 2800 processors to answer questions one at a time.  The technology that Google has may or may not be equally advanced, but perhaps doesn’t scale up to allow answers for millions of questions yet.

Second, this is a card in Google’s hand that it doesn’t want to show unless necessary.  If a competitor (mostly Bing at this stage) appears to be making significant inroads into its search space, it can add this feature to jump ahead, so it’s insurance.  Revealing everything would just provide Microsoft with a “copy this!” blueprint.

Watson and the Singularity – III

Posted in Computers by Armchair Guy on February 16, 2011

On day 2, Watson comprehensively outscored his human opponents.

To some extent, it seems Watson is at an advantage because his pneumatic button-pressing system can react faster than any human possibly could.  This severely affected Ken Jennings, who obviously had some of the answers and showed frustration at never being able to get to the buzzer first, shaking his head on occasion.

Perhaps a more fair way to assess Watson’s intelligence (as opposed to his button pushing prowess) is to adjust Watson’s button presser to be more commensurate with the pressing rate of human nerve systems.

Although Watson is doing great, it is becoming more apparent that Watson doesn’t understand the nuances of language in the clues as well as a human could.  There’s a document here (PDF) detailing some of Watson’s programming.

Watson and the Singularity – II

Posted in Computers by Armchair Guy on February 15, 2011

So, I watched the first part (of three) of the IBM Watson Jeopardy challenge.  So far, Brad Rutter and Watson are tied at first place, with Ken Jennings somewhat behind.  I was interested in getting a sense for how Watson “thinks”.  One of the things I tried to do was get a sense of the extent to which Watson is “understanding” human language.  At this point the answer seems to be “not very well”.

Of course, it’s hard to glean much just watching a TV show, but it seems as if Watson isn’t quite understanding language the way we do.  If a clue indicates the answer is a member of two sets, for example, Watson sometimes seems to ignore the second set.  An example (paraphrased): This word can mean the bend in the elbow and also a thief.  Watson’s best guess was “knee”, which has nothing to do with the second set (words that can mean “thief”) though it does have something to do with the first set (words that can mean the bend in the elbow).  The right answer was “crook”.

Watson seems to do superlatively well when there are unique phrases to be matched, i.e. when the clue contains phrases that are pertinent only to the answer and wouldn’t occur anywhere else.  Perhaps this is not surprising at all.

It’s possible Watson’s thought processes are a bunch of shortcuts completely unlike ours.  It may for example simply be finding a bunch of words and phrases based on associations with keyphrases in the clue and then ranking them.  Rather than searching for words/phrases in the sets that the clue is asking for.

Perhaps the right test is this: is it easy to add a subroutine to Watson that would allow it to rephrase the clue in several simpler English sentences?  I don’t know.  So I’m still unsure whether to call the creation of Watson a Singularity defining moment.

Nokia and Microsoft?!

Posted in Computers by Armchair Guy on February 11, 2011

Nokia, one of Open Source’s biggest advocates and sources of strength, has practically merged with Microsoft, Open Source’s biggest enemy and saboteur.  The agreement goes beyond simple cooperation.  Nokia is killing Meego, an important open source initiative.

This has been on the horizon for quite a while, ever since Nokia hired long-time Microsoft insider Elop as its CEO, and intensifying with a leaked internal memo Elop supposedly sent to Nokia employees.

This probably will help Nokia in the long run, but it fundamentally changes the company’s character.  This is a sellout by a biased CEO.  I was with Nokia so far, but I’m switching to Android as soon as I can.


I had a conversation yesterday that got me thinking, and the more I think about it, the more it seems to me that Elop was a Microsoft implant into Nokia, sent in for this very purpose.  Elop apparently made some noises about why he picked Windows over Android, but I doubt he ever considered Android.  The deal is hugely helpful for Microsoft, which was struggling to get anyone to show interest in Windows. It also seems vaguely helpful for Nokia, but it’s simply not commensurate.  Microsoft gets Navtec maps, various services, a ready-made phone distribution net, and a huge share of phone profits from Nokia at absolutely no cost to itself!  Nokia gives all this potentially revenue-generating stuff to Microsoft for free!  All Microsoft is doing is providing the already-developed Windows OS — and even that for a share of the profits!

Watson and the Singularity

Posted in Computers by Armchair Guy on February 9, 2011

The Singularity is a recurring theme in artificial intelligence and in science fiction.

It refers to an event where a computer achieves certain significant feats of intelligence.  Different authors use it slightly differently, or use different terms.  Sometimes the word means achieving “self-awareness” (whatever that is).  Sometimes it means the creation of a computer that is as smart as a human.  Sometimes it means the addition of a technology that results in a massive increase in ability (the new state is usually one of higher-than-human intelligence).  Some authors speak of multiple singularities — computers caught in an ever-rising spiral of super-intelligence.

The AI promises of the 1980s turned out to be too grand and ill-founded to be realistic.  People thought then that they could program intelligence by programming the minutiae of thought.  This turned out to be a vastly bigger task than anticipated.

For a while, it seemed there were things humans could do that computers would never be able to.  One of the biggest, and most visible, blows was Deep Blue’s defeat of Garry Kasparov.  Today, software (Rybka, Glaurung, Stockfish) running on the ordinary desktop computer will easily defeat the best human chess players.  But Deep Blue and its younger cousins don’t really have intelligence, at least not what we usually mean by it.  They’re “on-rails”, and can do very restricted things on very restricted input sets.

But all this doesn’t mean man-made intelligence is impossible.  Instead of programming intelligence, we can perhaps include techniques like evolving it or learning it.  Is that what Watson has done?

Watson is a massively parallel supercomputer, developed by IBM, that will participate on Jeopardy against Ken Jennings and Brad Rutter.  Watson can understand a variety of language nuances and sift through its massive database to attempt to find answers.  Given the diversity of subject matter as well as question phrasing on Jeopardy, this is quite a feat.  Does this qualify as intelligence?

It’s not clear to me how Watson works, but the bits I’ve gleaned indicate that it is a collection of a number of hand-written subroutines that interact in carefully human-tuned ways.  There’s no automated evolution or search of algorithms to try to make it better.  In that sense, it is still algorithmic, much like Deep Blue.  But Watson’s algorithm is much more complicated and chaotic than Deep Blue’s.  It sounds complex enough that I view it as a limited form of intelligence.

Perhaps we are hitting the first technological singularity, although it’s not the single explosive moment some have imagined.

Watson might have been a good learning experience — the engineers at IBM must have figured out a lot about how to make computers think.  But it still lacks the essential ingredient that sci-fi authors fantasize about.  We still don’t have automated techniques to take a given computer and make it better.  That is, we don’t know how to make computers improve other computers.  That would be the a real Singularity.

LaTeX Forward PDF Search with Emacs

Posted in Computers by Armchair Guy on November 15, 2010

I wrote a blog post on implementing inverse PDF search with okular and emacs here.  This post is about the reverse: forward search.  That is, with point at any position in the LaTeX source while editing in emacs, a keystroke causes okular to center the corresponding portion of the PDF in its viewable area. A nice overview of LaTeX synchronization can be found here.

In the comments on the inverse search post, B. Slade suggested the procedure at for forward search.  However, the instructions there require installation of AuCTeX version 11.86, while the latest version in the Ubuntu 10.04 repositories have is 11.85.

I managed to kludge a solution for the AuCTeX shipping with Ubuntu 10.04 by slightly modifying some emacs code I found here: Most of the work was already done by Mark Altern and earlier authors; the only change was to tell it to use the .pdf instead of the .dvi.

A note of caution.  Forward search with okular is not very convenient.  This is because okular redisplays the PDF document every time you do a forward search — with a side “contents” pane and also repositioning the PDF.  So if you’ve removed the space-hogging contents pane (by pressing F7 twice) and zoomed and positioned the PDF to your liking, doing a forward search will undo all of that.  You’ll have to remove the contents pane again and re-zoom and re-position.  This severely limits the usefulness of forward search.  There doesn’t seem to be a way around this for now.

Anyway, here are the steps.

  1. Follow instructions here to set up inverse search.
  2. Source for okular-search.el is at the end of this post.  Copy it and put it in a file called okular-search.el.
  3. In your .emacs file, add the following code:
    (add-to-list 'load-path "/path/to/okular-search.el")
    (require 'okular-search)
    (add-hook 'LaTeX-mode-hook (lambda () (local-set-key "\C-x\C-j" 'okular-jump-to-line)))
    (add-hook 'tex-mode-hook (lambda () (local-set-key "\C-x\C-j" 'okular-jump-to-line)))

That’s it. Press C-x C-j to open a new okular viewing window. Subsequent presses of C-x C-j will reposition the PDF in that okular window to correspond to whatever’s at point in emacs.

Here’s the code for okular-search.el:

;;; (X)Emacs frontend to forward search with kdvi. See the section on
;;; FORWARD SEARCH in the kdvi manual for more information on forward
;;; search, and for an explanation how to use this script. This script
;;; is a modified version of the script "xdvi-search.el" by Stefan
;;; Ulrich, version 2000/03/13. The
;;; modifications were performed by Stefan Kebekus
;;; . Tested with Emacs 20.7.1 and Xemacs 21.4.
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 2 of the
;;; License, or (at your option) any later version.
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
;;; 02110-1301, USA.
;;; Please report bugs or improvements, etc. via the "Report bug"-Menu
;;; of okular.

(defvar okular-script "okular"
  "*Name of start script for okular.")

(defun okular-jump-to-line ()
  "Call okular-script to perform a `forward search' for current file and line number.
See contents of okular-script for details.
If AucTeX is used, the value of TeX-master-file is used as filename
for the master .dvi file; else, the return value of okular-master-file-name
is used (which see)."
      (beginning-of-line 1)
      (let* (;;; current line in file, as found in the documentation
	     ;;; of emacs. Slightly non-intuitive.
	     (current-line (format "%d" (+ 1 (count-lines (point-min) (point)))))
	     ;;; name of the `main' .tex file, which is also used as .dvi basename:
	     (master-file (expand-file-name (if (fboundp 'TeX-master-file)
					     (TeX-master-file t)
					   (okular-get-masterfile (okular-master-file-name)))))
	     ;;; .dvi file name:
	     (pdf-file (concat (file-name-sans-extension master-file) ".pdf"))
	     ;;; current source file name.
	     (filename (expand-file-name (buffer-file-name))))
	(start-process "okular"
		       "okular-output" "okular" ;;; src-args
		      ;;; args for -sourceposition:
		       "--unique" (concat "file:" pdf-file "#src:" current-line filename)

(defun okular-get-masterfile (file)
  "Small helper function for AucTeX compatibility.
Converts the special value t that TeX-master might be set to
into a real file name."
  (if (eq file t)

(defun okular-master-file-name ()
  "Emulate AucTeX's TeX-master-file function.
Partly copied from tex.el's TeX-master-file and TeX-add-local-master."
  (if (boundp 'TeX-master)
    (let ((master-file (read-file-name "Master file (default this file): ")))
      (if (y-or-n-p "Save info as local variable? ")
	    (goto-char (point-max))
	    (if (re-search-backward "^\\([^\n]+\\)Local Variables:" nil t)
		(let* ((prefix (if (match-beginning 1)
				   (buffer-substring (match-beginning 1) (match-end 1))
		      (start (point)))
		  (re-search-forward (regexp-quote (concat prefix "End:")) nil t)
		  (if (re-search-backward (regexp-quote (concat prefix "TeX-master")) start t)
		      ;;; if TeX-master line exists already, replace it
			(beginning-of-line 1)
			(kill-line 1))
		    (beginning-of-line 1))
		  (insert prefix "TeX-master: " (prin1-to-string master-file) "\n"))
	      (insert "\n%%% Local Variables: "
;;; mode is of little use without AucTeX ...
;;;		      "\n%%% mode: " (substring (symbol-name major-mode) 0 -5)
		      "\n%%% TeX-master: " (prin1-to-string master-file)
		      "\n%%% End: \n"))
	    (message "(local variables written.)"))
	(message "(nothing written.)"))
      (set (make-local-variable 'TeX-master) master-file))))

(provide 'okular-search)

LaTeX Inverse PDF Search with Emacs

Posted in Computers by Armchair Guy on September 2, 2010

Latex is such a time hog that I’m always in search of ways to improve my efficiency. My editor of choice is emacs. I’ve tried other editors but it usually turns out that there is some “tail” feature that I can’t find in any other editor. By “tail” feature I mean a feature that is used either very rarely or by very few people.

I’ve tried LyX, which is described as a WYSIWYM (What You See Is What You Mean) editor. It’s actually quite brilliant, and I do use it for simple MS Word-style documents. I’d use it in conjunction with emacs, switching back and forth between LyX and LaTeX source code editing, if it were not for the fact that it messes up LaTeX source code big time (all source code formatting is lost, making it pretty unreadable).

So I stick to emacs. One of the problems with a non-WYSIWYG editor for a language like LaTeX is it is hard to spot what you’re looking at. If you’re looking at a PDF file, it’s really hard to find the tex code that corresponds to what you’re seeing in the PDF. This is where Inverse PDF Search comes in.

What inverse PDF search does is allow you to click on a location in the PDF file and be transported to the corresponding spot in the LaTeX source. I find this tremendously useful.

Under Ubuntu 10.04 “Lucid Lynx”, this works almost out of the box, with a little bit of work. Here are the steps.

  1. First, install Okular, the KDE PDF viewer. This may require a huge number of KDE libraries. Evince is nice but doesn’t support inverse PDF search yet.
  2. In okular, go to Settings > Configure Okular > Editor and change the editor to “emacs client”, and the command to “emacsclient -a emacs –no-wait +%l %f“.
  3. Make sure you have Emacs 23. This is the default in Ubuntu 10.04.
  4. We have to start emacs in server mode so that okular can talk to it. Add this line somewhere in your .emacs file: (server-start) The next time emacs is started, it will be in server mode.
  5. When emacs compiles using latex, it has to include “source specials”. Roughly, this is an index connecting every position in the PDF file to a line number in the source file. To create the index, a latex package called synctex must be installed. Under Ubuntu 10.04 this is included in the package texlive-extra-utils, so make sure that’s installed.
  6. To tell emacs to always use PDF (i.e. compile with pdflatex instead of latex) insert the line (add-hook ‘LaTeX-mode-hook ‘TeX-PDF-mode) into your .emacs.  This step is optional if you don’t want to automatically pick PDF each time, but everything in this post pertains to PDF.
  7. Tell emacs to compile using source specials by adding the following line to your .emacs: ‘(LaTeX-command “latex -synctex=1”) Alternatively, when editing a tex file, go to the menu LaTeX > Customize AUCTeX > Extend this menu; then LaTeX > Customize AUCTeX > TeX Command > LaTeX Command, then change “latex” to “latex -synctex=1” and click “Save for future sessions”.
  8. To tell emacs/AUCTeX to use okular rather than evince, add the following to .emacs: ‘(TeX-output-view-style ‘((“^pdf$” “.” “okular %s.pdf”))).  Alternatively, this can be done through the customization menu LaTeX > Customize AUCTeX > Extend this menu; then LaTeX > Customize AUCTeX > TeX Command > TeX Output View Style and change evince %o %(outpage) to okular %o %(outpage).  Click “Save for future sessions”.

When you restart emacs and use AUCTeX to compile under PDF (using C-c C-c), it should compile with source specials.  (You can manually compile with source specials using the command pdflatex -synctex=1 filename.tex at the command line, but it’s easier to use AUCTeX from emacs.) After compilation is done, the AUCTeX view command (also using C-c C-c) should start up okular. To use inverse search, Shift+Left Click on a position in the PDF file in okular. The cursor should jump to the corresponding line in emacs.

Note. It’s possible to omit step 7 and instead insert \usepackage{pdfsync} in the preamble of the TeX file.  This uses pdfsync, which is older than synctex.  But this has two drawbacks.  First, your LaTeX source file is now less portable (if you send it to someone without the pdfsync style file).  Second, the accuracy of the source specials generated using this method is atrocious: Shift+Left Click only places you in the general vicinity of the point you’re looking for, may be 15 or 20 lines above or below, and worst of all, is not even monotone (you click a later spot on the PDF, you might jump to an earlier spot in the source).  Using step 7 is much better.

On-Screen Reading with Comprehension

Posted in Computers by Armchair Guy on June 6, 2010

Reading on paper is something most of us grew up with.  It’s possible coming generations will have more memories of growing up reading on a computer screen.  Perhaps static text and non-interactive content will feel archaic to many of them.  But for the generation that grew up holding real paper in their hands, reading a real book or a printout is much easier than reading on a computer screen.

I come to that conclusion because most people I’ve spoken to express in some way that they’re more comfortable with paper than with the screen.  Some feel they cannot read technical articles with full comprehension, or perhaps with equal comprehension, on a computer screen. Some say that fiction just isn’t as much fun on a computer screen. (I don’t know anyone who owns an e-reader; so I may be using a poor comparison on fiction.)

What could the reasons be?

Several people comment on the feeling of holding a book, and how that just feels satisfying.  Others simply say it has to do with comprehension.  I have a few theories:

  1. How you got your start might have something to do with what you enjoy the most.  If you are accustomed to physical paper, that might affect your enjoyment.
  2. I think it’s possible that vertical text is harder to read with comprehension than horizontal text; most screens are vertical.
  3. For technical reading, the ability to flip back and forth for quick comparison, quickly search by flipping through several pages, rapidly access specific parts of a book (beginning, middle, end, about 10 pages back, etc.) all contribute to making it easier.  I would’ve thought these functions are not too hard to implement ergonomically on reading program, but there’s a whole lot of things you can do.  It might be hard to make them all available through a GUI.
  4. To some extent, memory is assisted by connecting content with position.  For example, I often remember whether a formula in a book is on the left or right side, whether it’s closer to the beginning or the end.  It’s said that this is a bad habit and does the memory no good (hey — my memory really isn’t that good!).  In any case, that feeling of knowing where you are “on a map” — the physical location on the book — is completely lost when reading on a screen.  It’s possible to know by looking at the scrollbar, but that doesn’t give me the same sense of knowing where I am.

Emacs: reposition paragraph after justify

Posted in Computers by Armchair Guy on October 11, 2009

Emacs’ justify (fill-paragraph, usually bound to the key M-q) has one bit of behaviour that annoys me.  I prefer horizontal scrolling to breaking long lines.  If I type a long line that goes off the edge of the current emacs window, emacs will scroll left as expected.  If I then hit M-q, the paragraph gets justified.  So far so good.  But after justification the lines remain left-scrolled, so that I can’t see the beginning of the lines even if they are now small enough to fit in the emacs window.  I have to hit C-a C-e or something like that to re-scroll the text sideways.

The fix is simple: remap M-q to fill-paragraph, scroll-right instead of just fill-paragraph.  Scroll-right is smart and won’t scroll right if the window is so narrow that, even after fill-paragraph, the line doesn’t fit in the window.  This is exactly what I want.  I inserted the following code into my .emacs:

;; Automatically scroll-right after justification
(global-set-key (kbd “M-q”) (lambda () (interactive) (fill-paragraph nil) (scroll-right)))

LaTeX Auto-Preview

Posted in Computers by Armchair Guy on September 24, 2009


It never ceases to amaze me that one or two brilliant people working by themselves can sometimes invent something that is so far superior to a professional piece of software produced by a behemoth like Microsoft.  Knuth created TeX, Leslie Lamport evolved it by creating LaTeX, and we keep getting huge improvements (like PGF/TiKZ) from time to time.  I find myself very grateful for some of the other things available for LaTeX, one of the most important being auto-preview.

There are three main auto-preview methods for LaTeX while editing under emacs.  These are collected at

WhizzyTeX is the most evolved.  It continuously updates a separate dvi-preview window as you type in emacs, and also positions the dvi preview at the point where you are editing.  The biggest problem with whizzytex is that it doesn’t understand newer packages like PGF/TiKZ which directly compile to PDF using pdflatex.  Such documents don’t compile to DVI at all, so whizzytex is no good here.

LaTeXMk is essentially a ‘make’ for LaTeX but it can auto-update every time you save.  So it won’t update continuously but will refresh as soon as you save (C-x C-s) under emacs.  This will also work with any other editor; it follows filesystem level changes to the file.  But:

  • It does not position the pdf viewer at the point you edited; you have to keep doing this yourself.
  • When there’s an error in compiling LaTeX code,  LaTeXMk calls LaTeX, which stops on the error.  You have to manually go into the LaTeXMk window and quit LaTeX for it to continue. (Correcting the error within emacs isn’t enough.)

Rubber appears to be similar to LaTeXMk.  I’ll update once I’ve given it a whirl…

Other that these, there are some What You See Is What You Mean programs like Lyx and Scientific Workplace (commercial).  Both are excellent, but sometimes it’s hard for me to get used to the lack of control.

Backup (Part III)

Posted in Computers by Armchair Guy on August 21, 2009

As I keep using computers, I keep changing my backup requirements. I’m a fairly simple user: I have one laptop (with three partitions), one desktop (with 3 partitions), and one external hard drive (with one partition) that I need backed up. I back up everything to another external hard drive. I started off with lofty industrial-strength backup ideas. The backup drive had to be on my LAN, always accessible from any computer, and available to anyone on my LAN with a password. (It was a pain to administer and quite slow to transmit data, so I gave that idea up.) I needed industrial strength encryption and versioning. And so on. I even wrote two posts on this: Backup and Backup (Part II).

At first I was using a tool called dar. It had all sorts of features, but its main problem was it used its own data format. This made it very hard to access my archives. Then I switched to Sbackup. This was a bit simpler, but stored the backups in tarred and gzipped files. I thought this would be accessible enough, but when your .tgz file is 60 gigabytes, it’s a major chore to unzip it just to see the contents! I think the rar format solves this problem somewhat. It maintains indexes so that to access the table of contents or to extract any particular file in a rar archive you don’t need to unrar the whole thing. But I think I’ve finally decided that I’m not that interested in compression or encryption or any of that fancy stuff. So I’ve switched to a lightweight tool called rdiff-backup.

rdiff-backup stores an identical copy of a directory on the backup drive. No unzipping, no decrypting; the files are all there for you to see. Every time you run a backup rdiff-backup stores a reverse incremental diff. This means that the backup looks like a mirror of your latest version, but some additional info is stored so you can retrieve an earlier version if you need to.  Plus, it’s super easy to use.  I just run one small script (for each computer) that basically checks to see whether the backup hdd is connected, then runs rdiff-backup for each directory I want backed up.

Pros: Super-simple, super-fast, has a sort of versioning system, your latest version is immediately accessible.
Cons: Unsecure, takes a lot of space because of no compression, no stable gui frontend for rdiff-backup yet.

Ubuntu 9.04

Posted in Computers by Armchair Guy on May 26, 2009


It’s been almost a month since Ubuntu 9.04 has been released.  I perfer not to install OSs immediately because they’re likely to have all kinds of bugs, but it’s time to upgrade now.

My main reasons for upgrading are a bunch of small but persistent and annoying bugs in my 8.10 install: gnome application window contents get garbled while scrolling and need a refresh (e.g. minimize and maximize again) to work, sound crashes frequently and needs rebooting to be brought back, gnome-terminal’s select-to-copy-to-clipboard wasn’t working, I wanted hibernate to be much more stable, poor sound quality issues with skype, and some quirky window size behaviour (windows would edge onto other workspaces by themselves), synaptic’s broken search (existing packages wouldn’t show up in searches), logout crashing X,  etc.

I’m going to write about my upgrade/reinstall experiences here.  My laptop is a Lenovo T61 with 3 gigs of RAM, an nVidia Quadro NVS 140M and Intel Corporation PRO/Wireless 4965 AG network card.

Upgrade This didn’t work at all for me.  I first got a “Not all updates can be installed” message from update-manager, and when I tried to go ahead anyway, I got a peculiar “Could not calculate upgrade” message and the upgrader quit.  It may be because I have some non-standard repositories and packages (like KDE 3.5).

Installation Before installing, I used

dpkg --get-selections > packages.txt

to keep a record of all the packages I had in my previous install. I also copied


to an external drive so I’d remember the sources I got those packages from. During installation, a minor problem with manual partitioning: clicking “Forward” and then “Back” in the Ubuntu installer causes it to forget all partitioner settings.  It’s also very slow to set up mount points.  The next irritant was the message “There were no users or operating systems suitable for importing from”, even though there was an Ubuntu 8.10 which the installer did recognize. Next, I still think Ubuntu should warn about the special status of the first user (who has sudo privileges), so that people can choose an appropriate username.  (I prefer to call this account admin, and avoid using it on a regular basis.) Other than that, it was pretty simple, taking only a short while to install the basics. One very awesome thing about installing from the live CD is you can use the computer during installation.

Reusing home directories I reused my old home partition when installing.  I renamed my old home directories temporarily and created all my usual user accounts (making sure the userids didn’t change from my previous install).  Then I renamed all the accounts back to what they were originally.  Although the accounts weren’t imported during install, I could log into any of the accounts after this and it was as if they had been imported and I could pick up where I left off.  No problems so far.  Every app I tried has simply picked up where it left off on the 8.10 installation.  And that includes all the apps I installed under Wine.

Restoring Packages I tried to restore packages using

dpkg --set-selections <packages.txt

and then

apt-get dselect-upgrade

to get back all the packages I had on 8.10. This didn’t work very well. apt-get wanted to uninstall about 110 packages I wanted in addition to installing the 1400 or so packages I asked it to. Some of those 110 packages were things like compiz, which I definitely wanted. Luckily, it displayed the list of 110 packages and asked whether to proceed. I tried various things and finally kept a record of those 110 packages and proceeded. After that was done I asked it to install those 110 packages again. That worked.

Skype This time around, Skype isn’t part of the repositories.  However, the old package can be downloaded from the Skype website and installed. I haven’t yet tested the sound quality issues.

X Logging out of the current account doesn’t simply blank the screen as it did on 8.10.  You get back to the default login screen.  Update 1: The X system feels a little more stable and responsive than 8.10.

Hibernate This still works out-of-the-box, but it seems the same as in 8.10: garbled screens and loud beeps before the session is restored.  Slow.  But it does work.

Suspend Suspend works beautifully.  I’m not sure how much power is consumed in suspend mode, and I’m still pretty apprehensive about putting a suspended laptop in a backpack for worry that it’ll overheat.  But my laptop suspends and resumes without a hitch in about 5 seconds.

Garbled Apps This one is important to me: 9.10 seems to have none of the scrolling-garbles-screen problems that were rife in 8.10.

Sound So far sound seems better than in 8.10.  It appears to crash less frequently.  But I did experience one sound crash that needed a reboot, so the problems are not gone.  Ah, I yearn for the good old 7.10 days!

I found a fix of sorts for this problem in this thread; it seems to work in my configuration.  The idea is to first close all applications that are using sound (discovered with “lsof | grep pcm”) and then restart sound using “sudo /etc/init.d/alsa-utils restart”.

Overview/Conclusion So far, my 9.04 installation is practically a clone of my previous 8.10 installation.  There’s very little here that feels new.  Even the much-vaunted “polish” just boils down to a glossier login screen background and a bit of mouse movement tweaking.  Everything seems to work as expected.  Whether the annoyances I had are now fixed, I’m not sure: those bugs weren’t always easy to reproduce. A few days in now; 9.04 does feel somewhat more stable and polished than 8.10.

Ubuntu and Whizzytex

Posted in Computers by Armchair Guy on February 9, 2009

I have an earlier post in which I pointed out that whizzytex was causing emacs to freeze intermittently.  After a lot of searching and a bit of system tool use (specifically, iotop) I think I’ve pinpointed the problem (but not solved it yet).

It looks like the problem is not with Whizzytex at all, but related to known a known bug in Firefox and/or Tracker and/or Google Desktop.  Or maybe something about the way fsync() and kjournald interact.  These programs access disk a lot, which is what was causing the delays.  Apparently this is compounded because Firefox 3 issues a large number of calls to fsync(), which in turn causes kjournald and pdflush to activate on a regular basis.  This is what sometimes ties up the disk for a second or two.

A potential solution is to tell firefox to do asynchronous updation of history and bookmarks, and use a ramdisk for the Firefox cache.  I tried this and also disabled tracker and gdl_indexer indexing, but I’m not sure it’s helping yet.

Update (Feb 25, 2009):

Fixed!  I am fairly sure that google desktop was one of the factors behind the annoying slowdowns.  I am not sure which (if any) of the other issues (firefox and tracker) was responsible.  But if I disable all three, I don’t see the delays any more.  I’ve been freeze-free for about 3 weeks now!  I like google desktop, so I simply disable indexing before starting whizzytex and re-enable it after.

Ubuntu 8.10: Love and Hate

Posted in Computers by Armchair Guy on December 10, 2008

ubuntu-logo-810I decided to quit being obsolete and upgraded from Ubuntu 7.10 to 8.10.  8.10, aka Intrepid Ibex, is not a long term support version and most reviews I read said it didn’t really make waves over 8.04, but then I was upgrading from 7.10, Gutsy Gibbon.  I expected it to make waves for me!  Indeed there were a lot of extremely useful things Intrepid does better than Gutsy.  Frustratingly, it also breaks a lot of things that were already good in Gutsy.  Here’s a kind of review with some details under various headings.  My installation is on a Lenovo T61 with an nvidia 140m card.

Things I’ve Dealt With So Far

Installation. The first thing I tried was to upgrade from Gutsy to Hardy (i.e. 8.04), planning a further upgrade to Intrepid.  BIG MISTAKE.  The upgrade took 3 hours (I do have a lot of packages), did a hotch-potch job, didn’t update the boot manager GRUB, and broke X completely (nvidia 140m wasn’t recognized after reboot, installing proprietary drivers didn’t help either).  At this point I gave up on upgrading since I was only interested in Intrepid Ibex anyway.  I installed Intrepid from a CD, the install was trivially simple but with a couple of scary moments:

  1. Selecting manual partitioning, the install GUI makes it look like everything will be wiped from the disk (based on the before and after pictures).  It doesn’t actually do this, but I was very nervous clicking “Forward”.
  2. In the partitioner, while editing a partition the dialog should tell you which partition you are actually editing.
  3. As usual, it doesn’t mention that the first user has a special status (Administrator but not root) on the install.  I’d rather not have sudo privileges for my usual login; I call this user “admin”.  The installer should warn about this.
  4. It asked me whether I wanted to import previous accounts, but didn’t display any information on what it would actually do!  I was planning to use a home directory with a lot of info already in it and didn’t want to take any risks, so I had to skip this and set up other accounts manually (even though maybe Intrepid could’ve done this automatically).

GRUB. Intrepid seemed to recognize all the other operating systems on my computer properly and put them into GRUB.

Bootup. Bootup is fast.  One common problem before was routine disk checking (fdisk).  This can really slow down bootup at times when you are in a hurry, you want to postpone and move on.  Intrepid does two nice things: first, it shows the disk check progress in the splash screen rather than the console, and it allows you to press Esc to postpone it to next time.

Network Manager. This program always gives me trouble, and this time was no different.  It doesn’t always come up on the non-admin accounts; sometimes I have to manually invoke nm-applet.

Nvidia Proprietary Driver. As soon as you login you get the option of installing the proprietary Nvidia graphics driver which provides 3D acceleration.  This is a pretty useful driver.  But the driver installer had an annoying glitch: I kept clicking on “activate” and it would bring up a dialog of some sort that disappeared immediately, and do nothing.  On the 5th or 6th try it suddenly worked and activated the proprietary driver.  No more trouble after that.

Fonts. Operating system fonts look even more awesome than before all round.  UNTIL you install the Nvidia proprietary driver, after which they’re ok but not that awesome.  Firefox fonts, on the other hand, are a different story.

Firefox. Intrepid installed Firefox 3.0.4. Works as expected, nothing new here, except a couple of weird things:

  1. Fonts in Firefox are awfully ugly.  (The rendered fonts, not the ones on the menubar etc.)  Maybe this is because all the websites want to use Microsoft fonts, I don’t know.  I fixed it by going to Edit -> Preferences -> Content -> Advanced and unchecking “Allow web pages to choose their own fonts…”.
  2. While trying to get fonts in Firefox to work, I moved my .mozilla folder to .mozilla.old and then back.  Somehow Firefox went and deleted everything in those folders, including bookmarks, customizations and history for 4 profiles.  I have to start with a blank slate now.  I’m probably to blame as well, but Firefox shouldn’t just delete everything without asking.
  3. Firefox hangs occasionally while exiting.  When it does this, it forgets all tabs that were open.  This is really problematic. Intrepid has X.Org 7.4.

  1. The big deal with X.Org 7.4 is its hotplug support, of which I am already an extremely grateful beneficiary: I can now dock and undock my computer from the Lenovo mini-dock.  AWESOME!  Before, the only solution was to restart the X server after docking or undocking (using Ctrl-Alt-Backspace).  The freedom to move about with my laptop is so liberating I feel like I lost 5 lbs and have improved lung capacity.
  2. But on the downside, the new server is glitchy. Once I’ve logged in to any account, I can’t log out.  Logging out simply blanks the screen.  Even Ctrl-Alt-Backspace doesn’t seem to restart the X server.  Sometimes I get a weird message saying my video card isn’t recognized.  Sometimes I’m just dropped to the console, without a shell.  All I can do at that stage is Ctrl-Alt-Del to reboot.  If I try to switch users instead of logging out, I sometimes don’t get a taskbar or panel after switching.
  3. Intrepid changes the keycodes for X, creating a whole host of problems for software relying on the keycodes.  One of the affected programs is DosBox, which no longer recognizes the arrow keys correctly.  (Fortunately the fix for DosBox is simple: insert the lines

    into a file called .dosboxrc in the home directory and restart dosbox.)

xmodmap. I used xmodmap to switch Caps Lock and Ctrl to help avoid RSI.  Previously Ubuntu recognized this switch as soon as I put a .Xmodmap file in my home directory.  It’s stopped doing this, but it’s fairly simply to get Ubuntu to do this every time my session starts up.  Supposedly the X keycode reassignment also creates problems with xmodmap, but I don’t use keycodes so I’m ok so far.

User Management. Some glitches in the GUI tool:

  1. Say you’re trying to add a new user whose home directory already exists, from a previous installation.  It won’t let you do it!  The error message is that the home directory already exists.  There should be a follow up action: create user anyway, or no, thanks.
  2. Say you’re trying to add someone to a group.  The user manager gives you a list of users you can add to the group but only displays the full name of the users (not their usernames).  So if two people have the same name, it’s impossible to tell who you’re adding to the group!

Konqueror. This was the most unkindest cut of all.  I loved Konqueror 3. Even though I don’t use Kubuntu, I still used Konqueror as my main file browser; I think it’s much more functional than Nautilus. But Intrepid has Konqueror 4.1.2, a horrifically amputated version of the heroic Konqueror 3 which could do almost anything.  Now:

  1. There is no Create Folder item in the right-click menu.
  2. There is no folder tree view (I think).  Folders can’t be expanded by default (the little (+/-) beside the icon is missing) — although after some digging I could enable it via Settings -> Configure Konqueror -> Views and checking Expandable Folders.  But I have to do this every time I start Konqueror.  There doesn’t seem to be a way to save this setting.
  3. When viewing an image, it doesn’t show icons for the next and previous picture in the folder.  Clicking the “Previous” button after viewing an image takes you back, but it forgets where in the directory hierarchy you were — so you have to click a series of (+) symbols to re-open your directory.  So Konqueror can no longer be used as an image viewer.

Why did they do this to Konqueror?  They should rename it Konquered.  Update: after some intensive google searching, I found out how to install KDE 3 under Intrepid.  It seems a little quirky, but it does have a version of Konqueror I can live with.

Hibernate. This is one of the two changes I’m excited about, one of the reasons why I wouldn’t consider going back to an earlier version of Ubuntu.  It appears as if Hibernate actually works out of the box on the Lenovo T61.  I’m not sure whether it worked on Ubuntu 8.04, but this is a feature I’ve been craving for at least 3 years.  There are problems with hibernate:

  1. It is extremely slow (takes much longer than rebooting)
  2. When it comes back, it first garbles the screen and beeps loudly (twice), which means I better not bring the laptop out of hibernation during a meeting.
  3. It doesn’t feel like real hibernate — I get the feeling it’s loading a bunch of libraries which it wouldn’t have to do if restoring the computer state.  It feels like it hibernates individual running applications.
  4. When it comes back it forgets about my multiple desktop placement and dumps all my apps onto one desktop (another reason I say this isn’t real hibernate).  This is related to problematic interactions between Compiz’s workspace switcher configuration and Metacity’s.

I also haven’t played with it enough to know whether it’s otherwise stable, but no problems so far.

Update-manager. Can’t run update-manager from a root console anymore.

Skype. This very important application is barely usable anymore.  It may have something to do with the use of the new Pulseaudio audio server.  The person at the other side hears me barely or not at all, often with an echo.  Skype used to work fine with 7.10.  OTOH, I can now video-conference with Skype!

Printing. I can’t seem to print in landscape mode any more.  I’ve encountered this problem so far with evince and Adobe Acrobat Reader 8.  The application’s “landscape” option shows up properly in the print preview.  But when I actually try to print it prints wide without rotating, with the result that only the leftmost 2/3 or so of the page is visible on paper.  This is almost a dealbreaker; there were no such problems with 7.10.

Sound. This is one of the more troublesome parts of Intrepid.  I think it has something to do with the introduction of PulseAudio as a sound… server?  I know very little about how sound works under Ubuntu,  but whatever it is, it keeps crashing repeatedly.  At least once a day.  There is no sound after the crash, with various applications complaining that they can’t initialize sound.  The only way to fix it if I do need sound seems to be to reboot.  Skype sound quality also seems affected, though I’m not yet sure Ubuntu’s sound is to blame.

Untested Features I’m Excited About

USB Boot Disk. Nifty new feature; you can write your installation to a USB drive and boot off it on any other computer, thus taking your entire setup with you whereever you go.

Microsoft and Evangelism

Posted in Computers by Armchair Guy on November 9, 2008

What does Microsoft have to do with Christian churches?

Nothing, except that they both exhibit a certain behaviour: aggressive evangelism. Both operate in ways that tend to reduce freedom of choice and make it hard for people to choose alternatives. Their behaviour on this count is similar because their motivations are similar. Both wish to monopolize society.

When Google became popular in search, Microsoft tried to beat Google at search. When Google began its mail service, Microsoft tried to beat Google at mail. When Google began getting into maps, books, Microsoft put some serious effort into the same fields. This is reminiscent of church planting in Indian villages.

When a Hindu temple undertakes a major activity that might get people interested (such as renovation of a temple or appointment of a new priest), Christian organizations often rush to plant a church and engage in a publicity and incentive blitz to attract villagers.

Microsoft has been doing the same thing in the tech domain. If there’s any tech development that attracts people, Microsoft tries to enter it in a big way in order to attract customers to the Microsoft fold.

Both Microsoft and church have practically unlimited financial resources compared to their competitors, and both are extremely resistant to the existence of alternatives.

It’s no secret that I’m on the side of Freedom here: freedom as in free software, and freedom of religion. Makes me wonder: do Microsoft vs. open source and evangelism vs. freedom of religion have the same solution?

Tagged with:

Automatically Inserting Matching Parentheses for LaTeX in Emacs

Posted in Computers by Armchair Guy on November 1, 2008

My use of emacs varies, but a good chunk of my time is spent writing in LaTeX for mathematical formulae. AuCTeX simplifies my life quite a bit, and whizzytex makes it awesome. But one feature that would really save me some typing is auto-completion of matching parenthetical symbols. In LaTeX, such matching delimiter pairs are $$, [], {}, \{\}, \left\{\right\}, \left(\right), etc. I found a major mode called Ultratex that does exactly this (and much more), but unfortunately it replaces AuCTeX rather than augment it, and isn’t maintained any more.

Here’s some trivial emacs lisp code for a minor mode that accomplishes this. You can easily modify it yourself to add or remove simple matching completions. You can put it directly in your .emacs file, or in a file called dlmins.el, and add the line

(load "/path/to/dlmins.el" t t)

to load it. If you want this to be activated every time LaTeX is fired up, put the following line in your .emacs file:

(add-hook 'LaTeX-mode-hook 'dlmins-mode)

To toggle the mode manually, use command M-x dlmins-mode. Here’s the code for the minor mode.

;;; dlmins.el -- Trivial minor mode to insert matching LaTeX
;;; delimiters automatically.
;; Copyright (c) 2008 Rajeev Ayyagari

;; Author:   Rajeev Ayyagari
;; Keywords: Parenthesis matching
;; Version:  0.01 of Sat Nov  1 11:22:44 EDT 2008

;; This file is not part of GNU Emacs.

;; Minor mode: dlmins-mode
;; Entering a left-parenthetical symbol causes the corresponding
;; right-parenthetical symbol to be inserted automatically, and point
;; is positioned appropriately.
;; To use, place this code in a file called dlmins.el and add the line
;; (load "/path/to/dlmins.el" t t)
;; to your .emacs.  To make the mode start automatically when a latex
;; document is opened, add the line
;; (add-hook 'LaTeX-mode-hook 'dlmins-mode)
;; to your .emacs after the above "load" line. Manually toggle (enable
;; or disable) the mode using M-x dlmins-mode.

;; Set up keymaps and list of delimiter pairs.
(defun dlmins-setup ()
 "Initialize delimiter auto-insertion."
 ;; Order matters in the list below!
 ;; The rule is if STR2 is a suffix of STR1, then STR2 should come
 ;; after STR1.
 (setq dlmins-dlm-list
  ("\\left\\{" "\\right\\}")
  ("\\{"       "\\}")
  ("\\frac{"   "}{}")
  ("{"         "}")
  ("\\left("   "\\right)")
  ("("         ")")
  ("\\left\\|" "\\right\\|")
  ("\\|"       "\\|")
  ("|"         "|")
  ("\\left|"   "\\right|")
  ("\\left["   "\\right]")
  ("["         "]")
  ("$"         "$")
 (define-key (current-local-map) (kbd "{") (lambda () (interactive) (insert "{") (dlmins-pair)))
 (define-key (current-local-map) (kbd "[") (lambda () (interactive) (insert "[") (dlmins-pair)))
 (define-key (current-local-map) (kbd "(") (lambda () (interactive) (insert "(") (dlmins-pair)))
 (define-key (current-local-map) (kbd "$") (lambda () (interactive) (insert "$") (dlmins-pair)))
 (define-key (current-local-map) (kbd "|") (lambda () (interactive) (insert "|") (dlmins-pair))))
;; Called when left delim is typed, finds and inserts appropriate
;; right delim.
(defun dlmins-pair ()
 "This should be called as soon as an opening delimiter has been typed.
  When called, looks backward to see which delimiter has just been typed.
  It inserts the matching closing delimiter.
  Eventually it will be smart enough to take care of \left and \right as well."
 (catch 'getout
    (lambda (dlm)
      "If expression before point matches open dlm, insert close dlm."
      (if (looking-back (regexp-quote (car dlm)))
     (insert (car (cdr dlm)))
     (throw 'getout nil))))
;; Toggle the parenthesis matching mode
(define-minor-mode dlmins-mode
 "Minor mode LaTeX matching delimiter auto-insertion. use
 \"dlmins-mode\" to toggle."
 :init-value nil
 :lighter " DlmIns"
 :keymap '()

Open Source versus Innovation?

Posted in Computers by Armchair Guy on October 9, 2008

I’m reading The World is Flat by Thomas Friedman, and he asks a question about open source that really made me think. What is the motivation for innovation if everybody gives their innovations away for free and nobody gets paid for their innovations, which is what open source seems to suggest?

I don’t have a good answer, but it seems to work. As Friedman himself points out, many important innovations have come out of open source, including the Apache web browser. I would go so far as to say that most innovations in the field have come from not-for-profit efforts. Google’s entire search infrastructure runs on Linux; Amazon’s entire web presence runs on Apache. It’s as real as it gets.

The question is tied to (and perhaps motivated by) statements from Microsoft bigwigs. Here is one that Friedman quotes (the inserts are his):

You need capitalism [to drive innovation.] To have [a movement] that says innovation does not deserve an economic reward is contrary to where the world is going. When I talk to the Chinese, they dream of starting a company. They are not thinking, ‘I will be a barber during the day and do free software at night.’… When you have a security crisis in your [software] system, you don’t want to say, `Where is the guy in the barbershop?’ — Bill Gates

But Bill Gates is hardly in a position to talk of innovation. Microsoft has not made any significant technical innovations in the last 10 years. Windows Vista’s UI is (feature-wise) just a bloated version of Windows 95, with some bling. Microsoft’s innovations are almost entirely on the business end: it has figured out effective ways to stifle innovation by competitors. So Bill Gates talking about what drives innovation is like a thief lecturing about honesty.

Gates’ comment about security is even more perplexing in light of the extensively poor track record Microsoft has in security. Open source alternatives are far more secure in every way than anything Microsoft has. Maybe the reason you don’t want the guy in the barbershop is if you know there’s something wrong with the security, it’s probably the Microsoft guy who’s responsible.

But what Gates says is not really relevant here. None of this actually answers the question: how can you justify, theoretically, the claim that innovation can be sustainably executed within Open Source frameworks?

I don’t have a good answer.

Tagged with: ,