Posts

goto in PHP 5.3

It appears that the goto statement is being added to PHP 5.3. Considering its bad reputation the move seems like a strange feature to be adding. Especially since one of the main benefit of a goto, exception handling, appears to have been introduced in PHP 5. Hopefully all the web programmers out there will tread cautiously with their new power.

Taking Stuff Apart: Nikko NA-550

Image
From time to time I come across an old piece of electronics that I want to harvest some parts from. Stepping motors from floppy disk drives, Solenoids from zip drives, small DC motors from CD drives to name a few of my favorites. Audio Amplifiers in particular are my very favorit. They have lots of interesting and hard to find pieces. Without further adieu, here's a before shot of this vintage 80's "Nikko NA-550 Integrated Amplifier" that I picked up at a landfill a few weeks ago. For anyone curious, the power button was jammed in the off position, which is probably what earned it a spot at the dump. Got a bunch of nice metal knobs, some dB meters, some very nice Alps selector switches, some Alps potentiometers, a 2.5A breaker and some other misc parts.

Ant AI

I've been toiling away trying to come up with an algorithm which will make ants move in a believable manner while only using a very limited view (the 4 adjacent tiles which they can move to). This was much more difficult than I was expecting, it sounds too easy to say "the ants wander around randomly, then once they found food they could head home following the chemicals they left behind". Implementing it like that not only doesn't work, but the ants end up congregating around the ant hill and don't accomplish much of anything. The final algorithm is a set of rules that look like this: 1. If carrying food, call go home AI. 2. If carrying food and in base, drop food (or wander until there is a spot to drop the food), set chemical output to low. 3. If not on surface, wander until on surface. 4. If on surface, check for food, pickup, change chemical output to high. 5. If on surface and no food, try to follow a chemical trail. 6. If no trail to follow search f...

First Demo

My DS application has come a long way in the past few weeks, I think it is finally time to present the fruits of my labor. I made a video to show off the player movement, world movement, camera scrolling and some of the simple AI / world effects I have going. This is only the beginning though! Everything is now in place for me to build more cool things. There are a couple more things I would like to show off in the near term which I'll post here and on the YouTube channel so keep an eye out! If you would like the demo shoot me an e-mail. Its not at the point where I'd like to publicly distribute it however.

Video Conversion - mencoder + ffmpeg

This is just a quick post. I am working on creating a video for YouTube to show off the current state of my project (see my prior post). Several challenges came up during this process, this is how I handled them: 1) I needed a desktop recording program to record the emulator. This was easy, I installed a program called "gtk-recordmydesktop" and was able to figure everything out with no instructions. On Linux (Ubuntu) this is in the package manager so it was as easy as " sudo apt-get install gtk-recordmydesktop " 2) The resulting video is a non-standard resolution and format, in this case my video file is out.ogv with 272 x 432 resolution. My video editor wants a dv file with 4:3 aspect ratio and YouTube wants 640 x 480 resolution. Getting this to the necessary aspect ratio / resultion / file type required re-encoding / padding / scaling with mencoder, and a transcode with ffmpeg. I found this command to do a straight conversion: mencoder out.ogv -ovc xv...

Side Tracked

I have a new addiction which has put all my other projects on hold. Nintendo DS Homebrew . A couple years ago I took a look at the homebrew development tools and libraries available for the DS and Wii, but didn't get much further than building and tweaking the example programs. Recently I took another look at the Nintendo DS homebrew devkit, devkitPRO . After a few hours I had myself a nice PONG clone, complete with touchpad control. Well, it was so easy to put together that I started working on something bigger. That was all two weeks ago, and my bigger project is coming along nicely (5000 lines strong). At the core my "game" is an ant simulator, complete with randomly generated underground tunnels, a surface world with food spawns and multiple possible underground surface links and a queen that lays eggs and soon breeders to move the eggs away from the queen, soldiers to fight spiders, spiders, etc. I'm nearing the point where I can stop with the ant simula...

Automated Checksums

I'm creating some checksums today for a folder full of large files. This is the method, which I found on the ubuntu forums. Essentially md5sum is called on each file with 'find -exec' : find -type f -exec md5sum "{}" \; > md5sum.txt ' find ' returns the contents of the directory, ' -type f ' ensures only regular files are returned, I'm not sure what the ' "{}" \;' part is for, finally I added '> md5sum.txt' to send the output to a file. This call can take a very long time depending on the size of files it is being called on, so I checked up on it by counting the lines in md5sum.txt with the following command: cat md5sum.txt | nl | tail -1 | cut -f 1 What this does is list the entire md5sum.txt file, count each line with 'nl' , output only the last line (aka first from the end) with 'tail - 1' then return only the first field of that line with 'cut -f 1' Finally...