Archive for July, 2009

XiMpLode

Wednesday, July 29th, 2009

It has been said before, but it deserves repeating: XML is overused. And often, made unnecessarily over-complicated for the task. Take for instance the example “A Simple Soap Client“.

Here is the request:

<?xml version="1.0"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <SOAP-ENV:Body>
    <calculateFibonacci
      xmlns="http://namespaces.cafeconleche.org/xmljava/ch3/"
      type="xsi:positiveInteger">10</calculateFibonacci>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is the response:

<?xml version="1.0"?>
<SOAP-ENV:Envelope
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" />
  <SOAP-ENV:Body>
    <Fibonacci_Numbers
      xmlns="http://namespaces.cafeconleche.org/xmljava/ch3/">
      <fibonacci index="1">1</fibonacci>
      <fibonacci index="2">1</fibonacci>
      <fibonacci index="3">2</fibonacci>
      <fibonacci index="4">3</fibonacci>
      <fibonacci index="5">5</fibonacci>
      <fibonacci index="6">8</fibonacci>
      <fibonacci index="7">13</fibonacci>
      <fibonacci index="8">21</fibonacci>
      <fibonacci index="9">34</fibonacci>
      <fibonacci index="10">55</fibonacci>
    </Fibonacci_Numbers>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Dear $DEITY, why do we need to define a new data type to hold a list of integers? And what in the world is that “index” attribute doing there? IT’S A FUCKING LIST. This is like a real-life example of the old XML binary encoding joke:

<data>
  <binary>
    <bit index="0">0</bit>
    <bit index="1">0</bit>
    <bit index="2">1</bit>
    ...
    <bit index="n">1</bit>
  </binary>
</data>

It’s just sad…

For the sake of it, let’s compare to a JSON-RPC version: (not the epitome of efficiency mind you, but an order of magnitude better)

--> { "method": "calculateFibonacci", "params": [10,], "id": 1}
<-- { "result": [1,1,2,3,5,8,13,21,34,55], "error": null, "id": 1}

Which would you rather use? :)

Touchstone

Tuesday, July 21st, 2009

I was originally quite sceptical about the value of the Palm Pre’s Touchstone wireless charger accessory, esp. at its ridiculously high advertised price. However, now that I’ve had it for a week, I’m a total convert. It’s so nice to be able to just plunk the thing down at night and pick it up again in the morning without having to fumble with cords or those crappy plastic covers every cell phone manufacturer seems to love these days. Thanks Palm for coming back from the dead and giving Apple a good run for their money. :)

Tent Stakes in Sand

Thursday, July 2nd, 2009

My bivy tent is so low profile, I’ve never had a problem with wind when beach camping as long as I’ve had some oversized steel stakes ($2 for 4 at Walmart). But my dome tent is more problematic, as Lingyan and I learned in South Padre over memorial day.

So a little googling led me to “deadman anchors”, which are basically anything buried in the ground. A basic design is some angle iron and steel cable. So a trip to Lowes and a few minutes assembly, and I have the following:

deadman anchors

1 4ft piece of aluminium angle iron, cut into 4 6″ sections. 4 3ft sections of 1/16″ steel braded cable. 4 eye loops, and 4 pairs of cable crimps. <$15 total.

We’re beaching camping again this weekend at Mustang Island. Will update with how well they worked.


<Kered.org>   © Copyright 2000-2005 by Derek Anderson
Get Firefox