Friday, January 23, 2009

More exciting than I would like

Well, we just had a magnitude 3.4 earthquake centered only about half a mile away. It's not the biggest earthquake since we've been living here - there was a 5.2 a bit further away last year - but because it was so close, it felt much more intense. There was probably 10 seconds or rough shaking, compared to 3 or 4 seconds of rolling in the 5.2, just long enough to be scary, especially for the dog.

My first instinct in an earthquake is not to get outside or check for damage. Oh no: it's to go the USGS web site to see where it was and how powerful. And I'm not alone, as several people on the neighborhood mailing list and on local blogs have already posted links to the report: http://quake.usgs.gov/recenteqs/Quakes/ci10373093.htm.

Saturday, January 10, 2009

Yodallings

I have an idea for a blog post which I don't have the skill to execute. So I'll write the bare bones of it here, and then it'll be almost as if I wrote it without actually having to do the work.

Flann O'Brien, when writing as Myles na gCopaleen, published some pieces in the Irish Times which appear to be in Irish, but if read phonetically turn out to be in heavily accented English. For example, one short piece starts
Aigh nó a mean thú ios só léasaigh dat thí slíps in this clós, bhears a bíord, and dos not smóc bíocós obh de trobal obh straigeing a meaits.
which reads as
I know a man who is so lazy that he sleeps in his clothes, wears a beard, and does not smoke because of the trouble of striking a match.
I wanted to put this together with the idea that Japanese uses different orthographies for different things: hiragana for native words spelled phonetically, katakana for imported words spelled phonetically, kanji, which is pictographic, for most content-bearing words, and occasionally romaji, the Latin alphabet you are reading now. So then I might write a little Star Wars parody, in which the country bumpkin hero (るくさかいをくる) speaks hiragana, and the villain (ダルトベイダ), who is clearly foreign, speaks katakana. Yoda would of course speak Kanji, and, just possibly, Wookies and those little teddy bears would use romaji.

