<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jfrank &#187; groovy</title>
	<atom:link href="http://www.joshuafrankamp.com/blog/category/groovy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshuafrankamp.com/blog</link>
	<description>technology and some random stuff</description>
	<lastBuildDate>Fri, 12 Feb 2010 21:11:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>a groovy google calendar</title>
		<link>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/</link>
		<comments>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 08:00:19 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=37</guid>
		<description><![CDATA[I pushed some buttons and opened up part of my svn repository to share the code from my earlier example:
https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/
I read up on groovy&#8217;s site, about google data support but I actually couldn&#8217;t find the referenced code anywhere&#8230; I&#8217;d like to learn more about &#8216;use&#8217; and other aop/mixin techniques.
]]></description>
			<content:encoded><![CDATA[<p>I pushed some buttons and opened up part of my svn repository to share the code from my earlier example:</p>
<p><a href="https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/">https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/</a></p>
<p>I read up on groovy&#8217;s site, about <a href="http://groovy.codehaus.org/Google+Data+Support">google data support</a> but I actually couldn&#8217;t find the referenced code anywhere&#8230; I&#8217;d like to learn more about &#8216;use&#8217; and other aop/mixin techniques.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>groovy code needs viagra (it keeps shrinking)</title>
		<link>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/</link>
		<comments>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 05:46:43 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=32</guid>
		<description><![CDATA[The other day I was talking to some coworkers about a groovy method that I had refactored. It was one that I had pulled the guts out because I needed two forms of the same data. So I added getDaySizeList which contains most of the logic, but I still needed to get a rollup sum [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was talking to some coworkers about a groovy method that I had refactored. It was one that I had pulled the guts out because I needed two forms of the same data. So I added getDaySizeList which contains most of the logic, but I still needed to get a rollup sum from getDuration for another part of the application.</p>
<p>I knew groovy collections supported an &#8220;each&#8221; function that takes a closure. Groovy syntax allows for omission of parentheses when there is at least one argument, so it can look like this:</p>
<p>myCollection.each{ <em>closure</em> } not myCollection.each({ <em>closure</em> })</p>
<p>it would also allow you do things like:</p>
<p>myCollection.add object  (look no parens!)</p>
<p>which creeps me out right now, so I&#8217;m not going to think about it.</p>
<p>I digress&#8230; Here is my method, that I thought was a short implementation:</p>
<pre>int getDuration(){
	int hours = 0;
	getDaySizeList().each{dayHourMap -&gt; hours += dayHourMap.hours}
	return hours
}</pre>
<p>I was excited, no visible loop, just something to do &#8220;each&#8221; for the members of the collection, drilling down into the hours property of the map in each collection item, summing them into a waiting &#8220;hours&#8221; int, then returning it. Slick.</p>
<p>Barney then replied that I should have (duh) used the sum closure-taking builtin in groovy&#8230; which turns the above method into this:</p>
<pre>int getDuration(){
	return getDaySizeList().sum{it.hours}
}</pre>
<p>&#8220;it&#8221; is the default single argument to the closure.  You can see I only kept the end of the closure, to the right of the former +=.</p>
<p>Magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vacation ala Google Calendar</title>
		<link>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/</link>
		<comments>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 06:03:30 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=23</guid>
		<description><![CDATA[I&#8217;ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my &#8220;for fun&#8221; time at work and home. The goal is to get an application that can replace the arcane paper based system that my company currently uses.
I have most of the front end of the app done, but I needed a good [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my &#8220;for fun&#8221; time at work and home. The goal is to get an application that can replace the arcane paper based system that my company currently uses.</p>
<p>I have most of the front end of the app done, but I needed a good calendar view to show the events. I decided I would use google calendars, so I wrote a little calender wrapper. Here is a snippet of the test driver class. GoogleCalendar is mine, the *Entry items are part of the api.</p>
<p>This is groovy code, not java&#8230;</p>
<pre>//omitting calendar name assumes the default users calendar
GoogleCalendar gc1 = new GoogleCalendar(username,password)
// adds an event 3 days in duration starting 3 days from now, with title and desc here
CalendarEventEntry entry = gc1.insertEvent("DELETE ME FTO","FTO",new Date()+3,new Date()+6)
gc1.deleteEvent(entry)

println("List of users owned calendars:")
for (CalendarEntry cal : gc1.getCalendars()) {
	println("\t" + cal.getTitle().getPlainText());
}

//this demonstrates the mixed constructor that is allowed in the groovy wrapper.
//i define a calendar name, and it looks it up and sets that as the calendar to work with
GoogleCalendar gc2 = new GoogleCalendar(username,password,"Web Services Team")
//adds an event 3 days in duration starting 2 days from now, with title and desc here on the WST calendar
gc2.insertEvent("Joshua FTO","FTO",new Date()+2,new Date()+5)</pre>
<p>Such fun.</p>
<p>This will allow me to have a nice visual display of everyone&#8217;s scheduled vacation calendar, and have an easy way to share it with other apps/users such as our wiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
