Dec 02 2008

a groovy google calendar

Published by jfrank under groovy

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’s site, about google data support but I actually couldn’t find the referenced code anywhere… I’d like to learn more about ‘use’ and other aop/mixin techniques.

No responses yet

Nov 30 2008

svnant 1.2.1 released

Published by jfrank under svnant

I fixed a few bugs in this release. One was dealing with remote info requests against files. A couple others were from updated subversion 1.5, and new svnant dependencies. I added a cleanup task, contributed to Oleg Byelkin.  Writing the tests for that was a little bit of a trick due to the fact that cleanup (in order to be succesful) needs to have a messed up working copy… so I settled for writing a lock file to the .svn/ and calling it succesful if it removed it.

svnant-1.2.1.zip

2 responses so far

Nov 29 2008

groovy code needs viagra (it keeps shrinking)

Published by jfrank under groovy

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.

I knew groovy collections supported an “each” 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:

myCollection.each{ closure } not myCollection.each({ closure })

it would also allow you do things like:

myCollection.add object  (look no parens!)

which creeps me out right now, so I’m not going to think about it.

I digress… Here is my method, that I thought was a short implementation:

int getDuration(){
	int hours = 0;
	getDaySizeList().each{dayHourMap -> hours += dayHourMap.hours}
	return hours
}

I was excited, no visible loop, just something to do “each” for the members of the collection, drilling down into the hours property of the map in each collection item, summing them into a waiting “hours” int, then returning it. Slick.

Barney then replied that I should have (duh) used the sum closure-taking builtin in groovy… which turns the above method into this:

int getDuration(){
	return getDaySizeList().sum{it.hours}
}

“it” 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 +=.

Magic.

One response so far

Nov 28 2008

Vacation ala Google Calendar

Published by jfrank under groovy

I’ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my “for fun” 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 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.

This is groovy code, not java…

//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)

Such fun.

This will allow me to have a nice visual display of everyone’s scheduled vacation calendar, and have an easy way to share it with other apps/users such as our wiki.

No responses yet

Nov 28 2008

python packaging

Published by jfrank under python

Python packaging is a pain in the ass. There are some tools to make it easy, so easy in fact that it becomes even worse…

easy_install is the easiest thing since sliced bread. What does it do? Everything. Its so magic it probably installs itself recursively just for fun.

You want a package?

Ok just type this: easy_install sqlalchemy (for the awesome ORM package for python)

It magically goes and finds sqlalchemy, and installs it INTO your system python installed path.

Why is the standard assumption that if I want to use a python package that is say a dependency for my project, that I want to INSTALL IT INTO PYTHON running on my system?

What kind of crazy idea is this? It causes all kinds of issues. The first and most obvious is: What If I have two programs that expect different versions of a given package? Since the packages are installed in to the runtime and not my app, you have to know about this issue and work around it.

If packages were managed the java way, the assumption would be that I want to install the package in the app that I am working on, not into /systemjdk/extensions/somePackage

The only argument FOR doing it this way that I can think of is saving disk space. Disk space is cheap.

/rant.

Ok so honestly, can anyone tell me why this is?

2 responses so far

Aug 12 2008

svnant for subversion 1.5

Published by jfrank under svnant

One day at work I saw that tortoiseSVN had an update, and so I blindly installed it and went about my business. It then began poisoning all the shared working copies that we use at work, with subversion 1.5 format, thereby causing all other svn clients to report “This client is too old to work with working copy …” Long story short, once you start its hard to stop.

I thought ok no problem, I’ll help all of my co workers upgrade and that will be that. Subversion 1.5 is a release after all, surely all the tools that go with it are released too! That turned out to be mostly true, but not for a specific tool that we use quite a bit here, svnant. There was no svnant bound against the latest dependencies.

I found an email by the guy who runs the show mark that said he wanted someone to take on the project. So I volunteered.

I became the svnant guy just like that. I made a simple release so if you are just dying to get svnant working with subversion 1.5 working copies, download the release candidate.

7 responses so far

Jul 16 2008

launchy hot key broken

Published by jfrank under resources

I use Launchy for Windows, it is a command line launcher that allows the user to forget the start menu is even there. Which is a dream come true. It is also customizable and generally useful.

I somehow broke my launch key setting by resetting it to an invalid combination. Alt-Space is the default, and I had set it to something that simply didn’t bring up the Launchy window. This is a problem with Launchy because there is no ‘official’ way to reset the hotkey without first bringing up the launchy window.

In short, if you ever have this problem, instead of attempting a reinstall, which doesn’t work just do this:

How To Fix Launchy’s Hot Key:

  1. Kill Launchy.exe from the task manager.
  2. Open launchy.ini in your users application data folder.
    For windows XP users, this is:
    C:\Documents and Settings\yourusernamehere\Application Data\Launchy\Launchy.ini
  3. Add or replace these ini style keys:
    [GenOps]
    hotkeyAction=32
    hotkeyModifier=134217728
  4. Save the file, and restart Launchy.exe
  5. Use Alt-Space (which is what you just reset the hotkey combo to be)

10 responses so far

Jul 11 2008

whew, finally something reasonable from the fcc

Published by jfrank under internet

“The Internet is based upon the idea that consumers can go anywhere they want and access any content they want,” Mr. Martin said. “When they show they are blocking access to some sort of content, they have the burden to show that what they are doing is reasonable.”

http://www.nytimes.com/2008/07/12/technology/12comcast.html?ref=technology

This is the latest good news in the net neutrality war since Google forced the telcos hand by bidding in a wireless spectrum auction. In so doing they enabled open access rules for devices that will use it.

No responses yet

May 01 2008

google charts is cool

Published by jfrank under resources

I picked three random names, three random numbers, and a random title to generate this chart.

Here is a breakdown of the url I used

http://chart.apis.google.com/chart

Chart Size
chs=375×175

Chart Title
chtt=Superdelegate+Endorsements

Chart Type
cht=p

Chart Data
chd=t:288,260,244

Chart Labels
chl=Uncommitted+(288)|Clinton+(260)|Obama+(244)

Color
chco=929AAF

Full url:
http://chart.apis.google.com/chart?chs=375×175&chtt=Superdelegate+Endorsements&cht=p&chd=t:288,260,244&chl=Uncommitted+(288)|Clinton+(260)|Obama+(244)&chco=929AAF

API:
http://code.google.com/apis/chart/

No responses yet

Apr 18 2008

adsense

Published by jfrank under setup

I wanted to try out AdSense, so I added it to my site. It was fairly painless, but I needed a clean way to integrate it with Word Press, so I went and looked for a plugin that deals with managing ads. There are many, and I found one, but I had to upgrade Word Press to the latest version in order to use the plugin.

Since it was so simple, I went ahead and added analytics too. It took about 5 minutes to add to my theme and that was that. Thanks Google.

Well it helps to have visitors too, after trying to convince barney to put ads on his site (which he declined), I am still left wondering a lot of things about it. Its more of an experiment right now than anything else. I’m wondering how much it would offset the bandwidth cost of an average blog. Like if someone was to get hits on a blog obviously factoring in images and other ‘heavy’ content, could the revenue from the Google ads offset or even overtake the cost of hosting?

One response so far

« Prev - Next »