The first thing you should do on a new Mac

The very first thing you should always do on your new Mac is to make sure you run as non-admin. This protects you against most malware out on the net, since it makes it very difficult to install anything without you knowing about it. It doesn’t exclude it entirely, but it makes a major difference.

Continue reading “The first thing you should do on a new Mac”

Macport and mono

Just a heads-up: Macport quit working on my machine. Link errors, missing architecture in sqllite3 dynamic libs or something. After much agonizing, I began to suspect mono, especially since the sqllite3 library port wanted to link against was in the mono path. There’s a shell script in mono called uninstallMono.sh that does a fine job of getting rid of it. Run that, and things work fine again.

I’m guessing the mono libraries are simply put in too early in paths, which may cause the problem, but since I’ve got actual work to do, I’ll just roll my eyes and get on with life.

Update: the above did solve most of my problems, but not all. After perusing more forums than I’d like to peruse, I hit on a remark from one of the Macport developers that you should always reinstall the entire Macport system after every major OSX upgrade. In other words, I installed my Macport under Leopard, then upgraded to Snow Leopard, so it got unhinged. The solution is to entirely remove the /opt/local directory contents, then reinstall Macport from source. Personally, I find it a little bit scary (like, is Macport really the only system using opt/local?) so I tarballed the directory first, just in case. But I don’t think that is necessary, but time will tell.

Anyway, after reinstalling Macport this way, the rest seems to have straightened itself out.

If all else fails, try Preview

I’m totally amazed at all the things Preview does in OSX Snow Leopard. I already use it for knocking out backgrounds, using the “Instant Alpha” tool in the “Select” dropdown. But what happened today is more interesting.

To my everlasting regret I got me a Canon Lide 60 scanner a couple of years ago. Canon’s hardware is pretty nice, but their driver support stinks, especially for OSX. This scanner costs me on average much more work than it should to keep going. Same for my Pixma 5200 Canon printer, by the way. Awful.

Anyway, I needed to scan a page from a mag to show on a slide. Hooked up the scanner, tried Canon Toolbox, and sure enough “Failed to open driver”. Internet next, user groups, downloads, complicated shit about uninstalling, reinstalling, rebooting the Mac Pro ten times. No joy. After a few hours (!) of this, I got an inspiration: hey, since I saw “Twain” mentioned, maybe Acrobat Pro 9 (CS4) could import it, instead of using Canon Toolbox? Sure enough, Acrobat found the scanner, looked it over, and promptly crashed.

And then I got my second inspiration: check out OSX Preview. And yes, that one worked. Not only that, but it automatically calibrated the scanner, proceeded to analyze the page, divided it into sections, scanned it, and served it up already partitioned into useful chunks. See the screenshots below. All the time I was just sitting there watching, doing nothing. The only thing I had to do was select the image and hit cmd-R twice to turn it the right way up.

Jeez, that innocent looking little Preview app is becoming mighty useful for any number of things.

I probably should mention that the driver I installed came in a file called “lide60osx11131en.dmg” to be found, somehow, on Canon’s support site. It installs both the drivers and the toolbox, but the toolbox doesn’t work.

OSX Mail and IMAP tamed

Oh, boy, this wasn’t easy. I’ve been trying for years to get my email life organized. The problem is this:

  • I’ve got almost ten different email accounts
  • I subscribe to tens of mailing lists
  • I want mailing lists to be automatically moved to dedicated folders
  • I want the same folder setup on different machines
  • I want messages read on one machine to be marked read on all the others
  • I used three different Macs to read mail on
  • I want to be able to get at both inboxes and discussion list folders even through webmail
  • I want all mail to be available offline as well
  • I don’t want to depend on my web host to not lose my saved mail
  • My regular inbox should only contain stuff I need to act on, everything else is either deleted or moved to a single (or possibly a few) archive folder
  • That archive folder must automatically be available and updated on all my machines and webmail client
  • Oh, I almost forgot: everything should be available on the iPhone as well, of course

Hey, that’s not too much to ask, is it? But until now, there was always something screwing it up. Now I think I’ve got it beat. Since I didn’t find all that much on the ‘net about this, but I did find little scraps here and there, I figured I ought to collect my notes here for posterity. Everything that follows was done on Snow Leopard, both client and server side.

Step 1 – Make it all IMAP

First things first. Change all your accounts in OSX Mail to IMAP. There’s no way to do this with POP3 access. I’m not going to describe how to do this, since it’s not rocket science and no secret tricks are involved. Take care so you don’t lose messages, though. (Not that I know why you should, but I felt I didn’t want to take responsibility if you found a way to screw up the only storage you had of those priceless emails.)

Step 2 – Get yourself an OSX Server

Not as bad as you might imagine. The Apple Mini OSX Server is pretty cheap. Set it up as safe as possible, using mirrored drives. If you have a NAS with RAID, you could set up iSCSI to that. I’m not going into this here either, it’s a separate subject, but I will assume you have an OSX Server at least. Most of what I’m telling you below can also be done on a webhost, but I didn’t want to have maybe gigabytes of mail storage entrusted to some cheapo webhost out there. But you decide, of course.

Step 3 – Enable webmail on your OSX Server

Since OSX Mail doesn’t seem to allow folder management under IMAP, that is, there is no way I can see that allows you to add new IMAP folders server-side, you need to do that using webmail. You only need it when adding or removing folders, not a daily thing.

Assuming you have your user account on your OSX Server, that your DNS is set up right and that you can access your email account on the OSX server over IMAP, you now have to enable webmail on that server. That isn’t in the most obvious place, so I took a screenshot to help you find it (click image for full size):

Server Admin screenshot for setting web services

You have to check the “Mail” checkbox. Actually, I didn’t do that here, I selected the “default” on port 443 (upper pane) and checked it there, so that webmail is only available over HTTPS, not plain HTTP:

Step 4 – Create your folders

Via a browser, log in to your webmail account on the OSX Server. It does come with SquirrelMail already installed and running (if you did step 3 at least). Once in SquirrelMail, click the “Folders” link and you get the following screen:

The first field lets you create a folder. Leave the “as a subfolder of” set to “INBOX”, that’s a pretty good choice. It may not seem all that intuitive, but the OSX Mail client will not show these contents as part of the regular collection “Inbox” even though it’s a subfolder, so leave it set that way. As you create subfolders, you see them in the left listbox down below.

When you return to the main screen in SquirrelMail and refresh the folders (click “check mail”), you’ll see this:

…which doesn’t seem right. It looks as if your new folders are children under “Sent Messages”, but that’s just an interface bug in SquirrelMail. Don’t worry about it.

Step 5 – Back to OSX Mail

Just quit OSX Mail and restart it, it’ll find the new folders. Now, if it doesn’t, check the IMAP Path Prefix field, which you can find if you go to preferences, accounts, select the account, then go to the “Advanced” tab:

If it says “INBOX” in that field, just empty it and try saving, quitting and restarting OSX Mail. I’m not sure if it should or should not have the “INBOX” set there, but try either way if you have a problem.

Step 6 – Rules

Now comes the fun part. You can set up mail rules in the OSX Mail client that move messages into one of the new subfolders you created, even though the original mail came in on another mail account. Think about this for a while until it sinks in. The rules let you move messages from one IMAP server to another, not just between folders on the same server or you client machine.

So, I’ve got mail rules that sorts mail coming in on several different IMAP accounts. As they match different rules, these messages are effectively moved from the original IMAP server somewhere in the USA to my own IMAP server in the backroom, and all those sorted messages are now available in real time from all my Macs and my iPhone (and iPad once I have one). I do have public IPs, so my OSX server is available to me from anywhere, which helps, of course.

You can still easily see where the messages originated, since the “To:” field does not change when you move the messages. If you open a message in the common archive and click “Reply”, OSX Mail client will automatically select to reply from the account the message was originally sent to, not from the account that your archive is in. Exactly as I’d want it to.

Oh, wait, there’s more

I can easily add another IMAP account that is shared with coworkers, and move or copy messages there, manually or automatically, say for support or some mailinglist I want to share with them all. Think about that for a sec.

It becomes even neater if you have MobileMe and you have set mail accounts and mail rules to synch across your machines. I don’t even need to set up the rules as they change. I change them on any one of the machines, and the other machines update the rules. I may, occasionally, have to enable the rules (I don’t know why), but their content is updated.

This is so cool.

Update: You can actually create the IMAP folders just as easily from inside OSX Mail. Just go to the right IMAP account in the side panel, then click the “+” down on the left, select “New Mailbox” and if you scroll far enough, you’ll find your IMAP accounts if one is not already selected. Select one of those and you can create a folder on the IMAP server. It was too obvious for me, I guess.

3.3.1 with a twist

The by now famous paragraph 3.3.1 in the iPhone Developer Program License Agreement for iPhone OS 4.0 says that “Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited”. Which, of course, ruins the day for Adobe and Flash CS5. The idea was to have Flash scripts run on the iPhone on just such a compatibility layer.

The theories as to the reason why are, generally speaking: f*ck Adobe, preserve performance on the iPhone and iPad, and/or make multiprocessing efficient on these devices. With regard to that last, the theory goes that the OS figures out how the app works and hooks into the app and the app framework, but if there’s a compatibility layer in between, that becomes very difficult and inefficient. Actually, purely technically, without any fanboyisms, it does make sense to me.

In that case, and reading the 3.3.1 literally, nothing stops me, or Adobe, from implementing a translation from our own specific languages using a precompiler, as long as you end up compiling actual Objective-C code using XCode into the app. That’s what I would do, and I find it a better solution, anyway.

But the anti-Adobe conspiration theorists may claim Apple doesn’t want you to do this, either. I don’t know if they do, but let’s assume.

Now it gets interesting. There is no way that Apple can detect from the runtime code, or even the source code, that the code has been produced by a precompiler, if that precompiler does a decent job. If they want to stop that from happening, they’ll have to monitor the user’s machine for precompilers and editing tools, like World of Warcraft is monitoring for bots. What a fascinating circus that would be.

Subversion server on Snow Leopard server

As I already bragged about, I got me one of those delicious little OSX Mini Snow Leopard Server boxes. So sweet you could kiss it. I just got everything together to make it run a subversion server through Apache, too, and as a way to document that process, I could just as well make a post out of it. Then I can find it again later for my own needs.

First of all, subversion server is already a part of the OSX Snow Leopard distribution, so there is no need to go get it anywhere. Mine seems to be version 1.6.5, according to svnadmin. Out of the box, however, apache is not enabled to connect to subversion, so that needs to be fixed.

We’ll start by editing the httpd.conf for apache to load the SVN module. You’ll find the file at:

/etc/apache2/httpd.conf

Uncomment the line:

#LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so

Somewhere close to the end of the file, add the following line:

Include "/private/etc/apache2/extra/httpd-svn.conf"

Now we need to create that httpd-svn.conf file. If you don’t have the “extra” dir, make it, then open the empty file and add in:

<Location /svn>
  DAV svn
  SVNParentPath /usr/local/svn
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /private/etc/apache2/extra/svn-auth-file
  Require valid-user
</Location>

Save and exit. Then create the password file and add the first password by:

sudo htpasswd -c svn-auth-file username

…where “username” is your username, of course. You’ll be prompted for the desired password. You can add more passwords with the same command, while dropping the -c switch.

Time to create svn folders and repository. Create /usr/local/svn. Then create your first repository by:

svnadmin create firstrep

Since apache is going to access this, the owner should be apache. Do that:

sudo chown -R www firstrep

Through Server Admin, stop and restart Web service. Check if no errors appear. Then use your fav SVN client to check if things work. Normally, you’d be able to adress your subversion repository using:

http://yourserver/svn/firstrep

Finally, don’t forget to use your SVN client to create two folders in the repository, namely “trunk” and “tags”. Your project should end up under “trunk”.

Once up and running, this repository works perfectly with Panic’s Coda, which is totally able to completely source code control an entire website. If you don’t know Coda, it’s a website editor of the text editor kind, not much fancy graphic tools, but it does help with stylesheets and stuff. It’s for the hands-on developer, you could say.

The way you manage a site in Coda is that you have a local copy of your site, typically a load of PHP files, which are version controlled against the subversion repository, then you upload the files to the production server. Coda keeps track of both the repository server and the production server for each site. The one feature that is missing is a simple way of having staged servers, that is uploading to a test server, and only once in a while copy it all up to the production server. But that can be considered a bit outside of the primary task of the Coda editor, of course.

You could say that if your site isn’t mission critical, but more of the 200 visitors a month kind, you can work directly against the production server, especially since rolling back and undoing changes is pretty slick using the Coda/subversion combo. But it does require good discipline, good nerves, and a site you don’t really, truly need for your livelihood. You can break it pretty bad and jumble up your versions, I expect. Plus, don’t forget, the database structure and contents aren’t any part of your version control if you don’t take special steps to accomplish that.

Coda doesn’t let you access all the functionality of subversion. As far as I can determine, it doesn’t have provisions for tag and branch, for instance. But it does have comparisons, rollbacks and most of the rest. The easiest way to do tagging would be through the command line. Or possibly by using a GUI SVN client, there are several for OSX. I’m just in the process of testing the SynchroSVN client. Looks pretty capable, but not all that cheap.

The cutest little muscle machine ever

I got me that brand new Apple Mini with Snow Leopard OSX Server unlimited edition included. This is such an adorable machine, you wouldn’t believe it. It has everything you can wish for in a server, as far as I can make out after just a couple of hours with it. It’s super easy to set up and to monitor. It’s small, it’s beautiful, it’s almost totally noiseless, and seems to use hardly any power. When you feel the case, it’s just barely warmer than the environment and the same goes for the power supply. When I switch off everything else in the room, I can only hear the server running from less than a meter’s distance. It seems to produce about the same noise level my 13″ white MacBook does when it’s just started and perfectly cool. In other words, practically inaudible. Still, it’s running two 500 Gb drives in there, which I’ve set up as a mirrored (Raid 1) set.

I’ll probably brag about this system some more once I get to know it better. But meanwhile, it’s the nicest computer purchasing experience I’ve ever had. Except for the Mac Pro. And the MacBook. And the iMac, of course. And the iPhone. And Apple TV.

server_dimensions_20091020

What a strange piece

Can’t help commenting on this opinion piece on TechRepublic: The Apple Tablet will disrupt Apple’s device momentum. Just a few choice quotes:

… 1) providing good entertainment; and 2) providing flexible input and output. The success of the iPhone illustrates how correct I was in the first point. It stumbled into the entertainment angle.

Yes, sure, Apple “stumbled” into success.

In fact, every key innovation in PC technology for the past 30 years has been driven by gamers, but Microsoft, HP, and everyone else – including Apple with its largely accidental success with the iPhone – have ignored this in the portable electronic device market. And the whole time, I feel like I’ve been jumping up and down, screaming, “Deliver the games, become the dominant games delivery system – and the rest will follow!”

You didn’t scream loud enough, did you? Oh, btw, me and a lot of other people I know buy iPhones for other reasons than games, like for their business and connectivity apps, you know? Haven’t heard of those yet? Maybe if you stopped jumping up and down and screaming for a sec, you’d hear us talking about that.

“Take my word: The super-hyped Apple Tablet – which is supposed to be a convergence of the iPhone, the Apple Mac, and the netbook phenomenon – is going to be a failure”

What Apple Tablet? Nobody has seen one, but you already know what it’s going to be and even why it will ultimately fail.

Why will the Apple Tablet fail? The one thing consumers don’t want is another gadget that ultimately does the exact same thing as several other gadgets they already own, especially one that requires all kinds of contortions to move legally-licensed and legitimately-owned content around from device to device.

Yes, especially as Apple is known for making their users buy media again and again every time another product of theirs comes on the market. Like the last time people bought all their media on the Play-For-Sure system only to discover that it wouldn’t play on the new generation Apple Zune. We’re not going to walk into that trap again, are we? When will Apple finally learn to treat their customers with respect, like Microsoft does with their iTunes, which is not only DRM free but works across devices without new purchases being required.

Oh, wait, did I get that backwards?

Then I just skimmed through the rest, but if you feel like being abused by more of that bad thinking, please head over there and enjoy some more of these “insights”.

Anything but games are illegal?

I’m having this most surrealistic dialog with a very agreeable iTunes support person, about invoicing. The thing is I bought a few apps from the iTunes app store, among which Omni Focus for the iPhone, but the invoice (or “receipt”) I got from Apple doesn’t mention sales tax at all. Just the net amount in Swedish crowns. It is, however, correctly addressed to my company.

As practically anyone realizes, this is super weird and means I can’t recover the sales tax when I enter this document into my accounting. So I wrote to iTunes support and asked for a correct invoice. The ensuing conversation follows (I took out the name of the iTunes representative).

Continue reading “Anything but games are illegal?”