FOSDEM: awesomeness^3

It has been a very long weekend, I’m writing this on the train while traveling back from FOSDEM. I knew the event was big, but I couldn’t imagine it was that big.

Everything was so perfect: the talks, the speakers, the facilities, the connection, … Specially the connection. On conferences usually network sucks because the access points can’t cope with the load or there is not enough bandwidth for everyone… who know. This was not the case at FOSDEM. Every device got a public IPv4 address and also a IPv6 one. We did simple test and downloaded 10GB from a FTP server. It took 2 minutes.

I was lucky and got the opportunity to give a talk in the Open Source Telephony Devroom about SIPSIMPLE SDK the SIP library we develop at work

The talk went through the implementation of different server applications for SylkServer a SIP application server we recently launched. Simple SIP client examples were also shown. The presentation is available for viewing and downloading here:

[slideshare id=6830569&doc=developingrichsipapplicationswithsipsimple-110206091415-phpapp02]

The code examples used for the presentation can be downloaded from my GitHub repository.

Once more, kudos to the organization os FOSDEM, it was a really great event, I would definitely recommend it to anyone. Hope to be there again next year!

:wq

Managing timezone aware datetime objects

Dealing with date and time can be quite tricky. Specially if we need to convert local times from different timezones. Lets see what standard Python datetime module does:

[gist]https://gist.github.com/805087[/gist]

The generated timestamp is in ISO8601 format, well, not really, microsecds should be removed, but that’s not the biggest problem. The problem is that the offset from UTC is not added. If a timestamp is generated in a local form, the offset to UTC must be provided, lets see an example:

2011-02-01T00:56:23+01:00

That means that the local time is 00:56:23, which is +01:00 hours ahead UTC. Regular Python datetime objects are not timezone aware. Getting proper timezone information is a tough matter, but fortunately the dateutil module will help. Lets see it in action:

[gist]https://gist.github.com/805107[/gist]

Hey! Now the timestamp is generated correctly! (I set the microsecond to 0 so that its fully ISO 8601 compliant). We can also use the dateutil module to parse a timestamp and generate a timezone-aware object out of it:

[gist]https://gist.github.com/805117[/gist]

One last note: if you need to perform operations such as calculating the difference between two datetime objects, they both need to be timezone aware, otherwise bad things happen:

[gist]https://gist.github.com/805121[/gist]

:wq