Some types of web applications require to start long running tasks – like import of file, compilation etc., but user still needs to have real time updates about progress of the task, eventually some error messages, warnings from the task (cannot import particular line, compilation error). There are existing robust solutions like Celery, but it is aways fun to reinvent the wheel In this case we focus on simple solution, without need for request broker in middle, which enables immediate/ real time updates on running tasks to client browser.
For our solution we will use two cool technologies/libraries web sockets and zeromq library. Continue reading Long Running Taks in Web App/Django
Recently I’ve updated TheTool to support also AppIndicator3 interface so it can show icon in Unity panel. Although the documentation is not saying it, you can use absolute path to PNG image as icon-name ( apart of stock icon name). I was trying to add application specific stock icons, but is somehow did not work well (only possibility is to use
xdg-icon-resource install --novendor --size 32 picture.png icon-name, but python code for creating application specific icons with Gtk.IconFactory was not working for me – see this post on stackoverflow). Continue reading AppIndicator3 – how to use custom icons
Almost all APEX applications I’ve been working with recently are used across multiple timezones, where many timezones uses DST (Daylight Saving Time) – that is basically almost all Europe and North America. The natural requirement is that users can see date+time information in their timezone time, reflecting if DST is active or not. Timezones and time conversions are always bit of mess and APEX is not supporting this completely out of box, but with small effort we can make our applications really global. Continue reading Timezones and DST in Oracle APEX
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
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
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:
- 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
- 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)
- 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”
- Download link is only shown when LOB length > 0 and is not null.
Continue reading LOB As A Link in Apex
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?
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
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: