Go language

Just watched “Another Go at Language Design” by Rob Pike from Google.  I had not heard of the Go language prior to this, and now I’m very intrigued.  The main points that I find interesting:

  • It’s a compiled language for speed, yet flexible Interface mechanism supports a (type-safe) duck-typing style I really miss when doing C/C++/Java
  • Goroutines + channels provide concurrency in the language
  • It’s designed to be good a system-level programming tasks

Admittedly, I’m not enamored with the syntax.  I’ve grown very fond of the aesthetics of Ruby, and Go seems like a big step backward on first impression.

I’ll add that to stack of things to learn more about.  It may be a good fit for upcoming projects…

BTW — I highly recommend the EE380 Computer Systems Colloquium, a weekly lecture series held at Stanford during the academic year.  It’s been a while since I viewed any of the presentations, and this reminded me of the interesting topics they cover.  I hope to be a regular viewer again.

Comments

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

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">
<html>
<head>
<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);
}
</script>
</head>
<body>
<div id=”my_chart”></div>
</body>
</html>

Comments

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

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

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

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

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