Posts

Showing posts with the label python

The generalization of the day

I use the web to find solutions of my problems, as most people do today. I have noted a huge difference between two communities I am using, the Java and the Linux community. With the Linux community I mean it in a broad sense like Linux distributions and common software running on Linux like Postgres, Apache, Evolution, F-spot, Python etc. I.e classic open source software. When I search on a problem in the Linux area I most of the time get good hits with people having the same problem and good answers from people who knows how to solve it. The hits are on mailing lists, forums, and blogs. On the other hand when searching on problems around Java I most of the time find people who have the same problem, but no answers. I know this is a very big generalization but are anybody else experience the same? Why are people in classic open source more willing to help than in the Java world?

Spring framework to Python

I just noticed that Springsource has released the Spring framework for Python. Interesting, especially since i like the Spring framework in Java and I prefer Python as language in a lot of cases. I must try it some day....

SpringOne Europe 2009 day2

SpringSource is really pushing Groovy and Grails. Hope they start pushing Jython too. Heard a nice talk just before lunch about transactions. Transactions engines are hard to write. Recomendation is to skip XA transactions. Time for some The before the next session.

Python, GTK and threads

Note to self: Before start threading a Python GTK-program call gtk.gdk.threads_init() otherwise will strange thing happen. The call must be done before gtk.main().

How to find the interesting TV shows?

I have had the possibility to do some coding this weekend. Which also gave me the possibility to learn XSL(T) , look closer on iCal, and xmltv. The result is a small application to search TV charts including the descriptions of the TV shows. It uses xmltv to fetch information about whats on TV. Then there are a very googly search interface to find the interesting shows. Out comes a new reduced XML file in the same format as xmltv but only including shows that match your search. This XML-file can then be translated to either HTML or iCal using XSL. Its is of course possible to write other XSL-files to create other formats. It is written in Python. I am not ready yet to publish the application. It needs some documentation and packaging. My main reason was not to write the program, it was more about to play with different algorithms and programing techniques. The program was just a side effect. I will write more about this software when I am ready to publish it.

Laptop refreshment and Jython

I haven't had too much spare time for a while, therefore the lack of writing. Fortunately I had time today to start upgrading my laptop to Ubuntu 7.10 (Gutsy Gibbon) when it is still fresh. I have a few minutes left until it finished. Yesterday evening I were at a seminar about Jython . Jython is an implementation of Python that runs on Java virtual machines (JVM). The advantage of this is that you can use all existing frameworks etc that exists for Java but still programming Python. The talk was about a Google summer of Code project that wrote a compiler for Python 2.5 for Jython. Until now Jython had only run Python 2.2 code. There were a lot of talk about how they had written the compiler to Java byte code with a minimal of effort. The focus was to get something working, and the got it.

Python and Java

Since I do Python programming at my spare time and Java programming, including a bunch of other Java technologies such as JSP, JSTL etc, at work. These articles were very interesting to read even if they are 2½ years old: Python is not Java Java is not Python, either Python interfaces is not Java interfaces

Storm

Canonical have today released Storm , a object-relational mapper for Python. Simple described is it a glue between Pythons Object-Oriented language and SQL-databases table-relational language. After I read the tutorial , I think its quite easy to use and will simplify the use of databases from Python a lot. I hope it will enter an Ubuntu repository soon.

find is an amazing tool, but it can't use Gnome-vfs

I use the find command line utility nearly every day. It is amazing to manipulate large directory hierarchy with files. Unfortunately, I have missed the possibility to do like this: find ftp://ftp.sunet.se/ -type f -exec gnomevfs-copy {} . \; The example above is of course stupid since it will take for ever and fill my hard drive but you get the idea. I need the similar functionality to copy video-files from my PVR, Kiss DP-558, to my Ubuntu server. This weekend I decided to solve the problem, so I created gvfsfind . The prefix gvfs since it is based on gnome-vfs. The tool has a help that I hope can get you to start using it. Just start it with the flag -h. This example prints all directories on the ftp-site: gvfsfind.py ftp://video.foo.org --type d --print To copy all files ending with .vob from the host skipper to the local host: gvfsfind.py ssh://skipper/srv/movie --type f --name ".*\.vob" --exec "gnomevfs-copy %u ." Create all directories on the remote host ski...

ESR leaves Fedora

ESR announce today that he leaves Fedora in favor for Ubuntu . When I see his argumentation I definitely recognize much of the same reasons why I left Fedora. I did try to submit some patches to fix some problems that I had, but no none could tell me how to submit these patches. Fedoras, or should I write Red Hats, political denial of including Mono did it not better. All their arguments against Mono could been used against Java too. It was only a ridiculous commercial protest against Novell, and more ridiculous was that they did not confess it. A note to people who wounder: Today I mostly do my programs in Python, which also happens to be the preferred language among Ubuntus core developers.

Blog ping

One drawback with blogger is that it can only ping weblogs.com . But I want to ping some other index sites too. One way is to go to each site and ping manually, but thats to much work. Another solution is to have a script or something that you run after each time you have written a blog entry. It hit me that blogger can send a mail each time you enter a new blog entry. So I wrote a python-script yesterday that is trigged by these mails an ping sites using XML-RPC . My script, blogping, reads a config file and ping all services listed in the config file. Then I added an email alias in my email server that run the script when a mail comes in. Last I registered the mail address in blogger. The alias looks like this in postfix: blogmail: |"/opt/local/bin/blogping.py -c /opt/local/etc/configfile" The result of the pings are logged using syslog. You can download the script from here . Run the script with the argument -h to get instructions. You do not have to trig it using mail,...

Music taging in Python

During the X-mas, I took a closer look in meta data tagging in music files using Python. There are modules to tag mp3, flac and ogg vorbis file, but each file format has its own module and each module has its own API. That's bad! Then I found a Python module called mutagen . Mutagen handles tagging for all the file formats above and some other too. Thats nice! If you are happy to only use some of those tags that are possible in MP3 files, you will have the same API for the three files. If you want to use all the tags in MP3, we are at least down to two instead of three different API:s. Unfortunately I noticed that mutagen convert all tag names in ogg files to lower case. The recomendation from the xiph-people that had defined the ogg-vorbis standard is that tag names should be in upper case. I have mailed the mailing list for mutagen and hope that they will change the behavior according to the recommendations.