Wednesday, April 25, 2012

How to present to an executive

Good article by Gray Knowlton, hope it will come in useful some day.

Tuesday, April 24, 2012

Three excellent articles about the state of IT

Frighteningly Ambitious Startup Ideas (Paul Graham)

The Jig Is Up: Time to Get Past Facebook and Invent a New Future (The Atlantic)

This Tech Bubble Is Different (Bloomberg Business Week)

Choice quote: "The best minds of my generation are thinking about how to make people click ads," [Hammerbacher] says. "That sucks."

Friday, January 20, 2012

Russian programmers

Russian programmers got a nice plug over at Marginal Revolution in the comment section:
My experience with Russians are that they are the best hackers. They trust themselves, they are self-contained and they work with meager resources and really sweat the details. I’ve worked with a few and I would love for all of my code to be eyeballed by a Russian programmer who’d make it work in less memory. I like the fatalism built into Russian engineering, makes stuff robust.
Being one, I heartily concur. Thanks!

Sunday, July 3, 2011

LINQ Expressions and Reflection.Emit: an uncomfortable union

The other day I needed a component for a project of mine, which would rewrite methods into state machines like the CTP C# compiler does for async methods. The rewriter would accept a callback to identify the sites where a continuation must be created, and another one to emit glue code for the site using two primitives: SAVE_STATE() which returns the continuation delegate and RESTORE_STATE() which returns the value passed to the continuation. This approach permits the users of the rewriter to avoid the overhead of saving and restoring state when the continuation turns out to be unnecessary (in async terms, when the awaited thing is already complete). The new CTP compiler implements this optimization. My component would eventually have to work with IL methods either via Reflection.Emit or Cecil, but I thought it would be interesting to make it work with LINQ Expressions first. Besides, the DLR has a similar rewriter for yield which I could scavenge for useful hints. The DLR rewriter uses a nested lambda to create the 'environment', shifting the work to the LINQ Expression compiler (EC). Probably because of permission issues, EC does not create new closure classes and instead uses a thinly veiled object[] to store closure locals. I did not want this, I wanted to generate a proper closure class. After all, EC can compile a lambda expression into a MethodBuilder!

Although I more-or-less made it work, I must report that LINQ Expressions don't work all that well with Reflection.Emit:

  1. A LambdaExpression cannot have parameters of unbaked type. EC appears to have no problems with this, but Expression.CreateLambda uses generic lambda factories and an unbaked type cannot serve as a type argument. One must have the lambda accept a suitable base class or object.

  2. It is impossible to generate a call to any method which has not been 'baked' because LINQ Expression constructors insist on validating a method's parameters and call MethodBase.GetParameters(). This extends to object construction as Expression.New validates constructor parameters. These two problems are very obnoxious and make any serious use of LINQ Expressions with Reflection.Emit impossible.

    As a side note, I find it puzzling and inconvenient that MethodBuilder does not expose its parameter list.

  3. EC has no problems emitting constants referring to a TypeBuilder or a MethodBuilder, but one must tell Expression.Constant the correct types, viz. Type and MethodInfo. Otherwise EC happily emits casts to TypeBuilder which blow up at runtime. Just a minor gotcha, but still.

  4. There is no DelegateCreationExpression. This is strictly speaking not related to Reflection.Emit, but it is annoying to have to generate a call to CreateDelegate, complete with casts and stuff, instead of a ldftn-new combo.

  5. EC cannot compile lambda expressions into member methods even if the method signature is compatible. The target method has to be static, period.

This was a useful excercise and working directly with IL should not be much more complicated.

Wednesday, March 16, 2011

Bakunin fulminates

"Etatism and anarchy" (1873)
Let us respect [social] scientists for their achievements, but for the sake of their reason and moral integrity we must not give them any privileges and only recognize their right, common to all, to freely preach their convictions, thoughts and knowledge. We should give power neither to them nor to anybody else, for whoever has power becomes, by an immutable law of sociology, an oppressor and exploiter of the society.
Woe unto mankind should theoretical speculation become the only source of guidance for society, should science alone take charge of all social administration. Life would wither, and human society would turn into a voiceless and servile herd. The domination of life by science can have no other result than the brutalization of mankind.

Thursday, March 10, 2011

February link clearance


 A white female LHC engineer bemoans the lack of black PhDs in physics in a rather over-the-top way — 'threatens the viability of scientific research'? Give me a break. But the statistic cannot be simply brushed aside. With all the Affirmative Action programs, powerful Equal Opportunities commissions etc. everyone who wants to go for a PhD in physics should have the opportunity, so what's up? Could it be that they just don't want it? Scientific research is boring much of the time, needs hard work and a particular mindset*, and it does not pay any too well in either money or status, so why should they? Especially given all the Xyz Studies departments. Check out White Studies, by the way.

 BBC article about robot carers in Japan contains very condescending remarks aimed at Japan's anti-immigration policy. It appears that many Anglophone Brahmins resent Japan for getting along tolerably well without mass immigration and want it to open up (this is noticeable even in Lonely Planet Japan), while condescension towards Japan is a regular feature of both articles and comments; sometimes these produce poisonous outbursts which then get moderated. Comment section to the above-mentioned article contains interesting discussion of job markets etc.


 Average female faces by country/region. Source: The Postnational Monitor. Also great mod text.

 Mark Thoma's lectures on economics theory, econometrics etc.

 Problems with bank executives' incentive structures — the breakdown in corporate governance [...] is complete.

 E. M. Forster's 1909 (!) short story "The Machine Stops" — much of the internet bears an uncanny resemblance to the story's tele-lecturers, who spend lives 'growing spiritually' by exchanging tenth-hand regurgitated information.

 It is more efficient to read books pursuing some idea than expecting to get ideas, even if your original idea turns out to be worthless later it serves as a scaffold for acquired knowledge. Very good!

 A very large epidemiological study of a 1946 British cohort.

 The Enron Corpus — 600000 emails generated by 158 Enron employees, went public during the Enron trial. Used to train systems for e-discovery, communication analysis etc.

 Journal of Macroeconomics article on economic growth in the Gilded Age US got cowened.

 Predictions on how Germans can't fix Eurozone's financial troubles — very realistic thinking and understanding of how European financial sector really works.

 The Onion makes fun of Tyler Cowen's call for more status for scientists.

 Excellent article about MMORPG design — class system, levels, balancing etc.

 People who have trouble focusing attention may be more creative, especially those who have high IQ.