Small software businesses and the 2015 VAT regulations

From the start of 2015, whenever you sell software, licences, or other digital stuff online direct to a customer in the EU, you have to make a reliable record of where they live and then pay VAT at their country’s rate.

There is no threshold for minimum value or sale quantity, and it doesn’t matter where you’re based, only where the customer lives.

The requirements for record-keeping are quite strict, asking for two pieces of evidence about the location of each customer, to be held by the business for ten years.

This is a particularly nasty shock for vendors in the UK because until now the UK has had a high threshold for sales below which you don’t need to register to pay VAT at all. (Currently it is £81,000 per year.) Sole traders and “microbusinesses” in the UK generally haven’t bothered to register for VAT and, because the regulations previously calculated VAT from the country the vendor was based in, this sufficed for small UK-based vendors across the whole EU.

But now if you sell digital goods directly to other people or businesses elsewhere in the EU — directly, not through one of the major app or ebook stores, which handle VAT for you — you’ll need to register, and quickly.

This will be a problem for me because in my spare time I run a tiny, tiny company with a tiny, tiny turnover which sells consumer software (both direct and through app stores) and software library licences. I do my own accounting because it doesn’t bring in enough to pay an accountant. (Also I think everyone should know how to do double-entry and I wanted to learn it myself.) I like the idea of having something in hand, and I want to stay in touch with the mechanics of making and selling software, so I want to keep it going.

Having to register for VAT, figure out how to charge the correct amount for each individual country, and submit extra returns and payments for every little sale I make — it’s going to be a pain in the arse for me, but at least I’m not depending on getting it right for a living as a lot of small UK vendors of digital creative goods will be.

(The alternative, of denying all sales to customers elsewhere in the EU, also appears tricky to implement reliably.)

There are advantages of registering for VAT, principally that you can avoid or reclaim VAT paid on expenses for your company. But that also involves paperwork and, if your company is very small, the value lost to the paperwork might be more than that reclaimed.

As I write this, the government pages about VAT registration have fuck-all about the fact that the £81K VAT registration threshold will disappear in six weeks’ time for a lot of very small businesses. Did HMRC imagine that only big companies would be affected?

Miscellaneous links:

MIREX 2014 submissions

Last year, Luís Figueira and I experimentally submitted a batch of audio analysis methods, implemented in Vamp plugins developed over the past few years at the C4DM, to the Music Information Retrieval Evaluation Exchange (MIREX). I found the process interesting and wrote an article about the results.

I wasn’t sure whether to do a repeat submission this year—most of the plugins would be the same—but Simon Dixon persuaded me. The test datasets might change; it might be interesting to see whether results are consistent from one year to the next; and it’s always good to provide one more baseline for other submissions to compare themselves against. So I dusted off last year’s submission scripts, added the new Silvet note transcription plugin, and submitted them.

Here goes with the outcomes. There is also an overview poster published by MIREX. See last year’s article for more information about what the tasks consist of.

Multiple Fundamental Frequency Estimation and Tracking

The only category we didn’t submit to last year. This is the problem of deducing which notes are being played, and at what times, in music where more than one note happens at once. I submitted the Silvet plugin which is based on a method by Emmanouil Benetos that had performed well in MIREX in an earlier year.

The results for this category are divided into two parts, multiple fundamental frequency estimation and note tracking. I submitted a script only for the note tracking part. I would describe the performance of our plugin as “correct”, in that it was reliably mid-pack across the board, pretty good for piano transcription, and generally marginally better than the MIREX 2012 submission which inspired it.

This was a fairly popular category this year, and one submission in particular improved quite substantially on previous years’ results—it may be no coincidence that that submission’s abstract employs the phrase-of-the-moment deep learning.

Audio Onset Detection

The same two submissions as last year (OnsetsDS and QM Onset Detector) and exactly the same results—the test dataset is unchanged and the plugins are entirely deterministic. Last year I remarked that our methods are quite old and other submissions should improve on them over time, but this year’s top methods were actually no improvement on last year’s.

Audio Beat Tracking

