Cape Alava, WA → Lubec, ME

July 12, 2015

On July 15, I’m going to be flying out to Seattle to begin a journey that’s been on my bucket list for a long time: biking across the country.

But it’s not going to be just any cross-country bike tour — it’s going to be an epic cross-country bike tour. I’m going to start out by going in the wrong direction, out to Cape Alava, WA on the Olympic Peninsula, the westernmost point in the continental US. And I’m going to ride all the way to Quoddy Head State Park in Lubec, ME, the easternmost point in the continental US, to make it the most extreme coast-to-coast trip.

That’s not all. I’m also planning to visit 20 state high points and 2 other extreme points along the way:

There’s an asterisk next to Charles Mound, IL, because that high point has some unfortunate red tape — it’s on private property and is only open to the public on the first full weekends in June, July, August, and September of each year. If I time it right, I can get there for the last open weekend on September 5–6; if I’m too late, I’ll have to come back another year; and if I’m too early, I’m not going to wait around and burn zero days — I don’t have too much wiggle room in my overall schedule, given my starting date and route.

The astute reader will also notice that I’ve omitted a number of the western states’ high points from my list above. I decided to only include the non-technical mountains which could reasonably be done in a day hike with minimal gear. I could conceivably have climbed Mount Rainier, WA at the start of my trip and shipped my mountaineering gear home afterwards, to avoid the need to carry all that with me, but I decided to skip that and save it for another time, given the extra logistical complications, the need to find climbing partners, and the rustiness of my glacier travel skills. Likewise for Mount Hood, OR. I could probably thrown Borah Peak, ID into my route, but I’m electing to save that for another time as well. Jermoth Hill, RI isn’t on my route either, but since it’s within striking distance of my home in Cambridge, MA, I may bag it as a bonus little side trip after I return home.

I’ve previously climbed a few of these before (NH, ME, RI, CT, NJ, and DC), but hey, why not do them again?

After tagging Cape Alava, WA, I’ll be heading up to Anacortes, WA to begin following the Adventure Cycling Association‘s Northern Tier route. I’ll be following that for about 1400 miles before going off-route to start bagging high points. That’s also part of the reason why I’m skipping Borah Peak — the ACA publishes a fantastic set of route maps, and the Northern Tier passes within about 60 miles of White Butte. From there, I’ll be blazing my own zig-zag path between high points until I get back to the east coast, at which point I’ll pick up the Atlantic Coast route for a bit, break up with that, and then finally rejoin a piece of the Northern Tier going into Maine.

Depending on when I finish and how I’m feeling, I may go for an encore and keep riding into Canada to bag some bonus provincial high points: Mount Carleton, NB, Glen Valley, PE, and White Hill, NS. That would have me finishing up in Halifax and flying home from there. If I don’t have the time to spare for that, I’ll turn around and head back home. (I might also head back to Bangor, ME and catch a bus, but really it’s only another 260 miles or so from Bangor back to Cambridge.)

The total mileage for my planned route is roughly 6100 miles. The Canadian bonus would add another 700. I’m aiming to average about 80 miles a day, though some days will obviously be longer than others. At that pace, combined with days for hiking and other possible zero days, I’m expecting to take about 3–3.5 months to finish, which would have me finishing up in mid-to-late October, at which point it’ll start to be getting cold up in Maine.

These estimates are based on Google Maps routes, so the exact mileage will vary, likely in the slightly higher direction, since I don’t plan to follow Google Maps routes exactly. When I’m not following the ACA routes, I’ll be using a combination of the routes suggested by Google Maps and my Garmin Edge Touring, as well as just plain old looking at the maps and using my intuition to choose a route.

Want to follow my progress on the trip? Follow me on Twitter, and I’ll be posting updates on the go.

See you on the road!

Comments Off on Cape Alava, WA → Lubec, ME

E3 2013 Wrapup

June 12, 2013

What a show. Sony easily won with Nintendo in second, and Microsoft came in last.

Firstly, the games. The games! These are the games that have me foaming at the mouth:

  • Donkey Kong Country: Tropical Freeze (Wii U)
  • Final Fantasy XV (PS4, Xbox One)
  • Killer Instinct (Xbox One)
  • Kingdom Hearts III (PS4, Xbox One)
  • Metal Gear Solid V: The Phantom Pain (PS4, Xbox One)
  • Mirror’s Edge 2 (PS4, Xbox One)
  • Super Mario 3D World (Wii U)
  • Super Smash Bros. for Wii U (Wii U)
  • Transistor (PS4, Windows)

Now, this may look like a dead tie between Sony and Microsoft, but if you watched the press conferences, you’d know it was anything but. The response to the Xbox One has been lukewarm at best, given all the bad press it’s gotten over its draconian DRM scheme.

In contrast, here’s Sony’s official video on how transferring used games works with the PS4:

And the #1 piece of news which filled me with the most joy:

I’ve watched that at least five times now, and I’ll watch it many more times until the next trailer is released. Nintendo, you made my day when you announced my favorite video game character would be in one of my favorite video game series.

This holiday season is going to be exciting for sure.

Comments Off on E3 2013 Wrapup

Polyomino puzzle solver

January 1, 2013

Last year’s MIT Mystery Hunt had a fun puzzle called Caterpillars which involved fitting together a bunch of polyomino pieces (laser cut by the fine folks at danger!awesome, by the way). So naturally I decided to write a program to solve it, and I was successful in that endeavor.

After the Hunt ended, I cleaned up the program, polished it up, and generalized it as much as possible. The goal was to have a general-purpose polyomino solver that could solve as many different possible puzzles. Another solver existed at the time, but it did not have any source code available so could not be modified to solve more general puzzles. Although apparently at least one new open-source solver has appeared in between then and now.

Without further ado, my polyomino solver can be found here on my GitHub, source code and all. Usage instructions can be found in the accompanying readme file.

It’s not super-efficient, but it was good enough to solve Caterpillars. If I ever get motivated enough (read: another appropriate Mystery Hunt puzzle comes along), I’ll re-architect and optimize it, but I currently have no immediate plans to do so.

Comments Off on Polyomino puzzle solver

PAX East post facto

April 15, 2012

PAX East took place in Boston last weekend. Some jokingly referred to it as PAX Easter or PAXover East for its congruity with certain well-known holidays. This was my third PAX East, and the second at which my company, Demiurge Studios, has been a presenter at the show.

I actually didn’t hear about my favorite story of PAX until after the show. Remember Paul Christoforo from last year? He was banned from PAX. But he claimed via Twitter to have snuck into the show in costume. Although he refused to prove it by supplying pictures of him at the show, he did post some pictures of the show.

Except they weren’t his pictures. The pictures were actually texted to him after having been taken by Penny Arcade’s business manager Robert Khoo. Paul took the bait and ran with it. Paul was so thick that he didn’t even understand he was pranked until enough people pointed out to him what happened, at which point he finally admitted he didn’t take the photos, but he still insisted he was at the show. Pics or it didn’t happen, Paul.

Now let’s shift gears and recap my favorite games from the show:

Retro/Grade screenshot

Retro/Grade is an impressive-looking space shooter/rhythm game. But unlike your typical space shooter or rhythm game, this one goes in reverse. Due to a rip in the space-time continuum after defeating the final boss in the game, you have to go backwards in time to the start of the game. To do so, you have to “unfire” your shots by being at the right place where you shot them at the time you shot them, in time with the music.

As you progress backwards in each level (which are numbered from 10 down to 1), enemies become undestroyed and you have to dodge their shots, which come backwards from the left, and eventually the enemies unspawn. As you do these things, your score goes down, fittingly. The game can be played with either a plastic guitar or a regular controller, so you don’t need any extra hardware if you don’t already have it. The visuals are absolutely stunning, and the gameplay is mindblowing. I can’t wait to play it—a rep at the show told me it’d be coming out this summer, which is consistent with their Twitter feed.

Also in the category of time bending, Super T.I.M.E. Force is like the lovechild of Braid and Contra. I didn’t get a chance to play this one, but it looks like a great action title. You go around shooting stuff, but if you die, you go back to the start and replay the level along with your former selves. So the more you die, the more yous there are, and the easier it gets. Or at least that’s how I think it works. If that’s not how it works, I have a great idea for a game…

Miegakure screenshot

Miegakure is another entrant in the mind-bending category. It’s a 4D (yes, 4D) puzzle-platformer. Similar in vein to how Mario can rotate into the third dimension in the various Paper Mario titles, you can rotate yourself into the fourth spacial dimension in this game. It also includes Sokoban-type puzzles in some levels—in one level I played there’s a wooden block that you have to push over to the other side of the level in order to be able to jump up to the exit. But all of a sudden, as you’re pushing it, it stops moving for no obvious reason.

Then, if you rotate yourself into the fourth dimension, you see that what looked like a 1x1x1 block was actually a 1x1x1x2 block, and it was getting stuck on an obstacle in another parallel hyperspace. So figuring out those puzzles is a really satisfying challenge. I can’t wait to give Marc Ten Bosch my money for the game, but unfortunately he hasn’t given any indication of a release date yet: it’ll be done when it’s done. Release dates are very fickle things—fans love ’em, developers hate ’em.

Snapshot screenshot

Snapshot is another puzzle game. You play as this cute little robot named Pic, trying to progress through the levels. Your secret weapon: the ability to remove objects from the game world by capturing them in pictures and then re-add them elsewhere (possibly in new orientations).

