Friday, August 22, 2008

Moving to Seattle

This has been in the planning stages for a while, but in October I'll be moving from one Washington (DC) to the other (Washington state), specifically to Seattle or thereabouts. Through the magic of telecommuting I'll be keeping my same job with the Senate, which is fantastic because there are always lots of cool projects going on and the freedom to play with the latest technologies and gadgets.

I have a blog post in the works called "Lightweight Cross-Country Moves" because in an effort to minimize the amount of stuff I lug (or have moved) 2800 miles, as well as just to lighten the load in my life, I've gotten serious about eliminating physical possessions wherever possible. I'll post that once I have it in better shape than random thoughts and bullet points.

And no, this move has nothing to do with my love for Microsoft as some people suggested on twitter. I still hate them as much as ever. :-)


Congrats Matt! I hope it all goes well!

Great news! Wherebouts are you guys planning to live? Drop me a note when you get here and I'll show you the sites.

Matt, as you know I've done one round trip international move in my life so far. Albeit to Montreal Canada, it involved moving from two locations at once -- Baltimore, MD and Minneapolis, MN. We used a self packing mover (ABF Freight UPack) for both directions. We consolidated as much as possible because you pay by the linear foot. Definitely something to think about for your move...

As a person who have just moved from DC to Orange County CA, I can understand your situation. :)

I did 3640 miles in 1 week and it was a nice trip. :)

Good luck!

@Ryan--thanks! We're coming out in a couple of weeks to look for a house. Looking in Kirkland, Bellevue, Redmond, Renton, etc. etc. at the moment. Just need to see some of the areas in person to know whether or not they'll work for us.

@Peter--thanks for the tip. We've actually been looking at ABF UPack. I assume you had good luck with them?

@Oguz--nice pictures! Your trip was even worse than ours will be!

Interesting note--the captcha letters for me on this comment are MVC :-)

Hallihallo Matt !

Since my longterm passive fellowship in our ColdFusion community, we have had several

short email contacts - remember CFHibernate :-) ?

Now I have just recognized Your comments in the onTap universe with regard to "onTap on BlueDragon" ... Has Your strategic decision to "eliminate physical possessions wherever

possible" something to do with Your wish for "onTap on BlueDragon" ?

In any case: I wish You a good physical move as well as a possible framework move :-) ...



P.S.: I am currently unsure about my own next moves - in the physical world as well as in the virtual world of (web) software apps ...

Ouch long move. At least you're trading one washington to a far better one. Since it will be a telecommute, do yourself a favour, look at being far outside the Seattle area. Hell I'd even suggest Bellingham Washington or somehwere similar. I envy you. wish I could do the same.


Yea Matt, we have used UPack twice now and have had great luck both times. Especially since both times were international moves US Canada and they simplified the customs bit quite a bit. I highly suggest that you estimate the linear feet the best you can because the penalties for being under or over by so much can add up to be quite a bit. Plus, it's cheaper to reserve 10 feet than to reserve 4 feet and then go over another 6 feet. I suggest investing in a tarp to throw over stuff before putting in the bulkhead. Rarely I've been told trailers can have leaks even though they try to use newer trailers for UPack movers. I know from my experience working at UPS that trailers can have leaks and do a lot of damage. Also, we used their terminal to terminal service since the drop off fees were expensive for the 8-10 feet we've used in the past. Also, it's worth it to invest in a bunch of commercial plastic attached lidded containers. Drug stores and many commercial businesses use these for shipping to stores. Costco used to carry these for a while -- just search for attached lidded containers.

Matt, I nearly peed my pants when I read that you were moving to Seattle. It will be wonderful to have a Mach-II guru local. Our company is located in Kirkland and has been slowly moving towards Mach-II for our heavy-weight applications. We may have to nab you for some Mach-II/OOP consulting.

Very cool Zack! More than happy to help however I can. I'll need to familiarize myself with the CFML community in the area as soon as I get there. Very much looking forward to it!

Be sure to check your cell phone coverage for this move (or any time you do cross-country travel).

Microsoft SQL Server, Mobile Edition, seems to work best with a fairly robust connection. Generally you shouldn't have trouble except in the following situations:

1) Rest areas in the midwest (Iowa, Illinois, etc) tend to use metal bathroom stalls. If you're answering nature's call at one of these rest areas and your connectivity suffers, expect degraded response when attempting complex or unoptimized queries (worse, I found the infrared sensor in the toilets can trigger the infrared port on my Motorola phone which really bogged down DB response, especially with non b-tree indexed tables)

2) Everyone is a DBA. At a truck stop in Wyoming (I believe it was a "Flying J" near Casper, if memory serves) I almost got into a tremendous row with a gang of motorcyclists-cum-analysts who insisted they could reduce the running time of one of my lengthy query operations by building a deliberately denormalized "warehouse table" for speeding up read performance. Well, as I tried to quote some C.J. Date to them, but they would hear none of it. I left in a hurry, but not without incurring several mean motorcycle-chain gashes on the hood of my 1998 Buick Regal.

With those things in mind, enjoy your trip good sir!

