Archive for the ‘Tools’ Category

Possible gmail break-in

When I logged into gmail this morning, I saw the message that I dread the most – detection of an unusual access.  There was a connection (two days ago) from a server in Malaysia, although it’s actually an AWS server (Amazon web services).

There are two possibilities: the good one is that this is something that I’ve previously given access to my account, accessing it via an alternate method (e.g. Backupify can access my mail to back it up, and they use AWS) so that it showed up an unusual.  The bad one is that someone was using AWS to bulk-attack accounts and got in.

In favour of the good one, as far as I can tell, no email was sent – I can’t see anything amiss at all.  The email account is the central lockbox for everything, of course, so it’s possible that it was just used to break into other things, or the email content was retrieved.  My password (changed now, of course) was a random 8-character string of lower-case alphanumeric characters, so not particularly simple to break (although not difficult either, given sufficient resources).  I never give out the password to anything that I do not completely trust, and nor do I give out access via other methods (e.g. oauth, openid) unless I trust those services too.

I had intended to turn on two-factor identification, but hadn’t got to it yet.  I’ve done that now, for the main account at least.  My password is now over 30 characters long, including upper and lower case and punctuation – I probably should have changed this a while ago too.

For now, I’m leaning towards the good possibility, so I won’t be completely resetting everything that can send a password reminder to my gmail account.  I’ll be keeping an eye on things as closely as I can in the next week or so, though.  If you see anything suspicious come from me, please let me know.

Trac to iCal

One project I work on uses Trac and has a custom “due date” field (it doesn’t really have milestones – updates are more granular).  While this is useful, one problem is that I don’t check this Trac instance every day, and so sometimes I’ve missed deadlines because I haven’t noticed that they are due.  However, I do check my calendar every day (multiple times a day).  It seems like exporting this “due date” value into my calendar will help with this.

This little script creates a calendar that can be subscribed to.  I run it once a day (due dates don’t change very often), and have iCal set to update once a day, so it should work fine.  If it’s of use to you, use it (no restrictions).  Let me know if there are things that can be improved!  It requires the Python iCalendar module, which I already use for parsing public holiday data.

#! /usr/bin/env python

import sqlite3
import datetime

import icalendar

cal = icalendar.Calendar()
cal.add("prodid", "-//PROJECT NAME Trac Deadlines//")
cal.add("version", "2.0")
cal.add("method", "publish")
cal.add("x-wr-calname", "PROJECT NAME Ticket Due Dates")
cal.add("x-wr-caldesc", "Due dates for PROJECT NAME tickets")
db = sqlite3.connect("/trac_location/db/trac.db")
c = db.cursor()
c.execute("select, t.owner, t.summary, c.value from ticket t, "
           "ticket_custom c where and t.status!='closed'")
for ticket_id, owner, summary, due_date in c.fetchall():
    if not due_date:
    due_date = datetime.datetime.strptime(due_date, '%d/%m/%Y')
    due_date =, due_date.month,
    event = icalendar.Event()
    event.add("summary", "PROJECT NAME #%s (%s): %s" % (ticket_id, owner, summary))
    event.add("dtstart", due_date)
    event.add("dtend", due_date)
    event.add("url", "" % ticket_id)
    event["sequence"] ="%Y%m%d%H%M")
    event["uid"] = "" % ticket_id
open("/var/www/subfolder/project-name-trac-due.ics", "wb").write(cal.as_string())

Apple’s Dog Food

The saying goes that you should eat your own dog food. It seems to me that Apple should be doing this with respect to their iOS (specifically iPad) applications. Unfortunately, it’s their apps that I have most to complain about. Continue reading

IronPython editor postscript

I earlier tried various editors I was considering using to teach IronPython.  One of the glaring omissions was Eclipse/PyDev, which has built-in support and is a very well-known IDE (particularly in the Java community).  The main reason that I skipped Eclipse was that when I was searching for an IDE to use professionally about five years ago I tried Eclipse (for Python, C, and C++ development) and I really hated it – the IDE was very slow (especially to launch), it was very Java-centric, and just didn’t suit me at all.  I’d briefly tried Eclipse before that as well, with similar results.

Over the last few days, I decided that I was probably being unfair, and since this was a choice for my students rather than for me personally, I really ought to try Eclipse (with the PyDev extensions).  I also noticed recently a post about using IronPython with NetBeans – I’d heard of NetBeans before, but only in a Java development context, and since I stay as far away from Java development as I can, I had no experience with NetBeans at all.


I was right to re-examine Eclipse.  The things that I remember bothering me so much five years ago (speed, the interface) seem to have been completely addressed, and it looks like a quite usable product.  When adding PyDev (which was quite simple), there’s support for IronPython that appears completely built-in (although it’s still obvious that Java is the #1 choice).  It seemed like a quite reasonable contender, unlike I tried to actually configure it to use the IronPython interpreter (which has to be done manually).  I was using a completely standard, fresh, installation of IronPython 2.0.1 (from the .msi) installed in the default location (here ‘C:\Programs\Iron Python 2.0.1’) with ‘Eclipse Classic 3.5’ and version 6u14 of the Java Runtime.

I believe that, in theory, you can click the automatic configuration button, or manually locate the IronPython interpreter, and it’ll just work.  Unfortunately, for me nothing seemed to work.  The error message indicated that having spaces on the Eclipse path could be a problem (which seems pretty shocking in 2009), so I tried moving Eclipse to C:\, which didn’t help.  I tried moving IronPython to C:\ (and renaming the folder to have no spaces), and that didn’t help.  I imagine that someone more familiar with Eclipse, or with PyDev with CPython/Jython, might have been able to solve this easily.  However, if I can’t figure it out in 10 minutes, then I am not at all comfortable with telling my first-year students to use it (even though we walk through the installation together, some of them will need to do that by themselves as well).


It wasn’t entirely clear which version of NetBeans to use, but I presumed that the most appropriate was NetBeans 6.7 “Python EA2”.  Although the post I saw indicated that you needed to rename ipy.exe and ipyw.exe, I found that just selecting ipy.exe worked fine.  I quite liked this IDE, and it appeared (although I didn’t use it for long) that using IronPython worked fine.   There’s no graphical form designer, so NetBeans is in the same category as Komodo Edit (which I discussed previously).  In many ways, it’s probably a better choice than Komodo Edit (in that the IronPython integration is simpler to do, although it does require that Java is installed), although I don’t know if there is any way to provide .NET auto-complete.  It’s a fairly full-featured IDE, like Komodo and unlike DIE, which would normally be a positive, but in this specific case (first-year programming students) is actually a negative, since they need to ignore all the ‘team’ functionality, and you have to work within projects (which is true of Visual Studio as well).  This is an “early access” version – since I’m not familiar with NetBeans I don’t know how unreliable that makes it – it makes me a little nervous about suggesting it to students, but I certainly didn’t have any trouble with it myself.


If you’re able to get Eclipse/PyDev installed, then I suspect it might slightly beat out my previous recommendations of Komodo Edit and DIE; since I didn’t get it working, I can’t recommend it to the students.  NetBeans, however, will get added to the list of suggested tools (alongside Komodo Edit and DIE).  If I wasn’t so familiar with Komodo Edit, I’d probably use NetBeans as the editor I use to demonstrate, but it didn’t wow me so much that it overcomes the familiarity.

Choosing an IronPython editor for teaching

The Northtec D520 “Programming” course is changing to IronPython (from Visual Basic) this year, so I have to figure out what editor/IDE the students should use.  In some ways, Visual Studio would be ideal, since they need to get exposed to that during the course (and it’s an excellent IDE, with a really great form designer), but since there isn’t any real IronPython support in Visual Studio (hopefully coming in 2010), it’s not really a viable option.  Instead, they’ll start with a simpler editor, and then briefly learn how to use Visual Studio’s form designer and subclass the forms in IronPython (as described in IronPython in Action).

The requirements here are a bit different than when selecting an editor/IDE for actual development work.  Firstly, it needs to be free (at least for educational use), and it needs to be reasonably simple to use the basic functionality (since these are first-year students).  Code-completion isn’t necessary (on the one hand, it helps them out while they are learning – on the other, they rely a little too much on it), nor is a built-in debugger, or support for complex projects.

I considered seven different editors/IDEs – there are a couple of others, but they either seemed too young (e.g. IronPython IDE, IronEditor), or inappropriate for other reasons (e.g. ZeusEdit is not free, I can’t stand Eclipse.  UPDATE: I decided to try Eclipse and Netbeans after all).

Continue reading

Useful / cute googling

Inspired by a Coding Horror post.  Things that I would demo to an “Intro to IT” class if I teach one again.

I don’t think you can get directly to NZE listings (i.e. “NZE:AIR” doesn’t work like “GOOG”) – you have to go via  I don’t think UPC codes are used here, either.  Looking up a VIN number would be great, but I’m guessing that doesn’t work, and can’t be bothered going and reading my VIN at the moment).

Google Calculator Wrong!

Google’s calculationEither I’m missing something (quite possible), or Google‘s calculator converts between joules and calories incorrectly.

According to pretty much everyone else (e.g. here), a calorie is 4.184 kilojoules. According to Google’s calculator, it’s 0.004184 kilojoules.

technorati tags:, , , ,

Delicious Library queries via SMS

