Late Night Creativity – Comic #5

October 3rd, 2011

Late night creativity - Supernifty Comic #5


Click to see the comic full size

Speed Scrabble Notifier for Firefox

September 28th, 2011

Firefox
If you’re a Speed Scrabble player and running Firefox, then you might be interested in trying the new Speed Scrabble Extension.

The add-on helps you keep track of who is currently online so you can easily drop in for a game. Try it out!.

Speed Scrabble is a fast, fun and free online multiplayer word game. If you’ve not played it before then check it out!

If you aren’t a Firefoxer, there are similar extensions for Safari and Chrome.

If you’re a software developer interested in seeing how the extension works, the source code is freely available and can be used for any purpose.

If you have any thoughts on the new extension, feel free to get in touch!

Book Review – Supercharged JavaScript Graphics by Raffaele Cecco (O’Reilly Media)

September 18th, 2011


Supercharged JavaScript Graphics provides an introduction to a number of modern and practical JavaScript topics.

This book is well-written and easy to read, with relevant, practical examples. It covers a wide range of topics, centred around dynamic graphics and game development, including:

  • Profiling and optimization
  • DHTML Sprites
  • The Canvas element
  • Vector graphics
  • Visualizations with the Google Charts API
  • Mobile app development with JavaScript

Each topic is covered in enough detail to get you started, without getting particularly involved in too many specifics. Presumably if any topic piques your interest you can investigate further.

I found this book to be an easy read and a good introduction to a number of interesting JavaScript topics. The book is particularly relevant for game development with an excellent example of how to develop a complete game with JavaScript and jQuery.

The examples in this book are excellent – well written, well explained, and typically complete and usable. It’s obvious that Raffaele knows his craft.

The book also provides an excellent overview of the current state of JavaScript and gives you a good idea of what can currently be accomplished with a pure HTML/CSS/JavaScript solution.

The only addition I would like to see is a section with recommendations for more in-depth information. Overall though this is a good practical introduction to JavaScript graphics.

Note: This book was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program

Python localization made easy

September 16th, 2011

Python
Here’s a set of simple steps to localize a Python application for different translations. This tutorial provides a clear set of steps with sample code.

Step 1: Initialize your application

Here is the code to initialize your application with localization enabled:


If you can’t see the source code try here.

This snippet looks for a resource file based on the users locale. For instance, “res/messages_en.mo” for English. If it fails to open the appropriate translation file, it falls back to NullTranslations, which simply performs no translation.

Step 2: Prepare your application for translation

trans.install() generates a global function available to all modules in your application: _().

Find all the strings in your application that you wish to translate, and wrap them with the _() function.

i.e. “Hello” becomes _(“Hello”).

This applies to parameterized strings as well. e.g. “Hello %s” % name becomes _(“Hello %s”) % name.

Step 3: Generate the pot

That’s messages.pot.

Run the command xgettext *.py or pygettext *.py. Under Windows, you might have to look for this tool. Under the Python installation directory, try Tools/i18n.

This command looks for all strings inside the _() function, and generates the file messages.pot.

Step 4: Translate

Send your generated pot file to your translator. They will replace the empty strings with the appropriate translations and return the file to you.

Step 5: Generate the mo

Save the returned file to reflect the new language that your application has been translated to. e.g. messages_De.po

Run the command msgfmt -o res/messages_De.mo messages_De.po to generate the required .mo file.

As with pygettext, if your system doesn’t find this command, look in Tools/i18n under the Python installation directory.

After running this command, the translation file required by the application will be in the res directory. When you’re distributing the application, make sure the res directory goes too.

Step 6: Test

On Windows XP, you can change your locale with the following steps:

  • Start->Control Panel->Regional and Language Options;
  • Under “Regional Options”, choose the locale for the translation file you have created and click “Apply”;
  • Start the Python application;
  • (Hopefully) enjoy your translated application!

In summary…

It’s straightforward to setup localization with Python once you know how.

Helping the world through microlending

August 29th, 2011

Supernifty likes helping others out, especially those who really need it. Microlending is one way to do this.

Microlending involves lending a small amount – sometimes just a few dollars – to someone just to help get their business off the ground.

In developing countries, often this is all that is needed to get a viable business up and running. The recipient starts earning money, can pay back the loan, and can help bring their whole family out of poverty. Children can afford to go to school, get proper jobs, and the cycle of poverty is broken.

Kiva is a well-known microlender. One of Kiva’s founders gave a good explanation of how this works.

Interested? Well then, try it out.

You can lend as little as $25, and since the loan is (typically) repaid, you get to help someone out and improve our world a little – for next to nothing. Brilliant!

Visit Kiva to learn more.

JavaScript Task Queue – Hack it #9

July 17th, 2011

Suppose you have a lot of tasks with completion callbacks to complete in the browser, but you want to do them sequentially. For instance, you might have a list of AJAX requests to make to your server.

This JavaScript demonstrates a simple solution:

If you can’t see the source code, look here.

Book Review – Programming HTML5 Applications by Zachary Kessin (O’Reilly Media)

July 16th, 2011


“Programming HTML5 Applications” is a new book from O’Reilly media that focusses on some of the new technologies available in HTML5. It also places significant emphasis on the language of web applications – JavaScript.

The book starts with a brief history of the Internet and the web, before covering some of the trickier features of JavaScript in Chapter 2 – primarily closures, the event-oriented nature of JavaScript, and the DOM.

Next is a good overview of two JavaScript frameworks: the ultra-popular JQuery and the more application oriented ExtJS, before moving on to some testing frameworks – QUnit for JavaScript unit testing, and Selenium for browser interface testing.

The author then moves on to HTML5, briefly covering:

  • local storage,
  • application caching,
  • web workers and
  • web sockets.

Finally, some interesting server side technologies are described: the “cloud” paradigm, node.js and Erlang. The book concludes with some useful JavaScript tools.

The copy provided for this review was an “early access” version which hasn’t been through the full editing process. The book clearly still requires considerable polish – I was surprised to find that the HTML5 chapters cover less than half the book; they feel incomplete. The “web workers” chapter contains a detailed example, but the other HTML5 chapters do not.

When learning a new technology, I like expert, clear advice about best-practise, and the production-readiness of each technology. This was lacking in the chapters on HTML5. For instance, there is little mention of which browser versions support which technology – an important consideration when deciding whether or not to use a particular feature.

Currently much better HTML5 resources are the truly excellent Dive into HTML5 and HTML5 Rocks.

In contrast, the JavaScript chapters are well-written and informative, particularly the framework and testing chapters. I would have liked to have seen some analysis of the other major frameworks. The overview of QUnit and Selenium and their use-cases made for a useful introduction to these tools.

When the final copy comes out, hopefully the HTML5 chapters will have filled out, and the many little errors corrected. Assuming this happens, this book will serve as an introduction to the main technologies involved in building an HTML5 application.

Note: This review applies to an “early access” version of the book and was provided by O’Reilly Media as part of their blogger review program.

I review for the O'Reilly Blogger Review Program

Real-Time Auctions with HTML5, PayPal, and Google App Engine

June 28th, 2011

Google App EngineSupernifty’s latest series of technical articles demonstrates the use of Google App Engine and PayPal to build a real-time auction site.

We also show off some HTML5 and discuss some of the issues associated with designing a site suitable for mobile devices.

All pretty interesting if you’re into this kind of stuff. Check it out:

Or go straight to the source code.

Speed Scrabble – most popular words

April 14th, 2011

We did some analysis on our Speed Scrabble players to find out the 80 most popular words used in games:

Speed Scrabble popular words

QI is easily the number 1 word, with AI and IN second and third. I guess most people know that trick when you get stuck with a Q without a U.

2-letter words dominate the list, taking the top 11 spots, and 66% of the top 80.

3-letter words round out the list, with the first 4-letter word, RAIN, coming in at 112th.

It’s a little surprising, but understandable given that Speed Scrabble focusses on speed.

Some users have commented on the unlikely sounding 2-letter words, doubting whether they are really words, so with the help of Wordnik, we have compiled a list of definitions of some of the more obscure words:

  • qi: The fundamental life-force or energy.
  • ai: See sloth.
  • en: The letter n.
  • aa: Lava having a rough surface.
  • ae: Chiefly Scots One.
  • un: One.
  • er: Used to express hesitation or uncertainty.
  • id: In Freudian theory, the division of the psyche that is totally unconscious.
  • oi: Said to get someone’s attention.
  • qat: khat
  • ye: Archaic “The”.
  • ad: An advertisement.
  • lo: Used to attract attention or to show surprise.
  • re: Music – The second tone of the diatonic scale in solfeggio.
  • et: and
  • jo: Scots Sweetheart; dear.
  • oe: A small island.
  • el: The letter l.
  • za: Slang – Pizza.
  • ar: The letter r.
  • la: Music – The sixth tone of the diatonic scale in solfeggio.
  • ti: Music – The seventh tone in the diatonic scale in solfeggio.
  • li: A traditional Chinese measure of distance, today standardized at 500 meters (547 yards).
  • pi: The 16th letter of the Greek alphabet.
  • bi: A bisexual person.
  • yo: Slang – Used as a greeting or to attract someone’s attention.
  • joe: Informal – Brewed coffee.
  • ain: Scots Own.
  • yen: A strong desire or inclination; a yearning or craving.
  • fa: Music – The fourth tone of the diatonic scale in solfeggio.
  • ne: Not.

So now you know: yes, they really are words.

If you’ve not played Speed Scrabble, try it out. It’s fun, fast and challenging. And occasionally educational.

Google App Engine, PayPal, Adaptive Payments – The Tutorial

April 13th, 2011

Google App EngineThe final part of my tutorial on using Google App Engine with PayPal’s adaptive payments to create an online market is available.

It extends the example online market application developed in part two by covering some of the practical considerations and handy features of hosting on GAE.

In summary: