Saturday, December 20, 2008

How to run the Spring Petclinic Sample Web Application

This week, I was asked to introduce a co-worker to some of the main Programming concepts behind Java Web Applications. This person was very familiar with DotNet, but had not touched Java in many years.

Like most programmers, he didn't want to read books...he wanted to get his hands on sample code as quickly as possible.

Rather than downloading the official Java EE Servers and exploring their sample code, I suggested he start looking at Java, Spring, and a lighter-weight Java Web Server such as Apache Tomcat.

Spring is NOT part of the official Java release from Sun. However, it is one of the leading (if not the leading) platforms to build and run enterprise Java applications.

Apache Tomcat is one of the leading (if not the leading) Java Web Servers (technically its a Java Servlet container). Unlike other industry giants such as BEA WebLogic ($expensive$), or IBM WebSphere($expensive$), Apache Tomcat (FREE) is not a full-blown Java EE Server and does not support the entire specification. That doesn't matter much though because developers have found it to be more than powerful enough to address a significant portion of the Enterprise Application problems out there. Especially when Apache Tomcat is paired with Spring.

So that's the set-up. There are more than enough documents out there on the Web which give detailed information about Java, Spring, and Tomcat. What I couldn't find for him is a straight-forward step-by-step guide on how to get these samples working for a Java-newbie. So here are my notes to him!

Before starting - you will need to download and install 3 things. A JDK (Java Development Kit), Apache Ant (one of the most widely used command-line build tools...very analogous to 'make' in the C/C++ world), and Apache Tomcat (the Java Servlet Container):

  • Java JDK download of 1.5 or higher


    • http://java.sun.com/javase/downloads/index.jsp

    • I downloaded "Java SE Development Kit 6u12"

    • After installing, add the JDK's "bin" sub-directory to your User or System Path

    • Test the installation!  Open a new Command-Prompt Window

    • Type "java -version"





  •  Download and Install Apache Ant 1.6 or higher - Command-Line Build Tool.  Not required for Java, but it's the most widely-used Build Tool


    • http://ant.apache.org/bindownload.cgi

    • I downloaded Ant 1.7.1 ( apache-ant-1.7.1-bin.zip )

    • Unzip this file to a location of your choice

    • Add Ant's "bin" sub-directory to your User or System Path

    • Test the installation!  Open a new Command-Prompt Window

    • Type "ant -version"





  • Download and install a Java Web Server.  I'd recommend Tomcat


    • http://tomcat.apache.org/download-60.cgi

    • I downloaded 6.0.18 under Binary Distributions / CORE / zip (apache-tomcat-6.0.18.zip)

    • Unzip this file to a location of your choice

    • Open a command-prompt, and Start-Up Tomcat by running "bin/startup.bat"

    • Open a web-browser and visit this URI: "http://localhost:8080/".  If Java and Tomcat are installed properly, you will see the Apache Tomcat Page!




We're almost there, now we have to download Spring (which will contain the sample PetClinic application)

  • Download spring-framework-2.5.6-with-dependencies.zip

  • Unzip everything - you will get a directory called "spring-framework-2.5.6"

  • Look in the directory samples/petclinic


    • in this directory, there is a readme.txt file.  That gives instructions on how to build the sample

    • Type "warfile" from the command-line to run warfile.bat

    • If all goes well, you should see the message "BUILD SUCCESSFUL"


  • In the directory "spring-framework-2.5.6/samples/petclinic/dist" you should now find a file called "petclinic.war".  this is the Web Archive - it contains the entire PetClinic Application.  This is the file that should be deployed to your Web Server.

  • Since the PetClinic sample needs a working database, the Spring developers have kindly provided a small java database ready-to-go. You can Start-Up the pet clinic database by running this file


    • spring-framework-2.5.6/samples/petclinic/db/hsqldb/server.bat


  • Copy the petclinic WAR file to the Tomcat Webapps directory


    • Copy spring-framework-2.5.6/samples/petclinic/dist/petclinic.war


    • to this directory: apache-tomcat-6.0.18/webapps

    • About a second after copying the file, the WAR file will auto-deploy and you will see a new directory called apache-tomcat-6.0.18/webapps/petclinic


  • The application is now deployed. 


  • Try to visit this URI:  "http://localhost:8080/petclinic"




This should be all you need to do to make Java, Apache Ant, Apache Tomcat, and Spring run on a machine that never had any of these installed before.

Wednesday, October 1, 2008

Insurance Breaks for Playing Computer Games...

I think Allstate Insurance is on the right track.

"Could playing computer games enhance mental agility enough to turn people over 50 into better drivers? Allstate Corp. wants to find out, and if the answer is yes, it might offer insurance discounts to people who play the games."


"Under a new pilot program called InSight, Allstate will offer specialized computer games to 100,000 customers in Pennsylvania aged 50 to 75...Then the group's accident rates will be compared to a control group of people who do not play the games."


I've got to ask my friend Ben in Pennsylvania if he's an Allstate customer...

Tuesday, September 30, 2008

The "N" key on my MacBook Pro is chipped again....

Am I the only person having this problem? The "N" key on the keyboard to my MacBook Pro is chipped again. I may type a lot, but I've owned countless keyboards and never had to replace keys due to regular usage.

Something's wrong with the material used to make keys on the MacBook Pro.

Wednesday, September 10, 2008

I've seen the future, and its comic books

Yesterday, I had a meeting with a marketing company that was looking for fresh ideas for their Web Campaigns. During our conversation, we talked about the best way to explain a concept to one of their clients. Eventually, we all agreed that whatever it was, it had to be simple and non-technical. "Stick Figures" was suggested. And that reminded me of these great videos I came across a few months ago from Common Craft.

Here's one of their many videos which explains various concepts using simple paper cut-outs. This one explains Social Bookmarking. (That's Delicioius, and if you're not using Delicous, you should be!).



Google has also headed in the direction of comic-books with an introduction to their new web browser Chrome. The sample page from the Chrome booklet below describes the concept of single vs. multi-threaded.

Why can't everything be this fun and simple?

Tuesday, August 19, 2008

World's Best Cup of Coffee!

....It's so good, that apparently Starbucks bought the company that makes it in order to prevent other people from having it!

Google's Motto - "Don't be evil"
Starbuck's Motto - "Burn Coffee, Make Money"


I first heard about the Clover coffee machine while reading a recent article out of Wired magazine (the ONLY print magazine worth subscribing too).

What's a Clover Coffee machine? Glad you asked...here's a video somebody posted that demonstrates this $11,000 coffee machine in action:



The Clover coffeemaker debuted in a handful of cafés in 2006 and was promptly hailed as the best thing to happen to coffee lovers since the car cup holder....The Clover also wowed Howard Schultz, founder and CEO of Starbucks. Last year, Schultz stumbled upon the machine in New York City when he had spotted a line of people standing outside a tiny joint called Café Grumpy. He tried a sample and declared it "the best cup of brewed coffee I have ever tasted." In March 2008, Starbucks announced the acquisition of the Coffee Equipment Company — the Seattle-based startup that manufactures Clovers in a converted trolley shed.

Out of curiosity, I had to try a cup. So I checked the Clover site (or what's left of it), and searched their map of Clover machines (there are only about 250 worldwide). In the Washington DC/Maryland/Virginia region, there are only 2 places!

Grape and Bean
118 South Royal Street
Alexandria, VA, 22314

Caffe Pronto
2329 Forest Drive, Suite G
Annapolis, MD 21401

I was traveling through Annapolis so I stopped at Caffe Pronto (and you have to go to the Forest Drive location, they have multiple stores, but the one at Riva is the only one with the Clover machine). The people there are super-helpful, friendly, and knowledgeable about coffee. So with or without the Clover...this is a really nice Coffee shop to visit. They recommended a Papua New Guinea Bean - it's mild and smooth.

Delicious.
One of the best cups of coffee,
...if not THE best cup of coffee I've ever had.

Karen tried some also, and she agreed -- it's really really good. Lots of flavor, but no bitterness or burnt flavors common with Starbucks. What's even stranger...most coffee gets bitter and tart as it cools. This coffee somehow seems to get more flavorful and smoother as you head towards the bottom of the cup.

Drip coffee machines don't come close to the Clover.
But I've had pressed coffee that tasted very similar to the Clover.

So if you're ever near a cafe that has the Clover machine...try it out! I plan to get a cup if I'm ever passing through Annapolis or Alexandria.

Monday, July 28, 2008

New Search Engine Cuil shows that I'm a musician from San Francisco!

A new search engine which competes with Google was just launched by an Ex-Googler called Cuil.

The main search entry screen works like Google Suggest, and presents a pop-up list of potential matches and hit-counts almost immediately. Search results are shown in a magazine-like format rather than a sparse list format.

...Curious, I thought I'd check it out and see what it says about me.

Sure enough, I see my picture, and this caption:



"Francis Wong has had a hand in guiding the San Francisco Bay Area Asian Improv label, along with such musicians as Mark Izu, Jon Jang, and the late Glenn Horiuchi. Wong has been a member of both Izu and Jang's groups. He also leads groups of his own, including the Great Wall, the eight-piece Asian Improv Arts Composers Workshop, and the trio Ming. Wong..."


Here's the problem, that description is mis-matched to my picture. As much as I'd like to be a musician in San Francisco...I'm not. Cuil is obviously trying too hard to find pictures to match up against web articles, and ends up looking in the wrong places. I'll have to spot-check it periodically and see if they fix this in the future...until then, I get to be a musician from San Francisco!

Friday, June 13, 2008

What to do when your Client doesn't pay?

Dilbert.Com lets people create their own punchlines to see if they are funnier than Scott Adams. Here's a comic I did this morning which sums up my limited options when working as a sub-contractor to one of the largest defense companies in the world.

Monday, May 19, 2008

Connecting a TomTom 720 GPS to a MacBook Pro with Parallels

Most USB devices work fine with my MacBook Pro and Parallels. And I can switch USB devices seamlessly between Mac OS X and Parallels. The only device that I've had trouble with is my TomTom 720 GPS. For some reason, this device always auto-disconnects in Vista under Parallels before I can do anything with the TomTom.

Here's a trick to make it work though. Before launching your Parallels OS, open the Configuration/USB panel, and set your USB support to "Connect to Guest OS". This means that any USB device will automatically be connected to the Guest OS (Vista in my case).

Now, when I plug the TomTom 720 into my Macbook Pro, it is immediately recognized in Vista, and works as expected.

Friday, May 16, 2008

Humanitarian Grid Computing

IBM is supporting an effort to used unused processing time from hundreds of thousands of computers to develop stronger and more nourishing strains of rice. This type of computing "...packs as much power as the third most-powerful supercomputer in the world..."

Ram Samudrala, a 36-year-old PhD who leads a 30-member research team, says it would have taken them decades to complete their rice research using the computing power at their disposal. With access to the World Community Grid, he says, he could generate results in less than two years.


For obvious reasons, I won't install this on any work-related computers. But I'm about to install it on the PC in my kitchen. So the kids can be researching rice while playing Roller Coaster Tycoon.

This isn't a new idea though...I remember loading something similar several years ago to help in the Search for Extraterrestrial Intelligence. Check out SETI@home.

SETI@home is a scientific experiment that uses Internet-connected computers in the Search for Extraterrestrial Intelligence (SETI)

Wednesday, May 14, 2008

Freecycle - Support Reuse! Toilets not welcome

In the past, I used Craigslist's free category to give away items. But many times, I'd have to sort through a lot of e-mail from people that don't live anywhere close to me...and they would need to drive from the other side of the city just to pick up the item. With the price of gas, that just didn't make any sense. People just weren't looking at the location before responding to pick up the item.

So I joined the Freecycle Network:

The Freecycle Network™ is made up of 4,363 groups with 5,106,000 members across the globe. It's a grassroots and entirely nonprofit movement of people who are giving (& getting) stuff for free in their own towns. It's all about reuse and keeping good stuff out of landfills. Each local group is moderated by a local volunteer (them's good people). Membership is free.

I like Freecycle better because they have very active local groups. My town's group has almost 3000 members. So if I post something, the people that are responding are usually within a few minutes of my house. You don't get a tax deduction for the donation. But its easy...and people come to me to pick up the items on my schedule.

Items I've Freecycled:

  • Crib Mattress

  • Toddler Bed

  • FAA approved Baby Flight Safety Vest

  • Game Boy Advance SP

  • Lots of Baby Toys

  • Toddler Swing

  • Old School 27" TV

  • Kids Shoes

  • Framed posters


The Game Boy elicited the biggest response. I had almost 50 messages in less than a hour after posting. That seems logical.

There were 2 items that received zero responses:


  • Sterling Brand Toilet (like new!)

  • Encyclopedia Brittanica Set



Out of everything I've listed, its the Toilet that's actually worth the most (I looked it up, its almost $200 brand-new. And this toilet is hardly ever used.

Surely somebody needs a replacement toilet. But I suppose free has its own set of values. And toilets carry an "ick" factor.

And the Encyclopedia is just a reflection on reality. Nobody wants them. They aren't worth the paper they are printed on. I can't even give them away.

Hotmail users can help a charity just by sending e-mails!

Last night while trying to fiddle with my Hotmail options, I noticed a new configuration titled "i'm making a difference". Curious, I clicked on it. It turns out that Microsoft is participating in a program which shares advertising revenue gained from e-mails with a charity of your choice! And its free to participate.

So if you're a hotmail user, consider enabling that option and giving some money to charity just by sending e-mails.

I'M is a new initiative from Windows Live Hotmail that shares a portion of our advertising revenue with some of the world's most effective social cause organizations. For every mail you send from Windows Live Hotmail, you help address the issues you feel most passionate about, including poverty, child protection, disease, environmental degradation and animal protection....You'll be making a difference and there's no charge to you.




The program is called I'm making a difference. As of May 14, 2008, the site claims $1,494,480 has been raised so far.

Tuesday, May 13, 2008

When Apple wins, Microsoft wins too!

I stumbled on this article that shows that when Apple wins...Microsoft wins too!

Microsoft's Mac unit is set to disclose on Tuesday that copies of the new Office for Mac 2008 are flying off the shelves at three times the rate of its predecessor. The company wouldn't disclose sales numbers, but said the sales are the highest in the 19-year history of the unit.

Wednesday, May 7, 2008

My love affair with TIVO is just about over...

I was one of the biggest and most vocal fans of TIVO for many many years. Several friends bought TIVO after seeing demonstrations in my home. And I currently still have 3 active TIVO boxes (a lifetime Series 1, and two Series 2).

But over the past year, TIVO began to do evil things to me....

My problems started last year, when TIVO mysteriously increased the monthly billing rate for my Series 2 system from $6.95 to $12.95 WITHOUT NOTIFYING ME! They had my credit card, so this silent increase continued for several months before I noticed it.

It took several phone calls just to get things back to the way they were. A credit was given, and a correction was made so everything should have been business as usual.

But, one month later, $12.95 again. I was upset enough that I tried to leave TIVO and purchased an entirely new high-end HP Vista Home Premium box with Windows Media Center. Luckily for TIVO, Media Center is total garbage and proved to be unreliable.

In full disclosure, there was a clause buried in the TIVO multi-box discount agreement. If a TIVO box with a lifetime subscription is inactive for 180 days, they assume the box is no longer in service and discontinue the multi-box discount. Reconnecting the lifetime TIVO after 180 days is not good enough. Apparently their Server software can turn the discount off, but it has trouble turning the discount back on. Nice.

Technically, I thought I was doing TIVO a favor by not taxing their analog phone lines with regular Series 1 phone calls. But TIVO sees things differently, they need to have it make regular phone calls. So now - in order to make TIVO happy - my analog Series 1 box sits alone in a quiet room. It's exclusive purpose in life is to make periodic phone calls to TIVO so it can "phone home". I hope TIVO is happy now.

My newest beef with TIVO has to do with their TIVO Desktop software. In prior versions of TIVO Desktop, Desktop included a feature for free which lets me transfer MPEG files from any PC in my house to my TIVO Series 2 boxes through my LAN. This effectively gave me a networked video-on-demand system! I loved this set-up.

But in a recent TIVO desktop upgrade, they moved this feature from the free version to the Plus edition. So now I must pay an additional $24 for a feature I've had for the past couple years. Unlike a typical software upgrade, this upgrade removed features. Transferring files has ZERO impact on TIVO servers because its completely contained within my LAN. So now do I stay with TIVO and upgrade to Plus? Or leave TIVO out of principal for removing a feature and expecting me pay $24 to get it back.




Maybe I'll build a MythTV Box....

Tuesday, April 29, 2008

I love the Apple Genius Bar!

The "N" key on my MacBook Pro was wearing down prematurely. I have no idea why its only the "N" key...every other key on the keyboard is holding up just fine. I tried to contact Apple support through their website, but it directed me to the Apple Store in Tysons Corner instead.

So yesterday on the way home from work, I decided to stop by the store and get it fixed.

How good was my customer service experience at Apple? In one word - FANTASTIC. It's a Monday, and the store was still buzzing with about 25 customers spread throughout the room. First thing upon arrival, I had to schedule an appointment with a Genius at the Genius Bar through Apple's Concierge. (you can also make an appointment ahead of time through Apple's website by the way).

While waiting - I checked e-mail in the "theater" at the back on what has to be the fastest WiFi connection I've ever stumbled across.

Within about 20 minutes, it was my appointment. Like a doctor's office, they call out your name and you shuffle up to the bar. I showed him the worn-down key....and without even looking at the serial number, he checked the rest of the keyboard for problems, walked into the back, and installed a new key...just like that. Granted, this wasn't a hard repair...but I didn't even have to fill out anything.

"Anything else I can help you with?"

This part I wasn't prepared for...now I wish I prepared a list of questions before I arrived. I just wasn't thinking ahead. So I rattled off anything that came into my head for the next 15 minutes. Things I wanted to know about Macs...but was too lazy to look up. He knew it all -- except for one question. (Can I upgrade from Beta BootCamp on Tiger to the BootCamp v2.1 update? The answer is NO -- I need to upgrade to Leopard first).



So here's two tips for first timers to the Genius Bar:


  • Schedule an appointment ahead of time on the web-site. Click here, to find the closest Apple Store location, then Reserve a time at the Genius Bar.

  • Make a list ahead of time with any questions you have about your Mac. Unlike other ordinary stores -- these guys actually know what they are talking about!



Also - back-up your hard-drive just in case you have to leave it overnight for repairs.

Saturday, April 26, 2008

Video Games and Violence - There's a book!

In the WashingtonPost today, I stumbled on yet another article discussing the links between Video Games and Violence. The catalyst for this discussion was the upcoming release of Grand Theft Auto IV this week.

As it turns out, there was a Harvard study on this topic (it was federally funded!). And the authors of that study have now published a book on their findings. (published April 15, 2008)

Even if your kid does play the game ... well, it might not warp him or her for life. The study was conducted by a husband-and-wife team who are co-founders of the Center for Mental Health and Media and serve on the psychiatry faculty of Harvard Medical School. The findings are published in their new book, titled "Grand Theft Childhood."...Olson said, real-world statistics paint the picture as vividly as any research. "In some ways, it's common sense," she said. "Game playing has been going up and violence has been going down."


The authors also have a companion website to the book where they list and dispel some myths regarding the topic:

MYTH: The growth in violent video game sales is linked to the growth in youth violence — especially school violence — throughout the country.

FACT: Video game popularity and real-world youth violence have been moving in opposite directions. Violent juvenile crime in the United States reached a peak in 1993 and has been declining ever since. School violence has also gone down. Between 1994 and 2001, arrests for murder, forcible rape, robbery and aggravated assaults fell 44 percent, resulting in the lowest juvenile arrest rate for violent crimes since 1983. Murder arrests, which reached a high of 3,800 in 1993, plummeted to 1400 by 2001.

Friday, April 11, 2008

Maryland Tech Tax Repealed

For those that didn't know, Maryland had enacted legislation to place a 6% Tech Tax on the following computer services:


  • Computer facilities management and operation.

  • Custom programming.

  • Computer system planning and design that integrate computer hardware, software, and communication technologies.

  • Computer disaster recovery.

  • Data processing, storage and recovery.

  • Hardware or software installation, maintenance, and repair.



But on April 5th, Maryland repealed the tech tax. This region is so small and dense. Tech Labor, and small businesses can easily move to DC, Virginia, Delaware or Pennsylvania. Maryland was wise to repeal their doomed legislation. Hopefully this will be a lesson to any other states that are thinking of drafting new legislation that singles out the computer field.

Could Video Games Reduce Violence?

In a recent Reuters article, Stephen King (the horror writer) was criticizing a US State's plan to ban violent video games...

"What makes me crazy is when politicians take it upon themselves to play surrogate parents. The results of that are usually disastrous. Not to mention undemocratic," wrote King.


So can games cause violence? Or could games actually reduce violence? Some people are so sure that video games cause violence that they will take legal action. A family attempted to blame the Columbine massacre on the video game DOOM. Is there a link?

Let's look at some facts...the legendary sci-fi shooter DOOM was released in 1993. Ten million people played the game in a span of 2 years. Another game mentioned was Duke Nukem. There were multiple Duke Nukem games, but the violent shooter variation of this was released in 1996. What made games like these and the original classic Wolfenstein a concern was their 3-d animation and motion which simulates a first-person's perspective. Now if violent action games like DOOM and Duke Nukem cause violence, there should be an measurable increase. After some Googling, I landed at the site of the Bureau of Justice.


Nonfatal firearm crime rates have been declining since 1994



After peaking in 1993, the number of gun crimes reported to police declined and then stabilized at levels last seen in 1988.



Graph reproduced from the Bureau of Justice Site.
Click here to see it at the source.


Looks like violent crimes actually dropped after 1993. As a matter of fact, they not only dropped, but continued to drop.

What if a prison installed inexpensive PlayStation2 consoles everywhere, and let the prisoners play games. Would there be a measurable drop in violence? Does anyone know if this has ever been tried?

Imagine if it were true, we wouldn't have to ship troops over to Iraq, just Game Consoles.

Wednesday, April 9, 2008

Spooge Error? Dawn Of War does work on a MacBook Pro



I recently ran into problems with Dawn of War on my MacBook Pro when Patch 140 was applied. The next time I launched Dawn of War after Patch 140 was applied, I was greeted with the following odd error:



"Spooge driver not found. Verify that DirectX is properly installed."

Chances are - you are fine, and there is no driver problem. If you Google the Net you'll see lots of people offering advice to run diagnostics, load drivers from unofficial locations, reload DirectX..... Don't do any of that...it's unnecessary. And it may also really mess up your system if you install a video driver that didn't come with Boot Camp.

Instead, continue applying Dawn of War patches manually until you reach the latest official patch release (v1.51). Now since Dawn of War is no longer working, you'll have to download them manually from here:

Dawn of War Patches

Once you've reached the highest patch level available (currently v1.51), then follow the instructions at this link. It's a small text file that tells Dawn of War to ignore the Spooge error.

Spooge error with VISTA and 8800 GTX

This blogger's patch was for Vista and an 8800 GTX card. But it also works for the 8600M board that's built into the MacBook Pro.

Now Dawn of War should run without problems. I hope this saves other people a lot of headaches. Dawn of War is an EXCELLENT game and it runs super-smooth at high resolutions on a MacBook Pro. Don't let that Spooge Error wreck your day!