Tao of the MachineProgramming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.
Last 10 archives
:: About me
:: Oasis Digital
On an unfamiliar system, keybindings are your worst enemy
Or maybe your first enemy. I’m just back from a very frustrating exercise on the Mac. You see, ideally I would like to use the Mac for my personal projects, and the Windows box for work. Turning the Mac into my personal hacking platform doesn’t work so well though if it’s so much work to get basic things done.
What am I complaining about this time? Just the fact that Mac software has some keybindings that I’m not used to. I want to edit Python code. That doesn’t seem so difficult, right? So I use vim, since that’s what I use on Windows. I don’t want to use the Terminal version because it has problems of its own, so I use this gvim build for Jaguar. Most keys work as expected, except for Shift-Tab, which happens to be crucial, because that is what I am used to use to dedent a line. I have been trying to remap Shift-Tab, asking questions on newsgroups, etc, to no avail. Learning a new key combination would be an option if the Windows box wasn’t around.
So I tried different editors. I downloaded three: AlphaTk, BBEdit Lite, and TextForge. Unfortunately, all of these seem to have peculiar mappings for Home and End (although this is probably common on the Mac): they jump to the beginning and the end of the document, rather than the line. I’m sure some of these editors let you rebind keys, but right now I really don’t want to worry about that, I just want to edit without running into problems every second keystroke.
Back to vim again. Maybe it helps if I copy my Windows .vimrc verbatim and use it on the Mac? After all, there are no Windows-specific commands in it. So that should work. Wrong. After doing this, vim didn’t even start anymore.
So I try to edit the .vimrc file in Terminal, using vi. More fun: it doesn’t tell me what mode I’m in, nor does
I’m done with the Mac for now. I’ll be back when I have a week to spare, or something.
If you are contacted by National Check Control...
…check out these sites first:
These people contact you, claiming that you have unpaid checks and threatening to prosecute. We know now from first-hand experience. The checks may or may not be real; either way, NNC is unwilling (and, I suspect, unable) to give you details about them, much less send you copies of the checks. They also don’t want to send you a certified letter, as they are legally obliged to do. What they are willing to do is threaten you and act in a very rude demeanor, making you out for a criminal. Because of their conduct, they have already been sued. More info on the aforementioned sites.
Keep this name in mind, it seems they are on a roll lately, and that they prey on people with bad credit.
A Python puzzleAs seen on c.l.py (where else?):
>>> class A(object): ... InstCount = 0 ... def __init__(self): ... self.__class__.InstCount += 1 ... >>> class B(A): pass ... >>> a1=A() >>> a2=A() >>> b1=B() >>> b2=B() >>> B.InstCount 4 >>> A.InstCount 2If you change the order, you get different results. E.g. try B(), A(), A(), B(). If there was a book "Python Puzzles" then this would be a good entry.
Learning C#, part 1
That’s right, currently I am learning C#, for work purposes. (Before you smirk, let me point out that last year I spent 99% of my work time in Python. :-)
Currently I’m not impressed. I’ll get over it, most likely. It’s just that I am not used to low-level programming languages anymore. After all, I left this type of language (compiled, statically typed, etc) years ago in favor of Python.
Quite a few C# constructs are very un-Pythonesque, and I am having a hard time adapting. Pointers are a thing of the past? Not so in this language. They’re back with a vengeance, and so are references, and clever C tricks with “pointers are arrays are pointers”. I get a bit queasy when I see objects and pointer arithmetic being mixed.
I hear that Python for .NET will be difficult to write, because the virtual machine (or whatever it’s called for .NET) doesn’t support dynamic languages well. True or not, it would be interesting to write Python and generate Intermediate Language.
Why private methods don't make sense in a dynamic language...and languages where functions are first-class objects.
>>> class Bamboozle: def public(self): print "I am a public method!" def __private(self): print "I am a private method!" def foo(self): self.public() self.__private() def bar(self): return self.__private >>> b = Bamboozle() >>> b.public() I am a public method! >>> b.__private() # cannot be called like this Traceback (most recent call last): File "<pyshell#14>", line 1, in ? b.__private() AttributeError: Bamboozle instance has no attribute '__private' >>> b.foo() I am a public method! I am a private method! >>> f = b.bar() >>> f() # ta-da! I am a private method! >>>In other words, you can expose the private method easily, defeating the purpose of the whole private mechanism. (Not to mention the other way(s) you can get around this.) I wonder if this is different with properties. Hmm...
Kaa 0.9 available for download
See the download section.
What’s new since 0.8?
Enjoy. Please send bug reports, comments, etc, to
This is supposed to be a Textile entry. Let’s see if it works.
Textile has three important benefits over regular HTML formatting:
In other words, you can now use Textile in Kaa. It’s really easy too: if an entry’s first line consists of a single #, then that entry is considered to be in Textile format, and will be treated accordingly. Kudos to Mark and Dean (visit this last link to see how it works).
Expect the official 0.9 release Real Soon Now.