Category Archives: Uncategorized

We’re moving!

At last, I’ve had the time to start setting up my new domain.

So, from now on, you can find the new posts at !

See ya there.

Sending SMS using Google Calendar’s python API

Soon another semester will start. And, like every semester, I received the list of assignments that are due, with their deadlines. Up till now I used to type into Google Calendar each deadline and set SMS reminders, to make sure I won’t forget to hand the assignment, but this time I realized I’ve had enough of this, and don’t feel like entering 30 different tasks over and over again, set the sms reminders etc.

So I figured ‘Google has an API for everything, why not automate it?’ So I opened their tutorial and started reading. Just about all the information was there, other then information on setting a reminder’s type (pop up, sms, email etc’).

I’ve read the python API code, and couldn’t find a reference for this. Googling for it I saw a few people mentioning it and saying the easiest solution is setting the default reminder type to SMS and then using the samples in the tutorial.

After looking a little harder I saw the JavaScript API let’s one set this type (in the API it’s ‘method’), so I ran a javascript test and sniffed it just to make sure it’s a simple attribute. After seeing that is the case I came to the conclusion that all that’s needed to set the ‘method’ of a reminder is this:

reminder = gdata.calendar.Reminder(minutes=’40’)
reminder._attributes[‘method’] = ‘method’
reminder.method = ‘sms’


Those two bold lines do the trick, where method can be ‘all’, ‘sms’, ’email’ and ‘alert’ (meaning a pop-up).

Happy SMSing!

ANTLRv3 Integration with Eclipse

I’ve been working on a pet project of mine, junit-converter, recently. It’s intended to help people migrate from JUnit 3 to JUnit 4, by adding required annotations and such, but it’s far from perfect. junit-converter is based on TestNG’s converter that uses Java’s Doclet.

For those who aren’t familiar with it, Doclet is something that allows you to process annotations added to javadoc comments and things like that, and it has some code-parsing capabilities that are being used in the TestNG converter.

Now, almost a year after publishing the first junit-converter version that’s based on the Doclet processing I’ve come to the decision that there has to be a better way for doing this. I’ve considered many options that I will write about some other time, but have finally come to the result that Antlr seems like the best candidate out there.

I’ve been using it for a few weeks now and had some difficulties getting it to work pragmatically with eclipse. The main problem with antlr (and anything else that generates code automatically) is that eclipse isn’t aware of the changes and because of that doesn’t compile the right files etc’. At the beginning I used to manually run the antlr compiler after every change I’ve made to the grammar and then refresh the files that were generated in eclipse. This of course was really annoying.

Later, I created an ANT build.xml file that parses the grammar only when needed and ran it manually, which was a bit simpler, but still no winner there.

Then, at last, I came up with the most comfortable configuration so far. I’ve added to my project another builder (under build preferences), an ant builder. It used my build.xml file and I configured eclipse to build using it every time I save (just like it does with its builtin compiler). After making a few tweaks so it won’t compile unless needed it was pretty fast and not annoying (considering the grammar isn’t where the majority of the changes are anyway).

So, just in case someone else wants an already ready build.xml file for this purpose I’m attaching mine. Notice that I’m running antlr using the ant execute task as the built-in task in ant doesn’t support antlr 3 and I didn’t want to add another dependency to my code for the published task on antlr’s site.

I hope this helps someone, and if anyone has a better way of doing this I’d like to hear about it!

<target name="compile" depends="compile-grammar">
    <javac srcdir="${src}" destdir="${build}">
        <classpath refid="classpath.base"/>

<target name="compile-grammar" depends="-check_grammar_needs_compile"
    <java classname="org.antlr.Tool" failonerror="true">
        <arg value="${grammar-file}"/>
        <classpath refid="classpath.antlr"/>

<target name="-check_grammar_needs_compile">
    <uptodate property="grammarBuildRequired" targetfile="${grammar-file}"