Many of you will be familiar with the concept of two separate genus of man existing side by side in prehistoric times. I’m talking about Neanderthal and Homo-sapien. Recent studies have shown our homo-sapien ancestors may have contributed to the extinction of the neanderthals. It seems 3 factors were at play

  1. Neanderthals were unable to deal adequately with cold stress at a time of climactic change, 25-30,000 years ago
  2. Neanderthals needed to increase their energy intake and hence food consumption to keep warm. Homo-sapiens were more anatomically suited to keeping warm, making better use of increasingly scarce food resources
  3. Homo sapiens devised high-tech ways to keeping themselves warm including furs, boots etc.

However, in a remarkable paleoanthropological discovery, researchers have unearthed the remains of a dwarf human species that survived on the Indonesian island of Flores until just 13,000 years ago. This significantly extends the known range of physical variation in the homo-sapien genus and reveals that we shared the planet with other humans much more recently than previously believed.
This bantam human genus, dubbed Homo-floresiensis, stood around a metre tall and had a head slightly bigger than a grapefruit. Despite it’s compact cranium it developed sophisticated tools such as micro-blades, perforators and barbs. As the article points out islands have produced giants aswell as dwarves as evidenced by the giant komodo dragon lizard. Anyway, I keep wondering what we’ll learn about the evolution of man, the full extent of our genus and the factors that both shaped us and caused homo-sapien to prevail. It’s also an interesting assertion of the effect of genetic and environmental isolation on genetic development. More on this at a later date…


MySql & XML Output

Pulled this from DECAFBAD… Nice tasty article all about -X command line switch in mysql. Wonderful I thought. XML based power in the worlds most popular and free relational database. I heard the sounds of dreams coming true.. well maybe 😉 There had to be a catch however.

However, just when I thought everything was peachy I started playing with this feature with less than spectacular results. Some intensive googling yielded the answer.
It seems that using the -X command line option for exporting the data in XML format produces invalid XML. It assumes XML escaped data in the DB!.. On what grounds??? Mysql only encloses the query results in XML element tags, but doesn’t do encoding of the contents inside the tags.

In XML, if you want to use one of the characters <, >, &, etc. inside an element tag is not valid. If you want to use one of those characters, you have to use the respective entity instead. Mysql doesn’t seem to do that, so when selecting tagged data or markup like “<foo>red & green<&#47foo>” with the -X command line option will always lead to invalid XML.
An uncool workaround would be to perform some string replacements for every selected column when using the -X option:

  • replace all & by &amp;
  • replace all < by &lt;
  • replace all > by &gt;
  • replace all " by &quot;
  • replace all ' by &#39;

Other stuff, like language specific characters (umlauts etc.) has to be encoded as well or has to be handled by defining or applying a different character set when post processing the XML output.

So the command produces invalid XML as invalid chars haven’t been escaped… Now this is a shame as writing some code to escape it in the db server coulda been done quite easily. A combination of escapes and using different charsets (perhaps as a command line option) along the lines of mysql --xml --xmlcharset=mycharset would be sweet. We’ll see what happens in the next release