What Else I Didn't Notice?

I accidentally did click’n’drag on tray notification are in Windows 7. I was quite surprised when icon actually moved.

Yes, Windows 7 allows notification icons to be moved around. And to make it better all icons will stick to that place - no matter in which order you start applications that create them.

I wonder what else I don’t know about Windows 7… I should probably start reading manuals. :)

Backing Field Must Be Fully Assigned

Structures are peculiar creatures in C#. One of more interesting peculiarities comes in combination with auto-implemented properties.

Lets begin with following struct:

public struct Test {
    public Test(int a) {
        this.A = 1;
    }

    public int A;
}

It is something that works, but having variable A directly exposed is not something that looks too good. Auto-implemented properties come to rescue:

public struct Test {
    public Test(int a) {
        this.A = 1;
    }

    public int A { get; set; }
}

This looks much better from design point of view. However, it also does not compile. It will greet us with: “Backing field for automatically implemented property ‘Test.A’ must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.”

Solution is quite simple, just call default constructor (as suggested in error message) and everything is fine:

public struct Test {
    public Test(int a)
        this(): {
        this.A = 1;
    }

    public int A { get; set; }
}

Unfortunately, you gain something, you lose something. Our original structure stops us when we forget to initialize field and I think of this as great feature. It ensures that we cannot forget a field.

Solution with auto-implemented properties has no such assurance. Since we need to call default constructor at one point or another, we will end-up with all fields initialized by struct itself. There will be no further checks whether fields are set or not.

While code did get nicer, our refactoring just got harder.

I Forgot :)

Illustration

I was having a beer with some friends in Berlin and talk came to Avatar. Yes, that 3D movie that everyone is so fascinated with. I had one more night to fill in Berlin so I decided to go and see what is that all about.

Unfortunately, there was no show playing on Wednesday (my last day in Berlin). Fortunately, I have friends who know German and she was kind enough to find a show that night and to reserve a seat for me. :)

As soon as I left U-Bahn station and went into Sony Center, I was amazed. I spent a lot of time in Berlin last few months and I cannot believe what I have missed. Yes, I was on Potsdamer Platz before, but it was during day time. I had no idea how beautiful it looks during night hours.

I got ticket for my first IMAX 3D movie, bought a pretzel and I was ready to see some 3D action. As lights dimmed I placed glasses on my nose and got ready to enjoy movie. Movie started and I could hear unprovoked wow from some girls behind me. After few more wows I was puzzled. There was nothing that interesting on screen.

I took me few more wows before remembering that I have diagnosis of congenital strabismus. I was diagnosed with it at age of four but I cannot say that it bothered me too much. It really has only one consequence - no depth perception. As you may guess, it is very hard to see anything in 3D when your eyes are not used to work together. To make it short - 3D was not working for me.

I spent rest of movie trying to get my eyes aligned. Not an easy task considering that I haven’t manage to do this for my whole life. Of course, I failed.

Nevertheless, it was an interesting experience and night well spent. :)

2010 App Cannot Be Found in Local Install Folder

Illustration

Notice: there is quite some ranting going on here, skip to bottom for solution.

I am quite a big fan of Formula 1 racing and, of course, God of Irony decided that I am to be traveling at exact time of race. I was hoping to get some coverage on my mobile phone and I connected to live timing page only to find that my login from last year is not valid.

It figures that I would forget that you need to re-register for this EVERY year. And, of course, neither Internet Explorer or SkyFire would work. They used some strange ordering of elements and submit button was just not visible. After initial frustration, I did find a solution. There is mobile version of site. There I was finally able to register.

I went to download mobile application that would give me access to all race data. My phone was listed among supported and I downloaded application, started install - only to be greeted with “2010 App cannot be found in local install folder”.

Shit, I thought, Internet Explorer is playing games again, I will try SkyFire - same result. In moment of desperation I even installed Opera Mobile only to have same issue. Notice that I was now almost an hour into race and with no data other that first three drivers. I was quite nervous.

In faq they mentioned using JavaFX for running application. In moment of desperation I downloaded it and, what would you know, application started.

There was some initial confusion with entering data because some idiot decided that my mobile must be limited to T9 entry. That meant that, even as phone had physical QWERTY keyboard, I needed to use my keypad to login. As Murphy would have it, after all that trouble, application was unable to connect to my 3G Internet. I fiddled with quite a few settings and gave up…

This morning I checked what exactly was happening and I noticed problem. My install file (Formula1.jad) was only 397 bytes in length. My default Java engine (Esmertec Jbed) didn’t know how to get rest of data. No direct link was present in jad but I figured that jar cannot be too far. Using my laptop, I downloaded jar from same location where jad was. It was enough to copy link and change extension.

I uninstalled JavaFX since I had no use of Java engine without Internet access and proceeded to install Formula 1 application with both jad and jar in same folder. This time it went without hitch.

Connectify

Illustration

I was on business trip for few weeks and that meant that my home wireless network was missing my devices. More importantly, my devices were missing my network. Hotel did have wired Internet, but that solved only laptop connection. My phone was still Internet-less.

Fortunately, few months before that trip, I installed Connectify. It was small router program that requires Windows 7, it was in beta, I had no use for it - naturally I installed it and even updated it regularly. All that without even testing whether it works. Sometimes I surprise my self.

Program’s interface is quite simplistic. Almost every configurable setting is visible on main program screen. Mostly you just need to select password and which device has Internet to share and you are good-to-go. It is quite surprising that you can share your active wireless connection. Performance will go down a little (since your card will need to serve both as wireless client and wireless router) but it will work.

Security settings are limited to WPA2/PSK. No weak WEP but also no RADIUS authentication or anything more advanced. Since this would be probably overkill for most of uses, I cannot hold that against it.

What I miss the most here are statistics. You only get information which devices are connected and on which IP address. There is no information about their current resource spending. I was connected to Internet over 3G USB stick and I shared this connection with two friends. We had limited bandwidth and we were downloading way to much data. It was pain-in-the-ass to find which computer was “leaking” data.

As final conclusion I can only recommend this program. Once you set it up (not a big task to do) you can just forget about it. Prerequisites are not quite clear - Windows 7 and “better” wireless network card (although almost all newer Intel or Broadcom cards will do). But if it works once, it will work every time.

P.S. If you were wondering what black magic are they doing in order for this to work, you can check Virtual Router source code. It is open-source project based on same API functions that became available with rise of Windows 7.