Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

Wow

OK, so GeoEye-1’s photo of Washington D.C. gets my vote as the coolest thing I’ve seen all week. It makes you realise just how many people turned out to see the inauguration of President Obama.

Big Spike in Spam?

Has anyone else noticed a big spike in spam recently? In 2008 hardly any spam got past my filters, but in the first few days of 2009 I’ve managed to accumulate over 90 junk mails(!)

Grrrr… Zombie Processes From Apple Mail

I don’t know if anyone else has noticed, but as of the 10.5.6 update, Apple Mail now creates a zombie AddressBookSync process every time you send an e-mail.

If you send enough e-mails, you’ll find that your process table is full and your machine just won’t work properly.

Filed as rdar://6451715.

Finally Fixed One of Our Servers!

One of our servers has been playing up since back in June when something caused it to stop responding to Server Admin. The only hint was mysterious errors on the system console, such as

Jun 23 10:19:16 server servermgrd[303]: Got error -9845 for SSLHandshake
Jun 23 10:19:16 server servermgrd[303]: Exception in threadListen: Socket: Connect failed

Server Admin’s error message wasn’t much help either; it just insisted that there was no server at that address (not true).

In the end it turned out that a certificate, together with its private key, had somehow ended up in the System keychain. And servermgrd stupidly picks up any such certificate (presumably at random, as I certainly didn’t specify which one to use anywhere) and tries to use it when performing an SSL negotiation.

Deleting this rogue certificate from the System keychain seems to have fixed the problem and I can now admin the server again with Server Admin, rather than having to use the command line and a text editor.

Who’s Behind Macserialjunkie?

Thankfully for Mac developers everywhere, Macserialjunkie (aka MSJ) has been down for quite a few days now.

Interestingly, though, I notice that it’s now being hosted directly in IP space belonging to Infinite Technologies. For those who don’t know, Infinite Technologies are colluding with the people running MSJ. How do I know this? Well, because we complained about MSJ to the ISP that they were using, who told us that it was being hosted by one of their clients and passed on our complaint.

In response, I got an e-mail from Ganesh Rao, who styles himself “Head of Network Operations/Network Architect”:

Seems friendly enough, right? Well I explained what MSJ was and what id did and that I didn’t think that any ISP that claimed to be supportive of copyright should be hosting such a website. Ganesh replied:

I found that quite offensive—basically Ganesh Rao was calling me a liar—and I said so. Eventually the conversation ended with

Notice that the tone has changed completely. Originally Mr. Rao was trying to make it seem as if he had no relationship with Macserialjunkie. But in this final e-mail the relationship is obvious. He talks about how “we” have connections with multiple Swedish ISPs, and about how easy it would be to transfer the data over to one of them.

Anyway, after forwarding this to the upstream ISP, it seems that action was eventually taken to kick MSJ off the servers they were using. It has, of course, resurfaced, but this time at 94.100.27.140, which (surprise surprise) is registered to none other than Infinite Technologies and in particular Mr. Ganesh Rao:

OrgName:    RIPE Network Coordination Centre
OrgID:      RIPE
Address:    P.O. Box 10096
City:       Amsterdam
StateProv:
PostalCode: 1001EB
Country:    NL

ReferralServer: whois://whois.ripe.net:43

NetRange:   94.0.0.0 - 94.255.255.255
CIDR:       94.0.0.0/8
NetName:    94-RIPE
NetHandle:  NET-94-0-0-0-1
Parent:
NetType:    Allocated to RIPE NCC
NameServer: NS-PRI.RIPE.NET
NameServer: SEC1.APNIC.NET
NameServer: SEC3.APNIC.NET
NameServer: TINNIE.ARIN.NET
NameServer: NS.LACNIC.NET
Comment:    These addresses have been further assigned to users in
Comment:    the RIPE NCC region. Contact information can be found in
Comment:    the RIPE database at http://www.ripe.net/whois
RegDate:    2007-07-30
Updated:    2007-08-07

# ARIN WHOIS database, last updated 2008-11-23 19:10
# Enter ? for additional hints on searching ARIN's WHOIS database.
% This is the RIPE Whois query server #2.
% The objects are in RPSL format.
%
% Rights restricted by copyright.
% See http://www.ripe.net/db/copyright.html

% Note: This output has been filtered.
%       To receive output for a database update, use the "-B" flag

% Information related to '94.100.27.0 - 94.100.27.255'

inetnum:        94.100.27.0 - 94.100.27.255
netname:        INFINITE-TECH
descr:          INFINITE-TECH
country:        NL
admin-c:        ITGR-RIPE
tech-c:         ITGR-RIPE
org:            ORG-ITPL2-RIPE
status:         ASSIGNED PA
mnt-by:         ITECH-MNT
mnt-lower:      ITECH-MNT
mnt-domains:    ITECH-MNT
mnt-routes:     ITECH-MNT
source:         RIPE # Filtered

organisation:   ORG-ITPL2-RIPE
org-name:       Infinite Technologies
org-type:       OTHER
address:        Postbus 964
address:        5000 AZ, Tilburg
address:        The Netherlands
remarks:        +--------------------------
remarks:        Abuse Complaints = Email Only
remarks:        Technical Support = Email & Phone
remarks:        +--------------------------
abuse-mailbox:  abuse@infinitetech.in
mnt-ref:        ITECH-MNT
mnt-by:         ITECH-MNT
source:         RIPE # Filtered

person:         Ganesh Rao
address:        PO Box 964
address:        Tilburg, 5000 AZ
address:        The Netherlands
phone:          +31-(0)13-2202617
fax-no:         +1 (408) 856-2445
abuse-mailbox:  abuse@infinitetech.in
remarks:        +--------------------------
remarks:        Head of Operations
remarks:        Technical / Sales / Abuse Dept.
remarks:        +--------------------------
nic-hdl:        ITGR-RIPE
mnt-by:         ITECH-MNT
source:         RIPE # Filtered

% Information related to '94.100.16.0/20AS35017'

route:          94.100.16.0/20
descr:          PL-SWIFTWAY-20080709
origin:         AS35017
mnt-by:         swiftway-mnt
source:         RIPE # Filtered

Their new upstream ISP appears to be Swiftway, a Polish firm that for some reason uses a UK domain name for its site. It seems unlikely that hosting MSJ is something that is allowable under Swiftway’s Acceptable Use Policy, since it (MSJ) clearly is used “to distribute…material in violation of applicable law…in a manner that will infringe the copyright…of others”.

OpenRadar

OpenRadar (via Rentzsch) looks like a great way for us developers to share information about bug reports we’ve filed with Apple.

Or it would be if it weren’t falling foul of the limits on the Google App Engine beta :-)

Perverse

For some time now the government has been banging on at the banks to pass interest rate cuts on to consumers.

This, it seems to me, would be perverse (as indeed are interest rate cuts in the first place). We arrived in the current economic mess as a direct result of interest rates that were too low over a sustained period because of a failure to take into account the boom in the housing market, both here and in the United States; had the banks not been busy shifting the risk onto others, perhaps money would not have been lent inappropriately even under those conditions, but the combination of the two has turned out to be a disaster for the world economy.

The fix for these problems is twofold. It was clear that the only way to solve the crisis in the banking sector was recapitalisation, whether through mergers, takeovers, outside investment or—preferably as a last ditch alternative—state investment in banks. The alternative would be to allow banks to go bust, taking peoples’ savings with them; this is political suicide and therefore unthinkable to the modern political class, not to mention terribly unpleasant for the people whose money would be lost.

But the underlying problem of the overheating housing markets on both sides of the Atlantic can only be tackled by taking real estate prices into consideration when setting interest rates. And, to date, the Bank of England has still not been instructed to include house prices in the measure of inflation it is supposed to be working to keep at a low rate.

We should not be making rate cuts at the moment, let alone forcing lenders to pass on those rate cuts to consumers. To make rate cuts when the problem is excessive debt and when housing is still significantly overpriced is simply madness.

McCain Spam

Is anyone else receiving spam from the John McCain campaign? Thus far, my company has received no fewer than three spam e-mails from johnmccain.com (and yes, I’m pretty certain they originate with the McCain campaign itself, and not with some spammer out to discredit the Republican presidential candidate).

This is annoying for three reasons:

  • The e-mail address to which these are being sent cannot have been collected in a legal manner. Why? Because it’s one of our customer contact e-mail addresses, that’s why. We don’t give it out to people so that they can send us marketing e-mail.
  • We aren’t American. i.e. we don’t even have a blasted vote!
  • It’s illegal to send spam into the European Union. Yet here we have an example of the American establishment flouting E.U. law.

