Installing Django on EC2 & EBS

This is a quick guide to setting up an Amazon EC2 instance as a Django server. There are many other guides along these lines, but this one includes a “turn-key” script to get everything up and running, as well as an implementation of the “polling” example from the Django tutorial.

Continue reading

Posted in Web stuff | Comments Off

Scripting Windows

If you want to write scripts for Windows, you have some unattractive options. You can use the DOS batch-file scripting language, but that’s a little on the primitive side. You can learn PowerShell (Monad), a typically overwrought, idiosyncratic MSFT affair. Or, you can pursue a better option: you can use JavaScript to script Windows.

Continue reading

Posted in Planet Microsoft | Comments Off

Isometric Graphics w/JS & HTML

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.

Continue reading

Posted in Projects, Reverse Engineering | Comments Off

Extracting bitmaps from Flash

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.

Continue reading

Posted in Reverse Engineering, Web stuff | Comments Off

Quickie – Pythonic “if” statements

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.

Posted in Uncategorized | Comments Off

File-like Strings in Python

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.

Continue reading

Posted in The Hard Way | Comments Off

EC2 Instance Performance

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”.

Continue reading

Posted in Web stuff | Comments Off

Command Line Quickies

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.

Continue reading

Posted in UNIX | Comments Off

Configuring EC2

As I work with Amazon EC2, I find that I need to configure machine images for specific tasks. In general, I’ve preferred to perform this configuration by running brief install scripts on the standard Amazon-owned images, rather than using more complex, pre-configured images. For me, the core issues are those of transparency and trust.

Continue reading

Posted in Web stuff | Comments Off

Lehman, Merrill, and Electricity

Lehman Brothers and Merrill Lynch have been much in the news lately. In light of Lehman’s bankruptcy and Merrill’s sale to Bank of America, I thought it would be interesting to look at their participation in the electricity market. Merrill Lynch appears to have been a major player in that market, while Lehman, despite growing aggressively over the last two years, was not.

Continue reading

Posted in Energy | Comments Off