About springs
Spring has came (to northern hemisphere, that is). That is to say, calendar one, and it doesn’t seem true one to me. We count years by sun, so all the seasons of year should be determined by solar events, solstices and equinoxes (equinoces?). Astronomers believe that spring begins on vernal equinox (20 Mar in 2011). But that’s a bit strange to me personally, since that way daytime increases only in winter and spring, and summer and autumn are both time of “darkening”. I’d prefer to consider that equinox (or solstice) are middles of theire seasons, so spring is a quarter of year, when daytime growth is fastest; summer is a quarter of year with the biggest daytime etc. Either way, the first day of real, solar spring is three weeks away from today. Before or after.
Python: nested iterator
Just a (probably) useful examle of nested Python generator written in Python using recursive *yield* expression.
{hg, git} bisect + portage
Recently I did stumble into a annoying bug in awesome WM. Devs asked me to do git bisect in order to help fixing it, but it appeared that simple compiling and running the binary wasn’t enough for reproducing it, so I though a bit and managed to couple bisecting and Portage.
Tabs and spaces
That’s quite old and well-known, of course, but I now have to deal with code like that (count the spaces!):
class c_integral_type(c_type): def __init__(self, name, format, min, max): c_type.__init__(self, name, struct.calcsize(format))
or like that (tabstop
is obviously expected to be 8 or 12):
def genMemList( self, members ): # indented with 4 spaces self.append( '\tdef members(self):\n' ) # indented with one <Tab>
So…
Oh noes! That’s what I had to deal with:
% pylint buratino ....... Your code has been rated at -1.79/10
My code isn’t perfect, I’d be first to agree, but it scores 7/10, and it’s positive 7, mind you! Bloody hell. So, back to work then
Eselect’ing xorg.conf
While experimenting with nvidia/nouveau I’ve decided to write module for app-admin/eselect to eselect required /etc/X11/xorg.conf from list. So here it is. Get it, use it, report bugs in it (here or, better, open issue on GoogleCode). Ebuilds are in rion overlay.
psycopg2 returns tuples of string
Today I was fiddling with PostgreSQL (v8.3, if anyone is interested) database from Python using famous psycopg2, but suddenly got stuck in unexpected place. Had switched to bpython shell I saw the following:
>>> cur.execute('''SELECT (parent, level) FROM "MsgElems" WHERE msg_id=1;''') >>> cur.fetchone() ('(0,1)',)
SELECT returned tuple of string, one string. Now that’s what I call unexpected… I didn’t find anything neither in Python DBAPI PEP nor psycopg docs, but after some time a bright idea came:
>>> cur.execute('''SELECT parent, level FROM "MsgElems" WHERE msg_id=1;''') >>> cur.fetchone() (0, 1)
Watch out. Meanwhile I’ll try to find out, what triggers such weird behaviour, and if it is weird at all.
Change the code and see the result
An interesting idea came to me several days ago. I have to write C++ code generator (sourcing data from SQL database), so I installed Jinja2, sharpened text editors and then asked myself: „Wouldn’t it be beautiful to see the result just as I type Python code, portion by portion? There’s a use for two monitors: the first one displays coding, the second one keeps freshly generated result always ready for review.“
Philips Xenium E100: review
Recently my old Siemens C60 has died, so I had to buy new cell phone. Since I’m not phone geek at all, I’ve decided to buy the simplest (just to call and write SMS) of Philips Xenium series (exceptional battery lifetime). So, here it is, my Philips Xenium E100.
Torrent server with GUI clients using Deluge
If you want to set up torrent-downloading server and control it with GUI-clients (even on Windows) read my article on Gentoo Wiki. If you’re using other *nix or Linux distro, you’ll need to think a little bit, of course, but nevertheless one might find it useful.
Gentoo: DRM, Radeon/RadeonHD, ATI R6xx/R7xx
Here’s brief summary of one hour on **#radeon** IRC channel:
old DRM modules don’t create /dev/dri/* for ATI R6xx/R7xx-cards, that’s normal;
kernel (up to, but not incl. 2.6.30) DRM aren’t that old, but neither aren’t new enough to support the cards in question;
moreover, DRM mainline lacks their support too: therefore x11-base/x11-drm doesn’t suit;
in order to build DRM modules for R6xx/R7xx, one should git-clone source from specific git branch (see Xorg Wiki)
use ebuild from x11 overlay with DRM_LIVE_BRANCH=”r6xx-r7xx-support” added to your /etc/make.conf
Added later: described technique has no use, if you’re running kernel 2.6.30 and later. Just compile DRM-modules and have fun.
Toshiba Satellite L350D-10X
Couldn’t find more or less official description in English. Kind of weird (-:E
Vista wiped out, Gentoo Wiki article started
How to check if your ISO-image has been burnt properly
If you has burnt some .iso-image with known md5-checksum, you can verify if disk is valid and was burnt properly
dd if=<your-CD/DVD-ROM-device> | md5sum
Example:
# dd if=/dev/hdc | md5sum && md5sum /mnt/win_e:/software/linux/systemrescuecd-x86-1.0.4.iso 68f9c2d885d95c82bfe6c7df736ae0a3 - <dd output skipped> 68f9c2d885d95c82bfe6c7df736ae0a3 /mnt/win_e:/software/linux/systemrescuecd-x86-1.0.4.iso
As you can see, md5sums are the same, so disk is valid. If someone knows how it could be done under MS Windows, please comment here.