Archive for the ‘Programming’ Category

Animation and 3D: the web is doing it wrong

In Animation and 3D: the web is doing it wrong, I argue that the way the web does animation and 3D is completely bogus and deserves to die. With Tao Presentations, we offer a dynamic document description language that lets us write shorter code that is much closer to storytelling. We’d like to bring this to the web.

Have you ever created a dynamic animation on a web site, or displayed a 3D object? Really, why is it so complicated? Why should I learn how to use half a dozen libraries, write dozens of line of boilerplate HTML, WebGL and CSS code, just to rotate some text on the screen or display a 3D object? Why do I need three (or four, or five) languages, libraries or frameworks to design a single animated web page?
In the realm of business presentations, Tao Presentations solved this problem with a 3D dynamic document description language, letting you easily create sophisticated interactive 3D animations and presentations. What if we brought this very innovative platform to the web? What kind of applications would become possible if we improved web browsers in the areas of storytelling, interactivity, 3D or multimedia?

La SNCF en flagrant délit d’IP-tracking

La SNCF augmente son prix de 41% en deux minutes

La SNCF augmente son prix de 41% en deux minutes

La SNCF affirme ne pas pratiquer l’IP tracking, J’ai du mal à y croire.

Il y a quelques minutes, ma femme va sur le site Voyages SNCF, et demande un billet Paris-Antibes. Prix du billet: 80€. “Attention, dernières places à ce prix”, bien sûr. Mais à un moment, elle fait une erreur, et décide de refaire une recherche sur le même site. Le même billet passe soudainement à 113€.

Je fais un essai depuis un autre navigateur, puis depuis une autre machine dans la même maison (donc même adresse IP depuis l’extérieur). Le billet reste coincé à 113€.

Mais, histoire de vérifier si les billets à 80€ ont vraiment été épuisés (la théorie du blog de la SNCF ci-dessus), je décide de passer par mon smartphone en 3G. Du coup, forcément, changement d’adresse IP. Et là, surprise (pas vraiment, en fait), je retrouve le billet à 80€. Que j’achète.

Le billet acheté: 80€ seulement !

Le billet acheté: 80€

Alor, si la SNCF ne fait pas d’IP tracking, pourquoi ce que je viens de décrire se passe à chaque fois? Ce phénomène ne peut pas s’expliquer par l’épuisement des billets à un certain palier de tarif; parce que les prix affichés sur un même ordinateur dépendent de l’IP utilisée !

Everything is broken and no one cares

February 10, 2013 1 comment

Everything is broken and no one cares

This post from Dear Apple is just so true, and so clearly on topic for Grenouille Bouillie!

Have we reached the point in complexity where we can’t make good quality products anymore? Or is that some kind of strategic choice?

The original post is mostly about Apple products, but the same is true with Linux, with Android, with Windows.

