Feed on
Posts
Comments

Archive for the 'Code' Category

A coworker recently needed to iterate over a custom object in python. It’s pretty easy to do, you just need to implement the __iter__ method on your object.
Here’s some example code that shows you how to extend your object, returning everything in your objects local dictionary:

class IterableObject(object):
def __iter__(self):
[...]

Read Full Post »

FlixBot

I’ve built a proof of concept in some hacked together python code to automatically add movies to my netflix queue when I send twitter messages to @flixbot.
For example this tweet:

Gets Blade into my queue. Awesome.
I started building this out into a full fledged service so other people can use it as well. Of course I’m [...]

Read Full Post »

Yet more proof of his awesomeness.
http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html
Basically he’s shown a proof of converting Ruby bytecode into Python bytecode, enabling ruby to run in python only places, like Google app-engine. Quite cool.
Additionally he’s been creating hackety-hack which is an environment for anyone (children) to learn programming. _why’s built it out of ruby and gecko and his own [...]

Read Full Post »

The goal here is to use the excellent code editing and application debugging/profiling available in Flexbuilder and still have the rapid prototyping and layout ability that the Flash IDE gives to you.
To get started create a new “Actionscript Project” in Flexbuilder.
Now we will add some code to testDebug.as that traces out when the application is [...]

Read Full Post »

I’ve been consolidating my music collection and found that there were lots of duplicate files.
Most of the dupes were named something like “Happy Birthday 1.mp3″ and “Happy Birthday.mp3″ would exist in the same directory. I’m not sure which program added these dupes, but removing 2500 or so of em by hand would not be [...]

Read Full Post »

XRay Logging with AS3

Using Xray you can utilize logging in your AS3 development in a nice clean manner. One of the great benefits here is that your logging/debugging process can be the same when developing locally and when you are running on your development and production servers.
To get started download the latest xray code from their SVN repository.
http://code.google.com/p/osflash-xray/source
Then [...]

Read Full Post »

I just started twittering and have found that getting alerts on my phone is great, just not when I’m also at the computer.
So being a good geek I thought I’d automate the process of turning mobile alerts on or off based on my laptop status.
So far I’ve scraped the HTTP headers and post variables so [...]

Read Full Post »

I’ve been moving a bunch of my brothers music out of iTunes for him so he can use it with portable players besides iPod. Unfortunately he encoded a lot of his cd’s in .m4a format. I found a decent utility for converting to mp3 (and other formats) http://www.bonkenc.org/
Unfortunately when you point Bonk at a directory [...]

Read Full Post »

Here’s a nice little function I’ve written to report the number of duplicates in a python list.

from sets import Set
#
def countDuplicatesInList(dupedList):
uniqueSet = Set(item for item in dupedList)
return [(item, dupedList.count(item)) for item in uniqueSet]
#
lst = [’I1′,’I2′,’I1′,’I3′,’I4′,’I4′,’I7′,’I7′,’I7′,’I7′,’I7′]
print countDuplicatesInList(lst)

The Set datatype is an unordered set that doesn’t allow duplicates, so the first [...]

Read Full Post »

“Transparent messages are the brainchild of Jef Raskin. It’s simply a large and translucent message that’s displayed over the contents of your screen” from monolog_boxes_and_transparent_messages.
Transparent Messages are a nice way to alert your users that something has happened. The alert is not ‘modal’ in the same sense that a standard message box is. The user [...]

Read Full Post »

Next »