Archive for December, 2008

Python For Series 60 v.1.9 Released For Testing

Sunday, December 28th, 2008

Python for Nokia’s Series 60 platform has been around for four years now and to be honest, not much has happened on that front during the past year. However, suddenly on 24th of December Nokia releases a version 1.9.0 of the Python for Series 60 that is a major rewrite of the whole thing and comes now with Python 2.5 version of the core language. As usual, the odd-number version branch means that the release is for testing purposes only and the even-numbered 2.0 version branch should be released once it becomes more stable. Blog at Croozeus.com has done pretty nice wrap up of the new release and here are my thoughts.

First of all I should mention that as I write this blog entry I’ve not yet had time to test the new Python for Series 60 release. So I apologize beforehand for all false comments I’m about to make.

It seems that they are giving a lot more focus on the ease of development in this new release. Which is a really good thing I must say. What pleases me the most is that they are planning on improving the Python runtime deployment so that the end-user or the guy that is installing Python applications should not have to worry too much about having or not having the Python runtime installed on his phone. Definitely a good thing. The new release includes a packaging tool that is not part of the S60 SDK and is basically ensymble with added GUI. Ensymble is an excellent tool and it is very nice to see it included in the official PyS60 release.

Like mentioned already, the new release includes the version 2.5 of the Python interpreter and most of it’s standard libraries. Ok, the word “most” does not sound good here. I’ll focus first on the good things. First, the new release has Expat XML parser in it. Definitely a good thing since XML is something that pretty much every application out there uses and so far people have had to make ugly regexp XML parsers or use 3rd party package of expat to be able to parse XML in their PyS60 applications. However, I would say that including JSON parser as the official Python 2.6 release did lately, would probably be a good idea too.

Also, inclusion of asyncore and more compliant socket module sounds nice. I can’t wait to try Twisted on PyS60 and see how it works. One could do some crazy things with that on a mobile phone.

Then to the things that are not included from the standard Python 2.5 libraries. Now, I don’t have too much information on this since, like said before, I haven’t tried the new release yet. However, to my disappointment I noticed that sqlite3 is not included. SQLite should probably be a platform component in S60 because it is kind of becoming a de facto standard in mobile platforms since both iPhone and Android platforms use it. I don’t know what is the equivalent in S60 or does such exist but having some kind of storage other than just plain text file for PyS60 applications would be extremely nice thing to have.

Ok, I have to try out the new PyS60 release soon. I’m hoping that I will be pleasantly surprised. I’ll definitely write more about it later.

Setting your SRV records straight for XMPP

Sunday, December 14th, 2008

I’ve noticed that DSN SRV records are something that are not very common knowledge among even some of the really techy people. Well, the reason is probably that most people never need to know what they actually are. I’m gonna explain them here briefly and show how I set the DNS SRV records for my XMPP server hosted at Slicehost.com.

Ok, so what these DNS SRV records are. If you’re familiar with the DNS MX record you know that it is used to indicate where is the email server that is hosting a certain domain. For example, I have domain service.com and I’m running my webserver at www.service.com and my email server is at smtp.service.com. Naturally, I would want my users to have email addresses like user@service.com. Here I would set the DNS MX record to point to smtp.service.com so when email servers communicate with each other they can ask from DNS server that “where is the email server for domain service.com?”.

DNS SRV records were specified for a bit more general purpose than MX records that can be used with email only. You might have XMPP server at xmpp.service.com and would like your users have also XMPP address of the format user@service.com. This is how the SRV records for the XMPP look like. This is an example of SRV records I’ve set for my XMPP server at teemu.im.


_xmpp-client._tcp.teemu.im. 82698 IN SRV 10 0 5222 teemu.im.
_xmpp-server._tcp.teemu.im. 86400 IN SRV 10 0 5269 teemu.im.

What there actually mean? Well, the _xmpp-client._tcp.teemu.im. line is the line that XMPP clients use to ask from DNS that “where I can find the XMPP server for domain teemu.im?”. The DNS server responds that “the XMPP server can be found from host teemu.im port 5222″. The other line that has _xmpp-server._tcp.teemu.im. is used by the XMPP servers when they talk to each other using the XMPP server-to-server protocol, similarly as the email servers use the MX records to find out information about each other.

The SRV records can also be used to do “poor mans load balancing” by using the priority and weight attributes, but I won’t go in to that now. Instead, I’ll show you how you can configure DSN SRV records on Slicehost.com server. This is because I use Slicehost, but the same principles apply for other hosting providers as well.

First, go to your SliceManager and login. There choose the “DNS” tab and you should see something like this:

Slicehost's SliceManager DNS Zones Tab

Slicehost's SliceManager DNS Zones Tab

Now click “Records” and then “new record”. Fill the form as shown below:

Slicehost SliceManager new DNS SRV record for XMPP clients

Slicehost SliceManager new DNS SRV record for XMPP clients

Note that the value in “Name” field starts with underscore although it is not visible in the screenshot.

Do the same for the server-to-server protocol, except for the name set _xmpp-server._tcp.domain.com. and for the data use 0 5269 domain.com..

You can use tool called dig for testing your configuration. Type the following line to see if your configuration is correct:

dig @ns1.slicehost.net SRV _xmpp-client._tcp.domain.com

The result should be:


;; ANSWER SECTION:
_xmpp-client._tcp.domain.com. 86400 IN SRV 10 0 5222 domain.com.

By the way… when configuring DNS it is good to set the time-to-live value to something relatively small. In case you make mistakes, you don’t need to wait until the DNS record will be updated. Other good practice is to use the @nameserver.domain.com parameter for dig command so that the entry does not propagate to other DNS servers and you can change it pretty much when ever you want.


blog.teemu.im is Stephen Fry proof thanks to caching by WP Super Cache