April 2009


iPhone27 Apr 2009 06:12 am

Apple just accepted my ChessPlayer update today. I’ve since removed all the amateur games from the database and have added a collection of Kasparov games compiled by Allen Dellinger specifically for use in Chess Player. I also have to thank Bruno Berenguer for letting me use his grandmaster collections.

We’re also now multilingual! Thanks to Maria Nuyanzina for Russian, Judith Meyer for German and Alex Kadar for French! I also translated the app to Esperanto, but since there is no localization option on the iPhone (even though it appears in the iPhone Simulator!) for Esperanto, there’s no way to view it on a device. However, Esperanto does show up as being supported in the app description.

chess_player_languages

iPhone and Objective-C24 Apr 2009 03:11 am

I’m developing an iPhone app which has a built-in quiz which runs using JavaScript within a UIWebView. After a user clicks a Check Answers button, I have to use JavaScript to determine if all the answers are correct, so I can save this result for later.

Here is the relevant JavaScript:

function checkAnswers() {
  // Do stuff to see if all answers were correct
  ...

  // Send all correct status back to Objective-C
  window.location = "/allCorrect/" + allCorrect;
}

In Objective-C, you then need to set up a UIWebViewDelegate to intercept whenever a new URL is to be loaded into the UIWebView. Then you need to call shouldStartLoadWithRequest and if you called your fake URL, then it shouldn’t load, but execute the code you need to run in Objective-C instead. Here is the relevant Objective-C code:

- (BOOL)webView:(UIWebView *)webView
        shouldStartLoadWithRequest:(NSURLRequest *)request
        navigationType:(UIWebViewNavigationType)navigationType {

  if ( [request.mainDocumentURL.relativePath
        isEqualToString:@"/allCorrect/false"] ) {
    NSLog( @"Nope, that is not right!" );
    return false;
  }

  if ( [request.mainDocumentURL.relativePath
        isEqualToString:@"/allCorrect/true"] ) {
    NSLog( @"You got them all!" );
    return false;
  }

  return true;
}
Podcasts21 Apr 2009 12:16 am

[Non-German summary: I appeared in a German tech podcast.]

Ich war ein Gast bei einem Podcast über alles was mit Technologie zu tun hat, aber hauptsächlich mit Apple und iPhone. Leider ist die Audio-Qualität nicht so gut, aber ich hoffe, ihr findet es interessant. Das war die erste Podcast Runde, wir probieren das zu verbessern. Ich freue mich auf euer Feedback!

ebooks08 Apr 2009 01:05 am

Yesterday I rediscovered the cross-platform open source app Calibre, an incredible ebook management tool. I like to say it’s like iTunes, but for ebooks. First of all, for those of you who don’t know, Sony Reader’s official software only works for Windows and from what I’ve read it’s quite unintuitive to use. Calibre has all the features you would want to manage your ebooks.

calibre

Remember that it will manage your library, so don’t tell it to use the directory that you currently use for ebooks as its default as this will drive you mad. Make an empty directory and then drag your ebooks into it. This will also effectively create a backup on your hard drive in case you accidentally delete books using Calibre. Once you have your books in your library, insert your Sony Reader (or other favorite eReader device) and Calibre will automatically recognize it and now you can simply highlight which books you want and click Send to Device. It will also show you the reader’s internal memory as well as any memory cards you have in your device and how much free space they have. By clicking on the arrow next to Send to Device, you can Set it to send to the device or card by default.

One issue that plagues everyone with eReaders is the plethora of ebook formats out there. Fortunately, Calibre deals with this nicely. You set your default output option, and I have chosen the standard ePub format and when you highlight a non-ePub book, you can just click Convert E-books and it will convert them to ePub format for you! Note that this does not work with DRM files.

However, the killer feature I found yesterday is Fetch News. Calibre comes with 100+ news sources in 10+ languages. As well as “ordinary news sources”, you can also use this to fetch your Instapaper or Google Reader by entering your username and password of that service. If Calibre doesn’t have the news source you want, you can add it yourself by creating a simple recipe. If you need something advanced, there is even a place where you can write a Python script to make it as customized as necessary! They encourage you to send them your recipes, so they can add them to future versions of Calibre, which is updated frequently indeed!

So, you can schedule Calibre to autofetch news feeds for you at a certain time of the day or every certain number of days. Then, when you connect your eReader device, it will automatically copy the latest news to your device in your preferred format. I have yet to see if it will also delete the old news files.

For those who are true open source purists, you might want to wait for the Txtr Reader which should also have integrated WiFi, 3G and bookstore… and it runs on Linux. In any case, whatever your device, Calibre should greatly improve your ebook management experience.