Black Tuesday

███ ██ ███ ████ ██, ██████ ███████ ███. ██ █ ███ ███. ████ ███ ███, █ █████ ███. ████ █ ██ █ ███ ███ ██ ██ ██. ██ ███ ██ ███ █ █████. ███ ████ ███ ██, ██ ████ ███ ███ FRA ████. ███ ████ █████ ██, █ ███ ██ ███ █. █████ ███ ██ ██ ███ ███ █ ████ ██ ███. ███ █ ██ ███, █ ███ ██. ██ ███ ████ ███. ███ ██████ ███ ██, ██ ███ █ ███ ██.

████ █████ ███ ███. ██ █ █, ███ █ ██ ███ █, ███ █ ██. ████ ██████ ██ █ ███ ███ ███████. ███ █ ██ ██ ██ ████ ███ █ █ ██. ████ ██████, ██ █████ ███ ████, █ ██ ████ ██, █ ██████ ██ ███ █ ██. ██ ████ █████ ██ █ █████. ███ ███ ██ █ ██, ██████ █████ █. ███ ██ ████ ██. ██ ████ ███ ███. ████ █ ████ ██. █ ███ ████ ███, █ ██ ██████ █ ███ ████. ███ █ ██ ██ ██ ███ ████ █ ██ ███. ███ ████ ██ ███ ███ ████ ████. ██ ██ ██ █ ███ ████ ███.

███ █ ███ █. ████ ██ ███ █ ███ ███ ███ █ █ ██. ██ ████ █████ ████. ██ ███ ██ ██ ██ ████ ██ █████ ███ ███. ███ ██ ██, ███ █ ██ █, █████ ██ ███. ██ ███ ██ ████ ███ ████ █ ███ ██ █████. ██ █ ██ █ ██ ███ ████. ███ ██ ██████ ██, █ ████ ███ ███ ██. █████ ████, ██ █ ████ ████, ███ ██ █████ ██, █ █████ ███ ███ █ ██. ███ ██ ██, ███ ████ ████ █, ███ ██ ███. █ █ █████ ███. ████ ████ █████ ███ ██ ████. █████ ██ ███ ███ █ ████ ██ ███ █ ███ ████ ███ ███; █████ █████, ██ ██ ████ █████, ███ ██ █████ █ FRA █ ██ ████ ███ ██ ██ ███. ██ █ ██ ██. ██ █ ████ ███. ██ ██ █, █████ █ █████ █ ██, ████ ██ ███. ██ ███. ███ █ ██ ███, █ ████ ██.

█████ █ ██ ██ ██ ███ █████. ██ ████ ███████ ███ █ ████. ███ ███ ██ █ ██ █████ ██ ████ ██ ████. ██████ ████ ███ ██ ██ ██. ██ █ █████ ██. ██ █████ ████ ███. ███ ████ █████ ██, █ ████ ███ ███ █. ██ █████ ████ ██ ██ █████. ██ ██████, █ █ █████ ███, ██ ██ █████ ██, ██ ████ ███ █ █ ██ █. ██ ██ ██, ████ ██ ███ █ ██, █████ █ ███. ██ ████, ██ █ ██████ ███, █ ██ ████ ███, █████ ███ ███ ██ █████ ██. ██ █ ███ █ ██ ███ ████. ██ ███ ███, ████ █ FRA ███ ██, █████ █ ██. ███ ████ ████ ██ █ ████. ████ ██ ███ ██, ██ ████ ██. ██████ ████ ███ ██ ██ ████. ██ █████ ███ ████.

Posted in Politics | Tagged | Leave a comment

Proposal: generics (and some other stuff) for Objective-C

Some time ago, Greg Parker asked the Twitternets what we’d like to see in a purely hypothetical Objective-C-without-the-C language. Someone — I believe it was Landon Fuller — pointed at an article about the Strongtalk type system for Smalltalk. I quite like the idea of Objective-C-without-the-C (i.e., a language that is native to the Objective-C object system and runtime without the baggage of C), but after reading that article I found myself asking why we couldn’t do something similar in Objective-C.

