Sunday, September 14, 2008

sudokudlx: Automatic Sudoku Solving with Dancing Links

In case I hadn't shown you yet, here's my Python implementation of a Dancing Links sudoku solver, on appengine!

Also, I've written a bit about how to use Dancing Links (DLX) to solve sudoku puzzles. Soon, I'll write up how to implement DLX.

Sunday, September 07, 2008

plats is Swedish for "locale".

My first pass for solving the problem from a few days ago is now live on appengine.

Check it out:

Just include a script in your page and you get a variable or a meta tag (for GWT apps) to tell you which locale you should be in. Details here.

Thursday, September 04, 2008

figuring out the user's language preferences, client-side

Your browser sends an HTTP header field called "Accept-Language" (see 14.4) when you make a request to a web server. It tells the server which languages you prefer, and in which ordering, so the server can send you localized content with graceful fallbacks. You can muck with these, for example, in your Firefox settings under Preferences > Content > Languages.

So I'd like to do this on the client side. I had the bright idea that I would just build an XMLHttpRequest object and ask it what headers it was about to send (XHRs do send this field), but GWT's HTTP objects don't let you get at request headers that you haven't explicitly set. The very good reason for this is that XMLHttpRequest objects don't let you query their headers. Oh noes.

It may be that the way to do this is with a bit of server-side cleverness, but that's not the answer I want. Unless somebody happens to have a way to snag these settings from JavaScript...