Archive for the 'Hacks' Category

Aqua Teen Day — January 31st, 2007: Never Forget.

Wednesday, January 30th, 2008

Update:

Evil Mad Scientists Laboratory has made the foundation of this build available as The Peggy for $80.

In typical EMSL fashion, that link includes tons and tons of information, including full details, board design, source, and loads of implementation notes.


So, apparently, it is being called Aqua Teen Day. Good enough.

Better yet, though, is that the fine folks of boston — the level headed public that makes the city such a great place — are celebrating the first annual “Aqua Teen Day” by decorating the city with LED art.


Mooninites & Lemur

On January 31st, 2007, the authorities in Boston completely lost their minds. It wasn’t the first time, but this particular date was heavily reported and even the most head-in-the-sand die-hard “OMGWTFBINLADENFTChildren!!!one!!!” fear mongers found it ridiculous.

I am, of course, referring to the Aqua Teen Hunger Force “Hoax Device” bomb scare.

I could go on a political rant about fear based leadership and the general stupidity of the security theater played out in our cities and airports.

But that is boring.

Lemur in Blue

I’d rather remind people of the jackassery that has happened and, once again, laugh at it. Then vote appropriately.

To that end, I purchased memorial kits from the fine folks at Evil Mad Scientist Laboratories and put them together over the last few days.

The results are just stunning. And effective. I brought the boards into work on Monday and, on the way home, stopped for a beer with boards in hand. Several folks asked about them and, upon explaining the history of the boards, they became just a touch more enlightened as to the stupidity of certain leadership and just a slight bit more inclined to learn more and vote accordingly.

MooniniteMooninite

Mission accomplished. With laughter included.

(The kits were a special edition from EMSL — you’ll have to contact them for availability. The LED “peg board” is generic; you can lay out the LEDs anyway you want to make any kind of similar display, including a “charlieplexed” mode that allows simple animations. I believe EMSL will be offering the generic form of the kit sometime soon.)

Posted in Government, Hacks, Humor, Micro-controllers, Rants | 7 Comments »

MMm…. the smell of hot solder in the evening.

Monday, January 28th, 2008
Lots of Soldering to Look Forward To!

I spent a chunk of the evenings this weekend soldering together the aforementioned kits from Evil Mad Scientist Laboratories.

As I said before, truly awesome kits.

While assembling the kits, I whipped out the camera and took a few random photos.

The kits are done, but I’m holding on the final photos until tomorrow.

So, for now, click on through for a bit of macro electronic assembly pr0n.

Read the rest of this entry »

Posted in Entertainment, Hacks, Micro-controllers | 1 Comment »

Lemurtronics!

Saturday, January 26th, 2008
Lemurtronics

In the last week, I received two very cool packages in the mail.

The first to arrive was my lemur from Mike Lee. While avoiding a sharp kick in the gonads (as threatened by Wil, anyway) was certainly a motivator, I joined Club Thievey primarily because Madagascar is a terribly cool place (that I hope to visit with my son), nature is an awesomely cool thing (of which I hope there is some left when my son grows up), we should all be doing our part to help out (both locally and occasionally throwing $$ at the abstract), and Mike is just one genuinely really nice dude (or 2.5 * dude, as it were).

And it was also because I have a coincidental soft spot in my heart for lemurs. In college, my frat — yes, I was in a frat, but it was the anti-frat… hazing not allowed, most honorable bunch of folk around, zero tolerance rape policy (sad to even have to say that, but I wouldn’t have been there unless it were true), etc… — participated in buggy races.

Anyway, we had a series of buggies named after various critters such as Jerboa and Lemur.

At the time, a bit of research revealed that these are some damned cool critters often living in some challenging areas of the world. Thus, lemurs have been of interest to me for over a decade.

Read the rest of this entry »

Posted in Hacks, Lemur, Life | 4 Comments »

Silly Hack of the Day: Mount the Obj-C Runtime as a Filesystem

Thursday, January 10th, 2008

Update: CocoaHacks was quite a bit of fun. Not only did I demonstrate the rather silly little hack, but I ran it fully garbage collected. With one simple change (that should be in the next release), the MacFUSE framework works just fine with Garbage Collection enabled!

The best compliment came from Amit Singh; something along the lines of “That is absolutely the strangest filesystem I have seen.”

In any case, my little hack repository has been updated to be GC only. retain/release/autorelease/dealloc are dead to me (in this project, anyway).

If you want to build MacFUSE with GC enabled, simply set Objective-C Garbage Collection to “Supported” in Xcode in the MacFUSE framework project’s build settings.

Browsing Classes_tn.png

At left, is a screenshot of the Finder browsing the Objective-C classes active in the runtime of a little Cocoa app that I wrote this evening.

