Category

Building the C2 Morse code trainer on OSX

I was trying to install Ward Cunningham and Jim Wilson's Morse code trainer on OS X and it looks like their .dmg file doesn't work on the new Intel machines. Here's what I did to get it to build.

Programatically creating a CCK field in Drupal 6

I spent some time today trying to figure out how to create a CCK field as part of an hook_update_N function. Unlike previous versions of CCK, in 6 it's very easy to manipulate the fields from code.

Using Growl to tail a log file

Mikey_p from the Portland Drupal Group pointed me towards a blog post he'd done on using Growl to watch for PHP errors. Always looking to put my fingerprints on something I decided to do the same but using PHP rather than Python.

The short version is install growlnotify then run the following from the terminal:

tail -n 0 -f ~/Sites/nm/logs/access_log | php -r 'while ($m = fgets(STDIN)) shell_exec("growlnotify -p 0 AlertTitle -m ". escapeshellarg($m));'
Obviously you'll need to use the right filename and change AlertTitle to something more to your liking.

Prefilling the ImageCache cache with wget

Today I needed to get Drupal's ImageCache module to regenerate a bunch of resized images. ImageCache doesn't create the images until a browser requests them and at that point the new image is saved to the disk for future use.

One way to generate the images would have been to just click my way through every page on the site but I'm way to lazy for that. So I used wget:

wget -r -nd --delete-after http://example.com

By using the recursive (-r) and --delete-after switches I was able to have it crawl the site and get all the images generated. Bonus points for running in on the server so that the transfers were via the loopback interface so the transfer didn't count against the monthly bandwidth limit.

News round up

I don't post news items like I used to a few years back but there are two things in the news today that I've got to comment on.

The first is GM's announcement that they're closing four North American plants manufacturing SUVs and looking at selling the Hummer brand so they can focus instead on more fuel efficient cars. The NY Times has a pretty good article on it but the GLARING OMISSION is that they don't mention anything about the CAFE standards. The American auto industry and their Republican lackeys have been fighting increases in the fuel efficiency since 1999. It seems like the US auto execs were the only people who didn't see Peak Oil and the end of the SUV coming... sure they'll tell you they've got hybrid SUVs the only problem that you can't buy them, they're just a PR device. I'd love to see some shareholder action to clean house and put some execs in place that have half a clue.

The second is Hillary and her Terminator impression. I'd defended her right to stay in the race until all the states had voted--even though it was obvious back in February that she wasn't going to be the nominee. But as of tonite this has gotten silly. Obama now has the delegates but she still can't quite let go and concede. Shit, I'll donate $20 to help pay off her campaign debts if she throws in the towel this week.

DrupalCampPDX

drupalcamppdx keynote I took a break today from my work at Sticky building a website for a major sports apparel company that cannot be named, for DrupalCampPDX. Ben Kaplan and I did the keynote presentation this morning which was definitely an honor. I followed that up with a panel on best development practices which was a bit unplanned but went really well. This afternoon I'm doing a presentation on Views2 and Panels2, I'm a little freaked out on that since I've done zero preparation at this point.

Drupal6: Display block for one node type

This is a little snippet I came up with to get a block to show up on a single node type:

<?php
$menu
= menu_get_item();
if (
$menu['path'] == 'node/%' && isset($menu['page_arguments'][0]->type)) {
  return
$menu['page_arguments'][0]->type == 'story';
}
?>

It uses the node type stored in the menu system so you don't have to match arg(0) etc.

About that experience thing...


"There was a saying around the White House that if a place was too small, too poor, or too dangerous, the President couldn't go, so send the First Lady."

And Sinbad... and Sheryl Crow... and the First Daughter? Yeah, let's talk about experience and judgement some more.

Spring Break

Almost done with classes for the term. Got to do the presentation for my Capstone class tonight. I think next weekend I'm going to try to get down to Reno for the StickerGuy 15th Anniversary. I worked at StickerGuy in Chris McClendon place while he when went on tour back in 2000-something. It wasn't a good experience at the time but as Mr. Bynum always said:

"You either have good times or good stories."

And, at this point, they're good stories. So it'd be good to get down to Reno, see some old friends and bands that I hardly remember. I've gotta say that I'm most excited about seeing The Atomiks, The Scurvy Bastards, and Dragonfire -- the first two because they're great bands the latter because of this video I found on StickerGuy's MySpage:

