Friday, 9 November 2012

Google link converter

Links provided in the search results of Google look something like
http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0A&url=http%3A%2F%2Fabc.go.com%2F&rct=j&q=abc&ei=kuw&cad=rja
when the URL it links to is simply
http://abc.go.com/
This tool allows users to transform the former into the later for easier copying and pasting.

Monday, 30 July 2012

Apache ignoring mod_rewrite rules?

Then it is very likely in the site configuration file, usually at
/etc/apache/sites-available 
you have directives such as
AllowOverride None 
Change them to
AllowOverride All 
and try again.

Tuesday, 6 March 2012

Unique rows in vim

Simple! Just

:sort u

Tuesday, 30 August 2011

Sending UTF-8 mail with PHP

I was facing issues sending mail encoded as UTF-8 via PHP. In order to do it properly, you need to set UTF-8 as the encoding for the mail function (first line of code below). Then, mail can be sent (second line).

mb_internal_encoding("UTF-8");
mb_send_mail( 'myrecipient@wherever.com', 'Polite subject', $message, $headers );

Sunday, 26 June 2011

Apache module modwsgi 3.3 on Ubuntu Lucid

A bit of library hell on Linux. I tried to install modwsgi on Ubuntu Lucid. I downloaded the Debian version. However,

root@virt251:/tmp# dpkg -i libapache2-mod-wsgi_3.3-2+b2_i386.deb 
...
dpkg: dependency problems prevent configuration of libapache2-mod-wsgi:
libapache2-mod-wsgi depends on libpython2.7 (>= 2.7); however:
Package libpython2.7 is not installed.
dpkg: error processing libapache2-mod-wsgi (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libapache2-mod-wsgi


You cannot install Python 2.7 (easily, at least) on Lucid, but you can install Python 3.1. Use apt-get and that will do the trick.

Friday, 3 June 2011

Automatic creation of regular expressions in different computing languages

Regular expressions are a powerful tool, albeit they can become difficult to build. This page, text2re, helps you build complex re's and provides code in a number of computing languages such as Python, Perl, etc.

Wednesday, 4 May 2011

Modifying Xubuntu application menu

One of the most disturbing features of my Xubuntu desktop is the apparent inability to modify the application menu. In particular, I had a huge settings submenu with duplicated entries: many already appeared in the system submenu.

So I edited the file /etc/xdg/menus/xfce-applications.menu and changed the section

<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>

<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>

<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>

into

<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Exclude>
<Or>
<Category>System</Category>
</Or>
</Exclude>

<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>

<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>

This is a simple example of what can be achieved if you (very carefully) edit the file.