Monday, December 29, 2008

The new printer is working... finally!


I finally got our new Epson Workforce 600 all-in-one printer working properly today. It wasn't an easy installation by any stretch of the imagination. Their setup software isn't what I'd call user friendly. I was close to having it work on several occasions but something always went awry. The most annoying problem was when the printer found the WiFi network during setup and allowed me to enter the WPA key even though it refused me to allow me to paste the key into the form (try entering a 64 character hexadecimal key manually twice with no errors). The printer sat there trying to connect via WiFi in excess of 10 minutes. When it finally failed, it gave no indication of why the connection attempt didn't work.

I won't bore you with a step-by-step recounting of all the problems I encountered. Instead I'll present a list of lessons learned. Most of these only apply if using the WiFi connection.

1. Make sure your WiFi router has some of its IP address range reserved for statically assigned IP addresses (as opposed to DHCP assigned addresses). Using a static IP address for your printer will make the installation go easier.
2. If you're using WPA-PSK, specify the key as a 63 character ASCII string. The Epson doesn't seem to do well with a hexadecimal key. I used Steve Gibson's Perfect Password page to pick a strong random WPA key.
3. Use the printer's front panel to enable and configure the WiFi adapter. Sadly this procedure isn't covered in the manual which insists you use the software to configure everything.
4. Configure the WPA key for the WiFi adapter. This is done with the up and down arrow keys. You can toggle among the uppercase, lowercase, and numeric/special character sets by using the menu key located at the bottom left of the menu navigation keypad (the keys surrounding the "OK" button).
5. Assign an IP address which was excluded from the router's DHCP range in the first step.

Now that the printer is configured, it works like a dream. Don't be put off by this confusing WiFi setup. I've read worse stories about configuring the WiFi adapters for all-in-one printers from other manufacturers. There are far too many combinations of WiFi routers and broadband providers for any manufacturer to ensure no problems will arise during installation. I'm sure at least part of the problems are a result of the router supplied by our broadband provider. I've encountered problems attempting to connect other devices to it in the past. If it weren't for the requirement of MoCA connectivity I would have replaced it with a better router because of the issues encountered.

Monday, December 22, 2008

My new gadget fix


Last week I finally got fed up with the numerous quirks exhibited by the cheap flash only MP3 player which will remain nameless (suffice it to say I should have never strayed away from the Apple fold for price alone) and ordered a refurbished iPod Touch. I figured I could use it as a light MP3 player when I was exercising or walking the dog. Plus it gives me the ability to play with some of the more compelling iPhone features without having to pay the monthly fee for the data service.

It arrived a few days ago and I've been having a great time playing with it ever since. I think it's as very nearly as revolutionary as the original iPod was. The first thing which struck me was how thin it was. I'm amazed at how such a tiny device can perform such an amazing number of tasks.

The mobile version of the Safari browser works well for light web browsing. I get a big kick out of using the gestures to zoom in and out on portions of web pages. Being able to rotate the device and having the display orientation automatically adjust itself is also very cool. Having a built-in IMAP email client is pretty darned handy too. I've also discovered a few free applications which complement the standard set nicely.

I like the mobile version of the NetNewsWire RSS reader. I've been using the Mac version for quite a while now. I discovered that I had to sign up for a second NewsGator account since my old account contains a lot more RSS feeds than the mobile version of NetNewsWire can comfortably handle.

I also downloaded Labyrinth LE, a game which takes advantage of the orientation sensors in the iPod Touch to allow you to control a ball's movement through a maze by tilting the Touch. It's more fun than I would have thought.

I'm sure I'll be discovering more cool applications for the Touch in the coming weeks. In the meantime, I'm having a blast playing with this clever little gadget.

Tuesday, December 02, 2008

NASA's steadily shrinking budget

According to this article at least some politicians are aware of the problems posed by NASA's steadily dwindling budget. With the economy as strained as it is now, there's very little chance they'll get the increase they so desperately need. The problem isn't widely understood either. According to this article, most Americans grossly overestimate how large a part of the nation's budget NASA gets. It's hard to believe they only account for 0.6% of the budget. Where else can you get that type of return for such a small investment?

We need to revisit our priorities because correcting NASA's funding deficits isn't merely something to do to make ourselves feel good, it's an absolute imperative. Have a look at this chart of the number of near Earth asteroids (NEAs) observed within the last 60 days. Do we really want to take the chance that none of these will come close enough to do massive damage, especially when funding NASA is so affordable compared to a lot of the other budget items?

Most scientists credit an asteroid strike with causing the extinction of dinosaurs. That may be the way we're headed unless we find a way to fund more space research.

Thursday, November 27, 2008

Gripping television

