Friday, February 24, 2006

Cobol : Net Express IDE comments

Ever noticed how the comments display as actual commands even though you have an "*" in column 7 and you chose a special colour for the comments under "Options / Customize IDE / Colors" ?

The solution is to go to "Options / Edit" and set the left margin to 7.

Now you have comments that actually look like comments!

Enjoy!

Friday, February 17, 2006

Cobol : Conditional compile / debug

DISPLAY messages are often useful in a development system but you most certainly don't want them in a production environment.

You can do this by setting a "D" in column 7. From the manual:

"A debugging line is any line with a "D" in column 7. It is only permitted in the program after the OBJECT-COMPUTER paragraph.

A debugging line will be considered to have all the characteristics of a comment line if the WITH DEBUGGING MODE clause is not specified in the SOURCE-COMPUTER paragraph."

e.g. SOURCE-COMPUTER. MainFrame WITH DEBUGGING MODE.

Enjoy!

Cobol : Creating a logging file for standard out and standard error

Often you want to send a log file to stdout so you can then redirect it to wherever.

In Cobol, you can use:

SELECT OUTPUT-LOG ASSIGN ':CO:'

where:

:CO: is standard output (stdout)

These can also be used:

:CI: is standard input (stdin)

and

:CE: is standard error (stderr)

Enjoy!

SOAP : TCPMON - trace SOAP messages

This can also be done with Ethereal but that requires some TCP/IP knowledge.

Download tcpmon.jar from here

and run as:

java -jar tcpmon.jar

This will bring up the screen with:

Local Port: 8080
Server Name: 127.0.0.1
Server Port: 80

Assume that the web service address that the client uses is

http://a.b.c.d:9090

Change this in the client to

http://localhost:8080

Then change the Server Name to a.b.c.d and change the Server Port to 9090.

Then "Add Monitor"

So now your client will send to port 8080 and tcpmon will pick this up and redirect to a.b.c.d:9090 thus trapping the messages and then displaying them

Enjoy!

Friday, January 27, 2006

VS : Looking at the SOAP proxy code

So you are writing a web client with Visual Studio (assume command line) and you need to add a web reference.

Solution Explorer - right click References - Add Web Reference.

Point to the WSDL - GO and it's done.

What's done? - where's the generated code?

Open File - navigate to Web References / WebReference / Reference.cs.

This will show the SOAP methods and signatures you can call.

It will start with "public class X".

So use:

X x = new X ();
and the SOAP call will be x.method.

(Hint - when compiling add a "using" to your main class and check the namespace of the generated code.)

The line "this.Url = "http://a.b.c.e"; " is useful. Change this url if you move your web service.

Enjoy.

Friday, December 23, 2005

Misc : 2005 reading list

The local library has a feature that stores all the books you have read so you can check your reading history.

Looking through this, the ones that were really enjoyed (in no particular order) were:

Under pressure : the final voyage of Submarine S-Five / A.J. Hill.

Excellent read and a prime example if how when there is a will, there's a way.

Rocketman : astronaut Pete Conrad's incredible ride to the moon and beyond / Nancy Conrad and Howard A. Klausner ; introduction by Buzz Aldrin.

Interesting and readable account of one of the real characters of the Apollo era.

The silicon boys and their valley of dreams / David A. Kaplan.

Really good overview of the .dot com boom and bust. Basically, the experts knew as much as the rest of us and they picked as many dogs as success stories.

The fate of Africa : from the hopes of freedom to the heart of despair : a history of fifty years of independence / Martin Meredith.

Excellent read. If you want to know why Bono and company waste their time trying to get read of 3rd world debt, read it. Ultimately a depressing story of how a continent with so much potential ended up bankrupt and in a mess. And a story of self-centered dictators more concerned with their Swiss bank accounts and orgies on the Riviera than their people starving and uneducated at home.

Dr. Space : the life of Wernher von Braun / Bob Ward ; foreword by John Glenn.

Good read, drags in parts. Doesn't really address the Nazi issues and how culpable he was with the treatment of the slave labour forced to build the V1 and v2.

Sinatra : the life / Anthony Summers, and Robbyn Swan.

Excellent read and an insight into his Mob links.

Dancing with cranes : on location with a New Zealand wildlife film-maker / Alison Ballance.

And you thought making wild-life movies was simple and easy. Quite staggering commitment.

A bright shining lie : John Paul Vann and America in Vietnam / Neil Sheehan.

Probably the best overall book on the war. Shows how much the top brass deluded themselves, how the war was screwed from the start and how the real victims were the Vietnamese peasants who were brutalised by both sides.

Enjoy!

Wednesday, November 30, 2005

Misc : George Best

Sadly, one of the all-times greats has gone.

When I was a kid, George Best was my hero. He was cool and fitted in with the whole 60's era - Carnaby Street, Twiggy, Mary Quant, the Beatles, Sergeant Pepper ... He was almost the fifth Beatle with his good looks and long, flowing hair. He was the epitome of what people aspired to - talent, youth, fame, fortune and a blond on each arm.

And he could play football! He had the support around him. In Man U's previous great era, George, Denis Law and Bobby Charlton were each voted European Footballer of the Year over a five year period. Show me another English club with that sort of record.

He was the master of the feint and the dribble. He leapt over tackles like a gazelle. And remember he played in an era where goalscorers were not protected as they are today. He faced such hard men as Chopper Harris, Norman Hunter, Billy Bremner and the like ... and he still scored goals.

He is the only UK player who belongs in the pantheon of the greats; Pele, Cruyff, Maradonna and Best.

He was never rated internationally because he never appeared in a World Cup. Northern Ireland last appeared in that competition in 1958 in Sweden when George was just a nipper. Maybe just as well - George in Sweden with those leggy, beautiful Swedish blondes would would been a potent distraction.

With Matt Busby as a father figure, he flowered. The pre-match instructions for George were "Go out and enjoy yourself" allowing full reign to his talent and individuality. Defenders hated him because he made them look ponderous, slow and stupid. Mostly they just saw his back, twinkling down the touchline.

The rot set in with the later managers - Frank O'Farrell, Wilf McGuinness and Tommy Docherty. They expected him to conform, to be part of the overall pattern, to be part of the common herd. It was never going to work and he walked away in disgust.

He left a massive hole at Man. U. Succeeding generations of footballers were always given the curse - "He's the new George Best". That "compliment" was a hospital pass. Ryan Giggs is a good example - a brilliant footballer, a great team man but the next Best? That's simply not achievable no matter how hard Giggs or anyone else tried - George was a one-off and we'll never see his like again.

Sadly, he forget that he was famous because of football, not in spite of it. He seemed to live on the tabloid's front page. Surrounded by sycophants and diverse hangers-on, he opened night clubs, advertised rubbish, partied and declined.

In his famous words, "I spent my money on booze, birds and fast cars. The rest I just squandered." The incredible talent that made him such a star also destroyed him. This seems to be a common theme - just look at Gazza. Perhaps Rooney should have been taken to the hospital at the end and told "Look - this is your life if you don't wake up"!

George has gone and an era has passed. Shakespeare wrote "the good men do is interred with their bones... but, their evil lives on and on". The "good" George did on the football field is certainly not interred and the genius and the memories will always remain. And what glorious memories - look here for a brief reminder:

http://video.google.com/videoplay?docid=6000929952097818068&q=%22george+best%22

R.I.P.

Friday, November 25, 2005

Eclipse : Writing java snippets in a scratchpad

For web server development, especially when the code is in a jar file, you need to write some code, stop the application inside the server, deploy the new one, start it all up etc. That takes time - and then you find that the code doesn't work so you try something else which takes more time and so on ...

It's much easier to write the snippet inside an Eclipse scrapbook first and test it.

"File / New / Other / Java / Java Run/Debug / Scrapbook Page

Then just write some code in the editor e.g.

System.out.println("Hello");

Then highlight the snippet, right click, "Display"

Bingo!

Enjoy!

Friday, November 18, 2005

Eclipse : Where's my console output?

Debugging my Java program inside Eclipse 3.1, I noticed that the console output which had tons of debugging statements was missing a large swathe of the initial output.

A bit of digging around found the option under Window / Preferences / Run/Debug / Console.

Uncheck "Limit console output" and you'll get the output you were expecting!

Enjoy!

Thursday, November 17, 2005

Java : String input to Digester

Every one of the gazillion examples out there use an XML file to demonstrate how to use Digester.

But what if you need to hand Digester some XML which is actually a String input.

Problem! The only String constructor needs a URI.

Well, you could write it to a file and then use the File constructor as input.

Yeah - right!

Use the StringReader class which converts a string to an input stream e.g.

StringReader sReader = new StringReader (AXmlString);
myResponse = (Response) digester.parse (sReader);

Enjoy!

Java : Digester debug logging

So you are trying to figure out why Digester won't parse the XML correctly.

You need the debugger!

Just apply the following run-time switches:

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester=debug

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax=info

where the levels (e.g. debug / info) at the end at the line are the levels you require.

(Note: the

-
D

is actually -D.

The console will spit out exactly what Digester is doing and it's all a whole lot easier to figure out.

Enjoy!

Monday, November 14, 2005

Misc : Martins Bay - just north of Auckland (2)



And another one - this time looking north.

Enjoy!