Thursday, September 3, 2009

WolframAlpha Awesomeness of the Day

“How long since Jurassic Park came out?” =>
16 years 2 months 23 days since June 11, 1993

How old do you feel now?

Tuesday, September 1, 2009

My Life as a Comic Strip

Never before has my life been so well captured by a Canadian webcomic about anthropomorphic dinosaurs.

Thursday, July 2, 2009

My Life in TLAs

I go to church at IBC. Bible translations which I have read in their entirety include JPS, KJV, and NIV.

I have two degrees from MIT. I have memberships with AAA, ACM, ADC, and NRA, and an Open Water Diver certification from SSI.

The airports I’ve visited the most are TPA, FLL, BOS, IAD, and DCA. I drive a 4WD 2006 FEH and usually get between 29 and 32 MPG.

I work for PTR at NRL, which is under ONR (part of DOD, of course). My computer is an LED-backlit MBP running OS X (pronounced “oh ess ten”, not “oh ess ex”; it’s the version after OS 9). I write software for its BSD layer and compile it with GCC. Other software I write against the JDK’s API, which I then compile with ANT and run in a JVM. Sometimes I run Scheme code with PLT or MIT/GNU. I have also worked on software to control robots from MHI and ASI.

I store files on AFS and money at BOA and ING. I communicate via AIM and my ATT cell phone. I spend far too much time browsing the WWW and reading RSS feeds. I listen to music in AAC format. I watch TV shows and movies on DVD. TNG and TOS are my favorite Star Treks. SG-1 is my favorite Stargate. TAS is my favorite Batman. My favorite comic book characters are the members of the JLA in the DCU.

I live in the USA.

I am JRH.

Saturday, February 14, 2009

May I Please Have My Name Back, Now?

I think I was incredibly patient throughout this whole mess, but it’s really getting old. Nobody ever asked me for my permission to use MY NAME as a meaningless campaign slogan, but now that things are settling down and the inevitable disillusionment is growing, I want it back.

Here, I’ll even let you have another poster with my name on it, but this time it’ll actually make sense, because it will have my face on it:

HOPE

I guarantee that the original photograph didn’t come from Reuters or AP; I just took it myself with my MacBook Pro’s built-in camera and Photo Booth (using the Comic Book filter). I then spent far too long trying to figure out the GIMP in order to put my name across the bottom (GIMP.app 2.6.0 definitely deserves the “experimental” warning; it has the usability of something from Redmond).

Anyway, it’s bad enough that the Smithsonian won’t give me my rock. Is it really too much to ask that I get to keep my own name?

I’m not being too audacious, am I?

Tuesday, February 3, 2009

Prayer Is Essential

This past Saturday, my old friend Carl Philip “Phil” Carlson was on the radio. He is now a campus missionary in Texas, and he was on the air sharing his testimony and talking about the work he does at his alma mater.

I already knew some of his testimony, from reading things he’s written and from talking to him about it (and I’m in Phil’s Facebook Group), but this was a whole different experience. When we’ve conversed recently, it’s been phone conversations that last maybe ten minutes; this was almost a half hour of Phil pouring his heart out. It was heartbreaking and sad and beautiful and powerful and amazing and challenging.

It’s hard to believe that this is the same guy I used to talk Star Trek with in high school as we’d study the latest screencaps from Pedro’s Shiporama (which still exists, wow!). Back then, Carl Phil struck me as a little stiff when it came to matters religious, but I just chalked it up to him being a Methodist (and it was actually kind of a welcome change from the people at the Pentecostal churches I attended); I had no idea of the kind of pain he was hiding, or its magnitude. We mostly stuck to lighter fare in our conversations, like science fiction or complaining about the latest stupidity inflicted upon us by our English teachers (not you, Mr. Wolstenholme).

But now, he’s a warm, sincere, outspoken, eloquent, mature man of God (with a hint of a Texan accent). Look at how he expounds upon 1 John 4:10:
It’s “not that we loved God, but that he loved us and sent his Son to be the propitiation for our sins.” In there we see that two-sided element: We’ve sinned. Sin is evil. It requires a price to be paid, it requires a just price. But at the same time, it’s love that he sent us a means of redemption. And that love is far greater than anything we can do on our own, it’s far greater than any human being can do, although the love of God can be poured through human beings… The key to life is the combination of the Law of God and the Good News of God. The Truth is so important that we need to show people, look, this is our situation, this is how we got here. And here’s how God is taking us out of it.

Or when he’s talking about forgiveness:
Forgiveness is a process: it has a starting point, but it doesn’t have an ending point while we’re alive. It really is something where we have that first moment, we say, look, I forgive you. But tomorrow those emotions are going to come back again, the memory’s going to come back, so we have to remember, okay, look, I am going to choose to forgive again today…

Wow. It’s not every day that I hear a testimony which actually impacts me; it’s usually just “I did bad things, blah blah blah, and then I found Jesus and now my life is different.” But this dude’s for real, you can hear it in the enthusiasm in his voice. God has touched his life, and he’s excited and wants to tell everybody about it.

It really gives me pause, because I realize that I don’t always share his enthusiasm. Am I complacent? I hope I’m not like the seed that fell among thorns. Sure, I try to live my life in a way that would be pleasing to the Lord (and routinely fail, of course), but I really don’t reflect on my salvation the way I should. I take it for granted, when I should be constantly thrilled and amazed and grateful and eager to tell others. “For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord.” Are those just words to me, or do I comprehend them as a statement of fact and a demonstration of unconditional love? Forgive me, Jesus. And thank you.

I highly encourage anyone to listen to Phil’s message, I’ve listened to it like four times now.

Monday, January 12, 2009

Job (the guy, איוב‎, not ‘employment’)

Bob made this statement to me this morning: “I’m reading Job now in my Old Testament readings and I wonder how the Pharisees could blame that dude’s blindness on his supposed sin after reading Job.”

His implication, of course, is that, clearly, the Pharisees’ own Scripture teaches them that it’s possible for a person to endure suffering without having sinned, and so the (apparently common) belief in Jesus’s day that the sick were being punished for a past sin (cf. John 9) reflected poor scholarship on the part of the religious leaders.

Naturally, a visit to Wikipedia was in order.

The Book of Job article has this interesting paragraph:

One Talmudic opinion has it that Job was in fact one of three advisors that Pharaoh consulted, prior to taking action against the increasingly multiplying “Children of Israel” mentioned in the Book of Exodus during the time of Moses’ birth. The episode is mentioned in the Talmud (Tractate Sotah): Balaam gives evil advice urging Pharaoh to kill the Hebrew male new-born babies, Jethro opposes Pharaoh and tells him not to harm the Hebrews at all, and Job keeps silent and does not reveal his mind even though he was personally opposed to Pharaoh’s destructive plans. It is for his silence that God subsequently punishes him with his bitter afflictions.[3].


The Sotah tractate of the Babylonian Talmud can be found here (and this is the page which mentions Job, Jethro, and Balaam as Pharaoh’s 3 advisers). The Talmud didn’t get written until several hundred years after Jesus (Rabbi Hiyya lived in the 3rd century), but it seems likely (to me) that some of the ideas contained therein were already present in the Jewish thought of Jesus’s day.

Hurray for the Talmud; when the Scripture presents you with an idea that challenges your beliefs, all you have to do is invent further backstory to explain it away. Biblical retconning at its finest. How to reconcile Job’s innocence with the idea that the guiltless are not afflicted? Ignore the text and claim that Job must have done something bad after all—despite the fact that the LORD himself said “he is blameless and upright”.

I’m not really sure how widely this belief about Job is held (the Talmud is more up for debate than the Tanakh, and that’s only one of many competing Talmudic references to him), and I’m fairly certain that the Holocaust drastically changed the way Jews view suffering, but it might explain why the Pharisees and even the disciples seemed to think that blindness, lameness, &c. must be deserved punishment.

If either of the two people who might possibly read this happens to be Jewish (somehow, without me knowing about it), I’d love to know how (if?) Job is taught in Synagogue.

Tuesday, September 2, 2008

iSync—Periodically!

My free-from-AT&T (because I am cheap) Sony Ericsson Z310a has Bluetooth comms, so with the help of a third-party iSync plugin, I can synchronize my phone’s contacts and calendar with my computer’s Address Book and iCal.

But I use Google Calendar because it allows me to access my calendar from my laptop or from my computer at work. Up until recently, that meant that using a web browser, because iCal had read-only access. So I would occasionally launch iCal and manually refresh the subscription to my GCal calendar, and I would even less frequently use iSync to push the calendar from iCal onto my phone. But usually I’d just leave Google Calendar up in a browser tab and not even run iCal.