We watched the finale of The Shield last night, a fact which fills me bittersweet happiness. It was a thoroughly enjoyable series. It's hard to believe that it's been seven years since it started. I'm going to miss marveling at the havoc Vic Mackey and the rest of the Strike Team managed to wreak each week.

The writing on the series was amazing, especially when contrasted with the drivel that passes for entertainment on broadcast TV channels. It was surprising that they didn't have a slow season unlike so many other series. I wish I could say as much for The Sopranos which came close to boring me to tears for much of its last three seasons. Unlike The Sopranos, The Shield's finale was every bit as good as the series had ever been.

I feel the same bittersweet happiness remembering The Wire. It's refreshing to see what a great team of writers including George Pelecanos, who also has an impressive career as a novelist, can create when given the kind of freedom that an innovative network such as HBO can offer.

So where do we turn for TV entertainment now that those two great series have run their course? I'm hopeful that True Blood, Dexter, Sons of Anarchy, and Brotherhood will all continue providing us with thoughtful entertainment for years to come. I'm fairly certain that the broadcast networks won't abandon their current fascination with crappy reality TV programs long enough to produce something capable of entertaining people who who have an attention span of longer than 30 seconds any time soon.

Sunday, October 26, 2008

You can get a virus just by visiting a web site

Just in case anyone doubted that the web is a dangerous place, this article discusses the very real possibility of getting a virus just by visiting a web site with scripting enabled. See, it happens to the ubergeeks among us too. ;-)

The safest way by far to browse the web is using Firefox with the NoScript plug-in installed. I keep scripting disabled by default and only enable it on sites I trust such as my bank, Amazon, etc. For those web sites which don't display properly without scripting enabled, I resort to browsing to them in a Virtual Machine under VMware Fusion. It's far easier to restore the single file containing my virtual machine than it is to have to either restore my entire machine or reinstall software.

Using OpenDNS is also highly recommended. It helps cut down on phishing by warning you when a link has directed you to a dangerous web site.

Those of us using Macs shouldn't feel too smug. With the Mac's popularity increasing so quickly, it's only a matter of time before the people who write malicious software start targeting Macs in earnest.

Monday, October 13, 2008

Firefox smart keywords

A lot of people I've talked to don't seem to explore features added by new releases of their software. A case in point is the smart keyword feature of Firefox. It allows you to enter a quick search on the web site of your choosing just by entering a few works in the Firefox's address bar.

An example will probably make this a bit clearer. I frequently visit the Internet Movie Database to look up movies I'm interested in seeing. So I've created a smart keyword called "imdb" which saves me a lot of time. When I want to look up the movie Time Bandits, I click in the Firefox address bar and enter the command "imdb time bandits". That takes me directly to IMDB's information page on Time Bandits.

To enter a new smart keyword, perform the following procedure.

1) Visit www.imdb.com.
2) Right click in the search box and choose the "Add a Keyword for this search..." selection.
3) Enter a name and the actual keyword for your saved search. For this example, I've used "imdb" for both the name and keyword.
4) I like to group all my keywords in a special keyword bookmarks folder. Then again, I'm an organization freak.

Tuesday, September 30, 2008

More about strokes

After a few visits with a friend who has recently suffered from a major stroke, I think it's a good idea to pass along some information because strokes are not well understood by the public at large.

It's important for people to learn to recognize the symptoms of a stroke. If you or your family members don't recognize the fact that you're having a stroke, you may not get treatment quickly enough to prevent unnecessary long term brain damage. It's especially important to remember when symptoms first appeared. The most promising treatment, TPA, must be given within 3 hours of the first appearance of symptoms. It can actually cause harm if given after 3 hours have passed.

The aftereffects of strokes are also somewhat misunderstood. Most people recognize the temporary or permanent paralysis of of one side of the body as classic stroke symptoms. The brain swelling which takes place frequently causes problems with speech or control of the limbs on one side of the body which can require months of therapy to correct.

You may also want to ask your doctor about taking a daily low dose aspirin as a preventative for strokes and heart attacks. For some reason the body seems more prone to developing blood clots as we get older.

A podcast I listen to regularly, Skepticality, features a host who had a major stroke a few years ago. He returned to podcasting after about 4 months. At first his delivery wasn't as fluid as it had been before the stroke but with continued speech therapy, it's now hard to tell that he ever had a stroke. I'm hoping therapy proves just as effective for my friend.

Sunday, August 24, 2008

Leopard's Stacks feature


One of the first Leopard features I started using was Stacks. I used it to replace the program launcher I'd been using. The Dock is a great way to organize your most frequently used apps but since it also gets populated with an icon for every program currently running on your Mac, it can get a bit cluttered. Fortunately Stacks offers a great way to tame that unruly list of icons.

