Drawing Blanks

Premature Optimization is a Prerequisite for Success

Closest neighbors

leave a comment »

A simple but curious statement:

In any finite set of points on the plane, there are points that have less than 4 closest neighbors.

Not sure if this is a deep or useful observation.

Not sure if I have a rigorous proof. I’ll publish a sketch of a proof later.

And here is how you prove it:


Read the rest of this entry »


Written by bbzippo

07/02/2012 at 3:27 am

Posted in math

Microsoft promoting anti-patterns

leave a comment »

Found this today in production code that I needed to modify:

… = ((TextBox)(row.Cells[1].Controls[0])).Text;
… = ((TextBox)(row.Cells[2].Controls[0])).Text;
… = ((CheckBox)(row.Cells[3].Controls[0])).Checked;

This was in a GridView.RowUpdating handler, and the change that I needed to make was adding a couple of columns to that grid.

Of course, I refactored the code in that page, and, of course, I found that all pages in the project are copy-paste-contaminated by that terrible pattern.

I did some lurking on google for grid view “best practices” and found something that is likely the origin of the infection:


Written by bbzippo

06/08/2012 at 4:53 am

Posted in Uncategorized

Xworder Mobile is out

leave a comment »

If you want convenient access to Xworder’s features from your smartphone, check out Xworder Mobile.

Written by bbzippo

05/30/2012 at 1:54 am

Posted in Uncategorized

Russian elections: 2011 vs 2012

leave a comment »

I managed to merge the 2011 and 2012 election data and I can now look at all changes that happened at precinct level.

As we saw here https://bbzippo.wordpress.com/2012/03/27/russian-presidential-election-2012, turnout increased, and the leader support increased even more.

What’s the relationship between the change in turnout and the change in leader support? Following Steven Coleman, we can use a nice additive measure – entropy – to compare those.

Below, on the horizontal axis is the change in turnout entropy. On the vertical axis is the change in choice entropy normalized to the number of candidates. The straight line is a regression with zero intercept (which is Coleman’s theoretical prediction, if I’m interpreting his theory correctly). The other line is the actual relationship (mean choice entropy vs. turnout entropy in 50 bins):


Even though overall the change in choice follows the change in turnout as predicted, there is a very significant drop in the entropy of choice in the central region of the graph where the majority of precincts are located.

That indicates that in 2012 (presidential) elections the opposition was much weaker that in 2011 (parliamentary).

Let’s see in more detail, where the additional votes for the leader came from.

Below, on the horizontal axis is the change in turnout percent, and on the vertical – the change in the votes for the leader as a share of all registered voters. Note that this measure is different from the votes as a share of all cast ballots. I use the former because unlike the latter it behaves linearly when we add ballots for one candidate. The color indicates the level of support for the leader in 2011.


The most dense cluster here lies in the north-north-east sector of the graph. Those are precincts that showed low support for the leader in 2011, but in 2012 increased turnout and leader support. And the majority of points being located above the diagonal, means that the increased leader support cannot be fully explained by the increase in turnout – some people who had voted for the opposition in 2011 must have voted for the leader in 2012.

The opposite cluster shows that the situation with the precincts who strongly supported the leader in 2011 is fully symmetric: turnout dropped and the leader support dropped even more. This may be interpreted as a decrease in fraud.

And the right side of the graph being almost empty below the diagonal, means that the opposition did not attract many new voters.

Below are pictures broken down by the 3 categories of precincts: ethic outskirts, smaller precincts (presumably countryside) and larger precincts (presumably cities). They have no qualitative differences:

Read the rest of this entry »

Written by bbzippo

04/22/2012 at 11:26 pm

Posted in Uncategorized

Tagged with

The real meaning of MPH: in defense of blondes

leave a comment »




For some reason, I’m under impression that the blonde lady intuitively understands that in order to answer the question, you need to know the average speed, and not just the speedometer reading. So she keeps bringing up "mile a minute" and "it usually takes me about…".

And the guy attempts to solve the practical problem under the assumption of constant speed, without stating that he is making that assumption (and I believe, without even thinking about that).

The girl accuses him of guesstimating, and he in reply claims “that’s math and science”.

The girl also offers to time their trip, and the guy just laughs.

I am on the girl’s side. Even though the guy remembers something from middle school, the girl’s intuition is much closer to science than the guy’s math.

And “MILE PER HOUR” is an anagram of “I REPEL HUMOR”.

Written by bbzippo

04/05/2012 at 1:59 am

Posted in Uncategorized

Russian presidential election 2012

leave a comment »

A quick comparison of 2012 presidential election vs. 2011 parliamentary election (see https://bbzippo.wordpress.com/tag/russian-elections/). I’m just trying out some new (to me) graphing techniques.

Precinct size vs. Turnout

2011 (parliamentary) on the left, 2012 (presidential) on the right. We can see the same 3 distinct categories: ethnic outskirts, smaller precincts (suburbs) and larger precincts (cities). Obviously, more people turn out to vote for president than for parliament seats, especially in cities. (The line is the median smoothing).


Distribution by turnout in each category


Leader support in each category

Read the rest of this entry »

Written by bbzippo

03/27/2012 at 3:02 am

Posted in Uncategorized

Tagged with

OPERA Neutrino update

leave a comment »

Written by bbzippo

02/23/2012 at 4:55 pm

Posted in Uncategorized