Primum non Nocere (linkfest)

One of the links for The Best of Software Writing II linkfest is to an article entitled ‘Primum non Nocere‘, or First, do no wrong. It’s an important principle that should be followed when writing software. On the non paranoia side of things we have the 10 places you must and must not use AJAX, which is a good consideration of appropriate cross cutting of client/server interaction. There’s the ‘Fractal nature of UI design problems‘, where I’ve reached step 5 in the problem being addressed before just saying ‘good enough’. How I came to despise AJAX, part of a long rant that I’ve experienced myself. Does Visual Studio rot the mind? I’m a vim user. Why I hate Frameworks – an argument against complicated frameworks. Simple ones for me thanks.
Bit of a linkstravaganza really.

XP on the mac

It’s unofficially doable; a few folks won the $14,000 odd prize for it. Practically nothing on the machine works, though. I am reminded of the situation of Solaris on X86 – noone wants it because the hardware support is so poor. The reason for the poor hardware support is that there isn’t anywhere the number of driver developers as there would be for such beasts as Linux or Windows.
640×480 (or 800×600 I think) VGA graphics drive, no wifi, no networking, no bluetooth. Pretty much useless from the usable laptop front. I’d take Linux on it before Windows if that’s the case. Of course theres a fully functional unix machine under the hood for Mac OS X, and while someone will probably want to shoot me for it, the fact that it’s proprietary isn’t too much of a big loss.
I was talking to my mate Mark on St. Paddys day about Hyper Threading processors, and he was mentioning that they’re not the best at high-performance computation (without extensive and expensive hints in the code). I agreed, mentioning that the latest generation of multi-core processors offer roughly equivalent cost and scale almost multi-processorly. I then went on to explain that the multi-threaded processors are better for I/O workloads, you shove a lot of the scheduling cost back into the silicon where it belongs, rather than having the OS deal with it in software.
For a big server, performing lots of I/O, a multi-core and multi-threaded processor would be the best of both worlds, and based on the direction that Sun is taking with the Niagra system, one can see that this can be taken to a scary extreme – consider 8 core with 8 threads per core all on the one processor module. The power-savings alone would be enough to warrant buying these machines.
Im still waiting for quotes on a few more laptops. I can wait, I just don’t know for how much longer. Meanwhile I’ll probably buy a phone. Nokia 6230i looks like a cheap and easy option – buyable from €260.19. Or maybe an annoying smartphone like the iMate PDA 2K (it’s the original of the O2 XDA IIs).

Slow composition

I have a set of hand written pages of the next 20-30 features to implement/changes to make to pocketcity in order to make it 1. better and 2. more easy to port. One of the things I’m planning on doing is moving the water pipes underground. This will change things quite a bit.
I’m considering getting a new laptop (again) and I’ve reached the point where the hardware that’s available is reaching what I want. It needs dual-core processor; I’m not getting another uni-processor machine again. Acer have dual core centrino models, with a decent graphics card. The only problems are the DVD drive and the video card. It’s a DVD-RAM drive. It won’t region free! it’s the same problem as the Ferraris. I don’t want to re-code all the non region-2 discs I have. That would be a pain in the ass. The video card isn’t supported in Linux either, which is another annoyance. I hope that ATI release a driver for the X1000 family soon.
Alternatives are Alienware and their Aurora m7700, which has an athlon processor. Has a more supported graphics card, but it’s about twice as expensive as the Acer. Then there’s the Widow PC laptop. Still the price tag problem.
Until I get a new laptop, I’ll have to be happy with the one I have. It’s an early generation centrino, so I’ve only got a/b wireless, and an integrated GPU. It works well for what I’m doing (programming, watching movies, occasional game).
Shame that Dell haven’t caught up on dual core for the gaming laptop.

Network protocol design

Let’s make this one easy for the protocol writers. Front load the important information in the packet. That way we can more easily detect it and send it on to the correct handler. Stop putting the decision making information in the middle of the packet. We don’t have infinite processor time on these handlers.
This complaint was brought to you by people who care how network bandwidth is being consumed.

The angst – the multi-step ADO operation tale continues