The first obvious application is moving platforms around. But then more complicated mechanics start getting added in, such as areas of the world where you can’t take pictures or paste them back in. Then there are roving elephants you can bounce around on. Then you learn that objects retain their velocities from when they had their pictures taken, making for some fun Portal-like moments. All in all, it’s another exciting puzzle game coming….some time in the future.

Quantum Conundrum screenshot

Hey look, another puzzle game! Are you sensing a pattern yet? Quantum Conundrum is a Portalesque 3D action-puzzle-platformer designed by Kim Swift. Swift was the lead designer of the aforementioned Portal back at Valve, before she went off to Airtight Games.

Instead of a portal gun, you have an Inter-Dimensional Shift glove, or IDS, that lets you switch dimensions at will. The three dimensions shown in the PAX demo were the Fluffy Dimension, which makes everything light and fluffy; the Heavy Dimension, which makes everything super-heavy; and the Slow Dimension, which slows down everything (in addition to the regular dimension, where everything has its usual properties). Certain objects are too heavy to lift normally, but if you switch into the Fluffy Dimension, you can lift them up and move them around to activate switches, make jumping platforms, etc. Other objects might get incinerated by lasers, but if you switch into the Heavy Dimension, they’re suddenly strong enough to withstand the power of the lasers and block their paths, allowing you to get by. So there’s a lot of potential for interesting puzzles there. Coming in 2012 to a console near you.

(Side note: I managed to freeze the game while playing it, but the rep at the show assured me that it was just the console overheating. I’m well aware that games have bugs, especially unfinished games, but given that the PS3 I was playing on was inside a locked cabinet with very little airflow, and given the propensity of PS3s to overheat, I’m inclined to believe him on this one.)

Rock Band Blitz screenshot

After a drought of Rock Band games, Rock Band Blitz brings the series back to life. Unlike its predecessors, it’s a downloadable title for modern consoles that uses regular controllers instead of fake plastic instruments, so it’s very similar to the earlier Harmonix titles Amplitude and Frequency, with a Rock Band skin.

Each instrument track only has two notes, playable by flicking the left and right analog sticks in any directions, and the instrument tracks can be switched between freely at will. Unlike Rock Band Unplugged‘s plate spinning mechanics, which autoplayed tracks for a short while after playing a section perfectly, Blitz is a lot more novice-friendly and doesn’t require hitting every note. As you play a track, you “level up” that instrument. There’s a level cap which encourages you to switch tracks, but the level cap gets raised periodically as you hit checkpoints placed through the songs, so there’s plenty of potential for the score micro-optimizers out there (you know who you are). To spice things up even more, there are special powerups you can get, including an Arkanoid-style minigame that releases a bouncing pinball onto the note tracks that you have to keep afloat for extra points while you’re playing the notes in the song.

The big thing that Blitz has going for it is its compatibility with the entire Rock Band catalog of songs—over 3000 and counting. In addition to the set list that will ship with the game, it can import your entire library of Rock Band songs from the rest of the main series. It has an internal tool that converts the songs’ gem tracks into simplified two-note tracks that are both interesting and playable (read: no crazy 200+ BPM bass pedal rolls).

I also attended Harmonix’s panel on Saturday, which discussed the development of Blitz. At one point, as lead designer Chris Foster was discussing the history of the game and its predecessors, he said something to the effect of how he was the only person in that room who had the pleasure of working on a Green Day game. I made sure to correct him.


I’m running out of space and time here (ok not really, but you’re probably starting to run out of patience), so here’s a bulleted list of other games I enjoyed at PAX:

Comments Off on PAX East post facto

Cerro Chirripó: The Roof of Costa Rica

January 3, 2012

Cerro Chirripó (12,533 feet)

24 miles hiked
7,546 feet of elevation gain
15 hours

I was recently vacationing in Costa Rica, so what better thing to do than climb the country’s highest peak?

After finishing a bunch of touristy activities in the Monteverde/Arenal areas, I made my way down towards the mountain. I caught a morning bus from San José (the capital) down to San Isidro de El General, a bus ride which follows one of the most treacherous sections of the Inter-American Highway. It passes over the 11,322-foot-high Cerro de la Muerte (Mountain of Death), with some spectacular views. The bus ride was supposed to take three hours, but it took closer to four, since apparently there was a bicycle race along the same road from San José to San Isidro the very same day.

I then took a taxi to San Gerardo de Rivas, the town at the base of the main trail to Chirripó, since I’d missed the bus there. I arrived at the National Parks Office around 3:45 pm on Monday afternoon.

Cerro Chirripó lies within a National Park, inside of which camping is not allowed. They do have a large hut, called Base Crestones, at about the 14.5 km (9 miles) mark along the 20 km (12 miles) trail to the summit, and it sleeps around 40 people or so (the exact number seems to vary depending on whom you ask—one person claimed it slept 60). Most people who hike Chirripó stay at the hut for a night and do the whole hike over two days, and many also stay at the hut for an additional night in order to hike other surrounding peaks.