I don’t think my random musings have much influence on the design of the language, but if I don’t write it down nobody’s going to know how nuts I am, so here’s a semi-concrete proposal for contextual types and generics for Objective-C. Since anyone even mentioning generics in the vicinity of Objective-C will inevitably be flamed for trying to turn it into C++, this is followed by an aside entitled Why This is Not the Baby-eating Spawn of Bjarne Stroustrup. (Nothing personal, Bjarne.)

Continue reading

Posted in Cocoa, Code | Tagged , , , , , | 9 Comments

Multi-type Save Panel Controller

As a change of pace, I thought I’d post some code that doesn’t go out of its way to be bad.

JAMultiTypeSavePanelController is a class (abstracted from ImageIO Export for Acorn) to handle the case where you want to offer the user a choice of formats to save in.

Save panel
Continue reading

Posted in Cocoa, Code | Leave a comment

Wanted: a Right-Handed Keyboard

My current keyboard looks like this:

Left-handed keyboard: keypad on right, empty space on left.

(Well, roughly. It actually looks like this, but I couldn’t find a decent-resolution Swedish one.)

This was a sensible design for the right-handed majority when it was introduced, some time in the stone age. However, since then, something quite important has happened: the keyboard has been joined by another input device, which I suspect is used more than the keypad by most people who are not cursed with an Excel-dominated career.

Continue reading

Posted in Hardware | 4 Comments

Net Neutrality (EU edition)

Network neutrality in Europe is under threat. Not in some vague possible future; right now. In one week, on Tuesday the fifth of May, the European Parliament will vote on the second reading of the Telecoms Package and amendments.

I urge all EU citizens to contact an MEP, via e-mail or (preferably) phone, and encourage them to support the Citizens’ Rights Amendments, which reaffirm net neutrality and anti-censorship positions adopted by the European Parliament in the first reading but subsequently removed by the Council of Ministers in their “common position”.

The primary purpose of these amendments is to make it explicit that the European Convention on Human Rights applies to internet and telecoms legislation. This should be obvious, but it is clear from the actions of politicians that it is not; it is all too clear that many see the internet as a frivolous toy, and civil rights obviously do not apply to toys. (It occurs to me that politicians are probably among those in the western world least affected by the digital communications revolution; if they need to communicate, they talk to their secretaries.)

Draft texts of the amendments (not yet numbered) can be found here: part I, part II, part III. There’s a (rather bad) campaign site here, and a less bad editorial – for all that it’s in a pointy-haired e-mag – in Computer World UK here.

Posted in Politics | Tagged | Leave a comment

Constant objects for fun and non-profit

The @"foo" operator for constant NSString objects in Objective-C is extremely convenient. Indeed, if it wasn’t there, programming with Cocoa would be a royal pain. Many of us have at various points wished there was equivalent syntax for NSNumbers, and possibly collections.

As an early Christmas present to fellow lovers of twisted, evil code that should never have seen the light of day under any circumstances whatsoever, I hereby present an implementation of the first half of that wish.

Continue reading

Posted in Cocoa, Code | Tagged | 3 Comments

Fun with the Objective-C Runtime

Ever since Leopard came out, I’ve wanted to do something useful with resolveInstanceMethod:. The opportunity has yet to present itself. However, I have done a couple of really silly things with it, which have until now languished in obscurity in the depths of paste.lisp.org. So here they are. Continue reading

Posted in Cocoa, Code | 4 Comments

Migratory Code

Of the two people I know of who have tried to get at some of my code releases in the past year, a full 50 % have given up and written a new implementation from scratch because downloading and opening a zip file is too much work (as is actually complaining to someone who can fix it). On top of that, some form of version control is good to have, and my local set-ups keep breaking when I do silly things like getting a new computer or installing a new OS. So now most of my released code lives at Google Code. Yay and stuff.

Specifically, the projects in question are:

For information about the various code bits and bobs, see here.

I fully expect that the next person who tries to grab some of my code will find it to onerous to dig through the subversion repo. To that person, my message is: tough.

Posted in Code | Tagged , , | Leave a comment

Key to QWERTY

Recently on the Twitterwebs, Peter Hosey asked for a library that takes a character and returns the corresponding virtual key code (implicitly, in the U.S. keyboard layout). The intention was to use it to specify default key bindings when binding to physical keys rather than characters.

