Wednesday, July 25, 2007

Getting Java Date in another Timezone

Getting the date in another timezone is not quite as evident. But I did whip up a method to return the Date object if you provide your local Date and the timeZone id of where you want to find out what time it is there.

import java.util.*;

public class Timezone {

public static Date getDateInTimeZone(Date currentDate, String timeZoneId)
{
TimeZone tz = TimeZone.getTimeZone(timeZoneId);
Calendar mbCal = new GregorianCalendar(TimeZone.getTimeZone(timeZoneId));
mbCal.setTimeInMillis(currentDate.getTime());

Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, mbCal.get(Calendar.YEAR));
cal.set(Calendar.MONTH, mbCal.get(Calendar.MONTH));
cal.set(Calendar.DAY_OF_MONTH, mbCal.get(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, mbCal.get(Calendar.HOUR_OF_DAY));
cal.set(Calendar.MINUTE, mbCal.get(Calendar.MINUTE));
cal.set(Calendar.SECOND, mbCal.get(Calendar.SECOND));
cal.set(Calendar.MILLISECOND, mbCal.get(Calendar.MILLISECOND));

return cal.getTime();
}

public static void main(String[] args)
{
Date now = new Date();

System.out.println("Current Time="+now);
Calendar cal = Calendar.getInstance();
System.out.println("Current Timezone="+cal.getTimeZone().getDisplayName());

//Canada/Central
String timeZoneId = "Canada/Central";
System.out.println("Getting Time in the timezone="+timeZoneId);
System.out.println("Current Time there="+getDateInTimeZone(now,timeZoneId));
}

}

Tuesday, July 3, 2007

TOGAF (The Open Group Architecture Framework)

Well, I did receive Open Group's TOGAF 8 2006. Looks like a solid read with little fluff. Maybe a little like when I read the PMBOK but more interesting!

What is TOGAF? (The Open Group Architecture Framework)

TOGAF is an achitecture framework - The Open GROUP Architecture Framework. It enables you to design, evaluate, and build the right architecture for your organization.

The key to TOGAF is the Architecture Development Method (ADM) - a reliable, proven method for developing an IT enterprise architecture that meets the needs of your business.

It mentions that it can be used in conjunction with the Zachman Framework(of which I need to read up on), which has an excellent classification scheme, but lacks an openly available, well-defined methodology.

"The TOGAF ADM defines a recommended sequence for the various phases and steps involved in developing an architecture, but it cannot recommend a scope - this has to be determined by the organization itself, bearing in mind that the recommended sequence of development in the ADM process is an iterative one, with the depth and breadth of scope and deliverables increasing with each iteration." (p. 30, TOGAF 8)






ADM (Architecture Development Method)

Monday, July 2, 2007

The Leader In You


Finishing "The Leader In You" helps reinforce the ideas from the Carnegie Institute.

Written similarly to "How to Win Friends and Influence People" and "How to Stop Worrying and Start Living", it gives lessons through the stories and personal experiences of modern day(up to early 90s) leaders from business, politics and sports.

It was good but I would certainly recommend starting with the 2 books above before reading this one.
Human relationships are important and Carnegie will help you develop them.

A recap of the main principles in this book:
1. The first step toward success is identifying your own leadership strengths.
2.Communication is built on trusting relationships
3.Motivation can never be forced. People have to want to do a good job.
4. There's nothing more effective than rewarding than showing a genuine interest in other people.
5. Step outside yourself to discover what's important to someone else.
6. Nobody is more persuasive than a good listener.
7. Team players are the leaders of tomorrow.
8. Truly respecting others is the bedrock of motivation.
9. People work for money but go the extra mile for recognition, praise, and rewards.
10.Be quick to admit mistakes and slow to criticize. Above all, be constructive.
11.Set goals that are clear, challenging, and obtainable.
12. Leaders never lose their focus. They keep their eyes on the big picture.
13.Consistently high performance comes from a balance between work and pleasure.
14. Gain strength from the positive and don't be sapped by the negative.
15. Tame your worries and energize your life.
16. Never underestimate the power of enthusiasm.