JeffHack: Getting iCal and TimeLog to coexist peacefully

One of an occasional series of ways I make my Macintosh weep. For Pete’s sake, I don’t recommend that you do this, and if you do it’s at your own risk. This is meant more as a tutorial for ways you can hack your Mac.

The problem: I use Stefan Fuerst’s wonderful TimeLog software to keep track of my billable and other work time. It’s great in many respects, but it had one behavior that really bugged me: while it’s running, iCal quits. Which meant that 10 times a day I was waiting 30 seconds for iCal to launch before I could edit my calendar. (Of course, I can always view my upcoming calendar because I use Karl Goiser’s wonderful iCalViewer on my Desktop.)

So I wrote Stefan, and he wrote me back in something like 90 seconds despite it being 4 AM in Switzerland, and it turns out that the problem isn’t with TimeLog, but rather with iCal—long story short, if you run iCal and TimeLog concurrently, iCal can overwrite your TimeLog calendars.

So the trick is to set up TimeLog and iCal so they use different file spaces, but so you can still see your TimeLog calendars in iCal. Luckily, we can do this, and all we have to do is set up a calendar server, multiple user spaces, and hack some program resources. No problem. Note that these steps will work just fine in case you want to use iCal to track multiple calendar spaces that you need to keep separate from one another.

Step one: we need a new user space. Head over to System Preferences > Accounts, and create a new account called “Timelogs”. Make it an administrative account, that will be useful later. If you want to be really anal about it, you can copy the TimeLog icon and paste it into the user picture. (You can guess what I’ve done.) The icon for any file can be copied by highlighting it in the Get Info window in the Finder.

If you haven’t already, this is an excellent time to turn on Fast User Switching in Login Options, because we’ll be doing some switching back and forth for a while.

Step two: hack TimeLog so it doesn’t quit iCal anymore. Go to the application in the Finder, control-click on the icon, and choose Show Package Contents. In the window that pops up, go to Contents:Resources:quitiCal. That’s an AppleScript application; open it up in Script Editor (by dragging it on top of the Script Editor icon—if you double-click on it, you’ll just quit iCal).

Replace the script with the following:


set whoami to do shell script "whoami"

if whoami = "timelogs" then
	try
		tell application "iCal"
			quit
		end tell
	end try
end if

So now the script will only quit iCal while you’re actually logged in as the Timelogs user. Save it. Get Info on the file, scroll down to Ownership & Permissions, change the group to “admin” and the access to “Read & Write”.

  • Note: naturally, this hacked script will be overwritten if you update TimeLog, so you’ll need to repeat this step next time Stefan releases an upgrade.

Step three: now that we’ve hacked TimeLog, we want to make sure that we can’t run it anymore. That is, if we launch TimeLog in our main user account, we run the risk of having it conflict with iCal and eating some calendar data. So we want to restrict TimeLog to only running under the Timelogs user account.

In the Finder, navigate to /Users/timelogs from your primary account (which I’m assuming is an administrative user). On your Desktop, create a new folder called Applications, and drag that into the Timelogs user folder. You’ll be asked for your administrative password. Now drag the TimeLog application into that Applications folder. TimeLog can now only be launched by the Timelogs user.

Step four: fast-user switch over to the Timelogs account. You’ll have a brand-spanking new iCal and TimeLog running over there (and you’ll have to re-enter your TimeLog registration code). Set up everything just the way you like it.

Step five is optional, if you want to have your TimeLog calendars visible in your regular iCal. The whole point of this is to lock away those calendars in a new user space—but you can still view them by using iCal calendar sharing.

So to do this, we need a calendar server. We can do that with WebDAV and the built-in Apache web server. Follow Erik Ray’s instructions in his article on MacDevCenter, and you’re good to go. Turn on Personal Web Sharing in System Preferences > Sharing, and leave it on forever.

Now go ahead and share your TimeLog calendars; i.e., from the Timelogs user’s iCal, publish the calendars you’ll be using. Then log out as the Timelogs user.

Step six: switch back to your primary user space. Subscribe your primary iCal to the calendars you published; boom, your calendars are now visible (but not editable) in your regular iCal.

Step seven: so now we want to actually use TimeLog in our primary user account. But only the Timelogs user can launch the application. So we need an AppleScript to do that as if we were logged in as that user. Like this one:

do shell script "sudo -u timelogs /Users/timelogs/Applications/TimeLog.app/Contents/MacOS/TimeLog &> /dev/null &" user name "username" password "password" with administrator privileges

