Planet l3ib

March 11, 2010

Dave Foster

Fluxus playing

Fluxus is a really neat program for “live coding“, which means something about creating visuals for performance art, but not having anything prebuilt for those performances.  It’s neat in that you write the code for your scenes directly inside of the renderer itself, which has a certain aesthetic to it.  You can get things to react to sound by attaching it to jack and using outputs of fft’d signal.

I am not so great with fluxus due to a lack of scheme experience and just general unfamiliarity, but I enjoy playing around with it - my fiance playfully refers to it as “cube manager” as there was a time I was only playing with fluxus or Football Manager.  Here’s some visuals I put together tonight:

by Dave Foster at March 11, 2010 03:22 AM

March 10, 2010

fitzsimmons

Haxpact Day 2

Registration of the bfbc2:// protocol is now complete. Now on to the real part of the program. I also found a chunk of C# code that will bind to the win32 INI parsing functions, since .NET doesn’t have something built in for it.

The next step is input validation. Here’s a sample server string: 3363010643,b652b484-4188-42ea-8885-50fc4991af5b,Reddit Unofficial Gaming Community – Chicago;

As far as I can tell, the format for the server string is three fields separated by commas:

  1. Some sort of numeric ID
  2. Something that’s probably a GUID, looks like it’s in hexidecimal. All servers appear to be in the 8-4-4-4-12 configuration.
  3. A freeform string

My current goal is to write a regular expression to match this format, and validate incoming input with it. It’s not a particularly challenging goal, but it will take time and will undoubtedly be a fairly ugly “write-only” regexp that nobody (including my future self) will understand.

After input is validated, I simply need to parse the ini file, check that the input is not already in the user’s list, and insert the new server. Not unreasonable to think I’d be done the basic functionality of this program by the end of the week.

by Fitzsimmons at March 10, 2010 11:11 PM

Dave Foster

Stage for Sinatra

I’ve been getting into hacking together quick web ideas via Sinatra, which is a great little Ruby web framework for getting things going QUICKLY.  I love how easy it is to get started (not many lines) and it supports HAML pretty much automatically.  It also lets you run a quick webserver just by running “ruby <yourfile.rb>”.

This is a great mechanism for development, because it allows really speedy iterations (or bugfixing).  However, some of these ideas are things I want to share or run more than just in a development mode, although not quite turn them into a full bore application.

Enter Phusion Passenger, the “mod_rails” plugin for Apache.  Passenger works for all Rack based applications, including Sinatra, making it pretty easy to setup a Sinatra app at a slightly more permanent location.

On l3ib.org, we have run lighttpd since the server was born, purely chosen out of its ease of syntax.  Over the years, things have been grafted on and some things are straight up hard to do on lighttpd, such as deploy Rails applications.  Luckily, our server provides a second public IP address, which Apache runs on.

Tonight, I created a staging area, called stage.minuslab.net, where I can dump these testing Sinatra apps as suburls.  I won’t link to the one app I put in there just yet as it is resource intensive and I don’t know yet how to throttle it to the outside world, but that will be coming a later haxpact entry.

I also wrote a quick script to manage adding each application as it is ready to be “deployed” - it adds the sub-uri to the stage.minuslab.net Apache configuration file, sets up the proper symlinks, writes the config.ru that is required, and restarts Apache all in one shot.  The script is buggy and internal only so I won’t share that either tonight, but it’s making developing small ideas with Sinatra even easier.

by Dave Foster at March 10, 2010 03:49 AM

March 09, 2010

fitzsimmons

Haxpact Day 1 – BFBC2FavouriteManager

First day of haxpact report:

I’m planning on making a favourite server manager for Battlefield Bad Company 2. The ingame server browser has a crappy UI, and has a tendency to just fail. For example, there is a well known bug where pings simply do not show up in the server browser. Makes it challenging for me to find a good server. Also, adding a server to the favourites list doesn’t work from the global list for me. It just locks up forever.

