Sunday, June 01, 2008

Palm Centro

I've used a Palm PDA without interruption since the first one was introduced in 1996. I was working for U.S. Robotics which owned Palm at the time and the employee pricing helped me decide to take the plunge into PDA life. After all these years, I've come to rely heavily upon a few key PDA applications (in addition to the standard PDA applications).

I use SplashID to securely store the multitude of passwords I need to remember both at work and at home. Without it, I'd have to resort to using weak passwords in order to stand a chance of remembering them all which compromises security.

I use SplashMoney to record credit card transactions while I'm away from my computer. This ensures I stay within budget and helps guarantee that I recognize any erroneous charges which might pop up.

JFile is invaluable for storing databases I design myself. I use this to keep track of all manner of data such as books I've got and those I'm interested in reading. Before I did this, I occasionally bought multiple copies of a book.

SlovoEd is a portable dictionary which allows me to look up words I don't recognize when reading without a print dictionary handy. My Centro takes up a lot less space on my nightstand than a conventional dictionary.

Adobe Reader for Palm allows me to read PDF documents on my PDA. This is handy to ready books in non-traditional settings. It's nice always having a book handy to read for those occasions when unexectedly left with extra time to kill.

A couple months ago, the time seemed ideal to upgrade my phone and PDA. My wife's phone was acting up and my stepdaughter wanted a cheap PDA. So it made sense to get a device which fulfilled both those functions for me, freeing up my phone and PDA for them. This also had the added benefit of allowing me to pare down the devices I carried from two to just a single gadget.

The Palm Centro is smaller than I expected but keyboard surprisingly useable. The software upgrades work to make the smaller sized device more intuitive to use than older Palm devices. Is it perfect? No, but it does seem a better compromise device than the other affordable multi-use devices I've seen.

If you're interested in an affordable combination mobile phone and PDA device, check out this review from Engadget.

Sunday, May 04, 2008

I/O Redirection

One of the most useful features of the Linux, Unix, MacOS, and to a lesser extent Windows (more on that later) is the concept of I/O redirection. In this discussion, we'll restrict ourselves to the pipe form of redirection which is invoked by the vertical bar character "|". This tells the command interpreter to take all output from the first part of the command and send (or pipe) it to the second part. The other characters which invoke I/O redirection are the less than "<" and the greater than ">" characters. Those are primarily used to send output to a file or cause the program to take its input from a file.

If you're a long time computer user, you may want to skip ahead to the examples below. You may have heard the term "I/O redirection" before but what does it really mean? I/O redirection gives you the ability to chance where a program's input and/or output is bound for. Normal command line programs have both their input, aka stdin (standard input), and output, aka stdout (standard output), directed to the console (which is just shorthand for saying the input comes from your computer's keyboard and the output goes to the portion of the screen where you're running the program). Note that if one of the portions of the command line produces errors, you may be surprised to find the error messages may not get redirected with the pipe command. This is because many Unix/Linux style programs also make use of a third I/O stream called stderr. WIthout taking special action, stderr output is almost always directed to the console to bring the error condition to the user's attention.

The simple example

For this example, let's suppose that you've got a huge tar file, aka tarball) which is really an archive file containing many other files. Now suppose you want to look to see whether it contains a text file but you really don't recall the name of the text file. Perhaps you recall something else about the text file such as it was located in the /projects directory. You could always get a listing of all the files within the tar file and manually search through them but computers were created to relieve users of the need to do such labor intensive tasks. How about we put I/O redirection to work?

To start with, we need to obtain a listing of all the files in our tar file which for purposes of illustration we'll call sample.tar. That can be accomplished with the command below.

tar -tvf sample.tar

That gives you a complete listing of all the files but chances are if it's a big tar file, the names and details of the files scrolled off the screen and perhaps overwhelmed even the scroll back buffer of your terminal window (aka command interpreter or shell). In any case, being lazy computer types we don't feel like searching through this huge amount of data.

The first thing we want to do is to weed out all the non-text files. Hopefully we've been disciplined about our file naming conventions and have added a ".txt" file extension to all our text files. So let's show only the files which end with that file extension. We'll use our old friend "grep" to match just the output lines which contain the string ".txt". Note that we're using the "-i" parameter to specify that we want to match the string ignoring the case of the letters in the string. This may be important if not everyone adding files to the tar file was careful about adding a .txt and not a .TXT file extension. Toy OSes like Windows don't make this distinction but you'll find they don't handle I/O redirection properly either. The Windows shell is very simplistic so even if you've added Linux style utilities like "tar" to its repertoire, you may be disappointed to find that it doesn't do multitasking. A proper OS will handle I/O redirection real time so when you type the command below, you'll see output data appear quickly. Windows creates a temporary file containing all output from the first part of the command which it then sends to the second part of the command once the first is completed. It makes the Windows command line feel much slower than it is and believe me it doesn't need much help. If you've ever manipulated large tar files on both Windows and Linux systems, you'll quickly discover that the Windows command line isn't performance oriented by any stretch of the imagination.

tar -tvf sample.tar | grep -i ".txt"

That gives us a listing of just the files which contain the string ".txt" which hopefully only appears as a file extension.

Something we notice about the output which makes life a bit tougher is that the tar shows you the file names and other details in the order they were added to the tar file. It would be nice if we could see the files sorted by the directory names in which they appear. Fortunately there's a simple solution to that desire.

tar -tvf sample.tar | grep -i ".txt" | sort

This command does the trick but it also illustrates some odd behavior. The output doesn't appear piecemeal the way it had been doing previously. If we think about it, the reason becomes obvious. The sort command can't really sort correctly unless all input to be sorted is present. So it must wait until the commands up to that point in the command line are complete before starting to sort the output.

Since we might be fans of the graphical version of the vim (vi improved) editor, we can add another labor saving twist to our command line. We can send the output of our command to gvim. This has the advantage of being able to search the output using editor commands. Doing this in gvim will also cause the search terms to be highlighted within the text making it much easier to pick out from the surrounding text.

tar -tvf sample.tar | grep -i ".txt" | sort | gvim -

Obviously the commands above were simple examples to make explanation easier. I'll add a few slightly more advanced examples below with a brief explanation of what they do. Once you get the hang of it, you'll find you quickly come to rely upon this powerful feature. Most of the Unix/Linux style command line utilities are written so they can be easily combined to create more powerful command lines similar or more sophisticated than the ones we've been exploring.

A few more advanced examples

The command below uses the find command to search for all files which end with the ".txt" file extension. It then searches them to see which of them contain the string "project". Note the "-l" parameter causes grep to only output the filenames which match the search criteria. If you omit the "-l" you'll see a list of matching lines from within the files. Also note the use of the xargs command which may seem unfamiliar. It's a method of appending multi-line output from previous commands to form arguments for the command specified after xargs.

find . -name "*.txt" | xargs grep -l project

This command does essentially the same thing but sends the list of matching file names to the vim editor. It issues the command to search for the string "project" so that term will be highlighted in the file and the cursor will be placed on the first occurrence within the first file.

find . -name "*.txt" | xargs grep -l project | xargs vim -c /project

Try coming up with ways to use I/O redirection which make your time at the computer easier. You'll be glad you did.

Friday, April 11, 2008

I knew it!

Here's an interesting article about Ernest Hemingway. The part I find most interesting occurs on page 4 where Hemingway that the symbolism which English teachers so often attribute to stories is not premeditated. He states "No good book has ever been written that has in it symbols arrived at beforehand and stuck in".

This quote supports my long held belief that the symbolism English teachers claim to find in books was usually not intended by the author and as such is entirely subjective. In school I always hated being criticized by an English teacher for not seeing the symbolism they claim is the "only" valid interpretation. Frequently these teachers would speak as if they had some sort of notebook from the author containing their secret thoughts about hidden subtext they had woven into their novel. What a crock!

Sunday, February 10, 2008

Backing up data

I've been struggling trying to find a decent solution for backing up my wife's laptop computer. The program I'd been using ended up not backing up some key files. We almost ended up losing all her photos when the hard disk in her laptop started dying recently. It's never a good sign when you hear clicking noises when you try to list a directory. Fortunately the use of SpinRite and a little luck allowed the drive to continue functioning long enough to manually copy the files to an external drive.

After trying a number of different backup programs and not being fully satisfied with any of them, I decided to use something simple. The tar program has been around since the early days of Unix. Tar stands for Tape ARchiver and it was originally used to archive a group of files to a tape device. The beauty of tar is there are versions available for almost any operating system you can think of. That makes it easy to examine the tar files on any system to verify I've backed up all the files which needed backing up. I'd long ago installed cygwin (a version of the most common Unix utilities for Windows) on her laptop so I was good to go. Cygwin can't fix all of Windows' shortcomings but it is able to make Windows much more useful. The Windows command line tools are so woefully underpowered that I no longer consider using them for anything.

Having decided to use tar, there were still a couple other problems which needed to be solved. The resulting tar file for even a partial backup is likely to be quite big. By default tar concatenates all the files with some file information (file name, size, permissions, etc) about each file added. So using gzip to compress the tar files is highly recommended to avoid using too much space on the backup device.

The gzipped tar file for the backup of just the data files on her laptop ends up having a size of just over 11 GB. The external USB hard drive and NAS (network attached storage) drive we have are both formatted as FAT32 to make it easy to use on Windows, Mac, and Linux systems. That presents a problem since FAT32 drives have a maximum file size of 4 GB. So I was forced to use the Unix split program to split the huge tar file into smaller files which can be copied to a FAT32 drive.

