December 2009 Archives

Perl 6 Config::INI on Github

I now have a basic INI file parser written in Perl 6. It's clumsy and I'm quite unsure about packaging. Any and all suggestions welcome, including patches!

The basic usage is like this. Assuming we have an INI file like this (note that we trim leading and trailing whitespace on k/v's and section names):

host = http://localhost/
port = 3333

[admin]
    ; these only apply to admin users
    name   = Administrator
    access = all

[ anonymous ]
    name   = Guest
    access = none

We can read it li…

Config::INI in Perl 6

What better way to learn Perl 6 than to write software in it? I thought a nice, small project would be to write an INI file parser. Unfortunately, it turns out there there is no standard INI format. Or if there is, there it's pretty much ignored. As a result, I tried to write something which would handle something which is the least surprising to people. Thus, I trim whitespace, I allow comment lines starting with ';' and '#' and I ignore blank lines. It does not yet handle quoted strings, but I want to add that later.

I finally …

Test Program Names

Schwern recently wrote about not using numbers in test names. He's right and it's something I've been guilty of in the past, but I want to recommend that people go further and start naming test programs after packages. For example, with SQL::Statement, you have the following tests:

00error.t
01prepare.t
02executeDirect.t
03executeDBD.t
04names.t
05create.t
06group.t
07case.t
08join.t
09ops.t
10limit.t
11functions.t
12eval.t
13call.t
14allcols.t
15naturaljoins.t
…

Improve My Perl 6!

I was playing around with the Slope One collaborative filtering algorithm. Collaborative filtering is a way of trying to guess what users may like based on past choices. There are roughly two approaches. One is the "neighbor-to-neighbor" approach. In this approach, we try to find people who have expressed similar preferences to your own and we use preferences that they've expressed but you haven't to guess what you might like in the future. This has a few problems. One, it tends to be computationally expensive. Two, you might have…

Gitpan Languages

As you may know, Perl is the second most popular language on github. Well, that's what the page says and that page is wrong for a variety of reasons, but first I'm going to talk about an unexpected problem at work.

Other groups often follow our change event log to see if there are any changes their systems need to know about. The default is to present the uses with 10 changes at time, but you can ask for one at a time, twenty at a time, one thousand at a time and so on. One of our customers decided that they wanted our entire change history…

Atom Feed Help

It's more than a touch frustrating for me, but I need help processing an Atom feed (having never done this before). Specifically, I need help with the gitpan Atom feed. Github has a useful API, but it can't handle the huge number of repos which gitpan has, not does it appear that the Github API offer any paging facilities.

I've already seen modules like XML::Atom, but what I'd like to see is something which allows me to pull past Atom entries (I kn…

Dataphor is Open Source!

Good news! The Dataphor relational database is now open source under a modified BSD license.

Bad news! It's written in C#. C# is lovely, but this will likely limit its adoption in the non-Windows world. I'm curious to know if it will compile and run under Mono. More important, how would we write a Perl interface for it? True relational databases seem to eliminate the object-relational issues which ORMs traditionally have. It would be nice…

MySQL and Oracle

Monty Widenius, the creator of MySQL, needs your help to save MySQL from Oracle. In short, Sun bought MySQL. Oracle wants to buy Sun. Get the picture? Oracle has already let InnoDB languish after acquiring it. There's no doubt that they would like to do the same thing with MySQL. After all, many companies look at the price of Oracle versus the price of MySQL and Oracle loses another sale. Oracle does not want MySQL to succeed.

Frankly, this might be a strange blessing in disguise as it could increase ad…

What's In A Name?

Working on rights modeling for programmes and one of the issues deals with the availability window of online content. It might be available for a day, a week, a month, etc. It looks like this in our XML:

<availability_window unit="days" value="1"/> <availability_window unit="days" value="7"/> <availability_window unit="days" value="30"/>

The availability window is an extremely important part of our rights model and if we get it wrong, we're violating contractual agreements with people who produce content for the BBC. In sho…

D Languages

I really wish we had a proper D language (the D languages for the relational model, that is). Here's one way to create a table in SQL:

CREATE TABLE foo ( id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, status INTEGER NOT NULL, location VARCHAR(20) NOT NULL, UNIQUE(id) );

Here's the analogous relation in Tutorial D:

VAR foo BASE RELATION { id INT, name CHAR, status INT, location CHAR } KEY …

About Ovid

user-pic Have Perl; Will Travel. Freelance Perl/Testing/Agile consultant. Photo by http://www.circle23.com/. Warning: that site is not safe for work. The photographer is a good friend of mine, though, and it's appropriate to credit his work.