Never Underestimate Radical Vision

October 25th, 2008

BorrowMe Lives!!!

For the past month I have been working with some great developers to develop an application for the iPhone and iPod Touch. This has been a great experience and I have learned a ton. After the grueling process of learning something totally different than my normal development path, BorrowMe finally is available on the iTunes Store for $1.99. The following is the application description:

“Who borrowed that DVD?” “Who loaned me this book?” “Who has my lawn mower?”

Sound familiar? We have the same problem; we like to loan things to our friends, and we like to borrow things from them, but have trouble keeping track of what went where. Our solution: BorrowMe. BorrowMe makes it easy to keep track of what you have borrowed, and what you have loaned. No due dates, no collection notices, just a casual arrangement between friends, sealed with a handshake and a smile.

Keep track of your valuables, but value your friendships with the following key features:

  • Separate lists for items you have borrowed and loaned.
  • Enter a new item, or select it from a list of existing items.
  • Use an existing category, or create a new one.
  • Friends can be selected from your contact list, or entered by hand.
  • A list of frequent borrows allows for quick and easy entry.
  • Take photos of your items, or pick an existing photo from your photo library.
  • Easily mark items as returned, and see returned items on demand.
  • Transfer loan information from device to device with an electronic “handshake”. This feature works just like a real handshake transaction. You borrow something from a buddy and want to track that item in BorrowMe. Your buddy needs to keep track of the loan in his/her BorrowMe. No need for both of you to enter the item. All it takes is one person entering the item as either a Borrow or Loan and then sending it via the “Handshake”. Your buddy just receives the “Handskake” and the item s enters his BorrowMe as the opposite of what you sent!

I think it is a great little productivity application I will use all the time. Go to the iTunes Store and try it out!

September 11th, 2008

How to setup Hibernate 3.3.0.SP1 in Maven

Here is just a quicky for a problem I was having trying to use the latest Hibernate in a project. I needed to setup Hibernate and HSQL in my pom.xml file so the project would build. I Googled around and could not find the correct answer. I tried the JBoss Maven repo were Hibernate lives but could not get the artifact hibernate or hibernate-distribution to work. After playing around here is the dependancies that are needed to get Hibernate Core to build with your code and using HSQL DB.

	<dependencies>
		<dependency>
			<groupId>hsqldb</groupId>
			<artifactId>hsqldb</artifactId>
			<version>1.8.0.7</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>3.3.0.SP1</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.4.0</version>
		</dependency>
		<dependency>
			<groupId>javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.8.1.GA</version>
		</dependency>
	</dependencies>
May 8th, 2008

Domain Specific Languages with Groovy

In general a DSL, domain specific language, is a language built to attack a specific problem domain and the lexicon of that language matches the problem domain. Huh?! What?! Is that even English?! In a nutshell a DSL is a language that maps to a very specific problem and the keywords are ones the users/developers of that problem space are familiar with. For example you have the problem domain of interacting with Apple’s iPod. Instead of using a general purpose programming language like Java you could develop a DSL that attacks the specific problem of interacting with and iPod. You could have specific commands like play, load, fast-forward, etc. Doing this in Groovy is really simple with method pointers. An example method pointer would be:

say = System.out.&println 

So lets setup the iPod interaction scenario and create a DSL around that. The first thing we need is a Song class to hold song information:

class Song {
  def title
  def artist
  def album 

  static Song newSong(title, artist, album) {
    new Song(title: title, artist: artist, album: album)
  }

  String toString() {
    "${title} by ${artist} on ${album}"
  }
}

Next we need an iPod class to hold that information:

class iPod {
  def static songs = []
}

This now gives us a basis for creating a DSL. We could use the classes out of the box but they are not in the language the use would be used to. Let’s abstract the user away from the class model and create a DSL they would be familiar with. We will do this by setting up some method pointers:

create_song = Song.&newSong
say = System.out.&println
play = { iPod.songs.each{song -> say song} }
load = iPod.songs.&add

Now we can write a little DSL script for interacting with out iPod:

load(create_song("Blue Collar Love", "StarFlyer 59", "Silver"))
load(create_song("Chasing Cars", "Snow Patrol", "Eyes Open"))

play()

This is just a small example of what is possible. There could be other ways to accomplish the same thing but I like this way. With the

ExpandoMetaClass

and meta-class programming combined with method pointers you can create a really interesting DSL that can help users or developers of your application by abstracting away the hard stuff. You could also embed a scripting language into your application by using a DSL.

This is just another example of what makes Groovy so "Groovy"

May 7th, 2008

Give me two Red Pills