After building the tar file, I was able to dump a list of all the files contained in the tar file. I was also to use the find command (the cygwin/GNU version not the lame Dos/Windows version) to build a list of all the files on her hard disk. Then it was a simple matter to use grep to get a list of all the JPG, GIF, DOC, etc files in both the listing of all files and the listing of all files in the tar file. That made it easy to verify that I've managed to back up all the data files.

Whew! It was a lot of work but now I can finally rest easier knowing all her data files are safely backed up.

Sunday, February 03, 2008

Bad advice from an IT guy

A relative called recently asking about her friend's laptop computer which was running slowly. Her friend had asked someone from the IT department at work how to make the laptop run quicker. The IT guy's response was to suggest they replace the hard disk with a faster model.

This is wrong on so many levels that it makes my head hurt. First, the IT tech didn't ask any questions to determine what the underlying cause of the slowdown might be. Laptop computers typically come with relatively slow hard drives since lower RPM drives create less heat. Laptops always have trouble dissipating heat because of the small cases. Chances are a faster drive may not be available or at least may not be affordable for the average user. A slow hard drive typically only causes delays in one of two circumstances: loading programs and reading or writing data files. Those two cases comprise a fairly small percentage of the overall usage time and will most likely not produce a noticeable delay.

A better approach to speeding up an older computer is to add more memory. Application software always seems to get larger over time. Data files also have a tendency to grow with use. Users also tend to use more applications simultaneously as they get more sophisticated. All of these conditions probably require more memory than originally came with the laptop. When the laptop doesn't have enough physical memory, Windows will be forced to swap unused applications and portions of the data files out to the swap file on the disk. Hard disk accesses are always much slower than memory accesses.

Sadly, bad advice like this is not at all uncommon. Hang around in the computer section at any big box electronic store any you'll undoubtedly hear something similar. Amazingly enough, $8.50 an hour and a few months of experience doesn't always produce quality technical advice. Imagine that...

Wednesday, January 23, 2008

PDA replacement

I finally found an excuse to take the plunge and replace my aging Palm Tungsten T3. This is not a transition I make lightly. I've been using Palm PDAs since I bought the first Palm device introduced back in 1996, the Palm Pilot 1000. I got it for special employee pricing since I was working for U.S. Robotics. You may or may not remember that they owned Palm when the first Palm PDA was introduced.

As a longtime and very satisfied Palm user, I would have loved to choose another Palm PDA but Palm's future doesn't look quite so rosy these days. The company has been making some strange moves such as spinning off their software division. They've also apparently lost focus and haven't introduced any new innovative PDAs models in a while. Even the Treo line they've been depending on so heavily has lost ground when compared with other smartphones.

The device I chose as a replacement was the Nokia N810. It includes pretty much all the features the Tungsten has but also features a slide out keyboard, a Wifi adapter, a built-in webcam, a GPS receiver, and can even use a bluetooth cellphone for an Internet connection if a wireless access point isn't available.

Now comes the struggle to figure out how to duplicate all the features I depend on my Palm for on the new device. Fortunately, Access has introduced a Palm emulator called the Garnet VM which should help ease the transition somewhat.

Monday, December 31, 2007

The fleeting nature of data with DRM

This article from the Washington Post highlights a problem which is bound to increase in frequency. It discusses the fact that Walmart has just cancelled their digital movie download service.

When you lock yourself into some form of entertainment which makes use of DRM, you're at the mercy of the company providing the data/service to continue offering it. Now the people who have downloaded movies can only continue watching them on the same PC they downloaded the file to in the first place and they can't re-download should their PC hard disk fail. I'll concede it was more convenient to purchase a movie this way but there wasn't a significant savings involved and what do they have now? Data subject to rapidly increasing entropy thanks to shifting business priorities. They'll definitely lose access at some point... it's just a question of when.

I think the same problem will occur with the e-book readers currently on the market. The Kindle (from Amazon) certainly makes purchasing and carrying lots of books much more convenient and even gives a pretty good ease of use, something important in a device designed to replace physical books. But at what cost? The books themselves aren't offered at a huge savings over paperback editions and they're subject to DRM. So you're tied to the device and should Amazon decide that the device isn't profitable enough and discontinue the service, you're stuck with an expensive device which will continue reading books you've already purchased but won't be good for much else. If they discontinue the service, you can bet that the wireless connection will no longer work.

I've also got other concerns about the device. Can you back up your purchases onto a PC or are you forced to re-download them if you want to re-read them in the future? There are some books I like to read again periodically so a proper replacement for physical books would have to take this into account.

Some companies have little interest in guaranteeing customers have continuing use of their DRM laden files. Microsoft changed DRM formats when they introduced the Zune. It won't play any of their previously purchased songs using the earlier Microsoft DRM technology.

The real answer is to avoid all forms of DRM. Applaud the move of 3 of the 4 major record labels to offer DRM free music on Amazon by supporting their efforts. Whenever possible, support the work of independent artists who haven't been punishing their customers the way the RIAA has. But most importantly, put your foot down and say hell no to DRM.