Now personally, I like to specify my defaults in plists, and if I was hard-coding them I’d use an enum. However, I thought of a mildly amusing implementation, so I wrote it (MIT/X11 license). It turned out to be less interestingly ugly than I expected, but did give me an opportunity to play with __builtin_constant_p(). This means that (if you’re using gcc) KEY_FROM_QWERTY_BODY(ex), where ex is a constant expression, will itself be a constant expression, and if ex is otherwise known at compile time to be constant (e.g. a locally-defined const int, which is not a constant expression in C) it will be constant-folded; in other cases, a function call will be generated.

Also included is code to generate the header, specifically the big ?:-based expression that does the work, using whatever keyboard layout happens to be active. Note, however, that the current implementation only includes keys that generate a single ASCII character, and skips dead keys. It includes capital letters as aliases for their lowercase equivalents, but not other shifted keys.

Conveniently, I’ve also written a library to get a display string for a virtual key code. That one does use the user’s current keyboard layout.

Posted in Code | Leave a comment

The Ubiquitous Wiretapping Bill

Krig är inte fred. Slaveri är inte frihet. Avlyssning är inte integritet. 17 juni.

This is not about programming. It’s about something that actually matters.

There’s been a little media coverage recently about a Swedish law that’s been in the works for a while. (The Register, Slashdot on The Register, The Local Edit: and IDG/PCWorld, European Digital Rights, Ars Technica; new portal site in Swedish). The law will permit the National Defense Radio Establishment (FRA, Försvarets radioanstalt) to carry out surveillance over the air and in cables crossing the Swedish border.

Surveillance over the air has been carried out since the 1940s, and satellite surveillance since 1976. This has been unconstitutional since 1995, when the European Convention on Human Rights was adopted as part of the Swedish constitution. The former second-in-command of FRA, Anders Wik, admitted this in a tape recording made public last saturday. This has received almost no attention in the Swedish press. Creating a law that permits the activity will make it legal under the EHCR¹.

The law was originally drafted by the Social Democratic Party, but withdrawn because it “received an unfortunate amount of attention”. It was reintroduced by the current four-party alliance in late 2006 (with a quick consultation carried out in the week between Christmas and New Year), but was suspended for one year by a rare minority veto instigated by the Social Democrats, who suddenly felt it should be adjusted to provide more checks and balances.

Defenders of the new law point out that it specifies that “military intelligence activity” [försvarsunderrättelseverksamhet] may only target “foreign matters” [utrikes förhållanden]. That restriction is actually already in place. However, it is the stated legal opinion of FRA that when they work for non-military authorities, such as the police, the customs office or the tax board, this is not “military intelligence activity” and is therefore not restricted to “foreign matters”. Besides that, determining that, for instance, an e-mail message is to or from a Swede involves analyzing it; as pointed out by the Council on Legislation, personal integrity is violated by opening the envelope, not just by copying the contents.

The obvious problem with this type of legislation is that it can easily be abused, especially when it’s written in very broad terms. However, there is another problem: even if it never is abused, the very existence of surveillance is oppressive and changes people’s patterns of communication.

A recent survey from Germany shows that a large portion of the population has changed or under certain circumstances would change their behaviour due to Germany’s implementation of the data retention directive. This “only” involves storing information about the participants in communication and their location. A law that allows essentially arbitrary civil authorities to order searches of the contents of people’s communication can be reasonably expected to affect behaviour more extensively. As such, citizens’ freedom of expression is curtailed. Without a functioning freedom of expression, democracy means nothing.

The proposed law is not a technical adjustment of foreign intelligence activity, as its defenders wish us to believe. It is a direct assault on democracy itself. It is expected to pass with a seven-vote majority eleven days from now, unless we can once again raise an “unfortunate amount of attention.”

Footnote: I know that we’re already being spied on by foreign agencies, but that’s less important. Foreign governments are not in a position to oppress us, except by taking over the government of Sweden. This is reflected by the Swedish bill of rights, which in several cases protects² the citizen “in his relations with the public institutions” [gentemot det allmänna].

¹ If you accept that it is “necessary in a democratic society in the interests of national security, public safety or the economic well-being of the country, for the prevention of disorder or crime, for the protection of health or morals, or for the protection of the rights and freedoms of others.”
² Sort of. Except for the EHCR, the Swedish constitution is not enforceable.

Posted in Politics | 1 Comment