Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected



This week's Tool of the Week is Pastebin by Dale Harvey.

What it does:


When you need it:

  • Quick testing of a bit of HTML/JS code
  • Demonstrating/Teaching HTML/JS in front of a group
  • IMing/Linking/Emailing editable code

How to use it:

Full Screencast here

The Example:



I'm starting a new feature on my blog. It's called "Tool of the Week". Let's see how long it lasts.

To be honest, I'm writing the first four TOTWs right now and scheduling them to post over the next month. Double confession is that all of these tools were introduced to me by none other than Paul Irish. The best developer I've ever had the pleasure of working alongside. He came out to Indy from Boston to help out with the FinishLine website redesign project and sat next to me for three weeks. I requested that he give a one hour presentation to our team, and I learned more in that one hour than I normally would have in about 6 months of just learning on my own (reading blogs etc). Hopefully I can help share that knowledge a little. This post is the first in a series of my attempts to do just that.

So, the first tool of the week is Pastie by Josh Goebel.

What it does:

Allows you to paste code that you can then e-mail/IM/embed in a FORMATTED SYNTAX HIGHLIGHTED WAY!

When you need it:

  • Working on a team
  • Posting code on your blog
  • Posting code on your website
  • Getting help online (IRC/forums/etc)

How to use it:

Full Screencast here

The Example:

Bonus TOTW! Paul Irish's easy CSS refresh code:

So, next time you find yourself getting ready to FTP a file, or paste code into an e-mail just to send it to another developer, use the <pre> tag on your blog or whatever, why not give pastie a try?

And btw, sorry to disappoint those of you who land on this page in hopes of finding anything related to the product actresses and "loose women" use in lieu of bras or even shirts... You're better off not finding that stuff anyways...


Command Line Subversion Client Mac

How to install and use the Command Line Subversion Client on a Mac.

Martin Ott's Binaries
Free Subversion Book


Auto Upload File on Save in Aptana

This is an explanation on how to automatically upload a file via FTP when you click "save" in the Aptana IDE (2.x does not work in 3.x). Let's jump right in...

1. If you don't have a project, create one. 

2. If you don't have a "scripts" folder in your project, create one (I put mine in the root directory of my project. No clue if it will work from anywhere else). 

3. Create a new file inside your scripts folder with a .js extension (I named mine "upload_current_file_on_save.js", not sure if it will work with any other name). 

4. Place this code inside the file: 


 * Menu: gMan > Upload On Save 
 * Kudos: Ingo Muschenetz 
 * License: EPL 1.0 
 * Listener: commandService().addExecutionListener(this); 
 * DOM: http://localhost/com.aptana.ide.syncing 
 * DOM: 

// Add  * Listener: commandService().addExecutionListener(this); to the top of this file to enable it 

 * Returns a reference to the workspace command service 
function commandService() 

   var commandServiceClass =; 
   // same as doing ICommandService.class 
    var commandService =; 
    return commandService; 

 * Called before any/every command is executed, so we must filter on command ID 
function preExecute(commandId, event) {} 