The little app is called RuntimeFS and it contains a simple bit of code that traipses through the Objective-C runtime and collects information about the Objective-C classes encountered. This information is then barfed up by the elegantly simple delegate like API required by MacFuse to create a filesystem.

Let me restate that: MacFuse kicks ass. The Objective-C API is trivially easy to use. Trivially easy. I implemented this little hack in less than two hours, not having looked at the MacFuse API before. Nor did I read the docs; just looked at this example and one header file. I have implemented filesystems in a couple of different languages. Filesystems are hard. Or was. Not anymore.

I dropped the source code in the “Silly” directory of my public SVN repository.

Because, really, this is quite a silly hack. And hack it is — it doesn’t crash, but that is about all the quality assurance analysis I have done.

Free as in “MIT License” free. Have fun. I’m accepting patches, of course.

Future Stuff

If I were to go anywhere with this, the first thing I would do would be to move the subclasses into a subdirectory and then add other subdirectories to contain additional data.

Specifically, I would add directories like -1- Instance Variables, -2- Class Methods, -3- Instance Methods, -4- Subclasses, -5- Documentation (or something), etc…

The naming convention serves two purposes. First, it sorts nice like. Secondly, the names are invalid as class names and, thus, it makes handling the metadata vs. class directories trivially easy while also eliminating potential namespace conflicts.

Posted in Hacks, Humor, Mac OS X, Software, Technology | 13 Comments »

Make Your Own Arcade Controls

Friday, November 9th, 2007
Roger Playing MAME with Ghetto Control Deck

Many years ago — long before Roger was born and back when I lived in Chicago — Adam Swift and I grabbed a couple of pieces of wood, hit up an arcade parts store, and whipped up this total hack of an arcade control deck.

I call it the Ghetto Control Deck because the wood was found in an alley near my house (construction waste). I tore apart a broken (bad button) PlayStation One controller and used it as the brains of the controller.

Thus, the control deck can be hooked to a playstation for some excellent retro gaming action. Of course, no retro gaming experience is complete without Robotron and Robotron cannot be played without two geneuine arcade sticks. However, trying to play — say — Mappy, Flicky, Mr. Do, Dig Dug, Joust, Bosconian, or any of the other classics without a proper set of buttons on the right is nigh impossible.

So the deck is reconfigurable using a set of phone jacks to plug-n-play the way you want. Simple to reconfigure and all the parts were in my junk box!

Now — more than ten years after it was built — MAME is all the rage and Dave Dribin has produced an awesome port of MAME to Mac OS X. As well, USB technology has evolved such that “HID Compliant” devices are fairly common and cheap. That plus some awesome work in MAME OS X means that plugging in any HID compliant game controller “just works”.

OK — mash it all up now. Not surprisingly, there are simple devices that will enable a PlayStation I or II controller to be plugged into the USB port of your computer. Better yet, if the converter is HID compliant, no drivers are necessary and it’ll just work with software like MAME OS X.

Plug it all together and it “just works”. Nothing like a bit of frantic Robotron action on a 46″ LCD.

Construction is not difficult. You’ll need a soldering iron, a hole cutter, and some kind of fasteners. I used wire ties because I had a boatload and I was two lazy to deal with that whole nut + bolt thing.

Click on through for details (with pictures).

Read the rest of this entry »

Posted in Hacks, Technology | 6 Comments »

The Scrap Monopod (The Stringpod)

Wednesday, October 10th, 2007
Supercheap Monopod

Pictured at left is the world’s cheapest monopod. Nearly the cheapest — since I’m in Missouri, I didn’t have access to my box of screws and, thus, this thing ran me about 62 cents.

For me, the end result was surprisingly positive.

The top frog picture was taken free-hand with a shutter speed of 1/125th of a second at ISO200. I took a series of photos starting beyond that distance and moving in until the shots were unusably blurry. Even that shot has a bit of blur.

The bottom frog picture was taken while using the stringpod with a shutter speed of 1/50th of a second at ISO100. Pretty sharp for less than half the speed and a noise reducing bump to ISO100!

Basically, the string eliminates vertical motion. As well, I find that the act of applying a bit of pressure against the string helps to eliminate horizontal instability, too.


Tree Frog in Bird House

Anyway, it is trivially easy to make and use.

Make:

  • Get yourself a 1/40-20 bolt of about the 1″ or 1.5″ long variety. Helps if it is a thumbscrew (has texture around a barrell shaped head), but really doesn’t matter.
  • Find a length of relatively strong string. If you are 6′ tall, plan on needing about 7′ of string.
  • Tie the string to the bolt head. Do not cover too many threads.
  • Optionally attach a washer to the other end of the string.
  • Screw the bolt into the tripod mount on the bottom of your camera.


Tree Frog in Bird House

