Have you ever thought about how do right-aligned texts look like? Don't you find them gnawed by an army of little hungry text-string eaters? Next time you type something, recall justification feature. Just think about it.
October 16, 2013
October 09, 2013
"A set object is an unordered collection of distinct hashable objects."
"A mapping object maps hashable values to arbitrary objects."
Old documentation tells that the set classes are implemented using dictionaries, so they are rather similar things.
From the definition of hashable it comes that an object is considered to be hashable if it has both __hash__() and (__eq__() or __cmp__()) methods. Python 3 says that the object is hashable if and only if it has both __hash__() and __eq__() methods. So, let's check that in Python 3 and Python 2.
Let's define a couple of classes and try to use their instances as set's members and dict's keys.
Well, class A is defined in new-class style and class B is defined in old-class style. In Python 3 all classes are new-styled indeed, so everything is OK and instances of both classes have __hash__() and __eq__() methods and we can create a set and a dictionary:
So, everything is fine with Python 3. Let's switch to Python 2:
and define the same classes and their instances:
and make some checks:
Oops! New-style classes in Python 2 do not have neither __eq__() nor __cmp__() methods, so by definition they are not hashable. Let's make the galaxy collide!
Emm, stop. Everything is good, wright? No. But, well, yes, we've got a set and a valid dictionary. But how? I don't get it. Let's move on:
T-sss! We are going to act like a real badass developers and use this really non-hashable (by definition) object in our experiments:
"Oops, I did it again!" Can you hear that? The time hasn't stopped and the clock is going on. How do you like that? Non-hashables are treated as valid hashables! I'm quite happy that nothing had crashed and it is not an 8th wonder of the world. But isn't it strange when some things act in the way they really should not?
June 25, 2013
If you would like to do something similar with your mercurial prompt, then you will need:
June 11, 2013
To prevent some butthurt during work with VirtualBox on Arch Linux you need to next modules:
# modprobe -a vboxdrv vboxnetadp vboxnetflt
To load them on system's boot create some .conf file in /etc/modules-load.d and add the modules list to it:
# /etc/modules-load.d/vbox.conf vboxdrv vboxnetadp vboxnetflt
April 23, 2013
To make some environmental variable available in KDE you should export it during KDE initialization. To do this you can:
#!/bin/sh # my_var_init.sh export MY_VAR=my_value
~/.kde/env/ # or ~/.kde4/env/ # or something similar
If you absolutely do not know, where to put you script, then go to
"System settings -> Startup and Shutdown -> Autostart" and add path to it.
January 09, 2013
By the ask of my mates I'm placing here link to the Tapestry plugins for Netbeans. They where compiled manually from sources. Do not ask, where I took them from. I just don't remember. In other case here would be the link to them. Have a nice Tapestring!