Leopard comes with two Stacks items by default, Documents and Downloads. I've gotten rid of Documents since I tend to keep my documents stored in a hierarchical directory structure rather than shoving them all in one big documents folder. I've also made a minor change to the Downloads item. Stacks has the annoying habit of changing the icon for the Downloads or any other Stacks item in the dock to icon of the first item in that folder. I find that disconcerting to have my Downloads folder sometimes look like a folder and sometimes look like the icon of whatever program I've happened to download. So I've added an alias for a folder called _0_dummy_folder to the Downloads folder (in your home directory). The name causes the folder to appear first in normal sort order so a folder icon is used for the Downloads Stacks item.

I've also added a few new Stacks items of my own to the Dock. I did this by following the procedure below:

1) Create a folder to contain the entries you'd like to appear in your new Stacks items. For example, I created a folder called ~/Dock/Utilities to hold aliases for all my frequently used utility programs. Note that the tilde is Unix shorthand for your home directory.
2) Create and drag aliases for each utility program you want appearing in this new Stacks item to the folder you created in the previous step.
3) Create and drag an aliases for a dummy folder to the ~/Dock/Utilities folder. I use an alias to a folder called _0_dummy_folder for reasons outlined above.
4) Drag the folder ~/Docks/Utilities to your actual Dock. I dragged mine to the left of the Downloads Stacks item.

You can repeat the above procedure to create more categories of frequently used programs or frequently accessed documents. The best part is I don't have to keep paying to update my program launcher. This also takes up less space than my old program launcher.

Monday, August 18, 2008

Recognizing the symptoms of a stroke

I found out tonight that a close friend of mine suffered a stroke last week. He recognized the symptoms and was able to describe them to the doctors before his speech was too affected. Knowing how bright he is and how much he reads, it doesn't surprise me that he'd taken the time to learn this valuable information.

The Stroke Association has a list of symptoms which everyone should commit to memory. It can make all the difference!

Saturday, August 02, 2008

Useful Mac software

A friend of mine just took the Mac plunge so I've been sending him links about useful Mac software I use most frequently. I thought it might be nice to collect all those recommendations here.

ClamXav is a high performance virus scanner for Macs. With the Mac's steadily increasing market share, it's becoming a more attractive target for malware authors.

TNEF's Enough is a handy little utility which unpacks the strange attachments which some Windows mail programs use (usually called winmail.dat).

MacJanitor allows you to manually run the 3 cron jobs (daily, weekly, and monthly) used to do periodic maintenance on Macs. This can be important on laptops which typically don't get left on all the time or desktop systems which may be asleep when the scheduled time passes.

Flip4Mac is a free QuickTime component that allows you to play WMV files.

JView is the fastest image viewer I've found.

MonoLingual is a utility to remove unnecessary language files on Mac OSX. This can save a fair amount of disk space.

NetNewsWire is the best RSS reader I've found for the Mac.

Transmission is a good open source BitTorrent client.

The VLC media player can play most types of video files.

NeoOffice is the Mac port of OpenOffice, an excellent and free alternative to Microsoft Office.

Here's an article on how to run Windows or Linux on your Mac in a virtual machine using some free software called VirtualBox. VirtualBox isn't the only virtualization software available for the Mac. At home I use Parallels which was the first virtualization software available for the Intel based Macs. At work I use VmWare Fusion.

Friday, July 25, 2008

MacVim

I'm a long time vi/vim user. I don't know that I'd recommend anyone who doesn't already know vi go through the heavy learning curve necessary to become proficient at using vi. There are a number of gui editors which are more easier for new users to learn. However vim (vi improved) is available on very nearly any computing platform you might use. I also find that vim allows me to accomplish some pretty complex editing operations faster than most of my former coworkers using other editors. Having used vi for over 20 years now, I have yet to find an editor which would make me more productive and believe me I've looked. I'm constantly searching for new programming tools in my spare time.

I've been looking for a decent port of vim for the Mac for a while now. The version pointed to by vim.org always seems to lag behind a version or two. It also has a few deficiencies. It used to have screen draw problems and would leave pixel residue behind after scrolling. It also never handled the "-" command line argument properly. This argument causes vim to read its data from stdin which is very handy for piping output from other commands into vim for easier manipulation.

My search is over. The team at Google Code has created a great port of vim for the Mac they call MacVim. It's fast and features none of the problems I'd experienced with other ports. Thanks guys for a great porting job!

Sunday, July 20, 2008

Data recovery, part two

I've managed to recover a fair number of files from my stepdaughter's failing hard disk. You might recall I used a program called dd_rescue to do a raw copy of the sectors of the failing hard drive to an image file on a larger USB hard disk. That was important because the old hard disk seemed to be getting progressively worse, as hard disks which have experienced a partial crash are wont to do.

There was good news and bad news regarding the copy. The good news was dd_rescue managed to copy about 33 GB from the 60 GB drive before encountering constant errors. The bad news is that left about 27 GB of data which hasn't yet been recovered.

