Skip to content

Introducing BreakBase.com

02-Jun-11

A few friends of mine and myself have been hard at work over the past few months on BreakBase. We finally opened the doors to the public on May 26th, 2011.

The idea behind BreakBase is simple: play your favorite board games with anyone you’d like. It’s totally free to use and you don’t even an account to start playing! So, head on over to BreakBase and start playing.

PS: There a lot more in store for BreakBase, including a ton of other games!

Facebook Psychic Mode

18-May-11

One thing that I’ve always enjoyed about the Pidgin chat client is the Psychic Mode plugin. This plugin basically detects when you receive an event from a given chat network that another user is typing a message to you. If you do not have a chat window open with that user, one will suddenly appear when plugin is triggered with the message “You feel a disturbance in the force…”.

After a little poking around on Facebook, I realized it’s pretty easy to add the same functionality into Facebook chat. I decided to write a simple Chrome extension to prototype the idea. You need to enable experimental extensions for any of the following code to work.


experimental.webInspector.resources.onFinished.addListener(function(resource){
  if (resource.request.url.match(/channel\.facebook\.com/)) {
    resource.getContent(function(content, encoding){
      if (content == null) return;

      if (content.match(/"type":"typ"/) && content.match(/"st":1/)) {
        var from = content.match(/"from":\d+/);

        experimental.webInspector.log('You sense a disturbance in the force from... ' + /\d+/.exec(from)[0]));

      }
    });
  }
});

 

When someone is typing a message to you, their browser will make a POST to ‘ajax/messaging/typ.php’. Facebook will then send your browser a message that contains an object with a ‘type’ property of ‘typ’ and ‘st’ property of 1. This extension simply looks for requests made to Facebook and attempts to find responses that meet said criteria.

This idea could perhaps be further flushed out via Firefox extensions. Chrome’s extension design and APIs make such a thing difficult (actively viewing requests and responses made by the browser). Such things are easier with Firefox where less restrictions and sandboxing for extensions are in place. Such an extension should likely even open the the chat tab with the target user (and of course display the ‘You sense a disturbance in the force from…’ message).

Introducing a New jQuery Google Maps Script

14-Apr-11

This script is similar to the one I wrote a few years back. This time however, it’s a jQuery plugin. Head on over to the github project for more details.

Flash ExternalInterface Internet Explorer Gotcha

14-Mar-10

Just learned this one the hard way. Apparently in Internet Explorer, a Flash application cannot use the “ExternalInterface” to add a callback named ‘play’. This list of reserved words also includes ‘stop’, ‘tags’, ‘item’ and possibly others.

Makes sense, but it took me a while to figure this one out since it is does not seem to be documented anywhere.

Full Tree Selects via Materialized Paths

03-Mar-09

At my internship I have been working on this really awesome in-house analytics systems.  One of the database tables used in this project behaves as a self-referential tree.  Since I am using Ruby on Rails for this project, I decided to go with the acts_as_tree plugin on this particular model.  This plugin adds various tree related methods with a minimal requirement that a foreign key column named “parent_id” exists in the corresponding table.

This plugin functioned as expected and something can certainly be said for sheer simplicity that this particular tree structure employs.  The complication arose when my application called for a full select of all the descendants from a given node.  This particular tree structure doesn’t support an efficient way to grab all of the corresponding descendant records.

More…