October 20, 2009

Memcached: List all keys

Posted in Software at 17:50 by Graham King

In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1Meg of keys, which is usually enough during development. Here’s how:

Telnet to your server:

telnet 127.0.0.1 11211

Read the rest of this entry »

August 10, 2009

Choosing a message queue for Python on Ubuntu on a VPS

Posted in Software at 06:05 by Graham King

More and more, my web apps need to run things in the background: Sending email, re-calculating values, fetching website thumbnails, etc. In short, I need a message queue in my toolbox.

Luckily for me, message queues are this years Hot New Thing, so there’s some good options. I looked at RabbitMQ, Gearman, Beanstalkd and StompServer.

Read the rest of this entry »

June 16, 2009

Django dynamic forms and formsets

Posted in Software at 02:08 by Graham King

A couple of great posts which explain Django dynamic forms and advanced formset usage very clearly:

June 11, 2009

How and Why to extend Firefox in Javascript

Posted in Software at 04:29 by Graham King

I will be giving this talk on Friday 12th June, at Open Web Vancouver 2009.

June 10, 2009

Unix shared directory permissions: GUID and umask

Posted in Software at 20:11 by Graham King

I setup my Mercurial repository in the same way we used to do CVS, then SVN: A directory owned by a group, with the GUID bit, and all users who need to commit are in that group.

The steps are, create the group and add relevant users to it: :noclick


    sudo groupadd topsecretgroup
    sudo usermod -a -G topsecretgroup graham

Read the rest of this entry »

May 17, 2009

Speaking at Open Web Vancouver 2009 in June

Posted in Future of Web Apps, Software at 22:30 by Graham King

I will be speaking at Open Web Vancouver on Thursday, June 11, 2009 and Friday, June 12, 2009.
That’s in Vancouver, B.C., Canada. There’s a very interesting speaker lineup, and the whole conference is reasonably priced, so come along, learn, interact, and enjoy Vancouver in the summertime.

My talk will be entitled How and Why to Extend Firefox in Javascript (and Thunderbird, Komodo, and Songbird). I will post the slides here in June.

See you there!

May 10, 2009

Micro-Zooids: A story

Posted in Ideas, Misc, Software, Strategy at 23:23 by Graham King

When I was 16, I wrote a computer game, called Micro Zooides. It was called that partly because on Windows .EXE files all start with the two characters MZ, and partly because it was about small creatures. Micro-Zooides was going to be about humanity’s progress, it was going to be Civilization, which didn’t exist yet.

The game had a splash screen of a Far Side comic, then a short video of me tromping through the woods like a Neanderthal, which my Dad filmed and which I digitized with a very early video capture card.

In Borland’s Turbo C++ 3.0 I wrote a basic graphics engine to display the tiles of the world, and an event loop so I could move the main character around the world. I drew sprites for a proto-human (the micro zooid), dirt, rocks and sticks. He could walk around the world, and pick up and put down rocks or sticks.

Then I took a break to plan. I have a proto-human, rocks, and sticks. How do I get to civilization?

May 8, 2009

Turn on debug output in SVN

Posted in Software at 00:02 by Graham King

After a desktop and server upgrade, my subversion client stopped working. I am using Digest authentication, and it kept asking me for the username and password. Wireshark showed me that the SVN client wasn’t sending the Authentication header. To find out more, I turned on Subversion’s debug output. Here’s how you do it:

Edit /etc/subversion/servers
Add this line at the end: neon-debug-mask = 511

That showed me this error: auth: '/' is inside auth domain: 0.

This means that the path I was requesting (the root of the repo) was not considered inside the AuthDigestDomain I had set in Apache.

It turns out that at some point in the upgrade of Apache, Subversion, or a library, the AuthDigestDomain requires a scheme. I had
AuthDigestDomain svn.myserver.com
whereas it should of been
AuthDigestDomain http://svn.gkgk.org.

So now you know.

April 7, 2009

Foxden – your life on one page

Posted in Software at 01:21 by Graham King

Update: There is now a user group for Foxden: http://groups.google.com/group/foxden-users

Foxden is a Firefox extension that allows you to tile all the web applications you use on one page. Imagine being able to see your email, your calendar, your bug tracker, feeds, twitter, whatever you use, on one page. Take a look at my setup:


Foxden screenshot

As you can see, I have (counter clockwise from top left) my email, calendar, feed reader, todo list and a local text file for taking notes.

It’s free, should work wherever Firefox 3 works, and it could be yours right now.

Download the Foxden Firefox extension

March 18, 2009

Eddit: Reddit without the Rrrr!

Posted in Software at 17:06 by Graham King

Eddit is a bookmarklet for Reddit, which gives you more signal and less of the noise that makes you go Rrrr! Here’s how it improves reddit:

Read the rest of this entry »

March 17, 2009

Flex internals: Setting a button label

Posted in Software at 00:50 by Graham King

Most ActionScript / Flash applications have a main event loop, triggered by Event.ENTER_FRAME. This is where the animation moves along to the next frame, or the sprites of the game are re-drawn in their new places.

In the Flex framework, you are expected to call invalidateDisplayList on the framework to say you need an update, and actually do the update when the framework calls your updateDisplayList method. This is the invalidation / validation pattern.

I went searching in the Flex code to understand how this invalidation / validation step ties in with Flash’s event model. I ignored properties and sizing, and edited the code down to the bare essentials.

Here is what happens when you change the label of a button:

Read the rest of this entry »

March 15, 2009

Choosing the best Flex book – Flex book reviews

Posted in Software at 23:05 by Graham King

UPDATE March 19th: Added First Steps in Flex, and Learning Flex 3.

You’re an experienced server-side programmer, with a background in C/C++/Java/C# or Python, but no Flash experience. You want to learn Flex. Which book should you buy to learn Flex 3? I have speed-read the following, so that you don’t have to:

Read the rest of this entry »

Math Dodger: A Flash game

Posted in Misc, Software at 02:26 by Graham King

Los Angeles is under attack, by trigonometric functions! OMG! Trigo-what? If I wanted to do maths, I’d go to San Francisco!! You, like, totally gotta save L.A man. Enter your name, then move your tank.

Use the left and right arrow keys to rotate, the forward and back arrow keys to move.
The barrel of the tank is the little black line. That’s the front.

No, your tank can’t fire. Avoid the mathematical blobs. YEAH!
The longer you live, the more points you get. A score above 100 is, like, totally AWESOME! Good luck Bro.
Let me know in the comments how much you score.


Read the rest of this entry »

February 23, 2009

Javascript objects: And what is this?

Posted in Software at 03:06 by Graham King

When writing object-oriented Javascript, there are two occasions when you need to be careful that this is set correctly: In inner functions and in callbacks.

this in inner functions

  1. If you are not in an object, this refers to the global window object.
  2. If you are in an object’s method, this refers to that object,
  3. except in an inner function, when this refers to the global window object again.

Number 3 is what you need to watch for. It is considered a bug in Javascript. Here is an illustration of the three cases:

Read the rest of this entry »

January 23, 2009

Easy object-oriented Javascript the Python way

Posted in Software at 00:47 by Graham King

Javascript is not an opinionated language. At it’s heart it is a hash map. You can layer pretty much any idiom you want on top of it. I’d like to make it look like Python, and it’s pretty easy to do. They both are dynamically typed, have functions as first class objects, and can treat most types as hash maps.

Let's observe this moose

Let’s assume code for a whimsical Moose Observation Project, and translate it from Python to Javascript.

Read the rest of this entry »

November 11, 2008

Plebis.Net. Speak your mind.

Posted in Society, Software at 02:34 by Graham King

I have just launched Plebis.net. It’s a wall on the Internet you can write on, for all to see.

You can write anything you want. There’s no censor and nothing is recorded, so feel free to scream shout and wail. Tell the world how you feel. Get it off your chest. Go on, it’s good for you. Head over to Plebis.net, and say something!

October 29, 2008

Internet Explorer not sending NTLM authentication

Posted in Software at 22:01 by Graham King

At work we setup a Twiki, and Internet Explorer refused to send the NTLM authentication, instead it showed a login popup. The problem was that our Windows domain, say mycompany.com was different from the Twiki URL, which was othercompany.com.

The solution is to tell IE that othercompany.com is a trusted site. ‘Tools’ -> ‘Internet Options’ -> ‘Security’ -> ‘Local Intranet’ -> ‘Sites’ -> ‘Advanced’ and add it in there, this must start with http:// or https://

The problem and solution are explained here:

Apache::AuthCookieNTLM – NTLM (Windows domain) authentication with cookies

Note that this will be a problem not just with that Perl module, but with any cross-domain NTLM authentication. IE correctly refuses to give out your username as it doesn’t know it can trust the site.

August 25, 2008

Keithnote

Posted in Software at 04:31 by Graham King

Keithnote is a presentation generator. You provide information such as the title of your presentation, and it downloads relevant images from Flickr. These are stored locally so you can run your presentation whilst offline.

Keithnote is hosted at Google Code, here: Keithnote

Read the rest of this entry »

August 16, 2008

MySQL quick reference

Posted in Software at 01:30 by Graham King

A concise reference / cheat-sheet / crib-sheet to MySQL’s commands.

Read the rest of this entry »

July 17, 2008

Using Ekiga softphone on Ubuntu Linux on a Thinkpad

Posted in Misc, Software at 00:19 by Graham King

For many months now I have been making and receiving telephone calls from my computer. There are two advantages:

  • It is very cheap. Calls within the United States are about $1/hour!
  • It makes your phone number virtual, and configurable, which means for example that my phone number will forward to my cell phone if my computer is offline. It also means you don’t have to be in the same country as your phone number.

I am running Ubuntu Linux on a Thinkpad, but most of this should apply to Ekiga on all platforms, and the principles apply to all Softphones.

Read the rest of this entry »

« Previous entries Next Page » Next Page »