UnknownLocaleError in Trac

Relatively recently I updated my Ubuntu to 14.04. Today I tried to access a Trac which I use for a toy project and which I access using the standalone server when I need. To my surprise, when I tried to access it in the web browser I got the following error:

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 514, in send_error
data, 'text/html')
File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 976, in render_template
data = self.populate_data(req, data)
File "/usr/lib/python2.7/dist-packages/trac/web/chrome.py", line 894, in populate_data
'locale': req and req.locale,
File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 316, in __getattr__
value = self.callbacks[name](self)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 279, in _get_locale
req.languages)
File "/usr/lib/python2.7/dist-packages/trac/util/translation.py", line 348, in get_negotiated_locale
normalize(get_available_locales()))
File "/usr/lib/python2.7/dist-packages/babel/core.py", line 201, in negotiate
return Locale.parse(identifier, sep=sep)
File "/usr/lib/python2.7/dist-packages/babel/core.py", line 313, in parse
raise UnknownLocaleError(input_id)
UnknownLocaleError: unknown locale 'en_GB'

After a bit of searching on the Internet it turned out that the problem is caused by the Babel package. I reinstalled python-babel-localedata and python-babel packages and everything got back to normal.

A good way to test whether the Babel package is installed properly for your version of python is to run the following command:

python -c 'from babel import Locale; Locale("en_GB")'

An error like
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/babel/core.py", line 150, in __init__
raise UnknownLocaleError(identifier)
babel.core.UnknownLocaleError: unknown locale 'en_GB'

indicates there is a problem with your installation.

Posted in computers, Python, Ubuntu | Leave a comment

Fix tagentry plugin in the newer versions of Dokuwiki

The tagentry plugin offers a very good way to visually assign tags to a wikipage. The plugin works together with the tag plugin. A screenshot of how editing works is in the picture blow:

Screenshot of how to edit tags in dokuwiki using the tagentry plugin

Unfortunately, the most recent version of tagentry is from Sept 2009 and due to changes with dokuwiki and the tag plugin, it does not work with the latest versions of the wiki and the plugin. In order to make it work, two changes need to be made. The first one is documented in the list of bugs and involves commenting some parts of the handle_editform_output function:

 
if ( !empty($event->data->_hidden['prefix']) 
     || !empty($event->data->_hidden['suffix'])) return; 
if ($event->data->findElementByType('wikitext')===false) return 

The second problem comes from the fact that the tag plugin started to use the metadata index offered by Dokuwiki instead of maintaining its one index. The solution is to modify the same handle_editform_output function and change the way the $alltags variable is initialised:

if ($this->getConf('tagsrc') == 'All tags') { 
    $alltags=array_map('trim', idx_getIndex('subject', '_w')); 
} else { 
    $alltags=$this->_getpages($tagns); 
}

So far it seems to work with no side effects when using the tag plugin released on 2012-08-24 and Dokuwiki 2012-10-13. Looking at the code of the plugin, I think it could do with a bit of cleaning up. But this is a task for another day.

Posted in dokuwiki, PHP, Uncategorized, WordPress | Tagged , , | Leave a comment

What are these coupons and where they came from?

I recently noticed some strange coupons in bottom right corner of various webpages. At first I thought it was something added by the owners of the page. But then I noticed them again and again on several pages. The box with links was quite strange with a small text “by Superfish”. They look like this:

This was both annoying and worrying. I tried to google, but did not find any useful information, so the next obvious thing to do was to check whether any of my chrome extensions added it. After I disabled all of them and enabled one by one, I found out that Read later fast has an option which does this.

 

This is something that appeared recently, but I am pretty sure I did not agree to have it enabled by default. I suppose if I check the terms and conditions I will find that they have the right to do whatever they want because this is a free product and they have to make money somehow. Still, not very nice. It would be much nicer if the user was asked to agree to it.

Posted in computers, Ranting | Leave a comment

Template for POST parameters in Netbeans

I tend to use the following structure for accessing the POST parameters in PHP

$id = "";
if (isset($_POST["id"])) {
  $id = $_POST["id"];
}

and I find writing the code quite repetitive and boring. For this reason I had a look at the code templates offered by Netbeans and created the following template:

$$${var} = "";
if( isset($_POST["${var}"])) {
  $$${var} = $_POST["${var}"];
}

Now all I have to do is to type the abbreviation assigned to this template and I have it expanded. Netbeans also takes care of replacing the variable name everywhere. The only thing I did not figure out yet is how to have the indentation consistent, but that’s not such a big problem to fix.

Posted in NetBeans, PHP | Tagged , | Leave a comment

Wow one of my blog posts is popular

