October 25, 2005 at 3:15 pm
by Wolfram · Filed under Computers, Miscellaneous
Christian Hackert was writing me an e-mail about an old article I had once written for the PHP magazin. From my todays point of view, I am not very proud of the article, but the world keeps turning. Thanks Charo.
I actually just wanted to say that I really love the design this guy has created for his website. Very simple and very clear, especially that the image on top changes depending on the page you are on. Ok, it doesn’t need to change on every click, which it doesn’t, but when you are changing the category/topic. I also like the embedded navigation up there, so the space is not only wasted. And those very clean and simple pictures. Great. I might copy that
Update 6-Nov 2005:
This page of the Firefox icon creator looks very neat and alike too. Especially the navigation up there with the items inside and the changing image, I start to like that more and more. But somehow not as clean and easy to follow, too many rounded corners, difficult to stay focused IMHO. A bit to playful.
Permalink
October 20, 2005 at 10:24 am
by Wolfram · Filed under Programming, Python
Sometimes it might be an indication for a flaw in your design, but to me the people programming Python seem to be mature enough to figure that one out. And every other language has a kind of __func__ constant. But why does Python not? Is it that I am really picky? Actually I just wanted to print out the __doc__ string of my function to show it as the instruction to the user on an interactive shell skript. But since the __doc__ refers to the modules doc-string I thought I would get access to my function’s doc-string by some kind of __func__ constant. So I asked in #python, but as there is written in a Python Cookbook’s recipe too, there is no such constant.
I only wanted to do:
def get_input():
'''Here are the instructions of what input I expect
and of what the function does, two things in one, I am just lazy!
'''
print __func__.__doc__
inp = raw_input('Please input here: ')
# Prepare input data ...
return inp
I may still have to get my head around to better understand Python …
Permalink
October 13, 2005 at 5:57 pm
by Wolfram · Filed under Programming
This is just a note to myself, since I seem to keep forgetting how to do that properly. After reading the chapter in the svn-book properly and using enough [--]help I figured it out and I am scared to forget how to get it right again :-). Here is how I got it working for me.
Read the rest of this entry »
Permalink
October 13, 2005 at 1:27 pm
by Wolfram · Filed under Programming, Python
I am over and over again looking for the difference between re.match() and re.search(), I just can’t remember (it’s a bit like PHP’s parameter twisting, see 1, 2). The documentation chapter “Matching vs Searching” does not really help either, it only confuses me. Ok, it says that re.match() kind of magically adds a “^” up front of the given pattern. But where the heck is the second parameter (the “1″), they use in their examples, defined as a pos argument? Also this doc says, in the next chapter, the last parameter contains the flags (e.g. re.I re.M, etc.). I was even diving into the re, sre source code, but couldn’t find this match() method either. And help(_sre.SRE_Pattern.match) also fails (_sre.SRE_Pattern is the type of what re.compile() returns).
Ok, enough confusion, at least for me. I just have to write down which method only to use, from now on!
Only use re.search() it searches the entire string and has no special behaviour, it just applies the pattern onto the entire string, as I am used to it from the various preg_* functions.
Permalink
October 12, 2005 at 10:07 am
by Wolfram · Filed under Private
I was eagerly waiting for reading an article of my brother, that he might publish on a blog one day. Simply because I know that he is a great writer. But I rarely get the chance to read any of his stuff, simply because we don’t see each other very often and if we do we got other things to talk about.
But this one is just what I wanted. I am impressed! I can not say what it is, but it’s just fun to read and not boring it is kind of a story out of life, but also an adventure. Because I have no idea of what makes good writing, I can just say that I like it. A must read …
Permalink
October 10, 2005 at 12:54 pm
by Wolfram · Filed under Miscellaneous
A while ago, I was confronted with the question if chatting really disturbes while working. I am in multiple chats all day long and I have to say I really appreciate the quick way of getting answers (e.g. in #python on irc.efnet.org) and learning stuff by reading, discussing and also answering questions. In the following I try to summarize what I think makes the chat worth being a tool a programmer needs in his toolbox. Of course we are talking about work-related chats here.
Read the rest of this entry »
Permalink
October 5, 2005 at 1:06 pm
by Wolfram · Filed under Programming, Python
It can be dangerous using mutable objects as default values for function parameters in Python!
Just remember: Default values are created exactly once, when the function is defined.
And: A list is a mutable object!
It really helps reading through the FAQ every once in a while
… Why are default values shared between objects?
Permalink