Accessing my iCloud Calendar from within Google Calendar was a major issue since my move to iCloud. Having said that, it’s not even my own “Backup” setup on Google Apps that bothers me that much, it’s more about sharing my calendar with other family members that are not using iCloud.

Getting Access – the easy part

Getting access itself is, despite one small caveat, the easy task. You’ll have to publicly share your calendar. WIthout public sharing only iCloud users will be able to access your calendar. Despite the fact that you’ll share your calendar with the world – that’s a minor pitfall to take.

Getting Access – the problem …

However, if you now try to access your calendar from Google (replacing webcal:// by http://), you’ll be presented with the following error:

Screen    Shot 2011 11 08 at 21 06 19

The iCloud servers seem to prevent access from Google – probably mainly to avoid the Google servers crawling all public calendars, but with the drawback of keeping us from accessing our calendar. After a [post in the iCloud]{https://discussions.apple.com/message/16617386#16617386} forums I don’t have much confidence this will be fixed soon … 

Solution 1 – the PHP script

So, I thought there must be an easier way than relying on Apple to fix the problem. Actually, there were 2 solutions that came to my mind:

  • Apache Reverse Proxy
  • A PHP script

Saying that I know that the majority of people doesn’t have an own (V-)Server to run an Apache instance they can actually configure. However, there are plenty of (free) providers that allow you to run PHP scripts.
The following script gets the calendar (via the public URL) from iCloud and presents it in a way that Google Calendar will be able to access it:

{% highlight php %}
“);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

// grab URL, and return output
$output = curl_exec($ch);

// Send the header based on the response from the server
header(‘Content-type: text/calendar’);
header(“Cache-Control: no-cache, must-revalidate”);

// HTTP/1.1
header(“Expires: Sat, 26 Jul 1997 05:00:00 GMT”);
// Date in the past

// Send the curl output
if (empty($output))   
echo var_dump($output);
else
    echo $output;

// close curl resource
curl_close($ch);

?>
{% endhighlight %}

Solution 2 – mod_proxy

The even easier solution (as long as you’ve got your own configurable Apache instance) is using mod_proxy to use a simple HTTP Reverse Proxy to get the feed from the Apple Servers and redirect it. One pitfall though is that the iCloud access strictly requires https access, so we’ll have to configure apache for ssl as well. This example is based on a RedHat 5.4 system, so adapt accordingly …
 
First, install apache2 and mod_ssl
{% highlight bash %}
yum install httpd mod_ssl
{% endhighlight %}

Next, we’ll configure the SSL Engine:
{% highlight bash %}
vi /etc/httpd/conf.d/ssl.conf



SSLProxyEngine on
SSLOptions -StrictRequire

{% endhighlight %}

Having configured https and enabling the SSL Proxy option, we can now go ahead an get the actual ReverseProxy working:

{% highlight bash %}
vi /etc/httpd/conf/httpd.conf
{% endhighlight %}

Add the following lines to the end of the file:
{% highlight bash %}
ProxyRequests   off
SSLProxyEngine  on


   Order deny,allow
   Allow from all

Set TCP/IP network buffer size for better throughput (bytes)

ProxyReceiveBufferSize 4096

ProxyPass /ical/ https://p03-calendarws.icloud.com/
ProxyPassReverse /ical/ https://p03-calendarws.icloud.com/
{% endhighlight %}

Now, start the apache process:

{% highlight bash %}
/etc/init.d/httpd start
{% endhighlight %}

You can now access your calendar by replacing the webcal://p03-calendarws.icloud.com/ part of your public URL by http(s)://yourserver/ical/, making is something like http://yourserver/ical/ca/subscribe/1/pY7JHjsAi

Ever since I upgraded to MacOS 10.7 (or OS 10.7 as you’d call it nowadays) I noticed my machine periodically waking up from sleep without turning on the Monitor – and going back where it came from. While it’s not a big deal, it is kind of annoying, so I wanted to get rid of it. A quick search for “wake reason” in Console revealed at least parts of the issue:

01/11/2011 06:14:13.000 kernel: Wake reason: RTC (Alarm)

After a quick search I found the Knowledge Base Article that describes exactly my problem: About Wake on Demand

The reason for this odd behaviour is the Bonjour Sleep Proxy that is used to periodically advertise services of the machine to the network. While I had this turned off in 10.6, is was set to on automatically when I upgraded to 10.7. To shorten the article, the solution is to disable “Wake on Network Access” in the Energy Saving options.

Given the fact that most companies still use Microsoft Exchange as their preferred E-Mail and Collaboration solution, we (running Linux and/or MacOS) see ourselves confronted with the same problem: How to get E-Mails and Calendar entries with the least possible pain.

I want to share my current, well working, setup with you.

Choosing a client

I’ve chosen Mozilla Thunderbird as my preferred client on the Linux desktop for E-Mail and Calendar.

E-Mail

I went for the usual setup: IMAP and SMTP directly to the Exchange server. The only (at least known to me) area where this damn thing is actually standards compliant.

Calendaring

I use the Exchange Data Provider for Lightning for calendaring. Works like a charm. After using DavMail with all the ups and downs this is the most stable solution I’ve used so far on Linux. Can only recommend it.

Calendar syncing

This goes for Google Calendar and/or iCloud. Syncing is a major factor for me as I want to have at least read-only access on my work calendar while I’m on the road.

Also, I went for an extremely straight-forward setup. Using the Automatic Export Plugin for Thunderbird I just let it put a copy of my calendar exported to ICS into my Public folder in Dropbox. Using the “Public URL” feature I then subscribe to the calendar in read-only mode from Google Calendar and iCloud.

That’s it! The easiest to configure and maintain setup I ever had. Man am I happy 🙂

For RedHat System which are not connected to the internet, it’s good to have a local dvd as an installation source. Here’s how to do it:

First, mount the Installation DVD:

mkdir /media/cdrom && mount /dev/cdrom /media/cdrom

Now, let’s quickly create an entry in /etc/yum.repos.d/ that points to your dvd

cat >/etc/yum.repos.d/rhel_dvd.repo <<EOF
[dvd]
mediaid=$(head -n1 /media/cdrom/.discinfo)
name=RedHat Enterprise Linux $(sed -n '2p' /media/cdrom/.discinfo | rev | cut -c -3 | rev) DVD
baseurl=file:///media/cdrom/Server
EOF

That’s it! Now you can use the following command to install packages without contacting RedHat Network:

yum install strace --noplugins

For further information, visit the Official RedHat Article.

max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

$ sysctl -a | grep shm
 vm.hugetlb_shm_group = 0
 kernel.shmmni = 4096
 kernel.shmall = 4294967296
 kernel.shmmax = 68719476736

So we have a maximum of 4096 shared memory segments, 128 Semaphore Arrays and 250 Semaphores per Array available. Looks reasonably good so far.

The most concerning parameter in terms of DB2 is this one, and that goes well together with the msgget() system call:

max queues system wide = 16

According to the DB2 Documentation, the maximum number of message queues (MSGMNI) has to be set to at least 16384. Also, the maximum number of Semaphore Arrays should be 1024.

OK, let’s do it:

sysctl -w kernel.msgmni=16384
sysctl -w kernel.sem="250 32000 100 1024"

Et voila, it’s working:

$ db2 connect to INSTANCE




Database Connection Information




Database server = DB2/LINUXX8664 9.7.1
 SQL authorization ID = USER
 Local database alias = INSTANCE

Now, let’s make the change persistent:

echo "kernel.msgmni=16384" >>/etc/sysctl.conf
echo "kernel.sem=\"250 32000 100 1024\"" >>/etc/sysctl.conf

That’s it! Now your DB2 adventures can begin …

Note: Please see the [official DB2 documentation]((http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.qb.server.doc%2Fdoc%2Ft0008238.html).

After switching to Ubuntu 11.04 from Fedora 15 I noticed that I wasn’t able to connect to our internal Citrix environment using ICAClient. Having followed the usual documentation (listed below) I was presented with the following:

*** glibc detected *** /usr/lib/ICAClient/wfica: free(): invalid next size (fast): 0x09c6e8b0 ***
      ======= Backtrace: =========
      ...
The process is actually core-dumping in libproxy.so:

Program terminated with signal 11, Segmentation fault.
      #0  0xf70d8f72 in nbc_connect () from /usr/lib/ICAClient/libproxy.so
      (gdb) bt
      #0  0xf70d8f72 in nbc_connect () from /usr/lib/ICAClient/libproxy.so
      #1  0xf70cd4d6 in NullConnect () from /usr/lib/ICAClient/libproxy.so
      #2  0xf70ce6cd in ProxyConnect () from /usr/lib/ICAClient/libproxy.so
      #3  0xf70ce8b1 in PROXYconnect () from /usr/lib/ICAClient/libproxy.so
      #4  0xf70d8764 in IPSTACKconnect () from /usr/lib/ICAClient/libproxy.so
      #5  0x080c3757 in ?? ()
      #6  0x080c2518 in ?? ()
      #7  0xf70c094a in ?? () from /usr/lib/ICAClient/PDCRYPT1.DLL
      #8  0x080c060a in WdSetInformation ()
      #9  0x080ffd8a in wdConnect ()
      #10 0x08100f9b in NCSbind ()
      #11 0x08077d09 in OldMain ()
      #12 0x08137f4a in PlatAppMain ()
      #13 0x080feda6 in AppMain ()
      #14 0x08137eda in main ()

However, Library dependencies on the libproxy.so looked fine:

$ ldd /usr/lib/ICAClient/libproxy.so
      linux-gate.so.1 =>  (0xf7732000)
      libc.so.6 => /lib32/libc.so.6 (0xf7594000)
      /lib/ld-linux.so.2 (0xf7733000)

In the strace output I could see it was trying to parse a proxy configuration – having already unset all proxy variables (http_proxy, https_proxy, ftp_proxy) I was wondering where he was trying to get the proxy configuration from. The following line was the important one:

[pid 15818] open("/home/i064850/.mozilla/firefox/cuqn88q3.default/prefs.js", O_RDONLY) = 5

It was actually trying to get my proxy configuration from my Firefox Preferences! While one could argue about this decision, it seems to cause my issue – because after moving the .mozilla folder, wfica was finally able to connect!

In the end I found out that this is an issue if you use Automatic Proxy Configuration in Firefox together with the Citrix ICA Client. Once you either deactivate or manually specify the proxy setting, it magically works.

I still have to find out where to submit a bug report for ICAClient – probably nowhere …

[Edit] Bug report posted

References: The Ubuntu ICAClient HowTo