January 2008


Uncategorized28 Jan 2008 06:18 am

5-week old serval kittens playing. They’re as big as adult domestic cats!

That Husky seems to like that ferocious kitten:

Uncategorized27 Jan 2008 10:05 am

That puppy is nibbling on the cat’s ears!

Uncategorized27 Jan 2008 05:48 am

Mutegi is an F1 Savannah Cat. Savannah Cats are the result of crossbreeding domestic cats with Servals. F1 generation Savannah Cats are 50% Serval, genetically speaking!

programming18 Jan 2008 11:03 am

This site gets very little traffic, but if you actually search for “hamster in a wheel running in circles” this site will be in the search results.  It means that this site has a very small and mostly accidental audience (probably pet hamster owners, I apologize to them, sigh…)

Blogging hasn’t been as inspiring as I hoped.  I usually have no idea what to write, so I end up posting links to cute YouTube videos.

My previous article (on XML Beans) provides information that I know people are looking for; I’d say it’s my first “real article.”  The last 3 lines of code took a long time to figure out and I’m sure it could be of help to other people.  At this point, though, unless someone proofreads the article, I’m reluctant to actually post links to that article.

Writing’s hard, I need practice.  My main goal at this point is to learn to be concise and to-the-point.  Following this philosophy, I just deleted two-thirds of this article.  Maybe I’ll revise it again tomorrow and cut it down further!

Uncategorized18 Jan 2008 06:25 am

This article explains how to add an XmlObject to another XmlObject. In this case, the parent XmlObject has children of type <xs:any>. The tricky part is that XML Beans does not create accessor methods for
<xs:any> elements.

In my case, I was creating a SOAP response. Here’s the snippet that creates a SOAP fault:

// SOAP schema XML Bean imports
import org.xmlsoap.schemas.soap.envelope.Body;
import org.xmlsoap.schemas.soap.envelope.Detail;
import org.xmlsoap.schemas.soap.envelope.Envelope;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
import org.xmlsoap.schemas.soap.envelope.Fault;
import org.xmlsoap.schemas.soap.envelope.FaultDocument;
import org.xmlsoap.schemas.soap.envelope.Header;

// DOM Imports
import org.w3c.dom.Element;
import org.w3c.dom.Node;... now the real code

// the XML document looks like this:
    <envelope>
        <body>
            <fault>
                ...
            </fault>
        </body>
    <envelope>

// create envelope and body
EnvelopeDocument responseEnv = EnvelopeDocument.Factory.newInstance();
Body responseBody = responseEnv.addNewEnvelope().addNewBody();

// create fault, must be a FaultTDocument. If you just create a
// Fault instance, it will be an an XML fragment, nothing will work
FaultDocument faultDoc = FaultDocument.Factory.newInstance();
Fault fault = faultDoc.addNewFault();
fault.setFaultcode(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Client"));

... some more code that populates the fault object

// now the tricky part
Node bodyNode = responseBody.getDomNode();
importedNode = bodyNode.getOwnerDocument().importNode(faultDoc.getFault().getDomNode(), true);
bodyNode.appendChild(importedNode);

The tricky part is the last 3 lines of code, I used the DOM API, not the XML Beans API, to add an XmlObject instance as a child of another XmlObject instance. Also, make sure that the node you import comes from an element that is part of a document, not just a parent-less XmlObject instance (it would be one of those useless XML fragments, frankly that part of the API is counterintuitive.)

Uncategorized17 Jan 2008 08:09 pm

http://www.beliefnet.com/story/76/story_7665_1.html

Uncategorized16 Jan 2008 02:49 pm

http://news.yahoo.com/s/nm/20080116/od_nm/clowns_odd_dc

Uncategorized16 Jan 2008 06:18 am

The year 2038 problem (also known as “Unix Millennium bug”) will cause problems because time is represented as the number of seconds since January 1, 1970 on Unix and most other systems based on the C programming language.  The latest time that a 32-bit system can represent is January 19, 2038.

The electric grid will go down, our toasters will explode, VCRs won’t work, the sewers will overflow, planes will crash!!!!!!!  What are we going to do???

Once we’ve survived Y2K38, here comes Y2.07K!  It’s hopeless, let’s just give up and go back to stone knives and bearskins.

Uncategorized03 Jan 2008 02:03 pm