Archive for the 'Random' Category

Does this repository make me look fat?

The main RunOrg SVN repository contains:

  • 38490 lines of OCaml implementation code spread over 273 *.ml files.
  • 5134 lines of OCaml signature code spread over 156*.mli files.
  • 4776 lines of HTML template code spread over 271 *.htm files.
  • 1971 lines of CSS in 6 files.
  • 1898 lines of JSON configuration in 26 files.
  • 1172 lines of JavaScript in 5 files.

That’s a total 53441 lines in 837 files.

Here’s a plot of how the 38490 lines of OCaml code came into being over the last eight months.

That is all.

PayPal Spam

Last year, I created a PayPal account with no associated credit card number, as I was to receive some contest prize money to pay for a specific product. Since then, I have received a lot e-mail from PayPal.

There were several dozen advertisements that I would rather not have received. There was not a single e-mail to notify me that the credit card I once entered to do a one-shot payment six months ago had instead become associated with the account and was going to be used to pay for anything PayPal thought I should pay. There was not a single e-mail to notify me that the original specific product had a one-year renewal policy which, given that there was now a credit card associated with the account, was about to charge me again. Nor was there any e-mail to notify me that I had just been charged.

When an internet service sends flurries of advertisements but fails to send relevant and important information, it’s time to leave. I realize now that I should have closed my PayPal account right away, instead of keeping it around «in case I might need it again later»

A lesson learned and an account closed.

AJAX Tiles Game

I started programming life by writing an AI for a simple game called RoboWar (back when it was a shareware game on Macintosh, in the pre-OS X days). Make sure you click the “Edit” buttons at the bottom of that page to view the kind of code I had to deal with. I then moved on to HyperTalk and, when I finally got my hands on a PC, started a ten-year spree in C++.

Recently, I started toying with a similar idea: to create a game where people could write an AI that would play for them, with simple and easily modeled rules, and a really easy way to share your creations with your programmer friends (because just adding your AI to a long list of other AIs is kind of boring and not very social).

So, I wrote a simple game in JavaScript. You feed it one URL for each player, and the game connects to that URL and asks for the next move. So, your AI is one URL, which makes it easy to share. Not to mention that you can probably write that AI in any language you wish, provided it can respond to HTTP requests and read JSON arrays of characters, and you can resort to a lot of fancy stuff (cloud computing, learning from experience, genetic algorithms) that would otherwise not be available in a game like RoboWar. The game board is readily available for you to observe while the game is played. It looks like this:

The rules to the game are fairly simple: pick white tiles to paint them with your color, pick tiles you already own to nuke them (blows up that tile and the four adjacent tiles as well), and connect a large group of tiles you own to a small group of tiles your opponent owns to conquer them. The player with the most tiles when the board is covered, wins. Play it here. I’ve already programmed four different AIs:

  • http://tiles.nicollet.net/ai/?random plays randomly.
  • http://tiles.nicollet.net/ai/?expand creates one single group of tiles and expands it as fast as possible.
  • http://tiles.nicollet.net/ai/?fearful nukes its own tiles when they might become connected to enemy tiles.
  • http://tiles.nicollet.net/ai/?contain attempts to contain the enemy in a prison of nuked tiles.

None of these are particularly good, and a human player can certainly beat them quite easily, but they’re a good challenge for your own AI. If you wish to participate without starting from scratch, you can fork the sample AI on GitHub to create your own (it’s PHP code). Also, the GitHub README contains all the technical details about what data your AI URL receives and what data it should respond with. And, if you’re curious, the game rules are cleanly described in the JavaScript source code.

I’m looking forward to hearing from you. Please share your AIs in the comments below, if you please: I’m really interested in what you might come up with.

Boo.

It was early february a few years ago. My girlfriend had just left France, and was to stay in China for six months, so I was getting back to my old teen programmer habits of writing code alone at my desktop computer at 4:00 am. My room was the typical no-girlfriend-around mess, with old clothes lying on the bed, dishes on the corner of the desk, unused laptops scattered around the room, soft music in my headphones and my two monitors being the only light source in the room.

I’m afraid I don’t really remember in what order things did happen that night. I do remember hearing a short, sad whistle coming from behind me, feeling something soft, large and warm pressed against my lower back, and all the lights suddenly going out, all in quick succession.