Fortunately, the favourites list is saved in a fairly simple format in BFBC2’s configuration file, called GameSettings.ini. I can modify this file to add favourite servers manually, as long as I have their identification string. What I’m aiming to do with my haxpact project is make a program that is bound to the bfbc2:// uri; the config information can be hosted on webpages, and people can simply click on a link to add the server to their favourites. At first, this is all the program will do. Perhaps in the future I will add a GUI that will allow people to export their favourites, reorder their favourites, etc.


The first technical problem I’ve encountered is registering the URI handler. You need to have administrator privileges in Windows Vista and 7 in order to modify the part of the registry that I need to modify. There’s no way to escalate the privileges of an existing process, so my project needs to launch another process with admin privileges (invoking UAC) to set up the URI handler. So far I’ve been struggling with understanding all this and figuring out the C# build environment, so I haven’t really made any progress on the project itself.

P.S. I’m Canadian so there’s going to be a u in the name. Deal with it.

by Fitzsimmons at March 09, 2010 07:51 PM

Dave Foster

Rainbow 2.0

As my first haxpact entry, I decided to finish up the remaining pieces of rainbow, a toy program I developed that I find useful when doing anything with color (HTML stuff usually).  It’s a Ruby/GTK program that displays hex color codes found in plain text.  Here’s a current screenshot:

It has just been released as Rainbow 2.0.  Go check it out!

Rainbow never had an official 1.0 release, as it was waiting on a bug to be fixed in the Ruby/GTK bindings in order to let drag and drop work.  That bug is long since fixed, but I wanted to improve the visual nature of the program to show colors more proportional to the number of times they occured in the file.  Let’s start back at program inception and show the progression.

rainbow early concept

The rounded corners were adapted from a Python GTK theme color previewer that someone posted on Planet GNOME once (I forget who or where!), and the grid layout is using some seriously sketchy math on my part to lay it out.  This is however a working concept, parsing colors from text input and putting them into the grid.

rainbow 1.0

That grid concept grew more and I eventually surrounded it with some options such as sorting by hue or count, and showing text labels of the hex colors. This was supposed to be released as 1.0, but never quite made it due to waiting for that Ruby/GTK bug to be fixed (as well as general apathy).

I then tried to modernize it by throwing out the grid concept and making the swatches proportional to the number of occurances read in the input, but I really didn’t know how to do that. I stumbled across the “bin packing problem” and tried to adapt it to rainbow, with disastrous results:

binfit

The problem with the bin packing solution is that you need to know the dimensions of the items you are trying to pack, in this case, the colors, and that’s not what I care about here.  I just care about the area the colors take up.

Then I remembered a Windows application that displayed file usage as some sort of divided squares. After some googling, I found it: TreeMap. I adapted some code from the open source Java implementation linked there and used it to form what is rainbow 2.0.  Give it a try!

by Dave Foster at March 09, 2010 03:38 AM

March 08, 2010

Dave Foster

l3ib.org haxpact begins tonight!

A number of l3ib.org members have agreed to spend every day of the next month haxing on something interesting and blagging about it: HAXPACT.  Today is the first day of haxpact, and those of you subscribed to Planet l3ib should see some activity by midnight tonight.  The goal of haxpact is to generate interest and momentum on projects that most of us are too lazy to keep up with.

First off, credit where credit is due, haxpact is copying the idea of Gabor Papp and friends from the livecoding world.

Second, rules for participants:

  • Every day, from 8 Mar to 7 Apr, you must create something and blag about it
  • You may use previously unpublished hax from before this month, as long as you blag about it
  • Anything considered creation counts: code, web pages, graphics, visualization, music
  • Stuck?  Learn something new like processing, fluxus, CFDG: all visual things with quick learning curves

I plan on making a progress report similar to django advent or RPI’s RCOS Dashboard (my alma mater!).

Participating l3ibs include myself, andrewy, Fitzsimmons, and jvd. If anyone unaffiliated with l3ib.org wishes to participate, send me an email and I’ll add you to the accumulator. You should drop by #l3ib on freenode too.

Happy haxing!

by Dave Foster at March 08, 2010 02:13 PM