Thursday, December 17, 2009

Performance gains in chair, not in computer

I've been utilizing Crunchbang's keyboard shortcut ability (any distro should have this ability), and I am convinced that it has sped up the way I use my laptop more than any performance enhancement I've ever done. 

It makes so much sense; I don't know why I didn't start using keyboard shortcuts sooner.  I probably just figured that it would be too much trouble to set up and then try to remember what keys launch which applications, but I generally only run a handful of applications, things such as Firefox, PCManFM, Liferea, and Zim, so there really isn't that much mental overhead.

If you're worried about overhead, consider what you are going through when lauching an application without keyboard shortcuts:
  1. Place hand on mouse
  2. Move mouse to menu and click on it
  3. Find the appropriate sub-menu (in most cases)
  4. Navigate to the appropriate sub-menu and click
  5. Repeat steps 3 and 4 until the actual application launcher is reached
  6. Click the item
  7. Wait for the application to launch
  8. Decide whether you want to use the keyboard or mouse
  9. Return your hand to the keyboard or move it to the mouse as appropriate

That is an aweful lot of mental and physical overhead, when you could just do a Super-W to launch Firefox.  Life is too short to go through all that work every time I need to launch an application, especially now that I've been able to recommision my CapsLock key to be my Super key.

After switching, I had no idea what a difference it made until a few days later when I noticed that it seemed like my laptop was actually running faster, because I was getting more work done in less time.  Back when I was working on a Help Desk, the other technicians and I used to describe a phone call that turned out to be user error as a "picnic"; Problem In Chair, Not In Computer.  I never thought that I would actually speed up my computer by making a change to the person sitting in the chair rather than making the change in the computer, but I guess it shouldn't surprise me after all those years of solving computer problems by changing people rather than computers.

So don't just sit there, go make the most of your time on the computer and start using keyboard shortcuts!

Sunday, November 29, 2009

Transforming Caps Lock into the Super key

Crunchbang has a lot of great keyboard shortcuts configured by default, e.g. Super+W launches Firefox, Super+T launches the Terminal, and Super+F launches PCManFM, the greatest file manager ever.  I love the idea of using keyboard shortcuts to get stuff done faster but I think it is unfortunate that in Crunchbang they are paired with the Super key (a.k.a the "Windows" key).  There are still a few keyboards that don't have a Super key and on my Dell Inspiron 5100, it is located way out in the middle of nowhere above the Backspace key.

I have a few options to fix this, the most obvious being that I could go into my rc.xml file, which contains the key mappings, and change the paired key from Super to something else, like Ctrl, Shift, or Alt.  I was hesitant to do that for obvious reasons: I didn't want to lose the functionality currently provided by those keys.  So I decided to keep the keyboard shortcuts paired with Super but remap my Super key to Caps Lock to make it easier to get to.

Enter xmodmap.  Xmodmap is the Linux keyboard mapping tool and is probably part of every distribution.  Xmodmap is one of those tools that can do just about anything but it can be a little tricky to learn.  I started my quest with this fantastic tutorial, and ended up with a file called .Xmodmap in my home directory (i.e. /home/jizldrangs/.Xmodmap) that contained the following:

     keycode 66 = Super_L
     keycode 133 = Caps_Lock

According to the tutorial that should have worked, and it probably would have if I were trying to switch N and W, but as it turns out these utility keys, such as Super, Ctrl, Alt, and even Shift, require special steps because they are "modifiers".  To make a long story less long, here is what I ended up with in my .Xmodmap:

     clear lock
     add mod4 = Caps_Lock

After rebooting I have exactly what I wanted: Caps Lock is converted over to Super and doesn't turn on the Caps Lock or capitalize anything anymore.

Wednesday, November 25, 2009

Great command-line tools and tricks

This was on Hacker News this morning.  It is easily the best list of little-known command line tools and tricks I've seen.  Did you know that you can control MPlayer remotely from the command line?  Or that you can establish an SSH connection with a remote server, go to the server, and use the connection to access the client?  If not, you should check this out. 

