Archive for the ‘How-To’ Category

Nice Google Trick to search for free music online

Wednesday, February 16th, 2011

Just copy and paste text below into a google search text area and replace the “artist or song” with an actual artist or song, and enjoy searching for free online music files :

-inurl:(htm|html|php) intitle:”index of” +”last modified” +”parent directory” +description +size +(wma|mp3) “artist or song”

Free anonymous web surfing site

Wednesday, January 26th, 2011

The new rise in demonstrations in Egypt was followed by the government trying to block a number of popular social websites, such as Twitter and Dambuser. But using a remote free proxy, or a site as below link, you can reach these sites with ease :

Installing Next Generation Java on Linux and Firefox 3.6 and later on openSuSE 11.1 64bits

Sunday, January 23rd, 2011

First, locate and download latest Java version from :

1. Exit Firefox.

2. Uninstall any previous installations of Java Plugin.

Only one Java Plugin can be used at a time. When you want to use a different plugin, or version of a plugin, remove the symbolic links to any other versions and create a fresh symbolic link to the new one.

Remove the symbolic links (or move them to another directory) to and from the Firefox plugins directory /usr/lib64/browser-plugins

3. Install downloaded java plugin

4. Create a symbolic link to the Java Plugin in the Firefox plugins directory.

Create a symbolic link to the Java Plugin file in the Firefox plugins directory:

    cd /usr/lib64/browser-plugins
    ln -s /usr/java/jre1.6.0_23/lib/amd64/

5. Start the Firefox browser .

Type about:plugins in the Location bar to confirm that the Java Plugin is loaded. You can also click the Tools menu to confirm that Java Console is there.

Offline Windows XP, Vista and 7 password recovery and registory editor

Monday, January 17th, 2011

Find below a nice utility to :

  • To reset the password of any user that has a valid (local) account on your Windows NT/2k/XP/Vista/Win7 etc system.
  • You do not need to know the old password to set a new one.
  • It works offline, that is, you have to shutdown your computer and boot off a floppy disk or CD or another system.
  • Will detect and offer to unlock locked or disabled out user accounts!
  • There is also a registry editor and other registry utilities that works under linux/unix, and can be used for other things than password editing.

You can get it from here.

Keep window always on top

Monday, January 17th, 2011

Small nifty utility for MS Windows. When enabled, it makes a window always stay on top of other windows. This is useful if you want to copy things from one window to another or if you want to look at two documents simultaneously. Tested on MS Windows XP and Vista.

Download Link : OnTop_10

Suse 11.1 bash script to convert files mp4 to mp3

Monday, January 3rd, 2011

Find below script that converts MP4 files into MP3 :

Using mplayer and lame :

#! /bin/bash
# Converts all MP4 files in the current directory to MP3s.
for f in *.mp4; do
newname=`echo $f | tr ' ' '_' `
mv "$f" $newname
mplayer $f -ao pcm:file=tmp.wav
lame -b 128 -q 2 tmp.wav ${f/.mp4/.mp3}
rm -f tmp.wav

Source page is here.

Joining *.avi.001, *.avi.002 etc video files

Friday, December 10th, 2010

HJSplit is a nice free utility to join or split files for MS Windows, MAC, Linux, Java, DOS and PHP :

HJSplit can also be useful for backups. A file of e.g. 10 gigabytes in size can be split into smaller parts which then can be burned to CD’s, DVDs, copied to USB sticks or uploaded to an online backup service.

PHP script to add Facebook LIKE button to your website

Friday, November 19th, 2010

You can use below PHP script to add Facebook LIKE button to your website :

// Display facebook LIKE button
echo "<br><iframe scrolling=\"no\"
echo "&layout=standard&show_faces=false&width=450&action=like&colorscheme=light\"
frameborder=\"0\" style=\"border: none; overflow: hidden; height: 35px;
margin-top: 10px; margin-bottom: 0px;\"></iframe>" ;

RTL support in OpenERP 5.0.11 and openSuSE 11.1 64 bits server.

Thursday, September 2nd, 2010

Today, we managed to implement a solution that allows RTL Arabic support for OpenERP 5.0.11 reporting engine on our openSuSE 11.1 64 bits server.

It has to do with enabling RTL in ReportLab, which is used by OpenERP to produce PDF reports. Also, OpenERP server code has to be patched to allow it to identify RTL and LTR test direction. OpenERP reporting engine is by default recognizes LTR only.

Support for unicode characters has to be enabled to allow the display of Arab and Hebrew characters.

No more details can be provided as although the solution is open source, we don’t have the permission from the author to publish it.

COPY – Enabling Arabic Support in OpenERP Reports – COPY

Sunday, August 8th, 2010

Below post is just a copy of :

OpenERP 5.0 relies on ReportLab 2.3 to create PDF reports. However, ReportLab 2.3 does not support RTL languages, and thus OpenERP does not support them as well. The following steps fix the issue in both ReportLab 2.3 and OpenERP 5.0.

Fixing ReportLab

To enable RTL language support in ReportLab 2.3, we need to modify some of its code, and build two supporting libraries, namely FriBiDi2 and PyFribidi2.

Building Dependencies

The following steps were tested on Ubuntu 9.04 (Jaunty). First, remove older libraries and install libraries necessary for building the new sources.

sudo apt-get purge libfribidi0 python-pyfribidi && sudo apt-get install autoconf gcc

Second, download FriBiDi2 (the latest at the time of writing is fribidi-0.19.2), extract it, open a shell in the extracted directory and execute the following command:

./configure && make && sudo make install

Next, download PyFribidi2 (the latest at the time of writing is pyfribidi2-0.8.0), extract it, open a shell in the extracted directory and execute the following command:

sed -i -r 's/\bfribidi2(\b|_)/fribidi\1/g' configure

[ `python -c 'import sys; print sys.version[:3]'` == '2.6' ]
&& sed -i -r 's/\bsite-packages\b/dist-packages/g' configure

./configure && make && sudo make install

Finally, verify the installation by opening a shell, changing to the home directory, starting the Python interpreter and importing pyfribidi2:

>>> import pyfribidi2

Note: If you get an error about not being found, try to reboot your machine. If the error still persists, you may need to edit ”/etc/”, adding the following line at the end of the file: ”/usr/local/lib” (without the quotes). Then run `sudo ldconfig`.

Modifying the code

Three files need to be modified in ReportLab’s code. The default installation of ReportLab in Ubuntu with Python 2.6 places it in the directory ”/usr/lib/python2.6/dist-packages/reportlab/”. We will need to modify the files there using an editor that is run in super user mode (e.g. `sudo vim`). I will refer to the files below using the relative path in ReportLab’s director.

We need to modify the search path that ReportLab uses to search for fonts to include the default path on Ubuntu.

In the variable T1SearchPath, add the following value as the last element in the tuple (approximately at line 67):


Do the same for TTFSearchPath, adding the following value as the last element in the tuple (approximately at line 85):


And do the same for CMapSearchPath, adding the following value as the last element in the tuple (approximately at line 113):



We need to import PyFribidi2 and call it before text is output to the PDF.

Add the following lines after the import statements (approximately at line 19):

# try to import pyfribidi
    import pyfribidi2 as pyfribidi
    log2vis = pyfribidi.log2vis
    DIR_ON = pyfribidi.ON
    DIR_LTR = pyfribidi.LTR
    DIR_RTL = pyfribidi.RTL
    import warnings
    warnings.warn('pyfribidi is not installed - RTL not supported')
    log2vis = None
    DIR_ON = DIR_LTR = DIR_RTL = None

Add a parameter to specify direction in PDFTextObject.init (approximately at line 135), so that the method declaration becomes as follows:

    def __init__(self, canvas, x=0,y=0, direction = 'LTR'):
        self.direction = direction

Finally, add a call to PyFribidi2 at the top of PDFTextObject._formatText (approximately at line 314), so that it becomes like this:

    def _formatText(self, text):
        "Generates PDF text output operator(s)"
        # Use pyfribidi to write the text in the correct visual order.
        directions = { 'LTR': DIR_LTR, 'RTL': DIR_RTL }
        text = log2vis(text, directions.get(self.direction, DIR_ON))


