Blog

// One Year with Amazon Kindle

About a year ago I finaly purchased my first Kindle 3 Wifi (later renamed to Kindle Keyboard Wifi). In these days new VAT limit for purchases out of EU was starting to be applied. But I ordered it in time before the final price raised by 20%. UPS delivered the package from US quicker than Czech Post Office is even able to deliver letter from one part of Prague to another (yes, they let you pay for it a lot). In parallel, leather cover was going from China. It took about 2 weeks to the delivery (but the shipping was free of charge).

It had not (and still has not) any sense to purchase Kindle from Czech retailer since the prize is much better and acording to many people on internet, Amazon return services are much better than services of arbitrary Czech e-shop.

Kindle in leather cover from DX.com

Primarily I've bought Kindle for school purposes (lecture notes and papers). I refused big Kindle DX because of its price and size, and purchased the small one. I became familiar with it very quickly, even for fictional books reading. After few years, the market with Czech written books finally arises but sometimes books include painful non-Amazon incompatible DRM stuff. Czech (and world's) classics is available for free from e.g. Municipal Library of Prague. In recent days I fell in love with shopping from Amazon, for both fictional and technical literature. Beside the fact that the price is much better, some books are not even available in Czech Republic.

Pros:

  • Size and weight. Now I need not to take big bag with books to a vacation.
  • e-Ink display. The most excellent LCD in the world cannot compete with it.
  • Amazon Whispernet. In combination with e.g. Send to Kindle Chrome extension, it's unbeatable for offline articles reading.
  • Dictionary integration. For us who do not handle English vocabulary so well.

Cons:

  • Inability to open non-Amazon DRMed books. Our local market with DRM protected books lays on Wooky or Adobe DRM technologies.
  • Low speed. When using dictionary, switching from book to dictionary and back is a bit slow. Also handling PDF documents is slow.
  • Kindle is unable to automatically check for new documents at Whispernet when in sleep mode. So I must remind to wake it before going to work if I manage to read newspaper.

// Compiling UI and resource files with PyQt

PyQt is a python binding for popular Qt library (which became LGPLed for non-commercial purposes recently). If you use Qt Designer, you have to compile XML description of UI or Qt resource files to Python code to use them in your application.

In C++, you can easily use qmake tool or Automake for creating suitable Makefile. For Python, there is no Makefile needed since Python compiles modules as they are loaded into VM. With PyQt, you can use uic module for compiling ui files or loading them as a Python class.

Alternatively, you can use pyuic4 and pyrcc4 command line tools in the similar way as appropriate Qt tools (uic, rcc). I'm using this way to produce Python code. Both tools have similar usage:

#compile ui file from Qt Designer
pyuic4 ui_file.ui -o compiled_ui_file.py
#compile resource file (icons, etc..)
pyrcc4 resource_file.qrc -o compiled_resource_file.py

Formerly, I had one shell script to compile all my resource files in project at once (because I was too lazy). This solution has two main disadvantages. At first, compilation of all resources takes more time than compiling of modified files only. This varies with amount of resource files your project has. The second one is more annoying to me. Since I also track compiled versions of UI and resource files (for no particular reason yet) with Mercurial, it always creates new changeset because pyuic4 tool adds information about compile time to Python code comments. So I refreshed my Makefile knowledge (and also used some old code snippets) and created following Makefile for compiling UI and resource files separately.

###### EDIT ##################### 
#Directory with ui and resource files
RESOURCE_DIR = src/resources
 
#Directory for compiled resources
COMPILED_DIR = src/ui
 
#UI files to compile
UI_FILES = confirm.ui main.ui repair.ui settings.ui statistics.ui
#Qt resource files to compile
RESOURCES = images.qrc 
 
#pyuic4 and pyrcc4 binaries
PYUIC = pyuic4.bat
PYRCC = pyrcc4
 
#################################
# DO NOT EDIT FOLLOWING
 
COMPILED_UI = $(UI_FILES:%.ui=$(COMPILED_DIR)/ui_%.py)
COMPILED_RESOURCES = $(RESOURCES:%.qrc=$(COMPILED_DIR)/%_rc.py)
 
all : resources ui 
 
resources : $(COMPILED_RESOURCES) 
 
ui : $(COMPILED_UI)
 
$(COMPILED_DIR)/ui_%.py : $(RESOURCE_DIR)/%.ui
	$(PYUIC) $< -o $@
 
$(COMPILED_DIR)/%_rc.py : $(RESOURCE_DIR)/%.qrc
	$(PYRCC) $< -o $@
 
clean : 
	$(RM) $(COMPILED_UI) $(COMPILED_RESOURCES) $(COMPILED_UI:.py=.pyc) $(COMPILED_RESOURCES:.py=.pyc)  

It works with GNU Make (from Cygwin or MigGW on Windows). It compiles files in following manner:

  • window.ui –> ui_window.py (GUI definition)
  • images.qrc –> images_rc.py (resources)

Now you can easily compile only modified files by only typing make in console. Make sure that your current working directory contains Makefile shown above.

// Facebook Chat now supports XMPP, finaly

Facebook social network finaly supports XMPP, better known as Jabber, for its chat. So it is possible to use it with various IM clients supporting Jabber. Therefore you needn't to have the Facebook web opened to chat with all those hundreds of your friends. :-)

Your JID is your_login@chat.facebook.com. Therefore, login server is chat.facebook.com. Port is 5222. SSL/TLS encryption is not supported.

Howtos for various IM clients can be found on this page.

// Lost in inheritance

Lost in ihneritance

Lost in ihneritance

// My first DokuWiki plugin

Few months ago I completely updated my website. I chose DokuWiki as a very flexible engine extendable with lots of plugins.

I also used Blog plugin and more to make my personal blog. But I missed one feature. This was metadata footer at blogpost page, similar to the one printed by Include plugin at blog page. Yes, DokuWiki prints footer, but when Discussion plugin is used, it is printed far far below the comments.

So I made simple plugin which inserts this information right before the text and comments. As an example, see information down this page. I had to make some hack of event handler internals to make my plugin to be the first listener of TPL_ACT_RENDER_AFTER event, just before Discussion plugin. As an effect, meta footer is printed before comments. You can download it on my DokuWiki goodies page.

About me
SW developer, amateur tennis player, rock'n'roll & heavy metal fan.