Monday, February 16, 2009

Bookmark and Share Monday, February 16, 2009 5:48:30 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [3]  
 Monday, February 02, 2009

Last night was Super Bowl 43. Alas, I am in a timezone that doesn't allow me to even care. But I love a good movie trailer, and a big bunch of them was released during the commercial breaks last night.

So here are four of them, in a biased order of ascending coolness:

1. G.I. Joe:



2. Terminator Salvation(sorry, no embed available)


3. Star Trek:



4. Transformers: Revenge of the Fallen(better quality here than in YouTube)

Bookmark and Share Monday, February 02, 2009 6:12:36 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [2]  
 Saturday, January 31, 2009

Update: this is the Google explanation (thanks Ofer).

While casually indulging in my favorite Saturday afternoon pass-time of Googling for... myself, I was rather surprised by the unusual results:



What? pashabitz.com may harm my computer? *My* computer? How? Wait. Every single result there seems to hold the power of hurting my computer. Do you have something against Pasha Bitz, Google? Or are you just trying to protect me from a severe case of Narcissism? And what happens when you do take the horrible risk and click the deadly link?



At my own risk?? Oh my. Will I be able to resist the temptation? Lets try something else:



Oh-ho. All of this is also extremely harmful for my precious innocent eyeballs and mind. What about Google itself?



Harmful again. Even Google itself! Reader, maps, google.co.uk. But wait, I am in Google right now. So how is this possible? Is it not self contradictory? Does it mean Godel was right? Is the universe about to collapse onto itself at this very moment? I was totally unprepared for this!


Luckily, I know some people working at Google. I examined the source code carefully and traced the problem to the following lines of code:


Bookmark and Share Sunday, February 01, 2009 12:22:24 AM (Jerusalem Standard Time, UTC+02:00)  #    Comments [2]  
 Tuesday, January 27, 2009

Left: Rembrandt, A Scholar, 1631, Oil on canvas.
Right: Me, picture by Aviel Lazar, 2009.

Bookmark and Share Tuesday, January 27, 2009 10:36:49 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [8]  
 Saturday, January 24, 2009

All I could think of for the first two minutes was...CSS! :)
Bookmark and Share Saturday, January 24, 2009 8:45:24 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [4]  
 Thursday, January 22, 2009

There are few reasons to have your code log extensive error/debug messages. One of them is to help with debugging issues on a remote (or worse, production) environment. Here are some tips to help you get the most out of this kind of logging:

Log Actual Values

With a well placed log message you will be able to easily pinpoint the line of code where the problem occurred. Now you're left staring at that line of code and trying to guess what caused the error. This will be so much easier if you include in the log message the actual run-time values that your code worked with. This includes stuff like the parameters to the method, fields of the class, session values etc.

Log at Component Boundaries

A component can be a different .net assembly, code that resides in a different logical layer of your application, a third-party library or a piece of code you communicate with using anything than just a method call (like HTTP or WCF). Wherever there's communication between two components, there are bound to be "wiring bugs". Because most components are well thought-out and tested on a standalone basis, it is very useful to know what data was exchanged to help with debugging the issue. Always log all parameter values, both on the client (caller) side and the server (called) side.

Log at Organization/Responsibility Boundaries

This is a slight variation on the previous suggestion. Whenever a call is made to a piece of code owned by another person or group, you should log all parameter values. When you walk across the hall to ask the owner of that code about the bug you're trying to fix, the first thing they'll ask you is what are the exact values you're sending in.

Bookmark and Share Thursday, January 22, 2009 10:58:45 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0]  
 Saturday, December 20, 2008

The good: Leonardo DiCaprio is "star power" defined. Holding the movie up in the air all by himself. Even though, a hint of one-sidedness is noticeable (Danny Archer from "Blood Diamond", Billy Costigan from "The Departed" and Roger Ferris from "Body of Lies" are all the same guy, really).

The bad: Alon Abutbul is the ultimate in Israeli terrorist-portraying technology.

Comic relief: Simon McBurney as the one-man-show homosexual secret black-ops branch of the CIA run out of the woods (the C-I-Gay).

The girl: Golshifteh Farahani as the mysteriously-beautiful-Persian is not mysteriously beautiful at all (but Persian nonetheless).

Believability: CIA agents shooting people on the streets of Amman are as low-key as a teenager playing GTA on crack.

Bottom line: Good flick. Well written, played and directed.

Bookmark and Share Saturday, December 20, 2008 7:54:20 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [1]  
 Friday, November 21, 2008

The FIFA ranking system is used to determine the seeding of national teams for various international competitions. It is considered absolutely broken by every football fan. For example, the Israeli national team is currently ranked 15th(1) in the world, while Sweden, for example, is only 29th. Enough said.

