JAVA_HOME is not defined correctly

I have been working with Grails and Groovy for the last little while and have started to use IntelliJ as my ide of choice since NetBeans Groovy/Grails support is still pending release. I did have an issue getting intelliJ to work though and I found someone else who had the same problem but also had the solution:


Tip for using Grails in Idea

Recently I tried creating my first Grails application using the JetGroovy plugin available in Idea (version 7.0). However, I have Linux (Ubuntu 7.10) and you don’t get those nice little icons to start Idea when you install it. Consequently when I tried to create a new Grails project I received the following error:

grails: JAVA_HOME is not defined correctly; can not execute: java

How in the world is that possible I thought to myself? What half decent java programmer doesn’t have JAVA_HOME set? Oh but then I remembered my special start script responsible for starting Idea. Idea requires the variable JDK_HOME to be set, but Grails within Idea needs JAVA_HOME. Therefore, here is my new script I use to start Idea 7 which allows me to create new Grails projects. And don’t forget Idea 7 on Linux requires JDK 1.6.

sh -c ‘export JDK_HOME=/workspace/java/jdk1.6.0_03;export JAVA_HOME=/workspace/java/jdk1.5.0_12;/workspace/java/idea-7361/bin/’


TSOT – Ruby Show and Tell Night

I was at TSOT last night with about 30 or so fellow community developers (Brent Ashly, Andrew Burke, Hampton – from Unspace, Joey DeVilla etc…) and had a blast. Its always fun to geek out with my programming peeps. Joey was MC with a quick counter rant on What Zed Said – very amusing. Andrew showed off the sign management application he has developed, Hampton gave an amusing demo/explanation on ziplocal and the pains of developing the site. There was a demo (also an unspace demo) on a site for the iphone touch – that updates you with sports scores – very nice ui. TSOT will be holding these coder show and tells on the virtues of rails development every second tuesday of the month.

Brent and I both had our Asus Eee PCs with us – see picture below – had lots of fun showing them off.
Brent and his Pink Eee


Joey At TSOT

Some cool things to get the mind working…

So I came across a few interesting things today, one is this Jack PC which is a dam small computer. I want to get one of these and put it inside a desk and make it a terminal unit that runs linux so I can XDMCP into an X server. Imagine desks that come with a computer! Fun food for thought. Makes bringing in new employees a breeze.

The second thing I came across today was this very cool video of one persons daily photograph over a span of years. When you watch this pay attention to how the guys nose grows over the years.

I’m playing arround with Lua right now and I will post some screen casts soon I think. Its been a while since I did a video. Those intrested should head over to and watch my old video podcast (see the side bar).

An update to Database Web Services

I found this great explanation of wrapping a database in a web service today . The author covers Oracle® Database Java Developer’s Guide 10g Release 1 (10.1) Part Number B12021-02 and how to use it to create web services around a db.

Should objects be responsible for their own stubbing?

I’m an advocate of TDD (test driven development) and I try too use it all the time when I’m coding. I have gotten accustomed to using JMock for a lot of my testing as most of what I test are servlets and such which require quite a bit of setup (HttpServletResponse, HttpServletRequest etc). The one thing I don’t like though is that using jmock exposes too much of the inner workings (or expectations of the inner workings) of the system to be flexible enough for rapid design. What I mean by this is that when I’m coding TDD style, I write my test case first and as I do I am thinking about how I may setup the class interface etc… Jmock forces me to setup certain expectations in advance (not with a gun to my head but pretty close) about how the code will actually implement the solution.

For example say I’m writing a login servlet called LoginServlet. This servlet class has a method called “doPost” that takes a ServletRequest and ServletResponse. My test case begins like this…

