Ender's Game is a Science Fiction novel by Orson Scott Card about Andrew "Ender" Wiggin, an almost-super-human child in terms of shear mental ability and military strategy. Ender is selected at an early age to enroll in an elite military training program in order to save humanity from an alien race of insect-like creatures known as "buggers". Throughout the book Ender is put through a mental hell, constantly pushed beyond the previously thought human limits to prove his self worth to save humanity from destruction.
Ender's Game is regarded as a SciFi classic for many good reasons. Card is an ingenious author, combining military strategy and tactics with commentary on many human related dilemmas such as over-population and resulting controls, the capabilities and limits of human potential as well as the technology we build, relationships between two vastly different intelligent species who can't so much as communicate with each other in any physical means, and many other profound philosophical insights. Throughout the book, human and political nature is explored through Ender's siblings, Peter and Valentine, who while Ender is in space training for his destiny to come, discuss and manipulate the subtle political structure of the future which the story takes place. Relationships between vastly different emotions such as love and hate are postulated, and Card dives deep into exploring the human psyche, especially when when humans are forced into uncertain situations for long periods at a time. By the end of the novel, the author wraps everything up quite nicely into a very complete conclusion, while leaving the reader thinking about how one would behave in the same situations. The reader won't agree with all of Ender's and the other characters actions in the novel, but thats partially the point, to point out what it means to be human and some of the mistakes we make,
Everything being said, I did find at some points, especially earlier on, that the pace was a tad slow. Various scenes, including the many war games in played in a vast, gravity-less battle room, are used to construct various aspects of Ender's personality and way of thinking, but could have potentially been combined. Conversely, a lot is revealed at the end of the book, particularly the last three chapters, and while its is common nature not to reveal all the subtleties of a novel until the very end of the plot, the reader finds himself rereading the same paragraph a few times due to the plethora of information contained.
That being said, the book wraps up very nicely, with all the hanging threads taken care of (save a significant one or two) leaving the reader satisfied. Any reader will have to make the choice at this point to leave the series as it, having completed a well written and deep novel, or to continue and find out more (which is what I will be doing ;-) ). Overall, I very much recommend Ender's Game for SciFi and Military enthusiasts alike, as well as the general literary fan.
Since its been over a month since my last post, I feel one is long overdue. Today's entry is about XPath, a language that allows for the traversal / retrieval of nodes in an XML document (note that at the time of writing this XPath 2.0; which adds additional type logic, operators, among other things; is now an official standard, but I will not dive into the additional features in this entry).
For this document, lets assume you are working on, and want to traverse the following HTML document (yes I realize HTML is not a strict subset of XML but for the purpose of the article, and in actual practice, XPath can be used to traverse html documents (and is often employed to do so, see my write up on integrating the Selenium web interface test suite into my current professional project oVirt))
<div id="intro" class="content">Would you like to know something about me?</div>
<p>My favorite foods</p>
Similar to Unix-like operating systems "/" indicates root, but unlike standard filesystems "/" does not correspond to any particular node. To start with something easy, to get the title of the web page, one would simply pass the following XPath into the search method of the library they are using
which would return the "Hello World" string. We could use a similar, full path lookup to retrieve the contents of the introduction div, but rather a simpler method would be to employ the "self or descendent" directive "//" in conjunction with the attribute directive "@" to find the div with the "intro" id attribute like so
This essentially tells XPath to search for a div with the "intro" id starting at the root element. Note there are many ways to accomplish the same thing, for example we would have started at the body element and ignore any divs elsewhere in the document (once again, that wouldn't appear in standard html but bear with me for this example) like so
If multiple elements match, for example when looking up list elements that appear in any unordered list like so,
A list of elements will be returned, or alternatively you can specify an index to retrieve a specified element (very important note indices are 1 based, eg index '0' is invalid) like so
If you do not have a definitive element type in mind, you can match 'all elements' using the '*' operator. For example to return both the paragraph and unordered list under the second div in the body, you would use the following statement
XPath also provides many functions useful in retrieving and transforming information stored in the document (technically all the aformentioned locators / specifiers are simply shorthand abbreviations for various XPath functions), for example to retrieve the number of list elements in the document, one could use the count function
Or to return div containing only text data (eg not other nodes) one would
which would resolve to the first / 'intro' div in the example.
I have barely touched upon the power of XPath in this guide, and have not even discussed additions which XPath 2.0 adds to the language, but hopefully this will give you a starting point which to expand and dive into the universe of XML traversal / lookup.