Right before the comment ”#now the font for the rest of the paragraph”, add the following lines (approximately at line 1337):

                # set the paragraph direction
                if == 'RTL':
                    tx.direction = 'RTL'

Fixing OpenERP

The fixes below have been adapted from the ReportsUnicode wiki on OpenObject’s website. However, the code in the wiki does not work correctly, so I have fixed a few things in it (and will hopefully fix the wiki soon). Only two files need to be changed: ”[bin/]report/render/rml2pdf/” and ”[bin/]report/render/rml2pdf/”.


Replace the code in this file by the following code:

import os, stat
from tools.misc import debug
from reportlab import rl_config
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase import ttfonts
from reportlab.lib.fonts import addMapping

def rl_isreg(filename, dirname):
        st = os.stat(os.path.join(dirname, filename))
    except OSError, reason:
        if reason.errno == 2:
            return False
    return stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)

for dirname in rl_config.TTFSearchPath:
    for root, dirs, files in os.walk(dirname): #@UnusedVariable
        for file in [x for x in files
                     if x.lower().endswith('.ttf') and rl_isreg(x, root)
            filename = os.path.join(root, file)
                face = ttfonts.TTFontFace(filename)
                pdfmetrics.registerFont(ttfonts.TTFont(, filename, asciiReadable=0))
                addMapping(face.familyName, face.bold, face.italic,

from trml2pdf import parseString, parseNode


Right before the parseNode function, add the following function (approximately at line 777). It replaces a number of standard PDF fonts with alternatives that support Unicode characters. I haven’t tried all of them, but Helvetica –> DejaVuSans works for me.

def changeFonts(data):
    fontmap = {
        'Times-Roman':                   'DejaVuSerif',
        'Times-BoldItalic':              'DejaVuSerif-BoldItalic',
        'Times-Bold':                    'DejaVuSerif-Bold',
        'Times-Italic':                  'DejaVuSerif-Italic',

        'Helvetica':                     'DejaVuSans',
        'Helvetica-BoldItalic':          'DejaVuSans-BoldOblique',
        'Helvetica-Bold':                'DejaVuSans-Bold',
        'Helvetica-Italic':              'DejaVuSans-Oblique',

        'Courier':                       'DejaVuSansMono',
        'Courier-Bold':                  'DejaVuSansMono-Bold',
        'Courier-BoldItalic':            'DejaVuSansMono-BoldOblique',
        'Courier-Italic':                'DejaVuSansMono-Oblique',

        'Helvetica-ExtraLight':          'DejaVuSans-ExtraLight',

        'TimesCondensed-Roman':          'DejaVuSerifCondensed',
        'TimesCondensed-BoldItalic':     'DejaVuSerifCondensed-BoldItalic',
        'TimesCondensed-Bold':           'DejaVuSerifCondensed-Bold',
        'TimesCondensed-Italic':         'DejaVuSerifCondensed-Italic',

        'HelveticaCondensed':            'DejaVuSansCondensed',
        'HelveticaCondensed-BoldItalic': 'DejaVuSansCondensed-BoldOblique',
        'HelveticaCondensed-Bold':       'DejaVuSansCondensed-Bold',
        'HelveticaCondensed-Italic':     'DejaVuSansCondensed-Oblique',
    for old, new in fontmap.iteritems():
        data = data.replace('"'+old+'"', '"'+new+'"')
    return data

Then, put the following line at the very top of each of parseNode and parseString (approximately at lines 812 and 820), before the call eTree.XML(rml):

    rml = changeFonts(rml)


(Tested on OpenERP Server 5.0.5 only)

In the method _rml_flowable._textual, modify the line that reads rc1 += etree.tostring(txt_n, encoding=unicode) (approximately at line 460) to become:

                rc1 += etree.tostring(txt_n, encoding=unicode)

That should be all. OpenERP should be all set and ready for creating Arabic reports.