Planet l3ib

March 19, 2010

fitzsimmons

Proof of concept BFBC2/HTTP Redirector

As noted by a reddit post, reddit doesn’t accept bfbc2:// style links. It’s probably going to be a fairly common problem. I wrote a proof of concept script that just does a simple 302 redirect from http to bfbc2. The base URI is http://fitzsimmons.ca/bfbc2/[server string here]. You can enter a server string raw, or URLified (with bfbc2:// on the front) and the webserver will automatically redirect you to a URI that the handler can pick up.

Here’s a couple examples:

http://fitzsimmons.ca/bfbc2/2503473115,3fc5640a-7dbb-415f-9e45-ba6cec0562dc,A Bacon Server

http://fitzsimmons.ca/bfbc2/bfbc2://3363010643,b652b484-4188-42ea-8885-50fc4991af5b,Reddit%20Unofficial%20Gaming%20Community-%20Chicago

This should allow you to link from places that only allow http style URIs. If this takes off at all, I’ll write a some info about what’s happening on the redirect page, for people that don’t have the handler set up.

by Fitzsimmons at March 19, 2010 03:47 AM

Dave Foster

FMCrests update – scaling issues

Continuing work with the FMCrests project today, I noticed a slight problem in the plan.  If the crests are going to be used at 16×16, there is significant scaling going on from the images I posted yesterday, and certain features start to get really crappy.  Observe this snippet from an HTML tester page:

The issues are with the small stripes on Hull’s orange and black logo, the stripes are all fuzzy and washed out, and also on any item with a white outline.  It seems to produce artifacts, and I’m not entirely sure why.  I’m using Imagemagick to convert the SVG files with the -background none parameter, which should make it as seamless as the black bordered ones, but no dice.

I don’t want to have to recreate the SVG for 16×16 icons exclusively, as I do want to have the full range of sizes available.  I might just eliminate the “thin” stripes option and allow only the “medium” and “fat” versions, those look acceptable at 16×16, but the white border issue is one I’ll have to fix no matter what.

Just for hahas I made an entire directory of crests out of random shapes/colors from a way too pastel-y palette, still cool to see it all work:

by Dave Foster at March 19, 2010 02:27 AM

fitzsimmons

BFBC2FavouriteManager Alpha 5

Download: alpha 5

Browse source

I’ve released the next alpha of BFBC2 to address issues with alpha4. Exception handler code has been added which should me debug tripwire’s problem. The regex has been updated to include server names with !s in them.

by Fitzsimmons at March 19, 2010 12:41 AM

March 18, 2010

Dave Foster

FMCrests – they live!

Results from yesterday’s ideas (implemented today!):

All generated by a command line script, modifying a single SVG file.  Much more to come…

by Dave Foster at March 18, 2010 03:52 AM

March 17, 2010

Dave Foster

New Project: FM-like crests

I’ve been playing with an idea in my head for a few months now, and finally had a chance to try out some ideas in Inkscape, and things look like they will work out.  So I’m happy to announce a new web project that I’m not sure will be live and open for everyone as it is computationally a bit expensive, but will be used in upcoming NFL Pick ‘em seasons.

First, the problem.  In the NFL pick’em, I implemented Gravatar support, but most of my userbase are not technically inclined and/or suspicious of having to sign up for things so many did not do so.  I used the Tango monkey icon, so most tables looked like this:

Just endless rows of monkeys!  I wanted people to use it in order to give themselves a slight visual cue – a color and shape is enough for my brain to associate it with people.  You see it with those auto-generated avatars on some blags (which actually don’t work too well for me, they all look too similar).

I “play” Football Manager every now and then, and I’m absolutely awful at it, but like a lot of the team management stuff it has.  I got a bit of inspiration from the game.  They don’t have the rights to use the English Premier League team crests, so they have these little generic icons which give a nod to the team’s colors and uniform designs, and I find them to be very stylish.  Here is an example:

Why not provide a service to generate crests similar to these?  It may not be able to replicate a real crest but it does a good job providing some uniqueness to each entry.  I see an independent web application (probably running on my staging server with sinatra for now) that will be tied into the NFL site so when people sign up for the upcoming season, it will let them edit a crest for their team.

I had to experiment with Inkscape a lot today to figure out how this would all work.  I plan on having one master SVG file with a bunch of different objects in them, and the webservice would copy that SVG file, edit the XML directly based on user supplied options, and use imagemagick to render to a 16×16 png icon.

In Inkscape, I drew a basic shield style crest to start and stroked it with a 100px outline (seems massive, it isn’t when you reduce the SVG to 16×16).  Then, create a colored object on top of that to show the design, covering the entire document.  Then, clone the shield path, move it to be the topmost object, select it and the color object, and do “Object->Clip->Set” to get a perfectly shaped colored shield.  Like this:

I plan on using a layered approach, having most objects with an opacity of 0, and having the web application turn them visible when needed (as well as combining the clip region etc).  The layers (and basic web app configuration params exposed) would be:

  • Base Shape (Shield, Circle, Squared Shield like Hull, Fancy Shield like Everton)
  • Design Layer (Solid, Two-Tone, Stripes of all widths and angles, four-square like a coat of arms)
  • Additional frills (maybe?) (A banner area below, crown or markings on top)

Of course you’d be able to configure colors on all layers, including borders/outlines.  I’m pretty excited about this, I hope to get going a bit more on it tomorrow.

by Dave Foster at March 17, 2010 02:28 AM

March 16, 2010

Dave Foster

Caching in Rails

Today I learned how to cache the results of my expensive calculation of group game predictions thanks to another amazing Railscast about caching.  It’s generally pretty simple to do, it’s basically a hash structure that just exists that you can use.  You set up how you want it to store in the backend via environment.rb, but by default it’s there and ready to go.  Example:

def expensive_calc_method

if Rails.cache.exist?("expensive_calc_method_cache")
return Rails.cache.read("expensive_calc_method_cache")
end

# otherwise, calc it, and save it in that key
end

Yes, a seriously contrived example, but I’m using it presently on my group predictions calculation method and now things return quite quickly.  Since the predictions are good for each group, one team takes care of four sets of predictions.

Todo in the future: learn how to use an observer (or a after_save override) to invalidate that cache.

by Dave Foster at March 16, 2010 02:59 AM

March 15, 2010

Dave Foster

Wordpress jumblings

I updated Wordpress this morning (boy they do make it pretty easy) and installed the SyntaxHighlighter Plus plugin. I edited an entry containing some Ruby code from a few days ago and it looks a lot better now.

Maybe someone can help: I’m looking for a plugin which lets you mark words or insert a placeholder of some kind which means “insert a link here before you publish”, and warns you before trying to publish with any of those items in there.  When writing these haxpact blags over the past few days, I usually just write then go back and link things, but that can be tedious.

by Dave Foster at March 15, 2010 02:25 PM

andrew

Hessian

Hessian is a binary protocol designed with communication between web services in mind. It can be used to do some interesting things, but here’s a pointless example instead.

On the server side (running in Resin in my case; with Resin you will also need a resin-web.xml):
public class HessianThing extends HessianServlet {
public String insult(String name)
{
return "silly " + name;
}
}

On the client side (Ruby here):
c = HessianClient.new("http://localhost:8080/hessianthing")
puts c.insult("you")

Outputs: “silly you”

The server interface’s (or implementation’s) javadoc is all that is needed for a protocol specification.

by andrewy at March 15, 2010 05:03 AM

Dave Foster

Sports related Rails DB model layouts

I mentioned previously that I’ve ran an NFL pick the winners site for the past three seasons, the most recent one on Rails.  I wanted to write a few words on some model related stuff for both this and the upcoming World Cup site.  I recently discovered the excellent Railroad gem and used it to generate model diagrams of both the NFL site and the (WIP) World Cup site.

Let’s start with the NFL site for an example of something current.  This has been cropped down to focus on what I want to talk about today: the games themselves.

So we’ve got a Team model which is for each NFL team, this is obviously needed and will be the same for the World Cup site.  The issue at hand here are the games.  As I see it, there are two options, the first modeled here.

There is a single model for all games: it contains the time, away and home teams (as references), and the score (recorded as “awayscore” and “homescore”).  The NFL releases its schedule early on, so all games can be preentered at the beginning of the season.  As games are played (or moved to different times), these Game models are updated and saved.

This is a reasonable system, and takes advantage of the fact we know the schedule ahead of time.  However, it has some downsides.  One such downside is that the relationship from a Team to a Game can go through either the “away” or “home” fields, meaning that to get all the Games for a Team, you have to get the “away” and “home” relations and combine them, sorting by game’s time.  This results in some slightly bigger queries than one might expect.

Another issue could be always updating the Game model itself.  I have yet to decide if that really is a bad thing or not, though.

for the World Cup let me see the setup in a different light.  In the World Cup, there are 64 total games: 48 group games (8 groups, 6 group games) and then 16 knockout stage games.  At the beginning we know the times and locations of every game that will be played, but we do not know the participants of the knockout games until the group games have been played.

This led me to think of another modeling of the situation, one with three models all linked together.  Visually:

In this setup, we have three classes working together with the Team model.  ScheduleGame contains all the information about the time/date of the games, and is the central place to find out information about a game through relations.  ScheduleMatchup contains the two teams who will be competing a game.  This consists of an away team and a home team, both relations to the Team model.  Finally, ScheduleResults are entered as the games complete.

This setup allows for no editing of model instances once they are created.  We can pre instantiate all ScheduleGames, and 48 ScheduleMatchups.  I made the ScheduleGames model completely read-only – they are instantiated through “rake db:seed” out of YAML fixtures.

This still does not solve the issue above of “away” and “home” and having to combine the two to get games for a team.  I debated making two ScheduleMatchups per game, taking a Team ref, Game ref, and “side” enum – Away or Home.  (Can you do enums in Rails models?  Haven’t tried before.  A simple boolean would work too, if you could remember which side meant Home or Away).

Any thoughts from the internets?  Is my quest to have no models be edited while the site is running just silly?  Would you combine the World Cup model into the NFL style model?

by Dave Foster at March 15, 2010 01:44 AM

Lame haxpact saturday

I spent the entire day working on our guest room:

  • Changing switches and plugs
  • Removing painting tape
  • Cleaning out old painting equipment
  • Getting paint off floor
  • Listening to The Killers on repeat

No this doesn’t quite count, but I had barely a chance to do anything Saturday but do work on this, so here’s a picture:

by Dave Foster at March 15, 2010 01:19 AM

March 13, 2010

Dave Foster

World Cup pick’em: Team group standing possibilities, part 2

Yesterday, I wrote about the World Cup pick’em site and doing some prediction “math” to figure out the likely group finishing positions of each team in a group.  Today, I planned to rewrite parts of it to speed it up.

My naive approach was to use transactions to create the db records needed so that a team could compute its group record, then back those transactions out to go on to the next possible finishes of games.  This was SLOW, and I knew it was going to be slow.  I began the rewrite by changing the way the group record was calculated.  Instead of relying solely on DB records, it allowed me to pass in an array of these records, and if that array wasn’t present, it would look them up in the DB for me.  This allowed me to create instances of models, but not save them to the DB, and just pass those into the Team.group_record method.  This reduction dropped individual database accesses when getting the group record down from about 16 or so to 2.  The savings are noticeable.

After making this change (and various other necessary changes based on this), I had the tools to rewrite the prediction methods.  That is when I discovered a major logical problem with the way I had written it yesterday.  It would generate all the possible scores 0..5 for both sides.. but then use that scoreline for BOTH games.  This meant that instead of 6^2 possibilities, there really existed 6^4 possibilities of games/scorelines.

Luckily I had stumbled across a neat collection of Ruby mixin methods for Arrays to do things like permutations, combinations, and (what I used) repeating permutations.  I dropped this code to config/initializers/array.rb:

class Array
  def permutations
      return [self] if size < 2
      perm = []
      each { |e| (self - [e]).permutations.each { |p| perm << ([e] + p) } }
      perm
  end

  def rep_perm_block(n)
    if n < 0
    elsif n == 0
      yield([])
    else
      rep_perm_block(n-1) do |x|
        each do |y|
          yield(x + [y])
        end
      end
    end
  end

  def rep_permutations(n)
    ret = []
    rep_perm_block(n) do |x|
      ret << x
    end
    ret
  end
end
I had a bit of trouble converting from yield style syntax to normal “build an array and return it” syntax, hence the helper method on the bottom.  Rails automatically loads anything in config/initializers/, so this mixin is always loaded for any Rails environment.  To generate all possible scorelines, I do this:
>> (0..5).to_a.rep_permutations(4)
=> [[0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 2], [0, 0, 0, 3],
   [0, 0, 0, 4], [0, 0, 0, 5], [0, 0, 1, 0], ...

And just pair them up to get scorelines for each of the two games.

This results in some improved numbers for USA’s chances:

=> [{"USA"=>[0.969135802469136, 0.0308641975308642, 0.0, 0.0]},
    {"ENG"=>[0.0308641975308642, 0.529320987654321, 0.266203703703704, 0.173611111111111]},
    {"SVN"=>[0.0, 0.335648148148148, 0.259259259259259, 0.405092592592593]},
    {"ALG"=>[0.0, 0.104166666666667, 0.474537037037037, 0.421296296296296]}]

There’s plenty more places this can be taken.  For instance, when there is an extremely low % chance for a team to finish in a spot, let’s say less than 2.5% or so, I could get a list of all the game scorelines that would generate that position, then find the commonality between them so it can be displayed in English e.g. “Egypt must win by 5 goals and Scotland must lose” or something like that.  There’s a lot more to do on this application though, not just this prediction model…

by Dave Foster at March 13, 2010 05:23 AM

March 12, 2010

fitzsimmons

That was fast; BFBC2FavouriteManager now has a real UI (Haxpact Day 5)

Alpha 4 download

Browse source

It turns out that creating UIs in Visual Studio is really easy. I created one for BFBC2FavouriteManager, so it now actually lives up to its name; it can now manage your favourites. Here’s a screenshot:

BFBC2FavouriteManager screenshot

The only thing missing now is that I’d like to add some signalling to the program so that the manager knows to reload the list when the link handler adds a new server. The link handler operates as a separate process, so I’m going to need IPC of some kind to achieve that.

Outside of that, I can’t think of any other features to add. I’m open to suggestions.

by Fitzsimmons at March 12, 2010 11:15 PM

BFBC2FavouriteManager Release (Haxpact Day 4)

Alpha release: download

browse source

It’s painfully difficult to add custom servers to Battlefield Bad Company 2. There’s no support for directly connecting via IP, and the server browser has a tendency to fail. Fortunately, the server strings for favourites and history are saved in a easily-parsed plaintext ini file, so it’s possible to hack in new servers to your favourites.

I’ve written this program to help make that process a little easier. It registers the bfbc2:// URI protocol, and when you click on a properly formatted link, it’ll automatically add that server to your favourites. Hopefully this will make sharing servers a bit easier on everyone.

The current release is alpha! Use at your own risk! It has nothing fancy like installers or icons! Read the readme in the archive for more information. I’m sure even this minimal program has a handful of bugs. Let me know what they are so I can fix them. I expect to see my regex reject a few server strings that are actually legit.

.NET 2.0 is a minimum requirement. If you don’t have that, you might as well get .NET 3.5 SP1 while you’re at it.

Anyway, here’s some sample links:

Reddit Unofficial Gaming Community- Chicago
–o Narwhal o– Ranked Rush 24/7
Hals n’ Pals – Mature Gaming Community

by Fitzsimmons at March 12, 2010 02:13 AM

Dave Foster

World Cup pick’em: Team group standing possibilities

The past three years I’ve been running a rather successful, private NFL pick the winners site.  The first two years it was a custom cobbled together PHP application, using raw database commands and everything.  Considering I wrote it two days before the season started, and still managed to sign up 20+ people, I was happy with its success.

This past year, I rewrote the site using Rails and fell in love, mostly with ActiveRecord.  It made working with databases fun again instead of feeling like such a chore.  I also really got into Ruby; it reminds me a lot of my Perl days back in college.  All little utility scripts I write these days are in it.

Anyway, I have a little less than 91 days until the 2010 World Cup starts, and I’ll be running a similar site, hopefully getting a good amount of people involved.  I’ve been writing the models for a while now, and today I implemented a feature I wanted to have for it.

For those unfamiliar, the World Cup is divided into two stages; the group stage and the knockout stage.  There are 8 groups, each with 4 teams, and each team in a group plays every other team in the group once.  3 points for a win, 1 point for a draw.  The top two teams in the group progress to the knockout stage.

Tonight, I wrote a helper method on the Team model which, after playing 2 of its 3 group games, can show you the probabilities of the team ending up in which place in the group. It looks like this:

>> cpcts = teams.map { |t| { t.abbr => t.get_possible_pcts } }
=> [{"USA"=>[0.916666666666667, 0.0833333333333333, 0.0, 0.0]},
   {"ENG"=>[0.0833333333333333, 0.5, 0.416666666666667, 0.0]},
   {"SVN"=>[0.0, 0.416666666666667, 0.166666666666667, 0.416666666666667]},
   {"ALG"=>[0.0, 0.0, 0.416666666666667, 0.583333333333333]}]

These numbers of course entirely based on simulated results for each team’s first games.  I like what I see here though, the US with a 91% chance of being group winners…

My database setup is slightly complicated, and entering a result for a game involves creating 3 records: one to record the score and two to indicate the winner/loser/tie-er of each game.  This meant for each possibility of the final games, I had to create these records and roll them back again.  I used a transaction and simply threw an exception, 36 times per team!

Also, if teams are level on points, there is a list of tiebreakers, much of them having to do with goal differences and goals scored, so in order to get a somewhat meaningful simulation, I had to simulate the final two games with each team involves scoring anywhere between 0 and 5 goals – thus the 36 transactions.  It’s a bit heavy, but if I can’t find a faster way I can always cache these results, as they would only change after a game has been played.

Plenty more to come about the WC pickem site as it develops.

by Dave Foster at March 12, 2010 02:13 AM

March 11, 2010

fitzsimmons

Haxpact Day 3

The regexp of horror is complete. I ran into some truncation problem with the ini library that I grabbed yesterday, because the buffer was too small. Thanks to the mercifully good debugger in Visual C#, I was able to track down the source of the truncation bug pretty quickly. The problem was that the author of the adaptor only allocated a buffer of 255. I’ve increased the limit to 2k, which should be way more than anyone should ever need (famous last words). It should be possible to test if the buffer was large enough, so I can probably future-proof the parser at some point by adding code that will dynamically increase the buffer size if the initial amount is too low. I’ll come back to that later.

I think the alpha is complete. Next on the list is to run some preliminary testing. Once that is done, I’ll make a source and binary release to the community.

Reddit Unofficial Gaming Community

by Fitzsimmons at March 11, 2010 07:34 PM

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