Category Archives: Programming

Greg Wilson – What We Actually Know About Software Development, and Why We Believe It’s True

Greg Wilson – What We Actually Know About Software Development, and Why We Believe It’s True from CUSEC on Vimeo. This has been brought to my attention recently, in the London.pm mailing list.

Music Hack Day London 2011

Last weekend, I went to London to participate in the Music Hack Day.

This particular hackathon is growing with a very fast rhythm. Consider what follows, for example: my very first MHD was Barcelona in October 2010, and from that moment I had the opportunity to partecipate in three other editions (New York, San Francisco, and another time in Barcelona) and to be among the public during the Cannes’ edition. That, and I also managed to skip another twos. After less than three years since the entire initiative started, it has demonstrated a relentless pace in proposing new events and building a community of music hackers (more on that later).

Spotify App Store, and MXM’s hack

I think one of the main themes during this MHD was the recently announced Spotify App Store. Most appropriately, a group of Spotify developers was present at the conference, which proved to be an inestimable source of help and encouragement during the 24H sprint.

Despite some minor glitches and random problems with the development environment, I have to say that writing software that has to be deployed into the Spotify client is a pleasure. It all boils down to write one or more web pages, using Javascript to make it live, via Spotify’s API and maybe another third party service to do something interesting.

In fact – after all, I’m a musixmatcher – we spent the weekend working on a lyrics app. I think the aim of such a project is obvious, anyway here a screenshot.

Next?

I’m not sure where next MHD will be. There will be a new “proof of concept” during Midem early in 2012, and I heard about another full-fledged edition in Amsterdam soon. I have the feeling, also, that Dave Haynes, our über-organizer, is almost flooded with cities offering to host next MHDs. That’s good news.

I think the majority of the attendants are employed in companies operating in the digital music ecosystem, but I also met many “solo” developers simply attracted by the coolness of the event. More importantly, I can’t help but seeing people helping each other and collaborating even if they’re not coworkers or members of the same masterplan to conquer the music industry. In other words, a true community is growing.

I’m not sure what’s the best way to keep nourishing this community: certainly there’s no shortage of opportunities to meet, but I think more can be done on the online part. Food for thought.

Related articles

How fast my git repositories are growing?

I wrote a very small utility to gather LOC counts from a git repository. Called gitsloc, it’s based on Cloc, with some extra goodness provided by Sysadm::Install (a rather inaptly named module, if you ask to me, but full of useful gems).

I guess it could actually have some uses, who knows?, but I wrote it mostly because I wanted to see how fast repos are growing, and R is the obvious tool to tinker with the results.

I’m less than a beginner with R, and I have to admit plotting data from a multi-column CSV file is less straitghforward than I expected: I had to use xyplot from the lattice package, like this:

xyplot(
  Perl + Bourne.Shell ~ 1:nrow(sloc),
  data = sloc,
  type = 'a',
  auto.key = list( space = "top", lines = TRUE, points = FALSE)
)
view raw gistfile1.r This Gist brought to you by GitHub.

Here the result, with data provided analysing the Dancer github repository (branch devel).

Muting/unmuting Skype for lazy people

With my current employer, we decided telecommuting was worth a try.

Our office is distributed between Barcelona and Bologna, with occasional incursions by traveler colleagues who happen to be in some random coffee house around the world.

One of the key elements for this setup to be practical and effective is Skype, which I don’t particularly like but I have to admit works pretty well in this scenario. In our headquarters in Bologna there’s an USB microphone/speaker, which my colleagues connect in shifts to their laptops, or to a spare Android tablet. On my side, I use the Macbook Pro internal mic and headphones.

The Skype audio chat is always on, meaning that it’s almost like being there: I only miss lunch and coffee breaks.

Actually, it seems it’s even more vivid than the real thing. It’s not unusual some of them shout “MUTE!” in my direction: the internal microphone on my parts takes in too much consideration the tik-ke-ti-tak of the keyboard, which in Bologna becomes an unsolicited, thunderous and rather unpleasant proof I’m really at my desk.

Of course I could use the handy HUD window with all the Skype controls, but that requires 1) finding its position on the screen, 2) moving my hands from keyboard to trackpad, 3) click the mute button. I’m lazy, and I wanted something less cumbersome. Something like a keyboard trigger to toggle the mute status of the current Skype call. Triggers? Quicksilver to the rescue.

I knew Quicksilver permits to assign arbitrary actions to hotkeys, and those actions can be anything you can do with Quicksilver: for example, running an Applescript program. Unfortunately, a quick inspection in the Skype’s Applescript dictionary revealed there was no direct and simple access to the Mute toggle. Here the first program I wrote to solve the problem:

on run argv
    set front_app to (path to frontmost application as Unicode text)
    tell application "Skype" to activate
    menu_click({"Skype", "Conversations", (item 1 of argv) & " Microphone"})
    tell application front_app to activate
end run


-- http://hints.macworld.com/article.php?story=20060921045743404
-- `menu_click`, by Jacob Rus, September 2006
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.

on menu_click(mList)
    local appName, topMenu, r

    -- Validate our input
    if mList's length < 3 then error "Menu list is not long enough"

    -- Set these variables for clarity and brevity later on
    set {appName, topMenu} to (items 1 through 2 of mList)
    set r to (items 3 through (mList's length) of mList)

    -- This overly-long line calls the menu_recurse function with
    -- two arguments: r, and a reference to the top-level menu
    tell app "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
        (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
end menu_click

on menu_click_recurse(mList, parentObject)
    local f, r

    -- `f` = first item, `r` = rest of items
    set f to item 1 of mList
    if mList's length > 1 then set r to (items 2 through (mList's length) of mList)

    -- either actually click the menu item, or recurse again
    tell app "System Events"
        if mList's length is 1 then
            click parentObject's menu item f
        else
            my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
        end if
    end tell
end menu_click_recurse

This is largely based on a piece of code by Jacob Rus I found in a hold post on Macworld. It accepts a single parameters (“Mute” or “Unmute“) and it will work only if you use the English Skype localization. I don’t think there’s something particularly interesting in this program, except the useful code I borrowed from Jacob, the trick with frontmost application to re-activate the application which had the focus before switching to Skype and, yes!, the fact is remarkably long to perform such a simple task. Also, I’m not set with only this script: I’d need to create two different hotkeys for muting and un-muting, and assign them to two different ways of calling the script itself.

There must be a shorter path.

To a closer inspection (silly me!), I noticed the menu item I’m using keeps the same hotkey (I mean hotkey from Skype’s standpoint): no matter what the current mic status is, it’s always ⇧⌘M. Let’s try to shorten the program.

set front_app to (path to frontmost application as Unicode text)
tell application "System Events"
    tell application "Skype" to activate
    keystroke "M" using {command down, shift down}
end tell
tell application front_app to activate

No need to differentiate the mechanism, and there is so much less code!

Music Hackday Barcelona

Today I attended the first half of the Music Hackday, in Barcelona. Here some pictures:

I should certainly spend many more words about this great event, but in short:

  • Congrats to the orgas for the smooth and enjoyable day: plenty of space to hack, nice location, and the internet connection was just working
  • There’s a lot of interesting APIs and products outside to explore, more than I expected: besides the big and very-well-known players like Last.fm, I discovered The Echo Nest, Canoris and MuseScore, just to mention a few.
  • I never tried this unconference formula before, but I think I’ll look for more: even if I didn’t hack very much (just polished some bits of my MusixMatch API Perl client), I really enjoyed the general atmosphere, and I can’t wait to see what the other attendees will present tomorrow.

Maintenance programming

$ history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s \n",a[i],i}}'|sort -rn|head
215 cd
121 ls
97 vim
41 grep
4 find
3 vimdiff
3 touch
2 tail
2 perl
2 less

IPW2008 – Idee per talk

Non so se quest’anno riuscirò ad essere presente all’Italian Perl Workshop, ma sto lo stesso pensando a quale (o quali) potrebbe essere l’argomento di una mia eventuale presentazione. Ecco le idee avute finora, e che ho già sottoposto al vaglio della mailing list:

  • Movable Type Open Source (20 minuti)
    Six Apart ha intrapreso il progetto di una versione opensource di Movable Type, basata sulla versione 4 di MT. Quali sono le novità della piattaforma, come contribuire, perchè (e perchè no).
  • Tecniche di debugging (20-50 minuti)
    Tutorial su tecniche e trucchi per il debugging in Perl. Come sfruttare a proprio vantaggio le feature più dinamiche di perl.
  • “Non è mai troppo tardi” (20 minuti)
    Adozione di best practice là dove prospera il lato oscuro. Come pagare il debito tecnologico senza l’aiuto di Bono Vox. Storia di un sopravvissuto.
  • Marketing Perl (10-20 minuti)
    Come può funzionare il marketing di Perl? Ha senso? Chi lo sta facendo? (con scampoli della versione 2008 di “Perl.it wants you!”)

Nobody knows shoes

Nobody Knows ShoesHo pensato di provare Shoes, un toolkit per GUI scritto in Ruby da whytheluckystiff. Non che per le mie attività correnti ne abbia bisogno, ma la lettura del breve manuale è stata divertentissima, e per molti aspetti Shoes mi ricorda Hypercard, un programma che desideravo usare ai tempi in cui non avevo ancora un Macintosh.