I intended to hike it in two days, Tuesday and Wednesday. SummitPost claimed it was easy to get a reservation, but alas that was not the case. When I arrived on Monday, the office was all out of reservations for Tuesday night, and they only had three reservations available for Wednesday night, which could not be reserved until the office reopened Tuesday morning. Here’s how the reservations work, according to a local I talked to:

  • Twice a year (once for the wet season, once for the dry season), about 30 or so advance reservations are opened up for each day in the upcoming season
    • These can be reserved by phone (call the parks office at +506-2742-5083), but you need to pay in advance with a wire transfer to ensure the reservation
    • Some hotels and travel services like to reserve these tickets right away and then resell them to clients; I don’t know who they are or how to get them.
  • Every night, 10 tickets are available for reservation the day before. That is, if you want to stay on night X, you can reserve them on day (X-1) at the parks office in person.
    • However, if anyone is staying multiple nights, then there are that many fewer reservations available. For example, if seven people bought two-night reservations for nights X and X+1, then there will only be three reservations available for night X+1 on day X.
    • The parks office is open from 6:30 am–4:30 pm. If you want to be sure you’ll get a reservation for the following night, you need to get there by 4:00 am. I’m not kidding—there will be a dozen people there by the time the office opens at 6:30.

So, after digesting all of that, I weighed my options. It was currently Monday afternoon, and I had to be on a plane leaving San José Thursday morning, which meant I had to be back to San José on Wednesday night. Sleeping at Base Crestones on Wednesday night was not an option.

Clearly the only sane thing to do was to hike it all in one day.

I could either hike it on Tuesday or Wednesday. But by the time I figured out what to do, the parks office was already closed for the day. I’d have to wait until Tuesday morning to get a permit to enter the National Park (you still need to buy a $15/day permit to enter the park, regardless of whether or not you’re staying at Base Crestones). I chose to hike it on Wednesday.

I went to bed early on Monday night to start shifting my sleep schedule as much as I could for an alpine start. Tuesday morning, I got up early, met the crowd waiting to get into the parks office, learned all about the reservation system, and bought a day pass to the park for Wednesday. I spent the rest of the day wandering around town, picking up some supplies, and relaxing.

Tuesday night I went to sleep around 7:30 pm at the Hotel Uran, which is about 50 meters from the trailhead in San Gerardo. I highly recommend staying there—for about $18/night for one person, you get a private room and hot showers (in a shared bathroom), and the restaurant there is also really good and cheap, too. I set my alarm for 11:45 pm, with the intention of starting hiking at the stroke of midnight.

But for whatever reason, I woke up an hour before my alarm clock. Instead of rolling over and trying to get another hour of sleep, I decided to get up and hit the trail, in true alpine start fashion. The entrance to the National Park isn’t until the 4 km mark, so as long as I didn’t get there before midnight, I’d be all in the clear as far as my permit was concerned (not that there’s anyone checking permits there—the only place they check them is at the Base Crestones hut).

The hiking for the first several kilometers was not particularly notable, it was a fairly steady climb upwards. At several points along the way, I could see the distance lights of a city, and the stars were gorgeous, but otherwise there wasn’t much to see in the glow of my headlamp beyond the trees right in front of me.

The trail has a signpost almost every kilometer up to the Base Crestones hut (a few are missing), along with a cute name for that section of trail. The trail is graded for horses, so it’s never too steep, but it’s not shallow either. There’s a porter service in town which will carry up your supplies by horse (for a fee) to Base Crestones the day before you get there, if you’re not sporting enough to carry it yourself. There are frequent sections of the trail where it’s divided into two parts, one for people and one for horses. The people sections have these nice staircases made of tree stumps, along with a railing and some posts to prevent horses from going in them, while the horse sections are extremely muddy and full of big, wet postholes.

Chirripó trail map

Chirripó trail height profile

I plowed along at a pretty steady pace of 25 minutes/km, stopping briefly every hour or so to chow down on an energy bar. Just after the 7 km mark, there’s this other shelter called Llano Bonito (Beautiful Plain). You’re not supposed to sleep there, but it can be used as an emergency shelter (which seems odd to me, since it’s a fairly large two-level four-walled building). It has a potable water supply there, as well as a trough for horses. Until then, there were no water supplies at all, not even little creeks. When I got there, I topped off on my water, downed an energy bar, and continued onwards.

Around 12 km came Monte Sin Fe (Hill of No Hope), which was the first non-trivial local maximum along the trail. There was a short downhill section afterwards and then it was up, up, and up again.

Finally at 14.5 km, I made it to the Base Crestones hut around 5:00 am. It was still dark out, and I hadn’t seen another human soul all night. I still didn’t see any other headlamps in the distance coming from hikers trying to make it to the summit for sunrise.

