development

In Defense of COS, or Why I Love JSON and Hate XML

I don’t miss XML

I don’t miss XML. XML would only have been a quarter as bad as it is if it didn’t introduce the ambiguity of trying to decide whether data should be an attribute of an element or the value of an element.

xml
1
<element attribute="attribute-value">value</element>

It would only be half bad if it didn’t introduce the unwieldy syntax of triangle brackets and an end-of-comment closing syntax that use more triangle brackets and a second copy of the element name. It would only be three quarters bad if the syntax for comments didn’t also use triangle brackets, along with a few hyphens and a required closure at the end of each line.

Read More

Express 3 Migration Issues

Today I migrated a web site from Express 2.5 to Express 3.0.0rc3. This is a non backward compatible version change. Express has a Migrating from 2.x to 3.x wiki page, but it doesn’t quite leave you prepared for the more time consuming incompatibilities that you’ll need to fix. I’ll enumerate some of these differences here. Note that some of these issues may be ironed out in later releases of Express.

Read More

Generating Jekyll pages from data

I wrote a Jekyll-generated site for Botanic Organic that sells products and includes product and ingredient pages that are generated from data. Jekyll is a blog aware, static site generator. Botanic Organic’s site was forked off of Octopress, which uses Jekyll but adds a few plugins and styles.

Read More

curl, JSON and pretty print

Curl is a wonderful thing. The output can be a bit messy, however.

This python pipe pretty prints your otherwise messy JSON output.

1
$ curl -H 'Accept: application/json' http://localhost:3001/myserver/cmd | python -mjson.tool

Or, using Ruby, if necessary run

1
sudo gem install json

then pipe your output.

1
cat myfile.json | prettify_json.rb

An even nicer solution is this node script, written specifically to handle curl output. You’ll need to make sure you’ve installed Node.js before you can use it.

ActionScript reflection based JSON validation and conversion to VO class

For an AIR application I had a need/desire to convert JSON generic Object instances to a tree of strongly types VO objects. The best post I could find on the subject did not go so far as to convert the Object tree to a strongly typed tree of objects that I’ve spec’d out. This post shows how I did this and I provide my conversion code.

Read More

AIR Badge Installer Gotchas

If you want to pass parameters down to your application through the badge installer launch parameters:

  1. Make sure you set allowBrowserInvocation to true in your application descriptor file (appname-app.xml). Doh!

  2. Encode your launch arguments. A lot of characters are not permited.

Read More

Rails: Installing a gem to plug-ins

Installing a gem to vendor/gems is easy. The basic steps are:

  1. Unpack the gem
1
2
$ cd vendor/gems
$ gem unpack oauth
  1. Add the gem to your config load path in config/environment.rb
1
2
3
4
5

config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
File.directory?(lib = "#{dir}/lib") ? lib : dir
end

Benefits are easier debugging and removing gem dependencies.

Click here for more details.

Configuring Eclipse for Servlet and Flex Development

During the past few months I’ve been doing Flex and Servlet development in Eclipse on a WinXP machine and simultaneously on a Macbook Pro running Mac OS 10.4. The tools and set up are pretty much the same on Win and Mac.

For newbies, figuring out the correct tools to use and how to configure them can take a bit of time and a bit of guess work. It isn’t always obvious from searches on the web which are the best options, and what information is up to date. I started capturing configuration details on an internal wiki, because we have a few people on my project at Adobe that have needed to simultaneously come up to speed on these procedures. I’ve publicly posted this information here to help others that may be in the same situation that I was a few months ago.

Click here to see the full article