Naturally, I would also have needed to think about word order, especially for Yoda. Japanese is a head-final language, which means it generally puts the word with the most oomph at the end of each clause, so for example in a sentence the verb comes last. Thus for "I like drinking beer" you might say something like "watashi wa nomimoni wa biru ga suki desu", which reads roughly as with regards to me, in the matter of drink, beer, likeable is. (With apologies for any errors in this: it's more than 10 years since I studied Japanese.) Then everyone could talk like this, except for Yoda, who would use English word order. Because in the English version of Star Wars, backwards speaks does he.

Alas, I could never take this beyond the germ of an idea. But it does trigger off one other thought. There is a discussion of Yoda's syntax in an old language log posting, in which various word orders for Yoda's speech are discussed, and it is also pointed out that occasionally he follows ordinary English word order. The question that troubles me is that given that he can follow English word order, why doesn't he do so all the time? He has had (we assume) several hundred years of exposure to the the language, which is surely enough to smooth out his idio-grammatical quirks and get him to native speaker competence. Speaks funny, then why does he? I believe there can only be one answer: that Chomsky was right all along. The innate language component of Yoda's brain is such that he intrinsically cannot get the words in the right order, no matter how much he studies and attends the Berlitz school for Jedi. The universal grammar of Yoda sapiens just won't allow it.

Saturday, January 03, 2009

Riddles in the light

I've had some fun over the last year with online riddle games. A couple of years back, I played Qwyzzle after reading about it in Alison Scott's Live Journal. It is an example of the "URL-changing" style of riddles, in which you get a web page which contains a puzzle to solve, and then change part of the URL based on the solution to advance to the next puzzle. As far as I can tell, Qwyzzle is now off-line, though there are many others like it.

Late in 2007, a metafilter posting directed me to a list of room escape games. These are usually built with Flash, and typically have a scenario where you have to escape from a locked room by finding and combining objects and solving brain teasers. Most of them are of poor quality, partly in the game mechanics (pixel-hunting, for example), but more particularly because the puzzles are often rather arbitrary or just daft, and they didn't really hold my interest for long. (With one exception: the submachine series by Mateusz Skutnik).

The same list also included The Roomz. Superficially, this looks like other room escape games, but is really closer to the Qwyzzle genre. It consists of a number of levels, each with a password that gets you to the next one. Some of the early levels are a bit like point-and-click games, but most of them involve breaking codes and solving logic puzzles, sometimes with a bit of lateral thinking thrown in. I don't want to reveal any details, but to give an outline of one "room", you start by seeing some pictures and a string of letters. Working out who and what the pictures refer to gives you a lead in to what kind of code it is and the keyword to break it, and this gets you to the password. This is an early puzzle and is a fairly simple one. By the end (room 45), you are solving multi-layered puzzles, in which you need to crack codes, solve cryptic clues, assemble information from the web (or your own head, if it already contains what you need to know), and make a few inspired guesses. It took me about four or five months to get through the whole of The Roomz, with probably a month or more on the last room alone. I am only slightly embarrassed to admit that I solved the last puzzle while at work, in a particularly tedious meeting.

The Roomz was a good experience, both for the puzzles themselves, and also because it has a supportive and helpful forum for getting you past points where you just can't see what to do next. After I finished it, I cast around for something new to play. Clever Waste Of Time is one that many people speak highly of, but I didn't like that to solve some of the puzzles you end up installing extra software, and also that the forum has a rather hostile feel to it. Eventually, I came across The Labyrinth (and Labyrinth II) at puzzlefiles. In presentation style, it is very different to The Roomz: each puzzle is simply a web page with low-fidelity graphics and a text field to enter the solution. However, the puzzles have the same multi-layered nature, with codes and numerical and word games, and in many cases the need to make an intuitive leap once you've done the initial stage. It also has a forum which, like The Roomz, has people willing to be helpful and constructive. With some of the harder puzzles, I needed to get a gentle hint, then less gentle nudge, and sometimes thundering great shove to figure out what was going on. I finished the two labyrinths after about 7 months, with some longish breaks at various stages.

I found both The Roomz and the two Labyrinths engaging in the same way that a good cryptic crossword in the British style is. They mix conventions (e.g. "blind" often indicates there is some Braille in the puzzle just as broken signals an anagram in a crossword), a set of solving techniques which you might recognize when you see them or might require you to work out something new, and some leap in the dark guesswork. And there is same a-ha feeling when a particularly difficult puzzle resolves. Of the two, The Roomz has richer interaction, though the puzzles are a bit easier and occasionally become formulaic. The Labyrinths have harder and more disciplined puzzles, with a less interesting visual style. I've not yet found a new game to move on to, though some of the puzzles at puzzletome look promising.

(BTW: The Roomz only works with IE. I've had some weirdness in retrying it after recent Flash updates, though not enough to make it unplayable.)

Friday, July 28, 2006

More reasons why the iPod is crap

Following my recent post about Apple's economy with the truth concerning the iPod battery life, I wanted to add a couple more reasons why I think the iPod is crap, or at least not as good as Apple would like you to think.

First, I've had the experience just after turning it on or after shuffling songs that the controls become unresponsive for 20-30 seconds. It's OK if this is happening because the iPod needs to do some computation. It's not OK that there is no indication of a delay in the user interface. Apple included the hourglass in what they stole from Xerox for the Mac UI: why couldn't they do it for the iPod?

Secondly, suppose you have the iPod set up to shuffle by album. You are half way through an album when the battery runs low and so you connect it up. When you next turn it on, it has reshuffled the playlist and started you on a new album. This is true even if no new music was downloaded, and even if you have manual synchronization set up.

Oh, and another thing. The capacitative touch control is all very well, but don't try using it too close to your Blackberry. The radio signal from the Blackberry presumably causes electrical discharge through your fingertips, and so the controls go mad. You have to think there are some Blackberry users amongst Apple's so-called design team who might have noticed this and considered a different sort of control. I wonder what happens if you use the iPod in a thunderstorm?

Sunday, July 23, 2006

Apple iPod Battery Life

Apple's figures for the battery life on a iPod are misleading, disingenuous, or at least economical with the truth. For a fifth generation, 30G iPod, they say 14 hours music playing time on a fully charged batter. If you think you are getting less than this, you can run a test using a methodology listed here. Basically, you set your iPod to play a single album on repeat, with the backlight and EQ turned off. Repeating the same album means there is little or no disk access, and turning off EQ reduces extra computation. If you get less than half the specified time, you can consider the battery faulty.

So another way of putting this is that the battery life is between 7 and 14 hours, provided you are using the iPod in completely unrealistic way. If you ever use the backlight, shuffle the playing order, or skip tracks, you get far less.

On the test, my iPod gave 11 hours and 10 minutes, about the in the middle of the range. In my typical use, with no EQ and the backlight timer set to 5 seconds, I get between 3 and 4 hours, which is barely acceptable.

Apple like to present themselves as a white knight: we are good for our users and morally better than the other guys. Well, they've always been better at projecting an image than creating a reality. This is the company who forced the one-button mouse on us, or made out that a Mac was better because it had a case made of translucent blue plastic, and who are currently advertising themselves as better than Microsoft by means of sneering at them. I think I would rather they put their efforts into being more honest about themselves.

Thursday, November 11, 2004

Uploading to Gmail

I recently signed up for a Gmail account. Normally, I get my mail through my ISP and download it to Outlook, and I want to keep doing this. At the same time, I'd like to have Gmail as a backup and a permanent store that I can access anywhere. There are some tools on the web for uploading your email to Gmail, notably GMLW. However, none of them work with Outlook, and though there are utilities which will extract from Outlook into a format GMLW can use (e.g. outport, readPST), I have not found them to work very well.

So I am writing some Perl scripts to do this. It's not too hard to read the Outlook mailbox, but there are some suprisingly difficult things, such as finding the email address of the sender, the reply-to address, and determining whether the message is plain text, RTF or HTML. In the case of RTF orHTML, there is also a problem of decoding it from the compressed form that Outlook uses. I've found solutions to most of these problems, through a combination of playing around, porting scripts from other languages (e.g. the RTF decompressor and the HTML-from-RTF extractor), and just picking up tricks here and there (e.g. how to get the SMTP transport headers).

The scripts are not yet ready to use, but I am working on them. Leave a comment if you might be interested.

Monday, October 04, 2004

Line Follower using Navigation

For the final version of the Line Follower control program, I used the Navigator API. The code is here. I like this approach: the code is much simpler and cleaner than the other versions, although it does rely on the calibration parameters being accurate.

One minor problem is this: when the robot needs to turn in order to find the line, it uses the navigator's rotate method. If the turn causes it to pass completely over the line from one side to the other, it will fail to notice that it has done so. I looked at the source code for rotate, and what it does is to calculate how long it needs to run the motors for in order to turn through the specified angle, and then sleeps (using Thread.sleep) until this time has elapsed. So I considered setting up a separate thread which watched the light sensor, and interrupting the sleep if this happens. If the sleep call in rotate is interrupted, it just stops the motors.

In the end, I decided this was too much hassle. However, it turns out there is another problem as well. The TimingNavigator class maintains an instance variable (called angle) containing the current angle. The rotate method updates this to the target value, i.e. the current value plus the rotation, before starting to run the motors. So if the thread is interrupted, angle will contain the wrong value.

A possible improvement to the class would be to update angle to the actual angle, based on when the thread was interrupted. Another change which might make life nicer would be to have a rotateUntil() method, which rotates through an angle or until some other condition is met. I would prefer this, as it gives you tighter control over how to interrupt the turn, and avoid the overhead of having a separate thread and catching the exception.