2006-06-10 19:41

Poland-Ecuador-England-Paraguay-Sweden-T&T-IvoryCoast-Argentina

Poland is... enough about Poland.

Ecuador played ok, they tried to stay simple, do their thing, make the other team beat them. Which Poland had no interest in, so Ecuador scored a couple of goals just in case, and hey, they won! Poland is perhaps the worse team so far, and that includes Trinidad and Tobago. And Costa Rica.

England, I have heard, are slow starters. I hope for their sake that's the case. Ashley Cole has a serious case of believing he is way more skilled than he needs to be ( I thought Rio Ferdinand was the one with that problem?) And anyway, Paraguay started weak, and had huge trouble attacking. So, good win for England, hopefully Paraguay was just nervous. Gamarra is a really unlucky guy.

Sweden... what a frustrating match. T&T was playing on guts alone, their best forward played as a defensive midfielder, and still they had the clearest shot at goal, out of a pass by the goalkeeper! Sweden was just incredibly unlucky, or their forwards were blindfolded.

Ivory Coast is a pretty good attacking team. They are a below average defense, though, which explains why Argentina scored twice on three chances, and the other one was saved 90% behind the goal.

Saviola played well, Riquelme didn't. The defense... they played waaaay back, and Abbondanzieri simply gave away every ball he touched with a long kick to an ivorian.

But hey, it's a win... no obvious trouble... need to play with some confidence... ok, we suck a little. But it can get better.

Palacio for some reason couldn't stand up in the field, was falling whenever he tried to run.

But I think everyone agrees: the Ivory Coast is a scary team. They are skilled, they are athletic, they are not too badly organized... they can be a chore for any team.

So far, of the "good" teams... none has looked very good. No candidates to win yet, IMVHO.

2006-06-09 14:48

The mathematics of offside

I will start by assuming the following:

  1. Everyone understands the offside rule.
  2. Everyone saw the first Costa Rica goal in today's Costa Rica - Germany match

One basic rule of economics is that people, all things being equal, will rationally choose the course of action that gives the greatest reward.

Knowing that, why do teams, even teams in the highest levels of competition, insist on such plays as Germany attempted?

The idea, obviously, is that the defenders play in a line, and move forward a fraction of a second before the attacking forward starts the pass, thus leaving the receiver of the pass in offside. You do that, you get the ball. Simple.

The bad news are, of course, that such plays work about 50% of the time. If that.

It requires the defenders to move forward in the exact same fraction of a second. If one stays late: it doesn't work.

It requires them to synchronize that way by an audible call, because it's very hard for them to see their whole line: they are stading sideways almost every time.

If the passer is smart, he will simply avoid the pass and run a diagonal.

It the receiver is smart, he will fall back, avoiding offside, and rely on a teammate to sprint for the pass.

And all these problems can happen every time the play is attempted.

The risk is huge. In fact, nowadays, in order to lure the attacking team into this trap, you need to play it with all your 4 defenders! Each extra defender probably doubles the chance of error.

And what do you avoid? ...a low probability long pass. Remember, in football, every attack is low probability. A penalty is only about 80%!

So, the german coach is incompetent. He may do some things well, but Germany's defense is atrocious. They will not win the cup.

2006-06-09 11:32

The world cup and I

Today is the first day of the world cup. While I fully expect the verbe and savoir faire of Paulo Wanchope to whip those german animatronic figures into submission [1] I started thinking...

The first cup I remember is Argentina 1978. Which, of course, we won. Thanks maybe to a shady grain shipment to Peru, maybe because Cruyff refused to come to the country, maybe because we had the world's strongest guy playing [2], maybe because the host nation had won like 60% of the time so far, but we did win.

I saw Argentina-Hungary in a movie theater with the screen decorated as a huge TV one day after it was played. Since we lived under a bloody dictatorship, everyone had to standup while we saw the taped anthem-singing, and there was a sort of desperate mandatory patriotism. But anyway, I was 7, it was fun.

Then came Spain 82. I was in school during most matches, so I didn't actually see almost any of them. We had a rather nice team, with Maradona and Ramon Diaz, but we met Brazil, which had a marvelous team. Then the final was the average versus the depressing, and the depressing won. Italy won with goals by an actual, proven game-fixer. And somehow noone remembers that.