A few months ago, I finally got around to cataloging all my books using Delicious Library. There were a few reasons for doing this – my insurance company wants a list of all the books in order to insure them for new-replacement value (rather than the few cents they probably consider they are worth), if anything did happen to them, I want to be able to print out a list and give it to a bookstore with an insurance cheque an wait for all the boxes to arrive, and, perhaps most importantly, it’s becoming difficult to purchase new books because I have to remember whether I’ve already got the book (or have just read it, or have just heard of it). It’s also just about impossible for anyone else to buy me a book (my favourite gift), because I might already have it (unless it’s on my Amazon wish-list, which I keep fairly up-to-date). I guess it’s also nice to keep track of books I’ve lent out, but that isn’t so common that I need software for it.

Just putting the books in the Delicious database covers most of these, apart from the issue of avoiding purchasing duplicates. Delicious Library can sync to an iPod (I don’t have one, but my wife does, so with a bit of work copying the library across accounts, that can be done), so that somewhat solves the issue of buying duplicates myself. It’s not perfect, though – for a start, I need to ensure that I have the iPod with me (easy to do for planned purchases, but not impulse buys). In addition, it seems that only 1000 books were sync’d – I’m not sure if the iPod is limited in the length of “notes” it can display, or if Delicious Library is limited in the number of books it can sync, or if something just went wrong in the process. This doesn’t at all help anyone else, of course, unless I give them a list.

Putting the list online is possible, through third-party utilities, but the one that I found that worked resulted in a page with so many images it would take forever to load, and while I put a custom-made version online that would load more quickly, printing the list out and taking it with you, or waiting until you could look at it online, isn’t particularly practical.

What I needed was a way to query the list using something that I and others would always have on hand. That’s really only a cellphone, either via voice (complex) or SMS (simple). ipipi, which I used in the past to send SMS messages from a computer, allows me to receive email from an SMS, which I could use to trigger an Applescript. While I could probably have done the whole job in Applescript, writing the search in Python was much simpler. Continue reading

Checking for new podcasts at a specific time in iTunes (Windows)

As far as I can tell, you can't tell iTunes when you want to check for new podcast episodes – it simply adds the periodic time (e.g. 24 hours) to the last time a check was done.

My ISP has changed their broadband usage system so that half of my monthly transfer allowance is "off-peak" (from next month, 2am to 10am). This really doesn't suit me well, as I typically spend only about an hour to two hours (8am or 9am to 10am) of this time online, so what I end up with is a huge chunk of unused allowance, and maxing out my "peak" allowance.

I don't want to change my habits so that I schedule everything for download. The point of having broadband was that I got what I wanted when I wanted it. The exception to this is podcasts, which are all time-shifted anyway, so I don't care when they download. They also account for a reasonable portion of my downloads (in terms of size – particularly the two video podcasts). So I really want these to download these around 4am.

One way to do this would be to get up at 4am one day and manually update. However, I like my sleep. That also means that if I ever decided to 'check now', I'd have to redo this.

So, my solution is to write a little Python script that tells iTunes (via COM) to update all podcasts, set iTunes to only update manually, and have Windows run this Python script as a scheduled task. If you want to do anything with this script, help yourself (it's really only 6 lines).

#! /usr/bin/env python
"""Tell iTunes to update all podcasts."""
import win32com
import pythoncom
import win32com.client

def main():
    app = "iTunes.Application"
    iTunes = win32com.client.Dispatch(app)

if __name__ == "__main__":

technorati tags: , ,

Skype 2.5 (Beta)

I found out (via that a beta of Skype 2.5 is available, so downloaded it.  I use Skype quite a lot for text messaging (because MSN is so unreliable), as well as some SkypeOut calls (if the lag was a bit less, I would happily switch to it for all my outgoing calls, since Telecom has put me in Helenville, which is nowhere near me and so I make no local calls) and the odd Skype call (I have one in-law, my parents, my sister, and one friend that I can call – not a large selection!).

2.5 adds some nice little features.  Making SkypeOut calls is much simpler, since I can dial ’09 414 0800′ rather than ‘+64 9 414 0800’, and it will add the New Zealand bit for me.  If I have to call another country, it’ll sort out the country code for me.

Much more handy is the ability to SMS ("txt") through Skype.  I would much rather txt via a computer (when at home) than via my phone.  For a long time I used the fantastic smspop service (great interface, great price), but it sadly died a while back.  I looked around for a while, and the best I could find to replace it was, which is ok, but not great (price-wise, or interface-wise).  Using Skype seems to be pretty convenient.

However, it is pretty pricy – €0.13 per txt, which comes out to about NZ$0.27, which is about 150% of what it costs to send via my cellphone.  So I’m not really sure the convenience is worth it.  But if the price drops (or the cost of txt’ing via prepay phone in NZ increases) then I’m sure I’ll use it a lot.

technorati tags: , , , ,