To use:

  • Bring the camera up to an inch or so below the height you want to shoot from.
  • Step on the other end of the line.
  • Raise the camera until the string is just a bit taut. No need to apply lots of pressure.
  • If kneeling, wrap the string around your shoe/foot to both get the loose end out of the way and add a bit of extra no-slip to the string.


Posted in Hacks, Photography | 11 Comments »

A Not Terribly Scientific Study Of Alternative Means of Using an iPhone

Wednesday, September 19th, 2007
Blurry Adam

Bad photo, right? Yup. But, at the moment, it is one of the very few iPhone photos taken entirely by nose control. Special, huh?

Of course, this rather amazing new level in human computer interaction required further investigation.

What can be used to wake an iPhone, unlock it, and take a picture?

  • Toes work. Duh.
  • Stomachs do not work. But it does tickle.
  • A dog’s paw works just fine…
  • … but licking the phone while trying to use it does not work.
  • Nipples do not work. And the screen is surprisingly cold.


Posted in Hacks, Humor, Technology | 6 Comments »

TwistedElephant: A Memory Debugger for Twisted Applications

Saturday, September 15th, 2007

Recently, I was trying to figure out why a Twisted application was leaking memory at a disturbingly rapid rate. In the process of investigation, I hacked up some one-off bits of logging within the target application that used Python’s GC module and my di() hack such that I could explore the active object graph within the Twisted process.

Knowing that I would be faced with this problem again, I did a bit of recreational hacking over Memorial Day and created a primitive, though effective, general purpose Twisted memory debugging tool.

It is called TwistedElephant.

It lives in my personal SVN repository at red-bean:

http://svn.red-bean.com/bbum/trunk/hacques/TwistedElephant/

It includes some quick documentation.

Note that it is a complete hack that was just good enough to solve a set of memory debugging problems that I had at the time. There are dozens of improvements that can be made and likely some great bugs, too.

Patches welcome!

Posted in Hacks, Software, Technology | No Comments »

Python: di

Friday, August 24th, 2007

The id() function doesn’t have an inverse1. Now it does.

>>> k = object()
>>> print k
<object object at 0x9a3b8>
>>> id(k)
631736
>>> from di import di
>>> j = di(631736)
>>> j
<object object at 0x9a3b8>
>>> id(j)
631736

Stupid simple module available in my SVN repository.

1 For good reason. An object’s id() is just its address in memory. This hack is effectively exposing a pointer — a fragile, prone to disappear out from under you, nasty, C-ism — into Python. It is like running on marbles with scissors. No stability and potential for loss of precious runtime fluids.

In a debugging context, though, being able to turn an id() back into an object reference allows interrogation of objects where identification of “objects of interest” and the actual interrogation of said objects does not have to happen within a contiguous set of expressions.

Chris says:

I wish people wouldn’t post stuff like this. There is never any case where this is a useful operation - the only time it works is when the object you want to retrieve is still around anyway - and there’s never any reason to store the id of an object instead of the object reference (or a weakref) instead.

People asking how to do this isn’t uncommon, and being able to google for it will just lead people to doing it instead of being told that they need to fix the problem that leads to them wanting to do it instead.

“Never any case”? That is a bit unimaginative and could even be construed as arrogant. The only safe “never” is in the statement “never assume you know everything”.

Sure — if you pass a random number or the id of a no longer existing object to di(), your process is going to crash. Totally true and I have added some emphasis on exactly why this feature is not a part of python, nor should it be.

As for this tool and the dangers therein: So what? Don’t do that. Tools can be misused. If something hurts, don’t do it.

This tool has saved me hours and hours of engineering time, several hundred lines of fairly complex code, and having to make some fairly nasty & intrusive changes to several relatively complex client/server focused codebases. More subtly, it allowed me to vastly reduce memory leaks without having to instrument the code in ways that would have very likely changed the lifespan of objects.

Lame. Python’s weakrefs don’t support weak references to Dictionaries, Lists, Tuples, Strings, or None. Four out of five of these types are very often exactly the kind of thing I need to figure out why there are tons of ‘em floating around that shouldn’t be. Bogus.

Posted in Hacks, Software | 15 Comments »

WWDC ‘07 is in the can!

Tuesday, June 19th, 2007
Gerbera Daisy

WWDC ‘07 is now behind us. A huge thank you to everyone who took a moment to give kudos and criticisms of all the work that we have done in the last year. It was overwhelmingly positive and very much appreciated — a confirmation that we are on the right track.

The Tommy’s runs were an awesome success. Wednesday had two graduations and tons of folks showed up!

I spent the weekend unwinding with a bit of development work on Dave Dribin’s MAME OS X client. Was quite relaxing to work with production tools in a production environment without any deadlines. I ended up adding persistence of audit data across app invocations. If I get a chance, I have some ideas to further improve the app.

Posted in Hacks, Life | 1 Comment »