Monday, June 23, 2008

The Economist covers the Lisbon Treaty

You'll have to buy a copy of The Economist for the details, but the cover of this week's edition captures The Economist (and my) view of the treaty:


Tuesday, June 17, 2008

Petition to PM: No to the Lisbon Treaty.

If the Lisbon treaty is something you would have liked to have the chance to vote against specifically, now you can on the PMs petitions wib site. As is often the case, the wording is less than perfect, but the sentiment is spot on:

Petition to: Respect the result of the Irish referendum and abandon the attempt to ratify the Lisbon Treaty.

Sunday, June 08, 2008

Non-blocking sockets in VisualWorks - the problem

I want to be able to know immediately when the other end of a socket connection closed the socket when using TCP sockets in VisualWorks. I need this for my work on Slaps, the smalltalk LDAP library.

Here is something you can try to see the issue. Run the following code and your image will wait for an inbound socket connection on port 12345. Use "telnet localhost 12345" to connect, enter a few characters and hit enter (whereupon telnet sends the characters over the socket to your server). Now you'll hit the first halt in the code. At this point close the telnet session (+] and then "quit" works for me). Now in the debugger, just press proceed and you'll get the next halt pop up - no exception indicating that the socket has closed by telnet. You can keep on reading from the socket for ever, getting zero bytes each time. So how can I get an exception when telnet (or the other end of any TCP socket) has closed unexpectedly? This post is already too long so I'll put what I've found in another post.

| serverSocket connectionSocket |
[|buffer octetsTransferred readOctets actuallyRead|
serverSocket := SocketAccessor newTCPserverAtPort: 12345.
serverSocket listenFor: 10.
connectionSocket := serverSocket accept.
buffer := ByteArray new: 100.
octetsTransferred := connectionSocket
readInto: buffer
startingAt: 1
for: 100.
readOctets := buffer copyFrom: 1 to: octetsTransferred.
readOctets halt: 'Now close the client connection'.
octetsTransferred := connectionSocket
readInto: buffer
startingAt: 1
for: 100.
octetsTransferred halt: 'Any exception? Nope.'.
actuallyRead := connectionSocket writeFrom: readOctets.
actuallyRead halt: 'Any exception? Nope.']
ensure: [
connectionSocket notNil ifTrue: [connectionSocket close].
serverSocket notNil ifTrue: [serverSocket close]]

BBC NEWS: "ID cards 'could threaten privacy'"

Good to see that some MPs are slowly working out that, far from reducing identity theft, ID cards will probably make identity theft a bigger problem:

BBC NEWS | UK | UK Politics | ID cards 'could threaten privacy'

The UK identity card system is a naive idea backed by the people who stand to make lots of money from supplying the support systems.