Tuesday, December 15, 2009

My Android Home Screen Shortcuts and Essential Apps

The main purpose of this post is to record the current configuration on my Android phone in case I need to recreate it from scratch. It gives me peace of mind to have such a record although I have become pretty good at making Nandroid and ext backups.

I am using the five home screens available in Cyanogen's and Dwang's ROMs for different categories or related categories of apps. (I recently switched to Dwang's and find it very stable and zippy.) Here are the screens from left to right. The middle one is the default home screen.

Leftmost: system administration and networking



Center-left: multimedia



Center: communication and information management



Center-right: news and reference



Right: games and tools (and dictionaries)



Other apps or activities without screen shortcuts
[...] = not available/needed in Dwang's ROM
  • [CM updater]
  • [Spare Parts]
  • [Amazon MP3]
  • AndroBlogger
  • Astro file manager
  • Babbler Lite
  • Calling Card
  • FBReader
  • GV Dialer
  • Layar
  • NewsRob
  • Ringdroid
  • ShootMe
  • Soccer Livescores
  • Thinking Space (mind map)
  • Toggle Google Voice
  • Where Did We Park
  • Wikitude

Sunday, September 20, 2009

Prerequisites for Building OpenWrt SDK on Snow Leopard

These are the prerequisites:
  • Case-sensitive file system!
  • sudo port install gcc45 binutils gpatch bzip2 flex bison gmake gettext pkgconfig unzip libzip wget coreutils gawk findutils getopt gnutar md5sha1sum
  • sudo su -
  • cd /opt/local/bin
  • ln -s gnutar tar # otherwise it won't find it
I just got done building the OpenWrt SDK Kamikaze 8.09.1 with these tools on Mac OS X 10.6.1 Snow Leopard.

Thursday, September 17, 2009

Linksys NSLU2 OpenWrt Sharing Multiple USB Printers

Most of the information required to share USB printers with OpenWrt is available here. I am just going to document a few details not covered in that document.
  • I had to write my own hotplug script, /etc/hotplug.d/usb/20-usb-printers, for giving the printers fixed symbolic links.

    #!/bin/sh
    
    create_link()
    {
     SYS_DEVDIR=/sys"$DEVPATH"/usb
     LP=`ls $SYS_DEVDIR`
     if [ ! -d "$SYS_DEVDIR/$LP" ]; then
      exit 
     fi
     REAL_DEV=/dev/`basename "$SYS_DEVDIR/$LP"`
     rm -f "$1"
     ln -s "$REAL_DEV" "$1"
    }
    
    process_action()
    {
     case "$ACTION" in
      remove)
       rm -f "$1"
       ;;
      add)
       create_link "$1"
       ;;
     esac
    }
    
    case "$PRODUCT" in
    
     "4b8/5/100") # EPSON C80
      process_action "/dev/inkjet"
      ;;
    
     "4f9/28/100") # BROTHER HL-2040
      process_action "/dev/laser"
      ;;
    
    esac
    

  • In addition, I created an init script, /etc/init.d/usbprinters, to make sure the links are also created when coldplugging the printers. Run /etc/init.d/usbprinters enable once after creating the script.

    #!/bin/sh /etc/rc.common
    
    START=39
    start() {
     [ -d /proc/bus/usb ] && {
      /sbin/udevtrigger --subsystem-match=usb --attr-match=bInterfaceClass=*7*
     }  
    }
    

  • Using these fixed symbolic links, /etc/config/p910nd now always exposes each printer on the same port:

    config p910nd
     option device        /dev/laser
     option port          0
     option bidirectional 1
     option enabled       1
    
    config p910nd
     option device        /dev/inkjet
     option port          1
     option bidirectional 1
     option enabled       1
    

  • I could not get avahi-daemon to work for advertising the printers via Zeroconf. Instead, I am using the no longer supported howl-mdnsresponder package (version 1.0.0-1). My /etc/mDNSResponder.conf looks like this.

    "Brother HL-2040 series" _pdl-datastream._tcp local. 9100 "txtvers=1" "note=Office" "product=(HL-2040 series)"
    "Epson Stylus C80"  _pdl-datastream._tcp local. 9101 "txtvers=1" "note=Office" "product=(Epson Stylus C80)"
    

    The idea is to use the product name that matches the product key in the PPD file on the client so that the client automatically suggests the right driver.

  • I manually downloaded and installed recent versions of ink and libinklevel from this repository, and now ink works with my Epson Stylus C80! I am using this script to see the ink levels as a bar chart in X-Wrt > Status > USB.