The sun started rising at about 5:30, as I was making my way through the comparatively flat section of Valle de los Conejos (Valley of the Rabbits) just beyond Base Crestones. There was a bit of frost on the alpine grass, crunching under my feet as I walked by, but it didn’t feel cold at all because I’d been staying moving almost continuously.

Valle de los Conejos

I put my headlamp away as the sky started brightening up. Miraculously, it lasted all night. I don’t remember when the last time I changed the batteries was, but I’ve definitely used it on numerous occasions for considerable amounts of time. I did have extra batteries with me, just in case. I expect I’ll need to use them the next time I need my headlamp.

I was starting to slow down noticeably here. I was walking more slowly and taking more frequent breaks. This was probably due to the elevation—I didn’t feel like I had any serious symptoms of altitude sickness, but it must have been having an affect on me. After following the trail around a nearby peak, I finally caught a glimpse of the summit, as well as some other people making their way down. The last 500 meters or so are rather steep, with a bit of scrambling (considerably steeper than anything else on the trail), but nothing I wasn’t used to from the rugged White Mountains of New Hampshire. I’d say it was comparable to a short section of the Webster Cliff Trail.

At 6:56 am, I summited Cerro Chirripó, and found myself on the roof of Costa Rica. The views were incredible! They say that on an exceptionally clear day, you can see to both the Atlantic and Pacific Oceans. This was not one of those days—there were too many clouds to see either ocean. I snapped a bunch of pictures, signed the summit register, ate my “breakfast”, and chatted with the other hikers there. One of them was even kind enough to share a swig of some rum he brought up with him.

After about 40 minutes on the summit, I started making my way back down. When I got back down to Base Crestones, I went in to use their toilets, which they let me do as long as I showed them my pass to the park (if you don’t go inside, nobody will ever ask for your pass). I also ashamedly checked my email on my smartphone—can you believe they have Wi-Fi up there? And it was actually reasonably fast.

The hike back down went faster than the hike up, not too surprisingly, but with about 8 km left to go, my legs started becoming uncooperative. All of the downhill hiking was doing a big number on my knees, and it was getting increasingly painful to keep walking downhill. My pace slowed down massively, and I started taking numerous sitting breaks to stretch and rest.

At long last, I stepped off of the trail around 2:00 pm, weary and sore. I quickly made it back to my hotel and took a nice hot shower. I packed my things, checked out of the hotel, grabbed a bite to eat, and started making my way back down the road to the bus stop in town. It was still another almost 2 km downhill, but the shower had rejuvenated me, so it wasn’t too bad.

I got on the 4:00 bus back to San Isidro, but the adventure wasn’t over yet. The bus managed to get a flat tire partway through, so we all had to sit there for about half an hour as the driver replaced it with a spare. The roads there are very hilly, bumpy, and in this case, unpaved.

When I arrived in San Isidro a little before 6:00 pm, they informed me that the next available bus to San José was not until 8:30, so I grabbed some food and wandered around the town center for a bit. Out of curiosity, I asked a taxi driver there how much it would be for a ride to San José, and he told me $160. I’d easily wait a couple of extra hours rather than pay that amount, so that’s what I did.

I was perusing an ice cream shop next to the bus station when a stranger approached me and asked where I was going (I was toting around a suitcase in addition to my backpack). When I said San José, he told me he’d take me there for $10. I thought it must have been some sort of scam, but he explained that he was a taxi driver based out of San José and was going back there anyways, so he was hanging around the bus stop trying to snipe off a couple of fares for the ride back. He had an official taxi (red with a yellow triangle), so I agreed to go with him since I wanted to get back at a reasonable hour. He wanted to get at least one other rider with him, though, so we didn’t leave right away.

After waiting for a while without anyone else, he said he’d take me back for $20, leaving right away. Again since I wanted to get back, I agreed, so that’s what happened. We went back over Cerra de la Muerte, and I got back to my hotel not too late to get a decent night’s sleep. The next morning, I got another taxi to the airport, and I was on my way home.

A smashing success.

Comments Off on Cerro Chirripó: The Roof of Costa Rica

Debugging a strange iTunes permissions problem with DTrace

November 27, 2011

The other day, I noticed that one of my media files wouldn’t play in iTunes because it decided that my computer wasn’t authorized to play it. I could not authorize my computer to play that song, however, because the iTunes account name associated with that song no longer existed—I had changed the email address of my account in between the time that that was purchased and when I transferred it to my current computer (it was purchased prior to iTunes’ releasing all of their music DRM-free; I strongly oppose DRM).

When I attempted to re-download the track from the iTunes Store, it gave me this error message which would ordinarily be pretty helpful:


iTunes couldn’t download your purchase.

You don’t have write access for your iTunes Media folder or a folder within it. Change permissions (in the Finder) and then choose Store > Check for Available Downloads