I thought I had it, but I didn’t. I still can’t find out the reason. Currently, after each post I re-read the table by closing and opening it. The table is a small, local, temporary table for recording information before posting it to the real database so I don’t really care that the exception is triggered.
Now, I’m getting DbgBreakPoint exceptions. This was in a simple showmodal call, so I have no idea why it’s there. Apparently it might have something to do with opening the table concerned.

At least one cause of ‘multi-step ADO operation generated errors’

I was experiencing this occasionally when implementing the delete functionality for a browse window. It turns out that I was not positioned on a record, but instead was either before first or after the last record. Simple problem, really but a bit of a pain to discover the reason as the error isn’t really informative.
The solution was to do move to either the first or last record. Thanks to the magic of the ‘meta bof/eof records’. I have to use the description loosely, as they definitely ain’t records and the correctness police would be rapping my knuckles for such a statement.
Discovering the solution was not helped by the browse grid control I was using – it seemed to indicate that I was on a record when in reality it wasn’t. Another case of model does not match the implementation.

Misleading Document titles

This one: Secure Java apps on Linux using MD5 crypt
Firstly, the encrypted string is: $<mechanism>$…, where a mechanism of 1 is MD5. My desktop has 2a, which indicates I’m using the Blowfish algorithm – I see no reason to compromise.
Well, guess what – this document won’t work for me because I use blowfish locally, and secondly, the only accounts in /etc/shadow (and passwd) are local accounts – if you’re using nis, nisplus, or ldap (solaris more so) for your name services, then you’re SOL with this mechanism.
This is another reason for not using the crypt mechanism is that this is trying to solve the problem from the wrong level. You should not be trying to compare the encryption strings, you should be using an alternative to the OS provided security mechanism. So in this case you should be using jaas, and a PAM plugin. The use of yet another ‘well it works on my box‘ mechanism is so cripplingly annoying that it angries up my blood.

Who’s living in what apartment?

It’s the COM apartment models. They’re related to the threads that make use of COM objects. What happens is that when you initialize COM for a specific thread you declare that it’s either Apartment Threaded (AKA Single Threaded Apartment) or Multi Threaded.
When you use the Apartment threading model, it means that the COM object is isolated within the thread that created it. The most important piece of information about this model is that you should never use that object in another thread – it causes brokenness.
When you use the multi-threading model, what you’re pretty much saying is that I’m probably going to use this COM object in several threads. The way it works is that a multi threaded model, then the context is shared within the process.
The model you support also puts extra complications on you, the creator of the object. COM objects with a declared MT support must use some synchronization to protect shared information within the object, otherwise you’ll suffer from data corruption due to threads walking over the data. You don’t have any of these considerations in a Single threaded model – you’re guaranteed safe and sane interactions.
Additionally, when you’re in COM land, remember never just WaitFor*, but instead MsgWaitFor* things. This also applies to using DDE. This is because the Apartment model uses windows messages under the hood.

[Listening to: TWiT 38: MacWorld Expo – Leo Laporte and the TWiTs – this WEEK in TECH (1:19:01)]

suspend/resume under linux on Dell 500m

The laptop does suspend and resume to disk, but I have issues with the video card – I use the 855resolution program to allow the video card to set the native 1400×1050 resolution of the screen. When I resume once X kicks in and can’t set the video mode correctly I am booted back to a login screen.
I put in an entry in the powersaved post resume from suspend2disk script, and it correctly repatches the video mode before the X server tries to reinitialize the video. The problem is that I need to use the powersave command to shut it down correctly.
I took the alternate route and installed the software suspend2 patch. It provides a cleaner interface to hibernation (the hibernate command); it compresses the file; it supports using a file on disk instead of the swap partition; you can encrypt the hibernation file. It will unmount the windows paritions when I suspend, remounting them when I resume (corruption issues avoided) and runs the 855resolution command before X kicks in. All in all a nicer way to deal with hibernation.
I still haven’t got suspend to ram working. Standby works, though.
Now all I need is to get 855resolution working on Solaris and most of my complaints will just vanish into the distance.

It would be really easy to get work done

Well it seems to be a problem for me – I’d love to get more work done on Pocketcity, but these bloody episodes of CSI on UK Living (I used to work there) are distracting me horribly until really late at night.