Thursday, 25 September 2008

Roadmap for "Advanced Python" series

I've outlined a roadmap for my "Advanced Python" series on ShowMeDo today.
I am going to continue with a brief explanation of the lambda statement, taking a maximum of 2 videos, I would say, then I am going to continue by explaining reduce, map and filter and afterwards I'll show alternatives for them using the list comprehension/generator expression syntax. Eventually I'll also show how to write custom generators.
  • variable scope to be done
  • decorators done
  • lambda post-production
  • operators module | functools.partial post-production
  • reduce, map, filter post-production
  • list comprehensions post-production
  • generator expressions post-production
  • generators to be done

Wednesday, 24 September 2008

E-Voting

Note: This post is describing the situation in Austria.

No thanks. When E-Voting is introduced, which they are planning to do, I am declaring our democracy as dead. Why is that, you may ask?
Well, let's first look at the brighter side, what are the advantages of E-Voting? Firstly, it may be cheaper, but I am unsure how much maintenance of a computer system secure enough to be capable of being used for a democratic voting, which I think no computer can do. Secondly, people won't need to leave their houses. Fine, I can relate to that.
But now let's look at the disadvantages: secrecy of you vote simple cannot be assured. There has to be some access control to the system, and no matter how good they may do it, afterwards it may be possible to see what you voted. Would you sell your right to vote secretly just for not leaving your house? I doubt it!

But the major problem is transparency. You simply don't know what the system is doing under the hood when you vote for a particular party. It can vote for any party internally, and you never know it.

In contrast to that, when you use the traditional paper method, it is hard to manipulate your vote. When the votes are counted, representatives of all political parties observe the process, and most importantly, you have the right to observe the votes being counted.

Even postal vote is more secure. You put an blank envelope which contains your vote into an envelope that contains your personal information. The personal information is verified, meaning they look whether you are allowed to vote and whether you requested postal voting. After that, the blank envelopes are taken and opened separately. So, at least in theory, you privacy is assured, and I am pretty sure that you are allowed to observe that process, although I am unsure.

Why should I give my democratic rights into the hand of a computer program of which I've got no idea how it works?
It's far to easy to manipulate non-transparent systems to give our basic democratic rights in the hand of them. Don't let laziness restrict your democratic rights.

Monday, 22 September 2008

Decorator screencasts

I have done two new screencasts today.

Decorators: The Basics
Decorators: Real World Example

Check them out at ShowMeDo.

Saturday, 20 September 2008

OO - But not quite

_inst = Context()
register_handler = _inst.register_handler
register_nostate_handler = _inst.register_nostate_handler
remove_handler = _inst.remove_handler
delete_action = _inst.delete_action
emmit_action = _inst.emmit_action
I have my actions module, as you might know. It exposed a API with only functions, as it was only one state that all of them shared, and I used a global variable for that.
Realizing that this was a mistake, I quickly refactored it to be object-oriented. Now you can create several Contextes, and register and emmit actions in every one of them.
But after all, most people will not even need this, as they will only use one context. So I remembered how it was solved in Python Standard Library's random.py.
It is done exactly the same way as the code I posted above, and I think it's a very good idea.

You can find the whole new code here.

I am planning to do a separate repository for that module, as it turns out to be more useful than I expected it to be.

Yes I am aware of the bug in the gitorious code viewer that makes it write "@@" instead if "@", I already told them in the IRC-Channel.

Wednesday, 10 September 2008

Black Holes would make great dustbins

Do you think the guys at CERN would be as kind as to send me some?

Saturday, 6 September 2008

Solved 25 projecteuler Problems

Bravo, segfaulthunter! Now that you have solved 25 problems you have achieved what 78.5% of members have failed to do and have advanced to level 1. Good luck as you continue.
I just solved my 25th projecteuler problem and got this nice message. Hope I will get to level 2 sometime. Though the problems are getting harder, a lot harder, now.

Thursday, 4 September 2008

"Who Can Name the Bigger Number" revised

I have produced a revised version of Who Can Name the Bigger Number written by Scott Aaronson and have uploaded a PDF of it. It is exactly the same text as the one on his site, only that I have changed the formatting in a more printer-friendly and probably even more readable way.
For me this also was a pretty good introduction into LaTeX which I may use a bit more in the future.
If you haven't read the article yet: read it!
You can find my revised version at http://name.nonlogic.org/bignumbers/bignumbers.pdf.

Monday, 1 September 2008

How I do my screencasts

I this post I am going show how I am doing my screencasts.
First I think about a topic. This is the easiest problem, as my TODO file is full of them.
Then I think about an example how to explain it, write some code, try it out and if it works I'll use it.
Afterwards I log into my tutorial account and start making the screencast, with recording on. It has to be noted that I have no second monitor showing me the code I am supposed to write, so I pretty much write it from memory. With longer screencasts I might have a paper with notes lying next to me. It is normal that at the first 3 or 4 tries the record will end with [insert swearing word here], because I made a mistake. Whenever I do a mistake, I start all over. I'm no fan of cropping the screencast because it's a lot of work and the output seems odd sometime.
So then after some tries I found out which words I need to look at to pronounce properly(I'm no English native speaker) and which code I need to take care of so I don't get a mistake in.
Once I did a recording that I am comfortable with, I extract its audio using mplayer, amplify it a bit, remove some background noise, et cetera. Then I put it back into the video and encode it using XVid. Then my screencast is done. I upload it to ShowMeDo and wait for people to comment on it.

That's how I do it. It might seem like a bit odd approach, but I think it works out. In my opinion you just have to try it a few times in order to get similar output to what long preparation would get you.