Alas, that was not the problem. Nothing I can think of would have messed up the permissions, and find(1) confirms that all of the subdirectories there are owned by me and are readable, writable, and executable:

$ cd ~/Music/iTunes
$ find . \! -user $USER
$ find . -type d \! -perm -0700
$ # No output from the above commands

What’s going on here?

Time to dig deeper with DTrace. DTrace is a powerful debugging tool, useful for answering such questions as “What system calls is this process calling?”, “Why is the performance of my server so horrendous?” and many more. It’s like strace on crack.

But with great power comes great complexity. In order to use DTrace, you need write a short program in the tool’s D programming language (not to be confused with that other D programming language). The program can be written on the command line or in a separate text file, but it’s still non-trivial. Some really useful examples can be found here, in addition to the various examples in the documentation.

The error message from iTunes strongly smells like a call to open(2) is failing with EACCES when iTunes tries to create the re-downloaded media file. Let’s see if that’s the case:

syscall::open*:entry
/pid == $target/
{
  printf("%s %s 0x%x 0x%x", execname, copyinstr(arg0), arg1, arg2);
}

syscall::open*:return
/pid == $target/
{
  printf("errno=%d", errno);
}

Get the PID of iTunes, start tracing it with sudo dtrace -s open.d -p $PID, and try to download the file again. Unfortunately the output is not expected—errors like this get printed many times:

dtrace: error on enabled probe ID 6 (ID 120: syscall::open:return):
 invalid user access in action #2 at DIF offset 24

After a little more digging, I discovered that iTunes does not like getting debugged, which probably means it also doesn’t like getting itself traced—it just makes the debugger segfault instead. Fortunately, it’s not too hard to get around this: just turn ptrace into a no-op in iTunes when it tries to make itself undebuggable with ptrace(PT_DENY_ATTACH). Charlie Miller provides a nice gdb script for doing so:

break ptrace
condition 1 *((unsigned int *) ($esp + 4)) == 0x1f
commands 1
return
c
end

Ok, so we’re past that hurdle. Quit iTunes, restart it under gdb with this anti-anti-debugging technique, fire up DTrace again, and try to re-download the file:

CPU     ID                    FUNCTION:NAME
  0    119                       open:entry iTunes /.vol/234881026/1516872/SC Info.sidb 0xa00 0x1b6
  0    120                      open:return errno=13

Hmm. Error 13 is indeed EACCES, but what is this strange file under /.vol? Why, it’s the Volume Management file system, used by the Carbon File Manager. Using ls -al /.vol, it appears that that directory is completely empty, yet somehow other file accesses within there succeeded, as indicated in the DTrace output.

I’m not sure if there’s an easy to figure out which directory in the real file system that /.vol/234881026/1516872 refers to, but a quick search for a file named “SC Info” yields two likely candidates:

$ locate -i "SC Info"
/Users/Shared/SC Info
/Users/Shared/SC Info~orig

Let’s see what those directories look like:

$ ls -la /Users/Shared/SC\ Info*
/Users/Shared/SC Info:
total 0
drwxr-xr-x   2 root  wheel   68 Jul  2  2010 .
drwxrwxrwt  10 root  wheel  340 Oct 30 22:54 ..

/Users/Shared/SC Info~orig:
total 0
drwxrwxrwx   2 adam  wheel   68 Jul  2  2010 .
drwxrwxrwt  10 root  wheel  340 Oct 30 22:54 ..

Aha! So iTunes is trying to create a file named SC Info.sidb in /Users/Shared/SC Info, but it’s failing because I don’t have write access to that directory.

The solution:

sudo chmod a+w /Users/Shared/SC\ Info

Bingo! The song now downloads successfully.

Of course, you probably could have skipped all this, googled the error message, and found this knowledge base article explaining how to fix it without too much trouble, but that’s boring. Using DTrace to debug the problem is much more fun and exciting!

Do you have any great success (or failure) stories involving DTrace?

1

Google search keyboard shortcuts

October 10, 2011

For quite some time, Google’s experimental search offered a “Keyboard shortcuts” experiment, where you could navigate search results with vi-style key bindings (j and k to navigate up and down search results, o or Enter to open a link, and / to move the cursor back to the search box).

It seems they have recently removed that experiment, as they sometimes do. I don’t know exactly when that happened, but The Wayback Machine puts it at somewhere between April 21 and now. But despite Google’s removing the experiment, the keyboard shortcuts had still been working just fine for me—until, that is, I revisited the page linked to in the first paragraph. Even just visiting that page, without taking any action, removed the shortcuts. The Accessible View experiment also provides similar keyboard shortcuts, but it does other things I don’t like, such as highlighting the currently selected search result blue.

I took a peek into the JavaScript on that page, and though it was optimized and obfuscated, it wasn’t enormously complicated. It was doing stuff with the PREF cookie, but the cookie’s content was highly opaque. There was a handy _toggle() function which took the name of a feature to toggle. The two currently available experiments, Instant on Images and Accessible View, which pass in the names 'ImagesInstant::PublicOptIn' and 'Axs' to _toggle(). Archive.org tells me that the keyboard shotcurts experiment used the name 'BetaShortcuts'.

So, the obvious next step was to see if running _toggle('BetaShortcuts') on that page would fix up my cookie to give me back my keyboard shortcuts. I fired up the web console from Firefox’s Web Developer add-on and ran that command:

> _toggle('BetaShortcuts')
TypeError: h("e_" + b) is null

D’oh. It’s trying to do something with the page’s DOM—ordinarily, when you click the “Join this experiment” button, it changes the button text to “Leave this experiment”, but there’s no button for the BetaShortcuts experiment to change the text for. The h() function is just a thin wrapper around document.getElementById(). Well, let’s try hacking around this by renaming one of the other buttons:

> h("e_Axs").id="e_BetaShortcuts"
"e_BetaShortcuts"
> _toggle('BetaShortcuts')
undefined
GET http://www.google.com/url?(various opaque parameters) [HTTP/1.1 204 No Content 88ms]

Close the page, and voila! Keyboard shortcuts work again.

11

Bastion

September 6, 2011

A gem of a game called Bastion came out earlier this summer, and I recently finished getting all 200/200 of its achievement points. If you have an Xbox 360 or Windows PC, I highly recommend checking out the demo at the very least, and for $15, it’s easily worth its cost. Sadly, Mac OS X and Linux users are out of luck for the time being (it doesn’t seem to run under Wine).

Bastion box art

Bastion is an action RPG, in a similar vein to the Diablo series, but the RPG mechanics are much simpler. You only have weapons and potions to worry about—there’s no armor/rings/etc. to worry about, no complicated skill trees. The set of weapons that you find throughout the game is fixed, not randomized, and you can upgrade the weapons for a cost. Potions provide passive benefits (such as increasing your chance of critical hits when low on health), and you can carry more potions as you level up.

Three things really make this game shine and put it on another level from your typical hack-n-slash game:

  • The narration—Logan Cunningham narrates the game, and he does a phenomenal job of it. Not only is he a great voice actor that really adds character to the game, but the narration is dynamic, based on what you do in the game. When you walk off the edge of the world for the first time, he comments “…and he falls to his death. (pause) Nah, I’m just kidding with you.” Check out the trailer videos for a sampling.

  • The artwork—it’s just plain gorgeous. Supergiant Games obviously put a lot of love in this one.

  • The adaptive difficulty level—you can make the game harder for an additional challenge. But it’s not your usual “pick easy, medium, or hard for your difficulty level and stick with that throughout the game”. Instead, the game starts off at a particular difficulty level, and when you reach a certain point in the game, you can make it harder in smaller increments.

    There are 10 gods in the game, and activating each god makes the game harder in a certain way. One god makes enemies more resilient to damage, another makes them hit harder, another makes them move faster, another makes them regenerate health, yet another makes them randomly deflect attacks, and so on. Playing with more gods activated increases the risk but also the reward—you earn more experience and money by playing with more gods. This unique system makes a fantastic addition to the game.

My only complaint is that the game is too short. The “New Game Plus” feature—which allows you to replay the game after beating it, starting with all of your weapons, weapon upgrades, experience, items, etc. from the end of the game—adds some replay value, but not a huge amount. I got maybe 12-15 hours total of the game, and I’d easily pay $60 for 40+ hours of gameplay.

Bottom line: 9.5/10

Comments Off on Bastion

Owl’s Head Adventure

May 16, 2011

This past Saturday, May 14, I attempted to summit Owl’s Head, a mountain in the Pemigewasset Wildernass of the White Mountain National Forest in New Hampshire. It’s one of the most remote of the Four Thousand Footers.

The shortest route to Owl’s Head from any trailhead is via the Lincoln Woods Trail. From there, it’s 9 miles each way, making for a non-trivial 18 mile day. However, since that trail has some tough river crossings, we decided to do some bushwhacking to avoid those. We took the Black Pond Trail, and from Black Pond (pictured below), we bushwhacked for about a mile north to where the trail to Owl’s Head crosses back onto the south side of Lincoln Brook (variation “A” in the map linked to above).

We followed the trail for another few miles until it crossed the brook again. Tried as we might, we couldn’t find a suitable route across the brook, so we reluctantly took our boots off and waded through. Let me tell you, that water was cold. There’s still plenty of snow melt this time of year (and plenty of snow at higher elevations). We thought that that was the only water crossing left, according to the map. We were wrong—the brook has an unmarked fork, so there was a second crossing that we were forced to wade through.

