Archive for February, 2013

Facebook Event exports take two

Friday, February 8th, 2013

So a while ago I wrote a php script to make facebook event names appear properly on google calendar.
I’ve since noticed that all ‘full day’ events on facebook get exported as though they are on the previous day! Someone has written a page to do this, but the source code is not available and so it depends if you trust them with your events or not.

As such I updated my php script to do this date change too! Code below, but if you want to use it on my site:
http://www.psykar.com/utils/cal.php?uid=&key=

Get the uid and the key from your events page on facebook by clicking the gear in the top right, and export events, then get the URL of ‘upcoming events’.

For adding this to google calendar use webcal:// instead of http://

<?php

// Facebook uses ZULU time for it's exports.
date_default_timezone_set('Zulu');

function inc_date($matches) {
        $date = new DateTime($matches[2]);
        $date->add(new DateInterval('P1D'));
        return "DT".$matches[1].":".$date->format('Ymd');
}
$ical = "https://www.facebook.com/ical/u.php?uid=".$_GET['uid']."&key=".$_GET['key'];
$file=file_get_contents($ical);

$pattern = "#DT(START|END):([0-9]{8})[\n\r]#";
$file = preg_replace_callback($pattern, "inc_date", $file);

$search="CLASS:PRIVATE";
$replace="CLASS:PUBLIC";
$output=str_replace($search,$replace,$file);
header("Content-Type: text/Calendar");
// Give the file a name and force download
header("Content-Disposition: inline; filename=events.ics");
print_r($output);
?>

Goa

Tuesday, February 5th, 2013

My reading on Goa suprised me a little when I realized that Goa is not actually a city, and not in the strict sense of the word a state either. I’m still not sure on what it’s called technically to be honest, but it amounts to a collection of towns and a capital city stretched along a coastline of about 100km or so (I believe)
We arrived at the airport, and booked a pre-paid taxi to Vagator where Kylie and myself had booked accomodation at ‘Asterix hostel’. The reading I’d done suggested that Vagator was a smallish town, with a somewhat laidback kind of crowd, and many Indian tourist families compared to the nearby town of Baga and Anjuna which were better known as party towns, with significantly more tourists clubs.
The taxi driver was great, named Smile (or something similar…) chatting about the various customers he gets. We were suprised to learn there are a large number of Russians who visit Goa – and that apparently they are the worst customers in the taxi unfortunately. We got Smile’s number just in case we needed a taxi later. Sadly, as awesome as he was, we didn’t feel it was worth calling him for a lift back to the airport later, as there were too many local taxis in Vagator willing to do it for a reasonable price as well.

We arrived at the hostel, and were taken to our 4 bed dorm, which we had to ourselves! It was in a separate wing to the main hostel, but we still had free wifi, which was a nice change from the exorbitant prices that we were charged in Pune. We endeavoured to book some tours which were run by the hostel, but unfortunately they required 4 people to happen, and we were never able to organise enough people at the hostel to actually make them happen.
The first day we spent lazily – getting some food from an American style restaurant, ironically called ‘Tin Tin’s’ (given Tin Tin has nothing to do with the US) then wandering down to the beach and back, browsing a few of the market stalls along the way. Then having dinner with a largeish group of people from the hostel.

The next day we commandeered a taxi to head in to Old Goa Рwhat used to be a colonial Portuguese  town, with many large churches in a very small area. After visiting Sa Cathedral, The Church of St. Francis of Assisi, The Basilica of Bom Jesus and a small museum, to the consternation of the taxi driver we found, we drove back to Vagator. 1 hour of driving each way for 1 hour of sightseeing. We still considered it worth it, despite the warnings we had received the previous night from a couple of girls at the hostel who considered it boring.
Dinner we had again with a bunch of people from the hostel, initially over candlelight with no power – which was out for nearly an hour. I was surprised to see police cars and helicopters start to make drive and flybys about 10 minutes after the power had gone out – I’m still curious as to why.

Morning came yet again, and we resolved to walk up to the nearby fort, which was on the map provided to us by the hostel, and was visible from the beach the first day. The hike was a short 10  minutes or so, to a low wall about 2-3 meters high ringing the hilltop, in a rather poor state of repair. Climbing over we wandered the central area, probably 4-5 acres of grass, taking photos of what was quite an amazing view, particularly to the north where a bay cut in to a river delta.
We then attempted to find our way down to the beach from the fort – given the map we had suggested there was such a path. Our first attempt proved fruitless, after 20 minutes of walking and ending at the top of a cliff we had to turn back, and found a different route. Although steep, particularly given we were both only wearing flip flops, we made it down eventually, to find ourselves at the beach next to the one we had visited on the first day. There were a few beach chairs arranged out the front of a cafe and we paused to grab a quick drink, before heading back to the hostel.

Our final full day in Vagator, we considered doing one of the tours again, even if just by ourselves with a taxi, but made in hindsight the right decision and opted for a relaxing day on the beach. I hadn’t even been in the water yet, which considering was a little rediculous. Despite being hesitant over the water temperature (the day was a little cooler than the previous ones) it turned out to be nice and warm, and short (and long) dips interspersed with sunbathing on deck chairs getting served drinks and food to your chair was, as hoped, nice and relaxing. Jess, one of the girls from the hostel joined us around midday and we were there until the sun started disappearing behind the haze, which existed even in Goa, and it started to get a little chillier.

Upon getting back it was about time to apply the nightly layer of mosquito repellant. Although Goa isn’t considered a super high risk of Malaira, I was still on anti-malarials. But despite this, repellant is still recommended. Quite besides the fact that the bites aren’t exactly pleasant. Interestingly they only really were a problem between about 6-8pm – around twilight. During that time you might get 20 bites in 5 minutes, but outside of those hours I wasn’t even wearing repellant most of the time and didn’t get bitten at all!

Given we were heading off to the airport the next day at 4am or so, we considered ringing Smile to book him in, but given all the local taxis as mentioned, we ended up asking the driver who had taken us to Old Goa earlier. For a slight premium due to the time of day (and fair enough too!) he agreed. Kylie and myself did end up having slightly too big of a night given the time of the flight in the morning, but when in Goa….
We still made it up in time to catch our epic sequence of flights to get to Amritsar, so it was all good.