Well a few weeks ago, Google finally added CalDAV support to GCal, which means that I can now use iCal as my calendar program and still have the benefit of viewing my calendar from any computer with WWW access. Great news!

This had the side effect of illuminating the fact that I won’t remember to sync my cell phone as often as I should; I typically only remember to do it once every week or two. Clearly, an automated solution is warranted. Because I am lazy.

Enter launchd.

launchd is OS X’s neato unified replacement for init, rc, inetd, xinetd, at, cron, and pretty much anything else that pertains to the launching of programs in response to the meeting of some sort of criteria (incoming network connection, file modification, file added to directory, time elapse, time of day, &c.). It understands service prerequisites and launches stuff as needed and in parallel, so booting is much faster than it is with Linux’s serial execution of rc.d scripts in alphabetical order of file name (what a hack). Anyway, it’s really great and magical and its only downside is that it continues Apple’s trend of using Property List XML files for everything under the sun.

Luckily, Peter Borg (Swedish, not evil alien) wrote the wonderful Lingon, which provides a simple GUI for me to describe what I want my LaunchAgent to do and generates the appropriate XML behind the scenes (and happily uses intelligible indentation, unlike most automatic code generators). It also knows where to put the resultant file (~/Library/LaunchAgents).

iSync is a scriptable application, so I can execute a command like
osascript -e 'tell application "iSync" to synchronize'

and it will start to (asynchronously) perform a sync. Unfortunately, iSync doesn’t quit when it’s finished. I need to wait for the sync to finish, and then tell it to quit. Something like (all on one line):
osascript -e 'tell application "iSync" to synchronize' >/dev/null && while [[ `osascript -e 'tell application "iSync" to get syncing'` = true ]]; do sleep 1; done && osascript -e 'tell application "iSync" to quit'

(I tried it as one big AppleScript, but the first "get syncing" returned false. There’s a race condition or something. It appears to always work with sequential invocations of osascript.)

A LaunchAgent can invoke any single command-line command (or launch an app), but it can’t do fancy stuff like pipes or shell boolean interpretation. So, something like the incantation above is out of the question. It has to go in a file as an executable shell script.

So, I gave Lingon a unique name for my agent, I pointed it to the location of my script, and I clicked the check box for "At a specific date:" and told it to run every day at midnight. When I saved the file, Lingon told me that I would have to log out and log back in for my new agent to work. But it isn’t true. launchctl to the rescue!
launchctl load path/to/file.plist


Note that if you make a change to the XML, you have to launchctl unload and launchctl load again for launch to notice the change.

Here’s the final XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>local.jhope.PeriodicISync</key>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/isync</string>
  </array>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Hour</key>
    <integer>0</integer>
    <key>Minute</key>
    <integer>0</integer>
  </dict>
</dict>
</plist>


For the shell script itself, I decided to write one in scsh (just because; yes, I know the scheme shell is total overkill for a script this short, but how often do you suppose people have Scheme code calling AppleScript?). It looks like this:

#!/opt/local/bin/scsh \
-o threads -e main -s
!#

;; I have to load the threads structure to get the sleep function

;; Get iSync to start syncing
(define (synchronize)
  (run/strings (osascript -e "tell application \"iSync\" to synchronize")))

;; Tell iSync to quit
(define (kill-isync)
  (run (osascript -e "tell application \"iSync\" to quit")))

;; Returns #t if iSync is still syncing
(define (synchronizing?)
  (let ((result (run/strings
                 (osascript -e "tell application \"iSync\" to get syncing"))))
    (string= (car result) "true")))

;; Waits for iSync to finish and then tells it to quit
;; (polling once per second)
(define (kill-isync-when-done)
  (sleep 1000)
  (if (synchronizing?)
      (kill-isync-when-done)
      (kill-isync)))

;; Start a sync and then kill iSync when it's done.
(define (main prog+args)
  (synchronize)
  (kill-isync-when-done))


Of course, I could also have just defined a single function:

(define (main prog+args)
  (run/strings (osascript -e "tell app \"iSync\" to synchronize"))
  (let loop ()
    (sleep 1000)
    (if (string= (car (run/strings (osascript -e "tell app \"iSync\" to get syncing")))
                 "true")
        (loop)
        (run (osascript -e "tell app \"iSync\" to quit")))))

but it seems to me like that reduces script length at the expense of hiding the logical operations that the separate functions illuminate.

Regardless, I now have iSync update my phone every night without me having to do anything. Qapla'.