My wife and I just came back from Seattle on Tuesday night and we're looking to move out there as well. Best of luck with the trip. If you're looking for a drink when you roll into town, I highly recommend the Taphouse Grill...160 beers on tap and a fish sandwich to die for.

Tuesday, August 12, 2008

File Manipulation on Windows Servers from Linux

This is more of a handy tip than anything earth-shattering, but yesterday I was faced with the task of grabbing all files with a particular extension from a nested directory structure, moving them all into a single directory, and renaming them with a different extension. I also had to be careful to preserve the original timestamp of the file.

The files reside on a Windows server, and needless to say the thought of remoting into the Windows server and spending the afternoon drilling into nested directories, sorting by file type, and manually moving and renaming the files didn't appeal to me.

One of the great things about Linux is how powerful the shell is. Let me preface this with saying I'm not a DOS expert, so maybe there's a way to do this in DOS (or PowerShell, which I've never tried), but I knew I could probably accomplish this entire task in a couple of commands in a bash shell.

Step 1 was to mount the Windows server drive:

sudo mount -t cifs //server.dns.or.ip/sharename /mount/point -o user=username,password=password

Note that "/mount/point" is the local directory where you want to mount the share. I tend to use something like /media/servername-driveletter because mounting everything in /media is easy to remember, and on some distros this will also cause the drive to show up on your desktop (though this doesn't happen on Kubuntu).

With the drive mounted, I navigated to the top level of the (rather nasty) nested directory structure and ran the following:

find ./ -name "*.fileextension" | xargs -i mv {} /mount/point/destinationdirectory

What this does is traverses the directory structure, finds all the files with the file extension I needed to move, and pipes that into the move command. The "xargs -i mv {}" bit basically says "get your arguments for the command you're about to execute from the standard input (which is the list of file names kicked off by the find command) and replace {} with the data from standard input." Then of course /mount/point/destinationdirectory is the directory into which I want to move the files.

A note if you want to use copy (cp) instead of move (mv)--this does NOT retain the original timestamp. The cp command has a -p option that preserves the original timestamp, but this did not work for me when I was mapped to a Windows share. Apparently this is because I'm executing the command as one user on Linux and that user doesn't have permission to change the timestamp on the Windows side. If you were logged in with the same user name on both sides maybe this would work, but I didn't try it.

So with step one completed, I just needed to rename all the files with a new file extension, or in my case I was actually just removing a second file extension since the files were named in the format "filename.ext1.ext2" and I just wanted to remove the ".ext2" part.

After navigating to the directory into which I moved all my files, that was another one-liner in the terminal:

rename -v 's/.ext2$//' *.ext2

The rename command in bash allows for the renaming of multiple files using Perl regular expressions as the criteria for the rename operation. In this case I just wanted to lop off the .ext2 bit, and apply that to all files with the .ext2 extension. The -v option is for "verbose" so I could watch what it was doing while it did it, and if you're nervous about what might happen, you can use the -n option to have it show you what it would do with your command but not actually do it.

So a bit of research and help from a Linux guru friend, and the drudgery of file moving and renaming was reduced to two commands in a bash shell. With some clever piping I probably could have even done this in one line.

I suppose my point with all of this is when I'm faced with little tasks such as this one, I try to take the time (unless I asbolutely can't) to find a way to accomplish the task elegantly and in a way I can use again, as opposed to blindly saying "there goes the afternoon," shutting off my brain, and dragging files around in a GUI. Not only does this make me more productive, but I learn something in the process, and it's something I can use and alter time and again in the future to make boring tasks a lot less work.


There is a pretty easy way to do this in Windows using pure GUI (and there are ways to do this in DOS as well.)

If you're ever in a situation where you've got to use the Windows GUI, then just do a Windows "Search..." (right-click on folder, choose "Search...") and use the extension as the filter.

It will then return every match in that directory tree. You can then select all the files, right-click and select "Cut".

Last, just paste them into the directory you want.

I've used this technique to quickly clean up .tmp files from a folder and occasionally to remove all the .svn folders from a directory.

The danager of mounting samba/cifs shares with the username and the password on the commandline is that during the mount operation the process listing will show the mount command AND show the username and password just as its written on the CLI. Not a huge risk, but worth noting that on a multiuser system any other user that does a process listing can intentionally or accidentally read the credentials.

@Dan--thanks for the Windows tip. That covers the move part at least, and I assume there's some relatively easy file rename command in DOS that would keep you from having to do the file renaming file by file.

@Steven--good point; I guess I wouldn't want to be in a situation where someone I didn't trust had access to the system ;-), but that's definitely worth pointing out. If you're doing this from a Linux server that may have multiple people with access, you'll want to be aware of this.

FYI, the xargs command uses the environment variable space to communicate the file list from the find command. If the paths are long, or there are more than X files, xargs will blow up because it has exceeded the maximum allowed environment storage. A better choice is to use the -exec switch on your find command.

Here's an awesome reference of find goodness:

I guarantee there's a pile of useful stuff find can do that Windows GUI search cannot.

Thanks Jason--good info. So much Linux to learn, so little time. ;-)

Saturday, August 2, 2008