Here is my own list of additional bugs, focusing on those that can easily be reproduced:

  1. Open a file named X in any of the new Apple applications, those without Save As. Open another file named Y. Save Y as X. Beachball. For every application. Worse yet, since applications often remember which windows were open, you get the beachball again when you reopen the application. It takes another force quit for the application to (fortunately) offer to not reopen the windows.
  2. A relatively well known one now: Type F i l e : / / / in practically any OSX application. Without the spaces. Hang or assert depending on your luck.
  3. Use a stereoscopic application like Tao Presentations ( Activate stereoscopy. Switch spaces or unplug an external monitor. Kernel panic or hang to be expected. Go tell to your customers that the kernel panic is Apple’s fault, not ours…
  4. If you backup over the network, set your computer to sleep after say 1 hour while on power. Change your disk enough that the backup takes more than one hour. Backup disk will come up as corrupt after a couple of days, and OSX will suggest you start a new one (and the cycle will repeat).
  5. Use the “Share” button. It takes forever to show up the window (like 2-3 seconds in general on my 2.6GHz quad-core i7 with 8GB of RAM). Since what I type generally begins with an uppercase letter, I usually prepare myself by having the finger on the shift key. But to that stupid animation framework, “shift” means “slow animation down so that Steve can demo it”. Steve is dead, but the “shift” behavior is still there.

I’ll keep updating this list as more come to mind. Add your own favorite bugs in the comments.

First update (Feb 13, 2013):

  1. Safari often fails to refresh various portions of the screen. Visible in particular when used in combination with Redmine. This used to be very annoying, but it has gotten much better in more recent updates of Safari.
  2. iTunes 11 no longer has Coverflow. It was a neat way to navigate in your music, which wasn’t even the default, why remove it?
  3. Valgrind on OSX 10.8 is completely broken. I have no idea what’s wrong, but it’s a pretty useful tool for developers, and Apple has nothing in its own development tools that is even remotely close.
  4. “Detect displays” is gone, both from the Monitors control panel and from the Monitors menu icon. Combine that with the fact that OSX 10.8, unlike its predecessors, sometimes totally fails to detect that you unplug a monitor. And you find yourself with windows stuck on a screen that is no longer there…
  5. That little Monitor menu icon used to be quite handy, e.g. to select the right resolution when connecting to an external projector for the first time. Now, it’s entirely useless. It only offers mirroring, fails to show up 90% of the time when there is a possibility to do mirroring, shows up when mirroring is impossible (e.g. after you disconnected the projector). It used to be working and useful, it’s now broken and useless. What’s not to love?
  6. Contacts used to have a way for me to format phone numbers the way I like. That’s gone. Now I have to accept the (broken) way it formats all phone numbers for me.
  7. I used to be able to sync between iPhone and Contacts relatively reliably. Now, if there’s a way to remove a phone number, I’ve not found it. Old numbers I removed keep reappearing at the next sync, ensuring that I never know which of the 2, 3 or 4 phone numbers I have is the not dead one.
  8. Still in Contacts, putting Facebook e-mail addresses as the first choice for my contacts? No thanks, it was heinous enough that Facebook replaced all genuine email addresses with aliases. But having that as the first one that pops up is really annoying.
  9. Now fixed, but in the early 10.8, connecting a wired network when I also had Wifi on the same network would not give me higher speed. It would just drop all network connectivity.

Updated February 28th after restoring a machine following a serious problem:

  1. Time machine restores are only good if your target disk is at least as big. But with Apple’s recent move to SSD, this may no longer be affordable to you. In my case, I’d like to squeeze 1TB of data into 512G. Time machine does not give me the level of fine-grained control I’d need to restore what I really need. So I need to try and do it manually, which is a real pain.
  2. Calendar sync is a real mess. Restoring calendars from a backup is worse.
  3. Spaces? Where are my good old spaces? Why is it I had spaces on the original machine, no longer have them, and find myself unable to say “I want 6 spaces” or to setup keyboard shortcuts for them as they used to be.

Building a 3D clock in under 10 minutes

In this screencast, I show how you can build a dynamic, real-time clock in less than 10 minutes with Tao Presentations.

Coding a DNA strand in 3D

In this live coding session, we demonstrate how to quickly create a DNA strand in 3D:

The whole code is below:

import LuckyStarsTheme
theme "LuckyStars"

picture_slide "Did DNA come from outer space?", 
    light 0
    light_position 1000, 1000, 1000
    translate -300, 0, -300
    rotatey mouse_x
    random_seed 12345
    dna_strand with -30 .. 30

slide "Arguments in favor", 
    * "Tardigrades can live in space"

dna_strand N:integer -> 
        translatey 50 * N
        rotatey 10 * N
            rotatey 90
            color "#BBB"
            cylinder 0, 0, 0, 10, 10, 200
        dna_base_pair random (0, 3)

dna_base_pair N:integer -> 
    dna_base_color N mod 4
    sphere 100, 0, 0, 40
    dna_base_color (N + 2) mod 4
    sphere -100, 0, 0, 40
    dna_base_name 140, N mod 4
    dna_base_name -140, (N + 2) mod 4

dna_base_color 0 -> color "red"
dna_base_color 1 -> color "blue"
dna_base_color 2 -> color "green"
dna_base_color 3 -> color "grey"

dna_base_name X:integer, N:integer -> 
    text_box X, 0, 40, 40, 
        font "Arial", 30
        color "white"
        align 0.5
        vertical_align 0.5
        dna_base_text N

dna_base_text 0 -> text "C"
dna_base_text 1 -> text "A"
dna_base_text 2 -> text "G"
dna_base_text 3 -> text "T"

When Google oversteps its authority

Recently, a user of Tao Presentations informed us that Google Chrome displayed a dire warning after he downloaded our software: “Tao Presentations may be malicious software”. Uh oh, for the average Joe, that’s a big no-no.

Google locks out “unapproved” programs

It’s not just us. Recently, I tried to download some of the amazing demos created by Iñigo Quilez. Same thing. Seriously, a 4K exe that manages to display a complete mountain? And Google Chrome would have me believe that there’s room in there for “malicious software”? Get real.

Now, it took me quite a while to find a solution to this problem. Apparently, you just need to record your site in Google’s Webmaster tools, and after scanning your site and ensuring (I assume) that there’s no known virus signature in the files, things should improve.

I still find this really annoying that a browser vendor would, by default, tag unknown files as “malicious”. Who are they to make this judgment call?

Why didn’t Google implement a real solution?

Shouldn’t they instead have something a little more sophisticated, that actually detects malicious signatures? You know, like a real anti-virus? Don’t tell me that Google doesn’t have smart enough engineers to write an in-browser anti-virus that doesn’t completely suck.

Nah, instead they went the easy route: anything that we don’t know is malicious. And we tell your users so.

I used to be a big fan of Chrome. Not anymore. Because of this single issue. I think this demonstrate an incredibly stupid arrogance and lack of technical diligence on Google’s part.

Google overstepped its authority and took advantage of their weight. Let’s not get used to it.


Is it normal to wait for your computer? Why should I wait 5 seconds when I click on a menu? Why does it sometimes take half a minute to open a new document? Developers, optimize your code, if only as a matter of public service! What about making it a New Year resolution?

Why is my Mac laptop slower than my iPad?

Apple cares about iPad performance

Apple cares about iPad performance

I have a serious issue with the fact that on a laptop with 8G of RAM, 1TB of hard disk, a quad-core 2GHz i7, I spend my time waiting. All the time. For long, horribly annoying pauses.

Just typing these few paragraphs had Safari go into “pause” twice. I type something and it takes ten seconds or so with nothing showing up on screen, and then it catches up. Whaaaaat? How did programmers manage to write code so horribly that a computer with a quad-core 2.6GHz i7 can’t even keep up with my typing? Seriously? The Apple II, with its glorious 1MHz 8-bit 6502 never had trouble keeping up, no matter how fast I typed. Nor did Snow Leopard, for that matter…

Even today, why is it that I always find myself waiting for my Mac as soon as I have 5 to 10 applications open, when a poor iPad always feel responsive even with 20 or 30 applications open at the same time? Aren’t we talking about the same company (Apple)? About the same core operating system (Darwin being the core of both iOS and OSX)? So what’s the difference?

The difference, folks, is optimizations. Code for iOS is tuned, tight, fit. Applications are programmed with severe hardware limitations in mind. The iPad, for instance, is very good at “pausing” applications that you are not using and recalling them quickly when you switch to them. Also, most applications are very careful in their use of resources, in particular memory and storage. Apple definitely cares about the performance of the iPad. There was a time the performance of the Mac mattered as well, but that was a long time ago.

Boiled frog syndrome : we slowly got used to desktops or laptops being slower than tablets, but it’s just plain stupid.

Lion and Mountain Lion are Dog Slow

It's obvious why they called it Lion...

It’s obvious why they called it Lion…

I’ve been running every single version of MacOSX since the Rhapsody days. Up until Snow Leopard, each release was a definite improvement over the previous version. Lion and Mountain Lion, on the other hand, were a severe step backwards…

Lion and Mountain Lion were not just loaded with features I didn’t care about (like crippling my address book with Facebook email addresses), they didn’t just break features I relied on on a daily basis (like full screen applications that works with multiple monitors, or RSS feeds). They were slow.

We are not talking about small-scale slowness here. We are talking about molasses-fed slugs caught in a tar pit, of lag raised to an art form, of junk code piling up at an industrial scale, of inefficiency that makes soviet car design look good in comparison.

And it’s not just me. My wife and my kids keep complaining that “the machine lags”. And it’s been the case with every single machine I “upgraded” to Lion or Mountain Lion. To the point where I’m not upgrading my other machines anymore.

In my experience, the core issue is memory management. OSX Lion and Mountain Lion are much worse than their predecessors at handling multiple programs. On OSX, the primary rule of optimization seems to be “grab 1GB of memory first, ask questions later.” That makes sense if you are alone: RAM is faster than disk, by orders of magnitude, so copying stuff there is a good idea if you use it frequently.

But if you share the RAM with other apps, you may push those other apps away from memory, a process called “paging“. Paging depends very largely on heuristics, and has major impact on performance. Because, you see, RAM is faster than disk, by orders of magnitude. And now, this plays against you.

Here is an example of a heuristic that I believe was introduced in Lion: the OS apparently puts aside programs that you have not been using for a long while. A bit like an iPad, I guess. On the surface, this seems like a good idea. If you are not using them, free some memory for other programs. But this means that if I go away from my laptop and the screen saver kicks in, it will eat all available RAM and push other programs out. When I log back in… I have 3GB of free RAM and a spinning beach ball. Every time. And even if the screensaver does not run, other things like backupd (the backup daemon) or Spotlight surely will use a few gigabytes for, you know, copying files, indexing them, stuff.

Boiled frog syndrome : we slowly got used to programs using thousands of Mac128K worth of memory to do simple things like running a screensaver. It’s preposterous.

Tuning memory management is very hard

Virtual Memory is complicated

Virtual Memory is complicated

The VM subsystem, responsible for memory management, was never particularly good in OSX. I remember a meeting with an Apple executive back in the times OSX was called Rhapsody. Apple engineers were all excited about the new memory management, which was admittedly an improvement over MacOS9.

I told the Apple person I met that I could crash his Mac with 2 minutes at the keyboard, doing only things a normal user could do (i.e. no Terminal…) He laughed at me, gave me his keyboard and refused to even save documents. Foolish, that.

I went to the ancestor of, opened a document, clicked on “Zoom” repeatedly until the zoom factor was about 6400% or so. See, in these times, the application was apparently allocating a buffer for rendering that was growing as you zoomed. The machine crawled to a halt, as it started paging these gigabytes in and out just to draw the preview on the screen. “It’s dead, Jim“, time to reboot with a long, hard and somewhat angry press on the Power button.

That particular problem was fixed, but not the underlying issue, which is a philosophical decision to take control away from users in the name of “simplicity“. OS9 allowed me to say that an App was supposed to use 8M of RAM. OSX does not. I wish I could say: “Screen Saver can use 256M of RAM. If it wants more, have it page to disk, not the other apps.” If there is a way to do that, I have not found it.

Boiled frog syndrome : we have slowly been accustomed by software vendors to give away control. But lack of control is not a feature.

Faster machines are not faster

A 1986 Mac beats a 2007 PC

A 1986 Mac beats a 2007 PC

One issue with poor optimizations is that faster machines, with much faster CPUs, GPUs and hard disks, are not actually faster to perform the tasks the user expects from them, because they are burdened with much higher loads. It’s as if developers always stopped at the limit of what the machine can do.

It actually makes business sense, because you get the most of your machine. But it also means its easy to push the machine right over the edge. And more to the point, an original 1986 Mac Plus will execute programs designed for it faster than a 2007 machine. I bet this would still hold in 2013.

So if you have been brainwashed by “Premature optimization is the root of all evil“, you should forget that. Optimizing is good. Optimize where it matters. Always. Or, as a colleague of mine once put it, “belated pessimization is the leaf of no good.”

Boiled frog syndrome : we have slowly been accustomed to our machines running inefficient code. But inefficiency is not law of nature. Actually, in the natural world, inefficiency gets you killed. So…


Taodyne – Tao Presentations documents: execution and drawing model

This article explains how Tao Presentations proceeds to transform a document (.ddd) into images on the screen. It describes an interesting mechanism making it easy to create dynamic documents that depend on events such as time or mouse movements. Moreover, this technique also allows Tao Presntations to optimize the rendering of graphic elements, enabling smooth 60Hz drawings even with complex contents.

Taodyne – Tao Presentations documents: execution and drawing model.

Meta: Talk about LLVM

I gave a short talk about LLVM today. The link to the talk is tao:// (sorry, can’t make it a hyperlink, as WordPress removes the tao:// part…). To watch this link, you will need Tao Presentations, which itself uses LLVM for the rendering.

Rendering of the LLVM talk with LLVM within Tao Presentations

This is not the first meta-talk made with Tao Presentations, but for some reason, this one reminds me of the first time I presented HPVM from a Powerpoint within HPVM.

Taodyne’s best wishes – Source code version

I have release the source code for the “Season’s Greetings” from Taodyne. This can give you an idea of what XL can do today. In that video, which is rendered in real-time and in 3D, the XL program executes 60 times per second to synchronize the animations on the screen with the background movie.

In other XL-related news, I’ve been working on an updated language reference document. This describes where I want to bring XL, notably the type system and library. A lot of what is in this document is not implemented yet, but it will give the directions that I intend to follow in the coming months.


Get every new post delivered to your Inbox.

Join 365 other followers

%d bloggers like this: