Showing posts with label grails. Show all posts
Showing posts with label grails. Show all posts

Wednesday, June 20, 2012

First Thoughts on the New Project

I have been experimenting with STS and Grails 2.0.4 for one week now. The initial idea was to spend two hours a night five nights a week. The first thing I learned is Monday through Thursday spending two hours at something that feels like work is all right. Friday night I didn't feel like it but I thought Sunday night made more sense anyway. Sunday night I didn't feel like it either. So I am not sure if five nights a week is really going to happen.

Quick Hits


  • If you want to use Groovy Eclipse in STS don't install STS in the Program Files directory.
  • STS is easy to move if you need to, just drop the folder somewhere else.
  • H2 has a console and Grails makes it available in the dev environment (grails dev run-app).
  • You can add an environment to the STS menu commands using Run > Run Configurations...

STS Run Configurations dialog box.
  • Pressing Ctrl+Shift+Alt+G brings up a Grails command prompt.
  • When running in dev use  http://localhost:8080/{appname}/dbconsole to get to the console.
  • The default JDBC URL is jdbc:h2:mem:devDb and Password is blank.
H2 Console login page.
I did write a very small amount of code. Small amounts of code is one of the reasons I really enjoy Grails. One domain class, scaffold controller with two additional actions, taggable plugin, one template, six lines added to the show view and the result is some jQuery fun.




Thursday, June 14, 2012

And the Winner is...

...STS

The first task I will try and document is setting up a development machine. I have a nice vanilla 64-bit Windows 7 PC with almost nothing installed. Not even a JDK. The first decision I made is to use Grails, current production version, 2.0.4. The second decision was more difficult, which IDE? I haven't worked in Eclipse for quite awhile. I used to have a total Sun fascination including using NetBeans. There is definitely a pun to be made but I'll restrain myself. If Grails support was included in the community edition of IntelliJ IDEA it would receive strong consideration. One of the reasons I chose STS is there are a lot of resources available to help me learn to use the software. This webinar recording got me excited to get going.

Groovy and Grails Applications with the SpringSource Tool Suite

When I went to download STS I noticed the following:

The following pre-requisites must be fulfilled in order to install STS:
  • Operating System: Microsoft Windows XP/Vista/7, Apple Mac OS X, Linux
  • Java Runtime: latest version of JDK 5 or 6 (a JRE will not be enough to use all STS features)
  • Hardware: 500MB free disk space, 2GB memory

Now I have another decision to make. Is there any reason I wouldn't use Java 6? Additional research may be required. I grabbed the STS version that needs a 64-bit JDK so off to find me some Java. Interesting discovery, I noticed the JRE installed on my 64-bit operating system is a 32-bit version. Might as well get rid of that while I am in setup mode. Wow, Oracle just informed me that 3 billion devices run Java. JDK 6 installed. While installing STS 2.9.2 I have another question. Should I let it install their app server? I am used to Grails having a built-in app server. Do I need vFabric tc Server 2.7.0? I am going to skip it and Maven for now.
Perfect timing, it is 11:00pm.

Wednesday, June 13, 2012

Nine Two Eleven

What can you accomplish in ten hours a week? What if you tried to find out? That is my plan. I want to see how long it takes me to launch a new web site working on it from 9:00 - 11:00pm five nights a week. Here is my expected schedule:
  • 9 -5 work to pay the bills
  • 5 - 9 enjoy my family
  • 9 - 11 do something different
It is highly likely I won't actually work at doing something different as often as I plan but I need to start somewhere so that is what I'll start with.

I have been trying to come up with something to work on and so far the favorite idea is a fairly simple web site. Two items will be displayed and one can be voted for to determine the winner each day. The day's winner will be sent out via Twitter and can be viewed on the site. Simple.

Supply List

Data store to hold the items and the votes
Ability to track who voted
Scheduled process to calculate the winner
Some kind of broadcast

I will try and explain the decisions I make when selecting tools to use in the project. So far I am leaning toward being a SpringSource fanboy and developing a Grails application for Cloud Foundry using STS. Follow along and see if I change my mind.

Friday, October 16, 2009

IntelliJ IDEA Community Edition — Free and OS Java IDE

