Vaio TZ

March 18th, 2008

It arrived!

First of all, it’s just great! A truly beautiful piece of hardware. It makes a solid impression, looks elegant and is just great in general. I love it!

Sony Vaio TZ

It’s a true ultraportable. In the first picture it might look big, but as soon as you compare it to an 15″ macbook pro you see the difference.

me_tz2.jpg

And when compared to the average desktop setup of an average developer

Vaio TZ

you see that it’s the perfect ultraportable. It’s small, it’s light, it’s great.

Setting up everything took a while though. Here are some notes.

Vista

After one hour I couldn’t stand it anymore. Created the two backup DVDs (important!) and wiped Redmond’s latest OS from the harddisk. Vista was constantly doing something and I had no idea what was going on.

XP

My TZ model (UK) fortunately came with an XP CD. I booted and installed it. To my surprise nothing worked after that. I assumed they made a special XP CD with all the drivers on it but after the first boot my Hardware Manager was full of yellow exclamation marks.
However, Sony provides XP drivers on their homepage. I accepted that sell-my-soul agreement, logged in and could then download all the drivers in one big package. On the same page you will find installation instructions. Read them and do exactly what is written there!
When you boot the TZ with a raw XP it doesn’t support *nothing*. No usb, no ethernet, no wlan. That means you have to download the drivers before installing XP, burn it on a CD, install XP and then insert the driver CD where you hopefully saved the installation instructions as well.
After installing all the drivers everything worked. WWAN, camera, wlan, ethernet, suspend, hibernate… Just the microphone didn’t work, you need to change the input device in the audio settings.

Linux

I wanted to install gentoo but to find out which kernel drivers are necessary I started with KUbuntu 7.10 (kernel 2.6.22). I had to set VGA to 600×800 (that gets automatically corrected later) because otherwise X was just active on 1/4 of the screen (which is tiny as the screen is just 11″ anyway).
Most of the hardware was supported out of the box (ethernet, wlan, intel graphics, sound, special keys..) but there were still some issues (wwan) After loading the sony-laptop module they special keys didn’t work anymore and suspend/hibernate just worked half of the time.

Anyway, I installed gentoo with the 2.4.26.3 kernel and everything worked after that. Non obvious kernel drivers are

  • iwl4965 for wlan (don’t forget to download the firmware file)
  • sony-laptop for special keys (audio and brightness) and advanced features like turn on/off cdrompower, wwanpower
  • usbserial for the wwan
  • r5u870 for the VCC 7 camera
WWAN

If the WWAN status LED is not active yet, the WWAN chip isn’t turned on. Turn it on by entering
echo "1" > /sys/devices/platform/sony-laptop/wwanpower
the status LED should flash up. echo "0" to turn it off again.

usbserial identifies the wwan card after you turned it on and sets up device entries for it. Anyway, you still need to set up a connection. It took me a while but I finally got it working. In kppp:

  • Set up a new modem
  • device: /dev/ttyUSB0
  • connection speed: 460800

Then on the modem tab press “Modem commands”, set initialization string1 to AT+CGDCONT=1,"IP","gprs.swisscom.ch","0.0.0.0",0,0
After that, set up an account. Set the phone number to *99***1# and let the other settings. Save everything, enter “gprs” for the user and “gprs” for the password, press connect and you are online :)

Data Loss

February 25th, 2008

Last week, just before I went to Las Palmas my fancy raid controller and the three SATA harddisks arrived. First I was worried about the compatibility as it’s written everywhere about SATA or SATA II and it seems I’m the only one in the internet who doesn’t see that they are backwards compatible. But anyway, yes they are.

The setup went smoothly and after all the important data got copied and mirrored, I formatted and mounted my old just-important-data-hd to /var/p2p so I won’t have to fight space problems over there for a while (Btw: Don’t get confused by strange manuals. raid-1 is mirrored also when the manufacturer writes something else in his manual)

I have created the first backup in my life.

Today, four days later that old disk where all the important data was on failed, disk crash.
Anyway, all data was already on the raid device.

Nice try entropy, nice try

Laptop Update

February 18th, 2008

The Sony TZ31 vaio models are now shipping from several European sonystyle shops. Still no word about the TZ32 but I keep hoping…

Remoted GUI

February 14th, 2008

Depending on your problem .NET remoting may be an awesome life saver. If you have hundreds of drivers, many configurations and independent client applications it can be the module which holds all the pieces together if your design is more or less correct.

Because it worked so well, somebody came up with the idea to store user controls in those drivers. First it seems like a very cool idea “a driver can provide a piece of GUI abstracted behind an interface which can be shown to the advanced user so he can change options”.

If you think more about it however, it causes more problem than it actually solves (localization + customization, anybody?) and you may get burned by this constant application highjacking where you include anonymous user controls all the time. Anyway, that somebody was from “management” and so I had to implement a prototype.

Well, after a full day of prototyping I can tell you that it won’t work (well it does somehow, but shhh )

The problem we have is that all those user control classes extend indirectly from the type MarshalByRefObject (some kind of remotable proxy) like maybe half of the framework does. Now when you invoke such a control directly from your service two things may happen

  • The user control gets invoked in the server’s app domain and fails to set up a message queue when the server is wrapped in a Windows service.
  • The user control is able to set up a message queue but cannot run because its distributed logic needs to access private methods which does not work as that part is in the server’s app domain.

The ugly solution:

“Give me the type of the user control and invoke it in my app domain.”

which translates into following code (assuming a constructor with one parameter)

Object o = this.localInstanceOfUIType.GetConstructor(new Type[] { typeof( String) } ).Invoke( new Object[] { "Form1" } );
if( o is Control )
  this.Controls.Add( (Control)o);

Of ):

Type Resolving

January 31st, 2008

When you write an application for the .net framework it’s very common to separate the various parts into visual studio projects which will be represented in separate assemblies (dll or exes) after compiling them.

This is usually done like that so other applications can link those assemblies without needing to include a whole stack of drivers for a little piece of logic (you know, reusability, reliability, blablabla…) So you end up with two or more applications/dlls depending the same dll.

Nothing special until here.

Deployment

So what happens when the user, like in my case, puts the executable out of directory with the shared dlls?

Exactly, the program cannot be started and fails with a TypeLoadException because it could not load all its dependencies.

The .net way to solve this is by putting the shared dlls into the global assembly cache (GAC). However, this requires the dlls to be signed with a key and will cause a lot of work if you have sub-dependencies because every signed component needs all its references to be signed as well.

And if you sign all the dlls you change the signature of them and break any existing client/dll. That will cause a big redeployment just because somebody wasn’t happy with a simple link and wanted to put the whole exe to his desktop (and we have lots of dlls, we explicitly decided not to spam the GAC and had some other reasons as well)

But of course there will be a solution for this I thought.

Assembly specific configuration is normally defined by a .config file which has the same name like the assembly itself. E.g.

MyApp.exe
MyApp.exe.config

Loads the xml configuration and applies it to the dll/exe while it gets loaded. With “probing” you can specify further directories where the class loader should look for the required types if they could not be found in the expected location. Anyway, you cannot know where the shared directory is located when you write the config file but I let that for now.

<configuration>
<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
	<probing privatepath="dirA;dirB"></probing>
</assemblybinding>
</runtime>
</configuration>

So I referred to my shared dll directory but guess what, it didn’t work! msdn tells me that those probing paths must not be above the application’s root path. Ha! how nice..

Fortunately, I have a remoting server running to which my client apps need to connect anyway so I could implement a way cooler solution.

TypeLoadException

When the client application could not resolve the dependency it calls some handlers which let the developer handle such cases before quitting.
You can register yourself for such cases with

AppDomain.CurrentDomain.AssemblyResolve +=
	new ResolveEventHandler( DoResolve );

and handle it in a method with this signature

