preload
Oct 10

$ javaws /path/to/file.jnlp

That works fine from a terminal window, but it was bugging me, because I was sure that there must be a way to launch these apps from the dock. And sure enough, it’s dead simple.

  1. Launch /Applications/Utilities/Java Preferences.app
  2. Select the Network tab.
  3. Click the View Cache Files button.
  4. Right-click on the app and select Install Shortcuts.

This lets you save an app file, which you can then drag onto the dock.

Java Preferences
Uploaded with plasq’s Skitch!
Java Cache Viewer
Uploaded with plasq’s Skitch!
Tagged with:
Aug 18

I’ve defended my 9 kyu rank on KGS, so I’m declaring success in my personal goal to reach single-digit-kyu by the end of 2009. The defense happened a while ago, but I waited to see if KGS dropped me back to 10k or if I’m solid in my new rank.

I put in a lot of time reading, studying, and drilling this year — more than ever before. I also greatly increased the number of games that I played, both online and with my good friend Josh 5k. So, even though “kyu” still means that I’m terrible, I’m proud of the advancement.

KGS: Edit User
Uploaded with plasq’s Skitch!
Tagged with:
Aug 10

It appears that Firefox 3.5.2 broke XMLHttpRequest.setRequestHeader(). According to the W3C docs, in giant bold green type:

The setRequestHeader() method appends a value if the HTTP header given as argument is already part of the list of request headers.

Rather than appending, it’s overwriting the existing value entirely.

The particular case where I ran into this was when using jQuery to send a remote form request. My setup code includes the following line.

  jQuery.ajaxSetup({
    'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
  });

When firing off an Ajax remote form request with Safari or older (pre-3.5) versions of Firefox, the header would contain the following.

Accept: application/javascript, */*, text/javascript

Or, if the browser had already decided that it was going to accept text/javascript, at worst I’d get a duplicate.

Accept: text/javascript, application/javascript, */*, text/javascript

With Firefox 3.5.2 I see this instead.

Accept: text/javascript

And the HTTP error returned from the server.

406 Not Acceptable

The workaround is simple.

xhr.setRequestHeader("Accept", "text/javascript,application/javascript,text/html")

I have to set that header parameter with all of the types that should be accepted as a response to a remote form request.

The downside to this is that non-broken browsers almost defintely include duplicate values, but at least it still works.

Ex.: Safari with the workaround in place.

