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".

Enjoy!

(Blackberry)

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!

Enjoy!

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".

Enjoy!

(Blackberry)

Friday, August 12, 2005

BB : Getting a guid for Event Log

Ensure you are not in debug mode.

Type:

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;

Enjoy!

(Blackberry)

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

Enjoy!

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

(Blackberry)

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

Enjoy!

(Blackberry)

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

Enjoy!

(Blackberry)

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

Enjoy!

(Weblogic)

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:

PressForChange

Have a read of the introduction in PDF format.

Enjoy!

SQL : Comparing dates with SQL server

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

So a search:

SELECT * FROM Table
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.

SELECT * FROM Table
WHERE (CONVERT(varchar(10), Table_Date, 112) >= CONVERT(varchar(10), GETDATE(), 112))

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

Enjoy!

Saturday, April 09, 2005


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

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