I immediately stood up and turned around, my not-yet-wireless headphone cord dragging unidentified objects off the desk into a cacophonous cascade, my badly adjusted eyes trying to see through the darkness to understand what had just touched me, or where that noise might have come from.

So I just stood there for a while. After a few seconds, I heard a noise, different from the first one. It sounded like fingernails on plastic. I could not precisely locate where it was coming from, and it was so soft that I quickly dismissed it as either a by-product of my terrified imagination or one of the fallen objects rolling around.

Then, I heard that same noise again ten seconds later. And again every ten seconds after that. It did not sound like anything a machine could make (and besides, all appliances and computers were powered off anyway), in fact it had an almost human feel to it.

I called out “Il y a quelqu’un?” (“Is anybody there?”), then immediately felt silly at asking such a question out loud while alone at night in my apartment. My question was shortly followed by a short male laughter coming from somewhere in my room. Then the finger-on-plastic noise again. And again.

It occurred to me that having a panic attack in the dark was not very advisable, and that I could at least use one of my laptops as a light source. I found one, picked it up, placed it on the desk and opened the lid. The screen came to life showing a browser pop-up window for some online poker playroom (don’t judge me!) that bathed the room in a pale green light. I started looking around for my flashlight, which would provide better illumination and let me reach the fuse box, when I heard someone distinctly laughing right behind me.

I turned around, striving to drive my elbow into what I hoped to be a sensitive part of the intruder’s anatomy and ended up being a lot of otherwise uninhabited air. And I notice a video playing on the poker pop-up, of a smug man like you expect to see on a poker pop-up, juggling with some poker chips in his hand and making that fingernail-on-plastic noise. And laughing every ten animation loops. Genius.

From what I gathered the next day, the power had been cut in the middle of the night, prompting my alarm clock to whistle loudly in its death throes. The laptop had been playing that poker video since I laid it down, but the sound had been drowned out by the music in my headphones and only became audible when the music stopped and I took them off. I still have no idea what the warm sensation was.

Also, you might want to read this [reddit].

Fukushima – Remind Me Later

The nuclear power plant Fukushima I has been the center of international attention this week in the aftermath of the Sendai earthquake and tsunami. They are currently having technical issues in four distinct reactors, for a variety of reasons. Depending on whom you ask, this might result in either putting those reactors out of commission permanently, or inflicting potentially lethal radiation doses throughout in East Asia.

Nuclear science is hard, but I still kind-of-get-it because I have a reasonable background in physics. But a real-life nuclear reactor involves a huge amount of small practical details that are beyond the grasp of anyone but a trained engineer — and even then, different types of reactors involve different areas of expertise. I suspect that most experts in the specific technology used at Fukushima I are busy solving the hell out of that mess, so we will not be getting a detailed explanation from them any time soon.

Until then, our main sources of information are far less reliable. Popular french media website Rue89 ran a headline about a nuclear explosion having happened, which was later revealed to be incorrect. Contradicting sources indicate the level of irradiation of workers anywhere between 100% and 2000% of allowed the yearly dose, some state that the confinement was breached while others state that it was not, and the French and Japanese atomic agencies disagree on whether this is a 4/7 or 6/7 catastrophe. Anti-nuclear activists are quoted in the media and rant on about «huge risks» without ever mentioning what those risks are and why they are huge, while pro-nuclear activists insist that sustained damage is well within acceptable (and foreseen) limits. And the media vomits technically incorrect approximations to make things easier to understand, skipping such critical details as the half-life of radioactive gases or the impossibility for the fuel to turn into an atomic bomb.

I’ve had the mixed pleasure of listening to an interview during which the first explosion at the Fukushima plant happened — the journalist interrupted the interview and asked the interviewee, a nuclear power expert, whether the explosion that just happened was a very bad thing or not. I know experts are known for being above-average geniuses, but please! How can you expect anyone to provide a reasonable answer based on a single-sentence description of an unconfirmed explosion?

I trust that the experts out there in Japan know what they are doing, and are taking the appropriate steps to protect the population should the worst scenario happen. So, I’m going to patiently wait until the crisis is over and all those experts can work on a detailed postmortem I can read through.

Behind Blue Eyes

Oh, my. Look at the time. It is almost 1:00 am here. I should already be sleeping by now.

She is already asleep. Which is quite surprising given that she needs less sleep than I do, and we usually wake up at about the same time in the morning. Of course, she commutes to work while I work from home, which might make it seem a bit frustrating.

She trusts me. And that’s rational trust in my ability to cope and either succeed or cut my losses, not the watered down «Of course I trust you, honey» version.

And she supports me. All the way through. She understands that I sometimes need to work late or week-ends, that I can spend a lot of time with my associates or customers, and that I sometimes leave the house in a mess because I was too damn busy battering a feature into an appropriate shape. And she deals quite gracefully with my permanent obsession about my start-up.

And I certainly do not thank her for this enough. I do not think I ever could.

 

Wait. She is not actually sleeping. The dim glow of a laptop and soft chattering of a keyboard are coming from the bedroom. She is almost as much of a geek as I am, which might be one reason she copes with my… tendencies.

Maybe I should get some sleep.

Yes.

Time to go.

Thank you.

 

97% of French Population was Polled

… at least once in 2010 according to the MFPI [1], finally answering accusations of bias due to the choice of the population sample. The MFPI contacted a representative sample of 988 people between March and April 2010 and asked them if they had been polled at least once during the year. 97% answered that they had been, while 3% declined to answer.

Silly, right?

Sample-based polling involves asking a small but diverse sample of people a series of questions, and then using national census data (and similar nation-wide sources) to extrapolate those results to the entire population. So, if a report somewhere says that out of 65 million people, 50,000 people are roman catholic caucasian males with a higher education between the ages of 25 and 35 and living in the Paris area, and you have in your sample one roman catholic caucasian male with a higher education between the ages of 25 and 35 living in the Paris area, then you will extrapolate the answer of that person to the 50,000 others who are construed to be identical.

The nice thing about sample-based polling, when done correctly, is that on average, it works: run the same poll one hundred million times with a different sample every single time, and you will probably end up with the correct result.

However, it’s easy to get things wrong, because sometimes the opinion of 50,000 people hinges on whether the one person from that group is a lunatic. Just a few examples:

  • Your questions might introduce unnecessary variance. I used to be a frequent user of the underground lines 13 and 14. When I was polled about this, they asked what lines were involved in my current trip — which happened to be a short detour to a restaurant to meet a friend there — and ended up attributing my extrapolated package of 5,000 users to line 7 instead.
  • People might not answer honestly. If you’re perceived as a tyrant, ask any independent statistics institute from the western world to poll your population — how do you think the terrified population of urban centers will react to a phone call asking whether they love their president for life? 90% approval rating, yay!

To end on a positive note, according to another MFPI poll, 100% of my girlfriends agree that I had a great impact on their lives.

[1] My Fictional Polling Institute.

Gifts

Are you having trouble with the search for presents for everyone around you? Worry no longer : this one-page helpful guide will take you through the difficult steps of having a great idea, and provides helpful tips for escaping from the melee on the morning of December 25th.

Creative Commons License
The font used for the headings is Tusj, and there’s a link to a downloadable and printable PDF file here. And don’t forget to support the Switzerland.

Ovh-WikiLeaks sets a Reassuring Precedent

I mentioned recently that Amazon ousted WikiLeaks from its servers without waiting for a confirmation of its illegality, and how this implied huge risks for anyone using the Amazon Cloud.

So, WikiLeaks moved elsewhere, and one of these locations was OVH, a hosting company in France that happens to host the RunOrg servers as well. As expected, a combination of public outcry and government pressure appeared as soon as the location of the WikiLeaks hosting was revealed on Thursday, December 3rd.

The OVH CEO, Octave Klaba, penned a response to the ongoing crisis the next day, which I have translated into english for your convenience.

Hello,
As you certainly know, the wikileaks site is hosted on our infrastructure since yesterday in the early morning. A client ordered a dedicated server with RIPE blocks and protection against attacks. Their bill, paid with a credit card, is less than 150 euro. And that client hosts the wikileaks site. On a strict legal definition, Ovh does not host that site. Ovh is only the technical support of the technical solution that said client has ordered.

In short, this is an ordinary and daily occurrence. The [ordering and delivery] system is entirely automatic and works 24/7. We discovered just like you did that this site was on our infrastructure yesterday … in the media.

Ovh is neither condones nor condemns this site. The question is off topic. Ovh is a company that provides infrastructure, the famous cloud computing available within hours …, and our role is to provide this technical service. That is all. We did not ask to host, or not to host, that site. Now that they’re using our infrastructure, we will honor the contract. That is our job. The site works.

Given the recent political statements, and the increasing pressure put on us even here in Roubaix Valley, we have decided to refer the topic in emergency to a judge, who could then determine whether this site may legally be hosted on French soil. It is the role of neither the political world nor Ovh to demand or decide the removal of a site, that is the role of judges alone. That is how it should work in a state of law.

We hope that the judge will take a decision tonight or tomorrow. And Ovh will apply that decision immediately.

All the best,
Octave

I am overjoyed to see that, at least in my country, my web site will not be ousted from the servers that are hosting it unless a judge says so, regardless of the political or economical pressure. I guess that’s too bad for Amazon.

Here’s the original French text, for those interested:

Bonjour,
Comme vous savez certainement, le site wikileaks est hébergé sur nos infrastructures depuis hier très tôt le matin. Il s’agit d’un client qui a commandé un serveur dédié, avec les blocs RIPE et de protections contre les attaques. Sa facture payée par CB s’élève à moins de 150euro. Et donc il héberge le site wikileaks. Juridiquement parlant Ovh n’est pas l’hébergeur de ce site. Ovh est, juste, le prestataire technique de la solution technique que le client a commandé.

Bref, l’histoire est banale et quotidienne. Le système est totalement automatique et fonctionne 24 heures sur 24. Nous avons découvert comme vous tous que ce site est chez nous hier … dans la presse.

Ovh n’est ni pour ni contre ce site. La question hors sujet pour nous. Ovh est une entreprise qui fournit les infrastructures, le fameux cloud computing disponible en quelques heures …, et notre rôle est d’assurer cette prestation technique. C’est tout. On n’a pas demandé d’héberger ce site ou ne pas l’héberger. Maintenant qu’il est chez nous on assure le contrat. C’est notre boulot. Il est fonctionnel.

Compte tenu de dernières déclarations politiques, et de pressions qui commencent réellement à se sentir, même ici à Roubaix Valley, nous avons décidé de saisir le juge en référé afin qu’il se prononce sur la légalité ou pas de ce site sur le territoire français. Ce n’est pas au monde politique ni à Ovh de demander ou de décider la fermeture ou pas d’un site mais à la justice. C’est comme que ça doit marcher dans un pays de droit.

Nous espérons que le juge donnera sa décision avant ce soir ou demain. Et Ovh appliquera la décision immédiatement.

Amicalement
Octave

Sorry About That

Welcome to a geek’s worst nightmare: the server just went down. There’s no more blog, no more web site, no more safe online backup of your family pictures, and your victor@nicollet.net e-mail is deader than a wooden piece of… wood. Turns out, my hosting company had a little accident where hard drives suddenly couldn’t be written to anymore.

Now, of course, nicollet.net is not what I would call a production server. On a real-life production server where the disk cannot be written to, sirens would start wailing, system administrators would be paged in the middle of the night (on a week-end), monitoring software would send cryptic apocalypse prophecies in their summary e-mails, and statues would cry blood. For my blog, everything continued to work in read-only mode for what appears to be half a day, until I decided to log in to the server and found out I couldn’t.

So, I rebooted it (from my hosting company’s online administration tool) and waited for it to come back up so I could investigate.

It didn’t. For half an hour. I kept refreshing the web page that shows the server status in my hosting company’s server rooms (mine is in 08H06) until I found out the page refreshed itself automatically.

And when it came back online, I stumbled upon the geek’s second worst nightmare: the private key of my server had been changed. In non-geek terms, this means that the server had been replaced by another server, possibly as a consequence of a hostile take-over by a random hacker (I’ve had this happen, and it’s very annoying) or an unexpected hard drive re-format.

After a few minutes of frantic searching, it appeared that my server had been replaced by a special rescue server that I was allowed to use to salvage whatever I could from the smoldering heap of its former self. That server, of course, had a special password that was sent to me on my e-mail address. All of you who guessed victor@nicollet.net, you get a cookie. All my attempts to have that password sent to another address failed miserably, until I finally gave up (because I have, you know, a Start-Up to start up).

It took about 12 hours for my hosting company to find out what happened, revert the changes and reboot my server. No data was lost (except for that e-mail that Steve Jobs sent me about our secret project together, which I guess I’ll never get), and everything works like a charm.



1170 feed subscribers
(readers who polled a feed this week)