By around 12:45 pm, we had finally made it to the fork for the trail going up to the summit of Owl’s Head, which was not marked by any signs. The only indications of the trail were two smallish cairns placed a trail’s width apart next to two parallel logs pointing up the mountain. Up until this point, the hiking had been almost entirely flat. Now, the trail shoots up 1500 vertical feet over 1.1 miles, an average grade of about 26%. On the plus side, though, we finally saw some fantastic views that weren’t of the river:

Shortly after beginning the steep climb up the loose scree, we came across the first people we’d seen all day since Black Pond. Coming down from the summit of Owl’s Head was a group with a blind man! They were of course slow-moving, as the blind man had to be carefully guided down the mountain, but it was an impressive feat nonetheless. They had camped out at the base of the mountain the night before and had taken a huge chunk of the day to go up and down that 1.1 miles.

The afternoon went on, and we found a stream of water pouring down the narrow trail. It was getting late, and the weather forecast was calling for rain. So although we were probably only about an hour away from the summit, we made the wise decision to turn around and head back home. It’s painful to come so close to the summit and not make it (especially one so remote), but I think it was the right decision. We still had another 8 miles of hiking ahead of us, including two stream crossings and more bushwhacking.

On the way back, we passed by the group with the blind man again around the stream crossings. They also had a dog with them (whom I presume was the blind man’s seeing-eye dog but was not acting in that capacity for the hike) who made it across the first crossing but couldn’t make it across the second. The poor dog had this horrible fear in his eyes and sadly had to be carried across.

When we made it back to the the next stream crossing that we had avoided by bushwhacking, we again went off trail with the goal of avoiding unnecessary wading. We could have attempted to retrace our steps back towards Black Pond, but the difficulty with that is that if we were off by just the smallest amount, we wouldn’t hit the trail and would have to bushwhack far more to find our way back onto it. Instead, we bushwhacked along the bank of the river (variation “B” of the aforementioned map, in reverse). It’s a slightly longer bushwhack, but it does not require pinpoint navigation.

1.5 miles or so later, we came out of the woods at Franconia Falls:

As we started following the trail back out to the Lincoln Woods parking lot, we came across a curious sign that said only “200 Feet” on it. We were a little confused as to its meaning, until a short while later when we saw another sign inquiring if you knew how much 200 feet was—in the Pemigewasset Wilderness (and many other parts of the WMNF), camping and campfires are prohibited within 200 feet of trails and waterways. The signs were demonstrating that 200 feet is farther than you might think.

We hustled through the final few miles back to the car, as it was really starting to rain considerably. We finally made it back to the car sopping wet at 7:00 pm, completing about 16 miles or so in just under 11 hours. We were sure glad we turned around when we did!

I’ll definitely have to come back to Owl’s Head some time if I’m to finish hiking all of the Four Thousand Footers, but after this adventure, I’m putting it down near the bottom of my list. It’s very remote, it has numerous stream crossings, and the trail is poorly maintained (I think we saw a grand total of two blazes and one arrow painted on a rock on the entirety of the trail between where we joined it after the bushwhack and where we turned around).

Stay tuned for more updates on the Four Thousand Footers, I have plans to hit many more this summer.

Comments Off on Owl’s Head Adventure

Algebraic Crosswords

April 24, 2011

A blogger by the name of T Campbell recently posted an interesting read about Algebraic Crosswords. And at the end, T posts a $100 bounty for a computer program to help crossword constructors construct such crosswords. That’s right up my alley as both a programmer and a puzzle solver, so I threw together a quick Python script to do the job.

My program, named algxword, can be downloaded from my GitHub.

The usage is as follows:

Usage: ./algxword.py [OPTIONS...] WORDLIST FROM TO

Finds all words in the file WORDLIST (which need not be sorted) which would
continue to be words when substituting the substring FROM for the substring TO.
Only words which contain FROM in them are considered.

Both FROM and TO can be empty strings.  If FROM is the empty string, then TO is
added at each position in the string to test for a word.  If TO is the empty
string, then the FROM string is simply deleted.

Ordinarily, only the first occurrence of FROM is replaced with TO.  If the -a
option is specified, then all occurrences of FROM are replaced with TO.

OPTIONS:

-a      Replaces all occurrences of FROM with TO when testing for a word
--help  Prints this help message

Examples:

# Find all words which remain words when substituting the first occurrence of
# 'qu' for 'k' in the word list /usr/share/dict/words
python algxword.py /usr/share/dict/words qu k

# Same as above, but replace all occurrences of 'qu' for 'k'
python algxword.py -a /usr/share/dict/words qu k

# Find all words which can have an 'lax' inserted in them
python algxword.py /usr/share/dict/words "" lax

More detailed instructions for the less command line-savvy can be found in the included README file.

UPDATE 2013-01-01:

The download location has been moved to GitHub. I also relicensed it under a BSD-like license instead of the GNU GPL.

5