http://www.tuxradar.com/content/command-line-tricks-smart-geeks

Saturday, November 21, 2009

My conkyrc file

I found a conkyrc file I really like and wanted to post it.

For those unfamiliar with conky, it is a utility that embeds information into your desktop. It was originally a system monitoring utility, but is very flexible and has been used to display things like the weather forecast, unread emails, rss feeds, playlists in Rhythmbox, text files that get modified frequently, and on and on. Conky is the name of the application itself and its config file is .conkyrc and is usually located in your home directory.  There are countless sites where people exchange their conkyrc files, so you don't even need to learn the conkyrc syntax to reap the benefits.  Just find one you like and slap it into your home directory.

I messed around with getting the weather on my desktop (which worked great after following a thread in the Ubuntu Forums), but when I was finished I realized that I only really wanted to do it to see if I could Get it Working and I wasn't really that attached to the idea of having the weather forecast on my desktop. In the end I settled on a more simplistic conky configuration: system information only. I found a really nice conkyrc file on the Crunchbang forums and am very happy with the results. I leared a lot about my system, mostly which processes are taking up resources and what kind of resources are being used most.

Anyways, here is the config file and I am providing a screenshot below.

# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! :)
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 200
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_right
gap_x 12
gap_y 12
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT
${font sans-serif:bold:size=8}SYSTEM ${hr 2}
${font sans-serif:normal:size=8}$sysname $kernel $alignr $machine
Host:$alignr$nodename
Uptime:$alignr$uptime
File System: $alignr${fs_type}

${font sans-serif:bold:size=8}PROCESSORS ${hr 2}
${font sans-serif:normal:size=8}${cpugraph cpu1}
CPU1: ${cpu cpu1}% ${cpubar cpu1}

${font sans-serif:bold:size=8}MEMORY ${hr 2}
${font sans-serif:normal:size=8}RAM $alignc $mem / $memmax $alignr $memperc%
$membar

${font sans-serif:bold:size=8}DISKS ${hr 2}
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${swapbar}

${font sans-serif:bold:size=8}TOP PROCESSES ${hr 2}
${font sans-serif:normal:size=8}${top name 1}${alignr}${top cpu 1} %
${top name 2}${alignr}${top cpu 2} %
$font${top name 3}${alignr}${top cpu 3} %
$font${top name 4}${alignr}${top cpu 4} %
$font${top name 5}${alignr}${top cpu 5} %

${font sans-serif:bold:size=8}NETWORK ${hr 2}
${font sans-serif:normal:size=8}IP address: $alignr ${addr wlan0}
ESSID: $alignr ${wireless_essid wlan0}
Connection quality: $alignr ${wireless_link_qual_perc wlan0}%
${downspeedgraph wlan0}
DLS:${downspeed wlan0} kb/s $alignr total: ${totaldown wlan0}
${upspeedgraph wlan0}
ULS:${upspeed wlan0} kb/s $alignr total: ${totalup wlan0}

Thursday, November 19, 2009

Introducing GSW Extreme 2009 (...or, The best game on Linux is Linux)!

I'm not a hard-core gamer, but I do enjoy an occasional game once in a while. There are a bunch of great ones available on Linux that I play once in a while, but I frequently find myself wondering which I enjoy more; the game or the joy of tinkering with Linux to get it to do more for me. Linux is so powerful and so flexible that what you do with it is only limited by your imagination (if you don't believe me, check these guys out). I'm frequently amazed at how often I will get an idea for what I would like Linux to do for me and after a little research I find someone who is doing it or something close enough that I can customize it for my purposes.

A friend of mine summed it up nicely in a blog post, "Linux can be the most addictive game ever devised". I totally agree. I refer to the "game" as GSW, Getting Stuff Working, and I can't stop playing. I'm a junkie (Mrs. Jizldrangs would back me up on that). I crave the feeling of personal achievement when I get some crazy idea in my head and then figure out how to Get it Working on my computer. I probably would have started this blog years ago if I hadn't.

It sounds pretty pathetic, and it is to a degree, but at the heart of it is a creative and inventive element that is part of human rationality. Our distinguishing characteristic as humans is to combine known, understood truths to form new, not-previously-known truths. I find the flexibility and power of the tools available on Linux to be a unique parallel to that activity. There are a bunch of little tools that "do one thing well" in accordance with the Unix tradition, and there are unlimited ways of combining them to do a lot of incredible things. Let your creativity roll!

As a matter of fact, if you're reading this blog, I'm probably in good company. So how are you going to get your next fix?

Saturday, November 14, 2009

When looking for hardware info, always turn to lshw first.

I recently discovered lshw, which is a tool that you run from the command line and it will print a lot of really useful information about the hardware attached to your computer. Not sure what model ATI video card came built-in with your laptop? Lshw knows.

It knows a lot more than that, too. It will also print information on your audio card, your network adapter(s), your processor(s), your expansion slots (such as PCI-E and PCI-X), your disk drive controllers, and on and on. It is really nice. Ask lshw first.

Hulu quest, Part 3: Crunchbang

In my quest for Flash that could handle Hulu videos, I started distro hopping and settled on Crunchbang 9.04. I've used Crunchbang before; it is basically a slimmed-down customization of Ubuntu, with all the bloat removed. Gnome and all of its various supporting applications such as Nautilus and Evolution have been stripped out and replaced with Openbox, a lightweight window manager and such applications as PCManFM, the lightening-fast file manager, Claws mail, Terminator, the terminal emulator, and a lot of the usual suspects like Firefox, Rhythmbox, VLC, AbiWord and Gnumeric, and Pidgin. It even comes with a few things that Ubuntu doesn't come with by default, such as Skype, MP3 and DVD playback capabilities, and our friend, the Adobe Flash plugin.

Crunchbang, like Ubuntu, automatically installed the drivers for my wireless card and I was back on the internet within minutes of completing the installation. I can't tell you what a relief it was to have wireless back after a few days of sitting in the corner of Mrs. Jizldrangs' office, tethered to the router with a LAN cable!

To make a long story short, I never did get Flash to where I could use Hulu. I tried a bunch of stuff after getting Crunchbang set up, such as installing libgl-mesa-dev, and after that didn't work I installed Hulu Desktop and that was pretty terrible.

The closest thing I had to success was when I went directly to Adobe's website and downloaded their Flash plugin for Linux. The version up there at the time of this posting is 10.0.32.18, and it didn't exactly give me smooth Hulu shows but the shows were the smoothest yet. You can get it by going to the Adobe's Flash Player Download Center, dropping down the menu at the bottom and selecting ".deb for Ubuntu 8.04+", then hitting "Agree and Install Now". That will download the package to your desktop. When it is finished you will have to install it using:

$ sudo dpkg -i /path-to-deb-package/install_flash_player_10_linux.deb

When I did that I received an error that there were 2 dependencies, libnspr4-dev and libnss3-dev that were not installed, so I did:

$ sudo apt-get install libnspr4-dev libnss3-dev

It took about 15 seconds to install those libraries, after which I reran the dpkg command above and I was in business (or, at least, as "in business" as I was going to get, considering that Hulu still wasn't watchable). If you do this, watch out for the update manager as it will try to "update" your flash player to the worse one in the repos.

So I spent several days distro hopping to get this working and came up empty-handed. I really don't understand why this is so difficult; I realize that this is an older laptop but it has been playing full-screen DVDs since Mrs. Jizldrangs bought it for grad school way back in 2003. It has a lot more memory now than it did back then, so it seems like it should definitely be able to handle these lower-quality videos on the web. On the other hand, my desktop, which is a quad-core machine with more RAM and a much newer graphics card, handles Flash just fine, so I guess that either my laptop doesn't have the resources or the hardware is not adequately supported under Linux (it has an ATI Radeon Mobility 7500, and I've seen several forum posts saying that ATI, now AMD, is dropping support for it after a certain version of Xorg; that angle may be worth chasing down).

Hopefully some of my future posts will be about how I was actually sucessfull in getting stuff to work...