AFTERSHOX - Tariq Ahmed on Technology :: Management :: Business
  • About Me
  • Resume
  • Contact
  • Learning List
AFTERSHOX - Tariq Ahmed on Technology :: Management :: Business
About Me
Resume
Contact
Learning List
  • About Me
  • Resume
  • Contact
  • Learning List
Groovy / Grails

Fixing a Grails plugin cache issue

I’ve been working on this small application as I continue to tinker around with Grails, and set the source code management up through GitHub so that I can synchronize across machines. My Mac laptop has 2.1.0RC2 while my PC had 2.0.4 where I planned to upgrade to 2.1.0RC2 as well.

When I thought I was good to go I began running into some really strange errors:



I then attempted to do a “grails clean”, and experiment with creating a new app and copy in the source to see if that would make a difference, but continued to encounter the issue.

However I did notice in the output that it was referencing a c:\users\{user}\.grails\{version} directory and attempted to nuke the version folder, and still had the same issue.

However, deleting the entire .grails directory fixed the issue!

Conclusion

There’s obviously caching going on here, and I’m guessing the auto-wizardry that figures out plugin dependencies got out of sync. So deleting that directory causes Grails to download fresh all the components that it needs to build the app.

Error Signature

Error executing bootstraps: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property  ‘sessionFactory’;

06/14/2012by Tariq Ahmed
Groovy / Grails

Installing weceem cms

This week I’m looking into integrating a CMS into a Grails application. Initially there won’t be much tight integration but it could involve single sign-on and lead into much tighter application embedding CMS content.

As it happens, there is a CMS built on Grails called Weceem – it took some trial and error to get it working as the documentation could use a lot of work. Here are some tips if you’re trying to get it working on Mac OSX (as a quick and simple standalone development mode).

