Older blog entries for fzort (starting at number 175)

1 Oct 2009 (updated 2 Oct 2009 at 00:40 UTC) »
dkg: seriously dude, WTF? I just had a look at an article linked from your post, with a transcription of the supposedly controversial bits of Mark Shuttleworth's talk. Isn't the word "guys" gender-neutral in that context? Also, how hard is it to understand from the context that he obviously intended the world "girl" to mean "non-techie companion of the opposite sex", whatever that sex may be?

Get a grip, you people. I'm alright with folks denouncing the oppressive patriarchy, but calling Shuttleworth's talk "sexist" is crossing the line towards utter batshit insanity. You guys (and here I'm using the word in a non-gender-specific way) are the ones who owe him an apology.

ncm: good one. I didn't find the tone "insulting" at all. Well, maybe he took issue with the last paragraph...

After a weekend coding marathon, the project is starting to look more like a game. New video here.

By Jupiter, I love to code, especially when it's something as cool as this! If only I could do it full time... :-)

8 Sep 2009 (updated 8 Sep 2009 at 22:44 UTC) »

I had a productive holiday. The world needs more Tetris clones.

3 Sep 2009 (updated 3 Sep 2009 at 22:06 UTC) »

Cartesian product of a list of lists, in Scheme:


(define cartesian-product
  (lambda (lists)
    (let loop ((lists (cdr lists))
               (result (map list (car lists))))
      (if (null? lists)
        result
        (loop
          (cdr lists)
          (apply
            append
            (map
              (lambda (l)
                (map
                  (lambda (i)
                    (append l (list i)))
                  (car lists)))
              result)))))))
(display (cartesian-product '((a b c) (d e f) (g h i))))

Not very efficient, but kinda cute.

29 Aug 2009 (updated 31 Aug 2009 at 13:56 UTC) »
This post is just for the Brazilian readers. Sorry, non-Brazilian Advogatans.

Regulamentação da Profissão de Analista de Sistemas

Para quem não ouviu falar sobre isso ainda, por favor leia isto agora e se revolte.

O assunto é muito grave. Se você é contra, envie e-mails e/ou cartas para os senadores do CAS. O e-mail que enviei está aqui. Se estiver com preguiça de escrever, fique à vontade para mudar só a assinatura e enviar a mesma carta, mas por favor se manifeste!

Compilei os e-mails e endereços dos senadores do CAS aqui. Se quiser enviar uma carta, o endereço é o da primeira linha do arquivo, acrescido do gabinete (por exemplo, "Ala Teotônio Vilela Gab 03" no caso da senadora Rosalba, a atual presidente do CAS).

Obrigado pela atenção.

Now, back to our regular programming.

28 Aug 2009 (updated 29 Aug 2009 at 16:37 UTC) »
iPhone Development on Linux

I recently bought an iPod Touch (which is basically an iPhone without the phone), specifically to develop games for it. Now, the official way to develop for the device is with Apple's SDK, which only runs on Macs. I don't own a Mac, but I knew there's an unofficial toolchain that runs on Linux (in fact, it appeared before the official SDK - there's even an O'Reilly book about it, written by one of the main developers). Unlike the homebrew toolkits for the Sony PSP or Nintendo DS, the unofficial iPhone toolchain actually uses Apple's SDK, so it's easy to go mainstream afterwards if you feel like it.

Here's how I set it up.

Jailbreak the device

It's easy. If you're lazy and impatient, there are GUI applications (for Windows) that do everything without too much hassle. I used QuickFreedom.

These jailbreak applications will usually install Cydia, a graphical front-end to apt (the package system we all know and love). The first package you'll probably want to install is OpenSSH. After you installed it, log in to the device and look around - it's a BSD:


$ ssh root@192.168.0.174
iPod-touch:~ root# uname -a
Darwin iPod-touch 9.4.1 Darwin Kernel Version 9.4.1: Mon Dec
 8 21:02:57 PST 2008;
root:xnu-1228.7.37~4/RELEASE_ARM_S5L8720X iPod2,1 arm N72AP
Darwin

Build the Linux toolchain

The iphonedevonlinux project is a nifty shell script that builds everything. The only catch is that it builds the toolchain for firmware 2.* (the current one is 3.*). But don't worry, it's still compatible with the newer firmwares.

Before you start, you need to download the iPhone SDK from Apple's site. There's no link at the site to the 2.* SDK, only for the 3.0 SDK, so here's a direct link to the one I downloaded, for 2.2. You'll need to register at Apple's site, but it's free.

The file is 1.7 GB. I left Firefox downloading it before I left for work in the morning a couple of times, only to find out in the evening that Firefox crashed during the download. If, like me, you don't have an ultra-fast internet connection, you might want to install this Firefox add-on; then log-in to Apple's site, use the add-on to export cookies.txt, and download the file with wget --load-cookies cookies.txt ....

After you're done, follow the installation instructions (if you downloaded the .dmg file I mentioned above, use the 2.1 branch). After you check out the project from SVN, toolchain.sh needs a couple of fixes before you can run it. Apply this patch - it fixes a broken URL and makes the script copy the OpenGL ES headers. Run the script and be patient - it will take a while.

While the script builds everything, you might want to read up on Objective C (in case you don't know it already) and the documentation on iPhone development at Apple's site (use Google). Have fun!

I ported my little game SIGBUS to the iPod - you can use the accelerometer to control the ship. Here's an early picture, and here's the application binary, which you can try if you have a jailbroken device. It's a work-in-progress - source code coming soon.

Assorted observations

  • Home wi-fi is an absolute must if you're developing under Linux. You'll need SSH to upload your applications to the device. Sorry.
  • iphonedevonlinux includes a couple of nice little "Hello, world"-type applications to get you started. If you look at the Makefiles, you'll notice that the deploy target does a killall SpringBoard - this is used to make the new application icon appear on the main menu. Unfortunately, this no longer works with newer firmwares (at least, it doesn't work with mine - I have 2.2.1). Instead, install BossPrefs from Cydia, and do /Applications/BossPrefs.app/Respring.
  • OpenGL ES is OpenGL minus a lot of cruft. Among other things, there's no immediate mode (glBegin/glEnd) or display lists. That's actually a good thing. Here's a quick hack to get you started - it sets up an OpenGL context and draws a triangle.

I'll update this "article" when I have some time.

6 Jul 2009 (updated 10 Jul 2009 at 11:20 UTC) »

My new game is looking like this.

I'm writing it for a contest, and it's important that the game performs well on a certain brand of graphics chips. Now, there are many ways to draw a triangle mesh with OpenGL: immediate mode, glDrawArrays, glDrawElements, vertex buffer objects, triangle strips... In order to settle the issue, I wrote a small benchmark (source, needs SDL and libglew). This loads and displays a rotating Stanford Bunny, with a FPS counter on screen; the space key changes the rendering method. I implemented variations of all rendering methods I could think of. The code also breaks the mesh into triangle strips, to check if they are worth the trouble (I'm using a stupid greedy algorithm - start from a random triangle and follow strips from both directions for as long as you can - which gave me 5325 strips for 69451 triangles, after some tweaking. There are better algorithms out there).

Results:

  • somewhat counter-intuitively, on all platforms I tried, drawing straight vertex arrays is faster than drawing indexed elements;
  • triangle strips pay off big time on all platforms;
  • VBOs are worthless on GPUs without hardware T&L (like most Intel GMA GPUs, except for the newer ones).
MAKE TIME

I'm permanently going off-line on IM services. That stuff is too much of a time sink. I'm still reachable through e-mail. Thank you.

23 Jun 2009 (updated 18 Jul 2009 at 17:56 UTC) »
[elided]

166 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!