View Single Post
Old 01-04-2011, 06:11 PM   #1
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Sudoku Kindlet (GPL3)

Hi,

I'd like to introduce myself to this nice forum (where I've been lurking since the start of last December when I got my Kindle 3 Wifi) with a Kindlet :-)

As I like to fiddle with my devices I was eager to learn how to program it. For a start (after giving up building a native toolchain, it was too boring) I resorted to learn about Kindlets. Well, I do not have KDK access, but nevertheless, the openly accessible documentation is growing. And I like to say thanks for the kapp rudimentary application published on the forum here.

So if you like to just play Sudoku or need another app to see how things can be done, here it is: a Sudoku kindlet. And yes, I'm aware there are others available.

For now, it can read .sdm databases (one line per 81 field sudoku puzzle). Use the menu to open a puzzle database file. You can find some on the web, e.g. here: http://www.sudocue.net/download.php
The kindlet will tell you in the file dialogue the folder where to put them.

In order to run the kindlet you need to prepare your devices developer keystore to accept the keys the kindlet is signed with. The corresponding developer.keystore file is attached to this posting. It's the one from the "kapp" demo kindlet published in the "how to write Kindlets" thread here.

Probably you will want to run other kindlets too. In order to run kindlets signed with different keys, you will have to merge your keystores.
You can merge keystores by issuing the following command on your desktop (the keytool application must be in the path):

keytool -importkeystore -srckeystore developer-to-import.keystore -destkeystore developer.keystore

The keystore must be put onto the device, _outside_ the area accessible while in USB storage mode. It goes at "/var/local/java/keystore/developer.keystore". You need to put the keystore there either by creating a fitting upgrade package (I did not do that yet) or by other means (I copied via scp, by means of USB networking, but Wifi would work as well).

The kindlet itself just goes into the usual "documents" folder.

Have fun with the kindlet and its source code.

A few words on the source: it's a netbeans project but only needs "ant" to compile. Just issue "ant jar" and it will build and sign a jar file (you need to rename it to .azw2 suffix when copying). The automated signing will only work on POSIX (read: Linux) shells, though, Windows users might need to do that manually.
Sources expect a folder "KDK" on the same level as the kindlet project basedir, containing a folder "lib", which itself should contain the jars from the device, as there are "Kindlet", "log4j", "json-simple", "xerces". You find the exact file names needed in the sources in the .properties file in the "lib" folder.

Update, 2011-01-06, 15:10 UTC: fixed manifest to make it run, fixed bug in isSolved()
and another note: You move the cursor with the direction keys, enter numbers with 0-9 if you have them, otherwise either the top row (qwer...) or the block qweasdzxc. You toggle between solving and notetaking with "m".
Attached Files
File Type: bz2 de.hilses.kapps.sudoku.tar.bz2 (36.0 KB, 1382 views)
File Type: zip sudoku-kindlet.zip (35.8 KB, 2883 views)

Last edited by hawhill; 01-06-2011 at 01:38 PM.
hawhill is offline   Reply With Quote