I decided to look into the method used by FIFA to determine the rankings, in order to understand why the system is so obviously broken and whether it can be fixed. To save you reading the detailed explanation in the Wikipedia article above, the method, in broad terms, goes like this:
1. For each game played by a given team, award the team a point amount using the formula:
Amount = [result points] X [match status] X [opposition strength] X [regional strength].
We'll look into the specifics soon.
2. Take then average of all the Amount values for all the games played by the team in the last year. This average is the score used to determine the rankings.
(In fact, the last four years are taken into account, but this isn't important to our discussion)

"Regional strength" doesn't have much effect relatively to the other factors, so lets ignore it.
"Result points" is 3 points for victory, 2 for victory in penalty shootout, 1 for draw or loss by penalty shootout and 0 for defeat.

So, where's the problem? The problem is the "match status" and "opposition strength" factors.

Opposition Strength

Here's how the opposition strength factor is calculated:
(200 - [opposition team ranking position]) / 100
(If the result is less than 0.5 - the value 0.5 is used)
The logic is this - there are about 200 teams in the ranking, so, when playing the best team, you'll get a strong bonus (200-1)/100=2. The bonus will be less and less significant the lower the opposing team is ranked, and starting at number 101, you'll actually be punished. For example for playing the 120th team the factor will be (200-120)/100=0.8.

The problem is that this formula ignores a simple but important truth: the best teams are much much stronger than all the rest. There are about 20 national sides that are consistently reaching the knockout stages of important international competitions and providing the star players to all the top clubs.
However, with FIFA's method, you will get a very high factor (of 1.6) for beating, for example, a team like Lithuania or Northern Ireland, ranked 41th and 42th respectively. These two teams aren't much better than South Africa (80th) or Austria (92th).
A quick fix that comes to mind is to take the square of the formula. This will "spread out" the factor a bit. You will get a factor of ( (200-10)/100 ) ^ 2 = 3.61 for playing the 10th ranked team, but only ( (200-50)/100 ^ 2 ) = 2.25 for playing the 50th ranked team.

Match Status

Match status is supposed to express the truth that a match that is played in an important competition like the World Cup is contested much more heavily than just a friendly game.
The way FIFA expresses this in the calculation is to assign a value of 1 to a friendly, 2.5 to a qualification match, 3 for a regional cup (like the Euro) and 4 to the World Cup. This value is used as a factor in the multiplication used to calculate the score for a specific match played by a team.
Lets assume that beating world champions Italy is worth 500 points. Then beating Italy in a Euro qualification match would be worth 1250 points and beating them in a friendly 500 points. So far so good.
But remember that to calculate the rating FIFA takes the average of the points assigned to the team in the last 12 months. So, for example, if a team plays 3 matches, beating Italy once in a Euro qualification match and twice in a friendly, this team's rating for the year will be:
(1250 + 500 + 500) / 3 = 750
However, if the same team beats Italy in two more friendlies in that year, the rating will go down to:
(1250 + 500 + 500 + 500 + 500) / 5 = 650
Effectively, the ranking system punishes you for victories in friendly games.

The correct way would be not using the match status in the points calculation for a single match but rather using it to calculate a weighted average. This way, in the previous example, the rating will not be hurt by beating one of the best teams in the world in a friendly:
(500 * 2.5 + 500 * 1 + 500 * 1 + 500 * 1 + 500 * 1) / (2.5 + 1 + 1 + 1 + 1) = 500
But also, an important match will have more influence on the overall rating. For example if a team plays 3 matches, with scores of 500, 700 and 700, when the latter two are friendlies and the former is a qualification match, the rating will be:
(500 * 2.5 + 700 * 1 + 700 * 1) / (2.5 + 1 + 1) = 588
Closer to the result in the important game than to the unimportant ones, as desired.

Unfortunately, I am sure the nice people at FIFA are wisely spending their attention on expensive women and liquor, instead of on silly math.

Bookmark and Share Saturday, November 22, 2008 12:55:06 AM (Jerusalem Standard Time, UTC+02:00)  #    Comments [3]  



Infectious, the car-art start up company, now has also laptop art which is insanely cool. I just wish it didn't cost 50 bucks to ship to Israel :(

Bookmark and Share Friday, November 21, 2008 10:48:51 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [2]  



The new Guns N' Roses album, "Chinese Democracy", which was in work for 15 years, is finally up on MySpace.

Yeeeeees!!!

Bookmark and Share Friday, November 21, 2008 10:38:54 PM (Jerusalem Standard Time, UTC+02:00)  #    Comments [0]