PHP’s Frustrating Flush

PHP not listening when you try to flush data. Try the following, it helped for me:


@ob_flush(); // try a normal flush
flush();

If PHP isn’t flushing it could be your webserver that’s collecting your output for gzipping:


mod_gzip_on no

This worked for me..

Synchronization of calendar, contacts on my (windows) mobile, horde and thunderbird.

(Sorry for the format, it’s a straight copy from my DokuWiki)

This is my situation:

* I’ve got a FreeBSD server which runs PHP, Apache, Mysql, Courier Imap.
* I’ve multiple clients which run Thunderbird as my mail client. I’m using imap for mail access
* My thunderbird clients also run lightning for agenda functionality
* I also have a mobile phone HTC Touch with Windows Mobile 6.

I would like to share my contacts, agenda items, notes and tasks with all my clients.
My phone syncs all these items.
Thunderbird only the contacts an agenda..

This document describes the installation of this system. I assume you already
have a working server like described above.

Install Horde

I downloaded the Horde Groupware Webmail Edition. WARNING this **must** be at least
the 1.1 edition. At this moment it’s still a Release Candidate. (Horde Groupware Webmail Edition 1.1-RC3)

http://www.horde.org/download/app/?app=webmail

Complete Install manual of horde can be find here:

http://www.horde.org/webmail/docs/

Summary of this setup:

* Extract this file to a web directory (horde-webmail-1.1-rc3.tar.gz)
* run the setup script: php scripts/setup.php
* build the database, enter the database settings etc.
* enter the name of your IMAP user that gets administrator rights for horde

Things to know:

* you can login to horde with your IMAP username and password
* The syncML url for horde is: http://yourserver/horde-setup-location/rpc.php
* Use your IMAP username and password for this synchronisation

Thunderbird

I assume you already have thunderbird running with lightning. I’ve got the latest versions:
Thunderbird 2.0.0.9
Lightning plugin 0.8

 * At the Thunderbird extensions site download Funambol Plugin
   * You can find it at the source:
       http://sourceforge.net/project/showfiles.php?group_id=149326
   * Choose Funambol Mozilla PIM plugin
   * I've tested version 0.4.4: Funambol-Pim-Plugin-win32-v0.4.4.xp
 * Change the config for this plugin
   * Thunderbird Menu: Extra => Funambol Plugin
   * Choose Options
     * Enter your server details:  

http://yourserver/horde-setup-location/rpc.php

     * Enter your IMAP username and password settings
     * Goto tab 'Synchronize'
       * Enable contacts, press details,
                and enter 'contacts' (without quotes) in the remote name.
       * Enable calendar, press details,
               and enter 'calendar' (without quotes) in the remote name.
       * tasks are not (yet) available :-(  too bad.

Make your phone support SyncML

Download Funambol: http://www.funambol.com/opensource/downloads.php
Tested with version: funambol-pocketpc-plugin-6.5.14.cab

  * Install this cab file on your phone.
  * Start Funambol
  * Choose Menu / Account
    * Again enter the Server and login details
  * Choose Menu / Settings
    * Enable only: contacts, calendar, tasks and notes! Disable the others!!
    * Choose Menu / Advanced
      * Enter the following names for the items:
        * contacts: contacts
        * calendar: calendar
        * tasks: tasks
        * notes: notes

This was all that it took to sync all my devices!

“2008-03-30″.to_date.to_time.tomorrow == “2008-03-30″

I wrote a very nice routine which would iterate over a few days.
Today I found my loop never ending !?! And this is very scary because the routine is a background process that needs to iterate over the last x-days.

But there’s a problem when you’re living in The Netherlands and you have to use daylight savings.

Try this code:


>> "2008-03-30".to_date.to_time.tomorrow.to_date
=> Sun Mar 30

WTF !! 2008-03-30 => Tomorrow => 30 March 2008 ?!?

I indeed complained, that time was passing so quickly. But I didn’t mean to keep it stuck at 30 March!
Oh.. I’ts only my Rails Application…

How’s this possible?

>> "2008-03-30".to_date.to_time.tomorrow
=> Sun Mar 30 23:00:00 +0200 2008

At 30-03-2008 the clock has been set back for daylight savings. Well I assume rails simply adds 24 hours with the method tomorrow. And yesterday we had 25 hours.

More info about this bug: http://dev.rubyonrails.org/ticket/2353

My temporary solution is to add some hours to tomorrow.


>> tomorrow_time = "2008-03-30".to_date.to_time.tomorrow + 12*60*60
=> Mon Mar 31 11:00:00 +0200 2008
>> tomorrow_time.to_date
=> Mon, 31 Mar 2008

Sometimes I hate Ruby on Rails!

why don’t we collectively protest agianst the oppression of daylight saving time?
Well Tijn, I agree!

Choosing a direction for Rich Internet Applications

Currently we’re at the point of a big shift/hype of (Web) Application Development. The development of Rich Internet Applications. (RIA). A RIA is an application that runs via the web, probably via a webbrowser though this isn’t a requirement.
The idea is that RIA makes this application work like a local desktop application. This could mean the application should be capable of running offline and online.

There are severy solutions for this purpose:

  • Ajax Based ~ This is wat I’m used to, but it has it’s limitations.
  • Google Gears ~ Browser Plugin Based. Look Nice, browser plugin offline application use
  • Adobe FLEX/Flash ~ Via the Flash plugin that’s installed on almost every PC
  • Adobe Air ~ To run applications from the desktop
  • Microsoft Silverlight ~ Microsoft attempt to join the club
  • JavaFX ~ Beta, Looks nice. unfortunally I’m not a big fan of the large overhead the Java plugin has.
  • Ajax isn’t an ideal solution because it never gives me access to the local user’s PC and doesn’t work offline.

    Now is my Problem, what direction should I choose?! Staying with Ajax for now seems like a safe choice, because it will run probably on the most platforms..

    This is something that requires some good Research!