System.Reflection.Assembly DoResolve(
	object sender, ResolveEventArgs args)

My plan

When my event handler method gets called, I call my remoting server and ask
“Hey mate, I need an assembly called ‘args.Name’. You have such a thing?”
“Sure. It’s located in MyCompany\Shared\MyCompany.foo.bar.dll”

When I have the the path information I can do something like

System.Reflection.Assembly.LoadFile( path );

and my client will load that assembly and finds the needed type information in it.

Thus in the end it looks like

private Assembly DoResolve(
	object sender, ResolveEventArgs args )
{
  String path = myServer.GetAssemblyLocation( args.Name );
 
  if( path == null )
	return null;
  else
	return System.Reflection.Assembly.LoadFile( path );
}

In the end the only dll left in the GAC is a dll where the resolving is implemented. Thus the only thing the client must do is calling helperDllInGac.AddAutoResolving() in the first line of its main() and a handler for type loading errors in the current AppDomain will be registered and all dlls will be resolved dynamically.

With this mechanism you can move all executables to any place and they will find their dependencies as long as the service is running. This may not be necessary in your case, but if you have lots of little tools it gets very annoying when you need to sign and register almost every dll because you cannot be sure that executable will be in the same directory.

Instead of returning a path you could also provide a byte array representing the assembly in the servers resolving method and gain even more flexibility. However, depending on what you are doing this it not a real solution and may make things even more complicated and slow.

Notes

Stack

AddAutoResolving() must be called *before* any external types appear while the stack gets built.
E.g.

void main( String[] args )
{
	new Helper().AddAutoResolving();
	MyExternalType t;
	new MyGUIApp();
}

will fail because while the CLR builds the method stack it has no idea about the unknown type yet, calls the handlers but there aren’t any registered yet and the app fails anyway.

LoadFile

LoadFile is just for people who know what they are doing. If you need those anti-dll-hell-features like versioning and policy don’t use it.

Functional Net

January 26th, 2008

http://lampwww.epfl.ch/fn

Now thats an interesting collection of papers (ps). It’s about petri nets (special kind of graphs + synchronization mechanism) combined with functional programming. They also wrote a language for it so you can give a try immediately.

Not that I have any use for it but it makes a nice reading anyway.

If you are interested you can find something similar here:
http://vodka.nachtlicht-media.de/

Choosing a Laptop

January 21st, 2008

I need a new laptop!

Not that my old one is ‘old’ (Macbook Pro 15″, 2GB, 80GB, 2Ghz, bought two years ago), I just don’t use it as much as I would like to: It is too big, too heavy, too powerful and kills the battery too fast. I don’t need all that stuff in there, it’s more a desktop replacement that a portable laptop.

Thus, I bought the wrong laptop back then. Thats not too bad, Apple products don’t lose value as fast as others do so I can still sell it for a reasonable price. I also started to appreciate the whole Mac environment, it’s not huge but most of the software is top quality. I will certainly buy another OS X powered computer one day.

Anyway, this time I think about the requirements first.

First: The real computer is at home. Lots of RAM, raid, lots of space, fast, two 24″ screens. Hence the laptop doesn’t need any of those, I already have it at home. It will be used as assisting help, not as main performer.

Secondly, I move a lot. Changing the room every second hour in school, being in a train or writing in a caffe demands a special laptop.
Its not the only thing in my bag, there are books, folders, bottles. The case must be resistible and protect the hardware from being damaged when it experiences the heaviness and complexity of the AI book for example.
Furthermore, I’m a geek: some bones and skin, a brain and almost no muscles: The weight of the laptop does matter and it should be as small as possible so it fits in everywhere.
Long battery life is essential. If I need to recharge the half full battery just because there wont be a plug around in the next hour I render the batteries’ capacity useless in no to time.

