Monday, October 02, 2006


Updated Scheduling Program

Thursday, September 14, 2006



yearly calendar with 24 hr timetable

Tuesday, September 05, 2006


THE PROGRAMMER'S QUICK GUIDE TO THE LANGUAGES

The proliferation of modern programming languages (all of which seem to have stolen countless features from one another) sometimes makes it difficult to remember which one you're currently using. This handy reference is offered as a public service to help programmers who find themselves in such a dilemma.

TASK: Shoot yourself in the foot.

C: You shoot yourself in the foot.

C++: You accidentally create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying, "That's me, over there."

FORTRAN: You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue with the attempts to shoot yourself anyways because you have no exception-handling capability.

Pascal: The compiler won't let you shoot yourself in the foot.

Ada: After correctly packing your foot, you attempt to concurrently load the gun, pull the trigger, scream, and shoot yourself in the foot. However, when you do, you discover you can't because your foot is of the wrong type.

COBOL: Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether SHOELACE needs to be re-tied.

LISP: You shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds...

FORTH: Foot in yourself shoot.

Prolog: You tell your program that you want to be shot in the foot. The program figures out how to do it, but the syntax doesn't permit it to explain it to you.

BASIC: Shoot yourself in the foot with a water pistol. On large systems, continue until entire lower body is waterlogged.

Visual Basic: You'll really only _appear_ to have shot yourself in the foot, but you'll have had so much fun doing it that you won't care.

HyperTalk: Put the first bullet of gun into foot left of leg of you. Answer the result.

Motif: You spend days writing a UIL description of your foot, the bullet, its trajectory, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.

APL: You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.

SNOBOL: If you succeed, shoot yourself in the left foot. If you fail, shoot yourself in the right foot.

Quotable Quotes

The pessimist complains about the wind; the optimist expects it to change; the realist adjusts the sails.

William Arthur Ward
--
Any code of your own that you haven't looked at for six or more months might as well have been written by someone else.

Eagleson's law
--
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Brian W. Kernighan

Friday, September 01, 2006


Dual Selecting Combo Boxes


function findTestTypes(grp){

var url = "/tests/lookup?cmd=test&gc="+grp.value;

if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}

req.open("GET", url, true);
req.onreadystatechange = showTestTypes;
req.send(null);
}

function showTestTypes(){
if (req.readyState == 4 && req.status == 200) {
var html = req.responseText;
var tt = getItem("tests");
tt.innerHTML = html;

fireChangeEvent("test_code");
}
}

// for mozilla
function fireChangeEvent(fieldName){
if (window.ActiveXObject) {
getItem(fieldName).fireEvent('onchange');
}else{
// target is some DOM node on which you wish to fire an event.
var target = getItem(fieldName);

var oEvent = document.createEvent( "Events" );
oEvent.initEvent(
"change", // the type of mouse event
true, // do you want the event to
// bubble up through the tree? (sure)
true, // can the default action for this
// event, on this element, be cancelled? (yep)
window, // the 'AbstractView' for this event,
// which I took to mean the thing sourcing
// the mouse input. Either way, this is
// the only value I passed that would work
1, // details -- for 'click' type events, this
// contains the number of clicks. (single click here)
1, // screenXArg - I just stuck 1 in cos I
// really didn't care
1, // screenYArg - ditto
1, // clientXArg - ditto
1, // clientYArg - ditto
false, // is ctrl key depressed?
false, // is alt key depressed?
false, // is shift key depressed?
false, // is meta key depressed?
0, // which button is involved?
// I believe that 0 = left, 1 = right,
// 2 = middle
target // the originator of the event
// if you wanted to simulate a child
// element firing the event you'd put
// its handle here, and call this method
// on the parent catcher. In this case,
// they are one and the same.
);
target.dispatchEvent( oEvent );

}
}

Favorite Quote

Admit nothing. Blame everyone. Be bitter.
-- Mattias Arthursson

App to Servlet Communication

App to Servlet Communication



DataInputStream dis;
try {
String urlString = "http://www.ibm.com";
URL url = new URL(urlString);
dis = new DataInputStream(url.openConnection().getInputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(dis));
String total = "";
String line = "";
While ((line = in.readLine()) != null) {
total += line;
}
in.close();
} catch (Exception e) {
System.out.println(e);
}





// Listing 2
//
// Applet client-side code to send a student object
// to a servlet in a serialized fashion.
//
// A POST method is sent to the servlet.
//

URL studentDBservlet = new URL( webServerStr );
URLConnection servletConnection = studentDBservlet.openConnection();

// inform the connection that we will send output and accept input
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);

// Don't use a cached version of URL connection.
servletConnection.setUseCaches (false);
servletConnection.setDefaultUseCaches (false);

// Specify the content type that we will send binary data
servletConnection.setRequestProperty ("Content-Type", "application/octet-stream");

// send the student object to the servlet using serialization
outputToServlet = new ObjectOutputStream(servletConnection.getOutputStream());

// serialize the object
outputToServlet.writeObject(theStudent);

outputToServlet.flush();
outputToServlet.close();

Thursday, August 31, 2006

Tuesday, August 29, 2006


Executing an i-sql statement via a .bat file


@echo off

if x"%1" == x"" Goto Usage
if x"%2" == x"" Goto Usage
if x"%3" == x"" Goto Usage
if x"%4" == x"" Goto Usage

isql -S %1 -d %2 -U %3 -P %4 -i create_vap_approved_applicants.sql -b
if errorlevel 10 goto error_exit
echo create_vap_approved_applicants.sql

isql -S %1 -d %2 -U %3 -P %4 -i alter_tU_CustFAA.sql -b
if errorlevel 10 goto error_exit
echo alter_tU_CustFAA.sql

goto exit

:Usage
echo Please provide the following [Servername, database, username, password].
goto exit

:error_exit
echo error found, exiting

:exit
echo done

Monday, August 28, 2006

Prague OrlojPrague Orloj Hosted on Zooomr


sweet!
Defining JBoss XA DataSources

I've come across the situation where using the default datasource xml definitions in JBoss resulted in the following error:
executing a prepare on a local transaction may result in unwanted results

Defining the datasource in a XA xml definition file removed the error.