Friday, September 29, 2006

Hibernate Tutorials

In my first Java database application I used straight JDBC calls to a simple Access database. This was good for practice but now I need a more Object related database approach and Hibernate seems like the way to go.

Here are some recommended Hibernate Tutorials that explain the basics of setting up a Hibernate project.

Hibernate Introduction
Hibernate Tutorial
Hibernate Tips & Tricks
Getting Started with Hibernate

If you are subscribed with ACM (Association of Computing Machinery) or have a Safari account there are some good Hibernate books that can be read online as well.

Wednesday, September 27, 2006

Eclipse vs Netbeans?

NetBeans 6.0M3 vs. Eclipse 3.3M2 by ZDNet's Ed Burnette -- Last week Sun and the Eclipse Foundation both released milestone versions of their flagship Java IDE/rich client platforms. This planetary alignment provides a unique opportunity to compare the state of development of these two open source projects....

Velocity in Java

Velocity is a very useful template tool. I use it with my mailing list software to prepare the jobfiles based on user input through a GUI. Each of the variables are set through the GUI and then the text jobfile is created using Velocity.

Here are some good links to get going with Velocity:

Java World - Velocity
Apache Jakarta - Velocity

Tuesday, September 26, 2006

Rename Column in Oracle SQL / PLSQL

To rename a column in an existing table use the following:

ALTER TABLE tablename RENAME COLUMN oldcolumn TO newcolumn;

Monday, September 25, 2006

Java and Study Technology

Learning Java is easy. That is if you know the secret to learning. I did a course called the Student Hat which is a Scientology course that teaches you how to study and ever since then, I've been able to learn ANY subject.

I was reading up on the difference between Abstraction and Interfaces today and was having a difficult time grasping it. Then I realized I didn't know what the word "Abstraction" meant. So I looked up this word, used it in sentences until I felt good about it and then carried on reading. The rest of the material made total sense and was not difficult to grasp any longer.

The secret of learning any subject is found in the Three Barriers to Study. There are several courses that you can do at any Scientology organization, starting with the Basic Study Manual or Learning How to Learn, all the way up to the Student Hat course and Key To Life course.

Doing these courses you can arm yourself with the skills to learn any subject, literally.

Sunday, September 24, 2006

Swing Events - Introduction

Here is a brief overview of how events work in Swing. This is from the IBM Swing Beginner Tutorial and is an important fundamental when learning Swing:


Finally, we get to one of the most important parts of Swing: dealing with events and reacting to interaction with the UI. Swing handles events by using the event/listener model. This model works by allowing certain classes to register for events from a component. This class that registers for events is called a listener, because it waits for events to occur from the component and then takes an action when that happens. The component itself knows how to "fire" events (that is, it knows the types of interaction it can generate and how to let the listeners know when that interaction happens). It communicates this interaction with events, classes that contain information about the interaction.

With the technical babble aside, let's look at some examples of how events work in Swing. I'll start with the simplest example, a JButton and printing out "Hello" on the console when it is pressed.

The JButton knows when it is pressed; this is handled internally, and there's no code needed to handle that. However, the listener needs to register to receive that event from the JButton so you can print out "Hello." The listener class does this by implementing the listener interface and then calling addActionListener() on the JButton.

JTable Defined

I am going through the beginner Swing tutorial put out by IBM and here is a good description of the JTable:


Think of an Excel spreadsheet when you think of a JTable and that should give you a clear picture of what the JTable does in Swing. It shares many of the same characteristics: cells, rows, columns, moving columns, and hiding columns. The JTable takes the idea of a JList a step further. Instead of displaying data in one column, it displays it in multiple columns. Let's use a person as an example. A JList would only be able to display one property of a person -- his or her name for instance. A JTable, however, would be able to display multiple properties -- a name, an age, an address, etc. The JTable is the Swing component that allows you to provide the most information about your data.

Unfortunately, as a trade-off, it is also notoriously the most difficult Swing component to tackle. Many UI developers have gotten headaches trying to learn every detail of a JTable. I hope to save you from that here, and just get the ball rolling with your JTable knowledge.

Many of the same concepts in JLists extend to JTables as well, including the idea of different selection intervals, for example. But the one-row idea of a JList changes to the cell structure of a JTable. This means you have different ways to make these selections in JTables, as columns, rows, or individual cells.

Blogger Categories and the lack thereof

I've been blogging for about a month now, not really gotten the hang of it. I've made many posts to my main blog "The Paradigm Shift" and received over 3,000 vistors so far. The only problem is that there are no categories in my blog and now it is unusable for me. I made the blog originally as a storage of helpful items and tips that I would need to refer back to.

I just ran across something now in Java that I worked out a solution for in the past, (How to check if a date is valid in Java) and posted to my blog, but now it is buried in archives somewhere. It took more than a few seconds to go back and find it.

Now Beta Blogger came out with the new blogger categories and I am trying this out with this new blog. I heard that soon Blogger will allow you to convert your existing blog over to the new blog format with categories, but I didn't want to wait so thus, this blog.