Thursday, May 31, 2007

[Humor] Copy n Paste

A well known motivational speaker gathering the entire crowd's attention, said "The best years of my life were spent in the arms of a woman who wasn't my wife"
The crowd was shocked...
He followed up by saying, "That woman was my mother"
The crowd burst into laughter and he gave his speech, which was well received.
About a week later, one of the top managers of an organization who had attended the speech decided to use that joke at his house. He tried to rehearse the joke in his head. It was a bit foggy to him.
He said loudly, "The greatest years of my life were spent in the arms of a woman who was not my wife"
Naturally, his wife was shell shocked, murmuring.
After standing there for almost 10 seconds trying to recall the second half of the joke, the manager finally blurted out "... and I can't remember who she was"
As expected, he got the thrashing of his life time...

Moral of the story:
Don't copy if you can't paste J J J

[Received in an email]

Sunday, May 20, 2007

Show'em Who's Boss

Received this seriously funny pic in an email forward :)





How true it is!

Monday, May 14, 2007

If you just focus on fixing someone...

Rajesh Setty of Life Beyond Code has this inspiring entry about 'fixing' people.

Your spouse wants to fix you.

You want to fix your spouse.

Your parents want to fix you.

You want to fix your children.

Your teachers want to fix you.

You want to fix your teachers.

Your boss wants to fix you.

You want to fix your boss.

Your colleagues want to fix you.

You want to.. well you get the point.

Wanting to fix someone whether right or not has one problem. In your quest to fix that someone, you forget to leverage the strengths of the that person for the benefit of both.

Next time, before you attempt to "fix" someone, why not focus on what that person brings to the table and see how best both of you can benefit from it?


http://blog.lifebeyondcode.com/blog/_archives/2007/5/10/2941581.html

Sunday, May 6, 2007

Java 6 Feature : Working with Derby Database

The Java 5 and Java 6 releases have introduced some significant changes. While Java 5 introduces new features (e.g. Generics, Variable arguments, Enhanced for loop, Boxing/unboxing, Type-safe enumerations, Static import, Metadata), Java 6 installation includes a lightweight database known as Derby.
Derby is actually an Apache Database project. Derby is a transactional, relational database and provides a small footprint on disk. When you install Java 6, core libraries, example programs, and a sample database gets automatically installed.
Derby has a command-line tool called ij. This tool provides a way to connect to and manipulate Derby databases.

To connect to Derby is quite easy. You need to have following jar files in the classpath to enable you to access Derby:
D:\tools\jdk1.6.0_01\db\lib\derby.jar
D:\tools\jdk1.6.0_01\db\lib\derbytools.jar

The derby.jar has JDBC drivers, while derbytools.jar contains the ij tool.

Once you have configured the classpath for Derby, open the command prompt, and start ij tool:
C:\Documents and Settings\Administrator>java org.apache.derby.tools.ij
ij version 10.2
ij>

You are now connected to Derby db.
Connect to the supplied example database (toursdb):
ij> connect 'jdbc:derby:Absolute_Path_to_the_connecting_database';
ij>

You can create a new database from the ij tool.
connect 'jdbc:derby:DB4MyApplication;create=true';

A semicolon (;) at the end of each command is also required.
You can get a list of Derby commands by issuing help command.
ij> help;

Supported commands include:

PROTOCOL 'JDBC protocol' [ AS ident ];
-- sets a default or named protocol
DRIVER 'class for driver'; -- loads the named class
CONNECT 'url for database' [ PROTOCOL namedProtocol ] [ AS connectionName ];
-- connects to database URL
-- and may assign identifier
SET CONNECTION connectionName; -- switches to the specified connection
SHOW CONNECTIONS; -- lists all connections
AUTOCOMMIT [ ON OFF ]; -- sets autocommit mode for the connection
DISCONNECT [ CURRENT connectionName ALL ];
-- drop current, named, or all connections;
-- the default is CURRENT

SHOW SCHEMAS; -- lists all schemas in the current database
SHOW [ TABLES VIEWS PROCEDURES SYNONYMS ] { IN schema };
-- lists tables, views, procedures or synonyms
SHOW INDEXES { IN schema FROM table };
-- lists indexes in a schema, or for a table
DESCRIBE name; -- lists columns in the named table

COMMIT; -- commits the current transaction
ROLLBACK; -- rolls back the current transaction

PREPARE name AS 'SQL-J text'; -- prepares the SQL-J text
EXECUTE { name 'SQL-J text' } [ USING { name 'SQL-J text' } ] ;
-- executes the statement with parameter
-- values from the USING result set row
REMOVE name; -- removes the named previously prepared statement

RUN 'filename'; -- run commands from the named file

ELAPSEDTIME [ ON OFF ]; -- sets elapsed time mode for ij
MAXIMUMDISPLAYWIDTH integerValue;
-- sets the maximum display width for
-- each column to integerValue

ASYNC name 'SQL-J text'; -- run the command in another thread
WAIT FOR name; -- wait for result of ASYNC'd command

GET [SCROLL INSENSITIVE] CURSOR name AS 'SQL-J query';
-- gets a cursor (JDBC result set) on the query
-- SCROLL cursors are only available
-- in JDBC 2.0 and higher.
-- (Cursor scroll type is ignored in JDBC 1.X.)
NEXT name; -- gets the next row from the named cursor
FIRST name; -- gets the first row from the named scroll cursor
LAST name; -- gets the last row from the named scroll cursor
PREVIOUS name; -- gets the previous row from the named scroll cursor
ABSOLUTE integer name; -- positions the named scroll cursor at the absolute row number
-- (A negative number denotes position from the last row.)
RELATIVE integer name; -- positions the named scroll cursor relative to the current row
-- (integer is number of rows)
AFTER LAST name; -- positions the named scroll cursor after the last row
BEFORE FIRST name; -- positions the named scroll cursor before the first row
GETCURRENTROWNUMBER name; -- returns the row number for the current position of the named scroll cursor
-- (0 is returned when the cursor is not positioned on a row.)
CLOSE name; -- closes the named cursor
LOCALIZEDDISPLAY [ ON OFF ];
-- controls locale sensitive data representation

EXIT; -- exits ij
HELP; -- shows this message

Any unrecognized commands are treated as potential SQL-J commands and executed directly.

So, now you have a lightweight DB installed alongwith the JDK. You can use this database for Proof-of-Concepts (POC), sample applications, demos among other things. To connect to Derby from Java, use the supplied driver
org.apache.derby.jdbc.EmbeddedDriver
. Connect to DB as shown earlier.

Saturday, May 5, 2007

Developing a Spring Framework MVC application step-by-step

Recently, I started reading on Spring. I was looking for an example application code, and then, I came across this article on springframework.org. The article is quite old (first written in July 2003, and then revised in April 2005), but quite relavent to topic. This is a hand-holding type of tutorial and develops an application from scratch, covering various Spring components, and even talks to HSqlDB, with JUnit test cases. Ant is used for deployment. It takes not more than 2-3 hours to develop the complete application.

Application is covered in 4 steps:
  • Basic Application and Environment Setup
  • Developing and Configuring the Application
  • Adding Unit Tests and a Form to the Application
  • Implementing Database Persistence

The tutorial assumes a Tomcat installation, but then u can develop it for any servlet engine or application server (e.g. i did it for JBoss).

it is a good exercise if u r new to Spring, or want to have a first hand look at Spring.

http://www.springframework.org/docs/MVC-step-by-step/Spring-MVC-step-by-step.html

Tuesday, May 1, 2007

Java 5 Feature: Static Imports

Static imports are another convenience feature added to version 1.5 that extends the way imports work in Java. For example, consider the code fragment shown below that calls the static ceil() method on the java.lang.Math class


// x is a number of type double such as 98.765
double y = Math.ceil(x);


With static imports in 1.5, you can ask the Java compiler to import only a class's static portions, as shown, for example, in the rewritten code fragment below:


// Import declaration at the top of the class along with the other imports
import static java.lang.Math.ceil;

// And then somewhere in the code...

// x is a number of type double such as 5.345
double y = ceil(x);

In the above fragment, I used the new static import feature to import the static method ceil() from the Math class. Now when I call the method, I don't have to qualify it with Math. If I wanted to use multiple static methods from the Math class, I could import them individually or all at once as shown below:

// Import all static methods from Math
import static java.lang.Math.*;


This also applies to any constants declared within Math, such as E and PI. With the above declaration, I can use these constants as if they were declared locally within my class (or superclass).

Use it when you require frequent access to static members from one or two classes. If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from. Importing all of the static members from a class can be particularly harmful to readability; if you need only one or two members, import them individually. Used appropriately, static import can make your program more readable, by removing the boilerplate of repetition of class names.

Sunday, April 22, 2007

Free eBooks on your cell

The jkOnTheRun blog points out a mobile e-book service, in Free eBooks on your cell:
Manybooks is mobile!, which points out that "Manybooks.net (a public domain / free eBook site) provides a mobile version of their offerings for Java-based cellphones! Point your browser to http://mnybks.net and you can download an eBook in .jar format for reading on the go. If you use Mobipocket reader on a handheld, you can also use the mobile site for Mobipocket format books."
Though these are non-DRM titles, Manybooks states that there are over 16,000 titles available.

Links

Wednesday, April 18, 2007

New Features in Java 5

Several useful features have been introduced in Java 5.
  • Generics: A way to make classes type-safe that can work on any type, such as narrowing an instance of a collection to hold a specific object type and eliminating the need to cast objects when taking an object out of the collection.
  • Enhanced for loop: A cleaner and less error-prone version of the for loop for use with iterators.
  • Variable arguments: Support for passing an arbitrary number of parameters to a method.
  • Boxing/unboxing: Direct language support for automatic conversion between primitive types and their reference types (such as int and Integer).
  • Type-safe enumerations: Clean syntax for defining and using enumerations, supported at the language level.
  • Static import: Ability to access static members from a class without need to qualify them with a class name.
  • Metadata: Coupled with new tools developed by third-party companies, saves developers the effort of writing boilerplate code by automatically generating the code.

Better GMail : Cool Firefox extension

Found Better GMail firefox extension (via delicious). Adds a menu of optional extra features to Gmail (Macros, Label Colors, Filter Assistant, Conversation Preview, Attachment Reminder, Attachment Icons, Saved Searches).

Better GMail Firefox extension

Saturday, April 14, 2007

Management Lessons for Developers

Others may say that developers can't be managers, but I fail to accept that; I just think developers need to get the basics about management in short, easy-to-remember doses. With that, I now offer the "Five-Minute Manager":

Lesson #1: Communication

A man is getting into the shower just as his wife is finishing up her shower, when the doorbell rings. The wife quickly wraps herself in a towel and runs downstairs. When she opens the door, there stands Bob, the next-door neighbor.

Before she says a word, Bob says, "I'll give you $800 to drop that towel."

After thinking for a moment, the woman drops her towel and stands naked in front of Bob. After a few seconds, Bob hands her $800 and leaves.

The woman wraps back up in the towel and goes back upstairs. When she gets to the bathroom, her husband asks, "Who was that?"

"It was Bob the next door neighbor," she replies.

"Great," the husband says, "did he say anything about the $800 he owes me?"

Moral: If you share critical information with your coworkers and employees in a timely fashion, you may be in a position to prevent avoidable exposure.

Lesson #2: Knowledge

A priest offered a Nun a lift. She got in and crossed her legs, forcing her gown to reveal a leg. The priest nearly had an accident. After controlling the car, he stealthily slid his hand up her leg.

The nun said, "Father, remember Psalm 129?"

The priest removed his hand. But, changing gears, he let his hand slide up her leg again.

The nun once again said, "Father, remember Psalm 129?"

The priest apologized "Sorry, sister, but the flesh is weak."

Arriving at the convent, the nun sighed heavily and went on her way.

On his arrival at the church, the priest rushed to look up Psalm 129. It said, "Go forth and seek, further up you will find glory."

Moral: If you are not well informed, you might miss a great opportunity.


Lesson #3: Politics

A sales rep, an administration clerk, and the manager are walking to lunch when they find an antique oil lamp. They rub it and a Genie comes out and says, "I'll give each of you just one wish."

"Me first! Me first!" says the admin clerk. "I want to be in the Bahamas, driving a speedboat, without a care in the world." Puff! She's gone.

"Me next! Me next!" says the sales rep. "I want to be in Hawaii, relaxing on the beach with my personal masseuse, an endless supply of Pina Coladas and the love of my life." Puff! He's gone.

"OK, you're up," the Genie says to the manager.

The manager says, "I want those two back in the office after lunch."

Moral: Always let your boss (or your customer) have the first say.


Lesson #4: Relativity

An eagle was sitting on a tree, resting, doing nothing. A small rabbit saw the eagle and asked him, "Can I also sit like you and do nothing?"

The eagle answered: "Sure, why not."

So, the rabbit sat on the ground below the eagle and rested.

All of a sudden, a fox appeared, jumped on the rabbit and ate it.

Moral: To be sitting and doing nothing, you must be sitting very, very high up.


Lesson #5: Sincerity

A turkey was chatting with a bull. "I would love to be able to get to the top of that tree," sighed the turkey, "but I haven't got the energy."

"Well, why don't you nibble on some of my droppings?", replied the bull. "They're packed with nutrients."

The turkey pecked at a lump of dung, and found it actually gave him enough strength to reach the lowest branch of the tree. The next day, after eating some more dung, he reached the second branch. Finally after a fourth night, the turkey was proudly perched at the top of the tree.

He was promptly spotted by a farmer, who shot him out of the tree.

Moral: BS might get you to the top, but it won't keep you there.

Management Lessons for Developers
http://blogs.tedneward.com/2007/04/11/Management+Lessons+For+Developers.aspx

Thursday, April 12, 2007

Process Improvement – Is it a Lottery?

The Methods & Tools newsletter has just released in its html archive section the article "Process Improvement – Is it a Lottery?" by Paul Morgan। This article provides an overview of the approach utilized to implement process improvement across its global organization without losing focus of its business drivers। It provides a practical overview of how over a four year period an organization moved from CMM® Level 1 to Level 3 and is currently transitioning to CMMI® Level 4. It will provide a candid insight including lessons learned and approaches adopted to achieve success. It will also provide examples of significant and measurable business benefits that can be accrued from adopting a documented and repeatable process improvement framework.

A common mistake made by companies when implementing process improvement is to allow the chosen model to dictate the process design. The CMMI® is a model that needs to be interpreted based upon the business environment and technical needs of the project; it is not a standard that must be implemented exactly as documented. A failure to recognize this might still result in maturity levels being attained; however, the end product is unlikely to be a process suite which complements your operating needs.

Total Pageviews

Popular Posts