Friday, February 10, 2012

plan2ics

This is a quick note about a small Python script I wrote to translate my home calendar into the iCalendar format.

I use an "old" calendar system called plan (sometimes "netplan" which is the server program, and easier to find on Google). It is fast, simple, and I have been using it since 1997, so I don't see any reason to change.

Then I bought an Android phone... which loves to sync with the Google Calendar, and can be convinced to sync with most iCal sources, but has no support for my system.

So what I decided to not do was to write an Android content provider to connect to my netplan server and get the calendar directly. This is the most elegant solution, but I didn't have the time to learn how to do it. (But when I do have time, I should look at the aCal app to see what needs doing...)

Instead I wrote a conversion script. plan2ics is on Launchpad.net, and it takes the netplan file as input and creates an iCal output. I allow the iCal file to be served by a webserver, then tell Google Calendar to import the calendar from an external URL. Once Google has it, the calendar gets synced down to my Android phone.
Oh, and I can also use the calendar URL for email clients like Evolution or Thunderbird.

So it works, but are there any problems?

Well yes, thanks for asking.

First, it is a READ-ONLY solution. So no updating the entries on the web or phone and expecting them to appear in netplan - for this I need to make my own client (see above).

Second, I'm not handling the UID for events properly. At the moment I have a fudge that will break when events are moved around, then I get duplicates in the calendar. To fix this I need to borrow a trick from some old tools to sync netplan with Palm Pilots, and that is to write the UID back into the netplan file as a comment, then reuse the UID in the next export.

Saturday, August 6, 2011

Being "nice" on Linux

Many thanks to a post from Colin Waters for showing me a better way to run background jobs on Linux without slowing down other processes.

Previously I would have just prefixed the command with "nice" and be done with it, and that was pretty good.

Now I use "chrt --idle 0 ionice -t -c3". Actually I wrap that into an environment variable and put $NEWNICE before the command. The two commands set the kernel and IO scheduling policies for the command to IDLE.

This has been making a huge difference on my video conversion scripts, and last night it meant that I could take a 9 hour migration, consisting of image conversions that wanted 100% CPU, and run it on a production webserver without losing service.

Monday, June 20, 2011

Tuesday, September 9, 2008

... and suddenly a year has gone by

I look away, and suddenly a whole year has gone by.

Father's Day 2008 was last Sunday. I fed the little girl (now quite the mobile toddler) her breakfast, and the adorable little boy prepared bananas, Weetbix, and yoghurt for me. Actually his first instinct was chopped bananas sprinkled with Milo, but that felt more desert so I asked for the Weetbix instead.

We went swimming at the Tepid Baths, waved the lawnmower over the onion weed in the back and did a little reading. The day before we visited the French Market for the weekly crepe, juice, and whitebait fritters - so a pleasant weekend all round.

The little girl is walking, and has been since around May-June. She looks forward to getting out of the house, and will often sit by the front door clutching her shoes... and if that hint fails, she has been known to deliver adult shoes to a grownup, who should obviously put them on and take her out.

The boy is now pretty big... he has taken to riding his first proper bicycle, which impressed me a lot.
His rugby season has just finished, and again he did very well. Since last year, he has basically got the hang of what he is supposed to be doing, and seemed to enjoy himself a lot more - scoring tries each week, and even making a tackle most weeks.

Meanwhile I have recently been indulging my media addiction, and very much enjoying The Middleman, Season 3 of Outrageous Fortune, Wanted, Pushing Daisies, and Life. I loved the gem that is Time Crimes and thought that the new Clone Wars movie was not as bad as it might have been...

Finally, watch this space for the complete run-down of "books I am reading while not finishing Proust...".

Sunday, September 2, 2007

Fathers Day

So today was Fathers Day... and very nice too.

It started at around 2am, then again at 4am, 5:30am, and finally 6am - as the little girl, unable to contain her obvious excitement at Fathers Day, decided to wake and demand a cuddle.

The little boy was very understanding and he (and his Mum) allowed me to snooze until about 9am. It was also very sweet of him, since he has spent 3 days plotting and hiding a Fathers Day card for me. When he delivered them to me, I was amazed to see they were actually three cards. One he made at school, and one he made at home for each day he was waiting before the Day.

At noon we went over to the parent-in-laws for a big lunch with all three (or should that be four?) families.

Sunday, August 26, 2007

Hand Eye Coordination

Another thing about last night was how (during dinner) the little girl was able to attract my attention.


For about a week now we have seen that she is getting some control over her hands - she is often able to wave them towards us when we are near.

Well, last night I was sitting on the floor next to her, eating - when I felt a little hand brush against my leg. When I looked down, there she was smiling up at me. Just to prove it wasn't an accident, after I smiled and talked to her and went back to eating... there was the little brushing movement again. She was so proud of herself whenever it worked and I looked down at her! I think it happened about three times all up.

Saturday, August 25, 2007

It's a Roll Over Weekend!

Today my little girl (3 months old) rolled over for the first time. My wife heard her do it in the morning, but it wasn't until this evening that she did it again while we watched her. Lying on her front, some stomach crunches to get onto her side, and flip of the shoulders and she was over. We are so chuffed. We are also looking at the shockingly short time before crawling and full mobility....


Today was also the last game of rugby this season for the little boy (5 years). They have made such a huge improvement through this first season, and he seems to really enjoy it. This week he was "properly involved" again - his clothes had mud on them! After rugby we had the now traditional visit to the French Market for crepes, juice, and whitebait fritters (except the crepe people were selling waffles this week); then off to swimming.


So to celebrate these things, I thought it was time to write a blog. :-)