Manlig härskarteknik

Visst, Sten Tolgfors är ungefär så långt ifrån min favoritpolitiker som man kan komma. Men dagens snyftartikel om hur han använder de alltid så populära “manliga härskarteknikerna” för att tillintesgöra sina kvinliga motståndare är ändå för löjlig för att vara sant.

För guds skull, om någon (man som kvinna) är så ofattbart osäker på sig själv att man kan bli “totalt tillintetgjord” av att bli kallad vid sitt förnamn, så hör man inte hemma i riksdagen. Det har inget med kön att göra, det handlar om att man är en svag, löjlig människa. Grow a pair.

All praise Epson

Epson is updating its digital rangefinder R-D1, and I cry a little tear of joy. It would have been so easy to just shut down that product line. There are probably about 10 people in the world that want this camera, but every one of us want it a lot.

It’s still outside my financial reach, but the only alternative, the Leica M8(.2) is even more expensive. And the Leica doesn’t have those beautiful analog gauges for memory space, white balance, battery and image format.

img_dist4 

img6

(images from http://www.epson.jp/products/colorio/photoviewer_digitalcamera/rd1xg/)

Inte kan väl flyktingar få arbeta?

Nu har Asylmottagningsutredningen överlämnats till migrationsminister Tobias Billström. Ett av förslagen är att asylsökare som väntar på beslut, och som kan och vill arbeta för sin försörjning, ska tillåtas göra det. De ska alltså undantas från kravet på arbetstillstånd, istället för att som idag tvingas till passivitet under de månader och ofta år som handläggningen pågår.

Ve och fasa, så kan vi ju inte ha det, att de tillåts göra rätt för sig. De kan ju tro att det här är ett land där man tillåts kavla upp skjortärmarna och ta ansvar för sitt eget liv. Då riskerar de ju att aldrig ta till sig den svenska kulturen.

Mini vs Micro

Att de största mobiltelefontillverkarna kommit överens om en gemensam standard för laddare är nog en av de få nyheterna som alla människor i hela världen kan vara fullständigt överens om är en God Sak, men en del har ifrågasatt varför man inte valde det vanligare Mini-USB-formatet över det marginellt mindre Micro-USB.

En kommentar på Engadet informerar dock att

Mini-USB is a depreciated standard. This doesn’t stop anyone using it in its current implimentation, of course, but it means there will be no Mini-USB plug for USB 3.0. So manufacturers are going to have to switch over in the future anyway. If they made Mini-USB the official standard, then in 2012 you’d either be stuck with USB 2.0 speeds on your industry-mandated Mini-USB port, or you’d have an industry-mandated Mini-USB port for power and a seperate Micro-USB port for USB 3.0 data. Neither of those is particularly desirable as far as phone manufacturers are concerned, and I doubt it would be a popular decision with consumers.
(Nothing’s to stop phone manufacturers putting out a Mini-USB connector that also supports USB 3.0, but they’d be forbidden from using any of the USB-IF logos.)

Intressant, det hade jag ingen aning om. Men lite snabb wikipediande säger att det stämmer. Så nu vet jag, och nu vet ni.

Ice.net i konkurs

Jaha, då hände det änligen. Nordisk Mobiltelefon, som körde ett EV-DO-nät över det gamla NMT 450-bandet, har fått kasta in handduken till sist.

Väntat men tragiskt. Jag hoppas Access Industries, som köper upp inkråmet, kommer göra något vettigt där. Sverige behöver verkligen ett fungerande mobilt bredband med meningsfull yttäckning…

Overloading == in C#

When overriding the == operator on immutable objects, I’ve previously done something akin to

public static bool operator ==(MyThing x, MyThing y)
{
    // Null tests
    try {var ignore =  x.GetType(); } // Provoke NRE
    catch(NullReferenceException)
    {
        try
        {
            var ignore = y.GetType();
            return false; // Only one operand null
        }
        catch (NullReferenceException)
        {
            // Both operands null
            return true;
        }               
    }
    return x.Equals(y);
}

to catch the case of two null objects. (null == null) should evaluate to true. Equals, of course, evaluates if the fields of the objects are identical. However, this solution purposefully raises an exception and then catches it, which is never a good design, and also makes debugging with “break on all exceptions” a pain. So I was quite happy when I realized that the test could be written as

public static bool operator ==(MyThing x, MyThing y)
{
    // If both are null, or both are same instance, return true.
    if (System.Object.ReferenceEquals(x, y))
    {
        return true;
    }

    // If one is null, but not both, return false.
    if (((object)x == null) || ((object)y == null))
    {
        return false;
    }

    // Return true if the fields match:
    return x.Equals(y);
}

instead. I can’t take any credit for the solution above, since it’s lifted almost verbatim from Microsoft’s C# Programming Guide, Guidelines for Overloading Equals() and Operator ==. But that’s the way it always is, any information you want is always out there on the net somewhere, you just need to find it. Hopefully this post helps someone else do just that.