Wednesday, December 31, 2008

OpenSolaris Workstation for Grails Development

I am creating a new development environment for the new year. I hope by writing this it will force me to both think it through and commit to actually doing it. I have an underutilized desktop computer running OpenSolaris that was built to be a GlassFish application server. What little development I currently do is on a notebook computer running Windows XP. Recently I've concluded that the notebook is partially to blame for my underwhelming productivity. I can't see enough information on the notebook screen to work productively and since it has wireless networking I tend to use it all over the house. Since there isn't a specific place I sit when I want to work, there are usually plenty of distractions wherever I am. I think if I am forced to go to a desk and sit at a workstation my brain will know when it is time to code and therefore I'll be more productive. There could be an additional benefit to spending more time working in OpenSolaris, when I need to do server administration it might be a little easier.

The tricky part is I want to make this happen for $150 or less. That should be possible for several reasons: I can get a monitor at no cost, I won't need much hard drive space, memory prices are down, and I already know the components will run OpenSolaris. The computer I am going to upgrade was built with an old 15GB hard drive. Since it was an application server all it had to fit was OpenSolaris, MySQL, and GlassFish. Now that it will be a development workstation I want to increase the drive space and mirror the hard drive. The motherboard supports RAID 1 so all I need is two matching disks (maybe one more cable). A recent price check revealed I should be able to buy 250MB SATA drives for around $50 each. As a server, 1GB RAM was easily enough. I want to increase that and there is one empty memory slot. Adding a 2GB memory module, for a total of 3GB, will let me have enough horsepower to run an IDE, database, and application server locally for development. That will be another $25. Ideally I'd like to add a graphics card that supports dual monitors but that can always come later when there is enough money for new monitors.

I recently ordered OpenSolaris media since I wasn't pressed for time and could wait for it to be mailed. Unless I am mistaken I won't be downloading any software except Grails directly. Once the Operating System is installed everything else should come through a package manager.

Here are the steps I plan to follow:
  1. Pickup 19" monitor
  2. Add new hard drives and memory
  3. Install OpenSolaris 2008.11
  4. Install NetBeans 6.5
  5. Install GlassFish v3 Prelude
  6. Install MySQL 5.1
  7. Install Grails 1.1

Wednesday, December 24, 2008

A Grails Christmas

As of this post, Grails 1.1 Beta 2 has been released. We probably don't appreciate the effort and dedication that was involved in getting this release accomplished by the end of the year. Much obliged, all those Grails people.

I celebrate Christmas and I'm also learning the Grails Framework, so I would like to pass on a Christmas list (or in this case, a map) to convey my own Grails feature wishes. If they're not implemented in the 1.1 release then I will post it again during the next holiday season.

def christmasMap = [:]
christmasMap['Grails #5'] = 'Coffee Maker Plugin'
christmasMap['Grails #4'] = 'Email Integration'
christmasMap['Grails #3'] = 'Hannah Montana Security'
christmasMap['Grails #2'] = 'Rock Band/ Guitar Hero Plugin'
christmasMap['Grails #1'] = 'Grails and Groovy Gift Cards'
println christmasMap

#5) Coffee Maker Plugin
I would like to have a USB coffee maker and the ability to program it with Grails. The caffeine in the coffee would in turn motivate me to learn more Grails. This is a win for everyone.

#4) Email Integration
I can't do Christmas cards anymore because I just can't focus. I can do email though and it would be convenient to have email integration to send out mass holiday greetings to family and friends. I can then save the email data to send again next year.

#3) Hannah Montana Security
In order for Grails to gain further acceptance in the world we have to prevent Grails from being used for applications that will not further its cause. I'm guessing a Hannah Montana site would be an example of that and there should be built-in security in the framework. No offense, Disney.

#2) Rock Band/ Guitar Hero Plugin
Some days I just want to stop coding and go home and play Rock Band. How about a plugin that lets me program Grails and Groovy with my guitar, drums or even a microphone?

#1) Gift Cards
In the spirit of Christmas, what could spread good cheer better than Grails and Groovy gift cards?

Happy Holidays and have a Groovy New Year!

Monday, December 22, 2008

How Microsoft Should Sell Windows 7

I had a revelation recently about Microsoft Windows 7. I know how Microsoft Windows 7 could be a success. Sell two, and only two, versions of the product. These two versions should differ so greatly that every person who buys a copy will know immediately which version they want to purchase. It would be easy to tell which you want to buy if one cost $99 and the other cost $999.

$999 Microsoft Windows 7 - Code Name "High Dollar"
This version should come with everything you will ever want from Microsoft; all the client software they sell, and a Client Access License (CAL) for every piece of server software they sell. Do you run Outlook connected to Exchange? Good, the license is there. You still need to buy Exchange for your server but that would be all you'd need - the product license for the server-based product. Every "High Dollar" Microsoft Windows 7 PC could access it at no additional charge. Use Office? Which version? Don't worry about it! It's all in there, even Project and Visio and Access along with Word and Excel and PowerPoint. Run SharePoint and connect to SQL Server. Think about how much simpler it would be for a business if they didn't need to count licenses anymore. If every client machine had a "High Dollar" license they're done. Plus, think about how difficult it would be for any competing vendor to sell a server product with client license fees? What, you expect us to pay you for each client that connects to your Business Intelligence, Directory, Database, Portal, etc. solution? We can run the Microsoft server product without additional client license fees.

$99 Microsoft Windows 7 - Code Name "Blank Slate"
This version should come with nothing you don't want from Microsoft; no text editor, no browser, no calculator, not even Solitaire. "Blank Slate" is just an Operating System - software that controls the operation of a computer and directs the processing of programs (as by assigning storage space in memory and controlling input and output functions).(1) Microsoft Windows 7 could be the best platform ever if that was all it tried to be. All they need to do is a little marketing around this new platform. Small applications become widgets. Partners and vendors can create and sell anything from the simplest tool to an all-encompassing specialized desktop replacement. Open up a store like iTunes. If you want a clock in the lower, right-hand corner go find one for 99 cents at the iWindows App Store. There should be 20 to choose from, many will be free while one costs $1 million and claims it can actually control time. Basically don't do anything half-baked, simply don't do it at all. PC vendors can add value by installing their set of widgets for you. All the cool kids would be buying new widgets from the iWindows App Store every night and their PC would go from being a personal computer to a personalized computer.

So there you have it, free advice from me to the richest man on the planet because I know how Microsoft Windows 7 could be a success.


1. Operating System. (2008). In Merriam-Webster Online Dictionary.
Retrieved December 10, 2008, from http://www.merriam-webster.com/dictionary/operating system

Monday, December 15, 2008

GroovyBlogs Gets Famous

Glen Smith is taking a dip in the Aquarium. Congratulations to GroovyBlogs for the well deserved mention as a tool for Grails and Groovy adoption.

Monday, December 8, 2008

Hosting Grails Applications

Back in the day when clients would ask me if they should buy a home PC or build a home PC in order to save money, I knew what to do. I would ask them if they wanted a tool or a hobby. That made the answer easy; the ones that wanted a tool should buy, the ones that thought of it as a hobby would enjoy building a PC.

I'm facing that same predicament with Grails hosting . Originally the cost for a server with enough memory for Grails hosting was cost prohibitive. I couldn't justify $70 a month without a clear, quick path to become self-supporting. So I built a server and thought I would self-host and live with limited bandwidth. That greatly reduced the cost and removed the need to make a profit. Then I found a way to get free hosting for a year, and jumped at it. The Layered Tech hosting has been great.

I have learned that I don't enjoy the sysadmin responsibilities though. I don't mind so much taking care of the server I can reach out and touch, but the remote one I'd prefer not to deal with. It also is difficult to have multiple applications running simultaneously on one virtual server with 512 MB RAM when the WAR files are 20+ MB large. My attempts to use shared libraries in order to reduce the size of the WAR files on GlassFish V2 were unsuccessful. The process seems to be better documented for GlassFish V3 Prelude. If I go forward with OpenSolaris 2008.11 and GlassFish V3 Prelude, I will be moving away from Layered Tech's supported offering. I'm all right with this because I know I don't want to be a sysadmin when I grow up. I want a tool for hosting Grails applications because I don't want hosting Grails applications to be a hobby, I want developing Grails applications to be my hobby.

Here is what I'm considering as the plan for 2009:

Wednesday, December 3, 2008

Hard Stop at Grails 1.0.4?

I am beginning to get excited about January 2009. Quite often New Year's Day provides a time of reflection on the past 12 months and an opportunity to set goals for the upcoming year. If the timeline for the release of Grails 1.1 comes through as expected, January may be a perfect time for me to start fresh. Why? I know how easy it is to upgrade Grails versions. That is one of the many really nice features of the framework.
    grails upgrade

Could it be any easier? But I want to upgrade everything. NetBeans shipped 6.5, GlassFish has V3 Prelude, OpenSolaris is coming out with the 2008.11 version, and Grails 1.1 is in beta. I'm going to start planning on some new bits for the New Year.

Monday, December 1, 2008

Dave Klein Wins Santa Look-Alike Contest in GroovyMag

The new issue of GroovyMag is out and prominently features all of the contributors in Santa hats. I haven't found the poll location for tabulating votes but Dave Klein is a shoe-in to win since he is the only participant with the correct beard, no offense Robert.

Tuesday, November 25, 2008

Quote of Tomorrow via RSS

The latest release of Q2OH went live last night and now it truly delivers the Quote of Tomorrow. Each night a quote is chosen at random and added to the new RSS feed. It uses the Feeds plugin and the Quartz plugin to make it happen and both are remarkable. Here is what it took to create and schedule a job as part of a Grails app:

class FeedSeedJob {

def quoteService

def cronExpression = "1 0 0 * * ?"
def group = "QotdGroup"

def execute() {
def qotd = quoteService.getQotdQuote()
println "QOTD is ${qotd.content}"
}
}

I honestly don't know how it could be any easier.

Thursday, November 20, 2008

Today's Timestamp is Tomorrow's Date

I have been working on a RSS feed for Q2OH. The Feeds plugin makes it as easy as I can imagine. I have run into a quirk or two with data formats that have nothing at all to do with the plugin. It seems my Dates are Timestamps. Grails does such a good job of things just working that I never noticed before. Trying to format a Timestamp is not exactly the same as formatting a Date. Also, when an API needs a Date, it may choke on a Timestamp. This makes sense and once understood is not too huge a stumbling block. However I noticed one thing that I found interesting and works in my favor. Incrementing a Timestamp seems to turn it into a Date.

Since Q2OH is the Quote of Tomorrow, in the feed entry I add a day to the field that holds the day the quote was added to the feed. In the Domain Class Quote, qotd is a Date. Here is the entire code necessary to create the feed:

class FeedsController {

def rss = {
render(feedType:"rss", feedVersion:"2.0") {
title = "Q2OH >> Quote of Tomorrow"
link = "http://host:port/app/rss/feed"
description = "The Quote of Tomorrow"

Quote.findAllByQotdIsNotNull().each() { quote ->
entry("Quote for ${quote.qotd + 1}") {
link = "http://host:port/app/quote/display/${quote.id}"
author = quote.author
publishedDate = (java.util.Date) quote.qotd
quote.content // return the content
}
}
}
}
}

This results in an entry title of : Quote for Fri Nov 21 10:22:50 EST 2008