public void testLoginWithValidCredentials()throws Exception{   String email = "";String pass = "abc123";

StubRequest req = new StubRequest();








Now I knew in advance that I was going to need a session object because I’m putting something on it after the login; what that is and how it works are unknown at the moment. Also at this point I don’t really have any expectations for my test case. I guess my expectation is that after executing loginServlet.doPost(…) that there will be some new information on the Session object. Thats about all I know to be true. So we can pull the session off the request object afterward and check that its there…. or using the JMock way we can set an expectation that the mockHttpSession receives a setAttribute message once with some data (At this point I have decided that I will store an Account object on the session). So we create our JMock expectation:

**Note:  I created an account instance object with some test data

Great, now we can know for sure that the info was set to the session. But how to we get that info?
All of a sudden I need to make all sorts of assumptions about how the code is going to be implemented instead of actually implementing it. I’m sure I’m just missing something here but if the way I get the data is by creating a LoginController instance inside the servlet then I need a way to control what comes out of that controller from the test case. Ok, so I could add an overloaded constructor to my Servlet that takes a LoginController instance and then store that inside the servlet for use during the doPost call… my gut tells me that may be the wrong thing to do. Lets try it out and make sure….

public void testLoginWithValidCredentials()

 throws Exception{		LoginControllerStub loginControllerStub = new LoginControllerStub();


loginServlet = new LoginServlet();


String email = "";

 	String pass = "abc123";

StubRequest req = new StubRequest();





loginServlet.doPost(req, response);


Now we need to fill in the login servlet code…

public class LoginServlet extends HttpServlet {
	private LoginController loginController = null;
	public void setLoginController(LoginController lc){
		this.loginController = lc;
	protected LoginController getLoginController(){
			this.loginController = new LoginController();
		return this.loginController;
	public void doPost(HttpServletRequest req, HttpServletResponse res) 
	throws ServletException, IOException {
		String email = req.getParameter("email");
		String password = req.getParameter("password");
		LoginController loginController = getLoginController();
		Account account = loginController.getAccount(email, password);
			// successful login
			req.getSession().setAttribute(Account.class.getName(), account);
			// something was wrong with the creds

And the test passes…. Hmmm maybe there is a clean way to do this after all….
The power of blogging wins again. This is really just a ramble run amok, if you have comments please send them to me.

BarCamp Toronto Tech Week

As I revel in the memories of the last Bar Camp Toronto (Toronto Tech Week) (photos) I am very inspired by what seems to take place at all of these events. We as community members have “real” conversations that often times lead to “real” action. Such as the formation of the mobile consumers & content developers advocacy organization – see the torcamp google group for info on that.

I had the pleasure of meeting Fred Ngo of and the founding investor Austin Hill from Akoha who shared with me some very intelligent ideas about how to find the right people to hire into my current startup Domainer Inc.

Its funny though, I got to thinking that all it took was a wiki entry and a few people (Bryce Johnson, Will Pate, Ryan Coleman and Dan Kurtz) to round up a space and some sponsors for food and we had a good turn out. Its very interesting that with all of the “new” technology out there all it takes is a shared piece of virtual paper to get people to come together. This begs the question of how over served some aspects of the web are? Do we really need 50 clones of myspace or flickr? Why is everyone soo intent on reinventing youtube or revver?  Are we as geeks so obsessed with control over the implementation details that we have to continuously “redo” and idea until we get it right?

I have tendency to “scrap” a lot of code because I often perceive that I could write it better the second time or third time etc. This probably is not healthy and I have taken steps to curb my abandoning ways in place of a more refactoring centric methodology. Its a little compounded by the fact that there is always a better way to do something especially the more you think about and play with a problem. I think this may be why we strive so hard for new languages and ways of working. We know what we want to express but have not found the best ways of doing it yet….

I need to find that new new thing for software development…

Why did you do it that way?

I cam constantly in awe over how badly we all write code. We contort our ideas into one of three camps.

  1. Object Oriented
  2. Functional
  3. Curried Rice (aspect oriented, etc…)

And as such we loose much of the expressive nature in conforming to the rules of “Modern” programming.  I suspect that 30 years from now we (some of us anyway) will look back and marvel that anyone was able to write any meaningfully useful programs in the same way I now look back and am amazed that anyone wrote with punch cards.

Now I’m dancing on a line here and thats between the programming language and the programming model. I have heard it said that the language you code in will affect how you model your thoughts about programming. I agree with this as I have experienced it (I’m sure you have as well). But what about the inherent “model” of programming itself? Computers are an extension of (physical realization of) a mathematical idea. That is, you can feed one function into another function and end up with a more complex function. (I’m simplified it a bit but I hope you get the jist of what I’m saying – read Alan Turing‘s original paper) so in essence we are influenced by the rules of math when creating programs. Now I’m not saying there is anything wrong with that but in recent years with the proliferation of languages like Ruby etc. that call themselves 5th generational languages I wonder if we are not striving for something more than a mathematical way to express our ideas in programs?

I want a new way to think about and model my programs. Does anyone have any ideas?

June 2018
« Apr    

Blog Stats

  • 6,280 hits

Flickr Photos