Author Archives: joe
Ruby / Gosu Game of Life Pt 1
I just finished up my first pass on Conway’s Game of Life with the Ruby version of Gosu while watching season 2 of Dexter. It’s ripe for refactor and I still have some work to do to make it worth running, but yeah, first pass.
To run it, you just need to run init.rb
ruby init.rb
Ruby Clipboard Directory List Utility
I wrote this little script to copy the filenames of a directory into the clipboard a while back and forgot to post about it. I’ve been particularly surprised about how often it’s come in handy for this or that.
require 'clipboard'
c = Clipboard.new
list = ''
if ARGV.size == 0
path = "."
else
path = ARGV[0]
end
Dir.foreach(path) {
|file|
if(file.length > 2)
list << file << "n"
end
}
c.set_data list
To use it, simply call run the script with the directory you want copied to your clipboard as an argument!
Target Practice Pt 2
I made a few small updates to Target Practice tonight. The biggest addition was sound although I made a few other little tweaks under the proverbial hood.
I had originally wanted to pack it up and release it as a single executable file but I was having some issues which I’ll post about once I figure out what the heck I’m doing.
Speaking of lazing, there are a few things I’d like to do differently in Target Practice. Most notably I’d like to abstract out out the media to some manager or another, and also my target manager class has grown rather bloated which I take to be a good indicator that it’s doing more than it should. I don’t care enough about this program to fix either of these issues, but hopefully I’ve learned from these mistakes!
Ganymede JSEclipse Alternatives
I’ve been having memory issues since setting up JSEclipse on eclipse. I tried googling around first but had a hard time finding any plugins that supported Ganymede.
Once again, stackoverflow came to my rescue by suggesting (free for non-commercial use) Spket and while I haven’t used it extensively yet it’s been working great so far!
CFEclipse/Ganymede Line Number Problem
My tray line numbers weren’t showing up in CFEclipse since upgrading to the Ganymede version of eclipse. My preferences were set correctly. I did a bit of googling but I didn’t actually find the solution until a few links down, so I thought I’d share the link love!
1. In directory
[workspace]/.metadata/.plugins/.org.eclipse.core.runtime/.settings/
2. Edit (or create) a text file called
.org.cfeclipse.cfml.pref
3. Add the following line:
lineNumberRuler=true
4. Restart Eclipse
MySQL Casting Gotcha
Works
SELECT 409.95 = (1 + 408.95)
Doesn’t
SELECT 409.95 = (a + b)
Works
SELECT 409.95 = CAST((a + b) as decimal)
How to Recover a Deleted File in Eclipse
I don’t know how (yet) and I can’t recreate it, but I swear that Eclipse ate two of my files while in the CFEclipse perspective. Neither of which I had placed under version-control yet. (DOH!) I was able to recover one of them from a nightly back-up.
When trying to figure out exactly what the heck happened, I took a peek at the local history for my back-up file and Eclipse still had the record of my changes up to the moment I lost the file!
Sooooo I re-created my lost file, right-clicked “Compare With” and “Local History” and I was able to re-cover the latest version of my file!
Phew!
SQL Beautifier
I’ve spent some time searching and I’ve finally found a good tool for auto-formatting SQL! Simply paste in your fugly code, make any configuration tweaks, post and *bam*. Beautiful SQL.
Great for those ColdFusion dumps.
There’s also a desktop version, but I didn’t check it out.
Target Practice
Half-Life is the game of choice at work, and sadly I’m terrible at it. I thought I’d try to write a little game using gosu to try and help me improve my accuracy. I just reached a good stopping point and I thought I’d share.
It’s really simple, the idea is to shoot little 20 x 20 “targets” (I’m artistically challenged) before they expire. Missing or letting 10 targets expire will end the game. Next version will include sound, improved visuals and maybe even a couple other fun features if your lucky.
The code is a bit over-engineered but I plan on incorporating parts into some “core extensions” that I’m working on that will hopefully make it a lot easier for me to bang stuff like this out. Finally, as I doubt anyone will ever download this, I didn’t bother to pack it up so you’ll have to have Ruby and gosu installed in order to enjoy it.
PS: I’ve been a Photoshop user for many years, but I used GIMP to make these images and I didn’t even hate it!