LOB As A Link in Apex

APEX 4.1 enables to include a download link to LOB object in standard or interactive repors.   Documentation is available  here, however the approach is not so obvious from it.  So here is quick recap, how it works:

  1. In report query you must have column that contains LOB length  (not LOB itself!) –  so something like select dbms_lob.getlength(MY_LOB) my_lob_lenght from MY_TABLE
  2. The report column corresponding to LOB length should be set as:
    Display As: Display As Text (escape special characters, does not save state)
    Number/Date Format: DOWNLOAD:TABLE_NAME:LOB_COLUMN_NAME:ROW_PRIMARY_KEY_COLUMN
    (beware names are case sensitive here)
  3. When more sophisticated download behaviour is needed you should also include  columns for MIME type of data, file name and modification timestamp.   Once you store basic DOWNLOAD format you can edit it with masked edit link “BLOB Download Format Mask”
  4. Download link is only shown when LOB length > 0 and is not null.

Continue reading LOB As A Link in Apex

Nice Solution for Recording Screencasts on Linux

Recently I needed to record some screen-cast from Linux desktop.  In past I was using gtk-recordmydesktop, which basically worked well, but I thought  maybe there is something better.   And I have found this combination of two tools very useful –   Kazam (screencaster) and OpenShot (video editing) . Kazam is easy to use with all basic functions that are needed  (screen area definition, multi-display support, audio source selection) and it supports output into two common formats (MP4, WebM).  When screen-cast is finished Kazam gives you opportunity to open it directly with a video editor – here OpenShot can be used to cut your screen-cast video, add titles etc. and  finalize screen-cast video.  Continue reading Nice Solution for Recording Screencasts on Linux

Bash Autocompletion for Root

Debian/Ubuntu do not have bash autocompletion enabled for  root account by default.  When working under root account, this is quite missed feature,   but luckily it can be enabled very easily:

cd ~
apt-get install bash-completion  # if not installed - like in minimal Debian install
nano .bashrc

add folowing to the file:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Sudo without password

I need to use superuser privileges quite often and not so particular about security, but still want to work mainly under my own user.  The solution is to set sudo not to require password for my user:

sudoedit /etc/sudoers

add following line to the end:

your_user_name ALL=NOPASSWD:ALL

As noted this is basically a security risk, so apply only if you are sure what you are doing.

 

Coverting Ebooks with Multiple Processes

Recently I’ve been converting a batch of ebooks into epub and mobi formats.  I used python tools, parts of my project MyBookShelf, which uses calibre and LibreOffice for all the hard work.   The conversion tool enables to run several conversion in parallel – in separate processes.  I wondered how the conversion will speed up with adding more processes.   I ran it  on my notebook with core i5 processor – two physical cores, each core can run two physical threads, 8GB memory. Graph below shows results for conversion of about 10 books into both formats.

Interesting thing for me is that only notable speed up is between 1 and 2 processes.   Not very much gain with running 3 or 4 –  looks like full utilization of HW threads is held back by I/O or memory speed limits?

Removing Diacritics Marks from Strings

Many Latin alphabets (like my native Czech) contain characters with diacritical marks (or can be called accent marks). For some application in computers (like searching, cross systems compatible file names etc.) we would like to remove diacritics and translate  to string containing just ASCII  characters.   Common approach for this is to use UNICODE character decomposition.

It utilizes fact, that unicode has two ways how to represent characters with diacritics – for instance character á (LATIN SMALL LETTER A WITH ACUTE) normaly has code 225,  but this character can be decomposed into two unicode characters   code 97 (LATIN SMALL LETTER A) and character code 769 (COMBINING ACUTE ACCENT).   This process will work for majority of common ‘special’ Latin characters, however there are still few left, for which unicode does not have decomposition defined – these include characters like ø  (LATIN SMALL LETTER O WITH STROKE)  used in Norwegian language or ł (LATIN SMALL LETTER L WITH STROKE) used in Polish language.  A special handling is needed for these characters – basically a transcription table to map these into some basic Latin characters (it could be 1 to many mapping – for instance æ (LATIN SMALL LETTER AE) should map to ‘ae’).

Characters decomposition is defined in unicode standard and all common computer languages contains libraries which contain unicode definitions and can decompose characters.  Below Ishow how this can be done in python. Continue reading Removing Diacritics Marks from Strings

Partly Cloudy – Openstack in VM

Having heard so much about clouds and ‘Infrastructure as A Service’ recently I decided to try Openstack – complete open source solution for cloud computing.   Openstack is actually a set of softwares, that together provide necessary services for a cloud infrastructure.  Openstack (Essex release) can be installed in virtual machine, Virtual Box in my case, so I gave it a try and here are some of my observations: Continue reading Partly Cloudy – Openstack in VM

The Taming of The Mouse – Details of Mouse Setup in X

After upgrade to  the new version of Linux (Mint 13, which is based on Ubuntu Precise) I’d found that my trackpoint is not working right (on Dell E6410), it was bit unresponsive and movement was not smooth.   Touchpad was generally  OK, but trackpoint really sucked. So I had to look into details of mouse setup in X and I was really surprised how many various parameters are there and how many aspects of mouse behaviour could be modified.   So I’d like to share few tips how to set pointing device – apart of those obvious settings, which are available in desktop settings (Acceleration and Sensitivity).

Continue reading The Taming of The Mouse – Details of Mouse Setup in X

APEX – Dynamic Actions with Report Region

In many scenarios it would be nice if we can provide some dynamic actions to report (classical) region, which can be handled via Ajax calls, rather then submitting a whole page  – these actions could include:

My Digital Bits And Pieces