tag:blogger.com,1999:blog-51748122147029778762016-12-17T14:23:04.689+03:00kondor's IT beetlebumkondor's blog to dump his thoughts about informational technologies.Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.comBlogger32125tag:blogger.com,1999:blog-5174812214702977876.post-60390615025366578662013-11-05T21:55:00.001+04:002013-11-05T21:55:59.741+04:00Pattern of Error Reporting in Python
Instead of Intro
That is not an uncommon and even not rare when an application which was supposed to be a prototype suddenly becomes a tool for everyday usage. Not a perfect thing here is that in a rush to make the program more or less user-friendly a developer has to hide internals by preserving error messages with internal details. Here I am going to share the pattern I mostly use in my "Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-17031935943227031042013-10-15T20:13:00.005+04:002013-10-15T20:13:58.210+04:00Python, argparse and Environment Variables
argparse more likely is the one of frequently used Python's libraries. It covers all standard cases out of the box. When a case goes beyond the box a developer is encouraged to extend the library with the specially provided API.
What to do when the argument is marked as required and its value is not changed during some quite long time? Make the argument's value persistent; store somewhere. Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com2tag:blogger.com,1999:blog-5174812214702977876.post-24360225860027812602013-09-04T21:30:00.002+04:002013-09-04T21:30:53.939+04:00Run Unit Test automatically for Python code
Have you ever thought how often you write the tests for the newly developed code? I believe that more likely -- every time. Even a tiny tool which will never leave the developer's sandbox, which is supposed to show that the implemented logic is correct might be called a "test"; it is not perfect, not maintainable, but it is intended to do at least one thing -- to check the code. I did so. Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-83277533004615592612013-05-29T22:18:00.002+04:002013-05-29T22:20:28.146+04:00Pass arguments to BaseHTTPRequestHandler
Each time when I face with the Python's built-in web-server (BaseHTTPServer) I feel a pain. The pain is caused by a strange architectural decision to pass a class as a request handler not an instance. At first glance it does not matter what kind of entity to pass. Since you can extend the default implementation with your logic. It still does not matter until a some moment. This moment happens Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com3tag:blogger.com,1999:blog-5174812214702977876.post-13155857786149680282012-09-06T09:33:00.000+04:002012-09-06T09:33:14.751+04:00Make new ThinkPad's charge thresholds work in Debian/Ubuntu
Instead of Intro
ThinkPad`s have been always famous for the amazing hardware compatibility with Linux. But seems this time has gone and owners of new ThinkPad`s like ThinkPad X230, T430 and of some other may have started experiencing some uncomfortable changes. The one of the such changes is inability to use tp_smapi module to set battery thresholds.
Battery charge threshold might be importantAndrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com6Moscow, Russia55.7427928 37.615400955.4567773 36.983686899999995 56.028808299999994 38.2471149tag:blogger.com,1999:blog-5174812214702977876.post-91124457867082108982012-07-22T11:16:00.000+04:002012-07-22T11:40:17.633+04:00Splitting OpenBox configuration to several files
Several weeks ago I decided to enhance performance of my Linux-powered ThinkPad x120e laptop. The one of the steps was switching from XFCE's window manager to a more lightweight and configurable one. I decided to give a try to OpenBox and since then I still like it.
Being a Software Developer I cannot stand pieces of software code which are large than ~15 lines. The one of the reasons is such Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-51677142959276182682012-05-30T09:41:00.001+04:002012-05-30T09:41:05.408+04:00How to replace screensaver in XFCE
Intro: XFCE's default screensaver
By default XFCE is shipped with a quite ascetic xscreensaver. Some people ma find it not attractive. So I do also. For example, if you install an alternative screen locking application called i3lock there are about no chances that it will be used by XFCE. Even there are no other alternatives installed. Because XFCE knows nothing about it. But user definitely Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com3tag:blogger.com,1999:blog-5174812214702977876.post-44262024411532364692012-05-01T19:36:00.000+04:002012-05-01T19:36:23.759+04:00Some TrueCrypt sugar for Linux
Intro
Currently we have a fast growing trend called "Clouds". In the Clouds we can store about everything and be sure that we are able to get it back anywhere and anytime. The only thing is Clouds do not belong to us. That's why we should think critical when we upload a very-very private data there. This way of thinking leads us to use various file encryption tools like encfs, TrueCrypt and Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-12410182528912296072011-12-03T22:59:00.001+04:002011-12-03T23:47:20.156+04:00Reduce Linux laptop's backlight on boot up
I like Linux. Especially for being able to create graceful workarounds for the things we get accustomed in a real life.
Being a Linux-powered laptop owner I have always been annoyed by sharp backlight change when Linux boots up. I do not like when a backlight is set to the maximum one and there are no ways to affect these settings on. So I did a very funny trick.
System's backlight (aka "Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com3tag:blogger.com,1999:blog-5174812214702977876.post-62349511044893065942011-11-11T11:01:00.001+04:002011-11-11T11:44:10.320+04:00Python, make ConfigParser aware of spaces
There is a wonderful Python's module called ConfigParser which allows to process .ini-style configuration files easily. I prefer to use it everywhere rather than spend the time to implement my own solution. Recently there was a bug received that values with leading and trailing spaces are read incorrectly: spaces are lost. This might be important for cases when an application is sensitive for Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com3tag:blogger.com,1999:blog-5174812214702977876.post-5378241842350532852011-10-28T22:23:00.001+04:002011-10-28T22:24:17.838+04:00PAM authentication for Transmission btorrent client
The one of the most valuable things in the World Wide Web beside the public available knowledge are files. Files which you can grab; and it does not matter they are Free or not. Files could be downloaded using various ways: when you grab them for yourself only or when not just grab but also provide others with the abilities to get them easily too. Due to the second point I like to use torrents.Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-83245632198878110312011-06-23T11:44:00.001+04:002013-10-27T11:41:49.072+04:00actkbd package for Debian/Ubuntu
Recently I became an owner of Thinkpad X120E laptop produced by Lenovo. The computer was supplied with no pre-installed OS so I deployed (unexpected decision, huh!) Debian GNU/Linux there. This time I decided not to use desktop "ready-to-use-out-of-the-box" environments like Gnome or KDE and give a try to build a DE I want from bricks.
The one of the tasks I have faced with is how to make Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-33840766902253306962011-05-22T17:56:00.000+04:002011-05-22T17:56:54.887+04:00Python, imp.load_source() trapWhile I have been writing a hook for WebApy lightweight RESTful Python webserver -- the recent a project of mine, I got ran into the funny (actually it wasn't; since it was hard enough to debug) issue related to loading of Python-app addons. As far as you know (or not; if you already have taken a look at sources), there is Python's standard library's 'imp' module is used to load hook files. "Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com1tag:blogger.com,1999:blog-5174812214702977876.post-921434036580644692011-05-11T09:18:00.001+04:002011-05-11T11:42:17.784+04:00WebApy -- webserver for easy and rapid REST API imitationHave been developing an application which depends on a remote REST (stands for Representational State Transfer) API of one of popular services I ran into the need to use it [API] more intensively while testing/debugging the code. Not all remote services provide developers with SandBox`ed environments to play in. And not all services may tolerate frequently repeated requests to their REST API; Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-82130857137816204982011-05-01T14:32:00.001+04:002011-05-01T14:35:38.873+04:00Broken Java networking in DebianPlaying around with Java I ran into the problem well known as Bug #560044. Seems that the problem appears for Debian GNU/Linux only. The essence of the issue is: when you run any Java application that requires network access (by HTTP or by other protocol; it does not matter) you will (as well as the running application itself) receive the following error. Or a very similar one:
Exception in Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-82750040187929154392011-02-12T22:33:00.000+03:002011-02-12T22:33:31.756+03:00Customizing GNOME screensaver's lock dialogUsing bleeding edge Linux there are absolutely no guarantees that something doesn't go wrong. Several days ago I updated my Debian GNU/Linux "Testing" [branch] installation in the way I usually do using aptitude upgrade. Some things got broken some didn't. After this update I found that appearance of GNOME screensaver's lock dialog had changed: it became collapsed in it's total width. So, how to Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-65315982757800679472010-10-13T22:46:00.001+04:002010-10-13T22:47:29.189+04:00Transition to Android. Said 'No' to Nokia.It seems I have not updated this for ages. Lets sort this out!
From the technical point of view the most considerable news of mine is that I am not Nokia admirer any more. Yes, it happened! (*)
Firstly I sold my Nokia N810 which I very liked and was very proud about (year ago, not now). The second thing I did - I got rid (**) of my E50 (Nokia) cellular phone. And finally I bought new Android Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-30467087232834819662010-06-08T23:41:00.000+04:002010-06-08T23:41:27.906+04:00Linux, Thinkpad, HDAPS: battery modeThinkPad laptops have a lot of amazing features. HDAPS is one of them. HDAPS stands for Hard Disk Active Protection System; it is intended to protect ThinkPad's HDD from damage in case of a notebook drop or other kind of impact while it is running.
But HDAPS doesn't work 'out of the box' on Linux by default. On my Debian too. But there is so indispensable website named ThinkWiki with the tons ofAndrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-9404856829196573612010-06-02T20:52:00.000+04:002010-06-02T20:52:51.047+04:00APT suggests to remove (autoremove) required packagesAfter another packages update (or after my attempts to remove Evolution out from the system, I do not know exactly) on my Debian Squeeze, APT began to suggest me to remove 'non-required' packages using 'autoremove' option like this:
The following packages were automatically installed and are no longer required: totem-common libempathy-gtk28 libaprutil1-ldap vinagre odbcinst Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-90979853610670699082010-05-22T08:35:00.000+04:002010-05-22T08:35:41.888+04:00Twitter and my solution for Debian + Thinkpad issuesHaving the latest Debian Squeeze (kernel 2.6.32) I got in some issues (hm... Seems that for some time I'm going to write about Debian and my Thinkpad only :)) with my laptop.
The common issues that I (and Google proves that not only my Thinkpad T410 run into them) had were:
LCD brightness up/down doesn't work with loaded up ``thinkpad_acpi'' module; ``hotkeys'' module param does not help. Even `Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-18544299440133259692010-05-20T11:09:00.000+04:002010-05-20T11:09:03.126+04:00Debian Lenny + Thinkpad T410: network adapter issueSince I chose Debian to be my primary and favorite Linux distribution on my new Lenovo Thinkpad T410, I agreed to myself to spend my time to solve various specific issues related to it.
So the first issue I met was that the Debian Lenny installation system didn't manage to find my Thinkpad's Intel 1000 ethernet adapter. Google 'said' that appropriate driver for the adapter was 'e1000e'. Manual 'Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com5tag:blogger.com,1999:blog-5174812214702977876.post-70459512956483674452010-05-06T22:19:00.000+04:002010-05-06T22:19:59.394+04:00My new laptop: Lenovo ThinkpadToday I bought my first Thinkpad -- Thinkpad T410. I know that since 'Thinkpad' trademark was bought out from IBM by Lenovo many people believe that they lost their legendary advantages. I think so also. A bit :). Anyway I still like them and their spirit.
Buying Thinkpads in Russia has its own unique peculiarities.
First one: you have to do your best to find a laptop w/ tech specs you like/needAndrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-71906875885130402922010-04-28T21:33:00.001+04:002010-04-28T21:34:35.785+04:00'cp' command with a wget-like progress barCan not help re-posting: a tip and trick to make 'cp' command have a wget-like progress bar.
#!/bin/sh
cp_p()
{
strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
| awk '{
count += $NF
if (count % 10 == 0) {
percent = count / total_size * 100
printf "%3d%% [", percent
for (i=0;i<=percent;i++)
printf "="
Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-1190030446620919562010-03-16T11:28:00.000+03:002010-03-16T11:28:59.554+03:00How to return back buttons layout in Ubuntu 10.04Ubuntu wants to be more user-friendly than other Linux`es. It is the fact. Each new Ubuntu release always introduces a set of features which make user's life easy. But not all these features are cool. Is the fact too.
Upcoming Ubuntu 10.04 also introduces a Mac-like approach when window-control buttons (to minimize, to maximize and to close a window) are placed on the top-left side of the window,Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com0tag:blogger.com,1999:blog-5174812214702977876.post-21552243660260979632010-03-11T15:59:00.007+03:002010-03-11T16:12:44.032+03:00Code snippet: QLabel to show remote pixmap by URLPerhaps one of the most often used widgets in Qt is QLabel. It is mainly used to display a plain text as well as rich one (which contains HTML markup). QLabel is also able to show graphics by passing QPixmap instance to it. But what if there is a need to display (using QLabel) a pixmap stored on remote server? There is no such "out of the box" functionality in QLabel. But it can be easily done. Andrew "kondor" Sichevoihttp://www.blogger.com/profile/11819320892810620423noreply@blogger.com1