Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

02 September, 2014

Boris bike tidal flow

Docking status information is available in XML for the London bike hire scheme ("Boris bikes").

I made this video (AVI) (animated GIF) of tidal flow as areas get busy or empty during the day, an animated version of the image below using data from Saturday evening until Tuesday lunchtime.

Each point represents a docking station. You can see how the shape of this cloud sits over London on this Google map. Blue means empty docking station. Red means full docking station. Light blue and light red mean almost empty and almost full, respectively.

Not so much on Saturday and Sunday, but clearly (to me) on Monday you can see a 9am rush hour move of bikes into the centre, and a 5pm move of bikes back out to the edges again.

13 June, 2013

mis-XML

There is a style of XML which I find quite frustrating. Here's a fragment:

    <mbeanNode>
      <name>java.lang:type=Memory
      <attributes>
        <attribute>
          <name>HeapMemoryUsage</name>
          <formattedValue>{committed=442433536, init=257990592, max=3670540288, used=103328176}</formattedValue>
         </attribute>
         <attribute>
           <name>NonHeapMemoryUsage</name>
           <formattedValue>{committed=57802752, init=24313856, max=224395264, used=57610720}</formattedValue></attribute>

This particular example came from XML output of javamelody, although I've encountered this misuse on a number of other occasions.

Most annoying is the guerilla formatting inside the <formattedValue> tag. XML already provides plenty of ways to pair up names and values, so why make a guerilla format that I now need to parse myself?

A smaller annoyance is the use of <attribute><key>X</key><value>V</value></attribute> style. XML already provides a mechanism for tagging a named key onto a value: <key>value</key>. The only defence of this I've heard is that it makes it easier to comply with a schema; but alas you miss the point and are also wrong. Wrong, because I can make an XML schema that accepts arbitrary XML tags; and missing the point, because the schema doesn't help much if all its doing is enforcing a skeleton.

I think all of this comes from fairly naive serialization of improperly defined application-internal data structures. suck.