Next, I used a handy (and free) program called PhotoRec to recover photos and a number of other data types from the partial image of her drive. All told, it found about 4000 jpg files large enough to be her pictures. Some of them probably come from a browser cache but a good deal of them are vacation photos which she'd be pretty upset to lose.

So far it's been at least a partial success. I'll post more if there are significant updates in the future.

By the way, let this be a reminder to you to go back up your data. Hard disks sometimes fail with no warning and not all drives fail gracefully enough to allow some data to be recovered.

No-name router problems

I spent part of this morning doing some remote troubleshooting of a problem my in-laws were having with their broadband connection. Their broadband provider supplied a no-name router. Somehow it had decided that my wife's laptop had made too many outbound connections and therefore must have a virus. Once having decided this (and quite erroneously so), this poorly designed router continued making this assertion even when her laptop was no longer plugged into the router. In fact it seemed completely unable to determine which were active computer connections and which had timed out. Its status page listed two computers which didn't match any computers currently connected to the network nor had there been any such computers connected that my in-laws could remember.

You might wonder how I could determine that the complaint about too many outbound connections was erroneous beyond the shadow of a doubt. I simply enlisted the use of the "netstat" command. The netstat command exists in all major OSes (Windows, MacOS, Linux, and BSD). It allows you to determine the state of network connections for the computer on which you execute the command. Using the "-b" option allowed us to see which programs had open connections. As I suspected, only iTunes, Thunderbird, and Firefox had network connections and none of the three applications had an unusual numbers.

And yet this silly router continued complaining about the number of outbound connections from this one computer even when the computer was disconnected to the network and through several power cycles of the router. So I walked my stepdaughter through the procedure to disable this poorly implemented portion of the firewall (the detection of number of outbound connections) because it obviously wasn't working properly.

My advice is to stick with a name brand router (Linksys or Netgear) whenever you're presented with the option. Sadly since this router was supplied by their ISP, they don't have a choice in the matter. Using a no-name router may cost you more than any initial cost savings realized by purchasing a cheap device in the amount of troubleshooting time you spend on poorly implemented features such as this one.

Sunday, July 06, 2008

Recovering data from a failing hard drive

I've been trying to recover the data off a failing hard drive for a family member. I've found a few programs which claim to be able to do just that but they always get hung up by the numerous retries the drive keeps doing in the failing areas. Then I came up with the idea of using the dd command to make a copy of drive image which I could then manipulate having gotten the retries out of the way during the initial copy process. I'd used dd pretty heavily during the development of an SD card driver I'd done at my last company. Once the drive image has been copied to a file, the resulting image file can be mounted using the mount command... well it can on Linux and Mac OS X at least. You poor folks running Windows are out of luck.

After looking around on the web, I discovered a great little program called dd_rescue which does intelligent retries if errors are encountered, slowly lowering the block size being requested to find the boundaries of the affected area. I think the standard dd command would try to do retries until the read worked or until the copy was aborted. dd_rescue also allows an offset to be specified when the command is invoked so the copy may be done in several stages. Since it's taken about 4 hours, off and on, to copy the first 33 GB from the failing 60 GB drive, I'm anticipating having to make heavy use of this feature to complete the copy process over the next day or two.

I made a few minor changes to the source to allow me to curtail the retries to speed up the copy. So far it's copied about 32 GB from the failing 60 GB drive. Once the data has been copied then I'll start trying to recover files from it. Wish me luck, I think I'm going to need it!

Monday, June 02, 2008

quick and dirty shell command

Today I was working on some old code at work. I discovered at least one duplicate include file which is a personal pet peeve. It's far too easy to allow multiple include files get out of sync so you have different versions for different source files.

What I needed was a quick way of finding all the duplicated include files within this project directory (and subdirectories). It turns out stringing together a few Unix/Linux/Mac OS commands with some I/O redirection makes this task pretty easy.

The first thing we need is to be able to locate all the include files. In the C programming language, these files typically end with the ".h" file extension. We can use the find command to give us a list of the files which end with .h.

The next problem to be solved is that the matching files will have not only their filenames but also the directory in which they're located printed out. So we need a way of extracting just the "base" filename. Fortunately bash has any easy method of accomplishing this with the basename command.

The next logical step in figuring out whether there are duplicate filenames is to sort the matching filenames to make it easier to see matches with the sort command.

Finally we can use the uniq command to show just the filenames which appear more than once. The uniq command has other options. You can choose to show just items which are unique as well.

If we put all the portions of this command together, we come up with the following command. It's doing a lot of work to save us the trouble of manually sifting through all the filenames ourselves. That's what computers are supposed to do for us, eh?

find . -name "*.h" -print | xargs basename | sort | uniq -d

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.