The laptop will need to display some pdfs from time to time, run a compiler, editor and a browser and connect to wlans (umts? hsdpa?), bluetooth and usb devices. That’s it. No 3D accelerated hardware, no huge space requirements, no multimedia capabilities, no need for a quad core cpu.

  • I need to type often: Usable keyboard please! (kills 80% of all umpc devices)
  • No need for tablet laptops
  • Size: Maximum screen size of 13″ but decent resolution: It want to see source files.
  • Battery: At least 4 hours with standard battery
  • Weight: As heavy as a small book
  • Camera + Mic: Required for conference calls.
  • WWAN would be cool: you can get cheap contracts at swisscom and surf mobile over umts and hsdpa everywhere you are.

Devices

These are the laptops I found

  • Asus eee pc 7/10″
    Asus EEE PC
  • Kohjinsha SA1F00A 7″
    Kohjunsha Laptop
  • Macbook Air 13.3″
    Macbook air
  • Lenovo Thinkpad X60/X61 12.1″
    Lenovo X61
  • Asus U1F 11.1″
    Asus U1F
  • HP Compaq “ultralights” 12.1″
    HP Compaq 2510p
  • Sony SZ 13.3″
    Sony vaio sz serie
  • Sony TZ 11.1″
    Sony vaio tz serie
  • Toshiba R500 12.1″
    Toshiba r500

Round 1

eee PC

It’s a nice device, but 7″ with 800×480 is just not enough for me. The cpu is not strong enough anyway. eee is out. Same for SA1F00A.

Macbook Air

13″ is a a bit big. The laptop isn’t an ultraportable anymore. The SSD option is incredible expensive. Fast CPU though for such a small device, but I bet it gets incredible hot. No optical drive? May be acceptable for some people, however I need it often and don’t wanna carry an external drive with me. No umts.
so no.

Lenovo X61

Ah, it gets better. 12.1″, 1.3kg, protected hd, umts + hsdpa, no glare. The resolution 1024×768 is not great but we let it for the next round.

Asus U1F

Lovely 11.1″, makes a very portable impression. Horny leather parts. But too expensive for not having umts/hsdpa. so no. Anyway, if 3g isn’t a must, I would take that one.

HP Compaq 2510p

Good: 12.1″, 1.3kg, umts + hsdpa. Resolution of 1200×800, very good for such a screen.

Sony SZ Series

Great laptop! protected hd, integrated camera, umts + hsdpa, carbon, not as light as the others but its 2kg are ok. 13.3″ inch, which is a bit much.

Sony TZ Series

Very small screen (11.1″) but high resolution, umts + hsdpa, 1.1kg, carbon, incredible long battery life. Keyboard is small but Macbook like so it’s hard to accidentally press the wrong key.

Toshiba Portégé R500

12,1″, umts + hsdpa, 1.280 x 800, 1.1kg, 64GB SSD. Nice! Macbook Air alternative? In the next round.

Round 2

  • X61’s resolution is too low. out.
  • HP has no camera. The quality of the screen is bad, this is a real problem with such a small screen and such a high resolution. out.
  • Sony Vaio SZ is too big. I have 15″ and it’s already big for me, 13.3″ is not a big difference. out.
  • Toshiba Portege: Piece of plastic, no camera, short battery life.

And the winner is…

Sony Vaio TZ-2x/TZ-3x Series. 11.1″ 1366 x 768, 2GB RAM, Core 2 Duo 1.2-1.3Ghz, wonderful screen quality and nice colors. umts + hsdpa, 7 hours batter life with default battery (though there are bigger ones with up to 11 hours), screen led light, normal sized enter key, dvd rw, bluetooth, mic, 2x usb, external vga, SSD. The perfect laptop to carry around.

It’s pricy but I know somebody at sony… :)

[Update]

The Sony VAIO TZ32 is listed in the sonystyle stores of the uk, Spain and France. Some guy at Sony told me that the TZ32 will be available in Switzerland by the end of February but it’s very likely that you can preorder it earlier.

[Update 2]

New laptops have been announced in the meantime. Steve H. wrote a good summary down in the comments.

OS essentials

January 17th, 2008