Update: I totally forgot to mention that my little brother Charles and his friends Petar and Chuck are coming up this weekend. Petar wanted to see Agalloch play tomorrow night and I owe him big for helping me find a place to stay in Boston during DrupalCon. Should be a good time.

Getting PHP + GD working on Leopard (aka recompiling everything)

Here's my writeup on how to recompile PHP for Leopard to get GD working. The basic plan is recompile Apache and PHP from source. It may totally bork your system, I'm just writing it down so the next time I need to do this I can remember what I did. I wish I could give credit to all the places I stole bits from but I didn't do a good job of keeping notes early on.

DrupalCon Day 1

Made it out to Boston last night. I'd gotten upgraded to business class on the flight from Portland to NYC which was a nice treat. NYC to Boston in coach was a bit of a blow to my ego but the scenery made up for it. The highlight of the flight was looking out the window and seeing a white speck fly by, it was three white balloons. As the sun set we were flying through a beautify pink mist.

I'm staying with a friend of my brother's friends. Great place but it's an hour away from the conference center by train/bus so I was up early this morning. I've got a nice tickle in my throat so I hope I don't end up sick.

Here's the presentations I'm hoping to hit today:

Still need an Oink replacement

I still haven't found a decent replacement for Oink after it got shut down... or at least one that I can get an invite to. Do I have any sugar daddies (or mammas) out there that want to hook me up with an invite to waffles.fm or STMusic?

Update: got an STMusic invite!

Finally, applied to graduate

I spent an hour or so working my way through the school's bureaucracy to figure out how to apply to graduate. Met my CS Adviser... that I didn't know I had. I hadn't taken CS161 (Into to programming) and he helped me figure out how to get that waived. Once that was settled they pointed me in the right direction and I put in my papers to graduate at the end of the Spring term. Just need to finish up this term and then get my thesis taken care of and I'll finally be a college graduate.

Reason #902,423 why Java sucks

I've grown increasingly annoyed at Java over the years. I've taken to describing the language designer's philosophy as "If there's two ways of doing anything, pick the one that involves more typing".

All I want to do in take an array of numbers and convert it into a comma separated list, e.g. 1,2,3,4. Most modern languages make this easy:

So how do you do it in Java? Well there's no built in method so you end up getting to write your own:

public static String join(String[] a, String separator) {
    StringBuffer result = new StringBuffer();
    if (a.length > 0) {
        result.append(a[0]);
        for (int i=1; i<a.length; i++) {
            result.append(separator);
            result.append(a[i]);
        }
    }
    return result.toString();
}

Maybe sometime around Java 9 they'll get around to adding it...

A smaller update

Been keeping busy. The dog keeps getting bigger and smarter. She's able to jump over the baby gates I've been using to pen her in the kitchen. She's also figured out how to stretch up and reach the counter so she can steal treats off of it while I'm not looking. But she's a great dog and I love her even when she is being a jerk.

Nick from NYC was out to visit last week. We had a good time and he was able to get all his stuff out of the basement of the old Russell Street house and mail it home. One of the highlights for me was last Friday when I hosted, what my friend Asia termed, Drew's Brews. Basically I invited a bunch of people over to help me drink the four gallons of porter that Steven and I brewed up. I'm hoping to repeat it again this weekend with a batch of pale ale.

This evening I went to Ignite Portland at the Bagdad Theater with Nick's friend Ingrid (who has a nice food blog). I was really impressed with the event, the speakers with the except the snake oil peddler who was trying to convince everyone that biodiesel is going to save us from our energy problems were all wonderful. I had a hard time picking favorites (though the history of the stick figure and why Germany loves David Hasselhoff stand out in my mind). I can't wait for the next one.

I just finished reading Queen of Candesce by Karl Schroeder. I'd read the prequel, Sun of Suns, last New Year's and loved it. I don't have the words to describe how amazing these books are. I'm just awestruck at the way he's able to construct a space opera that's convincing at every level; from the cloak and dagger intrigue of politics to the physics of constructing a city on the inside of a cylinder floating in air. In many ways it reminds me of the sweeping imagination and vision of the first Matrix movie (the big difference being that this sequel didn't suck).

for you, a photo

trees, wall, shadows

ads

User login