Fast & Curious
Gilles Debunne

XCode headermaps

When building with C/C++, the include paths are listed with a -I option, in search order. But XCode has an undocumented 'smart' feature called header map which supposedly accelerates the search process based on name.

However, when two files with the same name are provided by two different libraries (JSON.h in my case), the header maps do not preserve the include search paths order. The solution is to use the + icon in your project's build settings and add a USE_HEADERMAP=NO option. Hours lost.

It just works

This problem, and XCode in general, is a good example of Apple doing it wrong. Whether the user base is too small, or the software is inherently more complex, it does not par with the quality and ease of use of other Apple products. An IDE should be a tool, not the whole ecosystem. I had to manually fix my XCode workspace files many times, when it got confused after renaming or deleting files. When dealing with code, the config files should be the reference and should be editable, instead of hiding configuration under the UI.

AngularJS add ons

Tried to add two angular extensions to my project today.

angular-tour was supposed to easily create a tour of the web site. But all I got was undefined is not a function error messages. I debugged a little with no luck and finally created an issue on the git project page. The bower also has a hard coded dependency on jquery version 2.0.3 which prevented an update to a more recent version for my project.

Next I tried to integrate angular-slider, a replacement for angular-slider. I also looked at angular-rangeslider and angular-jsslider. So many options, all providing the same service, but with various limitations. The one I picked was basically invisible, as it does not provide a css, and had a flacky mouse tracking (clicking on a handle made it change the value).

Large projects needed

Comparable to the problems I had with grunt packages, it really seems the JS ecosystem is a bit too young. Open source projects are nice and github has tons of them, but a few tens of users and a single maintainer are simply not enough to create production ready bricks.

Bash is back

I had an other painful experience with bash scripts today.

All I wanted to do was to create a cron task that updates some files in a folder, compresses and uploads these files on a web site using ftp.

As before, the curl part was problematic, when used in conjunction with variables.

But this time, I've found this answer in a thread. Turns out that when you declare:

→ FOO='a b "c d"'

echo $FOO will work as expected, but showargs $FOO will list these parameters:

→ showargs $FOO
Program name: showargs
Parameter  1: a
Parameter  2: b
Parameter  3: "c
Parameter  4: d"

4 parameters instead of the expected 3, double quotes loosing their meaning and a text split by spaces.

showargs

showargs is a simple C executable that lists the different parameters of a bash command. Here is its code:

#include <stdio.h>

int main (int argc, char *argv[]) {
        printf("Program name: %s\n", argv[0]);
        for (int i=1; i<argc; i++)
                printf("Parameter %2d: %s\n", i, argv[i]);

        return 0;
}

Use gcc showargs.c -o showargs to compile, and you'll get a pretty cool debugging tool. Simply preprend it in front of the failing command in your script to list its actual parameters.

This allowed me to fix my curl syntax (by splitting a variable into two, bash black magic).

When I'm ready, I'll try to debug the bash REST test I abandoned few weeks ago.