English

“The problem with defending the purity of the English language is that English is about as pure as a crib-house whore. We don’t just borrow words; on occasion, English has pursued other languages down alleyways to beat them unconscious and rifle their pockets for new vocabulary.” – James D. Nicoll

Posted in Humor, Random Thoughts. Comments Off

XSL Sucks!

XSL is like a nuclear weapon, it might serve a purpose but firing in anger is a bad idea and not terribly scalable.

If there’s one thing I have learned…

… it’s that a day that begins with a visit from the police is unlikely to to end well.

Posted in Humor, Random Thoughts. Comments Off

Is “Inversion of Control” a Bad Smell?

Is the request for an “Inversion of Control” a sign that the requester knows nothing about software design?

Posted in Computing, Software Development. Comments Off

A Goal for this Week: Fake Swine Flu

I get minor allergy reactions every spring, but I think this year I’ll just try to convince everyone it’s swine flu so I can be isolated and play with my computers without interruptions.

Posted in Humor. Comments Off

Does XSL Leak File Handles?

Does XSL Leak File Handles?

No, but it may appear to in some use cases. If you use redirect:write a lot for example:

   <redirect:write file="{$outfile}">
   ...
   </redirect:write>

The solution here is to bracket the write with open and close so that the engine does not have to implicitly track the open file stream:

   <redirect:open file="{$outfile}"/>
   <redirect:write file="{$outfile}">
   ...
   </redirect:write>
   <redirect:close file="{$outfile}"/>

Posted in Computing, Software Development, Web. Comments Off

How Do I Create Standards Compliant HTML in Java?

This is a common question and the answers out there are pretty sketchy. So I’m going to provide my example code:

package demo;

import java.io.FileOutputStream;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;

public class HTMLDemo {

   public static void main(String[] args) {
      FileOutputStream outputStream = null;
      
      try {
         Document newDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
         Element html = newDocument.createElement("html");
         Element head = newDocument.createElement("head");
         Element body = newDocument.createElement("body");
         
         Element p = newDocument.createElement("p");
         Text textNode = newDocument.createTextNode("Hello World");
            
         p.appendChild(textNode);
         body.appendChild(p);

         html.appendChild(head);
         html.appendChild(body);
         
         newDocument.appendChild(html);
         
         outputStream = new FileOutputStream("/demo.html");
         TransformerFactory.newInstance().newTransformer().transform(
               new DOMSource(newDocument), new StreamResult(outputStream));         
         
      } catch (Exception e) {
         e.printStackTrace();
      } finally {
         if (outputStream != null) {
            try {
               outputStream.close();
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
      }
   }
}

I leave things like doctype as an exercise to the reader.

Posted in Computing, Software Development, Web. Comments Off

The Three Phases of XSL Adoption

  1. This is cool and powerful! We should use it everywhere.
  2. This is a lot harder than it looks.
  3. IT BURNS! GET IT OUT! Aaaaaaaaaaah!
Posted in Computing, Software Development. Comments Off

Is Mobility the Next Big Thing?

It’s certainly looking that way. After all I’m posting this from a Blackberry!

This qwerty keyboard is great for all sorts of things.

Posted in Mobile. Comments Off

Beyond the Laptop?

It seems that everyone and their dog is creating handheld computing devices with WiFi and/or 3G GSM. I think that the migration away from latops has begun.

Posted in Computing, Mobile. Comments Off