Originally the code was:
    entry("Quote for ${quote.qotd}") {

That had an entry title of: Quote for 2008-11-20 10:22:50.0

So if you ask me, tomorrow looks better than today.

Wednesday, November 12, 2008

I Can Empathize

Jan has a good point in this post... jan blog: It is very expensive to work with Grails. I got lucky when I found free hosting for a year. More accurately I was in the right place at the right time. If I hadn't already been experimenting with OpenSolaris and GlassFish for hosting Grails applications with a MySQL database, I wouldn't have seen the offer for a year of free hosting from OStatic. If I hadn't seen the offer I wouldn't have signed up and meet the requirements to get the free hosting. I have a VPS with 512 MB RAM. Even with the large size of a Grails .war file it will deploy multiple applications. I would like to try using shared libraries to be able to make very small .war files and host lots of applications. I haven't been able to get that to work on GlassFish V2 and most of the documentation I am finding for this feature is for GlassFish V3 Prelude. My hosting provider doesn't support V3 Prelude at this time so I'm not able to go that route just yet. When you consider it only costs $20 a month to host a full blown Java app that seems very reasonable. But how many $20's a month does it take to become unreasonable? I'm lucky, I still have 10 months to worry about how to pay the monthly hosting bill and I expect by then I will be able to find a provider supporting GlassFish V3, I'll have figured shared libraries out, and the economics of hosting a bunch of little applications will be reasonable.

Tuesday, November 11, 2008

SpringSource Gets Groovy

Wow! Big news this morning that SpringSource has acquired G2One, Inc. Read the press release and see what this means to the community. It seems to me that Rod Johnson is big on Grails. That is very exciting. All kinds of goodness should come out of this including improvements to the Eclipse support for Groovy and Grails. That is great news. Although I have been getting along just fine with NetBeans 6.5 it is important for the framework to have quality tooling, especially on Eclipse.

Thursday, November 6, 2008

Q2OH is now live!

Thanks to Ed's perseverance, Q2OH is now live and can be found at http://www.q2oh.com. You are all welcome to check it out, amaze your friends with a quote or just use it as a tool to procrastinate on your work.

Wednesday, November 5, 2008

What About GroovyMag Dave?

Kickin' down the cobblestones: Don't you hate blog posts about blogging?

I was reading through the first ever issue of GroovyMag and ran across a link to Dave Klein's blog. Having not read it in awhile I followed the link and found he was lacking an excuse for not blogging more often.

@Dave - Maybe it has something to do with the excellent contributions to the magazine?

Two More Failures

Two more issues with the production server have been resolved. First, GlassFish JVM settings were modified to make it actually work with only 512MB memory when deploying large .war files. I changed -client to -server and I reduced the max from 512 to 384. Not on the first try mind you. My first guess was to increase the perm gen but then nothing else would run on the server. It also took a lot of research to figure out how to have OpenSolaris forward http requests on port 80 to GlassFish running on port 8080. Most of the information I was initially finding was for using iptables on Linux. OpenSolaris doesn't have iptables and the previous way of using the inetd.conf file is no longer correct. So it took forever to find what is a very easy change. Enable ipfilter like so:

svcadm enable network/ipfilter
Then create an ipnat.conf file in the /etc/ipf directory with the following contents:

rdr xnf0 your.ip.add.ress/32 port 80 -> 127.0.0.1 port 8080 tcp

Load the file by using the -f attribute with ipnat:

ipnat -f /etc/ipf/ipnat.conf

Now the application can be deployed. But... in an effort to shrink the .war file, which was originally just short of 30 MB, I took out the fun features. This has left Q2OH an extremely simple application. So Q2OH 1.0 will be the Internet's simplest application.

Tuesday, November 4, 2008

I'm So Glad I Bought a Color Laser Printer

I can't wait to print out the first issue of GroovyMag. This looks like just the sort of resource I can use. I'm happy to support a quality publication like this and I look forward to purchasing future issues. Once I've actually read it I'll be sure to write a review.

Friday, October 31, 2008

Close But No Cigar

I have been trying to get the production server ready for a November 1st launch but it doesn't look like I am going to make it. My sysadmin skills are suspect and things that work just right in test seem to be yielding different results in production. Support at Layered Tech has been great. They are very responsive and have taken care of everything I've asked. Tickets get handled in a few hours and it doesn't seem to depend on the time of day. Now I just need to figure out why things aren't working the way I expect them to.

Monday, October 27, 2008

How Soon Can We Launch Q2OH?

I want to launch very soon. Testing has gone well. We still need to configure the production server. It is a race to the finish. Can we make it happen by November 1st? Stay tuned.

Thursday, October 23, 2008

Now This Is Cool

This sounds like an interesting demo. Sun has GlassFish playing two-player Tic Tac Toe over the Internet in a browser. Check out the blog post here.

Monday, October 20, 2008

Have a Test Server Ready

If we are trying to take advantage of free hosting, how did we happen to have a test server ready? Motivated by an excellent article, Build a (Very) Inexpensive Solaris 10 Workstation, I built a server out of spare parts and $150. One of the things that kept the cost so low is the long list of compatible hardware for OpenSolaris. We re-used a case (including power supply), optical drive, and hard drive. Newly purchased for the project were motherboard, CPU, CPU cooling fan, and memory. The easy-to-use package manager made installing GlassFish and MySQL a breeze, even without much experience running Solaris. Configured with a static IP address instead of using NWAM and an account at DynDNS the test environment was a lot less expensive then paying monthly hosting costs for a virtual server with similar specs.

Thursday, October 16, 2008

Grails Searchable Plugin is Awesome

I am working on adding search to the Q2OH web site. Getting it to work took about 20 minutes. Getting it to work just like I wanted it to took a day. All thanks to the Searchable plugin by Maurice Nicholson. It does exactly what it says it does and it does it well. I did run into a slight setback getting the suggested queries to work correctly. It was a syntax issue and once I got the spellCheck option correctly included in the closure it performed as advertised.

static searchable = {
only = ['content', 'author']
content: spellCheck 'include'
}

Now when you search for "sea", if there are no results it will ask if you want to search for "see" instead.

Thursday, October 9, 2008

First Failure

Well that didn't take long. Filters seem to be working differently between the development and test environments. This is why we test, right. Dev is a Windows XP notebook running Jetty. Test is an OpenSolaris x86 box running GlassFish. I am glad to have a test server running OpenSolaris and GlassFish so this didn't happen on the production site. I am using a filter with a uri which works fine in dev but appears to not do anything at all in test. It should force all requests to the login page for any user that is not already logged in. I will switch to using (controller:'*', action:'*') in the filter and see if that changes the behavior on GlassFish. I suspect the way GlassFish uses domains might require the uri to be different from what works on Jetty. Or I could have done something that works for one OS and not the other.

Wednesday, October 8, 2008

Quote of Tomorrow

What would you get if you made a Quote of the Day site with Web 2.0 features? How about the Quote of Tomorrow, or Quote 2.0? Better yet, Q2OH. In an effort to get something shipping now we are working on a very simple web application. The goal of Q2OH is to practice. Make sure the hosting is configured, the development process is working, we have the ability to test, and maybe have some fun along the way.

Monday, October 6, 2008

Create Database

I'll need to remember this information to set up MySQL in production.
mysql> create database qotd_prod;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on qotd_prod.*
-> to 'prod_user'@'localhost'
-> identified by 'password';
Query OK, 0 rows affected (0.05 sec)

Friday, October 3, 2008

Trying Is The First Step Towards Failure

Homer Simpson said that. I found it while searching for quotes to add to the quote of the day application I built following Glen Smith's instructions. Glen is part of an excellent podcast on Groovy and Grails (and Griffon?) and is now also teaming up to write a book on Grails. I think I will find inspiration in Homer's sage advice and get on with failing. If I do it enough times I just might suceed.

Thursday, October 2, 2008

I Am Not Alone

Maybe this web thing will catch on. In researching blogging tools I found someone kicking off a new Grails project that plans on blogging how it goes. Hmm, sounds familiar. Feel free to follow along and see who finishes first.

Tuesday, September 30, 2008

With Much Appreciation

Where do you get a year of free hosting? I got mine from OStatic. They got it from Sun. It is provided by Layered Tech. What can I do with it? Anything on Solaris using GlassFish and MySQL. What will I do with it? Something in Grails. Thank you OStatic, thank you Sun, thank you Layered Tech.

Monday, September 29, 2008

Free Hosting

Good news, I have a hosting account with no charge for a year. Bad news, I don't have a web site to host. The goal is to have a site that will be self-supporting when the free year of hosting is up. The clock is ticking, the account is already set up and will cost money in less than a year. It will take some time for whatever it is to gain traction and generate even the small amount of revenue necessary to break even. The normal cost is $60 per month. Labor is available, development and test environments exist. Ideas are lacking. A good idea would be nice, a good idea that can be implemented quickly would be great. Think, think, think.