The 9 most recent notes.
16: Running .NET applications on 64 bit windows
There is a problem running .NET applications that use COM interop on 64 bit windows. .NET applications are typically built so that the JIT compiler will produce code for the runtime platform. So on Windows 64 we get a 64 bit application when it is running. However, chances are all your COM classes are 32 bit dlls. OOps. These will refuse to load into the 64 bit process.
Fortunately there is a solution. One is to compile the thing and set the build option to fix the processor type in the application project properties. However, if you only have the built assembly you can use the CorFlags utility to change the execution environment for the assembly. CorFlags assembly.exe /32BIT+ will force the application to run as a 32 bit process. If the assembly is signed you may have to add the /Force flag which will break the strong name signature but when I did this to the IronPython console executable it seemed to work ok.
15: Git repositories for Tcl and Tk
Having had a go with Mercurial I am now testing Git. I got the Tcl and Tk CVS trees converted into Git repositories without much effort. gitweb.cgi is hooked up with the tclhttpd server running here so the repos are available at http://www.patthoyts.tk/gitweb.cgi/. So far it seems to be working just fine. Git makes significantly smaller repositories than Mercurial. The .hg directory for Tcl is about 56MB and the .git directory is around 10MB. gitk is also much faster than hg view - even though they are sort of the same program.
14: Testing Mercurial on the Tcl and Tk repositories
I have been doing some Mercurial testing with the Tk repository and looking into how much Mercurial Queues might prove to be useful. See my notes on Using Mercurial with Tcl and Tk.
13: Dealing with type punning.
gcc is fond of complaining about punned pointers. What it is complaining about is the technique of casting a structure to another structure using pointers to stop the compiler complaining. For instance, say we have a RECT and an AREA as below, we can reasonably interchange them as they have the same layout.
struct RECT { struct AREA {
int left; int x;
int top; int y;
int bottom; int height;
int right; int width;
}; };
So we might pass data in an AREA to some function that wants RECT using
function_wanting_area(*(RECT *)&area);
So avoid this error and let the compiler know that these two types are actually the same thing we can use a union to do the conversion instead. This is basically how to shut the compiler up and let it do more optimization.
union SWAPRECTAREA {RECT rect; AREA area;};
funtion_wanting_area(((union SWAPRECTAREA)area).rect);
I saw this someplace which can make this a bit easier to use:
#define UNION_CAST(x, sourceType, destType) \
(((union {sourceType a; destType b;})x).b)
ie: RECT rc = UNION_CAST(area, AREA, RECT);
12: Partimage problems with 64 bit windows
We use partimage to take filesystem snapshots on our test machine. So we have a PC with a 32GB primary partition and a set of Win98/2k/XP images that we restore to do installation tests etc. We managed to get our hands on a dual core AMD machine and so I thought I'd add images for 64 bit XP and Vista as I might get a chance to test some Win64 tclkit builds. However, it seems that partimage (at least the version we have in our Knoppix CD has some problems with 64bit NTFS filesystems. The only image I could restore was the standard 32bit Windows XP image. All is not lost however, the Linux NTFS project have got an ntfsclone program which takes NTFS filesystem snapshots and works with Windows AMD64! Phew.
11: Registering with fake details
I just noticed Mailinator which looks like a very handy thing to have around. somename@mailinator.com or mailinater.com or .net and one or two other domains. This might be handy one day.
10: Using QEMU on Linux
Looking to test software on older versions of operating systems I've been testing out QEMU using Linux as the host system. Windows98 was no trouble and once I found a suitable startup script I even sorted out the networking.
#!/bin/sh
sudo ${HOME}/bin/tundev ${LOGNAME} /tmp/${LOGNAME}-win98.log qemu \
-n ${HOME}/bin/qemu-ifup \
-hda ${HOME}/lib/qemu/win98se.qemu \
-cdrom ${HOME}/tmp/win98se.iso \
-boot d
Given the following qemu-ifup script
#!/bin/sh sudo /sbin/ifconfig $1 up 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 sudo /sbin/iptables -N nat sudo /sbin/iptables -t nat -F sudo /sbin/iptables -t nat -A POSTROUTING -s 10.0.2.15 -j MASQUERADE sudo /sbin/iptables -t nat -A POSTROUTING -d 10.0.2.15 -o $1
This setups up a tunnel interface to the emulated system on 10.0.2.15 and makes the hosts system 10.0.2.2. It also fixes up the firewall rules to provide the emulated system access to the real network. Once installed we can remove the -cdrom line and set the boot device to c.
OpenBSD 3.6 was only slightly more difficult. I set up a 500MB image file and booted up the OpenBSD 3.6 cd6.iso image file and did a network ftp install of the core system without X. The only issue I found was that QEMU doesn't support apm and it got a lot of "apm0: APM set CPU idle: unknown error code? (83)" messages. These can be avoided by booting the OpenBSD kernel with -c and giving "disable apm" at the UKC prompt. To make this change permanent, once installed and booted up use config -e -o /bsd.new /bsd and disable apm and save to create a configured kernel. Copy the new kernel to /bsd and no more warnings.
I also tried solaris 8 and 9 for x86 but so far no luck.
9: Internet Explorer 7 beta
Microsoft have released Internet Explorer 7 as a beta. They have added tabbed browsing which is good. But what have they done to the menus? The menubar is now a rebar control and it seems to be impossible to stick it in the normal location under the title bar. Instead it lurks under the tabs bar and I find I'm always looking in the wrong place for it.
One of the main complaints about IE6 (aside from the security) is its patchy support for the CSS specifications. A great page that illustrates a particular issue is the complexspiral demo. Firefox 1.0 and Opera 8 both display this correctly while IE 6 has always got the image placement wrong. IE 7 is still getting this wrong.
Another side with some interesting CSS code is CSS/Experiments. On this site there is a sample for multi-column layouts which IE7 gets shockingly wrong. Opera 8 displays this correctly, with a header and footer across the screen and some blue columns in between. Mozilla Firefox gets the header and footer wrong and displays then as columns while IE7 just gives up on the whole column thing and displays everything as rows!
On the CSS/Experiments site there is also an interesting example of using XHTML and CSS to display scientific papers. Once again, this comes out perfect in Opera 8 and ok Mozilla Firefox where some features do not work fully such as the numbered captions on images). However IE7 chooses to display this as an XML tree.
So I conclude that the CSS model here is going to be about as good as the IE6 version -- poor. I may try out the phishing protection features later. Maybe they will be a bit more impressive.
A bit more testing of some CSS tests at Eric Meyer's site. It seems the IE Freeze page still kills IE7. Not good at all.
8: Linking to maps: mapquest
Mapquest makes it simple to add links. For instance, we are in Yate. This just takes a postcode.
MSN maps can do a similar sort of thing, except they seem to be a bit more useless. Try this link.
streetmap.co.uk can also do this. They seem to provide Ordanance Survey grid coordinates by default like this
7: Testing Tk using Xvfb
Solaris 10 ships with Xvfb installed. This can be handy as it permits testing Tk on headless servers where you maybe cannot or do not want to try and send windows back to your workstation. To set this up we need to do something like:
Xvfb :2 -dev vfb screen 0 800x600x24 & export DISPLAY=:2.0 make test
The above creates the X server on display 2 and configures screen 0 and a 24bit 800x600 display. If we want to take a snapshot at some point we can also specify a path to the xwd(1) compatible memory mapped file that backs the server. This might be useful if the test suite hangs and we want to look at the display. I suspect I'd rather start the tests on a local workstation at that point.