Copy and paste that into a Script Editor window, all as one line with no carriage returns. Replace “username” and “password” with your admin equivalents, and leave the quotes in, AppleScript needs them. Save this as an application (a checkbox in the save window).

  • Note: for security purposes, you might not want to save your admin password in a file that’s human-readable. If you check the “save as run-only” checkbox before saving, Steve Jobs himself won’t be able to get your password out of this file.

Step eight: Run the new AppleScript application, and you’re done. You now have an iCal-safe TimeLog running. If you like, you can put the AppleScript launch application where you used to keep your original TimeLog application, and you can also put that into your login items if you want this to launch at startup.

That’s it, except for the passel of AppleScripts I’ve written to make this hack more useful in production. Those are available in the accompanying software post, JTLSA.

The War of the Worlds (1938)

This is the infamous Orson Welles radio broadcast version, available (along with many other interesting broadcasts I’m currently downloading) here.

Thanks to a dead battery, I’m only halfway through this, but I’ve got to say — despite the fact that I’ve read the book, watched this on the silver screen twice, and own the Classics Illustrated version: this is still exciting as all heck.

Of course, any review of the show has to include the notion that its original airing caused panicked mobs to flee New Jersey. Which raises the thought that people in 1938 didn’t have a strong grasp of science. I’d love to know if anyone listening to this show on the radio was suddenly reassured when they heard that there was supposedly a radio blackout in their area.

But by that time, they had already rounded up the kids and Bessie and were heading for the hills. God help anyone who tried to escape through the Pine Barrens. That place is spooky.

For contemporary listeners, perhaps the most interesting thing is listening to government responses to disasters then and now. Between assurances from the military that the threat is under control, and official federal appeals for calm and to God Almighty, it seems that not much has changed in seventy years.

John Williams is God

After two days of heavy rotation on my iPod substitute, I hereby nominate the Superman Theme for best piece of orchestral cheese of the 20th century. For four minutes and twelve seconds, three themes battle for dominance through a half-dozen crescendos and the grandest use of the gratuitious key change in modern music. And trust me, I know from gratuituous key changes.

Yes, I’m counting the days.

Signs of the coming apocalypse

Just spotted this out the window, which you can’t tell from the blurry camphone is an official Muzak van. I heard William Shatner’s voice in my head, in the tones of “Why does God need a starship?”, asking “Why does Musak need a ladder truck?”

62MJ0003.jpg

2020 Computing

Hat tip to Cliff Lynch at CNI:

Date: Wed, 22 Mar 2006 12:00:00 -0500
From: Clifford Lynch
Subject: 2020 Science — Microsoft Report and Nature Issue

Microsoft Research has issued a report on the practice of science in 2020 that emphasizes the growing role of information technology, e-science and related developments. You can find information about the report here

http://research.microsoft.com/ towards2020science/ background_overview.htm

and the report itself is available for downloading here

http://research.microsoft.com/ towards2020science/ downloads.htm

In conjunction with this, the journal Nature has done a special issue on computing and science in 2020; all the articles in this appear to be open access, and the table of contents can be found here:

http://www.nature.com/ nature/ focus/ futurecomputing/index.html

Much good reading here. Don’t miss the Nature piece by Alex Szalay and Jim Gray.

jeff@themovies: The Front (1976)

I followed up Good Night and Good Luck with this one. In case you happened to be in kindergarten the last time it was in theaters: it’s the McCarthy era, and Woody Allen is a small-time grifter who pretends to be the author of works done by people who are victims of the blacklist.

I can only recommend this film for people who are truly fascinated by that era and everything associated with it. For the rest of us, this movie is just two notches too turgid to really maintain our attention. Pathetic result for major character, check. Unlikely love interest with unlikely politics, check. Bad guy who claims he’s serving as a puppet of the system, but who obviously is out for his own self-interest, check.

The best reason to sit through this movie is a wonderfully staged (and highly out of character) denouement. It doesn’t make up for the first 90 minutes.

jeff@themovies: Sherlock, Jr. (1924)

Man, they really knew how to make a movie 80 years ago.

Yes, you need to have a certain temperament to sit through a silent movie. But they were shorter than today’s blockbusters, so give this one 44 minutes of your life and see what you think. The lengths that Buster Keaton is willing to go for a gag are, quite literally, insane; the Jackie Chan of his day, he did all of his own stunts, and in 1924 all of the stunts were real. IMDB reports that he nearly broke his neck in one scene.

Perhaps parts of the plotline don’t resonate eight decades later, but the slapstick comedy will still make you laugh out loud.

jeff@themovies: V for Vendetta (2006)

A dystopian future where the government spies on everyone, and everyone accepts it due to fears of terrorism. Clearly escapist fiction is really off the rails these days.

