Quick And Dirty Oracle Backup

I have an Oracle 11g installation running in virtual machine (under Xen). Oracle is used for APEX development and some host few local applications for our team. From time to time I need to do cold backups – to keep data around or to move them to another VM on different server, which is running identical version of oracle  and can be used as cold backup eventually.   The backup device is an USB disk with FAT32 filesystem (FAT32 was chosen a while ago for compatibility reason – to be able to attach it to almost any OS) and the disk is attached to other server. FAT32 means that there is a limit on file size, so the database backup need to be split to chunks (backup is 10-15 GB). Of course RMAN can do proper job, but since I’m no real DBA I want to have something quick ( data are not mission critical and also it is no problem to bring DB down) – so warning do not apply this procedure for important databases – no guarantee that it will work in all circumstances and you may loose your data . Continue reading Quick And Dirty Oracle Backup

GSettings – Flexible Configuration System

GSetttings is the standard way how Gnome 3 applications store their configuration. GSettings is the front-end interface for application, actual values are stored by back-end – standard one is called dconf. We can then use the tool dconf-editor to easily browse all stored configurations for all applications. Thanks to GObject introspection we can also work easily with GSettings from python. Continue reading GSettings – Flexible Configuration System

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

My Digital Bits And Pieces