Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 01-04-2011, 07: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,219
Karma: 2124593
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, 697 views)
File Type: zip sudoku-kindlet.zip (35.8 KB, 1455 views)

Last edited by hawhill; 01-06-2011 at 02:38 PM.
hawhill is offline   Reply With Quote
Old 01-06-2011, 03:03 AM   #2
azit
Member
azit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with others
 
Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
When I compile this and install it, it fails with a crash.log entry saying that there's a failure due to Network-Access-Grants in the manifest. I took that out (does it use the network?) and it still failed. Any idea?
azit is offline   Reply With Quote
 
Advertisement
Old 01-06-2011, 09:05 AM   #3
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,219
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Quote:
Originally Posted by azit View Post
When I compile this and install it, it fails with a crash.log entry saying that there's a failure due to Network-Access-Grants in the manifest. I took that out (does it use the network?) and it still failed. Any idea?
Darn, that's my fault. I'll upload updated sources ASAP. For now, open the manifest.mf file and edit the network policy to "Sponsored", then recompile. I edited that after my last test (I intended to do another test on this) and totally forget about it. I'll give updated files in a few hours when I'm back home from work. I'll also try and make a screenshot then to show what you can expect.
hawhill is offline   Reply With Quote
Old 01-06-2011, 10:23 AM   #4
theHippo
Junior Member
theHippo will become famous soon enoughtheHippo will become famous soon enoughtheHippo will become famous soon enoughtheHippo will become famous soon enoughtheHippo will become famous soon enoughtheHippo will become famous soon enough
 
Posts: 6
Karma: 590
Join Date: Dec 2010
Device: Kindle 3G
I think I spotted a little bug in the SudokoBoard code.
In the IsSolved method you call isColSolved twice, one of these calls should be to isRowSolved.
theHippo is offline   Reply With Quote
Old 01-06-2011, 11:19 AM   #5
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,219
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
thank you, quite right, that's what you get for doing C&P too much :-)

The manifest fix as well as a fix for this bug should now be in the freshly-updated files.

Sooner or later I should upload it to github or Google Code, I think. That will probably happen the coming weekend. I'd like to include some puzzles from the start and maybe link to a suitable pseudo-firmware-update file for including (or even better: appending to) the keystore. Also, a menu item for jumping to a specific puzzle within the current database would be handy, too. And in the longer run, it would be nice if the Kindlet remembers all solutions already done so you have proper state for all puzzles within a certain database. That would be database- and puzzle specific state storage. In the much longer run, some puzzle generators could be included. Maybe some open source code could be re-used for that.

PS: I would be very fond of a public "experimental" developer.keystore that includes all currently known developer keystores and brings the possibility (by including the private key and publishing its password, such as has been done by the kapp-demo-kindlet author) to sign further software. That way we could have _one_ main entry point for users whishing to run custom, non-KDK (i.e. inofficially) built Kindlets.
hawhill is offline   Reply With Quote
Old 01-06-2011, 01:26 PM   #6
azit
Member
azit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with others
 
Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
Quote:
Originally Posted by hawhill View Post
Darn, that's my fault. I'll upload updated sources ASAP. For now, open the manifest.mf file and edit the network policy to "Sponsored", then recompile. I edited that after my last test (I intended to do another test on this) and totally forget about it. I'll give updated files in a few hours when I'm back home from work. I'll also try and make a screenshot then to show what you can expect.
I already had tried sponsored (with a lower case s) and got the same result. It appeared to complain about network-access-grants whether it containined no line at all, a bogus one "whatever" or sponsored.
azit is offline   Reply With Quote
Old 01-09-2011, 08:48 AM   #7
azit
Member
azit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with othersazit plays well with others
 
Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
Working fine now thanks. It appears that when I recomplied with different manifest contents and scp'd them over to the kindle, it was somehow caching the old manifest or something until I cleared it all out and refreshed it.

Cheers.
azit is offline   Reply With Quote
Old 01-09-2011, 03:42 PM   #8
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,219
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Yes, I noticed during development that you need to do a full framework restart to drop the cached manifest. That was when I was thinking about a proper title for the Kindlet :-) So when changing the manifest, you'll need a "/etc/init.d/framework restart" on the device. A full reboot will do, too.
hawhill is offline   Reply With Quote
Old 02-16-2011, 09:14 AM   #9
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
Quote:
Originally Posted by hawhill View Post
Hi,
...
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
...
Can I ask which desktop and keytool application you use for merging keystores? I tried a Ubuntu keytool command, it has a quite different syntax, and it got me confused. Thanks.
PoP is offline   Reply With Quote
Old 02-16-2011, 12:08 PM   #10
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,219
Karma: 2124593
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
I use the one that comes with a regular JDK. In my case it's OpenJDK, here running on ArchLinux. But I certainly remember grabbing the description from somewhere on the web and it was not looking like it was OpenJDK specific but rather general JDK stuff...
hawhill is offline   Reply With Quote
Old 02-16-2011, 04:16 PM   #11
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
Thanks hawhil. After installing OpenJDK for Ubuntu (Sun's openjdk-6-jre to be specific) I could successfully merge the keystore per your exact instructions.
PoP is offline   Reply With Quote
Old 02-16-2011, 04:57 PM   #12
dubaaron
Member
dubaaron began at the beginning.
 
dubaaron's Avatar
 
Posts: 13
Karma: 10
Join Date: Feb 2011
Location: Albuquerque, NM
Device: Kindle 3G
keytool error

Quote:
Originally Posted by PoP View Post
Thanks hawhil. After installing OpenJDK for Ubuntu (Sun's openjdk-6-jre to be specific) I could successfully merge the keystore per your exact instructions.
Hmm, I'm on xUbuntu 10.04, and checked, and I have openjdk-6-jre installed -- I tried running the keytool command as specified, but it prompted me to "Enter destination keystore password:"

I tried blank, and tried a few dummy passwords, but nothing worked. I got

"keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect"

So it seems like it wants a password, or the keystores each have a password?
dubaaron is offline   Reply With Quote
Old 02-16-2011, 04:59 PM   #13
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 519
Karma: 7391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
I used "password" without quotes as password.
PoP is offline   Reply With Quote
Old 02-16-2011, 05:24 PM   #14
dubaaron
Member
dubaaron began at the beginning.
 
dubaaron's Avatar
 
Posts: 13
Karma: 10
Join Date: Feb 2011
Location: Albuquerque, NM
Device: Kindle 3G
ah, that worked. thank you!
dubaaron is offline   Reply With Quote
Old 04-25-2011, 12:03 AM   #15
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,643
Karma: 1928003
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Sources for puzzles
If you want to skip the puzzle creation there are several good puzzle collections available online (most of them concentrate on hard puzzles). Some examples:

http://people.csse.uwa.edu.au/gordon/sudokumin.php
Gordon Royle's puzzles with only 17 clues (see the link section). Most puzzles are not very hard.

http://www.setbb.com/sudoku/viewtopi...&mforum=sudoku
Wapati's hard puzzles (no chains needed).

http://www.sudoku.com/boards/viewtopic.php?t=6291
The Patterns Game Results: Contain puzzles with various degrees of difficuly that all have the same initial shape. The last figure on each puzzle line is the rating according to Sudoku Explainer.

http://www.setbb.com/sudoku/viewtopi...&mforum=sudoku
Tarek's "Pearly6000" (very hard).

http://www.sudokuvault.com/top50000.zip
Ruud's top50000 (most are really hard).

http://www.sudocue.net/top10000.sdm
A subset of the top50000 (contains only the hardest puzzles from the larger list).

http://magictour.free.fr/top1465
The top1465, another great list with really hard puzzles.

source:http://hodoku.sourceforge.net/en/docs_cre.php

Last edited by thomass; 04-25-2011 at 12:10 AM.
thomass is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DX(G) KindleTERM - a SSH client kindlet vdp Kindle Developer's Corner 94 09-06-2014 01:49 PM
Snake game kindlet anmipo Kindle Developer's Corner 6 04-26-2011 02:09 AM
Working kindlet development without the KDK adq Kindle Developer's Corner 16 02-03-2011 09:44 PM
GPL2 vs GPL3 licensing issues AZed News 6 02-13-2009 05:40 PM
Multiplayer Sudoku: Sudoku Combat! PostGrant Lounge 1 06-20-2006 07:14 AM


All times are GMT -4. The time now is 11:58 PM.


MobileRead.com is a privately owned, operated and funded community.