Again the same two submissions as last year (BeatRoot and QM Tempo Tracker) and exactly the same results (1, 2, 3), behind the front-runners but still reasonably competitive. While the best-performing methods continue to advance, it’s clear that beat tracking is still not a solved problem.

Audio Key Detection

Last year we entered a plugin that wasn’t expected to do very well here, and it swept the field. This year everyone else seems to have dropped out, so our repeat submission was in fact the only entry! (It got the same results as last year.)

Audio Chord Estimation

This is interesting partly because our submission (Chordino) performed very well last year but the evaluation metric has since changed.

Sadly, there were only three submissions this year. Chordino still looks good in all three datasets (1, 2, 3) but it is now ranked second rather than first for all three. I’m a bit disappointed that the new leading submission seems to be lacking a descriptive abstract.

Categories we could have entered but didn’t

Audio Melody Extraction

Last year’s submission wasn’t really good enough to repeat.

Audio Downbeat Estimation

I overlooked this task, which was new this year. Otherwise I could have submitted the QM Bar and Beat Tracker plugin.

Audio Tempo Estimation, Structural Segmentation

These categories had an earlier submission deadline than the rest, and stupidly I missed it.

Alte Schönhauser Straße

In 1992, while I was an undergraduate at Bath university, I went to Berlin for an industrial placement year. I had started out registered for a 3-year maths degree without a placement, but there was a scheme you could apply to if you changed your mind and fancied going abroad in the middle of it. Hardly anyone applied for it, and I don’t think any applicants from my course were rejected unless they failed their end-of-year exams.

I was to work at the Konrad-Zuse-Zentrum (ZIB), a computing research institution that at the time was based in Charlottenburg, a tidy part of west-central Berlin. My girlfriend, also at Bath but studying languages and responsible for encouraging me to apply to go abroad in the first place, had managed to arrange a study year at the Freie Universität. She moved in to a student residence and I into a modern one-person flat organised by the company, in Mariendorf, in south Berlin.

Mariendorf wasn’t very exciting and my girlfriend’s hall of residence wasn’t all that great, so after a few months we decided to find a new flat together. My spoken German was just functional, hers was good, and between us we spent a lot of time talking to Mitwohnzentrale agents and looking around flats until, in February 1993, we rented a flat in Alte Schönhauser Straße, near the centre of what had been East Berlin.

Central (eastern) Berlin, 1993 (Falkplan)

Central (eastern) Berlin, 1993 (Falkplan).

Central (eastern) Berlin, probably 1975 (RV Stadtplan).

Central (eastern) Berlin, probably 1975 (RV Stadtplan). This undated map includes the U-Bahn stations that opened in 1973, but shows the 1976 and 1978 openings as “in planning”.

Alte Schönhauser Straße is close to the S-Bahn station at Hackescher Markt, an area officially known as the Spandauer Vorstadt lying just north of Alexanderplatz. This district, and Hackescher Markt especially, is now super-shiny and is known for bars, shops, and lots of tourists. But its present state is a result of a thorough and rapid redevelopment and restoration starting in about 1997. (See p27 onwards of this urban-planning slideshow for an interesting overview of these works.)

Berlin. Corner of Neue Schönhauser Straße and Rosenthaler Straße, 1993

Neue Schönhauser Straße / Rosenthaler Straße corner, 1993

In 1993 the area was still a bit of a mess. Many buildings on major streets like Rosenthaler Straße and Neue Schönhauser Straße were pocked with bullet holes or had obvious bits missing. What is now the fancy paved square filled with outdoor cafés, outside the S-Bahn station, was just a road. One of the commercial streets now present (An der Spandauer Brücke) was then a scrubby park, I assume because the buildings had been pulled down after the war and were not rebuilt until the area was restored. The now-restored Hackescher Hof complex was an unremarkable grey residential building: I had no idea there was supposed to be anything interesting about it. It could all feel a bit bleak.

Berlin. Rosenthaler Straße?, 1993

Street scene, 1993 – but I’m not sure exactly which street. If you know, I’d love to hear.

But this was a thrilling area to live in as a transient foreigner at the time. Many of the most decaying buildings were temporarily housing intimidating and/or tantalising makeshift bars, cafés, or art venues, like autonomous growths forcing themselves up through the gaps in what had once been reliable, gentlemanly turn-of-the-20th-century buildings. From Hackescher Markt up Oranienburger Straße to the looming art-project squat of Tacheles the area was full of a sort of place I had never seen before. It all seemed sudden, urgent, about to collapse. I knew very little about any of it and I can hardly even characterise myself as a participant, but I loved being able to be there.

Berlin. Rear view of Tacheles, 1993

Tacheles from Friedrichstraße, 1993.

Many of these venues turned out to be longer-lived than I would have expected — Silberstein, on Oranienburger Straße, and Tacheles itself both stuck around until 2013, gradually increasing their plate-glass quotient as they went. (The back of Tacheles, which ended up glazed over, was initially a void you could fall out of.)

* * *

The flat had four rooms, much bigger than the modern one I’d become used to, and it was I think smartly decorated and desirable for its time and place, but it did have certain limitations. Each room had a coal-fired heating stove, which worked pretty well, but of course you had to bring coal up in a bucket from the cellar and light a fire in each stove some time before you needed the heat. These stoves were commonplace at the time, so the air around smelled of coal smoke in a way that western cities hadn’t, I imagine, for some decades by then. There was no bathroom; the loo was outside the flat, shared with the flat next door. Hot water was through a small electric heater above the kitchen sink that could provide about a kettle’s worth. The owners had installed a standalone electric shower unit in the utility room, which was very natty but a bit ineffectual: switch it on, wait ten minutes for it to heat up, get in, enjoy two minutes of warm water.

Still, it was a lovely flat, and I loved the coal tang of the cold night air and the late-night sound of the Rosenthaler Straße tram, its swooping creak as it slowed for a tram stop, carried to the window across the wasteland at the back of the building.

* * *

As it happened, when the day came to move all our belongings to the flat, I was alone: my girlfriend was temporarily in the UK with her family. We didn’t have all that much stuff, so I thought I could just load up a backpack and take it on the U-Bahn. I took three or four loads from my flat and three or four from her rooms, and by the time everything had been moved, it was late and I was very tired. I dumped everything and fell into bed.

February in Berlin can be very cold. I woke up early in the morning and found it difficult to move my limbs. I could move my head, but when I did, a crushing pain rolled through it. I’ve never known a headache to compare.

I realised that I couldn’t move because I was too cold, and that I needed to do something about it. But I’d forgotten to bring up any coal before I fell asleep the previous night. To warm up, I would need to pull on some clothes, find a bucket, make my way out of the flat and down to the unfamiliar cellar, fill up with coal, drag the bucket back up, set up and light a fire, and hang on long enough for the stove to warm up. It was a painfully long journey for such a simple job.

* * *

I’ve been back a handful of times since 1993, though sadly never for long enough to get beyond the initial phase of just boggling at things that have changed. The really obvious changes are of course along the stretch of the Wall, like the whole new Potsdamer Platz, but it’s the details like shops and venues, or changes to transport layout, that are the most interesting for me.

Berlin. Kaufhof, Alexanderplatz, 1993

Kaufhof (former Centrum department store), Alexanderplatz, 1993. At the time the food store here was still a decent place for a normal weekly shop. It’s much more upmarket now.

Some of this has to do with the time-telescoping effect of getting older, but it also has to do with not being there. If I’d been working there while all this was happening, I would probably be unable to remember what it had ever been like before, just as I can hardly remember what London’s Docklands area was like before its second big wave of building at the turn of the millennium.

Comparative advantage

Nice picture of a wisteria in the rain. Has nothing to do with the subject at hand.One of my favourite ideas from economics (a subject I know very little about) is that of comparative advantage, a theory that shows how two countries can trade to mutual advantage even if one of them is better at everything than the other is. A fairly clear example is described here.

What I like about this idea is that it justifies focusing on something you are good at, that is just hard enough for you to enjoy, without having to worry too much about whether others might be even better at it than you.

Putting this personally, the logic goes something like: Other people around me seem cleverer than I am; they would probably be better than me at the thing that I’m doing. But as it turns out, most of the time they aren’t doing that thing and wouldn’t choose to do it.

Why? Because they’re even better at something else, something I can’t do at all. Or the things I enjoy and am good at bore them. Or they’re doing something that I find too easy and that bores me. Or some other reason. It doesn’t really matter. The point is that I’m not in competition with them.

The wonderful and inspiring idea is that you can become known as an essential person in a line of work of your own choosing, that you enjoy, that you feel good at—even if you are surrounded by people who could in theory do it much better themselves.

This idea has been quite reassuring to me. I’ve tried hard to puzzle my way into the ranks of the people who seemed truly clever over the years, only to find it doesn’t seem to be very important: competence and persistence in a field I care about seem to work better.

I imagine that most people who are seen as successful are successful in this way—people who have chosen a focus for themselves, rather than exceptional generalists.

City pigeons

The London PigeonA pigeon is sitting in the yard of our London flat. I don’t think it can fly very well: it’s been mostly walking for the past few days, though it will flap away if alarmed. It has two mangled feet and doesn’t walk all that tidily either.

We took pity on it and gave it some mixed seeds and peanuts, which it seemed to like, except the pumpkin seeds, which it’s scrupulous about leaving. Then it started coming up to the door, including appearing in the morning waiting hopefully for breakfast.

As it was our guest I decided I should learn something of its ways, so I went on an internet hunt for city pigeon facts. I found myself pretty impressed.

  • Feral pigeons are found in cities across the world, and they’re the same kind everywhere (Columba livia). They’re apparently all descended from domesticated rock pigeons that got away. Presumably they do well in cities because the building habitat resembles the rocky cliffs they originally grew up around, back in the day.
  • They mate for life. Our pigeon (I don’t know its sex, apparently it’s hard to tell) has a much fitter-looking mate, which will come down and join it in the yard but then hangs back to let the weaker bird have the food.
  • They can in theory live for 15 years, though in the wild they usually expire before their time. Their predators include other birds like hawks (which are sometimes brought in to our local train station to frighten the pigeons away) or even seagulls, as well as larger mammals like cats and people.
  • Pigeons are pretty clever, being good at classification tasks as well as famously good navigators.
  • The reason why pigeons (and some other birds) bob their heads when walking has to do with their sight, and specifically the way their eyes point in different directions so they lack stereoscopic vision. Either the head-bob stabilises eye motion to reduce parallax effects while walking, or else it intentionally introduces parallax in order to provide depth cues.
  • Pigeons are resistant to bird flu and you’re unlikely to catch anything nasty from one. Less likely than from a cat or dog anyway.
  • Although the rock pigeon seems successful in cities, across the UK it’s vastly outnumbered by the wood pigeon, which has apparently around 5 million pairs, compared to just over half a million rock pigeon pairs (including feral ones).
  • Rock pigeons are also outnumbered by many far less visible birds, even in cities. This study in 2008 reckoned there were about 12,000 feral pigeons in Sheffield, a city of half a million people: fewer than there were of wood pigeons, swifts, house martins, wrens, dunnocks, robins, blackbirds, blue tits, great tits, magpies, starlings, greenfinches, or (most numerous by far) sparrows. This seems hard to believe to me, but there it is.
  • The dodo may have been a kind of pigeon.Mean bird sorting out a pigeon

Although I’d like to think this pigeon is safe in our yard, I doubt if it is. I’ve seen bigger birds munching on pigeon out there before (see photo—this is from several years ago, and is not yet the fate of our friend). I do worry that a lone pigeon motionless in the middle of the yard might almost as well be sitting on a serving dish.

 

Single-key menu shortcuts with Qt 5 on OS/X

Several of my Qt-based applications, including Sonic Visualiser and Tony, have some menu actions attached to single-key shortcuts without a modifier key. Examples include the Space bar to start and stop playback, or the “f” key (without Ctrl, Alt or any other modifier) for zoom-to-fit.

While testing the update from Qt 4 to Qt 5.1 we found that some of these shortcuts were no longer working on the Mac, though they still worked on other platforms. Hoping this would be fixed in a Qt update, I decided to stick with Qt 4 for the official Mac builds of Sonic Visualiser for the time being. As of Qt 5.3.0, though, the problem still wasn’t fixed and I decided I couldn’t avoid it any longer.

After some digging (documented in this issue tracker) I think I understand the cause and have a workaround, although I don’t know how to fix it properly in Qt. Here’s the summary as I understand it:

  • Qt on OS/X does not (in general) handle menu shortcuts itself. It creates a native Cocoa menu and lets Cocoa’s Key Equivalents mechanism handle them.
  • Key Equivalents apparently do not work reliably for shortcuts without modifiers.
  • Before Qt 5.1, any menu shortcuts that Cocoa did not handle would drop through to Qt’s cross-platform layer and be handled as window-level shortcuts bound to a QAction instead. So the single-key shortcuts continued to work even though Cocoa didn’t handle them itself.
  • This broke in Qt 5.1 because of this commit which was applied to fix this crashing bug. The problem was that some menus that should have been inactive (because a modal dialog was overriding them) could still be activated erroneously from the keyboard through this fallback shortcut mechanism.
  • There is an open Qt bug about the single-key shortcut problem and it contains a partial workaround.

So there’s a workaround in that last bug tracker, which binds each of the menu actions to a separate, global, application-level shortcut instead:

foreach (QAction *a, menu->actions()) {
    QObject::connect(new QShortcut(a->shortcut(), a->parentWidget()),
                     SIGNAL(activated()), a, SLOT(trigger()));
}

This works as far as it goes, but it doesn’t check the action’s enabled status (and nor does the action’s trigger slot) so it’s possible to use this to invoke an action that is supposed to be disabled.

I ended up using a more complicated workaround, which you can find here. The code is basically as follows:

void MainWindow::finaliseMenu(QMenu *menu)
{
    QSignalMapper *mapper = new QSignalMapper(this);

    connect(mapper, SIGNAL(mapped(QObject *)),
            this, SLOT(menuActionMapperInvoked(QObject *)));

    foreach (QAction *a, menu->actions()) {
        QKeySequence sc = a->shortcut();
        if (sc.count() == 1 && !(sc[0] & Qt::KeyboardModifierMask)) {
            QShortcut *newSc = new QShortcut(sc, a->parentWidget());
            QObject::connect(newSc, SIGNAL(activated()), mapper, SLOT(map()));
            mapper->setMapping(newSc, a);
            a->setShortcut(QKeySequence());
        }
    }
}

void MainWindow::menuActionMapperInvoked(QObject *o)
{
    QAction *a = qobject_cast<QAction *>(o);
    if (a && a->isEnabled()) {
        a->trigger();
    }
}

I then call finaliseMenu on each of the menus returned by findChildren<QMenu *> from the main window’s menuBar() object.

There may be a simpler way: let me know if you can see one.

 

Undergraduate programming languages

I read two quite different articles about programming in academia today.

I don’t know Yossi Kreinin, and when his piece Why bad scientific code beats code following “best practices” appeared on the Hacker News front page, I guessed that I probably wouldn’t agree with it. I’m a programmer working in academia who has spent some time trying to find ways to improve the code that researchers write, and I don’t want to be told I’m wasting my time.

But on the whole I agreed with him. A totally naive programmer is going to produce messy, organic, but basically linear code that will usually be easier to understand and work with than the code of someone who has learned a bit of Java and wants to put everything in a factory class. The part I don’t agree with of course, and that I suspect he put in just for the sake of the headline, is that these really are best practices.

I think that one of the hidden goals of a project like Software Carpentry is to teach that the reason software developers appear to be “too clever”, and somehow unreachable for the scientist outside the software field, is that they are being too clever. Programming gets over-complicated; you can learn to write good code (that is, readable code) more easily than you can learn to write bad code the professional programmers’ way.

I also identified with Yossi’s line that “I claim to have repented, mostly”. Most of the code I’ve written in my career is not very good, by this standard. It’s a long path to enlightenment.

The other article was by my friend Christophe Rhodes: What is a good language to teach at undergraduate level for Computing degrees?

A computing degree is an odd thing. Computer science is the theory of how computers and programs work. Computing, as a subject, is computer science plus some stuff about how we should actually program them in order to get a job done. The two are very different.

Christophe breaks down objectives of a computing degree: Think, experiment, job, career, study, society. I’m not very familiar with the study objective, which refers to postgraduate study in a computing department (something I never did). Think refers to teaching students how to think and solve problems computationally. I think he may be missing a step, and it may be useful to separate thinking about how the computer works (“understand”?) from thinking about how the programmer can work.

There is also, of course, the question of how to avoid making your programmer feel too clever.

As an undergraduate in 1990-94, I was taught, in this order, Prolog, C, ML, 68k assembly language, and C++. I also learned some Lisp, though I can’t remember being formally taught it. Prolog, C, and the assembly language were all good bases for what I referred to as the understand objective, getting something out of the history of computing and learning about how computers work. ML was a wonderful introduction to thinking, and it’s no coincidence that I’ve recently been programming in an ML variant as an engaging alternative to work.

The hard one to evaluate is C++. It was a very poor teaching language for object-oriented programming, which is a pity because at the time we learned it, I didn’t get object-oriented programming at all. And we learned nothing about any other kind of programming from it, having already been taught three different high-level languages. So it contributed very poorly to the think objective and not at all to the understand one. It’s an awful language to learn to write clear, reliable code in, therefore bad from the society perspective, and you can (as I have) spend 20 years learning to write it, which is obviously ridiculous, hence you would think also bad from the job perspective.

But it turns out that C++ has been the most valuable job language there could be, because (a) it is resiliently portable: it turns out that write-once-run-anywhere with a virtual machine comes and goes in waves, depending on the whim of the top operating system provider of the time, but compiling to machine code seems to be eternal; (b) it is just about able to ape a number of programming paradigms, so you can get away with adopting a style without adopting another language; and (c) its complexity means that it looks good on your CV. I honestly wish, as a 20+-year C++ programmer, that we could make it so that nobody ever had to learn C++ again, but even now I don’t think that is the case.

The one goal completely unaddressed by my own degree, and almost every language I’ve learned since, is experiment. I think there are two essentials for this: a responsive interactive interpreter, and visual responsiveness, like a graphical scene environment or plotting tools. Most of the things you want to do here are probably growing up in Javascript and HTML5.

I don’t really know anything about teaching, about the actual on-the-ground business of making people learn stuff. So you shouldn’t listen to me on this next bit, I’m just daydreaming. But if I were planning a 3-year computing degree course in my head now, I think I would aim to teach, in this order:

  • Python, for the basics of procedural computing. It’s the cleanest language for doing satisfying simple loops and input/output transformations, and is a sound general-purpose language.
  • Clojure. I’ve decided now that I don’t so much care for Lisp syntax day-to-day, but a Lisp gives you so much to talk about and investigate without getting lost in the specific requirements of the language. And a Lisp on the JVM gives you more depth: advanced students could learn quite a lot about Java without ever actually being taught Java.
  • Some assembly language, probably ARM and preferably with a nice visible bit of circuit board on hand.
  • Javascript, but not aiming to teach the language so much as using a specific interactive framework and with a specific small game-development project to complete. I would probably also use Typescript rather than untyped Javascript.
  • Haskell. As an ML guy it was always my enemy, but Haskell is the functional language that has endured. It’s a follow-on course from Lisp.
  • C++. Because, as far as I can see at the moment, you pretty much have to. But please, give them modern-style pointer ownership and RAII (i.e. avoiding explicit heap allocation).
  • Python again, in a closing course that taught people how best to do things in an actual working environment. Testing, not being too much of a smartarse, etc.

But the odd thing about that set of languages is that, just as with my own degree, you never get a very good dedicated object-oriented language. Maybe Objective-C could replace C++; it’s probably a clearer pedagogical object language, but C++ is everywhere while Objective-C is effectively platform-specific, even if it is a very popular platform.

And be sure to teach them version control.

Oh, and don’t forget to add a double-entry book-keeping course. It’s probably more useful than the programming stuff.