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
:~$
to
___________________________________ / Be security conscious -- National \ \ defense is at stake. / ----------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || :~$
Oh and…
:~$ tail -1 ~/.bashrc fortune -s | cowsay
Tags: linux, ubuntu
Posted in quick tips | No Comments »
The Processing Instruction Target Matching “[xX][mM][lL]” is Not Allowed
Friday, June 24th, 2011
Background
When parsing XML you receive the following error:
...The Processing Instruction Target Matching "[xX][mM][lL]" is Not Allowed...
Solution
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..!
Tags: xml
Posted in quick tips | No Comments »
Read a File as String with Java
Thursday, June 16th, 2011
Introduction
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…
Example
public String readFile(String path) throws IOException { FileInputStream stream = new FileInputStream(new File(path)); try{ FileChannel fc = stream.getChannel(); MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); return Charset.defaultCharset().decode(bb).toString(); } finally { stream.close(); } }
Tags: java
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: oracle, sql
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
Tags: DB2
Posted in Development, quick tips | No Comments »