Archive for the ‘quick tips’ Category

Linux: Cowsay and Fortune

Sunday, October 4th, 2020

So I got a “new” laptop which onto which I’ve installed Ubuntu 20.04 LTS (Focal Fossa).

What’s the first thing I needing done? Docker? Node? Even plain old Java? Nope, Cowsay and Fortune!

Takes my login from



/ Be security conscious -- National \
\ defense is at stake.              /
       \   ^__^
        \  (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Oh and…

:~$ tail -1 ~/.bashrc
fortune -s | cowsay

Tags: ,
Posted in quick tips | No Comments »

The Processing Instruction Target Matching “[xX][mM][lL]” is Not Allowed

Friday, June 24th, 2011


When parsing XML you receive the following error:

...The Processing Instruction Target Matching "[xX][mM][lL]" is Not Allowed...


The chances are you have some sort of whitespace (or control character) infront of your XML declaration:

..<?xml version="1.0" encoding="utf-8"?>

It may even be that you have more than one XML declaration in the document..!

Posted in quick tips | No Comments »

Read a File as String with Java

Thursday, June 16th, 2011


I’m always Googling for a way to do this. This seems to be the best “idiomatic” solution I’ve found. So without further ado…


public String readFile(String path) throws IOException {
    FileInputStream stream = new FileInputStream(new File(path));
        FileChannel fc = stream.getChannel();
        MappedByteBuffer bb =, 0, fc.size());
        return Charset.defaultCharset().decode(bb).toString();
    finally {

Posted in Development, How to's, quick tips | No Comments »

View Source of Oracle Trigger

Wednesday, May 11th, 2011

select trigger_body from user_triggers where trigger_name = 'XXXXX'

Tags: ,
Posted in quick tips | No Comments »

DB2’s equivalent of Oracle’s “dual”

Wednesday, February 16th, 2011

This is really a quick example of DB2’s equivalent of Oracle’s “dual”

Get current date/time in DB2

select current date from sysibm.sysdummy1 

Posted in Development, quick tips | No Comments »