13 November 2010

Where the Geek is when she's not blogging (in Egypt or on a Eurotrip)

Hi there. Yeah, I know it's been a long time, my apologies. Thing is, I've been alternately getting sick and travelling - I am now in a sick phase, hopefully the last one in a while. Since my sicknesses are not half as interesting as my travels, let me tell you about those.

The first one was a total Eurotrip. The deal was that a friend of Marcin is currently working at Cern and he invited us to stay with him for what turned out to be an entire week. We took him with us on one way plus his brother both ways. That trip included:

  • me crashing a Linux event in a Microsoft t-shirt (guys were staying, but hell knows if it was the t-shirt or the gender)
  • a night and a morning in Prague
  • visiting Bayreuth (but unfortunately not Bayreuth Festival Theatre because it had shorter opening hours than the student's office at my school)
  • me meeting some friends I hadn't seen in at least 12 years (my, have they grown!)
  • hanging at the Cern, especially at lunch time (which felt like being in a BBT episode, except they were many many more geeks - epic!)
  • hanging at an English pub and playing some trivia games (there was a Star Trek category!)
  • living maybe 50 meters from my middle school (ah, memories!)
  • me visiting the place I grew up in, which is the most beautiful place in the world to me
  • all of us visiting Geneva and Annecy
  • the guys going to Milan to grab a pizza after climbing on the Matterhorn
  • shopping
  • drinking french wine
  • losing a debit card and finding it soon after
  • crossing the french/swiss border at least four times a day
  • getting a flat tyre on the german highway.

All in all, that's more adventures than in Eurotrip. (Afterwards, I got scolded by my boss for taking all that overtime without asking him.) We're looking forward to organizing a similar trip next year.

Then I spent 3 days at home. These included working full time plus going to school on the evening (these were the first classes of the semester, so I didn't want to miss them). Consequently, cooking became microwaving and "taking everything out of the bags and dropping it on the floor" was the new unpacking.

Soon, we hit the road again, this time to a "real" summer vacation in the middle of October: we spent two weeks in Egypt. That trip included way less that the previous one:
  • bathing
  • sunbathing
  • a bit of sightseeing.
That holiday did us both lots of good and we enjoyed every minute of it.

Okay, now, for the pictures: I'm still trying to get the ones that weren't taken with my camera, so below are a few of my own, featuring absolutely no one.

That's the nice place where I grew up:


That's the previously mentioned middle school:


And here is a little piece of Egypt (Deir el-Bahari):



Now, I'm back to the life I love! I recently came across a quote by Seth Godin:

"Instead of wondering when your next vacation is, maybe you ought to set up a life you don’t need to escape from."

I definitely don't feel the need to escape from my life, but a vacation now and again is a great way to spend more time with loved ones and friends, get a fresh perspective on everything, load your batteries, etc. etc.

06 October 2010

The world is wrong about the Monty Hall problem

Today, at school, we considered the probability theory paradox called the Monty Hall problem:

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which he knows has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

The world says that by seeing that goat, you learn that the probability of the car being behind door number 2 is 2/3 and Wikipedia has various explanations.



I claim it's 1/2. My first argument is that there is full symmetry between doors 1 and 2. How could you lower the probability of door 1 being the winning one by picking it? Nonsense.

For my second argument, let's treat it like the conditional probability that it is. All probabilities will be from your, the contestant 's, point of view.

At the start, we've got 3 equally probable situations: I'll denote them as CGG, GCG and GGC hoping it's clear enough.

Now the host opens a door. You see the goat: you gain information. Probabilities change. The probability of the door number 3 being the winning one falls down to 0.

So far, no difference from the "official" solutions. However, those maintain that while the probability of the car being behind the first door stays the same, the probability of it being behind the second one increases. Why the incoherence?

An important remark here: with the new information, we now have new events. We know that GGC didn't happen, so we have 3 events that assume ~GGC, namely:
  1. if the first door wins, it's CGG | ~GGC and P(CGG | ~GGC) is 1/2
  2. if the second door wins, it's GCG | ~GGC and P(GCG | ~GGC) is 1/2
  3. if the third door wins, it's GGC | ~GGC and P(GGC | ~GGC) is 0,
the final results being basic conditional probability calculations.


According to Wikipedia, "even Nobel physicists systematically give the wrong answer, and that they insist on it, and they are ready to berate in print those who propose the right answer". That's comforting: I may be wrong, but at least I have excellent company.

[UPDATE] After reading all the comments, I can see that I was wrong. Boy, is that problem counterintuitive! Thanks everyone for contributing! [/UPDATE]

22 September 2010

5 reasons why I prefer cats over dogs

Below are 5 reasons why I prefer cats over dogs.

Reason #1:



Reason #2:



Reason #3:



Reason #4:



Reason #5:



[Picture credit, credit, credit, credit, credit.]

18 September 2010

Figuring out the right and wrong women's figures

When it comes to women's figures, the norms keep on changing. It however used to be simple: when sweets were a luxury, fat meant rich and thus was "in". Then it was thin's turn: thin people were the ones who could resist the temptation of tasty food - a kind of saint. That one has been taken too far, up to anorectic chick, and too many deaths later, something seems to be slightly changing. But how exactly?

If you're slightly too thin, there's always someone for you to ask whether you've got anorexia:


Yet, a model's silhouette is still this:


Can you see the difference?
(In reality, if an anorexic person is that skinny, it means that his or her illness has already gone very far and done severe damage. Read more about it on Psychology Today.)

If too thin is sick, what about the other way? There just was a plus-size show at New York Fashion Week:


Does that mean that extra weight is now socially acceptable? I'm not sure: Jessica Simpson has recently been heavily criticized for her weight gain, while she looks good and is far from being obese:


So what's right and what's wrong when it comes to a woman's figure? Go figure!

[Picture source, source, source, source.]

07 August 2010

Silverlight 4 with C# and Python (it's three!)

I recently felt like making a new Silverlight 4 app, but not just any app. I wanted it to have the following features:

  1. use an existing Python library
  2. be written in C#.
There is a way better way of using Python code - it is to write the app in Iron Python from the start. Picking C# to achieve that sounds like a bad decision.

However, I wanted to do something new and challenging, so I went for C#. Doing it on my own was hard, way harder than just following an "embedding Python in C#" tutorial. Finally, I found that working example and got something starting from there.

What I got is a three on a golden background:


Okay, maybe that's not the right angle to start with. What I did was used the numbthy Python library and used it's gcd function to compute the greatest common divisor of 15 and 3, and it's three!

Getting there was hard. Finding the right libraries to embed Python, importing them the right way were tough tasks for an inexperienced user - some error messages would be very cryptic. Then, the app would hang on the splash screen if something was wrong in the Python code, the debugger wouldn't show where the problem was, and the "problems" in the Python code were:
  1. the print statement
  2. a class inheriting from object.
Not obvious, and definitely not the kind of problems PyDev would warn you about. So I am afraid that importing bigger chunks of code could be hard - that is to be explored further.

05 August 2010

Yet another personal website

Thanks to my surgery, I recently had a bit of time to spend at home, so I built myself a new personal website. I spent a bit of time investigating the cool new features of HTML 5, CSS 3 and jQuery and ended up using a cool thing called jQuery Masonry, and here is the result:



This time, it's just a single page, because I can't really imagine what more I could share (besides the blog, of course). It's also only in English because... er... because.

Technically, I used some JavaScript not to do any copy-paste between the eight divs but ended up publishing a static html file with the end result.

Artistically, when I compare it to all the great designs featured on Smashing Magazine, I honestly think it sucks, but well, I'm more of a programmer than an artist. Plus, I put a lot of effort into editing it. Html is cheap and my mind has been to many many places, starting with Moroccan souks:


museums:


and texture factories:


All in all, I like it a lot, and I hope you do as well.

[Picture credit, credit, credit.]

26 July 2010

Geek gets surgery

A few days ago, I underwent my first surgery ever. The surgery itself wasn't as much of a big deal as the experience - I have wondered how it felt like since my childhood, when my little brother underwent one and I didn't. My curiosity finally got satisfied.

Wednesday, July 14th

I arrive at the hospital at noon. Waiting, paperwork, waiting, questions, waiting. Boring. They tell me not to eat to be ready the next day at 7h45 - I set my alarm clock to 7h30. I take a nap, then answer some e-mails, then go to bead early. Sleeping is something I'm actually really good at.

Thursday, July 15th

They wake me up at six and tell me to get ready now. I do. Then boredom comes back and I get back to sleep. (I guess there should be a part when I'm worried, but I'm really better at sleeping.) They wake me up just before eight. "Come on, it's time to go. (...) Okay, now the door on the right. No, on the right! But I can see you're smiling - that's the spirit!" When they lie me on the table, that's when I start to get nervous, but not for long: within a few minutes, I am asleep again.

I wake up to a doctor calling my name. Phew, I made it! Something is hurting me in the head. It must be the hair elastic I'm lying on. The algorithm to solve that problem is simple: lift head, move elastic, lay head back down. Ouch - lifting my head hurts. Oh yeah, they had to cut through my neck so now I can't really move it. I mange to pull the elastic away. Now what? Let's get back to sleep.

I wake up quite a few times that day and it's not pleasant. I miss Marcin, take a look at the clock and count the hours down to his visit on the following day. I want to drink - they give me a 9 ml bottle. I want to go to the bathroom. I want to cough. I want to lie on my side. I want to see Marcin. None of these are possible, but the deprivations are really bearable, as within a few minutes I am asleep again. I pass those minutes by observing all the IO interfaces I am connected to.

Friday, July 16th

I am back in my room at the hospital and am encouraged to start moving. I get to the promised land of the bathroom. I enjoy my position: no work obligations, no school ones, no social ones. I don't have to do anything. I can sleep all I want - and hell, I do! Visitors brighten my day, but I can't stay awake for the whole four hours when visits are allowed. As soon as they leave, I am asleep again.

Saturday, July 17th

Time to go! My stitches and all my IO interfaces get removed. I go to my Mom's for the week-end and spend most of the time - you guessed it - asleep.

Later on

I get two weeks of sick leave from work. So cool. So much time to sit at the computer, and, of course, so much time to sleep.

[Picture credit]

26 June 2010

I got my masters degree!

Two months after having my first defense and getting my bachelor degree in computer science, I am happy to announce I also got a master's degree in mathematics.

I now need to find a thesis subject in computer science, and besides that, I'm free for the summer!

05 June 2010

Rijndael S-box Sage implementation

It's no secret I like Python and Sage a lot. Today, I had the pleasure of working with Sage again: as a school assignment, I was required to show the calculations that prove that the value of the Rijndael S-box in row 2, column d, was indeed d8. While I am able to invert a polynome of this size by hand (let alone apply an affine transformation), I see no reason to do it, as a suitable tool is available.

So, here we go, the Rijndael S-box in Sage:

F.<y> = GF(2, name='y')[]
K.<x> = GF(2**8, name='x', modulus=y^8 + y^4 + y^3 + y + 1)

bin_digits = lambda h: [((int(str(h), 16))//(2^i)) % 2
for i in range(3, -1, -1)]
bin_poly = lambda n : sum([b * x^(3-i)
for i,b in enumerate(bin_digits(n))])

b1 = 2
b2 = 'd'

s = x^4 * bin_poly(b1) + bin_poly(b2)
p = (1/s).polynomial().coeffs()
p.reverse()

b = [0]*(8 - len(p)) + p
b.reverse()
c = [1,1,0,0,0,1,1,0]
d = [int((b[i] + b[(i + 4) % 8] + b[(i + 5) % 8] +
b[(i + 6) % 8] + b[(i + 7) % 8] + c[i]).n()) % 2
for
i in range(8)]
d.reverse()

s1 = sum([d[i] * 2^(3-i) for i in range(4)])
s2 = sum([d[i+4] * 2^(3-i) for i in range(4)])

print hex(s1), hex(s2)

I admit: the above is code, not calculations, but I did the calculations in class and worked hard on the code. My main problem was the bit order. Nowhere in the original publication did it say to reverse the bytes. Adding all the reverses was a moment of desperation, and imagine my surprise when it worked. I wonder how much credit that solution will get me.

A great Friday night it was.

03 June 2010

Xen virtual machines are the creepiest thing ever

Among the things that have always creeped people out are all kinds of ghosts and zombies, for one simple reason: since they are already dead, you can't kill them.

Along that line, here's what creeps me out: Xen virtual machines.


See what Wiki says about them:

Administrators can "live migrate" Xen virtual machines between physical hosts across a LAN without loss of availability. During this procedure, the LAN iteratively copies the memory of the virtual machine to the destination without stopping its execution. The process requires a stoppage of around 60–300 ms to perform final synchronization before the virtual machine begins executing at its final destination, providing an illusion of seamless migration.

Imagine that. On a traditional machine, if it was doing something you did not want it to do, you would slam the keyboard. On a VM, you'd kill the monitor. Then you'd pull the host's plug. Something would work. But here, as you try to kill the guest, it floats through the air to another host. There's no stopping it. There's nothing you can do but watch it do its evil.

Next, the robots revolt against us and it's Battlestar Galactica all over again. Brrr.