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

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.

Dell Inspiron N5010 Drivers for MS Windows Vista and Windows 7

August 8th, 2010

System BIOS
ftp://ftp.us.dell.com/bios/N5010A06.EXE

-
AMD ATI Mobility Radeon™ HD 550v

Inspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/video/R272410.exe

Intel HM57 Express Chipset FamilyInspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/chipset/R257260.exe
ftp://ftp.us.dell.com/chipset/R272193.exe
ftp://ftp.us.dell.com/chipset/R275031.exe

-
IDT 92HD79B1
Inspiron M5010
Inspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/audio/R260827.exe

-
Realtek RTL8103T Ethernet Controller

Inspiron M5010
Inspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit

ftp://ftp.us.dell.com/network/R257292.exe

-
Dell Wireless WLAN 1520 Half MiniCard

Alienware Laptop M11xR2
Inspiron Desktop 400(Zino HD)
Inspiron M5010
Inspiron N3010
Inspiron N4010
Inspiron N4020
Inspiron N4030
Inspiron N5010
Inspiron N7010
Studio Laptop 1747
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit

ftp://ftp.us.dell.com/network/R252544.exe

Inspiron N5010
Microsoft Windows 7 64-bit

ftp://ftp.us.dell.com/network/R252283.exe

Intel (R) WiMAX Link 6250
Inspiron N5010
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/network/R247430.exe

-
Dell Digital TV Receiver ATSC-01

TV Tuner Digital TV Receiver ATSC-01
Inspiron M5010
Inspiron N5010
Inspiron Mini 10v (1011)
Inspiron 1464
Inspiron 1564
Inspiron 1764
Studio XPS Laptop 1647
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit
Microsoft Windows XP

ftp://ftp.us.dell.com/video/R231725.exe

-

Dell Wireless 365 Bluetooth Module
Inspiron M301Z
Inspiron M5010
Inspiron M5030
Inspiron N3010
Inspiron N4010
Inspiron N4020
Inspiron N4030
Inspiron N5010
Inspiron N7010
Inspiron N301Z
Inspiron 1546
Inspiron 1564
Latitude Z600
Studio Laptop 1557
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/network/R226746.exe

-

Realtek RTS5159 Card Reader
Inspiron M5010
Inspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/chipset/R257282.exe

Conexant D400,External USB 56K Modem
Inspiron M301Z
Inspiron M5010
Inspiron M5030
Inspiron N3010
Inspiron N4010
Inspiron N4020
Inspiron N4030
Inspiron N5010
Inspiron N7010
Inspiron N301Z
Latitude 13
Latitude E4310
Studio Laptop 1457
Studio Laptop 1458
Studio Laptop 1749
Vostro Notebook 1320
Vostro Notebook 1520
Vostro Notebook 1720
Microsoft Windows 7 64-bit

http://ftp.us.dell.com/comm/CONEXANT…01_R232499.exe

-
Synaptics Synaptics TouchPad
Inspiron M5010
Inspiron N5010
Microsoft Windows 7 32-bit
Microsoft Windows 7 64-bit
Microsoft Windows Vista 32-bit
Microsoft Windows Vista 64-bit

ftp://ftp.us.dell.com/input/R257288.exe

COPY - Enabling Arabic Support in OpenERP Reports - COPY

August 8th, 2010

Below post is just a copy of http://brain.centrivision.com/enterprise_applications/openerp/arabic_support :

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.in configure setup.py

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

./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:

cd
python
>>> import pyfribidi2

Note: If you get an error about libfribidi.so.0 not being found, try to reboot your machine. If the error still persists, you may need to edit ”/etc/ld.so.conf”, 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.

rl_config.py

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):

'/usr/share/fonts/type1',

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

'/usr/share/fonts/truetype',

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

'/usr/share/fonts/cmap',

pdfgen/textobject.py

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
try:
    import pyfribidi2 as pyfribidi
    log2vis = pyfribidi.log2vis
    DIR_ON = pyfribidi.ON
    DIR_LTR = pyfribidi.LTR
    DIR_RTL = pyfribidi.RTL
except:
    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))

platypus/paragraph.py

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 self.style.wordWrap == '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/init.py” and ”[bin/]report/render/rml2pdf/trml2pdf.py”.

report/render/rml2pdf/__init__.py

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):
    try:
        st = os.stat(os.path.join(dirname, filename))
    except OSError, reason:
        if reason.errno == 2:
            return False
        raise
    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)
            try:
                face = ttfonts.TTFontFace(filename)
                face.extractInfo(1)
                pdfmetrics.registerFont(ttfonts.TTFont(face.name, filename, asciiReadable=0))
                addMapping(face.familyName, face.bold, face.italic, face.name)
            except:
                pass

from trml2pdf import parseString, parseNode

report/render/rml2pdf/trml2pdf.py

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)

report/render/rml2pdf/trml2pdf.py