The last time I was sitting in the train on my way back home I sat next to some computer science students complaining about the operating system course at their university.
“It’s way too low level”, “I never going to need this because in my Groovie world everything is painted in pink.”

Well, I do not agree here.

When you work on any project with a decent size there will be moments where you find yourself struggling with the limitations and quirks of the OS you are using. This may be anything from performance issues to all kind of allocation restrictions and filesystem limits.

If you attended the classes, you know about those problems in the first place and can code around those critical parts with appropriate methods. But if you have no idea about scheduling, threading, memory management, I/O stuff and security, to just name a few, there will be certainly a moment where the program is unexplainable slow or runs into strange errors and you have no idea what is going on. Or even worse, the external problem does not get identified as such and you start wasting ages finding the point in your code base which is responsible for the unexpected behavior.

And what will you do then? Analyzation programs nor your fancy tools will help you here. Suddenly, the pinkness of your Groovie world will become the everything covering tacky and brown glue which, slowly but steadily fills up your head-internal project cache and gives you those clammy feelings when something gets changed.

Frameworks and developing environments get better and better over time, let developers create more reliable applications in shorter time. But even today, in the age of Java-VM, .NET-VM, Whatever-VM you still have to deal with that thing which is running your hardware because the perfect abstraction doesn’t exist.

Thats when your computer science knowledge from some dark place deep in your head comes into. Because after the operating system course you can pass by the limitations of your framework and operating system, because you know what you are actually doing and what you cause deep down in your framework or operating system. Otherwise you don’t even have the slightest chance to fix, not even to detect those kind of problems. This ability differs you also from the outsource-endangered species “code monkey”.

And that leads me to the point that you generally should somehow understand the tools you are using because one day they will strike back and you will find yourself in huge problems and cannot go on with whatever you were doing. In that moment where the fancy automatizations you are using fail, the only thing you can do is hoping that there will be some kind of guru around who has the time, knowledge and lust to help you. Or you just know what the whole thing is about, search for somehow related keywords in the internet and find a solution for your problem within one or two hours.

However, obviously you cannot be familiar with all apps’ details you are using, but at least the core stuff you should understand. Putting your work in dependency of something you have no idea what it does and just hope that it will run yet another day is a bit crazy.

Cheap money

January 13th, 2008

Their money is worth almost nothing (Jan. 08: 1.09 CHF) these days and you can make huge savings in US IT stores. Just ensure you won’t get redirected to a localized non-dollar store where the exchange rates haven’t been/won’t be updated (aka proxy your way through the internet).

So storm the online shops and get new hardware as long as you can!

kde 4.0

January 11th, 2008

Today a new version of the KDE desktop got released. My impression (gentoo overlay):

  • They sticked to their configurability-style. The new applications I saw are flexible and very customizable. You can do whatever you want.
  • Ugly
  • Some MacOS inspired like features with the functionality of exposé and dashboard
  • Lot’s of white space wasted in core apps like in the new file browser (But hey, thats ok with me, my screens are big enough)
  • Most of the KDE folks are talking about really great API improvements. Lets hope this will also result in great applications. Also the gpl’ed availability of QT on MacOS and Windows may turn into an interesting thing.
  • Fast and not hogging resources.

Basically I’m happy that a new beta version got released and looking forward to 4.1. Not because I’m a kfan, no, mainly because I don’t like Gnome and how it gets adopted everywhere I go. KDE is my last hope being saved from too chocolaty or orangy interfaces. An absolute dominance of one major desktop environment may be a good thing on the one hand because of the gigantic amount of redundancy those two players generated in the past. However, on the other hand, being forced into their brain dead simplicity system where you can’t change nothing because it might confuse the mythical “average user” would be true horror for me. Simplicity is certainly a good thing, but they don’t achieve a sane balance of usability and functionality like for example e17 or MacOS does where the benefit created by the simplicity outweighs the missing configuration possibilities.

My editor is my window manager anyway and as long as I can full screen terminals the linux desktop experience will be all right for me.