Mexico 86. The first cup where I saw every damn match. And of course, one of the most memorable cups ever, since, again, we won. And we had the best player in the cup by some margin.

Of course, not everything could be flawless, and a deeply mediocre english team feels that they would have won except for the "Hand of God" goal. Well, here's the thing. If the english had won, it would have been injustice of such a mind-bending size, armageddon would have happened right there, 21 years too early.

Not to mention that the bitter dudes simply can't enjoy being beaten by the second goal [3].

Sure, we had to play only England, Belgium and Boxcar Willy [4] but then again, we have been on the "Group of Death" for 8 years in a row.

When you play in a park or schoolground, if there is a player that's incredibly good (or everyone else is incredibly bad) we say "with that gay, it's stealing". Well, in 86, with that guy, it was freaking armed robbery.

Italy 90. I have high blood pressure. I blame Italy 90. We started by being the first champion ever to lose the opening match, against Cameroon, because we didn't play Caniggia until minute 70. In the following ten minutes, two Cameroon [5] players got redcarded. If he had played from the start, we would have won by default because Cameroon would have ended with 5 players on the field.

Maradona had his left ankle the size of a grapefruit, and the color of Merlot. He could barely walk.

Our goalie was injured in the most gruesome accident I ever saw in a football field. On the slow motion reply you can see his leg turn into a Z in a very wrong way.

Then we played Russia where Maradona committed a clear penalty and wasn't called [6]

We seemed to advance in every round by penalties, and were pretty much unable to score at all.

In the match against Brazil, we were so overmatched it was kinda funny. And then we had two chances. One went in, the other hit the crossbar. Brazil had about 400 shots on goal, and we had the luckiest guy on earth on goal, so...

We played Italy. We had one chance to score. It went in. They tied.

We won on penalties, thanks to the most incompetent penalty kicker I ever saw [7]. Serena, wherever you are, if you ever need a drink, I'll buy you one, round-footed-wonder!

The finals. We were without the only guy that could score in the team. Without our best defender. Our best player was so bandaged he couldn't use shinguards. Everyone was way too old. Batista was playing like Boris Karloff's Frankenstein. We had ran out of players, out of ideas, out of time.

And we lost. Because of a penalty. Which was not a penalty (see the replays, really).

There have only been two players ejected on a cup final ever. Guess who they were?

But you know what? The guys played like god damn lions. If you are great, then you are supposed to win. We were not great. We were not even average. That team was a lot of senior citizens, one fast guy, a crippled wonder and duct tape. And they got to the finals. It was as if a smart, poor fat guy with acne and bad breath picks up Nicole Kidman, but doesn't get to have sex with her. He is still to be admired.

Then came the real heartbreak. USA 94. That cup never happened. I refuse to think about it.

France 98... so so. We got to quarter finals, which was about right. We could have gone further, but Ortega is the dumbest player in the universe, and he decided to headbutt a dutch in front of the referee.

Japan-Korea 2002. We were favourites. We were the best thing since sliced bread. Our coach was a mad genius. A tortured soul. We had the last chance to play one of the most implacable scorers of all time. We had a dazzling midfield. A solid defense. We had beaten Brazil in Maracana a little earlier. We were kickass.

We had a hard group. It was tight. We lost a close match to England. We had to play Sweden and we had to win. But we didn't.

I was living in Buenos Aires and didn't have a TV, so I had to go to bars to see the matches. Argentina-Sweden was played at some ungodly hour, like 3AM, and I went downtown to see it.

Of course, we were one goal short. And we were out of the cup. I had never seen Argentina fail to exit the group stage. And I was at 5AM in the street, in mid-winter, feeling really, really, really bad. Which means that of the last three cups, two have been horrible, one half-decent.

Since Maradona retired, that's our harvest. This time... this time we had a decent team, coached by a nice guy. We have a proabable superstar, but he's too young and a little injured. We have a terrible goalie, an aging defense, a lot of above average forwards... I say semis, or quarters. If we get any further, it will be in the Italy way, not the Mexico way.

But dammit, I will be watching.

