Xen 4 – Combined Bridged And NAT Networking

Normally Xen is deployed with plenty of of public IPs,  so it can use bridged networking and each virtual machine can have it’s own public IP.  However in my case I was limited by only 1 public IP, but I wanted to run several VMs with services accessible from outside.  Solution was to modify XEN networking scripts.

Idea is to use an internal bridge with hidden IP subnet and to use NAT and port forwading so particular services on VMs can be reached from outside (on public IP, which is assigned to DOM0).This solution works for me successfully on Debian Squeeze. Continue reading Xen 4 – Combined Bridged And NAT Networking

Writing to file in Firefox Extension

Mozilla has provided nice high level API in its Add-On SDK, where one can relatively easily write an extension, without need for any special knowledge about internals of Firefox – the general knowledge of Javascript, HTML and CSS plus very nice and detailed documentation of the SDK are basically enough.

However there are some functionalities, that are not available in SDK and then more effort is needed and  XPCOM components have to be used via their JS interfaces.  This requires bit more  research, so I’d like to share one useful snippet of code  – how to save string to file, which user has chosen via standard file picker dialogue: Continue reading Writing to file in Firefox Extension

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?

My Digital Bits And Pieces