(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.

HP IPG Laserjet printing supplies packaging changes

July 31st, 2010

HP will roll the packaging of HP LaserJet print cartridges to a new design to align IPG portfolio for consistent premium brand communication via a consistent packaging identity and retail experience.

All HP LaserJet monochrome AND colour print cartridge packaging will include a new selectability number. Monochrome has a 2-digit number & Colour a 3-digit number.

First new packaging for monochrome already is shipping (July 2010), first colour cartridges scheduled to start as of August 2010.

Can a purchased domain’s history affect its trust with search engines ?

July 16th, 2010

Batch converting audio files :

May 16th, 2010

This script may be of interest and value :

File: convertomp3
#!/bin/bash
#
# Usage: convertomp3 fileextention
#
if [ $1 = "" ];then
  echo 'Please give a audio file extention as argument.'
  exit 1
fi

for i in *.$1
do
  if [ -f "$i" ]; then
  rm -f "$i.wav"
  mkfifo "$i.wav"
  mplayer \
   -quiet \
   -vo null \
   -vc dummy \
   -af volume=0,resample=44100:0:1 \
   -ao pcm:waveheader:file="$i.wav" "$i" &
  dest=`echo "$i"|sed -e "s/$1$/mp3/"`
  lame -V0 -h -b 160 --vbr-new "$i.wav" "$dest"
  rm -f "$i.wav"
fi
done

Running convertomp3 wma will covert every .wma file in the current folder to .mp3.

Oracle Outlines Strategy for MySQL

May 14th, 2010

Edward Screven, Oracle’s Chief Corporate Architect, discussed the current and future state of MySQL in his keynote at the MySQL Conference & Expo.

Watch this video on youtube :

Latest HP anti-counterfeit printing supplies report in Egypt

March 20th, 2010

Local authorities in Egypt has confiscated more than 70000 counterfeit HP product from the local market in the past few months. Find detailed report in Arabic here.

No more Internet Explorer 6

March 6th, 2010

As of March 1st, 2010, Google has dropped support for Microsoft longest standing web browser, the IE6. Meaning that Google docs, Google Apps, Gmail and all other Google services will no longer support the ageing browser in an effort to introduce new features to these services.

How to win against your competitors in the search engines war ??

February 19th, 2010

Getting your website ranking as high as possible with major search engines is crucial for your business. It also gives you winning advantage against your competition. We will discuss in this article several factors that contribute to how high you can go on a search engine query result.

Please realize there is no such thing as a magic silver bullet that will vault you to the top of the search engines – if there were, everyone would know it, they would do it, and it would cease to work because of saturation.

Several strategies contribute to this, as you can see from the following. First, we will discuss the general strategies and techniques used with all major search engine. Then we will discuss the specific the specifics of what is currently working on each of the major search engines.

Part One : General Guidelines

Choosing your domain name :

One of the most basic, yet critically important, strategies is to use your best keywords in your domain address. An example would look like…

http://www.laptopshome.com
http://www.notebooksforsale.com

The reason for doing this is because search engines and directories assume the domain to be relevant to the keyword. It’s something that, in practicality, can’t be faked.

Getting your keywords into your domain name is strategically critical and chances are it will only become even more important in the future. Remember, by registering all possible keyword combination domain names you can think of you not only have them available to your company when needed but you’ve also prevented your competition from securing them and using them against you.

If your company name is your domain name, then that’s fine but you should still register all relevant keyword-rich domain names pertaining to your goods and services. This will give you the option of setting up specialized sites that place your services into the paths of the engines and directories.

Getting Your Web Page Titles Right :

This is all about your pages <TITLE> tag. Note in mind that Title is the most important aspect of web page design in respects to scoring well on most search engines.

Always make sure every word in your title is one that is likely to be used by a person when doing a keyword search for your business or service. AND, keep in mind that unless the name of your business is prominently recognized or likely to be used in a keyword search – something like “SONY cameras”, it does NOT belong in the Title tags.

Keyword Selection Techniques :

Make a list of every possible search word (keyword) and search phrase (keyphrase) that your potential customers
might use when looking for your information, product or service. Remember to include synonyms as well as the common misspellings of your keywords and pay particular attention to noun phrases. Next, use these keywords and keyphrases to find your competition on the top search engines.

Keyword Relevancy :

Simply put, your keywords must be relevant to the contents, or theme of your web page.

Keyword Density :

By this I mean the number of times your keyword(s) appear in relation to the other words on your web page.  Theoretically, a webpage that said only “Chicago” verses the “Eat at Chicago’s…” page would be given a higher score for the keyword Chicago due to a higher keyword density.

Description Meta Tag :

The meta description tag is used by many engines as the summary for your site when listed in the search results. It’s what tells a real person whether or not your site is relevant to their search. You should view it as a sales presentation for your link. If the meta description tag entices the searcher they will, theoretically, click your link and visit your site. Obviously that’s the purpose for being listed in the search engine in the first place.

Most search engines place a limit on the number of characters that a meta tag can contain. Once the limit is reached they typically ignore the rest of the tag contents. In general, 250 characters – including spaces and commas – is a good rule of thumb that falls within the guidelines of most engines.