soledad penadés
repeat 4[fd 100 rt 90]

Archive for April, 2008

20080421 Building a universal library in Mac OS X

If you need to use a library in a universal binary you'll need to use a universal library too.

Let's use FMOD as an example; libfmod.a is the PPC compiled version, libfmodx86.a is the intel version.

For combining both into a universal library:

lipo -create libfmodx86.a libfmod.a -output libfmod-universal.a
ranlib libfmod-universal.a

In the case of FMOD they provide you the with precompiled static libraries (the .a files). But if you build libraries from source code, there's a magic compiler option called -arch which will help you in this. Unfortunately I don't have an example handy right now. I'll put it whenever I find it again, but it roughly goes on the lines of -arch i386 -arch ppc :-)

I'm not sure that naming a library with something as *-universal.a is a good idea, specially if you have code which uses -Llibraryname for linking libraries — I guess you might need to change that parameter. I am explicitly adding the libraries to the project in XCode so it's working fine for me.

Suggestions and better practices are welcome!

20080408 Mental note about #ifndef's

When using #ifndef for #include guards:

#ifndef BLAH_H
#define BLAH_H

// code

#endif

make sure that #ifndef and #define are the first lines of the archive!

I had placed some comments before them and that made me lose several hours, trying to find out why class forward declarations didn't work as they should. One could expect the compiler to ignore comments automatically but that's not the case.

I also looked for something as #pragma once for GCC, since I remembered that from when I used Visual C++, but although it was supported at some time, it is now deprecated, so the only solution is placing the #ifndef where it must be (at the very beginning).

20080402 Zuckerberg == E.T.

You're going to love this one-month-old news (well… not) but it wasn't until today that I managed to listen to the Zuckerberg keynote at past SXSW. I had read it had generated a fair amount of discussion although I didn't know exactly why.

In any case, once you listen to the podcast you can easily understand the attendees' indignation. Roughly, it is pretty much an hour of:

Sarah Lacy:
Absolutely irrelevant or bland question | Right | A-ha | My book…
Mark Zuckerberg:
helping people communicate more efficiently … communicate … mission … communicate … efficiently … website trend … helping people communicate more efficiently… tool … communicate …
connect …

No wonder people made fun of the whole situation! There's even a cartoon!

In case you're really curious here's the podcast, from the podcasts page.

20080401 Incendiary fun

After the good feedback on the Tex & Knuth quotes (including e-mail and IM messages), I thought why not? Let's have more funny stuff

Today is a little bit about hot stuff. Incendiary. The type of people which can shake and stir readers' opinions until spawning pages and pages of infuriated responses in forums, mail groups and blogs alike, but have sufficiently founded arguments as to not to be labelled as trolls, and that's probably what makes their words so outrageous!

One

First, there's this guy called Erik Naggum. He's a genius in borderline trolling; and being a Lisp programmer, he seems to find Perl particularly irritating.

Casually, I once had to deal with a piece of legacy code written in Perl which wasn't behaving properly, and all I got was a lousy notion of how it worked, plus a big headache. So when he says this:

Part of any serious QA is removing Perl code the same way you go over a dilapidated building you inherit to remove chewing gum and duct tape and fix whatever was kept together for real.

… I can't but agree!

There's some love for C++ as well:

C++ is philosophically and cognitively unsound as it forces a violation of all known epistemological processes on the programmer. As a language, it requires you to specify in great detail what you do not know in order to obtain the experience necessary to learn it. C++ has taken premature optimization to the level of divine edict since it cannot be vague in the way the state of the system necessarily is. (I'm not talking about totally vague, but about the kind of vague details that programmers are supposed to figure out even after a good design has been drawn up.)

In other words, a C++ programmer is required by language design to express certainty where there cannot be any.

(from here)

The really good part is that he's not wrong. If you have done any C/C++ after working with dynamic languages for a while, you know perfectly what he's referring to. Will it be an unsigned char, a char, an int, unsigned int…? Updating the .h and the .cpp, then the other sources which refer to that class too, blah blah…

In a way, it's like playing cluedo with the compiler :-)

Of course, you can't advocate using dynamic languages for writing a kernel module, yeah, we know that part already; this was about funny quotes, remember? ;-)

There are more quotes by Erik in his own wikiquote entry, should you feel the need for more Naggum-isms.

… and two

The second and final dose of incendiary fun, while it's not strictly a quote, but coming really hot from the oven, comes from the one and only Linus Torvalds, this time reporting an error in Fedora when trying to play a Youtube video:

Description of the problem: youtube no workee - fedora 9 not usable for wife

Incidentally, this has taught me a new expression: rick-roll - which means either watching Rick Astley videos or getting them posted into any place! In other words: spreading the Rick Astleyness as much as possible! So let's all sing something to the tune of Never gonna give you up to celebrate, while we wonder if Linus' bug reporting was intended to be an April Fool's joke in fact!

UPDATE: Now that you know what Rick-rolling is, you have the chance to attend the first ever RickMob, 6pm, 11th April at Liverpool Street station, London, of course!