Technology, politics and the rest
Header picture

Posts from — September 2007

#

Radiohead’s long-awaited new album, In Rainbows, will be released Oct 10 (via download on their site). The site is colorful, slow, and lacking in details. It doesn’t say what format the downloads are, for example, which makes preordering seem unwise. Wikipedia is a bit more informative.

September 30, 2007   No Comments

Testing

Just testing some stuff… move along now…

Lots of photos coming soon.

September 30, 2007   No Comments

#

I just found 700 photos from college I thought I had lost!

I’ll post some highlights later.

September 28, 2007   No Comments

Javascript Boxes

Today I was trying to create a box on a web page that could be moved and resized. Well, several boxes, but that’s not important. I wanted a UI with handles indicating the places that the user can grab the box to resize in different directions, like this:

Given the position and size of the (blue) box at runtime, it’s not too hard to determine the green box positions, but you end up copying and pasting a lot of code if you do each one explicitly. So, I set out to write it as a loop, iterating once per (green) handle and avoiding duplication of code.

The key is to name the handles intelligently, and use the names to your advantage.

The following is a mix of javascript and comments where I avoided detail to describe my method. I’m doing this from memory, so there are bound to be errors…

var handle_list = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'];
handles = {}; // object for the divs to live once they’re created
for (var i = 0; i < handle_list.length; i++) {
  var name=handle_list[i];
  handles[name]=document.createElement(’div’);
  // perform some other formatting operations on the div here
  if (name.indexof(’s’) != -1) {
    // it’s on the south edge, so set the top offset to
    // bluebox.top + bluebox.top - greenbox.size
  } else if (name.indexof(’n') != -1) {
    // it’s on the north edge so set top to be the same as
    // bluebox
  } else {
    // set top to be halfway down
  }

  if (name.indexof(’e') != -1) {
    // it’s on the east edge, so set the left offset to
    // bluebox.left + bluebox.width - greenbox.size
  } else if (name.indexof(’w') != -1) {
    // it’s on the west edge so set left to be the same as
    // bluebox
  } else {
    // set top to be halfway across
  }

  // Add the div to the document..
}


Granted, this could be made simpler, but I think it’s a pretty clever and usable method. Now, let’s say I want to have the correct mouse cursor display when the mouse is over the green boxes. This naming system works again:


handles[name].style.cursor = name + ‘-resize’;

September 27, 2007   No Comments

SIgns that it’s time to get new shoes

I kept noticing holes in my socks this week, right where the top of my shoe meets the Achilles tendon. It turns out my shoes are so old that the fabric had worn and there was just some apparently sharp plastic at the top. I finally took a look when I noticed that my foot was bleeding a bit. The same leg has some poison ivy (on the back of my knee) from orienteering. If anything else happens to this leg, I’m just going to have to replace it with a peg leg or something.

September 27, 2007   No Comments

Maxed Out

Another recommended documentary: Maxed Out. It’s about debt, mostly credit card debt, but a bit about national debt.

Trailer:

(youtube embeds get stripped from the rss feed, unfortunately)

Louie CK is in it, too, so you know it has to be good!

September 25, 2007   No Comments

#

Recommended TV documentary series: Ross Kemp on Gangs. He travels all over the world documenting gang warfare in different countries, interviewing high-ranking gang members, etc. He has some amazing footage and provides a glimpse into worlds you don’t usually hear about. The segment on the Mara Salvatrucha (gang in El Salvador and other countries) was the most interesting I’ve seen so far, I think.

It’s a British show on Sky One, so you probably won’t be able to watch it, but if you’re interested in seeing it, let me know.

September 25, 2007   No Comments

Arcade Fire

I saw Arcade Fire at the Shoreline Amphitheatre on Friday… Google somehow got a whole lot of free lawn tickets so several of us went after work. I enjoyed the show, though it was a rough wait with two openers, a long-ish intermission, and some rain. I liked to see the variety of instrumentation in the music, which I hadn’t thought about as much before I saw it. Lots of the music has a really big sound that translates well to filling an amphitheatre (e.g. Intervention).

Backing up a bit, a week before that Girts got some free tickets to see Jonathan Coulton in San Francisco, so we headed up with a few other googlers. He’s a singer/songwriter with some great music and entertaining lyrics. One of my favorites is his a folk-style cover of Sir Mix-a-Lot’s “Baby Got Back” (you can listen here).

After exploring his website a bit, I discovered that he covers a bunch of songs from The Show with Ze Frank, which I really enjoyed (though nobody I know seemed to).

I also enjoyed Mr. Fancy Pants (song, not person), though it’s much better live when performed with one of these. It’s ridiculously stupid and catchy.

September 25, 2007   No Comments

Orienteering

I just finished doing peer performance reviews for work, so it’s time for some posting.

On Sunday morning, Girts and I went orienteering. I had no idea what that was before Saturday night, but it turned out to be pretty cool. Basically it’s like a running race, but you have to go find places as part of the race, so there’s an element of strategy and navigation. At the starting line, you’re given a map and a compass. The map has numbered locations of markers, and you have to go to each marker and use a tool there to punch a hole in a card that they give you (to prove you were there).

The maps are relatively dense, so it’s not trivial to find the markers, especially in the woods. Here’s a sample map, though that isn’t the same course. The one we went to was at the presidio, near the golden gate bridge.

Since I didn’t really know what I was doing, I went on the white course, which was 3 kilometers long. The distances are as the crow flies, so I’d say I did maybe a bit less than 5km through forests, streets, and fields. I finished in 41 minutes, which was good enough for me, considering I got lost a couple of times. Since most of my competition on the white course was relatively, ahem, casual about the race, I was in second place when I left (the start times are staggered so that you can’t just follow people, so some people hadn’t finished by the time I left).

September 25, 2007   No Comments

#

I hadn’t noticed until tonight that Andy Samberg was in Arrested Development.

More posts coming later, hopefully.

September 22, 2007   No Comments