back of a napkin

To XML or not to XML?

If you do any interaction between web applications, or even if you just use AJAX to query data in a background thread, you have to choose what format you want to use to send/receive data. When thinking about data wrappers there are usually about 4 obvious options:

XML. This is was the “right” way to send data, at least that’s what the kids have been telling me. It’s great when you have complicated data to send, like full HTML that you need to wrap into a container for an RSS reader. It’s a royal pain when you have to instantiate a huge XML parser that supports every crazy CDATA feature under the sun just to parse something like this:


<record>
<firstName>John</firstName>
<lastName>Smith</lastName>
<ordersThisYear>5</ordersThisYear>
</record>

Thankfully developments like simplexml have made the overhead for such operations much more manageable.

HTTP POST. While a lot of people might scoff at the POST, it’s surprising how often data interfaces use this method. Every credit card merchant provider I’ve integrated with has at least had a POST interface as an option, if not the only option. This is usually a pretty easy and lightweight solution, but you can run into limits with large records, and it’s far less easy to read as a human than XML or other options. Also, it’s not easy to speak in POST both ways. I can POST to you, but the data you give me back is probably going to be XML, JSON, etc.

I’ve seen another hybrid XML/POST method where I POST XML data to you, ala http://www.example.com/?xml=<record><firstName>John</firstName></record>

JSON. This is my new favorite data wrapper. One thing to love about JSON is that (as the name implies) you can easily bring your data into javascript. This means that you can have one interface on your backend for both bringing in data to your AJAX front-end and communicating with third parties via a web-facing API. If it’s formatted well it’s just as human-readable as XML.

Roll Your Own. Favorite of prima-donnas everywhere, the Roll Your Own method is usually a waste of time, but occasionally the best solution to a tough problem. Have a data method that has particularly special constraints? Maybe it’s time to roll your own, but probably not. There isn’t much that you can’t fit into one of the above methods, and the libraries already exist, saving you time (and hopefully money).

Pick your wrapper carefully, as you’ll end up supporting it forever when that one big customer is still “trying” to upgrade their system to work with your new API methods.

March 11, 2008 | Tags: , , , , | Comments (0)

Global Warming Update

Southern Baptists Fight Climate Change

Vatican lists “new sins,” including pollution

The Queen’s Take on Global Warming

Recent Twelve-month long drop in world temperatures wipes out a century of warming

March 10, 2008 | Tags: , , , | Comments (0)

Daylight Savings?

Today I join my Hawaiian brothers and sister in not changing our clocks. For the rest of you, here’s a study that questions the value of all that daylight “saved”.

March 9, 2008 | Tags: , | Comments (0)

Ethanol

A few items affected by the price of corn: milk (via feed costs), beer (less barley, etc. being grown), and just about every food you eat from the obvious - tortillas, corn chips - to the less obvious - soda, candy, and even some paper products.

When you’re buying food and wondering why the prices are 50% higher than 5 years ago, remember one thing: Hippies.

“One reason economists tend to be wary of mandated consumption levels is that they can have unintended consequences for related markets. Producing 15 billion gallons of conventional ethanol will require farmers to grow far more corn than they now do. And even with the increased harvest, biofuel production will consume around 45 percent of the U.S. corn crop, compared with 22 percent in 2007. The effects on the agricultural sector will be various and complex.”

Read The Whole Thing

http://freakonomics.blogs.nytimes.com/2008/03/07/the-ethanol-mess/

March 8, 2008 | Tags: , , | Comments (0)

Robots!

http://www.hackaday.com/2008/03/07/first-robotics-regional-kc-2008/

March 7, 2008 | Tags: , | Comments (0)

Ye Olde Universe

So if the universe isn’t really 13.73 billion years old, then why does it look that way?

Incentives

If my insurance pays for my medical bills, no matter what I do, what incentive do I have to make economically-motivated choices about how often to see the doctor or what kind of treatment to seek?

If I’m building an MRI machine that costs $10,000,000 to build, what motivation does the hospital have to negotiate a lower cost when they know they’re going to bill my insurance company, who in turn will pay every time?

Seems like separating the purchaser from the seller we’ve created a situation where costs can only rise.

March 4, 2008 | Tags: , | Comments (0)