Doin’ stuff automagically

I’m not sure if this will be interesting to anyone else but myself, but the process I used to produce my linked movie list was fairly complicated, and for myself and, perhaps, others, might be useful as an idea of how to get things done on a Mac (although there may be similar tools available on Windows).

I started by compiling the list of movies I had seen last year. Luckily I had the foresight of trying to post about, and tag, all of them. So getting the starting point was as simple as clicking that link.

I wanted the list for my year-end (year-beginning, I suppose) post to have each title linked to it’s Internet Movie Database page. But when I contemplated doing a search for each one, by hand, and copying-and-pasting each URL, and writing out each link with all its tedious a href="" and angle brackets and whatnot.

Now, I use TextExpander to save me steps when typing out common phrases, and especially when blogging and typing out links. Such genius. I’ve long used similar programs going way way back; they run in the background, and when they detect a specific key combination, the program automatically expands that into the actual phrase. For instance, if I typed ahreff, TextExpander substitutes the code for a link, and moves the cursor to the right spot for me to type out the actual URL.

But that wasn’t gonna cut it for a list of 50 movies. Even saving me a few steps, it would take forever, and with the added pain of having to copy and paste from my browser into another program… no. There had to be a way to automate it.

If I were a programmer, or better at shell scripts or scripting languages like Perl or PHP, I would spend a small amount of time writing a program to do all this for me. Alas, I’m a power user, but not a programmer. I have written small shell scripts, but I thought this was beyond me, at least now.

I could conceptualize the basic process, which is the first step:

  1. Take list of names, one by one, and:
  2. convert the name into a search term, then
  3. use that search term to find the IMDB page
  4. copy that resulting URL, then
  5. construct the link text.
  6. And insert it around the movie title in a new text document.
  7. Repeat for each item in the list.

Luckily, I discovered that there’s a way to create a URL that will force Google to give it’s top hit for any search term, also known as “I’m feeling lucky”. I don’t remember where I saw it first, but this page describes the technique.

I thought that if I could figure out a way to insert the movie name into a Google “Lucky” URL, then having some way to automate opening up a bunch of those URLs would give me the list of IMDB addresses I needed.

Then it would just be a matter of creating the whole text that represents the linked movie name.

Not being a programmer, I still had an awesome tool to work with: Apple’s built-in Automator. It’s a GUI program where you drag and drop different modules representing each step of a workflow. It’s beautiful for repetitive actions, though it has its limits. And it was perfect for me. Or so I thought. It actually took two different Automator workflows to get what I needed.

First, I had to do a bunch of search-and-replace on the list of movie names. A URL doesn’t have spaces in it, so I replaced all the spaces with + signs, and took out all the other punctuation. When I tested the Automator workflow on a small sample, I realized that some movies were so popular that some other site, not the IMDB page, showed up as the first hit. So I explicitly added +imdb to each movie name, just to be sure. Then I turned each one into a link with another set of search-and-replaces.

Next step was to open the resulting list of links in Safari, and turn the first Automator action on it. This action had three steps:

Get Current Webpage from Safari -> Get Link URLs from Webpages -> New Safari Document.

This opened 50 new windows, in alphabetical order. Then I used the next workflow I’d figured out, which consisted of:

Get Current Webpage from Safari -> Copy to Clipboard (which copies the results of the previous action, or the IMDB address I needed) -> Set Contents of TextEdit Document (by appending) -> Run AppleScript (which was tell application "Safari" to close the front window" – an important step for working back through the 50 windows) -> Loop 51 times.

I actually had to reverse-sort the original list, because once I did the second step, I had a list of addresses with no way to tell, without opening them in a browser again, which movie they represent. IMDB uses a string of numbers for their webpages, not something human-readable, like, say, Wikipedia. But using Wikipedia had it’s own problems, which I’ll leave as an exercise for the reader.

The final step took me a bit to come up with, but was pretty simple once I’d figured it out. Again, a programmer could write code that would string together each part of the link and spit out a fully-formed URL: front-half-of-IMDB-link + Movie Title + closing-tag.

What I did, instead, was copying each list into a spreadsheet (I used Google’s free online one), each type to a column, then exported it as a text file. A quick search-and-replace to remove all the tabs from the tab-delimited list, and ta-da! I had my linked list.

I think, now, that I know enough to write a simple AppleScript to run each Automator workflow, but I’m not sure how to automate the final step. Still, it’s a significant savings in time and effort.

If you start noticing lots of linked lists on my blog, now you’ll know why.

This is what is called “pilling on”

Even though it’s been noted almost everywhere on the internet, I had to say something.

Turns out Microsoft’s Zune 30GB digital media player shuts down for New Year’s Eve. But only during leap years.

No, I am not kidding.

No “social” for you, Zune 30 owners.

That just… awesome.

One day left

Only one day left in 2008. Less than one day, actually – just over 17 hours, as I type this.

I’ll have a post in the next day or two about all the movies I’ve seen this year. I’m still pulling it together.

I have also been working on a long post (that keeps getting longer) about what “evidence of god” would look like. I think anyone who reads my blog will understand why that particular post just won’t seem to stop.

But I haven’t had any shorter ideas for posts lately. I really liked the birthday series because I wrote those up in advance, all in one go, and didn’t have to worry about posting on a daily basis for a week and a half. I think I’ll do more of that in the future – picking a topic and writing a series of articles on it.

2008 was, in some private ways, a very stressful year for me. But it had many positives, too. Maybe before the end of the day I’ll have a recap of some of the positives.

Or maybe not.

Happy New Year’s Eve!

More on the idea that reporters treat politics as gossip

I know I’m late to the party on this; I’ve seen several other posts on this topic, and three days is nearly a lifetime in blog time. However, this ties in so neatly with what I said earlier, in my review of “Frost/Nixon”, where I suggested that our traditional media views our political leaders, their policies and actions taken to advance their goals presumably in our behalf, as if they were celebrities.

After I had written that post, I saw that Glenn Greenwald had torn into Michael Calderone’s, the Politico’s “media reporter” year-end wrap-up of his top 10 political “scoops” of 2008. Gaze and marvel:

  1. Katie Couric’s interview of Sarah Palin (CBS)
  2. McCain can’t say how many homes he owns (Politico)
  3. Obama’s “bitter” comment (Huffington Post)
  4. Sarah Palin’s shopping spree (Politico)
  5. Turmoil in the Clinton camp (Washington Post and Atlantic — “The behind-the-scenes tension was captured by the reporters in one memorable exchange: ‘[Expletive] you!’ Ickes shouted. ‘[Expletive] you!’ Penn replied. ‘[Expletive] you!’ Ickes shouted again.”)
  6. Jeremiah Wright tapes (ABC News)
  7. The Pentagon’s military analyst program (NY Times)
  8. Bickering in the McCain camp (NY Times Magazine)
  9. John Edwards’ affair (National Enquirer)
  10. Powell endorses Obama (Meet the Press)

Greenwald responds, at least in part, with scathing sarcasm:

Indeed. For a politically engaged person, it is truly difficult to conceive of how any year could ever be more satisfying than one marked by riveting scandals over shopping sprees, bickering among campaign operatives, and an extramarital affair of someone who, at the time of disclosure, held no political office and was running for absolutely nothing. Anyone surveying this mountain-high pile of Pulitzer-worthy investigations can do nothing more than echo the observation of Newsweek’s legendary Senior White House Correspondent, Richard Wolffe, who famously gushed: “the press here does a fantastic job of adhering to journalistic standards and covering politics in general.” Who could review Calderone’s glorious list of the year’s top “scoops” and disagree with that?

In fairness to Calderone and his comrades in the political press, our media currently covers a country that has very few substantial problems and an administration that is renowned around the world for being competent, honest, conventional and quite uncontroversial. In general, countries which enjoy great tranquility, prosperity, and stability — such as the U.S. today — can afford the luxury of fixating on the types of fun and trivial stories which comprise the list of top “scoops” heralded by Politico.

The emphasis is Greenwald’s.

When folks turn on the cable news channels and see endless, 24/7 coverage of Senator McCain’s residences, say, or pick up the national papers, the New York Times or the Washington Posts, and see front page coverage of Senator Clinton’s emotional state or Governor Palin’s financial excesses, instead of discussion about the “unitary executive” and how radical an idea that is, or how outrageous it is that the American military has been ordered by top White House officials to design and implement torture programs, programs that many intelligence officials strongly believe to be worthless for gaining actionable intelligence, not to mention directly reduce the safety of American citizens and our soldiers abroad… that’s when the average American starts to think that politics doesn’t really matter.

How could it matter, if the “most trusted name in news” has Wolf Blitzer moderating a discussion between someone who’s “pro-waterboarding” and “con-waterboarding”? The only conclusion to draw is that Very Serious People are carefully weighing both sides of the debate, so, therefore, either side in the discussion may, in fact, be right. Right? I mean, they wouldn’t spend so much time talking about it if it weren’t important; and since there’s an equal number of people on each side of the debate, that means that CNN is carefully representing the factions who are deciding policy. Right? And since Wolf isn’t giving an opinion or providing any context, well, I guess the average American can just flip a coin. Or, perhaps, doesn’t even need to concern himself with finding out more. Let the eggheads on teevee fight it out. Why bother getting involved? Who’s left on American Idol this week?

There’s so many ways that this game, the “fake balance” game is played – and rigged. Once it’s explained, it’s pretty easy to see. For instance, take a note of the people who get invited in to talk on the Sunday political talk shows, and you’ll start to see a pattern: very often, there are more Republican or conservative pundits than there are Democratic or progressive ones. In fact, I’ll go further and suggest that more often than not, the pundits who represent the Democratic or progressive side on those shows aren’t politicians, but people from a media background – journalists who are representing their newspapers or media corporations, who may be held to an objective, factual, “balanced” standard in their speech.

When those “balanced” pundits go up against men and women who are fiercely partisan, men and women who pursue their talking points with a fervor, who do you think will come across as the “winner”? And since the moderators of those discussions, the Brokaws and the Mathewses, don’t feel the need to correct any factual errors or offer any context for the discussion, the pundits, the ones who are playing to a partisan crowd, can feel free to pull “facts” from their nether regions.

The game is played completely differently on Fox “News” – if you watch them, pay attention anytime that a guest is talking trash about Democrats. You’ll notice that, invariably, in addition to the Republicans doing it, there’s always a token “liberal” who is there to attack their own party. Senator Joe Lieberman is a favorite Fox “News” guest for exactly that role. Even though Lieberman isn’t a Democrat anymore (his constituents voted him out of the party largely for his stance as pro-Iraq War and pro-President Bush), the fact that he still caucuses with the Democrats in the Senate means he’s considered “liberal”. At least in Fox “News” land.

Or count the number of times that any Republican that’s seen as a “loser” is labeled a “Democrat” on Fox “News”. It even happened to Republican Presidential Candidate John McCain. That’s “fair and balanced”? And no correction was issued.

And I don’t expect any of this to change, now that President-elect Obama will be taking the oath of office in January. It didn’t change after Democrats won control of both houses of Congress in 2006. Oh, wait, there was one change this year: there’s one, real, live, progressive now on TV: Rachel Maddow on MSNBC. And, man, what an outcry putting her on caused. You’d think that the world had ended, from all the complaints from our traditional media. But only liberal journalists are called “partisan”.

Is it any wonder that the blogs have grown so much, and so fast, for progressive Americans? Is it any wonder that the younger viewers, the 18-35 set, that coveted demographic, are more informed the more they watch Jon Stewart’s “The Daily Show” and less informed when they watch Fox “News”?

It’s refreshing, though, to see survey after survey show that Americans see the financial crisis, health care, and the Iraq War as the top issues. We can find out what we need to know, these days, and what we need to know concerns our jobs and our sons’ and daughters’ lives.

It’s just too bad our traditional media chooses, instead, to focus on what our leaders are wearing. That focus will be their undoing.

Forty-four minus zero

Today I celebrate the forty-fourth anniversary of my birth.

As I’ve been counting down to this day, I am posting birthday memories. This is the final installment; thanks for indulging me as I reminisce.

So, my birth day – the actual day of my birth. I don’t remember much about that actual day, y’know, directly. But over the years I’ve collected quite a bit of personal mythology.

This is all pieced together from fragile tissue: my own memory of stories told to me. If I’m wrong, it hardly matters. But if anyone out there is reading this and has more accurate stories (Dad? Lisa?) feel free to post ’em in the comments.

It was 1964. My parents lived in a small house in Gladstone, OR, behind Rex Putnam High School. They’d been married since the fall of 1959.

My dad was working as a salesman for Francis Ford, and was 30 years old the day I was born. My mom was 38 – a divorcée. She had been married before, and had an almost-teen daughter from that previous marriage, and I believe my half-sister still lived with mom and my dad, her step-dad, the year I was born.

My full sister had been born the year before, in November 1963, the same month that President John F. Kennedy had been slain in Dallas. She was 13 months old the day I was born; my half-sister babysat her while mom was being driven to the hospital.

My parents told me that I was a premature baby; I was supposed to be due in February 1965. But for some reason, I wanted out early.

The snowpocalypse of 2008 has reminded me of one other fact of the day of my birth; that December was the last time Portland had seen that much snow, until this year. I imagine that the drive from Gladstone, all the way to the old St. Vincent’s Children’s Hospital, up in the hills of Portland, a trip of of over 10 miles and ending with a drive up treacherous and curvy Burnside Avenue, was a white-knuckle experience. Add in an about-to-give-birth woman, and my father behind the wheel, and, well, such is the stuff legends are made of.

But I was, in fact, born in the hospital, not in a back seat, and at 5:57 AM on December 28th, I was born. (This post was published at that exact time) My height and weight are not recorded on my birth certificate, but, being a preemie, I imagine I was fairly small and underweight.

My parents had initially decided that I was to be named, if I was a boy (the gender-determining technology not being available forty-four years ago), Brian Keith Moon. My mom was a fan of Brian Keith, the actor later known for his role as Judge Milton C. Hardcastle in the TV series “Hardcastle and McCormick”, but who was known to my mom as an actor in her beloved Westerns. Little did they know at the time, but I would have had a double in celebrity names: the famously destructive drummer for the Who, Keith Moon, who had, according to Wikipedia, only joined the band earlier in 1964 at the age of 17, and who would die of a massive drug overdose 14 years later.

But that was not to be. Dad, as he tells the story, decided at the last minute that he didn’t like that name, and, since mom was not willing to budge on the first name, dad went out to the nurses’ desk, where they kept the book of baby names, opened it up to the first page, and selected the very first name in the book to be my middle name: Aaron.

The doctor, who was from the Middle East but not a Jew, raised an objection to a Gentile child being given the name of Moses’ priestly brother, but that objection fell on deaf, and largely irreligious, ears. I was given the name of Brian Aaron Moon.

And that’s all I know about the day I was born.

Welcome back, rain!


Let me join the multitude of folks that are welcoming back to Portland: the rain!

We have missed you, rain.

And it’s 47° F right now outside!

Remember when that felt cold?!

Forty-four minus one

In one day I celebrate the forty-fourth anniversary of my birth.

Counting down to that day, I am posting birthday memories.

One reader out there, I’m sure, has had a certain interest in these posts. He may have even been reading them and wondering when, if ever, I would be mentioning him. Just because I’m kinda wired that way, I have held off until the next-to-last moment to write about this particular birthday.

I don’t have much memory of this one, because it’s one of the earliest birthdays. It was 1972 1970 (oops, thanks for correcting my math, Kevin!), and I turned six. But, as always, there is some family mythology involved and it makes for a funny story.

Maybe I had pineapple upside-down cake. Maybe I had a little too much. But, the story goes, I wasn’t feeling well that day. All day long.

My family and I lived in an apartment building, a four-plex, on a rural road in Kalama, Washington. Dad worked for Reynolds Aluminum, at their plant in Longview, Washington (I believe). And miles and miles away, in Portland, down south, I had another sister. A half-sister, my mom’s only daughter from a previous marriage.

Sometimes we would drive down to visit her and her husband, a man she married right out of high school (and to whom she remains married today). They lived in another apartment complex somewhere in Portland, I don’t recall which neighborhood. And she’d been pregnant that year with their first child.

She gave birth to that baby, my nephew, Kevin, six years after I was born. I was made an uncle almost before I could really comprehend that concept.

My oldest nephew and I share a birthday, and in many ways, he’s the younger brother I never really had. Tomorrow is his birthday, too. And I couldn’t have a better friend to share it with.

But on the day of his birth, the sixth anniversary of my own, apparently I was sick.

Forty-four minus two

In two days I celebrate the forty-fourth anniversary of my birth.

Counting down to that day, I am posting birthday memories.

What about the birthdays I don’t remember? I’ve been scouring my brain trying to remember what happened on one day, repeated for (almost) 44 years. I was obviously present for all of those days. My earliest memories, of course, no one expects me to remember them. It appears that the most memorable moments were from when I was around six, up until I turned 21… and then a few handful of memories from the last 10 years or so.

There’s a gap in-between.

A gap that can’t be explained by alcohol. I knew you were at least thinking it so don’t deny it. Well… can’t entirely be explained by alcohol.

This post is for the missing birthdays. The birthdays were nothing much of note happened. Or, rather, the birthdays when the expected happened. In spite of the lack of specific memories, I’m sure that every birthday I’ve had was spent with family or friends. I’m sure that I received gifts and cards, carefully selected by my friends, along with good wishes. I’m sure there was cake, and probably ice cream, and probably booze of some sort or another. Because that’s what most people remember – the good times, the company, the feelings.

And most of my birthdays have left me feeling… well-loved. Even if I’m fuzzy on the details.

Merry Newtonmas!

Thanks to Edwin Kagin of Blasphemous Blogging, who has compiled a list of the many deities who were alleged to have been born on December 25th:

Hmmm, that list looks fairly complete. Did he leave one out? I can’t tell.
Be sure to click through to Kagin’s list; he lists a bunch of facts regarding each of these deities that might sound familiar to a modern American theist.

…but to a scientist, even an amateur one like myself, the most important birthday today is Sir Isaac Newton, father of classical physics.

At least he was born on 25 December in the Julian, or Old Style, calendar. Dates are such fuzzy things sometimes.

Update:

I removed Bacchus because that’s the Roman name for Dionysus, and shouldn’t be confused with Saint Bacchus, a Christian martyr; Dionysus predates Christianity by a couple of centuries at least. I also fixed the link to Tammuz. – 12/25/2008 12:10 PM bam