Accept: text/javascript, application/javascript, */*, text/javascript,application/javascript,text/html

Tagged with:
Jul 07

If you edit with TextMate, but you haven’t yet installed Ack in Project, you’re missing out. It’s much faster than TextMate’s built-in search. My preferred fork of this bundle is David Lynch’s, which adds a pull down menu of file types to focus your search on.

Ack In Project
Uploaded with plasq’s Skitch!

One of the cool things about file types in Ack is that they’re more like buckets of types. Looking in ack-standalone.sh, this is the default mapping for “Ruby” files.

ruby => [qw( rb rhtml rjs rxml erb )]

I wanted to include Haml in that list, so I edited the .sh file and issued a pull request for the change. David wrote back, informing me that these mappings can be modified on the command line so I dug into that a bit deeper.

It turns out that you can modify an existing mapping with Ack’s --type-add switch. In this example, I wanted to include both .haml and .rake files to my “ruby” searches.

--type-add=ruby=.haml,.rake

You can also add a completely new type with --type-set.

--type-set=haml=.haml

Put these in ~/.ackrc with each switch on its own line.

The Ack docs don’t use the equal sign after the switch name, but I found that it’s needed for OS X. No idea why that is, but it seems to work.

Ack in Project will automatically pick up these changes, because it builds the pull-down menu by parsing the output of ack --help=types. This also makes it convenient to see if you’ve set up your .ackrc file properly.


$ ack --help=types
...
    --[no]ruby         .rb .rhtml .rjs .rxml .erb .haml .rake
...

Yay.

Tagged with:
Jun 28

Dave Peck runs a very slick email driven Go service. It lets you create a game, supplying only the name and email address of both players.

Here is what you see when you first arrive at the site.

[Dave Peck's Go]
Uploaded with plasq’s Skitch!

Simple and clean, like the game itself.

After you “Get Going” you have to supply a few pieces of information, setting up your game. At first, I didn’t notice that the list on the right was clickable. You can change the board size, handicap, and swap colors by clicking on the option that you wish to change.

[Dave Peck_s Go » Get Going]-1
Uploaded with plasq’s Skitch!

You don’t have to log in, nor can you. You receive an email when it is your turn, with a “secret” URL that contains a token for your game. When you click on the link, you are taken directly into your game. Place your stone, click “make this move” and you’re done.

[Dave Peck's Go » Foo vs. Bar]
Uploaded with plasq’s Skitch!

The source code for the site is also open source in case you’d like to help out or run your own server.

Tagged with:
Jun 23

I squeaked over the line into 10k-land on KGS during the last week. Still played my live games on Sunday at 6 handicap against Josh 5k. I won both, so maybe if that continues I’ll move up to 5 stones against him soon.

KGS: Edit User
Uploaded with plasq’s Skitch!
Tagged with:
Mar 30

Bask in the ineptitude of my latest Go game. Poor decisions early, plus getting into 30 second byoyomi by move 127 made for a painful experience on my end.

Sensei Mathews 5k has kindly provided comments on this game.


If you had JavaScript enabled, you’d see the EidoGo SGF viewer here.

You can download the SGF file anyway.

I’m playing black, going by the name Bray on KGS.

Tagged with:
Mar 03

Daylight Saving Time is soon upon us, and that means that the spring disc golf leagues are about to start. For reference, here’s the more-or-less official list, although it’s usually outdated.

One thing to note is that the term “league” is a bit misleading for new players. You don’t have to sign up ahead of time, like you would with a bowling league. Just show up on the days that you want to play and pay your entry fee. Some leagues do track stats and offer season-end prizes, so there’s some incentive to be a regular beyond hanging out with your friends once per week.

These are the leagues that I play in.


Westside Wednesdays

Wednesdays @ 5:30 in the west metro.

First week: March 11th at Lions Park in Shakopee.

This is the main league for me, and I rarely miss a week. It’s of moderate size, averaging around 40 players in June, less in the early spring and fall.

During the summer the courses rotate between Bryant Lake, Hyland Hills, and Elm Creek (new for 2009). In the early spring we use Lions park in Shakopee, and in the fall we use Rosland Park in Edina.

The level of play is decent, with some real pro players as regulars. Open and Advanced are offered every week, with other divisions like Intermediate (most every week) and Women (rarely) as demanded. Most of us playing in the open division are actually advanced amateur tournament players. This is partly because a lot of us have these courses so dialed in that we play way above our rating on them, and we don’t want to crush the amateur divisions and drive away newer players.

Vibe: Relaxed regulars having a very good time, competing for small stakes.

Tim Gill runs this show. He’s one of the nicest guys you’ll ever meet, and also one of the best players you could ever compete against.

Fees: Pro $6, Am $5. You also need to have a yearly ($30) or daily ($3) pass from the Three Rivers courses that we use (Bryant, Hyland, Elm).


Sundog

Tuesdays on a rotating series of courses around the east metro.

First week: Early April
The Sundog website hasn’t been updated yet for 2009, but the old one will give you an idea of the schedule and courses that are used.

This is the mother of all leagues for the state, and one of the largest leagues in the world. They draw 150+ players during the peak of summer. The level of play is very high. It’s essentially a tournament every Tuesday. I try to get to at least one of these per year.

Vibe: This is a tournament, but we’re still all here to have a good time.

Tim Gill and Matt Koerner do an excellent job of managing this beast of a league.

Fees: They haven’t been announced yet for 2009, but they should be something like $10/$8 for pro/am. Slightly higher fees and huge attendance make for some monster payouts.


The Solberg Leagues

John Solberg runs a series of leagues in the west metro. It’s a shorter season, which usually starts in April. His tee times are later, usually 6:30, which shortens the season due to daylight concerns. I try to make a couple of these per year.

This is a very laid back league. The level of play is good for amateurs, and not so great for pros. Advanced Am tournament players should be playing open here. This seems to be by design, as John caters very well to the newer players. His intermediate division is usually deep, and he draws the largest crowd of new players of any league in the area.

Vibe: Party time? That’s an overstatement, but I’d probably avoid bring kids to these.

Monday: Bassett Creek
Tuesday: (new for 2009) There’s a possibility that he’s starting a new league at Elm Creek.
Thursday: Plymouth Creek

Fees: In the past it’s been $5 to $7 depending on division. Should be roughly the same for 2009.

Feel free to send me any questions you have on leagues or disc golf in general.

Tagged with:
Feb 22

Out of the blue I started getting the following error from TextMate’s test runner for Rails tests.

Rails requires RubyGems >= 1.1.1 (you have 1.0.1). Please `gem update --system` and try again.

On the command line, I’d see the following:

jdl ~ $ which gem
/opt/local/bin/gem
jdl ~ $ which ruby
/opt/local/bin/ruby
jdl ~ $ gem -v
1.3.1
jdl ~ $ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.3.0]

Pretty clearly, TextMate was picking up the wrong Ruby installation on my system. With JRuby and at least one other “normal” Ruby installed, it didn’t seem impossible. But why now? I still don’t know the answer to that question, but I did fix the problem.

Digging through the TextMate Ruby bundles, I kept seeing a reference to “TM_RUBY”. In the advanced preferences I set this to have a value of my desired Ruby install, and everything was happy again.

Setting the TextMate TM_RUBY variable in advanced preferences

Setting the TextMate TM_RUBY variable in advanced preferences

Tagged with:
Feb 21

Every time I switch to a new branch in git, I ask the question, “Are my dev and test databases in a state that works with this branch?”  Rarely being able to remember the answer, I go through the ritual of dropping the tables, migrating, loading fixtures, and prepping the test database.  Annoying at best.

I hacked together a potential solution.  This is intended for your dev and test databases only.  This looks like an outstandingly stupid thing to do on your production server.  Although, who deploys their database.yml file from git anyway?

For months, I’ve been using this great shell hack that puts your current branch in your command line.  Thanks github.

jdl ~/hm(master) $ git co foo
Switched to branch "foo"
jdl ~/hm(foo) $

It finally dawned on me that my database.yml file could also use a similar treatment. Modifying the system call a bit, I ended up with this. Notice that I’m using an absolute path to git. That’s because the TextMate test runner wasn’t able to find git in whatever PATH it was picking up. If you’re just using rake or autotest, then you can simply specify ‘git’ there.

local_db: &local_db
  adapter: mysql
  username: root
  password: 
  host: localhost

<% branch_name = `/usr/local/git/bin/git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`.strip.gsub(/[* ]/, '') %>

development:
  <<: *local_db
  database: <%= "project_dev_#{branch_name} "%>

test:
  <<: *local_db
  database: <%= "project_test_#{branch_name} "%>

Creating a new branch takes a bit more effort, but switching is now faster.

jdl ~/hm(master) $ git co -b foo
Switched to a new branch "foo"
jdl ~/hm(foo) $ rake db:create:all; rake db:migrate; rake db:fixtures:load; rake db:test:prepare

The downside to this is that it’s overkill when creating a branch that has no migrations in it. I’m going to try it for a while and see how it goes.

Update: After a week of using this, I have to say that it’s neither terrible nor great. I still think that there is a good idea buried in there, but it needs to be integrated with the git branch hooks to ease the pain a bit. Specifically, I need to figure out the following.

  • Deleting a branch should automatically clean up the databases that were created.
  • It would be great to have this be optional when creating a new branch. If I could decide to just use my base dev db on a branch, or to create a whole new set of local db’s at the time of branch creation that would be the killer feature for this idea.

Not dead, but back to the drawing board.

Tagged with: