Scripts Part 3: Split and Rejoin Large Files

Two events have transpired to lead to the posting of this script: 1) I've been meaning to post a new script to the Scripts section of the blog for some time, and 2) MacOSXHints today had a hint about splitting and rejoining large files, and suggesting scripting this process. I just happen to have had such a script lying around for some time, so this seemed like an especially appropriate time to post it.

Essentially, this script is made to take large files and cut them into smaller (theoretically CD or DVD sized) pieces. The same script can then be used to rejoin these chunks. For splitting, the script uses the split command, and to rejoin files, it uses the cat command.

So here it is in all its glory.

SplitAndRejoinFiles Script
See the code

Option-Arrow Word Movement in Terminal

Want to use the option-arrow key combo to move through text in Terminal just like you do in virtually every other Mac application on the planet? Boy, I sure did. Luckily, Allan Odgaard, the author of TextMate, has figured out how, and it's a breeze. In a nutshell (no pun intended):

  • Open Terminal
  • Open the Inspector (command-i)
  • Go to the "Keyboard" section
  • Add a new key binding by pressing the "Add" button
  • Set "Key:" to "cursor left"
  • Set "Modifier:" to "option"
  • Set "Action" to "send string to shell:"
  • In the text box, press the escape key to get the "\033" text, then hit the "b" key, for "back"
  • Click "OK"
  • Repeat this process for forward movement, using "cursor right" for the "Key:" setting, and "escape-f" for the forward key binding
  • Be sure to click "Use Settings as Defaults" if you want the change to be permanent

The Terminal Inspector: Finally Proper Word Movement

(click for larger view)

That's it! Now hitting option-left-arrow will move the cursor back one word in Terminal, and, of course, option-right-arrow will move it one word forward.

Sweet!

I Actually Bought iLife '06

I've always pooh-poohed the iLife suite as being oh-so-not-professional, and thus, mostly useless to me. But over the years I've found more and more reasons to like and use many of the apps in iLife. The latest incarnation of the suite actually found me shelling out my $79 bucks for it, which is seriously not a bad deal at all for everything you can do with it.


The iLife '06 Suite: I'm Done Pooh-Poohing

iMovie and iDVD
Now, I'm not a fan of iMovie or iDVD. These apps are great, I guess, if you need to do something quick or not that complicated, and if you didn't want to shell out the dough for Final Cut or DVD Studio Pro, they'd be a great value and plenty good for many personal projects. But I cut my teeth on the Pro Apps, and having done so, I find iMovie and iDVD far too limited — and even confusing sometimes — for my own use. For the money, these are amazing apps, but I can't really talk about them as I just don't use them. Suffice to say, it looks like the latest versions include some nice new features that long-time users will appreciate.

iPhoto
I've been using iPhoto for about a year now. It's fine for me. I'm not a pro photographer, and the vast majority of my photos come from my cell phone. This collection has grown fairly large in the last year, though, so I needed a way to organize it. iPhoto was the obvious solution as it came bundled with my G5. For my limited purposes it worked fine. The only major complaint I ever had was that iPhoto 5 takes all your images and organizes them in an arcane, completely non-sensical (to humans, at least), database-like folder structure. And it always makes copies of any image it imports. This sucked for two reasons: 1) Every picture in iPhoto 5 was a duplicate of the original, taking up extra disk space, and 2) the organization of images in iPhoto did not match what you saw in the Finder.

iPhoto 6 rectifies both these problems. When importing new photos, iPhoto 6 finally gives you the option to not copy your files to the iPhoto database. Which means you can have your photos wherever you want on disk. Nice. If you do choose to copy your photos, however, iPhoto 6 will organize them on disk exactly as they are in iPhoto. So if you have a film roll called "Pets" in iPhoto, it will correspond to a folder in the Finder called "Pets." 'Bout frickin' time. Was that so hard?

iPhoto 6's new editing mode takes some interface cues from Aperture, and is pretty nice too. Check it out.

GarageBand
My latest love, and the real reason I bought the suite, is GarageBand. I recently discovered GarageBand when I wanted to record a demo song quickly, easily, and with very little actual physical equipment. I own a ProTools MBox system, but I have to tell you, GarageBand's ease-of-use, and its wonderful collection of amp simulators made me think twice about ever using ProTools again. I was able to plug my guitar and mic into my mixer, plug the mixer directly into the Mac, and go to town, recording and mixing my demo three times in two days (and not full days, mind you, this was in the evenings after work). The great thing was that I needed no amps, which I can't really use in my apartment because of noise and space constraints. Using GarageBand's included amp simulations and built-in effects, though, was good enough, and in two days I was able to produce a demo that sounded as good if not sometimes better than stuff that took weeks to mix in ProTools. Color me amazed. If GarageBand had support for 24 bit sound — or for that matter, the MBox hardware — I'd probably switch to it altogether.

At this point I've only toyed with the latest version. But it looks to be quite nice. The instruments, effects and simulations all appear in a new, integrated, sidebar-like media manager, rather than in a new dedicated window, and switching instruments will toggle the settings in the sidebar. There's also, now, support for video, which is great, and a much welcome addition to the app.

The only problem I had was using the "Musical Typing" feature, which allows you to use your computer's keyboard as a MIDI input device. In the new version using the keyboard to record MIDI exhibited a great deal of latency and resulted in horribly offbeat recordings. It was basically unusable. Using a proper MIDI keyboard, however, worked fine. This was not a problem in the previous version of GarageBand.

That said, I'm really looking forward to playing with this new version. There are all sorts of features aimed at podcasters that could be really useful for general sound production as well, particularly the "ducking" feature. All-in-all, I'm far happier with GarageBand than I ever thought I would be.

iWeb
I'll just say it. I hate iWeb. I don't know that it's necessarily a bad program per se, but It's really not a program geared toward someone like me. iWeb is almost completely template driven, and barely customizable. You can't even change the color of links on your page. I'd call it a web publishing app more than a web design app, because Apple apparently expects you to largely use their designs, with perhaps minor modifications. If that's all you want to do, and you like their templates (which are very nice, as usual) then you might like iWeb. I prefer a bit more control than iWeb offers, and I will never use it.

As you can see, I only use two of the iLife applications. Two. Out of five. Am I bothered by the fact that I spent $80 bucks on the iLife suite? Nope. Not a bit. This package is such a good deal, and does so much for the money, I'd pay $80 bucks for one of these apps without a blink. And if you happen to use all five, iLife is easily one of the best deals going in software anywhere, ever.

Final Cut is Reliable Again!

I recently got my sweaty mitts on the latest Final Cut Pro Studio — which includes, among other things, Final Cut Pro 5, DVD Studio Pro 4, and Compressor 2 — and had the opportunity to run it through its paces on a fairly long and involved project. The project involved cutting about five hours of vacation footage down to somewhere around an hour-and-a-half. There was also a 3 minute music video section for the grand finale. Finally, I had to author a DVD around all this content, complete with chapters and a slideshow of stills from the video. Oh, and did I mention, this all had to be done in four days?

Final Cut Pro
Some background first: I've been using FCP since the golden days of version 1.0. Okay, the golden days didn't really start until v.1.2.5. But suffice to say, that version of the program was rock solid. I could use it on my beige G3 for hours with nary a crash. It was easy and reliable and worked like a dream. And I fell in love. Subsequent versions of the app saw gradual decreases in stability. Version 2 was okay. No real problems, I guess, but the occasional crash, to be sure. This was the version in which they implemented the "Autosave" feature, which I remarked to my class that year, was indicative of the fact that Apple pretty much knew the app would crash at some point, and that my students should bear this in mind for obvious reasons. Version three was increasingly buggy and crash-prone, and it only got worse in version 4. Version 4 was an abomination. With that version I saw my beloved Final Cut go from rock-solid, wonderful video editor to a time and troubleshooting black hole. It was horrid. So much so that — after participating in every user-group survey I could find — I finally, for the first time ever, submitted feedback to Apple. It was that bad. In my post I pleaded with them to bring back the qualities that made Final Cut the app to use (or, in many cases, switch to) for video editing: ease-of-use and stability. Fuck features, these things come first.

Well, it looks like it worked.

I'll say up front, over the course of four days of straight editing — on a system that most likely needs a new motherboard no less — Final Cut Pro v.5.0.4 did not crash once. Not. One. Single. Time.

That's what I'm talking about.

There was still the occasional bug or two. There's that pesky bug where pasting into the timeline sometimes puts the pasted clip into track one, and sometimes into track two, even though track two is the only paste-enabled track. A few years ago, Apple changed the default paste-to-track behavior, so that now you have to disable pasting in the tracks you don't want to paste into, rather than enabling the ones you do, which seems ass-backwards and totally counter-intuitive, but whatever. And I could live with it if it worked predictably, but it doesn't. Still. What's up with that?

Fortunately, we see some bug fixes in this version as well, though. The most annoying (and as-yet-unfixed) bug in version 4 was the text rendering bug that, about 50% of the time, caused text to be "smeared" or "doubled," both in preview and in render. I've actually seen this on TV when editors were clearly using FCP v.4 and just didn't catch it or couldn't figure out how to fix it. It's incredibly annoying, and thankfully, it's totally fixed in FCP 5. Or at least it didn't happen to me once during this whole project, and I did lots of text.

DVD Studio Pro
Other Pro Apps saw appreciable gains in stability and overall usefulness. DVD Studio Pro has gotten a bit peppier in the UI. My main complaint in previous versions of DVDSP was that it was dead slow at times, even on a G5, but this version performed quite nicely. There were some minor glitches with chapter markers and slideshow timings that showed up on builds of the disc, but these were usually rectified by resetting the properties of the element in question, and other than that, the application worked great, stayed out of my way, and allowed me to rapidly author, test and build my DVD.

Compressor
Compressor has seen some improvement too, though still not enough that I could recommend it. Compressor is now the default way Apple expects you to encode your media to MPEG2 for DVD authoring. In fact, the MPEG2 Export Component included with previous versions of FCP is strangely absent from this release. After installing FCP Production Suite 5, you will no longer have the ability to encode MPEG2 movies from Quicktime Pro. This would be fine except that, at least in my experience, Compressor sucks ass at encoding video. Let me be a bit more specific: Compressor takes for freaking ever to encode movies to MPEG2. Wanna know why? Well, apparently, Compressor is not multiprocessor aware. To wit: I took my movie to encode into Compressor (directly from FCP, which is pretty sweet integration, I must say) and began encoding. When the encode was taking way longer than I thought it should (four hours for a ten minute movie? Dude, I'm on a deadline here!) I decided to check Compressor's resource usage with the ever-useful top -u command. top showed Compressor running at 70% max. After replacing my MPEG2 Export Component, I used Quicktime 7 to encode the same clip, with the same settings, and it used around 190% of the two processors. Not too shabby, and much faster!

The other problem with Compressor is that, when you access it via FCP, it takes over the FCP interface and locks you out of your project. So, if you use Compressor to encode your movie, you can't continue editing in FCP. Hey! Did I mention I'm on deadline here?

I'm sorry, Compressor is a great idea, but it's just not ready for primetime, and it's really not ready to be the default encoder for MPEG2 material. It's just too slow and it completely locks you out of your FCP project.

Hmmm... Maybe I should send feedback...

Overall, I'd say this is a very good year for Final Cut users (unless you're getting a new Intel Mac before March). The suite is working better than it has in years, and there are lots of new features to play with that I won't even bother talking about. 'Cause the best new feature in this year's FCP release, in my opinion, is stability.

Really, what better feature is there?

ADDENDUM:
An intrepid commentor asked how to get back the old Quicktime MPEG2 component. Here's how to get it from your original DVDSP install disc:

  1. Insert the DVD Studio Pro install disc
  2. Control-click on the "Install DVD Studio Pro 3" alias and select "Show Original"
  3. In the resulting window there will be a folder called "Packages" which contains all of the individual installers for the DVDSP app, including the one for the QT MPEG Component
  4. Open the "Packages" folder and run the package installer called "QuicktimeProMediaComponent.pkg"

ADDENDUM 2:
It looks like you can also run into serialization issues when trying to restore MPEG2 functionality to Quicktime, as one reader points out. See the comments for a number of additional solutions to this problem.

Re-Binding to a Mac Server

Last semester we had a lot of problems in the lab. Our main problems were due to two things: the migration to Tiger, and problems with our home account server. Our Tiger problems have largely gone away with the latest releases, and we've replaced our home account server with another machine, and, aside from a minor hiccup here and there, things seem to have quieted down. The Macs are running well, and there hasn't been a server disconnect in some time. It's damn nice.

There has been one fairly minor lingering problem, however. For some reason our workstation Macs occasionally and randomly lose their connection to our authentication server — our Mac Server. When this happens, the most notable and problematic symptom is users' inability to log in. Any attempt at login is greeted with the login screen shuffle. You know, that thing where the login window shakes violently at the failed login attempt. This behavior is an indication that the system does not recognize either the user name or the password supplied, which makes sense, because when the binding to the authentication server is broken, for all intents and purposes, the user no longer exists on that system.

I've looked long and hard to find a reason for, and a solution to this problem. I have yet to discover what causes the systems to become unbound from the server (though I'm starting to suspect some DNS funkiness, or anomalies in my LDAP database as the root cause at this point). There is no pattern to it, and there is nothing helpful in the logs. Only a message that the machine is unable to bind to the server — if it happens at boot; nothing about why, and nothing if it happens while the machine is on, which it sometimes does. It's a mystery. And until recently, the only fix I could come up with was to log on to the unbound machine and reset the server in the Directory Access application. Part of my research involved looking for a command-line way to do this so that I wouldn't have to log in and use the GUI every time this happened, as it happens fairly often, and the GUI method is slow and cumbersome, especially when you want to get that machine back online ASAP.

It took me a while, but I have found the magic command, at a site called MacHacks. Boy is it simple. You just have to restart DirectoryService:

sudo killall DirectoryService

This forces the computer to reload all the services listed in the Directory Access app, and rebind to any servers that have been set up for authentication. I've added the command to the crontab and set it to run every 30 minutes. That should alleviate the last of our lab problems.

Hopefully the rest of this semester will be as smooth sailing as the past two weeks. I could use a little less systems related drama right now.