2008/12/08

Python: changing the class of an instance

So it happens often that i while i’m in ipython, i want to edit the display methods and test them without reloading the data. I tried pickling the data but pickle complained about it for some reason, so my only option was to edit the methods in place and while ipython is great, i prefer my editor, besides i want to store the code in case it, you know, works. So i type reload Module then foo.__class__ = Module.Foo and voila! all the methods change but the instance variables remain the same so i don’t have to reload the data!!
Source.

2008/03/18

print the content of the clipboard as text (Windows)

getclip.cpp

2008/01/31

Ruby and VIM

Article, documentation.

I had only one problem (on Windows). gVim comes with Ruby support, but the included console version of Vi doesn't. The solition is on hasno.info.

2007/04/23

Windows Freeware Diff/Merge application

I started a discussion about Diff/Merge tools on reddit.



I collected together the candidates on this list:

http://www.listible.com/list/windows-freeware-diff2Fmerge-application



The only one which was able to handle long lines is the CS-Diff. A few supports word wrapping, but none of them are flawless:

  • KDiff3 have the functionality, but breaks the lines randomly, useless.

  • WinMerge does the word wrapping good, but turning it on breaks keyboard navigation, and no word wrapping in the DiffPane.


2007/04/18

Processing Tag files with Ruby

2007/03/02

Mercurial - status produces wrong slashes on Windows

If you don't like it, then a quick fix (for 0.9.3):



Line 768 in C:\Python24\Lib\site-packages\mercurial\util.py:



def localpath(path):

return path.replace('/', '\\')



Replace it with:



def localpath(path):

return path



2007/03/01

Mercurial - kdiff3 - hgmerge

Context: Windows, MSYS, Mercurial installed from source



Problem: hgmerge will use "merge" to merge even if kdiff3 is present



Solution: edit x:/Python24/Scripts/hgmerge and remove the following line (and the corresponding fi should be eliminated too):



if [ -n "$DISPLAY" ]; then



notebook