My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://mindsiview.wordpress.com/ and update your bookmarks.

Monday, June 28, 2004

Java Quick Tip of the Day: Using HashMaps

The next time you have to create a simple lookup table in Java, try using a HashMap. HashMap is part of the java.util package. It is an interface for storing objects as key-value pairs. HashMap is typically used for storing object relationships.

Take a look at the following example:

import java.util.*;

public class HashTest {
  static HashMap qbLookup;
  public static void main(String[] args) {
  qbLookup = new HashMap();

  qbLookup.put("Raiders", "Rich Gannon");
  qbLookup.put("Titans", "Steve McNair");
  qbLookup.put("Steelers", "Tommy Maddox");
  qbLookup.put("Colts", "Peyton Manning");

  if(args.length > 0) {
if (qbLookup.get(args[0])!=null) {
System.out.println("The starting quarterback for the "
+ args[0] + " is " + qbLookup.get(args[0]));
} else {
System.out.println("NFL Team not found, try again");
}
} else {
System.out.println("Please enter a valid NFL Team");
} } }

As you can see from the code, I created a HashMap called qbLookup. Using the put() method, I created some objects representing NFL teams and the starting quarterbacks. Although I used String objects in this example, you can use whatever kind of object you need to store and retrieve later. For example, I could've created an object that represented the entire roster of each team instead of a String object representing the quarterback.

Next, you'll see that I'm checking the arguments passed to HashTest's main() method. If I find an argument, I pass it to the get() method of the HashMap object qbLookup in order to retrieve the related object. I check to see if the get() method has returned a value and print out the appropriate message.

When you compile this code and execute it with the command java HashTest Titans you get:

The starting quarterback for the Titans is Steve McNair

I hope this example helps you see ways that you can utilize HashMaps in your own programs.

Tuesday, June 22, 2004

Monday, June 21, 2004

Do You Need a Change?

When do you know that it is time to either change your attitude or leave your company? That is a hard question to answer, but there are warning signs. Ask yourself the following:

  • Do you hate coming to work each day?
  • Do you find excuses to be out of the office?
  • Do others consider you hostile and defensive?
  • Are you always upset?
  • Have you had these feelings for more than 6 months?

If you've answered yes to 4 out of 5 of these questions, you got a problem. Do something about it. It may be that you are burned out. In the IT field it happens a lot. We’ve all been there. Big projects, unreasonable deadlines and bosses, stress at home, and too much to do with too few resources are just some of the causes of IT burnout. Sometimes you have to take some time off and get your life back in order.

When I experience burnout, I pull back a little and reassess my life. I spend more time with my family and less time at work. I stop worrying about the areas that are out of my control and focus on the ones I can control. I delegate so that others can “feel my pain” and to lighten my load a little. Also, I pray a lot.

What if you tried those ideas…and a few others…and nothing happened? Well my friend, you’re not burned out, you are checked out. What do I mean by being checked out? Checked out means that, like Elvis, you’ve left the building---only you don’t know it yet. If you’re in this situation, find a new situation. Start looking. I promise you, it’s not going to get better till you do. If you stay at your current job more money won’t help, new bosses won’t help, new responsibilities or that raise they’re promising you if you stay won’t help either. Get off your duff, brush off your resume, and find a new job. Until you do, you will continue to answer yes to the above questions.

Thursday, June 17, 2004

Is Information Technology Becoming a Commodity?

I've been reading Does IT Matter? by Nicholas Carr. He argues that IT is going to go the way of railroads, electricity, etc. Meaning that information technology will become a commodity...a cost of doing business. In my opinion a lot of factors have to fall into place for this situation to occur.

First, availability of broadband Internet services has to be cheap, reliable, and less prone to hacker attacks. I think we're a long way toward this end. Look at Internet service today versus 5 years ago. When's the last time your ISP was down compared to then? ISPs, especially commercial providers, are extremely reliable today. Additionally their costs are reasonable...though I think that broadband service could come down a bit. One of the core problems with Internet service is hacker vulnerability. From an Internet connected server standpoint we're still living in the Wild West. As server vulnerabilities are reduced and overall service improves, the Internet component of the transition of IT from strategic player to commodity will be solved.

Aside from improvements to Internet services, companies have to be willing to adopt standard ways of transferring information to each other. EDI has been around for years, but ask any EDI support person and they will tell you that each trading partner has a unique setup. XML offers hope, but it too has the same issues to deal with. A recent ComputerWorld article EDI Alive and Well After All These Years makes the point that companies aren't quickly moving away from EDI to XML. Instead, they are moving away from Value Added Networks (VANs) to FTP transfers and Internet standards for delivering EDI documents.

What makes electricity so attractive to businesses (and individuals) is that once it reaches the building, the breaker panel(s) control and parcel out the appropriate voltages. Then it becomes a matter of making sure that you have the right piece of equipment, appliance, etc. plugged into the right plug (with the right plug configuration of course). The same needs to happen with information transfers before they can be considered a commodity.

Hardware and software have to become more simplified for the end user. An example of this would be a phone. I daresay in developed countries almost everyone over the age of 3 knows how to use a phone. Whether it's a cell phone or a land-line, the average person can turn it on, dial a number, and have a conversation without much problem. Computers are not quite that simple. If you're in the IT field, how many times have you been called on to help a friend or family member with a PC problem? How often have executives in your company tried the latest high-tech gadget only to find it complex and confusing? Let's face it, interactions with computer hardware and software must improve before information technology becomes a commodity.

Let's talk about software for a moment. It can be argued that as more companies move away from in-house developed packages to so called "off-the-shelf" packages that they will become more standardized with other companies. On the surface it appears to be a valid point. In reality, today's ERP, finanical, WMS packages, whatever, have a tremendous amount of conifgurability for your organization. This means that although you and nearest competitor are running the same package, both of your implemenations can vary significantly depending on the customizations. The point, individual software implementations are a long way from being standard.

So back to the original question, is Informatiion Technology becoming a commodity? I think that parts of it such as Internet access are. But, I also think that we have a long, long way to go before IT becomes a commodity.

Tuesday, June 15, 2004

Java Quick Tip of the Day: Getting the Date in YYYYMMDD Format

There are times when you need to return a date as string in YYYYMMDD format. Here's a simple way to do it:
    import java.text.*;
    ...
    ...
    ...
    SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd");
    java.util.Date date = java.util.Calendar.getInstance().getTime();
    System.out.println(sf.format(date));
Technorati search