8-bit Assembler Artwork

Ξ November 16th, 2008 | → 0 Comments | ∇ code, Art |

I happened upon this project called dismap last week that generated fantastic artwork from 8-bit game carts.  The person behind the project, Ben Fry, disassembled the roms using a tool called NESrev, and then formatted the 6502 assembler instructions into readable columns.  To touch up the visuals, he then drew lines between all of the jmp source and destinations.  He also lead a companion project called Mario Soup, featuring tiles ripped from Super Mario Bros., and another project called distellamap, which featured assembly code from Atari 2600 games.  Prints are available for both dismap, and distellamap.

Original post by ojuice


Interfacing With Another Species 7.2 Ksecs Too Early

Ξ September 29th, 2008 | → 0 Comments | ∇ special, Work, code, japan, coding, programming, conference, meeting |

I’ve been scheduled for a conference call without my input on the time for more than 7Ksecs before I usually resume consciousness.  In the past this has usually resulted in disaster for the other involved parties, as I typically can’t resume from standby that early, let alone speak in coherent sentences or form what humans would consider lucid thoughts.  My ideal employer would either be able to work with this better, or be located in Japan.

This article on Code Climber identifies a lot of the most important reasons I and so many others work best at night. There are numerous benefits to working at night:

  • There are far less interruptions by email, instant message, and news via RSS
  • There is minimal interaction with human species, as they seem to prefer sleeping while Sol illuminates the oppopsite side of their planet
  • My best and most productive work requires long periods of concentration and Focus

Original post by Maker


A little regex in php for fun

Ξ August 14th, 2008 | → 0 Comments | ∇ code, coding, php, programming, regex |

So after working thirteen hours in a row I came home and thought of a handy function to bandaid some legacy code that returns a url with double slashes after the TLD. I realize this is a worse solution than fixing the code in question, but my regex-fu could use work so I though I’d do a little exploring. Here’s what I came up with:

$url = remove_url_slashes('http://www.killallhumans.com//?robots_eating=hobos&passion=361', 'killallhumans');

function remove_url_slashes($url=’’,$domain=’’) {
return false;
$domain = 'killallhumans';
$pattern = "/($domain)(.*?)(\/+)/ie";
return preg_replace($pattern, "'\\1\\2/'", $url);

Original post by Maker


Silence on the Wire

Ξ July 17th, 2008 | → 0 Comments | ∇ code, Books, blife, Cycling, Site |

Sorry, I haven’t updated in ages.  Prepare yourself for some rambling.  I switched to Night Shift, then back to Day Shift.  Went on a couple road trips, read a book or two, etc.  Anyway, I’ve been porting Mode8 to SDL.   It was sad when I decided to do so, as I had to throw away the coolest, and most time consuming classes.  But actually the switch improved the over all structure.  I’ve also been watching a lot of races over at the Velodrome.  Good stuff.  The Tour de France is currently in the Pyrenees’s; Team Columbia has been doing well.  I wish both them and Garmin-Chipotle the best.  FF4ds comes out next week, and it looks fantastic.  DQ4ds comes out in two months and looks even better.  This years E3 has been disappointing, except perhaps for Mirrors Edge, and the FFXIII port to the Xbox 360

Original post by ojuice


blife2 on the wii

Ξ May 26th, 2008 | → 0 Comments | ∇ code, blife |

I was up until 3:30am last night working on this. :=)

blife2 on the wii

Original post by ojuice



Ξ May 20th, 2008 | → 0 Comments | ∇ code, blife |

You might remember blife.  It was an implementation of Conway’s Game of Life in C, and used OpenGL to render the state of the colony.  It worked in Windows, Linux, and everything else.

I threw it away.

I’ve been working on a nice and clean generic cellular automata application.  I’ve been working in C++, and using SDL to render output.  The kicker is this, though, the ruleset isn’t going to be hardcoded.  The idea here is to abstract away the rules.  I’m working on a LISP interpreter to program rulesets with.

What are the advantages of this approach?  In the original blife, you were bound to Game of Life, and only Game of Life.  By virtue of implementing the GoL as a standard, you were also stuck with its default rules. Neither of these assumptions will be present in this new application.  You’ll be able to modify life to your hearts content.  And who says you have to run Life; run Wolframs ‘Rule 30′ instead.  Or use it as a tsst bed for any ideas you have kicking around in your head.

I forgot to mention, SDL wont be the only output option available.  NULL, Text, and PNG output will be available out of the box.

Original post by ojuice


Warning: SQL Statement is Missing SQL

Ξ March 26th, 2008 | → 0 Comments | ∇ code |

I found some great code at work today I’d like to share. I’ve omitted anything that might qualify as a trade secret or proprietary information. I’ve also changed the names of the innocent variables to make it more readable. Also, this won’t be funny if code makes your brain hurt.

Here’s the error I kept finding:
Warning: pg_query_params(): Query failed: ERROR: bind message supplies 3 parameters, but prepared statement "" requires 0 on line 9175

Upon investigation, I determined that the reason our postgres query was failing was because we forgot to actually give it any SQL statement (pay attention to the second parameter here.. it should contain the SQL query that you want to apply the third parameter for):
$ret = pg_query_params($this-connection, "", array($shipping_type, $customer_id, $payment));

Well, fine.. but I thought it was funny.

Original post by Maker


The Codebook

Ξ March 13th, 2008 | → 0 Comments | ∇ code, Computing |

I’ve been keeping a journal that I call “The Codebook” for the past four of five years. When people see it for the first time, they usually ask me something like: “So.. are you with the NSA then..?”, and I although cliche, reply with something like: “I can neither confirm nor deny my involvement with the NSA”. Anyway, The Codebook is a notebook that I write down all of my programming ideas, work through technical problems, and keep track of what I’m working on.

The content of The Codebook is intractable. It ranges from C++-pseudo code, and algorithm analysis, to mocked up maps that I plotted out when I did that Legend of Zelda clone I wrote back in college. It’s also organized very poorly. Anybody who looked at it would probably think it’s gibberish Computer Science, or some kind of nerd stream of consciousness piece. For instance, I just found an outline of what my plans for JuiceMUD were, right next to a rather large listing of UNIX programs, and then on the next page there’s some mysterious binary work surrounded by blank paper.

This all leads me to a question: how do you keep your technical thoughts organized?

Codebook Cover Codebook Example Codebook Map

Original post by admin


In which a system administrator is an idiot

Ξ March 10th, 2008 | → 0 Comments | ∇ code |

I recently did some freelance work for a friend of mine. It was extremely basic, just adding some includes so he didn’t have to manage a hundred different navigations for each page he had made. Well, I did it fast and I skipped some basic checking in my script. My code would work unless you had the error logging turned up all the way, which is fairly excessive. The other way it would fail is if you had display_errors set, which is the default PHP configuration. No one with any ounce of experience or common sense would let display_errors be set for a production server. This gives out sensitive information about the environment of the server. Here is what the PHP Security Consortium has to say about display_errors:

“The display_errors directive determines whether error messages should be sent to the browser. These messages frequently contain sensitive information about your web application environment, and should never be presented to untrusted sources.

Unless you are in a closed development state, display_errors should be disabled, and all error messages should be passed to system log files using the log_errors directive.”

So I fixed my code to be able to run in a very strict error checking environment, to such a point that it’s excessive. It checks to see if a variable exists immediately after I’ve set it. This is sort of my passive aggressive way of telling the syadmin who had a problem with my code to take a long walk off a short beach. The icing on my cake is that I check at the very beginning of the first include to see if display_errors is on. If it’s on and isn’t set to log errors to a file, I disable it. Then I check to see if the supeglobal $_SERVER is set. I’m not even sure if it’s possible to NOT have it set. But just for good measure, if by some miracle it isn’t set, and I can’t figure out the name of the script that’s running, I exit which causes a white screen to display.

// http://us3.php.net/errorfunc Note: You’re strongly advised to use error logging in place of error displaying on production web sites.
if(ini_get(’display_errors’) && ini_get(’display_errors’) == ‘1′) error_reporting(0);
if(!isset($_SERVER) && !isset($_SERVER[’SCRIPT_FILENAME’])) exit;

He also calls this production server, “the dedicated box” even though it runs many virtual hosted sites.

Original post by Maker


Compiling libpng in Visual Studio .NET {2005}

Ξ March 1st, 2008 | → 0 Comments | ∇ code, Projects, Computing |

There is very spotty documentation on how to use libpng under Windows. I did find one site that talks about the subject, so you might want to refer to it as well.

1. Libpng Setup:

First, you’ll need to download the latest version of libpng and zlib. Extract them someplace (I placed them within my projects root, in a directory called ‘deps’). The pre-canned Visual Studio settings that come with libpng look for ‘zlib’ rather than ‘zlib-x.y.z’, so rename the directories so that they lack the version numbers.

2. Compiling libpng and zlib

Next go into <projectname>\deps\libpng\projects\visualc71 and open libpng.sln. Go to Build and run ‘Clean Solution’. Now you have a choice, you can either compile libpng as a dynamically loaded library, or a binary blob to statically link into your executable. You can compile either one as a debug or release build. Just make sure that whichever way you compile libpng (debug/release), is the same as what you compile your project. So choose an option, and go to Build -> Build Solution. This will compile both libpng and zlib.

3. Project Setup

Now you’ll need to set your project up to include the libpng and zlib files. Open your Visual Studio project, and go to Project -> <projectname> Properties. Expand Configuration Properties, and then expand C/C++. The top field on the right will read “Additional Include Directories”. Click it and add “C:\<projectname>\deps\zlib;C:\<projectname>\deps\libpng”.

Now close the C/C++ tree and expand the Linker tree, which is directly below it. Roughly 3/4 of the way down is a field called “Additional Library Directories”. Click it and add


In my case, I compiled as Win32_LIB_Debug (Statically Linked, Debug Symbols included), so that’s what I set <projecttypeyoucompiledas> to.

Next open the Input node that is in the Linker tree. Under “Additional Dependancies” add libpngd.lib zlibd.lib if you chose to statically link, or libpng13d.lib zlib1d.lib if you compiled it as a dll. If you did compile as a dll, you will then need to copy the dll’s that were generated to the same directory as your executable, or to a directory loaded in PATH.

Now you can implement PNG reading or writing into your project.

4. Troubleshooting

Q: I get a ton of linking errors!
A: Visual Studio cannot find the lib files. Double check that they are compiled (libpng{..}.lib, zlib{…}.lib), that your projects Library dependancies includes the directories that they are in, and that the lib files are included in the Additional Dependancies field.

Q: Visual Studio spits out errors about undeclared identifiers!
A: Make sure you have #include <png.h> in your source. Also make sure that png.h’s path is included under Additional Included Directories in your projects settings.

Original post by ojuice


My History of Programming

Ξ December 19th, 2007 | → 0 Comments | ∇ code |

This essay is a somewhat brief history of my programming experiences. It is by no means all encompassing, but I’ve tried to hit all of the big moments in my programming career (my favorite classes and so forth).
Although I had experimented with QBasic a little bit as a lad, it wasn’t until High School when I got my TI-85 graphing calculator that I really started to program. The TI-85 was a wonderful device that allowed users to program in a BASIC right on the calculator using the keypad. The primitives and control structures were all listed in horizontal menus, and you’d select which one you wanted using the menu buttons as the top of the keypad.
I didn’t have a manual on BASIC, so I fooled around with each keyword until I understood what it did. The first program I managed to write was a simple Fahrenheit […]

Original post by Brad


  • Rumours and Lies