Moving on from Intel

I’m down to one week left at Intel.  I’m looking forward to the next step in my career / personal development — I’ll be taking a position at IntelePeer starting in May.

This represents a big change in a number of ways.  It’s a small company of ~70 people, in a totally new industry for me (telecom).  I’ll be doing more focused software development than I’ve done for a while at Intel.  And while I will still be in Fort Collins, I’m going to be telecommuting primarily.

There’s plenty I will miss about Intel, but I think it’s time to move on.  I’ve been here (HP / Intel) since getting out of school (12 years), and the longer I stay, the harder it will be to look into other opportunities.  Besides, one of the core Intel values is supposed to be risk taking, right?


Comments (0)


OpenFlashChart — loading data via javascript

OFC2 sample chart

I’m just getting started using OFC2 to render charts for a project.  I specifically want to include all the data in the initial page load, rather than require another request to the server (the standard way to do it w/ OFC2).  The library provides a mechanism for this, but it is described as hard, ‘for advanced users only‘.  After slogging through it for a few hours today, I finally arrived at the key.

The data to be loaded in to a chart has to be passed to the OFC2 swf object as a JSON string (not a javascript object).  The OFC2 download package includes the json2.js javascript library to create JSON string from objects.  The problem is, it produces bad output.

Just as example, here a simple javascript object that defines a basic OFC2 bar chart (the image at the start of this post):

var d = { elements: [{type:'bar_glass',values:[1,2,4,8,4,2,1]}],
title: { text: "test data" } };

JSON.stringify(d) produces the following:

{"elements":"[{\"type\": \"bar_glass\", \"values\": [1, 2, 4, 8, 4, 2, 1]}]","title":{"text":"test data"}}

The array value for “elements” was turned into a quoted string.  When this JSON is parsed, it will be interpreted as a quoted string, not an array.  Fail.

The latest OFC2 version as of this writing (Lug Wyrm Charmer) contains a json2.js version dated 2008-03-24.  The latest version from json.org is dated 2009-09-29, but it’s still broken.  Use a better javascript library, such as prototype — In my testing, using the Object.toJSON() method from prototype instead of JSON.stringify() worked perfectly.

So here’s a full working example (apologies for the formatting):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>ofc test</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript">
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "250", "200", "9.0.0",
"expressInstall.swf", {"get-data":"load_data"});

function load_data() {
var data = { elements: [{type:'bar_glass',values:[1,2,4,8,4,2,1]}],
title: { text: “test data” } };
return Object.toJSON(data);
<div id=”my_chart”></div>


Comments (0)


windows change caps lock into a control key

This is old stuff, but I recently had to re-find this:

Change Caps Lock into a Control key: caps_lock_to_control.reg (via johnhaller.com)

That’s one of the first thing that goes on when I setup WinXP.  I have zero experience with Vista.  I wonder what changes for Win7?


Comments (0)


CowPotato at BDNT

I presented CowPotato at the BDNT meetup in Boulder tonight — it went well except for having no audio for the gameplay video. The crowd seemed to enjoy it all the same. Generated some good laughs, and some good feedback. Too bad I was probably the only Android user in the house…

CowPotato is nowhere near done. We had to rush to finish up a bunch of things to submit to ADC2. We plan to continue polishing it and adding gameplay features over the coming weeks. No plan yet on how / if / when to start charging or otherwise generate some revenue.

And hopefully in the near future I’m going to start putting some content up over on CrazyheadGames.com — some additional games, some android tutorials, etc.


Comments (4)


CowPotato game for Android — beta demo video

I’ve been working on CowPotato for Android, with the guys at Froogloid. We’re getting close to being done, driving to the deadline for the Android Developer Challenge 2 (Aug 31).

Restarting with Java from scratch, OpenGL ES, Android, etc — there’s been a big learning curve to get to this point. I’m looking forward to working on more Android games to comes.


Comments (0)


Fixed my ubuntu sound problems

I have been enjoying my recent upgrade to Ubuntu 9.04. Suddenly started having sound problems, however — no idea how/when/why this started happening.

But the symptom is that all sound stops, and I just hear static when sound is supposed to be playing. Well I finally found the answer: turn up the volume. Seems the PCM device gets muted somehow, and ALSA produces static instead of nothing in that case. Go figure. Turning the volume up for PCM in the ALSA mixer gets things back to normal.


Comments (1)


I have been enjoying my recent upgrade to Ubuntu 9.04. Suddenly started having sound problems, however — no idea how/when/why this started happening.

But the symptom is that all sound stops, and I just hear static when sound is supposed to be playing. Well I finally found the answer: turn up the volume. Seems the PCM device gets muted somehow, and ALSA produces static instead of nothing in that case. Go figure. Turning the volume up for PCM in the ALSA mixer gets things back to normal.


Comments (0)


Alibaba OpenGL game project source code

alibaba game project for Stanford cs148

'alibaba' game project for Stanford cs148

I’m working on some OpenGL-based games for Android, so I pulled out code for a project I did for a class at Stanford in 2003 — my first and only game to date.  It was fun to reminisce, and perhaps someone else might have some fun with the code (see below).

From the README, describing the basics of the game:

You control a flying magic carpet, pursuing Ali Baba and his 40
thieves across the desert.  The object is to kill all of the thieves,
by lobbing exploding coconuts at them, before they make it to the
safety of their cave.

And of course this great memory, also from the README:

Just for humor: my two sons (5 & 3) were very fascinated with the
game, anxiously following the development.  One night they were
sitting on my lap actually playing it, when the 5-yr-old puked up all
over my desk, keyboard, red book, laptop, etc (vertigo?)  That was a
bit of a setback :)

The sacrifices we make to bring you great games…

I had to hack the source a bit to build with more recent versions of g++ etc.  I’ve included two tarballs with the full source plus binaries for two platforms:

Enjoy! You’re free to use the code however you want (except to claim it as your own and submit it for another school project)

BTW — Nothing there yet, but I’ll be putting the Android games over on CrazyheadGames.com


Comments (0)


Migrating rails app from sqlite to mysql

I run a pretty simple rails site for pickup ultimate games in Fort Collins, hosted at Dreamhost. For many months, it had been working just fine using sqlite for the database. Somehow in the last few weeks, it developed a locking issue and has just not worked right since.

Why the locking issue all of a sudden? Perhaps it experienced concurrent requests for the first time? Maybe some change to dreamhost’s NFS setup, or the mod_rails/passenger setup? Who knows. But whatever the reason, sqlite was no longer working, so I migrated the site to mysql.

Two steps involved: create the mysql databases, and transfer the data from the sqlite dbs to the mysql db’s. I was using sqlite because it was easy, essentially no overhead for setup / admin (at a cost, obviously). I created a devel and test db on my mysql instance at home, and the production db on the dreamhost-provided mysql server. Updated the rails config to match.

Migrating the data was the only part with any gotchas. In theory, something like this should work:

echo .dump | sqlite3 production.sqlite3 |  \
    mysql -u username --password="passwd" -h myhost production

Dump from sqlite, import directly into mysql. The issue is some differences in the SQL dialect between sqlite and mysql. See that article at StackOverflow for the details, but it ended up being a matter of a few minor edits to be able to import the dump into the new mysql production database.

I expect many more months of smooth sailing from here…


Comments (0)


Outlook VBA macro to post email body to the web

At the request of one of my managers, I looked into the possibility of using Outlook to automatically post the contents of an incoming email to a website (an internal group wiki in this case). We previously used procmail to accomplish this task, but now that all email has migrated to Outlook/Exchange, that’s no longer an option. It turns out this is pretty easy to accomplish using the VisualBasic for Applications (VBA) macro capabilities built-in to Outlook.

The basic pieces to make this work:

  1. A Rule in Outlook that matches the specific email criteria, and runs a script (Outlook Macro)
  2. The Outlook macro which pulls out the message body and posts to a web site
  3. The web site / CGI to handle the incoming message

Setup the Outlook Rule

The first part is the easiest – define a rule with filters to match specific messages that should be forwarded onto the web site. The filter criteria should be as specific as possible — not generally a good idea to be posting arbitrary email messages onto a website. The action should be “run a script”. The ‘script’ has to be a macro with a specific signature, like this:

Sub PublishMsgToWeb(Msg As Outlook.MailItem)

That defines a macro specifically intended to handle Outlook message (Outlook.MailItem instances).

Define the macro to post to the web

The macro is pretty simple: ready the message body and any other data of interest from the Outlook.MailItem object, package the data up into an HTTP POST request, and send it off.

Sub PublishMsgToWeb(Msg As Outlook.MailItem)
    Dim URL As String
    URL = "http://example.com/post-msg-from-outlook.cgi"

    Dim Subj As String, Body As String
    Subj = Msg.Subject
    Body = Msg.HTMLBody

    PublishMsgToURL URL, Subj, Body
End Sub

Sub PublishMsgToURL(ByVal URL As String, Subject As String, Body As String)
    Set xhr = CreateObject("MSXML2.XMLHTTP")
    xhr.Open "POST", URL, False
    xhr.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    data = "subj=" & URLEncode(Subject) & "&" & "body=" & URLEncode(Body)
    xhr.Send data
End Sub

I split the macro into two different pieces for testability. The HTTP POST request is done by instantiating an MSXML2.XMLHTTP request. Web services in Outlook seems to be a bit of a muddy subject, with multiple flavors of XmlHttpRequest. MSXML2.XMLHTTP is what I found to work in my version of Outlook 2003. YMMV.

The only real trick to putting the request together is in encoding the data as “application/x-www-form-urlencoded”, the format typically used for POST requests. I used the URLEncode() VBA function to encoded each piece, then joined them together into a normal query string


This example just sends the message subject and body. Obviously there has to be an agreeement between the macro and the receiving website as to what data the request body should contain. Date, sender, and others are readily accessible from the Outlook.MailItem.

Define the CGI on the website to receive the message

For the purpose of this example, I just put together a simple CGI script in Ruby:

#!/usr/env/bin ruby
require 'cgi'
cgi = CGI.new

subj = cgi['subj']
body = cgi['body']

File.open("msg.html",'w') do |fh|
fh << <<END
<title>Outlook msg: #{subj}</title>

print cgi.header( "type" => 'text/plain' )
print "ok\n"

This just saves the message content to a static html file that can then be viewed in a browser. The script just returns a simple ‘ok’ message back to the caller, but that will not actually be seen by anyone since the Outlook macro handles this transaction behind the scene.

So there’s the basic framework for posting email to the web using the built-in Outlook rules and macro capabilities. Whether or not this is actually a good idea is another question altogether…


Comments (2)