LWJGL: No Keyboard events in Ubuntu / Linux

Running the jbullet demo just now, I noticed mouse events were handled but none of the keyboard events were handled. Stepping through the code it seemed no events were captured by LWJGL’s Keyboard class. Spotted this “Keyboard does not respond on Linux” discussion on LWJGL’s forum which has the answer (ibus isn’t handled correctly) but doesn’t provide a copy-paste solution for “do you haz teh codez” visitors (as I was just now) who just want to overcome the immediate hurdle of the non-functioning LWJGL Keyboard.

This works for me:

XMODIFIERS="@im=none"; java -Djava.library.path=../lib/lwjgl/linux/ -jar jbullet.jar

Measuring tube homework worksheet

Similar to the clock face worksheet, here’s a simple generator for a measuring tube homework worksheet. Every time you click on the link below, you will download a new randomly-generated measuring tube worksheet with 6 questions on it. The measuring tubes are drawn with vector graphics to make sure they look good when printed.

Download a PDF measuring tubes worksheet ready to print.

Clock face worksheet

With a little extra effort the clock face generator can produce a worksheet with several different clock faces on a page. The page is produced with Freemarker / LaTeX. Producing vector graphics for inclusion in the LaTeX document instead of bitmaps is done with FreeHEP.

Just in case you missed it, this link will download a PDF document for you with different times every time!


Tell the time with online clock face test

Yet another homework-inspired addition to the API – a clock face image generator. My son brought home a worksheet from school with badly-drawn clock faces on it. On some clock faces the minute hand was pointing to the “6” (half-past) while the hour hand pointed directly at the 3, when it should have pointed either half way between 2-3 or half way between 3-4.

The clock-face image URL creates a random clock face if no arguments are present. Query arguments are ‘time’ to specify time in milliseconds since midnight. A ‘resolution’ argument controls the resolution of randomly-generated times and also to hide the seconds hand for anything greater than second. Values for ‘resolution’ are one of [second, minute, fives, quarter, half, hour]. The ‘width’ argument is a 3-digit size in pixels of the generated image.

A .json API URL returns some data useful for embedding the clock face as an interactive test:

What is the time?

Online audio spelling test

Another homework-inspired application. My daughter brings home lists of words to learn for spelling tests. I help her practice by reading out the words and giving an example just in case the word alone isn’t clear or the word has homophones. We’ve been checking words at wiktionary and even uploading audio where a pronunciation file is wanted.

We thought if we made the spelling test word list interactive, it might be quite nice to share it with friends at school, so I knocked together a little add-your-own-spelling interface to create entries for spelling tests and some crude javascript to automate the presentation of a spelling test on a web page.


Once you’ve applied for a token and username, you ‘login’ to the spelling test editor by providing your email address and the token sent to you. For each spelling word, provide an example text containing the word and two files: one of the word spoken alone and one of it spoken in your example phrase.

I use audacity to record and edit my sound files. An example work flow is:

  1. Write down all words and example phrases in a text editor.
  2. Start recording
  3. Allow a few seconds of silence
  4. Speak the word
  5. Be silent for a second or so
  6. Speak the example text
  7. Be silent for a second or so
  8. Repeat from 4 for the next word
  9. Be silent for a few seconds
  10. Stop recording
  11. Select one of the longer silences
  12. (in Audacity) use Effects…Noise Removal to set the selection as the noise profile
  13. Select the whole recording
  14. (in Audacity) use Effects…Noise Removal to remove noise.
  15. If the silences in your recording are still noisy, repeat from 11 with the other long silence
  16. Select a word with at least 0.5 seconds of silence either side
  17. (in Audacity) use File…Export Selection to create a mp3 file like ‘theword.mp3’
  18. Select the example sound with at least 0.5 seconds of silence either side
  19. (in Audacity) use File…Export Selection to create an mp3 file like ‘theword-example.mp3’
  20. Repeat from 16 for all the words you’ve recorded

Once you have your audio file, uploading them is a simple matter of copy-pasting from the text file and selecting the audio files from where you saved them. When you ‘Update a word’ you’ll get a link like Sean:sequence which you can use to check the audio files uploaded OK and the word occurs in the example text.

Embedding in a web page.

My javascripting isn’t the best, so see the page source of Emily’s blog for the way I did it. I create a JSON object containing the username/spelling pairs for the spelling object, use some javascript/jQuery to create the rows in the spelling test table and SoundManager2 to handle the playback of the audio when the links are clicked.

To create each spelling test, all I have to do is copy a small amount of HTML and change the JSON object to include the new spellings. There’s a search facility for existing spellings – feel free to add your own and use the spellings already uploaded.

Here’s a sample in this WordPress blog:

Spelling Example Spell it! Check Result