I’m a big fan of the original V for Vendetta comic series, so I’ve been looking forward to the movie for months, and caught it on its first showing in DC. Verdict: a great romp. There’s plenty here for people who loved the comic, and plenty here to piss them off; I can certainly see why Alan Moore distanced himself from the final product. (Although Moore doesn’t seem to understand that movies and comics are very different media with very different audiences; it’s hard to picture a movie that would make him happy.)

I’m going to try to avoid spoilers in the rest of this review, but if you want to go into the movie cold, it’s best to stop reading now. Suffice to say, it’s recommended.

Unfortunately, some of the best parts of the original series were jettisoned for the movie. V is much more mysterious in the comics; his abilities are never quite explained, and the movie version is both more powerful and more straightforward. Anyone who sees the movie and is intrigued about this angle on the character should read the book, immediately.

Evey is a bit older in the film than she is in the series, probably because Natalie Portman isn’t 14 anymore. She’s also in less dire straits in the film, which gives her a bit of moral purity that’s less clear in the series. On the other hand, what happens to her is one of the greatest story arcs in recent fiction, and it was stunning to see this faithfully adapted for the screen.

It’s a bit of a shame to see V drop the asexual aspect to his character—and it would have been even more interesting if they had changed this and had maintained Evey’s age as a Lolita. I suppose that this will never happen in an American film, certainly not a “comic book” film. But for once I’d like to see an adaptation where the hero doesn’t give away his secret identity to the love interest in the first reel. Maybe it’s okay for Superman, since he goes on to marry her, but one of the things that makes Batman interesting is his self-sacrifice. Anyone who doubts this really needs to read Son of the Demon.

This isn’t the best of all possible V movies, but it’s pretty damn good.

An open letter to David Hughes

Mr. David Hughes
Acting President and CEO, Amtrak

Dear Mr. Hughes,

As a fellow frequent traveler on the Northeast Corridor, I have a few questions about how you might respond to certain hypothetical experiences during your trips.

1) You are running late for a train which is boarding from Gate B at Union Station. You enter the platform from the Metro entrance at Gate A, carrying your ticket out in your left hand. You are within five feet of the platform when you are stopped by two armed police. They direct you to reenter through Gate A, walk around the 200 MARC travelers waiting for their train, and come back in through Gate B. How do you reward your officers for preventing such an obvious threat to safety?

2) Onboard the train, the conductor is approaching and you know you have to sign your ticket. You know from past experience, when your ticket was stolen, that your signature is solely for the convenience and security of Amtrak. You ask the conductor, “Do you have a pen?” He replies, “Yes,” and makes no motion to give one to you. According to your training manual, should he have replied, “Yes, sir?”

3) You move from one seat to another to get out of the sunlight glare, and neglect to take your seat check. A conductor asks you for your ticket again, and you tell her that your seat check is nine inches from her right shoulder. Should she: a) move the seat check for you, or b) tell you to get it yourself? Presume for this hypothetical that you are in the window seat with a laptop in your lap, with luggage in the aisle seat, and the aisle tray table is down with your work spread out on it.

4) You are trapped in an elevator for four hours with the Pepsi-Cola delivery guy. You are thirsty. He proposes to sell you a can of soda for $1.75, which you know to be a profit markup of at least 2,088%. Do you feel warm and amiable towards him afterwards?

My one-way travel today cost $71.25. There is a bus I can take for $15. I take the train because it is a more pleasant experience. Or at least, it used to be.

Best,
Jeff Porten

Jeff is an idiot, entry #4,372

Don’t you hate it when you write a quick utility AppleScript to automate something you do regularly, go to save it, and find that you’ve already done this, named it exactly what you were going to name the new script, and saved it exactly where you were going to save it?

I wish this were rare.

.mil WHOIS server is offline

This is an email I’m circulating on a few mailing lists, tracking down a weird problem I ran into today. If anyone knows more, please comment.

I’m doing some routine maintenance on our mail server and tracking back IP addresses with a database that queries various WHOIS servers. To my surprise, the .mil whois server at whois.nic.mil is offline — the domain itself doesn’t resolve any longer.

I spoke to the very nice customer support representative at the phone number I found on the web, who told me the following:

1) he wasn’t sure if this service was *ever* public. Which I find interesting, as it’s a coded flag in the whois man page.

2) he said I should refer all IPs I need to review directly to DoD CERT.

3) he said that he received many calls like this, and it’s “always” people spoofing the IP addresses of .mil computers. I mentioned that since I’m tracking spam flow, it’s likely to be someone with a legitimate .mil address and a compromised computer. He referred me again to CERT.

Anyway, this struck me as *very* odd, and I feel like I’m showing up in the middle of the story. Anyone know more about this?