Shorty after I upgraded my Ubuntu to 10.10 beta, I posted an entry about how to make Evolution work using the Microsoft Exchange Connector. For weeks that post received one or two visits per day, but today I noticed that suddenly the number of visits jumped to over 50 on 11th Oct. After a few moments of consternation, I realised that’s the day after the new Ubuntu was released. Nice to see I am not the only one who faces this problem.  Now I am running the stable version, but the problem is still there. One day, I will find the time to discover how I can compile Evolution 2.32 for Ubuntu 10.10. The 15 min I spent on this were definitely not enough.

Posted in computers, general, Ubuntu | Tagged | Leave a comment

Enabling CAPTCHA in TracDownloaderPlugin

In my previous post, I showed how you can install the TracDownloaderPlugin. One of my concerns was the spam and the fact that the instructions to install PyCaptcha do not work anymore. Anyway, I found out that it is easier to make captcha work than expected.

First, install Python Imaging Library (PIL). On most distributions this is quite easy. In Ubuntu you need to make sure you have python-imaging installed.

To install PyCaptcha you need to check it out from it svn repository:

svn co http://svn.navi.cx/misc/trunk/pycaptcha/

and install it using

sudo python setup.py install

After you do these steps everything should work fine.

Posted in Trac | Tagged , | Leave a comment

Installing the Trac Downloader plug-in

One of the plugins for Trac is Trac Downloader, a plugin which allows you to make files available (obviously in the context of Trac very likely releases of your programs)  for download on your Trac website. At the same it provides a nice way to organise the files and to track how many times a file was downloaded, by whom, etc.

This is a great plugin, but it seems to be more or less abandoned and the version available on the website does not work out of the box. However, it is not very difficult to make it work. I did the following steps:

Continue reading

Posted in Python, Trac | Tagged , , , | 1 Comment

Discovering new features in Ubuntu 10.10

It’s quite nice to find new features in Ubuntu 10.10. I would be probably aware of them if I read fora and blog posts, but I did not so I enjoy discovering them bit by bit. First of all it seems that sound and music got a bit of attention. The volume control was revamped and it integrates now with amarok allowing you to see which song is being played and control amarok (of course the ability to control the volume is not gone).

After some hardware problems I had a while ago, I lost a lot of album covers and adding them with the previous version of amarok was a real pain because quite often amarok would not find any cover despite the fact that it was for a very famous album. The amarok distributed with Ubuntu 10.10 comes with an improved cover manager that allows you retrieve covers from various sources including last.fm, google and yahoo.

Finally, it seems that Ubuntu is trying to push harder Ubuntu One. When I go to Documents folder, I can see an invitation to synchronise my documents on Ubuntu One.

I have used in the past Ubuntu One and I managed to upload a few files, but I find Ubuntu One a very unreliable service. There is no guarantee it will work next time. Currently I use dropbox which seems to have very few problems.

Posted in Ubuntu | Tagged , , | Leave a comment

Problems running evolution 2.30.2 in Ubuntu 10.10 beta

Yesterday, I upgraded both my work and home computers to Ubuntu 10.10 beta. Some of my previous problems disappeared, but suddenly I was no longer able to use evolution to access my work account on an Exchange server using the Exchange connector. In most of the cases there was no crash, but I could not see my emails either (basically whenever I tried to expand the tree under the account label the program refused to do it and collapsed the tree back). This version of Ubuntu distributes version 0.28.3 for the MAPI Connector which is more or less useless. After I tried all kind of things and deleted the cached files several times, I noticed that one way which seems to work almost all the time is to start evolution in offline mode. So all I do is type in a terminal:


evolution --offline

After evolution starts, I click in the bottom left corner of the window or select from the menu to make the program work online and everything works fine … or kind of. I can use evolution more or less fine, but from time to time it freezes for a while. Maybe by the time Ubuntu 10.10 will be released this problem will disappear. Meanwhile I enjoy using amarok 2.3.1 which has a much better cover management than the previous version (I believe 2.3) and displays the contents of my collection properly.

Posted in Ubuntu | Tagged , , | 2 Comments

Screencast how to use the Netbeans editor

The guys from Netbeans made available a screencast on how to use the IDE editor in NB6.9 to write Java code. People who use Netbeans on regular basis will be familiar with most of the features presented. However, it mentions some nice features which can increase the speed with which you write code. I found particularly useful the shortcuts presented. I wish they listed them on the page so you do not forget them.

A bit of googling revealed a document which contain a list of shortcuts in Netbeans. The only problem is there is no indication for which version of NetBeans the list is. However, it seems that most of the shortcuts are valid, even thought it may be incomplete.


Posted in Java, NetBeans | Tagged , , | Leave a comment