Monday, August 3, 2009

Imported All Legacy Email into Gmail

I switched to Gmail in 2006 but still had my earlier legacy email in three different places:
  • Maildir format (Courier server) since about 1998 (about 2 GB)
  • Netscape mbox format since about 1996
  • MH format from 1987 to 1996
I am just about done with the conversion. It required a tedious semi-automated process that took several days. I basically followed these steps:
  1. Convert MH mail to mbox using this script.
  2. Convert resulting mail and Netscape mbox mail to Maildir using the newest version of this script.
  3. Filtering out all messages already in Gmail, for each set of desired Gmail labels, import the corresponding Maildir folders using Scott Yang's excellent IMAP-based maildir2gmail.py tool, then apply the desired labels to the imported messages, finally add these labels to the filter. Repeat until done.
There was one minor complication: A colleague of mine used a misconfigured client that caused the year in his messages to appear as 100, 101, etc. instead of 2000, 2001, etc. maildir2gmail.py couldn't handle those messages, and I was too lazy to figure out how to fix them with sed, so I simply deleted them. I probably have most of their content quoted in my replies anyway.

My recommendation is not to bother with these options:
  • An email GUI client won't be able to handle anything but tiny volumes of mail reliably.
  • Gmail Loader uses SMTP and seems to mess up the original message headers. Besides, it seemed very slow.
Now I have over 90,000 messages taking up almost 4 GB, a bit more than half of the current limit.

Monday, January 26, 2009

Whole Foods: Mixed Experience

I vaguely recall having been to Whole Foods once many years ago. Today I went back only to stock up on organic quinua for a decent $3/lbs in bulk, better than Trader Joe's $4 for a box with less than one lbs, if it's even in stock.

But I also noticed various items that were significantly (up to 50%) more than the exact same items at TJ.
  • Driscoll organic raspberries, WF $5.99, TJ $3.99
  • Laughing Cow Babybel cheese, WF $4.99, TJ $3.29
WTF? I'm not planning to go back until I run out of quinua...

Friday, January 16, 2009

Excellent Linksys/Sipura SPA-3102 Experience

As a result of my migration from a noisy, overheating mid-tower server to a near-silent Mac mini Core Duo with a DAT Optic 4-bay FireWire enclosure, I could no longer use the Digium X100P clone FXO internal PCI card. Therefore, I needed an external device with an FXO port to which to connect the incoming phone line from the building lobby (please see this earlier article for more context).

I was also hoping to replace or at least complement the Digium S101i IAXy analog telephone adapter (ATA), which is not reliable enough for everyday residential use because it frequently goes into an inconsistent state and gives a busy signal instead of a dial tone.

Fortunately, the Linksys/Sipura SPA-3102 is exactly what I needed. It is a SIP-based ATA with both an FXS port, which provides a dial tone to my existing apartment phones, and an FXO port, which receives calls from the building lobby. Surprisingly, at about $75, it is cheaper than the IAXy. As long as you don't need support for the IAX protocol, you're probably much better off with this rock-solid device. It also has a web interface and supports numerous features that I am actually using, such as distinctive ring.

I connected mine to my existing Asterisk server following some of these instructions and the device's manual. I configured the following dial plan for the PSTN line to transfer incoming calls immediately to the given extension:

S0<:sipura-fxo-incoming>

In Asterisk, I can then receive calls on this extension like so,

[sipura-fxo]
exten => sipura-fxo-incoming,1,Goto(intercom,s,1)

using the context I specified in the ATA's SIP registration shown here. (The authentication settings in the ATA configuration has to be consistent with Asterisk's SIP configuration.)

[sipura-fxo]
context=sipura-fxo
type=friend
host=dynamic
username=sipura-fxo
secret=******
disallow=all
allow=ulaw
canreinvite=no
qualify=yes
insecure=port,invite
nat=no

[sipura-fxs]
context=sipura-fxs
type=friend
host=dynamic
username=sipura-fxs
secret=******
disallow=all
allow=ulaw
canreinvite=no
qualify=yes
insecure=port,invite
nat=no