Anyway, Mr. McCain, whoever is doing your e-mail campaign is doing you and your party a disservice. Spamming people isn’t going to make them vote for you; it’s going to make them vote for someone else. Probably Barack Obama.

(Of course, some may say, well, so much the better. I don’t really have an opinion on who the United States should elect as their next president. I suspect it will be Obama, and I hope therefore that he turns out to be a good choice for the American people.)

Protecting MPs From Their Voters

It seems that over-the-top privacy “concerns” are now going to mean that we won’t know where our MPs live.

To my mind, this is highly undemocratic. If there is a problem with MPs’ security, we already have a solution—posting a policeman outside their home. But without knowing MPs’ home addresses, telephone numbers etcetera, there will be no way for their constituents to contact them in an emergency.

It seems to me that some MPs have forgotten that their primary duty is to serve their constituents, and that they are supposed to make themselves accessible, not inaccessible, to those same people.

If MPs are not going to be required to publish their personal contact details, then they should be required instead to provide a method of contacting them directly that is guaranteed to work 24 hours a day, 7 days a week, 365 days a year.

Running Xcode Unit Tests From the Command Line

For some time now, Xcode has included support for unit testing via an integrated copy of Sen:te’s OCUnit. On the face of it, this is a great feature as it lets you easily write unit tests and straightforwardly integrate them into the Xcode build process.

Unfortunately, there is very little documentation in Xcode itself relating to the unit testing feature. In fact, all I can find is the pointlessly short Xcode Unit Testing Guide.

It’d be really handy if the various STAssert macros were documented in the API documentation; constantly having to open up the SenTestCase_Macros.h header file is a bit of a pain, frankly. Since it’s now possible to put third-party docs into the Xcode Documentation window, perhaps someone will take the time to document the various macros?

But it isn’t nearly as much of a pain as the fact that there is no explanation anywhere of how to run your unit tests from the command line, or indeed how to debug a failing unit test.

Running otest from the command line

Trying to run a unit test from the command line can be a real headache. Especially if the machine you’re testing on happens to be 64-bit capable, because when you try to run otest from the command line, OS X will choose the 64-bit variant, which probably won’t match the test bundle. Either way, if you’ve tried this and you haven’t seen error messages like “no suitable image found” or “GC capability mismatch”, frankly you’ve been very lucky.

The best way to show how to avoid these problems is probably to give an example, so here goes:

<blockquote class=”code””> $ find . -name '*.octest'
./build/Debug/MyTests.octest
$ export OBJC_DISABLE_GC=YES
$ arch -i386 /Developer/Tools/otest ./build/Debug/MyTests.octest </blockquote>

The first line finds the test bundle. You don’t really need to do this every time (or at all, if you know where it is already).

The second line disables GC; this is optional, but if the code you are testing doesn’t support GC and the version of otest on your system was build with GC enabled, you need to disable it as shown here or you’ll get a “GC capability mismatch” error. If you’re seeing “GC capability mismatch” and your code is build to require GC, you probably need to update your version of Xcode (3.1.1 comes with an otest that does work with GC) or if that isn’t an option you could build a suitable otest binary yourself.

The third line is where things really get interesting. You can’t rely on just running otest, since the system you’re running on might choose the wrong architecture for your test bundle. Fortunately Apple has provided the arch command (see man 1 arch), which lets you ask for a particular architecture when running something from the command line. In the example, I asked for 32-bit x86, but I might just as well have asked for any number of other things.

If you’re unlucky enough to be trying to debug a framework unit test, you’ll also be having problems at this point with the system not finding the framework. To fix this, you can add something like

$ export DYLD_FRAMEWORK_PATH=`pwd`/build/Debug

to the above set of commands.

Running your unit tests in GDB

OK, so we know now how to run the unit tests from the command line. How do we get them to run in GDB? Simple. Something like

$ gdb -arch i386 /Developer/Tools/otest GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries ...... done

(gdb)

Notice the -arch i386 at the top… that sets the architecture, which you need to do at the GDB command. Then we proceed as before, but this time using GDB commands rather than shell script

(gdb) set environment DYLD_FRAMEWORK_PATH=/Users/alastair/Source/UnitTestTest/build/Debug
(gdb) set environment OBJC_DISABLE_GC=YES
(gdb) set args ./build/Debug/MyTests.octest
(gdb) run

Again, the DYLD_FRAMEWORK_PATH and OBJC_DISABLE_GC steps are both optional and whether you need them or not depends on your particular circumstances.