// Internet Duct Tape

The Canary in the Coal Mine of Open Source Code Re-use

Posted in Humor, Programming and Software Development, Software, Technology by engtech on February 12, 2008

Programming Tips

Don’t reinvent the wheel. Like all advice it’s much easier to say then it is to do, particularly when it comes to programming. Programmers suffer from a horrible mental disease called Not Invented Here Syndrome (it’s in the DSM — check if you don’t believe me). We will happily rewrite a perfectly good tool because someone else wrote it and it’s easier to rewrite than it is to understand. Sure, we might not handle all the bells and whistles of the original tool (unicode is for sissies) — but at least we got to DIY.

Rewriting from scratch is particularly a bad idea when it comes to open source software. If there’s an open source library or plugin available that does the trick then there’s no reason at all for you not to pick it up and use it. It’s free. If it doesn’t work the way you want it to then you can rewrite that small part or add functionality. There’s no reason to reinvent the open source wheel…

… as long as you can find it. One problem with leveraging open source is finding out if it exists at all. After enough cursing at Google you’ll eventually get a knack for it and know the good code sharing repositories and announcement lists for your languages of choice. The wheel exists! Someone else is having the same problem and came up with a solution, so now you don’t have to! Thank you, lazyweb.

Or that’s what you think, until you try to take the wheel for a test drive. The install instructions are outdated and don’t work quite the way you’d expect. You have slightly different versions of some common components and that causes things to break in mysterious ways. Or you’ve come across a wheel that the wheelmaker gave up on after he got to where he had to go. The wheel looks like it might do what you want it to, but it’s missing the voodoo required to hook it up to anything.

The single biggest problem I have when trying to leverage open source code with my projects is how long does it take me to get it up and running to demo it? If I can see right away that it works and it will solve my needs, then I’m willing to slog through migrating versions of different libraries, sacrificing some chickens and swilling too much coffee to get it integrated with my code on my machine. But the problem is all the installation headaches seem to happen before you reach that nirvana of running a working demo and seeing what it really does (as opposed to what the hastily written release notes ambiguously imply that it does).

I know what you’re thinking fearless reader: this looks like yet another rant about a wasted afternoon trying to be “productive” through code reuse but instead spent glaring at compiling warnings. But there is a light at the end of the tunnel! I have a solution that will keep you from the Poorly Thought Out Install Process Hell that prevents you from making the most out of open source software:

Google Blog Search.

Ok, that was a bit anticlimactic; and it isn’t even Valentine’s Day yet. But stick with me, I have a point lying around here somewhere. If no one other than the author is talking about that tool/plugin/library on blogs then that means no one else is using it. Or, at the very least, that it hasn’t been sufficiently hardened that you should make any assumptions about how smoothly that wheel will run.

At the very least you should be able to find someone writing about what the tool/plugin/library does and any issues they had in getting it running. If no one has bothered taking the time to do that, then that is a huge canary in the mineshaft, dear friend. A huge canary wearing a bright orange tank top with the words “waste of time” written across it.

Photo by tenerife

Best of Feeds – 13 links – geek, marketing, blogging, software

Posted in Best of Feeds by engtech on November 17, 2007

RSS feeds are like cookies (that are good enough for me). Best of Feeds is a weekly collection of the best stuff I saw on the Internet this week. They’re saved on delicious and stumbleupon and cross-posted to Twitter and Tumblr as they happen and then collected together on Saturdays. I don’t blog on the weekend so read these links instead.Subscribe to //engtech to see this every week (or get it by email).


  • saves – number of people who bookmarked on http://del.icio.us
  • inbound links – number of blogs who linked to it (max 100)
  • diggs – number of people who dugg on http://digg.com

This Week at Internet Duct Tape

This Week at IDT Labs

  • [AKISMET] Akismet Auntie Spam v2.09
    • I’m done. I swear. Not going to touch it for a month. Promise. 2007/11/15 version 2.09 – bug fix: vanilla WordPress and WordPress.com return spam results a little differently 2007/11/15 version 2.08 – bug fix: fixed a stupid debug statement that was breaking 2.07 – added menu option for…
  • [AKISMET] Akismet Auntie Spam v2.07
    • Because why shouldn’t a new release happen within hours of the last one? 2007/11/15 version 2.07 – bug fix: improved slowness of displaying hidden comments – added menu option for checking for updates right now – added menu option for configuring how much spam to download at a time for modem…
  • [AKISMET] Akismet Auntie Spam v2.06
    • Our favorite Auntie has a new version. 2007/11/15 version 2.06 – optimized, optimized, optimized – only displays 5000 comments per page to avoid stressing slower computers – will work for any language (not just english anymore) – any additional slowness is because of a bug on the WordPress end that…
  • [YAHOO PIPES] Yahoo Pipe Cleaner v1.1
    • Yahoo Pipes changed their website on me and I’ve fixed Yahoo Pipe Cleaner so that it works with the new site. Now it also removes image thumbnails that were popping up. It might not run on all Yahoo Pipes because some pipes now have custom URLs — let me know if you are having any problems using…

Tags: , , ,

How to Profile Greasemonkey Scripts with Firebug

Posted in Firefox and Greasemonkey, Programming Tools, Technology by engtech on November 13, 2007

Programming Tips

Running performance analysis on Greasemonkey scripts can be a pain in the butt. They aren’t part of a webpage so standard tools for analyzing web sites don’t work… or do they?

The Goal

Profiling Greasemonkey scripts with Firebug

What You’ll Need

  1. Firefox
  2. Greasemonkey
  3. Firebug extension

The Trick

#1: You need to remove all of the Greasemonkey GM_* functions from the script you want to profile. This is easier than it sounds because all of the functions can be performed by plain ‘ole javascript (except for the open in new tab function and register menu command).

#2: You need to embed your Greasemonkey script inside of the running page so you can analyze it with Firebug’s profile tool. I have a function below that can embed a function inside the current web page.

#3: You’ll need to call the function either using unsafeWindow or by embedding a call to the function in the page.

#4: Litter your code with calls to Firebug’s console.profile() and console.time() functions.

Sample Code Template

(function() {
  function embedFunction(s) {
document.body.appendChild(document.createElement('script')).innerHTML =

  function myKickassGreasemonkeyScript() {
    // Put everything you need for your Greasemonkey script in here
    // Don't use any of the GM_* functions!

function kickass() {
      // Block of code that might take a lot of time
      // another block of code



// more cowbell


  // Method 1: embed the function call into the current page
  document.body.appendChild(document.createElement('script')).innerHTML = "myKickassGreasemonkeyScript();";
  // Method 2: directly call the function using unsafeWindow
//     window.addEventListener("load", function(e) {
//                   unsafeWindow.myKickassGreasemonkeyScript();
//                   this.removeEventListener('load',arguments.callee,false);
//                 }, false);


Firebug Tutorial

Michael Sync has a tutorial on using Firebug that describes the console.time() and console.profile() functions. The official website has a nice list of Firebug keyboard shortcuts and a brief description of all the console.* functions.

Related Posts