Hacking Thy Fearful Symmetry

Hacker, hacker coding bright

Meeting Availability Dialect

March 10, 2007
perl ottawa.pm


Organizing the March meeting of Ottawa.pm, I came across the problem that setting a date is pretty much like playing Battleship. If a specific date is proposed, people tend respond with boolean answers (can/can't come on that day), which is perfect to assess the punctual value of the attendency function, but quite lousy to determine its monthly optimum.

So, taking the premise that there's no simple problem that can't be solved by an overcomplex solution, I thought about a way we could all signal our availabilities for a certain month in a simple, standard and easy to parse way (for I have evil plans to hack a script to help me do the scheduling). A few bus commutes later, MADness was born.

Meeting Availability Dialect

A MAD signature line has the following syntax:

                month : availability

The month is simply the name of the month. Availability is defined by a sequence of tokens that add or remove available days, depending if they are modified by a plus or minus sign.


                April : WD + Sat - Wed - Day(13)

which means any work day, plus Satudays, but not Wednesdays or the 13th of the month.

The base token are:








AD - Any day

WE - Week-end (same as 'Sat + Sun')

WD - Week days (same as 'Mon + Tue + Wed + Thu + Fri')

For a specific date, use Day(X), where X is the date. For example, 'WD - Day(14)' means all week days, except on the 14th (one can surmise that was for February).

To target a specific week, append '(X)' to the token, where X is the week in question. Several weeks can be given, separated by commas or a range operator '..'. For example, 'Tue - Tue(2)' is equivalent to 'Tue(1,3..4)' and means the first, third or fourth Tuesday of the month.

Availability is resolved from left to right, which means that, for example,

                April : AD - WE + Sun(1)

means any day, except week-ends, although the first Sunday is okay. Note that

this is equivalent to

                April: WD + Sun(1)

MAD doesn't consider whitespaces as significant. The full availability, however, must be represented on a single line.

comments powered by Disqus

About the author

Yanick Champoux
Perl necrohacker , ACP writer, orchid lover. Slightly bonker all around. he/him/his