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.


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:


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.


Then highlight the snippet, right click, "Display"



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!


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);


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:


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

(Note: the


is actually -D.

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


Monday, November 14, 2005

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

And another one - this time looking north.


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

Quiet and peaceful!


Thursday, November 10, 2005

WL : Using wsdl2service to create the Java classes for servicegen

In the previous post, it talks about a_service.service.Java_ServiceImpl.

But where does this java class come from?

The answer is that it's created by Weblogic's wsdl2service. In the build.xml file, you would add:


This utility reads the WSDL and then creates the classes.


WL : servicegen and javaClassComponents

Weblogic's servicegen "takes as input an EJB JAR file or list of Java classes, and creates all the needed Web Service components and packages them into a deployable EAR file".

javaClassComponents has as input a "Comma-separated list of Java class names that implement the Web Service operation. The Java classes must be compiled and in your CLASSPATH"

This comes under the service element of servicegen so part of the build.xml would be:


So in the CLASSPATH, you would have:

set CLASSPATH=%CLASSPATH%;C:\...\a_service\service\Java_ServiceImpl.class;

and would than have a:

package a_service.service;

Note the "a_service.service" in javaClassComponents. If that's missing, servicegen will invoke javac which will then throw a "Class not found" exception.

But where does the Java class come from in the first place? See this


Wednesday, November 09, 2005

WL : The task doesn't support the "generateimpl" attribute

Running Ant on Weblogic SP2 wsdl2service.

Get this weird message.

file:.../build.xml:xx: The task doesn't support the "generateimpl" attribute.


The Weblogic 8.1 documentation specifically states that it IS an option:

"generateImpl - Specifies that the wsdl2Service Ant task should generate an empty implementation Java class file."

Pull hair out. Turn to best friend Mr. Google. Turns out this is a bug which has been fixed in SP3.

Download latest SP4 - problem solved.


SOAP : Debugging Axis with Tomcat and Eclipse

Using Tomcat 5.0 and Eclipse 3.1.

In your Tomcat/bin directory, there is a file called catalina.bat. From the command prompt, just run catalina to see the options. You'll see one option called:

jpda start Start Catalina under JPDA debugger

That's the one you need. I had endless problems running this until I changed the relevant part of the bat file to:

%_EXECJAVA% -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%""%CATALINA_TMPDIR%" %MAINCLASS% %ACTION%

i.e. the address and transport are specified in the command line rather than in environment options.

Now start Tomcat with this option.

In Eclipse, the project is set up in the normal way with java classes etc.

Breakpoint where you want the code to stop inside Tomcat (e.g. inside a web service)
and then select Run / Debug / Remote Java Application.

You only need to worry about the Connect tab. "Connection Type" is "Standard (Socket Attach)", host is e.g. "localhost" and the port is the port specified in the command line above under the "address" option i.e. 8000. Then press the "Debug" button.

Now invoke whatever to force your Tomcat code to execute e.g. running a web service client which invokes the web service you want to debug.

Bingo - Eclipse will catch the breakpoint and change to the Debug perspective.


Thursday, November 03, 2005

SOAP : Compiling Axis WSDL2Java

So you've run Axis WSDL2Java and got all the Java files in their package and are battling to compile it all.

Don't sweat.

Add the following construct to the command line for WSDL2Java:


This constructs the build.xml file for you and then it's as simple as running "Ant".


SOAP : Administer Axis

The "Administer Axis" feature is disabled by default for security reasons. To enable it, navigate to:

C:\Tomcat 5.0\webapps\axis\WEB-INF\web.xml

(This assumes that Axis is running inside Tomcat 5.0)

Then uncomment the section with the comment:

-- uncomment this if you want the admin servlet --


SOAP : Watch the obvious

From the Axis SOAP install documentation:

set AXIS_HOME=/usr/axis
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;

So you cut and paste and make a .bat file that does this and nothing works. Pull out hair. Hang on, lets have a look at the \lib directory. Ah!

It's not "commons-logging.jar" but rather "commons-logging-1.0.4.jar" and so on.

Sometimes it's the obvious that screws you!


Thursday, October 27, 2005

WL : Posting SOAP request directly to the SOAP server

It's often useful to make changes to the SOAP request to see what happens. Normally, you have to do this via code and then re-compile the client.

However, you can do this via the command line.

Run the Weblogic "setDomainEnv.cmd" first to set up the environment and then:

java "file name"

where "file name" is a file that contains the SOAP request.

Using this you can add / change the request parameters by simply using a text editor.

Much simpler.

An example of the file format is:

POST ...method... HTTP/1.1
Content-Type: text/xml
SOAPAction: ""
User-Agent: Java/1.4.2_06
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

#?xml version="1.0" encoding="utf-8"?*
#env:Envelope xmlns:env="" xmlns:xsi="" xmlns:soapenc="" xmlns:xsd=""*


# = Left square bracket
* = Right square bracket


WL : Getting a Weblogic SOAP wire trace

If you are using the BEA Weblogic webservices for a Java SOAP client, you can see what is being sent on the wire by adding the following VM command line argument:


e.g. if you are using Eclipse, you can specify this under "Run / Arguments / VM Arguments".

The console will then display something like:

!-------------------- REQUEST ----------------
Headers :
SOAPAction: [""]
Content-Type: [text/xml]

... SOAP request

!-------------------- END REQUEST ------------

!-------------------- RESPONSE ---------------
URL : Response Code :200
Headers :
Date=Wed, 26 Oct 2005 19:15:40 GMT
Keep-Alive=timeout=30, max=199
Content-Type=text/plain; charset=ISO-8859-1
Envelope :

... SOAP response

!-------------------- END RESPONSE -----------


Thursday, October 20, 2005

.NET : Web services behind firewall

If you are trying to generate the web service proxy classes by using "Add Web Reference" from Visual Studio 2003 and the URL you are trying to get to is behind a firewall, you are screwed! Big time!

There's no way to do it.

You need to run Visual Studio command line (See earlier post) and then run "wsdl.exe".

Just type "wsdl" and you'll get the options. You'll note that you can specify the firewall address and the user logon / password to get you through the firewall as options. Bingo!

e.g. wsdl http://URL.wsdl /proxy:xx.xx.xx.xx /pu:User /pp:Password

So now you can go ahead and generate the proxy stubs. Add this file to your project and you are away.

But wait - there's more!

When you try and run the program to actually access the web service behind the firewall you will have exactly the same problem - the dreaded "407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied. )"

The way around this is to programmatically specify the proxy / logon / password.

Assume that you have the proxy configured in IE under "Tools / Options / Connections / LAN Settings". (Note that this does NOT allow user logon / password to be specified).

(See also :
The proxy settings on this computer are not configured correctly for Web discovery).

You create the webservice from the proxy class in the normal way.

using System.Net;


wsName = new WebServiceName ();

// Use default IE setting as above.
wsName.Proxy = System.Net.WebProxy.GetDefaultProxy();
// Set credentials
wsName.Proxy.Credentials = new NetworkCredential("User", "Password");


Friday, October 14, 2005

BB : Erasing all data on the device

Interesting article in "Blackberry Cool"

Erasing All Data On Handheld


WL : Logging to a Weblogic log file

There doesn't seem to be any way to programmatically log to the access.log but you can log to the server.log. In the jsp file:

(Note: # is "left square bracket %" and * is "% right square bracket").

#@ page import="weblogic.logging.NonCatalogLogger"*

NonCatalogLogger serverLogger;

serverLogger = new NonCatalogLogger ("Name of application"); ("Some information message");


Thursday, October 06, 2005

Misc : African recipes, African cooking and African Cookbook

e-book download with heaps of recipes from Africa

African recipes, African cooking and African Cookbooks, The African Recipes Book, Real food from Africa

Try the bobotie, the brandy pudding and the Cape Malay pickled fish.



BB : Running simulator without IDE / JDE

Obviously you need the IDE / JDE to develop the application. However, the simulator can be run without starting up the IDE. The IDE requires the Java 2 SDK Standard Edition. The simulator does not.

Assume you want to run the simulator on a laptop which does not have the J2SE platform installed.

First install the BlackBerry Java Development Environment (JDE) from the Blackberry site. Then copy across the program files app.code, app.cso, app.debug and app.jar into the "C:\Program Files\Research In Motion\BlackBerry JDE 4.0.2\simulator" directory on the laptop. (This path assumes that you have installed the 4.0.2 JDE).

Now run the required simulator file from that directory e.g. 7100v.bat.


Monday, October 03, 2005

Misc : English Cut

Sometimes you stumble across a blog that is so different and potentially looks so interesting that you just have to stop and read it.

Here's one: English Cut, a really interesting blog about bespoke Savile Row tailoring.

Atom feed


Monday, September 26, 2005

CF : Installing a cab file programmatically and quietly (no user interaction)

The trick is using wceload.exe with the /no­askdest and /noui parameters.

Again thanks to

private bool installCabFile ()
ProcessInfo pi = new ProcessInfo();
if (CreateProcess ("\\Windows\\wceload.exe","/no­askdest /noui " + downloadFileName, pi))
return false;

catch (Exception e)
Cursor.Current = Cursors.Default;
MessageBox.Show ("Problem installing Cab file " + e.ToString());
return true;

return false;

// CreateProcess PInvoke API
[DllImport("CoreDll.DLL", SetLastError=true)]
private extern static int CreateProcess ( String imageName, String cmdLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, Int32 boolInheritHandles, Int32 dwCreationFlags, IntPtr lpEnvironment, IntPtr lpszCurrentDir, byte [] si, ProcessInfo pi );

// GetLastError PInvoke API
private extern static Int32

public Int32 GetPInvokeError()
return GetLastError();

private extern static Int32
WaitForSingleObject ( IntPtr Handle, Int32 Wait);

public bool CreateProcess (String ExeName, String CmdLine, ProcessInfo pi)
unchecked {INFINITE = (int)0xFFFFFFFF;}
bool result = false;
if (pi == null) pi = new ProcessInfo ();
byte [] si = new byte [128];
result = CreateProcess (ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, si, pi) != 0;
WaitForSingleObject (pi.hProcess,INFINITE);
return result;

public sealed class ProcessInfo
public IntPtr hProcess = IntPtr.Zero;
public IntPtr hThread = IntPtr.Zero; public int dwProcessID = 0;
public int dwThreadID = 0;


(Compact Framework)

CF : Battery status in CF

bool success = GetSystemPowerStatusEx (ref system_power_status_ex, true);

this.lblMainInfo.Text = system_power_status_ex.BatteryLifePercent.ToString() +
"% Power Status " + (BatteryChargeStatusEnum)system_power_status_ex.BatteryFlag;

this.lblBackupInfo.Text = system_power_status_ex.BackupBatteryLifePercent.ToString() +
"% Power Status " + (BatteryChargeStatusEnum)system_power_status_ex.BatteryFlag;


public static extern bool GetSystemPowerStatusEx(ref SYSTEM_POWER_STATUS_EX pstatus, bool fUpdate);

public byte ACLineStatus;
public byte BatteryFlag;
public byte BatteryLifePercent;
public byte Reserved1;
public uint BatteryLifeTime;
public uint BatteryFullLifeTime;
public byte Reserved2;
public byte BackupBatteryFlag;
public byte BackupBatteryLifePercent;
public byte Reserved3;
public uint BackupBatteryLifeTime;
public uint BackupBatteryFullLifeTime;

private SYSTEM_POWER_STATUS_EX system_power_status_ex;

public enum BatteryChargeStatusEnum : byte
High = 1,
Low = 2,
Critical = 4,
Charging = 8,
NoSystemBattery = 128,
Unknown = 255

Thanks to the good folks at OpenNETCF (see "Links") for this.


(Compact Framework)

CF : Hiding / showing the taskbar in CF

This is for Windows CE Compact Framework.

In the "onLoad" method:

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

To show:

int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_SHOW);
Rectangle rc = this.Bounds;
this.Capture = true;
IntPtr hwnd = GetCapture();
this.Capture = false;
MoveWindow (hwnd, rc.Left, rc.Top, rc.Right, rc.Bottom - taskBarSize, true);

To hide:

int h = FindWindow ("HHTaskBar", "");
ShowWindow (h, SW_HIDE);
Rectangle rc = this.Bounds;
this.Capture = true;
IntPtr hwnd = GetCapture();
this.Capture = false;
MoveWindow (hwnd, rc.Left, rc.Top, rc.Right, rc.Bottom + taskBarSize, true);


private int taskBarSize = 24;

const int SW_HIDE = 0x0000;
const int SW_SHOW = 0x0001;

public static extern IntPtr GetCapture();

public static extern int FindWindow (string lpClassName, string

public static extern int ShowWindow (int hwnd, int nTaskShow);

public static extern int MoveWindow(IntPtr hwnd, int X, int Y, int nWidth,
int nHeight, bool bRepaint);


Friday, September 23, 2005

BB : pushScreen always displays the menu on top

Really annoying problem. You invoke pushScreen and lo and behold the current menu pops up on top of the new screen. You have to escape out.

Lots of traffic on the Net about this. Half of the people say that it is not the default behavior and refer you to the Blackberry samples that don't exhibit this behavior. The other half say "Stuff the samples, I can SEE the problem and it's driving me nuts".

And the reason is the humble button (ButtonField). You aren't supposed to use buttons, rather add the action to the menu. But some users are Windows centric and WANT a button. The samples don't use a button; hence don't exhibit the behavior.

The problem is that the click is passed onto the next screen and so invokes the menu. The trick is to dump the click. You do this by:

bf = new ButtonField ("Submit", Field.FOCUSABLE | ButtonField.CONSUME_CLICK);

Problem solved.


OpenNETCF : Getting OpenNETCF code from the Vault

The latest code is always available from the Vault (a VSS lookalike).

(NOTE: The code under the "Source" tab at is NOT the latest).

For multiple files, install the Vault client application from here:


For single files, direct from source control here:

login = guest
password = guest


.NET : Serial classes

There is no support in either CF or the full framework.

OpenNETCF has serial classes which can run on both platforms.

There are some samples here:

with a write-up called "P/Invoking Serial APIs in the Compact Framework" by Chris Tacke here:

For the full framework, John Hind has an excellent article called "Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications" here:


CF : Enabling network connection from a PPC emulator

Assuming the desktop that runs the emulator has a network connection ...

This is using PPC 2003 emulator / PPC 2002 is similar.

Start / Settings / Connections

Click Connections icon.

Advanced / Select Networks

Change dropdown for Internet connection to "My Work Network"

Edit / Proxy Settings

Check the checkbox "This network connects to the Internet"

OK all the way out.

Try IE - should now have a network connection from the emulator.


(Compact Framework)

SOAP : "Dynamic" web service

Using SOAP and web services, this is something I have found useful.

Basically, the original question was: "Is it possible to allow an application to access webservices without specifically adding a web reference in the project? In other words, can an application be created which allows the 'user' to specify the URL, and then call whatever webmethods may exist on that server?"

This may be a bit of a hack but hey "If the shoe fits ....".

What you could do is have dummy stubs

e.g. int Method1 (int)
string Method2 (string)

and so on and code each differently on the server side.

So Method1 on URL1 will do something completely different to Method1 on URL2.

The important thing is that the WSDL signatures are correct.


SQL CE : TIP: Typing complicated queries using Query Analyzer

Ever tried to do this on a mobile device like a PPC? Using the small SIP is guaranteed to give one eye strain.

I use the "ActiveSync Remote Display" from Windows Mobile Developer Power Toys.

This allows a remote display of the PPC on your desktop and you can use your keyboard to type the query in.


Misc : Wikitravel

Wherever you are in the world while reading this, why not visit Wikitravel and enter some details about where you live, things to do etc.

It's a Wiki site along the lines of Wikipedia.

As they say in Wiki speak : Plunge forward.

Thursday, September 22, 2005

BB : Installing an application from Desktop Manager

The first thing to remember is that you need to generate an alx file. Either right-click on the project in the "Files" window or under "Project" in the toolbar.

Then start Desktop Manager. (I have found that sometimes it helps to use the version of Desktop Manager on the CD that comes in the box with your Blackberry.)

Then "Application Loader". Then "Add" and browse to the alx file and select it. Then confirm that the checkbox is ticked and "Next".

It helps if you have a "Title" and a "Version" in your project properties under "General" . Also an "Output File Name" under "Build". That way Desktop Manager can tell you which file is which rather than a list of blank lines!


Misc : WTP installed finally on Eclipse

Been battling for a while getting Eclipse WST (Web Standard Tools) and WTP (Web Tools Platform) to run on Eclipse 3.0. Eventually gave up on it and installed 3.1. It's a monster download and you need to add the optional WTP plugin.

The software updates feature under Help makes it a snap. Remember to click the “Select Required” button to enable the features required by WTP which are not already installed. Got it all installed and now can right-click on a WSDL file and select “Validate WSDL”.


Misc : Number of IDE's for development

So many IDE’s on my desktop just has to lead to confusion.

Eclipse 3.1 for basic Java
Weblogic Workshop for Internet stuff
Blackberry 4.0.2 for Blackberry development
Visual Studio 2003 for .NET, C++, CF, PPC and Smartphone.
eVC++ 3.0 and eVC++ 4.0 for older mobiles
Java Studio Mobility for J2ME

And yes, most of them are used most of the time! Gets really confusing when you have more than one open at the same time especially if they require different languages.

That’s 11 platforms – can anyone beat that?

Notice the only real gap is Visual Basic – I’m not a big fan.


Wednesday, September 21, 2005

BB : Running simulator standalone

The Blackberry IDE puts the project files into e.g. :

C:\Program Files\Research In Motion\BlackBerry JDE 4.0.2\simulator

There will be .cod, .cso, .debug and .jar files for each project.

To run the simulator standalone, ensure that the project’s files are in the above directory, cd to the directory and then run the “type”.bat file in a command prompt.

e.g. to run the 7100v simulator, run 7100v.bat


Friday, September 16, 2005

Misc : Other automatic Pings

Two other sites I've used for automatic Blog pinging are:

King Ping :


Pingoat :

Enjoy !

Thursday, September 15, 2005

Misc : Ping-O-Matic

Can't recommend this Blog pinger highly enough.

Why do the pings individually when you can aggregate them all in one?

Does Weblogs, Feedster, Technorati and more.

Nice one!


Misc : Google Blog Search

So cool!

In one fell swoop, I can find nearly all my Blog entries via Google. The old Google search found around 10% of them.

Read about it here:

In particular:

  • How do I find Blog Search?
  • Can I subscribe to search results?
  • What search operators are supported?


Wednesday, September 14, 2005

SQL : Date format and style

I'm always getting confused between the UK and US formats:

For UK format i.e. dd/mm/yyyy, the style parameter is 103

CONVERT (DATETIME, '18/12/2005 00:00:00', 103)

For US format i.e. mm/dd/yyyy, the style parameter is 101

CONVERT (DATETIME, '18/12/2005 00:00:00', 101)

And I really wish that people would give examples like '18/12/2005' where it's quite obvious which is the date and which is the month instead of the normal examples like '04/06/2005' where it could be either.


Friday, September 09, 2005

BB : Showing the Blackberry screen on a PC

You can do this in Windows Mobile with one of the Power Tools.

It's really useful for demos. Just hook up the native device via Active Synch. , display the device screen on your PC, drive it from your PC mouse and keyboard and you can enlarge it and project it, make screen shots etc.

Beats the hell out of 10 people elbowing each other out of the way to look at the miniscule screen.

But there is no such facility on Blackberry. That sucks major league big time.

You have to do the demo. using the simulator. That leads to "smoke and mirrors" comments. And the Blackberry simulator DOESN'T simulate. It will run perfectly on the simulator and throw exceptions on the device.

My previous post concerning "blocking operation not permitted on event dispatch thread" is just one such example.


BB : The dreaded "blocking operation not permitted on event dispatch thread"

Seen this message on your Blackberry?

“Uncaught Exception:blocking operation not permitted on event dispatch thread”

Have you done this?

A new class for threading:

class NewThread extends Thread

and in this you have a

public void run ()

Then in the main thread, you have

NewThread nt = new NewThread ();
nt.start ();

In NewThread, to access the UI you need:

(new Runnable()
{public void run()
Dialog.alert ("Some message");

To access fields in the UI, use get / set methods (which are declared in the main thread) from the Runnable code above. I used to have the blocking exception until I changed to the above.


Thursday, September 08, 2005

BB : BlackBerry MDS Studio

This is part of the BlackBerry Mobile Data System v4.1

From the FAQ:

"BlackBerry MDS Studio is a powerful visual application design and assembly tool that allows developers to quickly create applications using drag and drop functionality."

It's different to a vanilla J2ME application because "BlackBerry MDS Applications are applications developed using BlackBerry MDS Studio and that require BlackBerry MDS Runtime Environment to be installed on the device in order to run."

So much like Windows Mobile where you also have to load the Compact Framework.

One question?

"Q: Does BlackBerry MDS support Microsoft .NET?
Yes. BlackBerry MDS Applications can integrate directly with Web Services created with
Microsoft .NET tools and running within a Microsoft .NET environment."

That's actually saying you can create a Blackberry client that speaks via web services to a .NET server. It doesn't mean that you can run .NET applications on a Blackberry. Isn't that the usual meaning of "support"?

Best of all though "BlackBerry MDS Studio is based on Eclipse. Eclipse is a widely used open source IDE framework that can be extended to create software development tools for particular types of applications."

Got to be heaps better than the current IDE. Finally some standardisation and another feather in the cap for Open Source.

Bring it on!


Wednesday, September 07, 2005

Misc : Blackberry vs Compact Framework development

You can say what you like about Microsoft but the Compact Framework development environment and support creams RIM and Blackberry hands down, TKO, no contest!

  1. Visual Studio is a much better, less buggy IDE than the Blackberry JDE.
  2. Deployment is much easier with Active Synch as opposed to Desktop Manager. It's basically another folder and you can drag and drop all kinds of files anywhere.
  3. Blackberry Forum support is a joke. Does anyone from RIM actually read it? Most of the posts go unanswered for days on end. Compare this to the Google group "microsoft.public.dotnet.framework.compactframework". You get answers within hours and the quality is excellent with such people as Peter Foot, Paul G Tobey, Daniel The Moth, the two Alex's and so on.
  4. CF has the superb OpenNETCF. RIM has nothing even remotely comparable.
  5. Do a Google search for some CF samples. You are spoiled for choice. Do the same for Blackberry - the quickest way I know to return zero Google results. If anyone out there is doing Blackberry development, they certainly don't seem to be posting it to anywhere.
  6. To be fair, Blackberry is constrained by the J2ME environment in terms of the quantity and richness of the components but it's still no contest.


Thursday, August 18, 2005

BB : Updating your application via Desktop Manager

The trick to getting DM to recognize that an application has been updated and hence a new version needs to be downloaded is to change the "Version:" under "Project/Properties/General".



Monday, August 15, 2005

Misc : Programmatic Java scheduling cron

Had a need for some scheduling operations. I could have done it myself using java.util.Timer but then stumbled across Quartz, an open source component.

From their website, "Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components or EJBs. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering."

Nice one!


BB : Adding an icon to your program

Use .png format.

Add the image to your project, then right click on the image file in the IDE, "Properties / Use as application icon".



Friday, August 12, 2005

BB : Getting a guid for Event Log

Ensure you are not in debug mode.


long guidName

Drag the cursor to highlight "guidName" and then right click.

Select "Convert guidName to long"

"guidName" will be replaced by the generated guid xL

Just edit to add "guidName =" before the xL to create

long guidName = xL;



BB : Logging to Event Log

String myApp = "My App";
long appId = 0x8b979f96520ee725L;
EventLogger.register (appId, myApp, EventLogger.VIEWER_STRING);
String logMessage = "This is a test";
if (EventLogger.logEvent (appId, logMessage.getBytes()))
System.out.println ("Log successful");


Note: To see how to get the guid 0x8b979f96520ee725L see my next post.


BB : Getting selected RadioButton option

RadioButtonGroup rbg = new RadioButtonGroup ();
rbA = new RadioButtonField ("A", rbg, true); // Selected by default
rbB = new RadioButtonField ("B", rbg, false);
add (rbA);
add (rbB);

boolean isA = rbA.isSelected ();



BB : Getting selected item in ObjectChoiceField

String [] choices = {"A", "B", "C"};

ocfChoice = new ObjectChoiceField ("Select choice", choices, 0) ;
add (ocfChoice);

int index = ocfChoice.getSelectedIndex();
String selectedChoice = choices [index];



Thursday, June 02, 2005

WL : Weblogic Workshop textbox sizes

Weblogic Workshop 8.1 SP2 running on XP SP2.

The following HTML code snippet:

LB input size="14" value="input" RB
LB input type="password" size="14" value="" RB

where LB = "<" and RB = ">".

When viewed in either the standard IE browser or the Workshop test browser, the password textbox is smaller than the normal textbox even though both are the same size.

The same is also true when viewed by Weblogic using the LB netui:textBox .... construct.

The solution is to make the password field use a monospace font i.e.

LB input type="password" value="" style="font-family: courier new;font-size:14;" RB



Wednesday, June 01, 2005

Misc : Digital Dish

So there I was researching some blog issues and I came across "Digital Dish" -"Digital Dish contains the freshest, most original food writing of the year from ordinary people writing regularly online in food blogs. It is an honest and alternative look at the world of food and cooking from over 20 different contributors around the world."

Check it out here:


Have a read of the introduction in PDF format.


SQL : Comparing dates with SQL server

The date is actually stored as "date & time".

So a search:

WHERE Table_Date > GETDATE()

will not find any articles with a Table_Date of today - because the GETDATE() time now is > the time the record was inserted into the table.

To do the compare properly, only the date portions must be compared i.e.

WHERE (CONVERT(varchar(10), Table_Date, 112) >= CONVERT(varchar(10), GETDATE(), 112))

112 is the ISO standard style to ensure the correct compare results.


Saturday, April 09, 2005

Down the road: Brown's Bay Beach, North Shore, Auckland

Room with a view - Long Bay, North Shore,Auckland

Tuesday, April 05, 2005

VS : Visual Studio command line

It's often very useful to run the VS tools outside of Visual Studio.

To do this, run the Visual Studio Command Line which sets up the command prompt with the correct PATH environment.

Navigate via:

Start -> Programs -> Visual Studio .Net 2003 -> Visual Studio .Net Tools -> Visual Studio .NET 2003 Command Prompt

e.g. you could use this to run

dumpbin /exports mydll.dll

which will display the exported function names.


Monday, April 04, 2005

SOAP : Tracing SOAP Web Services using extensions

Ever wanted to log the actual content of the SOAP messages arising out of Web Services on your device.

You can do this with SOAP Trace Extensions.

See here:

Fun with SOAP Extensions -


Friday, April 01, 2005

CF : Problem with CF SP2 with Form navigation

My particular problem was with Windows CE.

This behavior can be seen using the CE emulator running under Visual Studio 2003.

InitializeComponent() and the onLoad event both have the

this.WindowState = FormWindowState.Maximized;

construct set.

Using the RTM version of the CF (1.0.2268.0) navigating between the two forms using the buttons causes the two forms to be always maximized.

Installing SP2 (1.0.3316.0) on the emulator and then running the same application causes the forms to be minimized on the taskbar while navigating between them and they have to be manually maximized.

The full example I wrote to illustrate this can be found here:

Problem with CF SP2 with Form navigation

After posting to the group, emails to Microsoft, formally logging the bug with Microsoft I got nowhere.

Then Alex Feiman suggested a workaround to this.

The code was:

currentForm.Hide ();
nextForm.Show ();

As Alex explained: "The reason the forms get minimized is because at some point you do not have a visible form and the runtime thinks you want the app hidden".

Reversing the order:

nextForm.Show ();
currentForm.Hide ();

stops the next form from minimising under SP2. It was never an issue with RTM.

Each form has always had the

this.WindowState = FormWindowState.Maximized;

attribute set.


(Compact Framework)

Tuesday, March 29, 2005

CF : Error: Cannot establish a connection ...

Irritating error: "Error: Cannot establish a connection. Be sure the device is physically connected to the development computer."

This may help:

You need to download and install Microsoft Windows CE Utilities for Visual Studio .NET 2003 Add-on Pack 1.1 on your development PC running Visual Studio. Get it from here:

Then read through the solutions listed in the Readme.htm file in the:
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\WinCE Utilities folder.

You may need to run C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\WinCE Utilities\WinCE Proxy Ports Reg\ProxyPorts.reg.

Also: In Visual Studio under "Device Options", ensure that the "Transport" is "TCP Connect Transport" and that you "Obtain an IP address automatically".

Then start ActiveSynch, inside your project go to Tools\Select Windows CE Device CPU and select ARMV4T or whatever your CPU is. Then deploy to the device and you should be able to debug on the device.


(Compact Framework)

CF : Downloading a file to the emulator

Perhaps the simplest way is to add the file as "Content" to your project using Solution Explorer and then deploy the project to the emulator. Then find the file and run it.

Note: "Left Slash" = /, "Right Slash" =
In Windows CE, copy the file to a shared directory on your desktop and then using the "Run" command, execute

"Right Slash""Right Slash"Desktop"Right Slash"Share.

Then either run the file direct or copy / paste to a directory inside the emulator and then run it.

In PPC, use IE and type

file:"LeftSlash""LeftSlash""Right Slash""Right Slash"Desktop"Right Slash"Share and follow the same procedure.

Alternatively, use "File Explorer/Open" and then

""Right Slash""Right Slash"Desktop"Right Slash"Share

You can also use "Emulator ActiveSync Connection Tool - Allows Activesync to connect to your Emulator session from Visual Studio .NET 2003" from "Windows Mobile Developer Power Toys" available here:

(Note: There are two downloads. You need to download "EmuASConfig.msi").

Once connected via ActiveSync, you could use "CECopy - Command line tool for copying files to the device currently connected to desktop ActiveSync" also available from the Power Toys link above.


(Compact Framework)

Wednesday, March 23, 2005

SQL CE : Merge Replication

Two useful articles that have helped me:

How to Program Microsoft SQL Server CE 2.0 Merge Replication Using .NET Compact Framework

Developing Apps with the .NET Compact Framework, SQL Server CE, and Replication