[1] Yeah right.
[2] You can see Kempes dragging no less than three rather large dutch people hanging from his shirt. And he didn't even slow down.
[3] I actually prefer Maradona's Belgium goal.
[4] Our side of the draw were all bums.
[5] Everyone remembers this Argentina team as thugs. Cameroon was about 10 times as rough, and noone remembers because they were the feel good story of the cup, with Milla being 56 years old or something. But if you attacked them, you ended barefooted, flipping in the air.
[6] God plays defense, too.
[7] Except Palermo, who missed three (3) penalties in the same match. Then again, he actually kicked two of them decently.

2006-06-07 11:41

Eating like a Python, for Python, and other stuff

I am now almost recovered from the trip to Santa Fe for the Jornada Python and I have reached a few conclussions.

  1. I do kinda miss my old city.
  2. It does take slightly longer than 15 minutes to show it ;-)
  3. This kind of events is cool
  4. I am old, and can no longer take a 6-hour bus ride and then go to work.

On more detail:

The city is much prettier than it was when I left 5 years ago. Lots of construction going on, everything is cleaner, nicer, and more organized, it seems.

Man, I had forgotten how great you can eat there. And how cheaply. Remember I mentioned that fish-eating place? Well, it's only $22. That's pesos. So, it's about 7 dollars for all the delicious fish you can eat, and all the cold beer you can drink.

Which in my case is quite a lot. Although I am getting slow on the beer, too.

The only bad thing about it is that the guys that went on Sunday got Pacú and we didn't. Dammit!

Then there is the Sociedad Alemana. The ugliest place ever. The best picada [1] ever. It's a clubhouse founded by a former Graf Spee crewman. If they eat like that on the german navy, I would consider joining. And I get seasick.

Oh, and the lebanese restaurant. I was forgetting that.

Of course all this eating and imbibing also meant I missed half the event, but the morning conferences were introductory, so I got the good bits anyway.

Specially: I now understand metaclasses! and decorators! Yipee!

We had a good time with Rosario, she got to know better some of my friends, specially Javier and César [aka Ned Flanders] (and Cesar's family, Norma, Florencia and Julian).

We took a ride over the costanera (a riverwalk), peppered with comments like this (all dates are wrong):

Here was the Piedras Blancas beach, until the flood of 87.

That's where the old train bridge was until the flood of 69, then there was a liftchair, until the flood of 82.

That suspension bridge is not the original, which was washed off in 83 (and then stolen)

This piece of the costanera is new, the old one was gone in 78

And so on. You see, this place is... kinda floody. Architecture is not a permanent thing.

On yet another angle, I am going back to school next year. I don't intend to finish my Maths degree, but will go for System Engineering instead. We'll see what happens.

[1] We had the german style picada. That means plates of potato salad, smoked ham, three different sausages, leverwurst, pickles, three cheeses, and a sausage cazuela. The classic Santa Fe style picada may include any of those plus meatballs, milanesa (schnitzel-like thing), chips, olives, lupines (a kind of pickled bean), small sandwiches, and a hundred other things. All that in small pieces, ready to eat with fingers and/or toothpicks. All salty. So you get extra beer.

2006-05-27 17:22

A question for KDE devs...

... if I want to store a password in kdewallet, from a non-kde app, how can I do it?

It would be better if there was a client API I could link to that didn't involve kdelibs, or at least a DCOP interface.

This is nice technology, I want to use it.

2006-05-23 19:28

A silly entry

Today's entry has no pieces of neat python code, no questions, no critic of anything, no interesting link, no hint of anything I wrote/(would/will)write, no funny piece, no unfunny piece, no nothing.

I am tired today.

So, have a nice day :-)

2006-05-22 01:09

The Da Vinci Code is Broken.

I saw The Da Vinci Code saturday night. This has spoilers. So don't read it if that bothers you, ok?

I can now post and noone can complain about how I had not read the book. Although of course, I haven't. But this is about the movie.

First, I want to say that I must correct my previous comments, caused by reading a synopsis of the book in Dan Brown's site.

I must say (assuming the movie follows the book) that it doesn't paint Opus Dei as a clandestine sect at all (not even as specially interested in obtaining any secret). Only one specific couple of Opus Dei guys are. Which is fine and dandy for me. Secret societys can chase each other around the globe. Their problem.

Of course it also means the following ( again, if the book is like the movie ):

  • The comments defending the book's portrait of Opus Dei as a secret society as appropiate fiction are nonsense, because the book doesn't do that. You were defending the book of something that's not in the book.
  • The guy that wrote the synopsis in Dan Brown's official site has not read the book.

Having said that, onto more serious matters...

Ron Howard is incapable of filming a comprehensible action scene. Don't trust me? Watch the Smartcar chase.

Tom Hank's hair is scary. It's a weird bilateral combover. I used to do that. I don't anymore. I am right about stopping. Besides, it's way too distracting.

//ralsina.me/static/calculin.jpg

Professor Langdon, I presume?

I enjoyed the movie as a popcorn flick with pretentions, but most of the plot follows no logic.

Sauniére triggers an alarm, in the Louvre, and is then shot in the stomach. Then he traipses around the museum, finds a marker visible only on UV light, does things to three paintings, hides a key behind a large, heavy painting, takes off his clothes, creates an anagram, writes it on the floor along with some numbers, draws a pentacle on his chest, arranges himself in a position reminiscent of the Vitrubian man, and then dies.

He not only does all that instead of calling an ambulance on his cell, but he does all that before museum security gets there. In the gallery that has the Da Vincis.

Not only is it unlikely, but it also is stupid. Had he died earlier, he could, for instance, have been found with the key in his hand, and no clue left for the "good guys".

It's amazing there is still any paintings in that museum, with such security.

And don't get me started on the biiiiig secret. It turns out the Priory of Sion protects a secret about Jesus.

If said secret was revealed, it would damage the catholic church.

Of course... the catholic church also knows the nature (and details) of the secret, which means the catholic hierarchs dedicate their lifes to a faith they know to be false. Which makes no sense, really.

And then it turns out that several historians also know the nature and details of the secret, and have published books about it (except, of course, they have no evidence).

LAST WARNING, HUGE SPOILER HERE

REALLY

There is, however, one detail only the Priory is supposed to know: the location of a corpse that could be used, via DNA analysis, to show that some person is a descendant of some specific other "historical figure".

Which is, of course, absolute nonsense.

Suppose I show you a corpse and tell you "this is the corpse of Joan of Arc". You carbon-14 date it, and do the usual forensic analysis, and all agrees. It's a woman, that died in a fire, at such age in so-and-so year.

Then I show you a DNA analysis that shows she is my great-great-granny.

Am I the scion of the Orleans Maiden?

Hell no! Because to accept that, you would have to accept that the corpse is hers!

You can only reasonably do that if there is a clear historical record of the whereabouts of the corpse until now, or else it's a rather simple forgery.

For example, nowadays we used DNA of known descendents of Columbus to decide which of his two alleged bodies is the real one. About a known historical figure, world-famous in his life. We are just not sure of where his corpse is. We have two of those.

Since the "witnesses" of the authenticity of this corpse are the ones that are bound to gain from the claims, it's suspect at best.

If you go back a certain number of generations, almost every corpse will be your granny.

I am pretty sure that a large percentage of modern europeans are related to almost any random 2000 year-old corpse.

And, in the specific case of the movie (or the book), even if you assume it is the corpse of who they say, so what? That shows she is the descendant of a certain woman, not of a specific man. Get it? You don't prove the big premise. Only the little, meaningless premise, that M.M. (not Marilyn Monroe) had a child. Who gives a damn?

The secret the Church is trying to keep secret, the secret the Priory is not trying to make public anyway... doesn't matter. It doesn't cause what the church fears, it doesn't cause what the Priory hopes, it does nothing.

So, really... much ado about very little. If I were the church, I would let them say whatever they want, and nothing would happen. Absolutely nothing.

Not to mention that the apocryphal Leonardian device, the cryptex... it's ... I have no words. If you missed it, the idea is that there is a papyrus inside it, and a vial of vinegar. If you try to open it without the key, the vinegar "dissolves the papyrus".

Do you know what papyrus is? It's made of the stems of a plant, and it looks a lot like paper.

It's cellulose. It doesn't dissolve in vinegar. It's like saying lettuce dissolves on vinegar.

You can make a paper that dissolves on vinegar, but papyrus is not paper.

It may make some sense if you said the ink used dissolves on vinegar, but it's not what they said. What they said is stupid.

So, it defies reason how so many people can enjoy a book based on a premise innocent of logic, about a conspiracy to protect nothing.

2006-05-20 13:00

Python-v4l: neat!

Thinking about CherryTV and ways to turn it into a real application, I thought the worse piece of it was the reliance on v4lctl, and how really you just don't know if it works or not, and how you can't finetune, and whatever, and run into Python-v4l.

It has remained apparently untouched by two years, but I managed to build it with one edit and to make it work by switching a line to an alternate version (they are both there), and it's nice.

Here's the example TV viewing application using it:

#!/usr/bin/env python
# Sample TV viewing application for pyv4l >= 0.3 - by Michael Dove
#<[email protected]>
# Note: this does the imaging in grab mode. Performance is limited.
# I average 35 fps @ 320x240. Disabling the writes to the tk window yeilds 90+ fps.

import v4l
import Image
import ImageChops
WIDTH = 320
HEIGHT = 240
vid = v4l.video('/dev/video')
cap = vid.getCapabilities()
print "Device Name: %s" % cap[0]
print "Type: %d" % cap[1]
print "Channels: %d" % cap[2]
print "Audios: %d" % cap[3]
print "Maximum Width: %d" % cap[4]
print "Maximum Height: %d" % cap[5]
print "Minimum Width: %d" % cap[6]
print "Minimum Height: %d" % cap[7]
vid.setupImage(WIDTH, HEIGHT, v4l.VIDEO_PALETTE_YUYV)
print vid.getChannel(0) # TV
vid.setChannel(0) # set to TV
vid.setFrequency(216250)

import Tkinter
tk=Tkinter.Tk()
import ImageTk
photo = ImageTk.PhotoImage("RGB",(WIDTH,HEIGHT))
label= Tkinter.Label(tk,text="mini TV",image=photo,width=WIDTH,height=HEIGHT)
label.pack()

vid.preQueueFrames()
nextFrame = 0;
vid.setVolume(5)
vid.mute()

try:
    while 1:
        output = vid.getImage(nextFrame)
        im = Image.fromstring("RGB", (WIDTH, HEIGHT), output)
        # update Tk label
        photo.paste(im)
        tk.update()
        nextFrame = vid.queueFrame()

except Tkinter.TclError:
    print "something"
    pass
vid.mute()

If you have seen the equivalent C app... well... nice job here!

2006-05-19 10:45

Great radio show, for free.

It really hurts my productivity, because I can't understand a radio show in english and code at the same time (although I manage to pretend to chew gum and walk), but hey... it's Penn Jillette, and I love the guy.

You can listen to his show for free here: http://penn.freefm.com/

Have fun!

2006-05-17 08:29

Flickr Banners

If you are one of the three persons who actually see this blog on its site instead of reading it through some sort of aggregator, you may have noticed I have a banner.

This is what it looks like:

//ralsina.me/lateral/lateral.jpg//ralsina.me/lateral/opinion.jpg

Nice, ah?

It's not very original (look for "spell with flickr" to see where I stole the idea), but I wrote a script to do it. So here it is, feel free to steal it too, it's your turn.

You will need this, ImageMagick, and a Flickr API key.

To use it simply call it like this:

python banner.py something

And you will have a something.jpg with something in it.

#!/usr/bin/env python

import flickr,sys,random
from urllib import urlopen
import os

g=flickr.Group(id="[email protected]")

urls = []
for l in sys.argv[1]:
  if l=="a":
    l="aa"
  if l=="i":
    l="ii"
  photos = g.getPhotos(tags=[l], per_page=50)
  urls.append(photos[random.randrange(50)].getURL(
              size='Square', urlType='source'))


for i in range(0,len(urls)):
  f=open(str(i)+'.jpg','w')
  data=urlopen(urls[i]).read()
  f.write(data)
  f.close()

os.system ("montage -tile %dx1 -geometry +0+0 %s %s"%(
            len(urls),' '.join([ '%d.jpg'%x for x in range(0,
            len(urls)) ]), sys.argv[1]+'.jpg'))

Contents © 2000-2019 Roberto Alsina