I just got out of a session about taking the Red Pill – Groovy and Meta-programming. This session was flat out awesome! The speaker was excellent and his demonstrations were impressive. In my group at work we have been building applications with Groovy for about two months and I have already swallowed the Red Pill, but after this session I want a second dose. There is so much more about Groovy that I need to learn to truly unlock its power. The meta-programming aspect of the language is my untapped market. The speaker did a great job of showing how Groovy enables more productivity by having Java examples and then showing the Groovy equivalents. There were many oohs, ahhhs and laughter about how easy certain things are. What was really cool is how he javap’ed the Groovy class to basically show the bytecode and prove that it is really Java under the covers. He did a great job pf pointing out that he has heard that Groovy may replace Java and laughed that off. He basically said it would be live "icing replacing cake", it is not going to happen. Groovy is Java and they live happily together. This is a really excellent point. You can use Groovy without fear that you are cheating on your precious Java. I will blog hopefully later about some really cool code examples of things he showed with the MetaClass programming. This stuff is really super cool programming magic.

The takeaways really are threefold:

  1. Try it! Use in unit tests because the meta-programming can really make unit testing rock for even the hardest of problems. Not only does it rock but it is like a drug, the more you use it the more you need it.
  2. If you need to build rapid applications for proof-of-concept, prototypes, etc. on a JVM you really can not afford to not use Groovy. It is just Java but with the icing to let you get were you need to go quickly. Groovy is not better than Java it is just the icing on the cake. You can build real applications for very low cost in development time. Not only that it is easy for Java programmers to pick up because it is a world they are already familiar with.
  3. Groovy can be used and is used it production. Oracle, IBM, LinkedIn, Sun, Mutual of Omaha, etc. are all examples of companies that use Groovy in production applications. Is is slower than Java, sure, but only in milliseconds. Not everything about a business application is performance. They use it, you can too!

I strongly encourage you to watch this presentation when it is posted for FREE on the JavaOne web site. I will post a link when it becomes available. Be fore you make your mind up on Groovy give this presentation a watch. Give Groovy a try before you relegate it to the insignificant. I have taken the Red Pill and am about to swallow my second.

November 8th, 2007

Variable initialization in BPEL 2.0

When using variables, either global or scope, in a BPEL process you have to make sure you initialize them with a value before use or an exception will be thrown. You can do this easily with an <assign> tag during the execution of the process. Yet, what if you want to use a global variable for the life-span of the process and do not want to reassign it on every <receive> or <pick> that starts the sequence?

As of BPEL 2.0 you can initialize your variables with an inline from-spec in the XML. What??? This is really quite simple. In the variable declaration sections that could look like this:

<variables>
       <variable name="PostCount" type="xsd:long"/>
</variables>

You just need to modify it with a from-spec like so:

<variables>
       <variable name="PostCount" type="xsd:long">
             <from><literal>1</literal></from>
        </variable>
</variables>

The the <assign>, <copy> and <to> tags are implied and do not need to be set.

This makes it very easy to initialize a variable at any scope when it is defined so you do not hit the uninitiated error when running your BPEL process. This also allows you to have global variables that can be used during the entire life-span of the process without having to reset it every <receive> or <pick> event.

NOTE: Currently the Sun BPEL SE for OpenESB does not support this inline variable initialization which makes using global variables for tracking quite pointless. Hopefully the team will implement this as it is standard BPEL 2.0.

October 19th, 2007

Maven repository tip #2

I was trying to deploy my maven plug-in to the internal repository and was having a little bit of trouble. I could not get my plug-in to deploy properly because of ‘Permission denied" errors. This was easily solved by deploying to the file path of the repo server instead of the http path of the web repo. For example, when deploying to a repo http://myrepo/maven2 that is stored on the local file system at /repo/maven/maven2 you need your scp:// statement to use the file system path so it shows up correctly in the http path. For example:

<distributionManagement>
  <repository>
    <id>internal-repo</id>
    <name>Internal repository for Maven</name>
    <url>scp://myrepo/repo/maven/maven2</url>
  </repository>
</distributionManagement>

Also, you can configure the authentication to the server in your Maven configuration file at MAVEN_HOME/conf/settings.xml. You need to add the following configuration under the <servers> element:

<server>
  <id>{unique repo id}</id>
  <username>{server username}</username>
  <password>{server password}</password>
</server>

For example:

<server>
  <id>internal-repo</id>
  <username>joeuser</username>
  <password>P@ssw0rd</password>
</server>

The id would be the same id you use in the deployment element in the pom.xml file.

 
October 18th, 2007

Maven 2 repository tip

"It’s a formidable scent… It stings the nostrils. In a good way."

I recently had issues setting a dependency to Ant 1.7.0 for a project I was developing. The default local repository for Maven 2 is located at ~/.m2/repository. This resolves in Windows  to C:\Document and Settings\{username}\.m2\repository.  When setting up a dependency in a project to Ant 1.7.0 the build would fail trying to grab Ant because of a illegal character in the path. It looks like Maven or something doesn’t escape the path properly and the spaces were causing the build problems. The fix was to point Maven to a new local repository path that had no spaces.

To do change your local repository:

  1. Navigate to MAVEN_HOME/conf/
  2. Edit the settings.xml file
  3. Under the <settings> element add an element called <localRepository> and enter your new path there.

For example, <localRepository>/.m2/respository</localRepository>

Your maven builds will take a little longer the first time you run them again because it fills the repository fresh. You could also just cut and paste your older repository contents and put them in the new place to minimize re-download.

October 9th, 2007

Firefox search tip

I love Mozilla Firefox. I think it is the best browser available. It has great plug-ins and themes. It also has this really cool keyword creation utility. Basically I use this for quick searching on sites I go to a lot like Google or Wikipedia. What you can go is setup a keyword that can be used as a shortcut on the URL address bar. For example, I use git:, short for "Google It", for quick searching Google. Say for instance you want to search Google for books, I would type in the url address bar git: books and hit enter. The browser would then use Google to search for books. I also have one for Wikipedia where I could search for books by typing in the URL address bar wiki: books. Following are the steps to set this up:

First, go to your favorite search site and enter something to search and grab the URL from the address bar after the serach. For instance if you search Google for books you get an URL of:

http://www.google.com/search?hl=en&q=books&btnG=Google+Search

If you notice in the URL the q=books area. This is where any search phrase goes for searching Google.

Second, you need copy this URL and go create and new blank bookmark. Bookmarks->Organize Bookmarks…, this will launch the Bookmarks Manager and click the New Bookmark button. You should see the following screen:

image

Next you enter a new for the key word search like "Google Search"

image

You need to now paste the copied URL into the Location: area

image

You need to find the q=books in the URL and replace it with a %s which is built in as a variable to basically mean any text you type after the keyword

image

to:

image

Finally add a meaningful keyword to the bookmark that you want to use for searching this site

image

Click the "OK" button and close the Bookmarks Manager. You can now clear the URL address bar in Firefox and type "git: books and stuff" (and remember the space between the keyword and the search phrase and you do not need the quotes) and hit the Enter button on the keyboard. You should now see a Google search results page for "books and stuff".

This is really a powerful, time saving feature that I can not live without. It is hard for me to use any other browser because I rely so heavily on my keyword search. You basically can use this keyword tool for any URL that you want to dynamically replace some text in the URL with %s. This works great for sites that have searches you use a lot. I have keywords for Google, Wikipedia, Dictionary.com and Wookiepedia (I am a Star Wars fan). Create a Google bookmark and get in the habit of using it and you will never type www.google.com in the address bar again.

Let me know how this works for you. If you have any trouble I could be persuaded to post a How-To video if needed.

June 16th, 2006

So long and good luck Bill!

If you haven’t heard yet, Bill Gates will be leaving a day-to-day role at Microsoft in 2008.  This is huge news to me!

I have always tried to be in the middle road on technology. I use Windows, Mac OS X and Linux. I have programmed in .NET, Visual Basic 6, Java, PHP, etc. I love learning new technologies and have always strived to keep the “technology holy war” out of my decisions and pick the best technology for the job. I will say lately I have been doing a lot of .NET stuff and loving every minute of it. I think Microsoft really hit a homerun with this technology and where they are taking it.

Whether you love Microsoft or love to hate them you have to give Bill credit, he has created a lot of jobs, buzz and new innovation in the field. You may be working for him, working with his tools or thinking of news ways to take him down but you are doing so because of the way he changed the industry. He didn’t always do the change himself but he motivated a Steve Jobs to bring Apple from the ashes to compete with Microsoft and finally get a measure of revenge on Bill. He ticked off Sun to make Java the best competing technology that it could build. He created the open source software movement by giving them an enemy to fight against. He gave millions of people jobs building software that allow other people to do their jobs better.

You may hate him or love him but you should thank him.  Thank you Bill Gates for what you have done to an industry that is my passion and my job. Thank you for pushing the industry forward. I may not have always agreed with the way you have done it but I am truly thankful. You have brought a profession most people never even thought of except for extreme geeks to others who living is a small town of Missouri would have never heard of if it wasn’t for you. Thank you!

I can’t wait to see what Microsoft does in the future and what changes it will make. I do know this, technology will never be the same!

February 25th, 2006

I want to be a Ninja

While reading through the posts as they scrolled across my aggregator this one (Are you a Java Ninja?) caught my sight. This looks like a really good way to take simple tests to how current you are with the latest Java technology. I beats paying all the bucks to get Sun certified, which I am not convinced is anything more than a money pit. I am not saying these test will help you get any jobs but they could be a fun way to test your current Java knowledge. As you take the test you even earn different colors of belts. I will keep you informed on my progress. Ok Andrew the contest is on.