Archive for October, 2008

Isometric Graphics w/JS & HTML

Friday, October 31st, 2008

As an experiment, I decided to see if I could approximate a Flash game in JavaScript and HTML (without using the non-standard CANVAS tag). It turns out to be pretty easy to replicate an isometric display using some simple 2D graphics techniques.

(more…)

Extracting bitmaps from Flash

Friday, October 24th, 2008

Flash content is pretty common on the Web, but it is considerably less transparent than traditional HTML-based content. Whereas HTML-based content is built from human-readable script files and URL resource definitions, Flash content is locked inside a binary file format. It is sometimes necessary to convert Flash content into a more managable form. As an example of such a conversion, I discuss the process of extracting all JPEG images from a Flash (SWF) file, and present some Python code which performs the extraction.

(more…)

Quickie – Pythonic “if” statements

Saturday, October 18th, 2008

In reference to my previous post, a reader writes:

You don’t need parens around your if conditions in Python – and it’s more Pythonic not to have them…


if size <= 0:
    return ""

Both statements are true. As an old C hack (and current heavy JS user) "if" statements Just Don't Look Right to me w/o the enclosing parens. Therefore, I thought the reader's point bore repeating.

File-like Strings in Python

Friday, October 17th, 2008

Sometimes one has data stored in a string, and wishes to pass that data to a function that expects a file-like object. Writing the data to a file, then opening that file and passing it to the function is cumbersome and seems inefficient. A better solution is to turn the string into a file-like object, and pass it directly to the function.

(more…)

EC2 Instance Performance

Friday, October 10th, 2008

I’ve been working with a large-ish MySQL table on an EC2 instance. This table has approximately 147MM rows, and I’ve been disappointed with the performance I’ve seen. I took a look at how much performance I could gain by moving to a more powerful EC2 instance, and the answer is “some, but not all upgrades are equal”.

(more…)

Command Line Quickies

Friday, October 3rd, 2008

One of the best things about working in the UNIX environment is the powerful command-line interface, which includes the available shells, scripting languages, standard utilities, and facilities for I/O manipulation. The strength of this interface is its modularity; a large-ish collection of powerful, somewhat single-minded tools is more flexible than a monolithic, “kitchen-sink” approach to interface design. However, this very modularity can make it hard to learn how to use the interface, since most documentation is devoted to a single tool or utility, and there is relatively little guidance on how the interface as a whole may be used to do work. Therefore, I present some simple UNIX shell commands, with brief explanantions, that might prove suggestive.

(more…)