Wednesday, August 31, 2011

LHC results put supersymmetry theory 'on the spot' (link)

Results from the Large Hadron Collider (LHC) have all but killed the simplest version of an enticing theory of sub-atomic physics.

Researchers failed to find evidence of so-called "supersymmetric" particles, which many physicists had hoped would plug holes in the current theory.

Read full article...

Tuesday, August 30, 2011

Experiments Show Gravity Is Not an Emergent Phenomenon (link)

One of the most exciting ideas in modern physics is that gravity is not a traditional force, like electromagnetic or nuclear forces. Instead, it is an emergent phenomenon that merely looks like a traditional force.

Read full article here...

Monday, August 29, 2011

Regular expressions in lexing and parsing (link)

I should say something about regular expressions in lexing and
parsing. Regular expressions are hard to write, hard to write well,
and can be expensive relative to other technologies. (Even when they
are implemented correctly in N*M time, they have significant
overheads, especially if they must capture the output.)

Read full article...

Monday, August 22, 2011

Commentary on the Sixth Edition UNIX Operating System (link)

This directory contains a copy of John Lion's “A commentary on the Sixth Edition UNIX Operating System”. This form of the document was published on the USENET alt.folklore.computers newsgroup in May 1994.

Link to page...

Saturday, August 20, 2011

What is intelligence, anyway? By Isaac Asimov (link)

When I was in the army, I received the kind of aptitude test that all soldiers took and, against a normal of 100, scored 160. No one at the base had ever seen a figure like that, and for two hours they made a big fuss over me.

Read full story here...

Friday, August 19, 2011

A bit of Go language: type switch

Not a long time ago I discovered very useful Go language construct “type switch”.

switch t := someValue.(type) {
    fmt.Printf("unexpected type %T", t)
case bool:
    fmt.Printf("boolean %t\n", t)
case int:
    fmt.Printf("integer %d\n", t)
case *bool:
    fmt.Printf("pointer to boolean %t\n", *t)
case *int:
    fmt.Printf("pointer to integer %d\n", *t)

Description in Effective Go

A switch can also be used to discover the dynamic type of an interface variable. Such a type switch uses the syntax of a type assertion with the keyword type inside the parentheses. If the switch declares a variable in the expression, the variable will have the corresponding type in each clause.

My use case

I have started writing bindings of libcurl for go language (
In libcurl we have C function: curl_easy_setopt(CURL *curl, CURLoption option, ...);

I'm using cgo utility for binding generation and this utility doesn’t support varargs yet. So I wrote wrapper function in C for each type of arguments. And then I needed way to know then to invoke each specific type of wrapper function. Here we have prefect case for type switch. Here follows the code:

func (e *Easy)SetOption(option Option, param interface{}) {
    switch v := param.(type) { 
        fmt.Printf("unexpected type %T", v)
    case uint64:
        e.code = Code(C.curl_wrapper_easy_setopt_long(e.curl, C.CURLoption(option), C.long(v)))
    case string:
        e.code = Code(C.curl_wrapper_easy_setopt_str(e.curl, C.CURLoption(option), C.CString(v)))

Thursday, August 18, 2011

"Avoid Premature Optimization" Does Not Mean "Write Dumb Code" (link)

First there's a flurry of blog entries citing a snippet of a Knuth quote: "premature optimization is the root of all evil." Then there's the backlash about how performance needs to be considered up front, that optimization isn't something that can be patched in at the end. Around and around it goes.

Read full article here...

Monday, August 15, 2011

How far do I have to ride my bike to pay back its carbon footprint? (link)

I'm thinking about switching my daily commute from four wheels to two. But I'm concerned about all the energy it takes to manufacture and ship a new bicycle. How many miles would I need to substitute a bike for my car before I've gone "carbon neutral"?

Read full article...

Understanding Linux CPU Load - when should you be worried? (link)

Most people have an inkling of what the load averages mean: the three numbers represent averages over progressively longer periods of time (one, five, and fifteen minute averages), and that lower numbers are better. Higher numbers represent a problem or an overloaded machine. But, what's the the threshold? What constitutes "good" and "bad" load average values? When should you be concerned over a load average value, and when should you scramble to fix it ASAP?

Read full article...

Sunday, August 14, 2011

Whatever happened to programming PART 2? (link)

We talk about ‘flow’ quite a lot in software and I just have to wonder what’s happening to us all in that respect. Just like a conversation becomes stilted if the speakers keep having to refer to their phrasebooks and dictionaries, I wonder how much longer it will be possible to retain any sort of flowful state when writing software. Might the idea of mastery disappear forever under a constant torrent of new tools and technologies?

Read full article here...

How Virtuous Is Your Code? (link)

Want to get in an argument with a developer? Tell them their code isn’t very good. The hackles rise, adrenaline kicks in, and then you get that “how dare you” look. But even though we may defend the quality of our code today in passionate arguments and reasoned apologetics, three years in the future—or even three weeks later—we may look back on it with embarrassment.

Read all article here...

Saturday, August 13, 2011

We have an international standard: C++0x is unanimously approved (link)

The final ISO ballot on C++0x closed on Wednesday, and we just received the results: Unanimous approval.

Read here...

Friday, August 12, 2011

Mono: A cure for Microsoft monotheism (link)

When Attachmate bought Novell, it seemed for a while as if the open-source version of .NET would be a casualty.

Laying off the Mono team turned out to be a blessing in disguise, according to Miguel de Icaza, who now runs Xamarin and develops the Mono project, with a perpetual licence from Novell to take care of IP worries.

Read full article...

.Net DI container speed test (link)

You probably don't care why I've done this, but if you don't even care about most of the details of this test, let me lay it on you short and sweet: Autofac, Castle.Windsor, and StructureMap put out some excellent, consistent numbers; Spring.Net is middle of the road; Ninject is consistently the slowest of the pack by several orders of magnitude; and finally Unity showed such a weird behavior that made me question both the validity of my approach and the sanity of its developers (mostly kidding, ctavares is awesome).

Read full article...

Thursday, August 11, 2011

NHibernate 3.2 and default proxyfactory

Now NHibernate comes with default proxyfactory pre-configured. So basically you don't need the following line in your configuration files any more:

<property name='proxyfactory.factory_class'>INSERT_YOUR_FACTORY_NAME_HERE</property>

unless you know what you are doing and why...

Monday, August 8, 2011

Saturday, August 6, 2011

Understanding the Git Workflow (link)

If you don’t understand the motivation behind Git’s design, you’re in for a world of hurt. With enough flags you can force Git to act the way you think it should instead of the way it wants to. But that’s like using a screwdriver like a hammer;

Read here...

Friday, August 5, 2011

Agile: The good, the bad and the ugly.

Most companies are adopting Agile as the “de facto” process for their new projects, while is clear that overall is better than waterfall, it still has its defects. This article does a brief overview of what is good, bad and ugly about agile.

Explicating the new C++ standard (C++0x), and its implementation in VC10 (link)

As you might be aware, the C++ language is being updated by the ISO standard. The codename for the new C++ language is C++0x, and many compilers have already introduced some of the features. This tutorial is an attempt to give you an introduction to the new changes in the C++ language.

Read here...

Thursday, August 4, 2011

Random number generation using C++ TR1 (link)

This article explains how to use the random number generation facilities in C++ using the TR1 (C++ Standards Committee Technical Report 1) extensions. We will cover basic uniform random number generation as well as generating samples from common probability distributions: Bernoulli, binomial, exponential, gamma, geometric, normal, and Poisson.

More here...

Getting started with C++ TR1 regular expressions (link)

This article is written for the benefit of someone familiar with regular expressions but not with the use of regular expressions in C++ via the TR1 (C++ Standards Committee Technical Report 1) extensions. Comparisons will be made with Perl for those familiar with Perl, though no knowledge of Perl is required. The focus is not on the syntax of regular expressions per se but rather how to use regular expressions to search for patterns and make replacements.

Read here...

The man you want to be does not matter (link)

“Ambition is the last refuge of the failure.” ~ Oscar Wilde
Read here

Wednesday, August 3, 2011

In 2500 years, we use up the Milky Way galaxy (link)

Since the beginning of the Industrial Revolution, we have seen an impressive and sustained growth in the scale of energy consumption by human civilization. Plotting data from the Energy Information Agency on U.S. energy use since 1650 (1635-1945, 1949-2009, including wood, biomass, fossil fuels, hydro, nuclear, etc.) shows a remarkably steady growth trajectory, characterized by an annual growth rate of 2.9%...
Read here more...

Firefox performance annihilate Chrome when you have many tabs open (link)

I like breaking stuff! Whenever I try a new feature it breaks. This used to be an annoying “skill” when I started programming but over the time I learned to appreciate it.

Currently I am testing various memory allocation strategies for Firefox. Read more...

Monday, August 1, 2011

Running log 2011-08-01

Just finished 1 lap ~2km...
While running I decide that I won't by ipod because there is something special about running in silence without all this noise... :)