Ever needed a utility which converts from one unit of time to another?
Well with Java 5 and higher, you won't have to create your own conversion routine any longer.
Say for example you wanted to specify a value in seconds but the method you need to call expects a value in milliseconds (which is a common thing in Java).
Then this would be how you can convert the value with the java.util.concurrent.TimeUnit utility.
[sourcecode="java"]
long oneMinute = TimeUnit.SECONDS.toMillis(60);[/sourcecode]
Java 5's TimeUnit supports conversion to and from nano, micro, milli and seconds while Java 6's TimeUnit also supports minutes, hours and days.
Friday, March 28, 2008
Wednesday, March 26, 2008
Sunday School Songs
I'm thinking of buying either the Super Strong God DVD or CD online.
Super Strong God DVD Hillsong Kids
Super Strong God
Our two-year old daughter learned about this from her Sunday school and she loves singing and dancing with it!
I tried searching our local Christian Music stores and they said they only have the older Hillsong Kids DVD (see below) and that it might take a while for new stocks to come in.
Jesus Is My Superhero - Hillsong Kids - DVD
Anyway, I was discussing the possibility of ordering this online with my wife the other day and when our two-year old daughter heard about it, she gave me a very big smile (enough to make my heart melt).
It might cost me more to purchase it online (considering the international shipping rates and taxes), but I think it will definitely be worth it.
Super Strong God DVD Hillsong Kids
Super Strong God Our two-year old daughter learned about this from her Sunday school and she loves singing and dancing with it!
I tried searching our local Christian Music stores and they said they only have the older Hillsong Kids DVD (see below) and that it might take a while for new stocks to come in.
Jesus Is My Superhero - Hillsong Kids - DVD Anyway, I was discussing the possibility of ordering this online with my wife the other day and when our two-year old daughter heard about it, she gave me a very big smile (enough to make my heart melt).
It might cost me more to purchase it online (considering the international shipping rates and taxes), but I think it will definitely be worth it.
Labels:
Christianity,
Hillsong,
Kids Songs,
Praise,
Sunday School,
Worship
Tuesday, March 25, 2008
Sun Certification Retake Promotion
This post has moved to a new location and is only kept here for archiving purposes.
To commemorate Sun's awarding 500,000 certifications, purchase a voucher by June 20 for most Sun certifications - and should you need it, you can take the exam one additional time for free.
Taken from: http://www.sun.com/training/savings/retake.xml
For SUN Phils, however, here are the more detailed guidelines.
Please be informed that Sun is _relaunching the popular Sun Certification Retake Promotion starting April 2008_. Note the voucher code for this program is "DS". The retake exam is not applicable for any assignment or essay exam. Validity date : 01 April to 30 June 2008
Below are some of the exams which qualify for the Free Retake Promotion. I also added some links to highly recommended books in case you need help with them.
- Sun Certified Programmer for the Java Platform, Standard Edition 6 (CX-310-065) - NEW!
- Sun Certified Programmer for the Java Platform, Standard Edition 5.0 (CX-310-055)
- Sun Certified Programmer for the Java Platform, Standard Edition 1.4 (CX-310-035)
- Sun Certified Web Component Developer for the Java Platform, Enterprise Edition 5 (CX-310-083)
- Sun Certified Business Component Developer for the Java Platform, Enterprise Edition 5 (CX-310-091) - New!
- Sun Certified Developer for Java Web Services (CX-310-220)
- Sun Certified Mobile Application Developer for the Java Platform, Micro Edition, Version 1.0 (CX-310-110) - New!
- Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0 (CX-310-019)
- Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5 (Step 1 of 3) (CX-310-052)
Terms and Conditions
Exam vouchers are only valid in the country in which they are purchased. Each voucher associated with this program is valid for one exam and, if failed, one free retake. You must allow 72 hours after taking your initial exam before scheduling the free retake exam. Please also be aware that per Sun certification guidelines you must wait at least 14 days before you may retake any exam. Certification vouchers may only be used at an Authorized Prometric Testing Center in the country where it was purchased. Please be aware that exam vouchers are non refundable for any reason.
Happy studying!
Related Post:
Labels:
Books,
certification,
Java,
Java Certification,
Philippines,
Programming,
scbcd,
scdjws,
scea,
scja,
scjp,
scwcd,
SUN Microsystems
Easter Goodies
I just wanted to share with you some "goodies" I got from my new boss over the "Easter" weekend.
These items are supposed to make me more productive. So back to work I go...
Options, Futures and Other Derivatives
Genius HS-02N (which is a replacement for my previous company issued Logitech Premium Stereo Headset)
These items are supposed to make me more productive. So back to work I go...
Labels:
Books,
Derivatives,
Easter,
Gadgets,
Headset
Wednesday, March 19, 2008
Java vs C# - switch statements
This is my first installment of a new blog series I'm planning to call Java vs C#.
Today, I'll be discussing the behavior of "switch" statements in both Java and C#.
Consider this snippet for Java which prints out the values "1", "2" and "Default" when value = 1.
Since I did not add "break" statements after each case, it should execute the code in the next cases up to the point where it reaches a break statement (or exits the switch).
[sourcecode language='java']
switch (value) {
case 1:
System.out.println("1");
case 2:
System.out.println("2");
default:
System.out.println("Default");
break;
}[/sourcecode]
You would think that the snippet for C# below (which is patterned after the code above) would behave in exactly the same way.
[sourcecode language='java']
switch (value)
{
case 1: System.Console.WriteLine("1");
case 2: System.Console.WriteLine("2");
default: System.Console.WriteLine("Default");
break;
}[/sourcecode]
But this is where it gets interesting, the code above will actually NOT compile.
They said that this is actually a safety mechanism for C# which help prevent debugging nightmares for developers in the event that these switch statements get bigger and more complex.
Seems like a valid point.
But it might be important to note that C# still allow fall through for switch statements, provided you do not add any logic to the case statements.
[sourcecode language='java']
switch (value)
{
case 1:
case 2:
default: System.Console.WriteLine("Default");
break;
}[/sourcecode]
You can however work around the said fall through problem by using goto which I do not really recommend (so I'm not going to add any more details about that).
As a side note, in addition to int and enum types, C# switch statements also allow string types as argument.
So there you have it folks, switch statements in Java and C#.
Hope you enjoyed and learned something from my first installment.
References:
Today, I'll be discussing the behavior of "switch" statements in both Java and C#.
Consider this snippet for Java which prints out the values "1", "2" and "Default" when value = 1.
Since I did not add "break" statements after each case, it should execute the code in the next cases up to the point where it reaches a break statement (or exits the switch).
[sourcecode language='java']
switch (value) {
case 1:
System.out.println("1");
case 2:
System.out.println("2");
default:
System.out.println("Default");
break;
}[/sourcecode]
You would think that the snippet for C# below (which is patterned after the code above) would behave in exactly the same way.
[sourcecode language='java']
switch (value)
{
case 1: System.Console.WriteLine("1");
case 2: System.Console.WriteLine("2");
default: System.Console.WriteLine("Default");
break;
}[/sourcecode]
But this is where it gets interesting, the code above will actually NOT compile.
Error 1 Control cannot fall through from one case label ('case 1:') to another
Error 2 Control cannot fall through from one case label ('case 2:') to another
They said that this is actually a safety mechanism for C# which help prevent debugging nightmares for developers in the event that these switch statements get bigger and more complex.
Seems like a valid point.
But it might be important to note that C# still allow fall through for switch statements, provided you do not add any logic to the case statements.
[sourcecode language='java']
switch (value)
{
case 1:
case 2:
default: System.Console.WriteLine("Default");
break;
}[/sourcecode]
You can however work around the said fall through problem by using goto which I do not really recommend (so I'm not going to add any more details about that).
As a side note, in addition to int and enum types, C# switch statements also allow string types as argument.
So there you have it folks, switch statements in Java and C#.
Hope you enjoyed and learned something from my first installment.
References:
Labels:
C#,
Dotnet,
Java,
Programming
Mobile Phone eBook Reader
A few months back, my friend and I were discussing about the possibility of creating a free eBook reader for Java enabled phones.
We were both very busy during that time so we had to postpone that plan.
This morning, while quickly browsing through the projects at java.net, I came across this link.
Well, I guess somebody smarter/faster already did it for us. I hope to try it out within the next few weeks.
Recommended books:
We were both very busy during that time so we had to postpone that plan.
This morning, while quickly browsing through the projects at java.net, I came across this link.
EBookME is application for creating and reading e-books on the mobile phones and other devices which supports JME (Java Micro Edition) with MIDP 1.0 profile. It consists of two parts:
- reader core (JME)
- standard Java (JSE) application which creates JME application packages. It puts together your texts and reader core.
Well, I guess somebody smarter/faster already did it for us. I hope to try it out within the next few weeks.
Recommended books:
Labels:
Books,
eBook Reader,
Java,
JME,
Library,
MIDP,
Mobile Phone,
Programming,
Tools
Friday, March 14, 2008
VI and Bash Tutorials
No matter how hard I try to avoid command-line Linux/Unix, every once in a while, a project pops up requiring some basic VI and Bash skills.
Every time I encounter these kinds of projects, I go straight in to Google and type "vi".
Well by blogging about it, I'm planning to just search for this blog entry in my archives and I'll be ready to go.
Anyway, here are the links which I found useful:
Enjoy!
Every time I encounter these kinds of projects, I go straight in to Google and type "vi".
Well by blogging about it, I'm planning to just search for this blog entry in my archives and I'll be ready to go.
Anyway, here are the links which I found useful:
Enjoy!
Tuesday, March 11, 2008
Surf anywhere with your Laptop and Smart 3G
THINGS YOU'LL NEED:
The following steps are specific to our setup. We used an LG KU250 Phone and a Windows XP OS. Installation procedures will depend on the model of your phone and operating system.
STEPS:
SPEED TESTS
From San Juan / QC Area (Strong 3G signal):

From a small town in Bulacan (no 3G signal detected):

PROBLEMS ENCOUNTERED
I'll keep you posted on my findings. Happy surfing!
- 3G Capable Phone
- Computer (Laptop/Desktop)
- SMART Buddy Sim
The following steps are specific to our setup. We used an LG KU250 Phone and a Windows XP OS. Installation procedures will depend on the model of your phone and operating system.
STEPS:
- Enable Phone 3G Settings (Text "SET KU250" to 211)
- Install and Run LG PC Suite
- Connect your Phone (USB/Bluetooth) to your computer
- Click LG Internet Kit Icon [Under Communication Group]
- Create a Profile
- Click Connect



SPEED TESTS
From San Juan / QC Area (Strong 3G signal):

From a small town in Bulacan (no 3G signal detected):

PROBLEMS ENCOUNTERED
- File Upload
- Email Attachments
- Yahoo! Messenger Voice
I'll keep you posted on my findings. Happy surfing!
Labels:
3G,
LG KU250,
Philippines,
SMART 3G,
Smart 3G Settings,
Tools
Friday, March 7, 2008
Java JDK/JRE Downloads for Mac
Did you know that you cannot download a JDK or JRE for Mac from Sun's website?
Well I didn't.
To downlo
ad/update Java for different versions of Mac OS X you will need to go to Apple's Developer Connection site for Java.
UPDATE: 10/22/2010 Apple Discontinuing Java Installation Packages for Mac OS X?
(I need to install JDK 6 because of the new Java Desktop Features I'm using in my application)
Now, all I need is to figure out the Mac OS X version of my target users and I'm good to go.
Well that didn't sound so easy to do.
Subscribe to:
Posts (Atom)







