nose kill me

So, you had perfectly running tests. You were happy with nose.

Then (maybe you mounted a volume over to a VirtualBox guest, or you copied your code to another filesystem), disaster, now nosetests is unable to find any tests (reporting 0 tests to run).

You tried everything. You renamed the tests. You printed shit inside the test file, to no avail.

Well, check the test files permissions: if it’s xecutable, nose won’t consider them tests…

Grunt-ing discomfort

Lego gruntI recently gave grunt an extensive test run, on a number of (relatively varied) WebItUp and Roxee projects, in order to evaluate its use for our clients and internal projects alike.

Indeed, grunt is appealing, at least for “web” projects (and most projects are “web” nowadays, for the better or worse), at least more appealing than rake/make/poisonake – web projects that ought to perform the same well identified build operations over and over again (hint-ing, test-ing, karma-ing, uglify-ing, you-name-it-ing).

Continue reading

Notes about fiddling with docker and continuous deployment ideas

If you don’t know what docker is yet, you may read this.

In a word, docker is to linux containers what the meat and beer is to the idea of barbecue (sure, you are free to try without, but, hey, why not try ferret legging while you are at it? :-)).

Linux containers provide a lightweight virtualization mechanism. While you do have less isolation than with traditional virtualization technics, you consume a lot less resources and can “boot” way faster.

Then Docker provides tools to manipulate and setup containers easily, and to “describe” requirements and software deployment operations.

Continue reading

About Mozilla mobile marketing speech

I started writing this as a comment on a recent Beyond the Code blog post – though what I would like to say sometimes goes OT to the original post, and… Posting my comment (twice) ended-up with a blank page, pending POST, and 405 on the subsequent GET. Maybe somebody tripped on the lizard tail there and disabled comments, in a truly open-web fashion? :-)

Either way… This has been bugging me for quite some time, and I need to get it out of my system in order to get back to useful stuff.

Continue reading

What not to do to write portable javascript for (former-) mozilla-addicts

Firefox’s javascript engine has a number of non-standard core extensions / features (just like some other browser). There seem to be a number of people who have grown used to these in the past (doing too much xul is bad for your health, you know?), and there also are a number of newbies who learn javascript using mdn, not necessarily paying attention to what is standard, deprecated, obsolete, and what not.

Having to refactor such codebases, written under the influence, may require a cheat sheet to quickly spot firefoxisms, and there doesn’t seem to be a good list out there.

So, let’s try establishing that list. If something is not there, add a comment on that post.

The purpose is not to list what might work, and where – just what is not standard among Firefox features (and using non-standard features is pretty bad, right?). In other words, what should just be avoided / removed, in a web context aiming at being cross-browser.

Non-standard for Strings

Non-standard stuff for Objects

Non-standard for Functions

Javascript AMD considered harmful: autopsy of a persistent discomfort

AMD? The hardware company?

The Asynchronous Module Definition pattern (or AMD for short – possibly one of the most clumsily nicked concept in computing history) is an attempt at “solving” javascript lack of a good, native, code modularization and dependency resolving solution.

Indeed, while javascript lets you organize your code in a fairly intuitive and malleable way (say: MyLibrary.someNamespace.someModule), there is no (native) way to express (nor “fetch”) dependencies, which leaves javascript developers with unsolved problems:

  • refactoring code is a dangerous task
  • large codebases have unclear dependencies
  • code tend to quickly become unmaintainable and unclear if not written very carefully
  • lazy-loading of additional code is not trivial to do right

Continue reading

Cocoa: get user preference “minimize on title bar double click” to implement behavior in borderless windows

Apps that want a custom title bar on OSX usually have a NSBorderlessWindowMask on the NSWindow, with the drawbacks of:

  1. Not being able to switch workspace by reaching the edge of the screen
  2. Not being able to minimize to dock on double click (if the user activated the setting in the pref panel)

But it’s possible to fix #2.

The trick is pretty much how to access the user preference:


NSString *const MDAppleMiniaturizeOnDoubleClickKey = @"AppleMiniaturizeOnDoubleClick";
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults addSuiteNamed:NSGlobalDomain];
bool shouldMinimize = [[userDefaults objectForKey:MDAppleMiniaturizeOnDoubleClickKey] boolValue];

And voilà. The rest is piece of cake: catch double click on your custom header, check the value of shouldMinimize, then call minimize on your window.

We implemented it successfully in Roxee (QT).

Credit goes to user NSGod on stackoverflow.

Ha! Rdio, you failed too… at switching workspace on OSX

Applications on Mac that wish to have a “custom” title bar can go two roads.
The easiest IMO (and the one that allow seamless integration with the app body itself) is to go Qt::FramelessWindowHint (or NSBorderlessWindowMask).

This is what we do – and I’m pretty sure this is what Rdio does as well.

Usually, that means you have to implement moving yourself (and probably resizing as well).

There is one caveat: there is no Cocoa programmatic way (AFAIK) to make the app switch workspace (this is usually triggered when moving an app to the current space edge, and waiting a bit).

So, our Roxee client fails here…
Spotify works ok (but I’m pretty sure they don’t do NSBorderlessWindowMask, but rather have a custom title bar).
And Rdio fails, just like us.

At least, we are not alone.
And I would be glad to hear about any solution to this that doesn’t involve messing with private Cocoa API…

[UPDATE]

Rdio guys know about this