This is almost great news. The open source version of IntelliJ IDEA will only be missing one feature that I want, the Grails framework.

http://www.jetbrains.com/idea/nextversion/free_java_ide.html

Somehow I doubt they will sell me one feature without the need to purchase the Ultimate Edition.
http://www.jetbrains.com/idea/nextversion/editions_comparison_matrix.html

Wednesday, August 19, 2009

SpringSource Launches Enterprise Java Cloud

SpringSource Launches Enterprise Java Cloud

This is interesting. However, I am always a little nervous about a single vendor providing every part of a solution. I think that may not be justified, especially in this case. I've assumed for some time that any future Grails projects I do would be hosted in the cloud. There are multiple vendors doing a good job of supporting Grails in the cloud already. I will keep an eye on what SpringSource does because I expect they will do a great job of supporting Grails.

Monday, August 17, 2009

Friday, January 23, 2009

Grails Templates and the 960 Grid System

I stumbled across the 960 Grid System and wanted to see if it could serve as the layout foundation in a Grails application. I am pleased with the results and believe this will help speed up the initial design of new web sites. Having read several articles and blog posts demonstrating the use of templates in Grails, I could have started from scratch but decided to follow along with Mo and add the 960 Grid System to the mix.

My first impression was, "That's a lot of stylesheets!" It took me awhile to decide if I liked the modularization of the CSS but I grew to appreciate it because it helped me focus. This is the same reason I like breaking a layout into Grails templates. I haven't tried to make the result look good yet, it is intended to demonstrate a quick way to customize the structure of your layouts.

I ended up with five templates stored in a folder named common. I added a stylesheet specific to the application named layout.css since I named the application layout. Later I decided that was a confusing name but luckily this is just a quick proof of concept. I did not include the standard main.css but of course you can if desired.

The only feature of 960 Grid System that didn't perform as I wanted it to right out of the box (no offense Dave Klein) was centering the page in Internet Explorer. In order to center the page in IE I added the wrapper div with text-align: center. This required me to tweak container_12 to return everything to text-align: left. This demonstrates a very simple example but it should be easy to see how you could use Grails templates and the 960 Grid System to create just about any fixed layout you could want.

Here is main.gsp:
<html>
<head>
<title><g:layouttitle default="Layout Example"></title>
<link rel="stylesheet" href="${createLinkTo(dir:'css',file:'reset.css')}">
<link rel="stylesheet" href="${createLinkTo(dir:'css',file:'960.css')}">
<link rel="stylesheet" href="${createLinkTo(dir:'css',file:'text.css')}">
<link rel="stylesheet" href="${createLinkTo(dir:'css',file:'layout.css')}">
<g:layouthead>
</head>
<body>
<div id="wrapper">
<div class="container_12">

<div class="grid_12">
<g:render template="/common/topbar">
</div>

<div class="grid_12">
<g:render template="/common/header">
</div>

<div class="grid_12">
<g:render template="/common/menu">
</div>

<div class="grid_8">
<div id="content">
<g:layoutbody>
</div>
</div>

<div class="grid_4">
<g:render template="/common/sidepanel">
</div>

<div class="clear">

<div class="grid_12">
<g:render template="/common/footer">
</div>

</div>
</div>
</body>
</html>

Here is layout.css:
body
{
background: #99BADD;
}

#wrapper {
text-align: center;
}

.container_12 {
text-align: left;
}

#topbar {
background: url(../images/30-y.gif) repeat-x;
height: 30px;
margin-top: 20px;
}

#header {
background: url(../images/120-y.gif) repeat-x;
height: 120px;
text-align: center;
margin-top: 20px;
}

#menu {
background: url(../images/60-y.gif) repeat-x;
height: 60px;
margin-top: 20px;
}

#content {
background: url(../images/620-x.gif) repeat-y;
width: 620px;
margin-top: 20px;
}

#sidepanel {
background: url(../images/300-x.gif) repeat-y;
width: 300px;
margin-top: 20px;
}

#footer {
background: url(../images/45-y.gif) repeat-x;
height: 45px;
text-align: center;
margin-bottom: 20px;
}

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 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.

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, 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.