More Bug repairs

Ok,
large numbers of the screen location/scaling bugs have been removed from the game – I was getting confused as to what elements were being kept in native coordinates and what were being kept in logical coordinates – the Palm platform doesn’t make this terribly easy – for example if you want small text you need to cheat. It’s easier to do things when you don’t have to scale, but them’s the breaks.
The next focus is on getting the ‘nix port to work correctly with the new save-game format. Once that’s been accomplished I’ll work on getting the desires coded.
Desires…
With every cycle of zone development/reduction:
– if we don’t have enough for commercial || industrial increase
the desires of residential
Normalize the desires every cycle?
Industrial | Commercial:-
need = (residential_value –
(commercial_value + industrial_value))
Residential:-
need = months * months / 35 + 30 – residential_value
Commercial:-
need = (industrial_value * 2 / 3) – commercial_value
I need to *visualize* this
Default Desire levels:
Evaluation 0 [it’s normalized from -32000 -> +32000 ]
Residential 500
Industrial 250
Commercial 0
Scale goes from -512 to +512
Every time we try to promote and don’t have enough of other elements to allow it to grow we should increment the desire level, every time it can grow we decrease the desire level. a +-512 scale should be sufficient.
I need to come up with a good layout for the desires – horizontal colored bars should be good.

dtrace in the morning

Well I have a presentation from 12.00 -> 12.30 tomorrow in DCU. It’s on Dtrace. This will be my first presentation on Dtrace in front of an audience of more that 10 people. With any luck I should have them all converted to using the One True Tool. Scary to be putting work related stuff here, but I think people should know that I have a mostly un-life.

Disabling / Reenabling compressed folders in XP/ME

Disable Compressed Folders (Windows Me/XP)
Windows Me and XP include a built-in feature to manage compressed ZIP files and folders. This tweak allows you to disable it and install a third-party application.
To disable the compressed folder feature click on Start -> Run and enter the following command:
regsvr32 /u zipfldr.dll
To enable ZIP folder support run this command:
regsvr32 zipfldr.dll

beaming seems to work

Well, I seem to be able to send cities between different instances of the simulator. My next effort is sending them between real devices (mixed mode is the real trick).
It works when the applications are open, closed, rinning and non-running.

ntp trivia

In response to an ntp query about how many servers you should have, someone commented that 3 was sufficient.
This is a (unfortunately) very common misconception. NTP requires *four* servers before avoiding a single point of failure. In reality, the times reported by servers rarely if ever match, so three servers are not sufficient since in all likelihood, none of them will actually match.
NTP gets around this problem by using intervals based on the offset and plus or minus a calculated error. A candidate interval is created using two servers, and any two servers can form such an interval. NTP uses the shortest interval which encloses at least half of the servers. With three servers, this can always be formed no matter how wildly the servers disagree by choosing the interval made by the highest and the lowest server offsets, since the third will always lie between them on the interval.
With four servers, however, if three servers are very close and one is far off the others, the shortest interval will consist of the three in agreement, thus cutting out the bad guy. Of course, since NTP servers often use each other as time sources, it is better to have more servers to avoid the problem of one server contaminating another and cascading failures. But to avoid clock jumps you should have at least four.

Weekend tired

carraig houseI was at my sister’s 40th this weekend, and boy am I tired. She had her party in the lovely Carraig House, on Caragh Lake. A lovely location for having a nice quiet weekend. There was karaoke, and tunes for the aged. We didn’t finish up on the Friday night until after 4am, and on Saturday night I was guiding people to their beds at 5.30 in the morning. The poor nun was woken up at 4.30 by some kids in the room next to her – unfortunately they have no concept of time. I think their parents got a sum total of 2 hours sleep. This morning I had to get up for a 6am flight back to sunny Dublin. I was in the office before 8am – which is way too early for anyone. I’m drinking coffee and trying to keep myself awake (shhhh… don’t tell my manager).

writeable constant strings

Another one of those silly problems in C programming that occasionally crops up.
Depending on the compiler, declaring a char * variable pointing to a string constant can cause that string to go into the .text segment of the application. This segment is marked as readable and executable; but explicitly not writeable.
When you try to write to this address it issues a memory protection fault (SEGV on linux). Solutions are:

  1. copy the string using strdup before writing to it. This means you need to remember to free the memory once the function has completed.
  2. use alloca and strcpy to populate the string. This eliminates the need to free the memory, but adds a bit to the set-up overhead

Nontheless, you should never be writing to values obtained from a constant; you never know where it’s been (poor blighter).

beaming

I’ve started work on beaming. Doesn’t look too hard (famous last words).