/* Add in all methods required by the interface, even if they are unused */ 
function postExecuteSuccess(commandId, returnValue) 
   // if we see a save command 
   if (commandId == "") 
      /* Replace above line if you'd like to limit it to just certain projects 
      var fileName = editors.activeEditor.uri; 

function notHandled(commandId, exception) {} 

function postExecuteFailure(commandId, exception) {}


5. Save the file. 

A few notes on what needed changed in this file from the sample file I took this from: 

1. I added this line of code to the comment block at the top: 


 * Listener: commandService().addExecutionListener(this);


I know there is a comment in this file that tells you to "add this to the top of this file", but since I'm new to the whole scripts thing I didn't get that when it said "top of the file" it meant "the middle of the comment block at the top of this file". I thought I was literally supposed to make that line the very first line in the file... Which didn't work at all... 

2. I changed the "menu" line to: 


 * Menu: gMan > Upload On Save 



 * Menu: Synchronize > Upload Current File On Save Enabled


For some reason it didn't work until I changed this line. Since my project is code named "gMan" (It's a user management system, you'll make the connection...) I just named the menu item "gMan" after my project. Then the command is to upload on save, so that's what I named it. As soon as I made this change is when the whole thing started working. Could be coincidence, or could be that you have to do this for the script to work (rename the menu command something other than what the sample is named). 

In case you haven't figured it out, you run the script by going to the "Scripts" menu in the toolbar at the top of Apatan (and selecting the script, whatever you named it in the previous step). 

Want to read more about website creation in Aptana from this author? Check out his book:
HTML, XHTML, and CSS All-in-One Desk Reference For Dummies (For Dummies (Computer/Tech)). Support the Author of this post and buy the book from Amazon by clicking on the link on this page. Thanks for the help!


phpbb3 & zen cart integration

I've been trying to get the phpbb3 & zen cart integration to work.

I've had some errors in the default SQl zen cart comes with. First I was getting an error about an invalid column name in the phpbb_user_groups table (specifically the group_description column not existing). Once I fixed that, I got a very cryptic "1062 Duplicate entry '' for key 2" error every time I tried to create a new user.

Here's how to fix BOTH of these problems:

Problem 1 - "column group_description does not exist":

Edit line 196 in store>includes>classes>class.phpbb.php. Change "group_description" to "group_desc"

Problem 2 - 1062 Duplicate entry '' for key 2:

Edit line 187 (in the same file as in Problem 1). Change it from:

(user_id, username, user_password, user_email, user_regdate)


(user_id, username, user_password, username_clean, user_email, user_regdate)

Edit line 189. Change it from:

('" . (int)$user_id . "', '" . $nick . "', '" . md5($password) . "', '" . $email_address . "', '" . time() ."')";


('" . (int)$user_id . "', '" . $nick . "', '" . md5($password) . "', '" . $nick . "', '" . $email_address . "', '" . time() ."')";

phpbb requires that each user have a unique "username_clean". This is the second "key" in the table requirements. The first creates an index on user_id, the second requires username_clean be UNIQUE, the third creates an INDEX on user_birthday, and so on. In fact, at NO POINT do they EVER REQUIRE THE USERNAME TO BE UNIQUE! WHAT????? yep. It's username_clean that must be unique. zen cart doesn't even try and insert anything into username_clean, it just tries to make the username (this makes no sense at all!!!).

Feel free to comment if you have any insights/questions!


SPE (Python IDE) for Windows

I've been playing with Python this weekend. Currently I'm rebuilding "Clink" in Python instead of finishing it in Flash (It really needs AS 3.0 to do properly, and I only have access to 2.0).

The book I am reading (Game Programming: The L Line, The Express Line to Learning) recommeds the SPE (Stani's Python Editor) IDE for creating Python programs. However, the book doesn't really say how to get the program. Stani (the IDE's author) doesn't appear to have a web page with a "download" link and instructions; so here's a download link with instructions from me instead (this is for installing on Windows):


Step 1: Download & Install wxPython (NOT wxWidgets!!!!)

The book states that you should download and install wxWidgets. It turns out, you need wxPython instead, which you can get here:

Scroll down and get the version that matches your version of Python. Just double click the downloaded file, and it basically installs itself. I won't give you any advice on what boxes to check at the end of the install, because I don't remember what they said, and to be honest, I arbitrarily made my choices having no clue as to why I was choosing what I chose (I unchecked the top one, and left the bottom two checked).

Step 2: Download and Install SPE

Go to

Get this file:

Unzip it to somewhere you will remember (I put mine in Program Files) but don't rename the folder anything other than "_spe".

Go inside the _spe directory you just created and double click

At this point your shiny new Python IDE should start up. If not, sorry... I don't know why it didn't work. Make a shortcut to the editor on your desktop for easy opening (or start menu, or quicklaunch toolbar).

Have fun!


Installing Python (mod_python) on XAMPP (on Windows)

So you want to get Python working with XAMPP eh? Me too! So, apparently, do a lot of people; and pretty much no one who knows how is saying how from what I've found online in my cursory 5 minute search. Let's just jump right in, shall we?


Step 0: Install XAMPP & Python

You should have installed XAMPP already, but if you are a brand new "b" to the Server Side Dev ring, and you have stumbled upon this post looking for the catch all solution to getting your feet wet with Server Side Programming and have picked Python as your poison, go get XAMPP! It basically installs and configures itself, and there is an excellent tutorial on the apachefriends website to get you through this process:

You might not have installed Python already (although, if not, why did you choose Python over PHP or Ruby?). If you haven't installed it already, go download and install it now:

Step 1: Make a Backup

If you are like me, and have a few years worth of stuff in your XAMPP directory that you don't want to 'splode when you screw up the first time you try to get Python working with XAMPP, go ahead and just zip c:\xampp to x:\ now...

Step 2: Download mod_python

Download mod_python now...

Wait, which one do I download?

Good question! Check your version of Apache and Python to determine which one you need

  1. Enter the text (leave out the space between phpinfo and ()):
    <? phpinfo (); ?>
    into a new text document in notepad.
  2. Save the document as "test.php" (or something) in the htdocs directory of your xampp install.
  3. Start Apache (open the xampp control panel, c:\xampp\xampp-control.exe, and click "Start" next to Apache).
    NOTE: If you have IIS running, stop it. (Control Panel, Administrative Tools, Services, IIS Admin, Stop (say yes to stopping those other services too). If you scroll up to "Apache" at this point and click on it, you will see which version you are running and can skip to the next step in the mod_python install).
  4. Browse to the document you saved in step 2 through your web browser (localhost\test.php). You can NOT just double click the file and expect it to be parsed by apache and run...
  5. Scroll down and view the output in the "apache2handler" section. The first box in the table should be "Apache Version" and should tell you which version of Apache you are running (mine is 2.2.4, so I downloaded the very last ".exe" file so that I would have Python 2.5 w/ Apache 2.2)

Step 3: install mod_python

  1. Double click the exe file
  2. Click "Next"
  3. It should find your Python install. If you have more than one version, select the one you want to use. Click "Next"
  4. Click "Next"
  5. There should be a pop-up asking where Apache is installed. If you installed xampp to c:\, then this will be c:\xampp\apache

Step 4: Configure Apache

  1. Open c:\xampp\apache\conf\httpd.conf
  2. Scroll down to the section with all the "LoadModule" lines (about line #67) and add this line:
    LoadModule python_module modules/

    Note: If you are unable to start Apache after this, go back and type the line in the conf file by hand instead of copying/pasting.

  3. Scroll down to the section with the <Directory "/xampp/htdocs"> tag ends (about line #232) and add these lines following the closing </Directory> tag:
    <Directory "/xampp/htdocs/test">
            AddHandler mod_python .py
            PythonHandler mptest
            PythonDebug On
  4. Save and close the file.
  5. Restart Apache
  6. Create a new file (and folder) c:\xampp\htdocs\test\
  7. Place the following text in the file, and save it (watch your formatting, Python is whitespace sensitive!):
    from mod_python import apache
    def handler(req):
    	req.content_type = 'text/plain'
    	req.write("Hello World!")
    	return apache.OK

Step 5: Testing Py!

Point your browser to http://localhost/test/

You should see "Hello World!". If you don't, check this page out (and this one and this one). Also, make sure you got the path correct in the <Directory /> tag, and saved your file to the right place.

What's next? Why not get a Python book? This one is really good:
Game Programming: The L Line, The Express Line to Learning (The L Line: The Express Line To Learning). That's right! Game programming in Python.

Or, why not check out some tutorials, starting with this one! (and check out this presentation on django)


Some user comments:

<Directory /test> ... </Directory> <-- This is wrong!

But, the following works:

<Directory "C:/xampp/htdocs/test"> ... </Directory>

instead on adding the directory block, which turns on mod-python for a single folder, add the following at the end of the file (assumes you want to use the Publisher handler):

<IfModule python_module>
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

If you have any other comments that require code. Just send me an e-mail (cmcculloh-at-gmail-dot-com) and I'll post the code (so you don't have to worry about it getting mangled).


Creating A PHP Spider/Bot/Crawler

Today begins the first in a series of posts about creating a PHP Spider/Crawler/Bot. I'm actually not sure what to call it.

At my work, we deal with hundreds of shipments to and from hundreds of vendors. We have thousands (possibly more) "tracking codes" for Fedex, UPS, DHL, Conway, etc. All of these places have websites where you can go to look up a specific tracking code and see the status of your delivery. Fedex has an API, as does USPS, as does UPS, as does DHL, but Conway does not. The question I'm facing is, do I integrate four different APIs plus a bot to get the info I need, or do I just brute force it all with a bot?

First things first though, can I even make a bot in PHP? Yes! As a test case I have created a simple page scraping bot. It will open up the OCA website and scrape today's scripture off and print it out:

//get a connection to the desired page (remove the space between fopen and the "(")

$handle = fopen ("" , "r");
//pull down the contents of that page
$contents = stream_get_contents($handle);
//close the connection

/*convert everything to lower case so it's easier to do my string matching (not necessarily a must)*/
$contents = strtolower($contents);

/*I looked at the HTML coming down, and found that this was the best consistent place to look at to determine the beginning of the "scripture" content.*/
$start = 'class="scriptureheader">';
//find the position of the start text in the page content
$start_pos = strpos($contents, $start);

//drop the text before the start position
$first_trim = substr($contents, $start_pos);

/*this looked to be the best consistent ending of the scripture in the HTML*/
$stop = '</table>';
//find the position of the stop string in the content
$stop_pos = strpos($first_trim, $stop);

//drop everything after the stop position
$second_trim = substr($first_trim, 0, $stop_pos);

//print out the results
print "<div>$second_trim</div>";

It's important to note that the start and end positions can not have any spaces in them. This could (and would need to be) greatly improved to really be useful. I'd probably recommend incorporating regular expressions instead of using the "strpos" command. Next I'm going to look at the cURL library for PHP. I'll re-use the same website again to navigate forms to get the scriptures readings for Sundays instead of the current day.


Meet Caidor

I'm playing with an AI program that allows you to create a "Virtual Personality" for yourself. I've named mine "Caidor" and I'm in the process of teaching him about myself. You can talk to him here:

There's a plug-in that would allow you to add him to MSN Messenger to talk to people for you when you are away. Pretty sweet. I want to make it so that I can place him on my website to talk to my visitors without them having to leave my site, but so far it doesn't look like that is possible.



A Mac… Thinking Again…

So I've been feeling more and more of an urge to start vLogging. Mostly things like recordings of me building flash games/AJAX sites set at 4x speed to music, or me solving Rubik's cubes (my new goal is to solve the 2x2x2 cube blind-folded), stuff like that.

Windows movie maker is cool and everything, but it just doesn't "do" it for me. Plus my PC can't really do video recording very well ATM (especially because I can't find the video input adapter for my video card).

I keep coming back to the Mac. Honestly, if I had $500 (or however much it cost) laying around to get a Mac mini, I probably would. The problem is, that I'm not made of money, and buying a mac is a big investment. Recently though more and more of my friends have been switching to Mac. At first I could write this off as "well, they use the computer about as much as my mom would, and for similar things". But then my boss (Jason, click the link, it's perfect for this post) at my first job used a mac to program. What? Ok, so I wrote this off as uber-geek trickery. He has somehow ported Unix or Windows programs over or something. It sort of broke my "Macs and AOL are for grandmas" rule, so I didn't try and investigate at all. Then a co-worker at my last job used his Mac to program and GAME. WhatwhatWHAT??? Yep. Ok, so I had to investigate. Turns out he just ran windows on a mac machine. I'm not paying $2000 for a mac just to run windows. But then Brad came along. He seems like somewhat of a gamer, he programs, and he's a big geek like me. So why is he using Mac? It's scary. Could I actually use a Mac? Curiosity makes me want to try.

But I can't just switch, can I? I have about 300GB worth of data on my PCs. Read that again: PCs. I have like six of them. A mac would have to be my secondary box. The one I used just for video editing. Which is why a mac mini would be great. But then there are all sorts of questions... Is it compatible with my ergonomic Microsoft keyboard that I need for my wrists? Is it compatible with my network? Is it compatible with my dell flat-panel monitor? Would I have to set up a whole station just for it, or could it sit next to my dell sandwiched between it and my external USB HD, and could I use one of my KVM switches and just flip back and forth to it?

I would be more willing to buy it if I could have a 30 trial copy to try before I buy. If Mac is so confident in their product, it seems like I should be able to walk into a store, and after giving them my CC# & DL# (in case I didn't bring it back), walk out with a mac-mini. Take it home knowing that I have to return it after 30 days, otherwise they will charge my CC and it's mine.

Now I know that's not ever going to happen. There are so few things that you can actually do that with. But I mean, your computer is like your bed. You use it more than any other thing every day. You can't test a bed for thirty days... Oh, wait, you can if it is a super expensive select comfort sleep number matress. So, the argument could be made that Mac is like the super expensive sleep number matress of computers. If that's true, I would like to try it for 30 days. Unfortunately, I can't. So I'd rather spend $200 on an awesome video card, plus some good video editing software for my PC...

But still the curiosity remains, and I feel like I'm getting closer and closer every year to springing for a little mac to try out. Maybe if I get a big bonus this spring...

Filed under: movies, Software, Tools 3 Comments