The Artful Blogger
prpatel's weblog
Pratik Patel's complete blog can be found at: http://jroller.com/prpatel/
The August ATL2G is right around the corner!
Meeting location/time here:
http://www.ajug.org/confluence/pages/viewpage.action?pageId=3637252
Groovy - Gaelyk - Appengine
Who: Pratik Patel
What: Groovy - Gaelyk - Appengine
When: Wednesday August 26, 2009 - 6:30PM
Where: Matrix Resources, 115 Perimeter Center Place NE, Suite 250, Atlanta, GA
This month, I'll be presenting Gaelyk on Appengine. Here's the description of Gaelyk from its website:
Gaelyk is a lightweight Groovy toolkit for Google App Engine Java.
Gaelyk lets you deploy small applications on Google App Engine Java.
Gaelyk gives you the choice to use Groovy for developing your application
So now that the annual basketball tournament is underway, I thought I'd share my latest tool for becoming master of your tournament pool. Here's a neat little groovy script to extract the stats for a team.
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import static groovyx.net.http.ContentType.TEXT
class TeamStats extends GroovyTestCase {
def void test_parseTeamStat() {
def page = getPage('http://www.cbssports.com/collegebasketball/teams/stats/NC/regularseason/yearly/SCORING')
def playerTable = page.body.div.table.tr.td.div.div.table
playerTable.tr.list().each { row ->
row.td.list().each { column ->
print "${column}\t"
}
println ""
}
}
def getPage(url) {
def page
def http = new HTTPBuilder(url)
http.request(Method.POST,TEXT) { req ->
response.success = { resp,reader ->
//println resp.headergroup.allHeaders()
def parser = new org.ccil.cowan.tagsoup.Parser()
page = new XmlSlurper(parser).parse(reader)
}
response.failure = {
// do something here
}
}
return page
}
}I take these stats, dump them into a database, and create a few graphs and stat comparisons to figure out my picks. Problem is that I went with my 'gut' rather than the stats.
The ATL2G January meeting is around the corner. We're going to kick off
2009 by jumping into the deep end of the Groovy & Grails pool with
a presentation on Easyb and Easiness. Click on the links below to find out more. Be sure to leave a comment if you're coming or send me an email (pratik -AT- mypatelspace - dot - com) so we can have enough food for all!
ATL2G January 2009 Meeting
ATL2G Info Page
So I'm working on migrating back to Intellij to do some Groovy/Grails stuff (from Netbeans, but that's another long blog post if you're really interested).... I quickly realized the path-of-least-resistance was to just create a new Intellij project and copy over the stuff in the source folders. Since I was migrating from Grails 1.0.4 to 1.1Beta2 anyways I figured I'd clean up some cruft as well.
My main concern was how to re-sync with the existing Git remote repository I have hosting my project at Assembla's Git repo. I'm used to Subversion, which has those .svn directories in every sub-directory underneath your project root. I started mentally constructing a "find -name .git -exec mv ..." command in my brain. I found only one .git directory at the root of my project. I figured "what the hell, I'll just move the old .git dir into the new project dir and roll the dice."
git status
git commit .
git push
Done! Very nice indeed. For those running on Mac OSX here's a useful link for setting up a global .gitignore for those pesky .DS_Store files.
Also, here's a link for setting up a .gitignore for a Grails application.
This is sweet. Concise but still expressive:
// both work, 2nd is new in Grails 1.1
//def itemList = Item.findAll("from Item item where item.id in (:allIds)", ["allIds": allIds])
def itemList = Item.findAllByIdInList(allIds)
Check out the new features in Grails 1.1Beta2
If you need an IDE for this beta release, you can try the Intellij IDEA EAP release for 8.1, the IDEA 8.0.1 release does NOT support Grails 1.1Beta2.