Tomcat

    • Download the tar.gz distribution of Tomcat.
    • Decompress Tomcat.
    • Copy the folder somewhere as desired, I used /opt/apache-tomcat-7.023. Check out this really good tutorial here.
    • Download the MySQL JDBC driver.
    • Copy the MySQL JDBC driver (i.e. the mysql-connector-java-{ver}-bin.jar file_ to {tomcat home}/lib. I read postings that say you can copy to a common/lib folder, but that didn’t seem to work.
    • Edit the {tomcat home}/conf/tomcat-users.xml file and add something along the following lines:
  <role rolename="admin"/>
  <user username="admin" password="admin" roles="manager-gui,admin"/>

Create a MySQL Database

  • Create a DB in MySQL called whatever you’d like (I used cms).
  • Create a username and password that has access to read/write/modify the schema.

Weceem config file

Create a weceem.properties file somewhere. /etc/weceem.properties might be a good choice. It’ll look like the following, update accordingly.

# Control whether or not connection pooling is enabled
dataSource.pooled=true
dataSource.driverClassName=com.mysql.jdbc.Driver
dataSource.username=dbusername
dataSource.password=dbpassword
dataSource.dbCreate=update
dataSource.url=jdbc:mysql://localhost/cms
searchable.index.path=/Websites/cms/search-indexes

 

Make sure that whatever you set as the searchable.index.path is a directory that that the user Tomcat will run under has read/write access to.

Update your environment variables

Edit your ~/.profile and make sure you have the following lines, update path accordingly:

export JAVA_HOME=/Library/Java/Home
export CATALINA_HOME=/opt/apache-tomcat-7.0.23
export JAVA_OPTS=-Dweceem.config.location=file:/Websites/cms/weceem.properties
export CATALINA_OPTS="-Xms756m -Xmx756m -XX:NewSize=256m
                      -XX:MaxNewSize=512m -XX:PermSize=256m -XX:MaxPermSize=512m"

Deploy Weceem

  • Download the Weceem.war file.
  • Copy the Weceem-{ver}.war file to {tomcat home}/webapps/weceem-{ver}.war.
  • You can rename the Weceem file to just Weceem.war if you’d like.

See what happens

  • Open a terminal window.
  • cd to {tomcat home}/bin
  • Type in ./startup.sh – you’ll see some stuff about environment variables, and the command line will return back to you.
  • Open another terminal window.
  • In the second terminal window, cd to {tomcat home}/logs, and type in tail -f catalina.out
  • You should eventually see a line that says “INFO: Server startup in xyz ms”
  • Open up a browser to http://localhost:8080/manager/html (use the username and password you set up when editing the tomcat-users.xml file above).
  • You should see the Weceem application listed and started. If it’s not started, click on the start button.
(click on image to enlarge)

 

  • Once running, just click on the left column (the path column) and it should load up the default Weceem page.
  • There’ll be a link on that page to edit content, the default admin user name and password is admin/admin.

Hope that helps save someone time who wants to tinker around with it.

12/06/2011by Tariq Ahmed
Groovy / Grails, Uncategorized

Grails wildcard search on two fields

So I’m still in learning mode w/Groovy & Grails, and I have basic CRUD for managing users. The user domain class has the properties that you’d expect, including a FirstName and LastName:

class User
{
  String firstName
  String lastName
}

So I wanted to create a simple right side wildcard search that would effectively be the same as this in SQL Server:

where (firstName like '#searchTerm#%' or lastName like '#searchTerm#%')

In Grails you have a wrapper around Hibernate called GORM, which provides a mechanism called Dynamic Finders.

Imagine if you had to write a collection of functions for finding and retrieving one or many records based on each property (findByFirstName(), findAllByFirstName(), findFirstNameLike(), findByAgeGreaterThan(), etc…), it could take awhile. 🙂

But with GORM, it’s as if a little elf in the middle of the night coded all night long to create these functions for you. You never see them, but they’re magically there!

There’s a whole “with criteria” mechanism and the Hibernate Query Language (HQL), but I found the simplest way was just to do this:

def userList =
User.findAllByFirstNameLikeOrLastNameLike("${params.searchTerm}%",
"${params.searchTerm}%")
11/24/2011by Tariq Ahmed
ColdFusion, Featured, Groovy / Grails

Sizing up the business perspective on Groovy, Scala, and other JVM languages

Background

As a technology manager, one of my teams consists of a web development group building  both internal and external business applications. The core platform is built on ColdFusion, a JVM based technology, mixed in with various other frameworks and technologies (jQuey, Flex, ColdBox, SQL Server, etc…).

A couple of years ago we had a project that involved integrating JBoss Drools (a business rules workflow engine), and we needed a way to easily bridge ColdFusion and Drools together, and came across the works of Barney Boisvert and his CFGroovy project. using CFGroovy, we were able to successfully complete the project, while being able to assess the Groovy language itself.

Meanwhile as the years went by, whenever we had to recruit additional talent we found it increasingly difficult (you can find an article I wrote on the topic at RIARockStars). We don’t even bother looking for ColdFusion developers any more, we look for any talented individual with a web engineering background willing to learn.

With the success that we had on that one project, and the seemingly shrinking ecosystem we decided on a strategy of switching over to another JVM language. The reasoning and hypothesis include:

  • Ability to progressively evolve our existing platform (we can do it feature by feature, vs. total rewrite)
  • Opens up access to the larger Java talent pool
  • Keeps the product on a more relevant platform
  • Keeps the staff’s skills relevant

Why not Java itself?

One of the huge benefits of ColdFusion is the incredible productivity and low learning curve. What one ColdFusion developer can do in a day would take 3-5 (if not more) Java developers to do. So productivity and learning curve remain priorities in order to maintain rapid turn around time on product updates.

The big assumption

There’s a big assumption – would a Java developer actually be interested in these non-Java JVM languages? We know from experience that Sr. level Java and .NET developers will not switch to ColdFusion as they feel invested in Java. So I threw a survey out (results below) to get a feel for what the Java community feels about these platforms.
I realize I didn’t quite ask the question directly in the survey, and as soon as I had sent it out I had received a number of responses and didn’t want to abandon that progress. So I’ll probably follow up with a much more direct survey, but big thanks to the Twitterverse for all the retweets in getting the word out.

Assessing the risk/potential

From a business perspective, going down a new technology path has its risks and rewards, and the information collected in this article is part of a series of analysis I’m conducting in order to validate/challenge the strategy. As a CIO/CTO, you’re investing hundreds of thousands if not millions in development time, thus your interest is to make sure of the merits behind the strategy by evaluating as much as you can:
  • Is the technology gaining traction in the community?
  • Who is backing it (corporation, random collection of open source guys, etc…)?
  • Is there corporate support?
  • What is the size of the community (aka talent pool)?
  • What is the momentum of the community (shrinking/growing, accelerating/decelerating, etc…)?
  • How long will it take for a team to achieve a degree of proficiency?
  • How do you get a team to proficiency (training, books, blogs, magazines, etc…)?
  • How fast is the technology improving (rate of releases, etc…)?
  • Have other companies been successful with the technology?
So to other technology execs out there, I hope this data proves useful.

Disclaimer

This article is from the eyes of management, and not that of a developer. The findings are equally useful, but the conclusions a developer would make would be different than that of management. Most importantly as a developer, you should make it your mission to learn as many technologies as possible, it opens your eyes to new techniques and trends, and makes you an adaptive individual – and this is something a business values (Seven Languages in Seven Weeks is a particularly good book in this context).

Another thing to note is that I’m not evaluating the technologies themselves – there’s no shortage discussions and articles out there that cover this, so you can read up on those as part of evaluating technological fit (you’ll find some good ones on StackOverflow and Quora).

I’m by no means an expert on any of these platforms, and this was the result of a series of Googling for a week to gather various angles. If my perception is off on anything, I welcome the feedback. Thanks!

 

Observations

I just didn’t have the time to fully evaluate all of the JVM languages and their ecosystems, so I had to focus on (from my analysis) the biggest three: Groovy, Scala, and Clojure. Given more time, what I would need to do is focus the research on specifically web development as all these languages (including Java) encompass more than just web applications.

But I needed to start somewhere, and you can see where I try to rope in some web perspective.

Groovy

Groovy at this point in time would be the conservative/safest bet, business wise. It’s like the Ryan Seacrest of non-Java JVM languages; its conservative, clean, polished, and very active. Groovy is like the athletic younger brother of the lethargic and obese Java.

It appears to have the overall largest ecosystem of the three, and is backed by a huge well known entity (VMWare/EMC). Grails being the web framework of interest, they’re also about to release a big 2.0 update.

I am very disappointed that although SpringSource mentions they have a Groovy and Grails courses, they actually don’t conduct any. This could be used as clue that there’s not enough interest to warrant hosting such classes (well more than a clue, that is the case), but you figure just for strategic reasons they’d take a loss on the training (the classic Gillette move, sell the razor at a loss and make it up on blades).

However, I found the Scala and Clojure training availability just as disappointing.

Scala

Scala would be the other strong contender. Although its ecosystem is smaller than Groovy’s, it has a noticeably more passionate community. As well, having Twitter as the big success story is a massive notch on its belt.

The funding of Scala would be on my things to keep an eye on. Part of Scala is backed by a Swiss university (EPFL), and educational institutions tend to be extremely bureaucratic and their funding dependent on government entities. And then you have a business also involved (TypeSafe.com) who has only been able to generate $3M in venture capital, based on the size of their corporate team, that money won’t last long if they’re not generating revenue (since they are private there’s no way to know).

Trending wise it appears to be accelerating in popularity – it’ll be interesting to resample six months from now and evaluate the landscape. Although not as many books as Groovy, its books are more current.

Clojure

From a business perspective, I wouldn’t even put Clojure on the radar for now, I’d need to see if it gains more traction in order to justify investing in it, as well as a much more solid foundation behind it.

ColdFusion

Although I don’t fully analyse it, the ColdFusion ecosystem is much larger than any of these languages. Extremely passionate community, backed by Adobe who invests millions per year in it, vast array of physical and online user groups, etc… As of right now, going by numbers, ColdFusion wins.

But, we wouldn’t be looking to hire a Groovy/Scala developer, just a developer willing to learn. I know that Java/.NET/PHP folks have no interest in ColdFusion (beleive me, we tried on many occasion). So the question is, is that the same situation with Groovy/Scala/etc…, and trend wise is it a matter of time and we’re just at the infancy stages?

 

The Data

JavaRanch Posts

  • Groovy: 2398
  • Scala: 625
  • Clojure: 532

Books on Amazon:

  • Groovy: 12
    • Grails; 7
  • Scala: 7
    • Lift: 2
  • Clojure: 6
    • Conjure: 0
    • Noir: 0

Note: The current offerings of the Groovy & Grails books are relatively old (most recent Groovy one being from 2008, and the most recent Grails ones from 2009).

User Groups:

  • Scala: 53
    • Lift: 4?
  • Clojure: 33
    • Noir: 0?
    • Conjure: 0?
  • Groovy: 23
    • Grails: 63

Email List Activity:

  • Groovy: 50/day
    • Grails: 83/day
  • Scala: 38/day
    • Lift: 46/day
  • Clojure: 33/day
    • Noir: 2/day (Google Groups)
    • Conjure: 1/day (Google Groups)

Tiobe Index:

  • Scala: 50
  • ColdFusion: 59
  • Groovy: 69
  • Clojure: not on the list

eWeek Article 09/12/11 (http://bit.ly/nbbtbx):

  • “Groovy, JavaScript, Ruby among the fastest growing programming languages”
  • Note: the early relative percentages are interesting, but as impressive as a 100% increase is, going from 1 job to 2 jobs isn’t.
  • The more relevant thing here is the industry perception an article like this generates.

StackOverFlow Search on terms:

  • “groovy” : 4390
    • “grails” : 3391
  • “scala” : 3222
    • “lift” : 1608
  • “clojure” : 3059
    • “conjure” : 89
    • “noir” : 34

Source of funding/corporate support:

  • Groovy
    • SpringSource a VMWare company, subsidiary of EMC Corporation
      • VMWare: Publicly traded on the NYSE (VMW)
        • Employees: 9000 employees
        • Market Cap: $42B
        • Revenue: $3.54B
        • Gross Profit: $2.36B
      • EMC Corporation: Publicly traded on the NYSE (EMC)
        • Employees: 48,500
        • Market Cap: $51B
        • Revenue: $19B
        • Gross Profit: $10B
    • Team Size: 68? (http://bit.ly/ryL8fb)
  • Scala:
    • Ecole Polytechnique Federale De Lausanne (EPFL), a Swiss Federal Institute of Technology organization.
    • Scala Solutions, acquired by TypeSafe.
      • Privately held
      • Founded in 2011 by the creators of Scala.
      • Received $3M (euro) in Series A funding on 5/12/2011 by Greylock Partners.
    • Team size: 12? (http://bit.ly/u3uPmI)
  • Clojure
    • Primarily via the personal “commercial endeavors” of the creator of Clojure (Rich Hickey) and private donations.
    • Team size: 8? (http://bit.ly/tIEaQ6)

Who’s using it:

  • Scala
    • Twitter, LinkedIn, EDFT, Novell, The Guardian, Xebia, FourSquare, Sony, Siemens, Thatcham, OPower, GridGain, AppJet, Reaktor
  • Groovy
    • Wired.com, LinkedIn.com, Sky.com, Aegeon, eHarmony, EverBank, ExpertPlan, NetJay, NimBuzz, XWiki, Vodafone Music Store,
  • Clojure
    • BackType, Sonian, Fightcaster, Akamai, BankSimple, Relevance, KamaGames, Stere, Infinitely Beta, Wusoup, Factual, The Deadline, holodb, Prismatic, Amazon

Job Searches on Dice.com:

  • ColdFusion: 343
  • Groovy: 247
  • Scala: 126
  • Clojure: 20

Job Searches at Monster.com:

  • ColdFusion: 196
  • Groovy: 120
  • Scala: 64
  • Clojure: 9

Indeed/SimplyHired trends

Survey Responses

With just under 2000 responses, I don’t think the sampling is enough to be representative of the community as a whole, but it does provide some perspective. I even found out about even more JVM languages that I hadn’t heard of yet (Visage, Dart, Quercus, Frege, Dash, Mirah), and got a couple of Railo’s (which I wouldn’t count as a language as it’s an open source ColdFusion server).
10/30/2011by Tariq Ahmed
Groovy / Grails

Webinar – introducing Grails 2.0 – developer productivity

Hosted by Peter Ledbrook, Grails Advocate

With the imminent release of Grails 2, it’s time to find out just why we think you should upgrade. Or if you’re not using it, why you should give it a second look.

This webinar will introduce you to the new usability features that are targeted at improving your productivity, such as the new interactive command line, improved class reloading, and much better unit testing support. You’ll also discover powerful new features such as ‘where’ queries, database migrations, and static resource (CSS, JS, etc.) handling.

North America: November 03, 1:00pm EST / 10:00am PST – Register Here
Europe: November 03, 3:00pm UK / 4:00pm Europe – Register Here

10/30/2011by Tariq Ahmed
Groovy / Grails

Grails’ dateCreated and lastUpdated properties

 

 

I’m in the process of learning Groovy and Grails, and Grails has this neat feature called scaffolding where you just create a domain class like a User and all its properties, and it’s auto-create a full CRUD to be able to create/read/update/and delete.

class User
{
	String userId
 	String password
	Date dateCreated
	Date coolStuff
	Profile profile
}

Which when creating, will generate a form like this:

 

 

 

 

 

 

But I was wondering what’s the deal with dateCreated. Turns out that if you define dateCreated and lastUpdated properties, Grails will automatically take care of storing in the database the record creation date and when it was last updated (which is all facilitated via Grails’ ORM Hibernate wrapper).

 

 

10/17/2011by Tariq Ahmed

Who is this dude?

Tariq Ahmed Howdy! My name is Tariq ("Ta-Rick") Ahmed, and a Director of Software Engineering at New Relic where my time is focused on creating developer experiences through our developer websites, APIs, CLIs, SDKs, and ability to build your own custom apps on the New Relic One platform. I'm most passionate about finding amazing people, growing talent, and building amazing teams in order to accomplish meaningful breakthroughs in technology that ultimately create great user experiences.
Twitter feed is not available at the moment.

Categories

  • Agile (11)
  • Business Intelligence (1)
  • Career (7)
  • ColdFusion (7)
  • Collaboration (1)
  • Featured (5)
  • Flex and AIR (2)
  • Groovy / Grails (6)
  • I.T Systems (1)
  • Innovation (4)
  • Leadership (6)
  • Management (8)
  • Project Management (1)
  • Software Development (1)
  • Startups (2)
  • Technology (7)
  • Uncategorized (2)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Blogroll

  • LinkedIn
  • Teletrac Navman

"This blog is all about sharing thoughts and experiences in my journey as a technology leader. From the technology itself to the processes, practices, and teams needed to make it happen."

Find more at LinkedIn.