Posts tagged Perl

Better than BASIC?

David Brin complains about the difficulty of obtaining BASIC for modern computers, in a piece published yesterday on Salon. He’s been trying to teach his son to code, starting with simple algorithms and developing a good sense of what the computer is doing as it processes each step. Java and C++ are considered too complex for this purpose, and he seems to consider most scripting languages to be too high-level:

The “scripting” languages that serve as entry-level tools for today’s aspiring programmers — like Perl and Python — don’t make this experience accessible to students in the same way. BASIC was close enough to the algorithm that you could actually follow the reasoning of the machine as it made choices and followed logical pathways. Repeating this point for emphasis: You could even do it all yourself, following along on paper, for a few iterations, verifying that the dot on the screen was moving by the sheer power of mathematics, alone. Wow!

I’m not convinced. Sure, some versions of BASIC let you get pretty low-level with PEEK and POKE, but there’s a perl library that will give you that level of access. And while Perl, Python and Ruby will provide a lot of high-level features, most of the time you don’t have to use them. You can go back to the core of most algorithms and, yes, follow the reasoning.

Meanwhile, you get an easy transition to more refined programming techniques. As a BASIC programmer who wanted to switch to OO techniques, you had to learn a whole new syntax. Learning new languages is a good thing, but it’s nice to be able to encounter new paradigms in a familiar environment.

Of course, for those who insist on BASIC, you can always follow Brin’s lead and buy a Commodore 64 on eBay, or there’s BBC Basic for Windows.

Grand Rapids GIS

A couple of weeks ago I attended my first Grand Rapids Perl Mongers meeting in order to hear a presentation about the City of Grand Rapids‘ efforts to build a GIS driven by perl and hosted on linux. The presentation was interesting, though the coverage of the technology used didn’t dig much deeper than “we used perl and linux because they’re free and we had staff who advocated them” and “this is all done in perl,” and I didn’t get a sense of a broad vision for the future potential of such a system (by contrast, the Mayor’s speech when launching the latest phase of citywide WiFi testing demonstrated a broad vision for enhancing city services through the use of pervasive technology).

My main interest in the city’s GIS is the potential of opening up city information for use by community organisations in location-aware applications. There is potentially considerable benefit for community organisations in being able to integrate with the city’s databases in order to pull out information about issues that affect their constituency (road closures, zoning hearings, etc) and for businesses in being able to integrate with details such as public transport stops and routes. I’m also interested in using it as a backbone for more participatory politics tools, as keeping track of ward boundaries can be a tricky process and is best managed in one place.

Sadly my questions regarding web services hooks for the GIS were met with a response that I could get hold of my own map data from their source, which wasn’t really what I was going for. I’ve followed up with emails, and hopefully will hear more soon, but don’t hold out much hope that there will be any potential for integration any time soon. It is frustrating that a relatively recently built system using tools which are touted in part for thei “open source” credentials should lack interfaces which needn’t be hard to implement and that would encourage a much broader uptake of the system to build a rich information environment.

MTPastEntries 0.3

It can be all too easy to get sucked into a single project and then find most of the day has disappeared. I’ve now packaged up MTPastEntries version 0.3 and put it along with an instruction page here.

The main changes are to the PHP code which I’ve now had time to test. It seems to work pretty nicely for now, though as before I’ve not tested on a large-scale setup. I’ve also tidied up the perl a little bit, and added in two new tags MTPastEntriesIfComment and MTPastEntriesIfTrackback which are taken with only the slightest of modifications from Adam Kalsey/Brad Choate’s SimpleComments plugin.

I’d like to add a number of features, such as some way of flagging up which previous entry each comment came from, sorting of comments by various parameters, and the aforementioned use of fields other than keywords, but it’s probably time to take a look at some other work for a while.

Moveable Type PastEntries 0.2

It turned out that the first version of MT::PastEntries was riddled with bugs that were quietly filling up my logs, so I’ve just released version 0.2. This version has been tested on a small blog of three entries and worked as intended.

I suspect that on a blog of any size it would add considerable load when rebuilding static pages, so I’m going to move on to writing a PHP/Smarty version asap. Gavin suggested looking into integration with the ExtraFields plugin, so once the PHP version is in place that’ll probably be next on the ‘to do’ list.

UPDATE: I’ve had a first bash at the PHP side. I’ve not done any debugging yet, but for those who want to have a look, the whole lot is available here.

MT::PastEntries

As part of my new found involvement with the Talk Euro project (aiming to produce an online, commentable, annotatable version of the EU constitution) I’ve been considering how to use Moveable Type to keep track of different versions of a particular clause or article in a document.

The issue is that the constitution (and the other documents we hope to then use the toolset with) will inevitably be amended over time and it would be good to be able to keep track of those amendments and to present comments on previous versions of an article to those reading the latest version.

The most elegant solution I’ve come up with so far is a plugin that will scan the keywords field of the entry for notes of the form previously:xx where xx is the ID of a previous version of this article and extract all comments made on any entries located. The plugin then provides a container tag that can be used to display those comments. In practice, the user will probably want to then disable comments on the previous version of the article, and offer some link from the old version to the new one.

For those who are interested, you can download the initial version here, but note that I haven’t even gotten as far as testing it; version 0.1 is simply to illustrate how the process might work.

Before releasing it for any serious usage, I’d want to add sorting of comments/trackbacks, and a way of attaching a note to each entry to indicate which previous entry it comes from (as well as the obvious refactoring, etc). And of course once that’s all stabilised, a PHP version will follow.