Joshua Java

Archive for the ‘Codevaganza’ Category

Animated GMap dropped marker with GWT

Posted by: Joshua on: October 29, 2008

Yesterday we were evaluating GWT to be used as a wrapper for the GMap API. And one thing we need in our apps is to be able to drop marker and follow where the last marker is dropped.

Tags:

Using GWT’s Hyperlink widget

Posted by: Joshua on: October 24, 2008

Okay, so here’s the problem what I faced recently. I’m doing a research on using GWT because we’re currently evaluating whether or not to use GWT in the future. I am trying to use GWT and stuck on using the Hyperlink widget. There were two problems that I faced:

First I need to figure out how [...]

Average of a datetime datatype field in SQL Server 2000

Posted by: Joshua on: June 14, 2008

In SQL Server 2000 you can not use the AVG() function on a datetime datatype field. So how do you get the average for a datetime datatype field?
This is the nasty way to do it:
convert(varchar, convert(datetime, avg(convert(real, end_time – start_time))), 108 ) avg_call_length

In the example I subtracted two fields: start_time and end_time to get the [...]

Adding extra char infront with SQL Server 2000

Posted by: Joshua on: June 13, 2008

Recently I’ve got a table with a field that the values needed to have an extra character infront of it. Each record must have extra zero infront of it and in the end the total character must be 10 characters long. So if I have a record with code: 12345, it should be transformed to [...]

Random Number Generator

Posted by: Joshua on: April 1, 2008

Recently I’ve got a task to generate a random PIN number. Now the PIN must be in 6 digit number. Here’s the number generator:

public class RandomGenerator {
    private static final Logger logger = LoggerFactory.getLogger(RandomGenerator.class);

    final static int [] sizeTable = { 0, 9, 99, 999, 9999, 99999, 999999, 9999999,
                                      99999999, 999999999, Integer.MAX_VALUE };

    private static [...]

Tags: