Mavericks, OS X Server, and CalDAV

Well, that's inconvenient. I didn't set up an email address for my local sync user.

Pasted Image 11 5 13 1 24 PM 3

Happily, changing account type to Manual allows one to specify a username and a server address.

Pasted Image 11 5 13 1 26 PM 2

Now to follow Jay's advice from Setting up your own sync server: Export existing iCloud-synced calendars one by one, then import them into the new local server.

Mavericks, OS X Server, and local sync accounts

I've installed OS X Server under OS X 10.9. Among other uses, I wanted to use it for local sync of contacts and calendars, in place of iCloud.

For the most part I've followed the beautifully clear instructions posted at securityspread.com (Setting up your own sync server). Everything has worked as documented, right up to the point in Configuring OS X to connect and sync with the server where Jay writes

[...]select ‘All on My Mac’ (this is where all the originals should be), select all of your contacts and drag them to ‘All OS X Server’.

Whenever I would drag to 'All OS X Server', the green "+" badge would not appear on the drag icon. I could not drop my local contacts onto the "All OS X Server" group.

Eventually it occurred to me to try to set up a CardDav account – the approach described in the section on configuring an iOS client. So, instead of adding a new OS X Server account, I'm doing as follows:

In System Preferences > Internet Accounts, select "Add Other Account...". Then instead of selecting "Add an OS X Server account", select "Add a CardDAV account".

Add A CardDAV account 8

In the resulting sheet, enter the account information much as you would have done when adding an OS X Server account.

Pasted Image 11 5 13 1 00 PM 5

Go ahead and create the account. You may get a warning about being unable to verify the identity of the server, if you're using a self-signed certificate like I am. If this happens you can click "Show Certificate" and, opening the Trust section, explicitly trust the certificate.

Pasted Image 11 5 13 1 04 PM 2

Click Continue to add the account.

With the new account in place, quit System Preferences. Launch Contacts. You should see a new group with the local name of your server. Better yet, you should be able to drag contacts from "All on my Mac" and drop them onto your new server account.

I haven't gotten around to trying a similar workaround for the OS X Server Calendar service. Here's hoping it works just as well.

OS X Server.app and pre-existing PostgreSQL Installations

This one is for everybody doesn't like to read documentation. (Or, at least, for me.)

I recently got a copy of OS X Server, hoping to use it to set up an Xcode CI server. From past projects I had PostgreSQL 8.4 running on the localhost, listening on port 5432.

When I first launched Server.app it would display a setup dialog. Then it would hang for about an hour saying that it was "Preparing Services". Finally it would say that an error had occurred. Thereafter the app would respond very sluggishly to almost every user interaction.

ps showed a few Python processes, all of them trying to connect to a PostgreSQL server. Eventually I remembered my ancient PostgreSQL server.

I exited Server.app, ignoring its warning that it was busy, and moved it to the Trash. A few seconds later an alert appeared recognizing the trashing of the app and reporting that it had been uninstalled (or words to that effect).

With that done, I stopped my postgresql installation via launchctl. Then I moved /Library/Server to /Library/Server.save/, put back Server.app from the Trash, and launched it again.

Things went much better this time.

I should probably have completely removed my postgres installation just to make sure that OS X Server didn't find it by mistake. One step at a time...

Xcode 5 - a profusion of provisioning profiles

When I upgraded to Xcode 5 I was very disturbed to discover that all of my old provisioning profiles, many of which I'd long since deleted from the app store, were suddenly re-appearing. I couldn't make them go away. All of them showed in the provisioning portal as "managed by Xcode 5".

And those old profiles were updated to include every device that I'd registered in the portal. Egad!

It seemed almost as if Xcode 5 were using Spotlight to find .mobileprovision files no matter where they might be hiding, and to bring them back to life.

I'm not sure I've fixed the problem, but so far this procedure appears to have worked:

  1. In Xcode 5's Organizer, review all provisioning profiles installed on your development devices. Delete those you no longer want.
  2. Quit Xcode 5.
  3. Using spotlight search, find all .mobileprovision files on the development machine.
  4. Trash every old .mobileprovision file.
  5. Empty the trash.
  6. Using Safari, login to the developer portal. Delete every provisioning profile that you don't want to keep.
  7. Restart Xcode 5.
  8. Open preferences.
  9. Open each of your Apple IDs, and View Details.
  10. Refresh the Provisioning Profiles.

iOS 6, initially hidden status bars, and UITabBar clipping

My app has a tab bar as its main view. Its status bar is hidden at app launch, via an Info.plist entry:

    <key>UIStatusBarHidden</key>
    <true/>

When the app finishes launching, the app delegate makes the status bar visible.

    [application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];

Unfortunately, this causes the content of the tab bar's current view to extend under the status bar.

Extending under status bar

And there it stays until the app is rotated.

I tried to fix this by resetting the main window frame as soon as the status bar was made visible:

    self.window.frame = [[UIScreen mainScreen] applicationFrame];

This worked, but only until the app was rotated. If the app was initially in portrait orientation, then rotating to landscape and back to portrait caused the tab bar's view to shift downward 20 pixels -- the status bar height -- so the bottom of the tab bar was clipped.

Clipped tab bar

Happily, a discussion on Stack Overflow triggered a head smack: I was changing the frame too soon. I should have been subclassing UITabBarController, overriding viewDidAppear:, and adjusting the view's frame there:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    self.view.frame = [[UIScreen mainScreen] applicationFrame];
}

Problem solved. Thanks again, Stack Overflow.

"Invalid use of NULL Value", MySQL and RoR Migrations

Today I was working with a Ruby on Rails application, configured to use MySQL 5.6.10, that kept failing to perform a column-modifying migration:

class SomeModel < ActiveRecord::Migration
 def up
   change_column(:some_models, :some_value, :integer, default: 0, null: false)
 end

 def down
 end
end

The error message, from the Mysql12 adapter, was "Invalid use of NULL value".

Using the test database I could change the schema manually, from the MySQL prompt. But I couldn't do so in the development database. As is typical, the test database held no records. That should have been my clue.

Eventually I realized that in the development database the "some_models" table contained many records, at least some of which held NULLs for "some_value".

After performing a manual update:

update some_models set some_value = 0 where some_value is null;

I was able to run the migration.

[Edited 20130822 for typos]

SQL 2008 R2 - Uninstall of SQL fails with error about RsFx Driver or Common Files still being installed

I've been trying to re-install a stack of MS SQL Server installations, from 2005 to 2012, with no luck. "Uninstall" of MS SQL Server 2008 kept failing because "the following products are installed:"

Microsoft SQL Server 2008 R2 RsFx Driver

Of course the RsFx (Report Streaming?) driver showed up nowhere in the list of installed programs.

This post solved my problem:

SQL 2008 R2 – Uninstall of SQL fails with error about RsFx Driver or Common Files still being installed:

"Option B – Get the product GUID (Identifying number) from WMI using WMIC and uninstall using MSIEXEC /X {GUID}

"

I had trouble reading the text describing the actual shell commands to use, because it rendered white-on-white in my browsers (Safari, Google Chrome). Happily it was easy enough to just select the region with the mouse and paste into a plaintext text editor buffer :)

Climate Predictions: Worst-Case May Be Most Accurate, Study Finds

Here's more about the research predicting "higher end" temperature increases.

Climate Predictions: Worst-Case May Be Most Accurate, Study Finds:

"Hovering several thousand feet above Earth's surface, in the troposphere—the part of the atmosphere where clouds can form—dry zones play a primary role in the future climate.

The scientists compared the observed relative humidity in the dry zones to 16 different climate models used in the most recent study by the Intergovernmental Panel on Climate Change.

Since we don't have good ways to observe or predict how clouds will form, focus instead on relative humidity, which we can observe. How well do the climate models predict the relative humidity data that has actually been observed?

Fasullo and Trenberth found that the three models that best matched the humidity observations were the same ones that predict the hottest future, with temperatures increasing 8 degrees F before century's end. The least accurate models overpredicted relative humidity and projected lower increases in temperature. Fasullo used the analogy of an eye: 'The dry zones are like the iris of the climate system. With warming, the iris dilates, decreasing cloud cover and allowing in more heat.' Models that don't provide for that expansion of the dry zone fail to accurately depict observed data, he explained."

The article ends with a small equivocation:

Karen Shell, a climate scientist from Oregon State University who was not involved in the research […]: "It's a promising technique. It's one study, but if this relationship holds up, it implies the climate sensitivity is on the higher end of the range."