2014-07-30

Gradle and Dynamically Setting Test.forkEvery

I ran into an interesting problem today when customizing my teams Gradle build. I wanted to be able to dynamically set the forkEvery value for our test tasks. So, using common property techniques, wrote:

test {

    if(project.hasProperty("test.forkEvery")){
        println "Setting the tests to fork every ${project.getProperty("test.forkEvery")} for project ${project.name}"
        forkEvery = project.getProperty("test.forkEvery")
    }
}

Through simple observation I knew the tests were completing too fast. No errors, but something was off. I hard coded the value to 1 (not quoted), and that worked fine. Hmmmm. Considering Groovy would print 1000 for this:
def l = 1L; l = "1000"; println l;
I had to assume something must be happening with type conversion, and Gradle is not giving me an error for it. The fix was Long.parseLong:
test {

    if(project.hasProperty("test.forkEvery")){
        println "Setting the tests to fork every ${project.getProperty("test.forkEvery")} for project ${project.name}"
        forkEvery = Long.parseLong(project.getProperty("test.forkEvery"))
    }
}

2013-03-13

Thunderbird Keeps Giving An Alarm For A Past Event; How To Get Rid Of Them

I ran into a strange issue where Thunderbird just simply would not quit reminding me about the calendar events from one day in one of my remote calendars. I suppose in all fairness this is really the Lighting extension which did this. I dug around in the extensions sources on my system, and I found where it was happening, but didn't have time to really formulate a real "fix". But, what I noticed is it was using a cache to hold this information. So, I started looking at the folders under my profile.

What I noticed was the folder calendar-data directly under my profile. On Linux this can be found at ~/.thunderbird/yourprofile/calendar-data. The next thing I noticed was the cache.sqlite file along with some others you most likely want to keep. I opened the database in sqliteman, and I could sure enough find the entries there. I had already deleted the events from my remote calendar through my phone, and my other events, future and recurring, still exist in my remote calendar.

I thought, I can either find all the rows for these, as there are multiple tables in the database, or I can just blow away the cache, and not really worry about it. My preferences for how many days to cache would determine how much would be downloaded again; on my office or home connection, it would not be a problem.

For some, blowing away the cache may be a big deal, so know what that means for you if that is the option you choose, but for me, it was a great option. I made sure I synchronized to push any of my changes, shutdown Thunderbird, deleted cache.sqlite, and restarted Thunderbird. As predicted it downloaded everything again, and the constant alarm stopped.

Problem Solved!