Archive for the ‘Python’ Category

Programming Contest Trouble

May 13, 2006

Last weekend, I worked all night programming a random player for a programming contest. Things like this always turn out to be harder than expected. Elegant code, nice class dependencies, doctests, Python 2.4.

Results: errors. It turns out the contest sandbox runs Python 2.2. I’m not complaining, host Fred is limited by his hosting provider. Hey, this is the real world. Some companies do use almost 4 year old versions1.

Ok, maybe I shouldn’t have used

for move in moves[::-1]:
    yield move

But did you know built-in function sum(seq, start=0) was introduced in Py 2.3.5?

return sum(scores)
NameError: global name 'sum' is not defined

You live, you learn.

Check my position, second last. But tonight, my random player will get lucky. I just submitted my 4th version, this time tested with Py 2.2. Good night!

1) Red Hat Enterprise servers, for example.

Simple Artificial Intelligence project

April 15, 2006

Since today, I have my first Open Source project listed at Source Forge: simple-ai

The project gives you a simple 2D world for playing with Artificial Intelligent actors. It contains of a world with objects. And a simple game, pyRugby, demonstrating the use of this world. All built in Python, using pygame for visualization.

Suggestions are more than welcome!

Thanks to Richard for the UML assistance.

simple ai pyrugby rugby python

Django, J2EE, Rails, TurboGears or Zope (Plone)?

March 13, 2006

Wow, this is a real must-see for web developers:

A 20 minutes screen-cast comparing 5 web frameworks. With a surprising ending.

Ubuntu & TurboGears

March 11, 2006

Ok, it took me a bit longer than expected, but I’ve got TG now installed and running on my fresh (two weeks old) Ubuntu Linux.

Installing Ubuntu was easy. HD partitioning was the biggest hurdle. But that resulted more from the difficulty of the decision than from the installation procedure.

TG required some dev-lib packages to be installed, which slowed me down.

Useful links:

I’m very pleased with Ubuntu. It is easy to install and comes with all your basic needs: free, high quality software. More on that later.

Reporter Guido van Rossum at Google Base

January 15, 2006

Interesting news from reporter Guido van Rossum at Google Base:

Python is big at Google.

And did I mention that I get to spend 50% of my time on Python?

If it uses two-space indents, it’s corporate code; if it uses four-space indents, it’s open source. (If it uses tabs, I didn’t write it! :-))

Read for yourself: Python Status Update

Zope3 mindmap or concept map

October 5, 2005

Just to show how accessible knowledge can be.

nederhoed Hello, I have plans for a simple FreeMind mindmap product for Zope3 does that sound interesting to anyone? maybe I should say "thoughts about" instead of plans :) tekNico nederhoed: here`s a thought. mind maps are usually hierarchical, and therefore too limited to reach their goal. the original "concept map" concept seems more useful, and generally applicable. I have a few more links to recommend, if you are interested... :-) well, two will suffice. nederhoed merci, I`ll check them out. * tekNico (n=tekNico@pdpc/supporter/active/tekNico) heeft #zope3-dev verlaten ("See you later")

Wikipedia: Mind mapping, Concept mapping
Christpoher Alexander: A City is not a Tree
Clay Shirky: Ontology is overrated (a must-read!)

tekNico does not seam to be supportive of my mindmapping product. Let’s just figure out the concept of Conceptmapping first then.

Zope3 behind Apache: .htaccess configuration

September 20, 2005

You can add the following to the .htaccess of the domain you want Zope3 to reside behind.

/httpdocs/.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*) \
  http://localhost:8080/++vh++http:%{SERVER_NAME}:80/++/$1 [P,L]

It is almost literally a copy of example 17.3.2 from Philipp von Weitershausen’s book. The only 2 differences are the RewriteBase line and the fact that it’s in a .htaccess and not in apache2-rewrite.conf.

PS – I’m still wondering when the demo section will go live.

PUN meeting Den Haag outcome

August 5, 2005

A short note before bed:

Presentation links:
Rob Hooft, Bruker AXS

Martijn Pieters, Pareto
Wing IDE, Chronolog

Social talk links:
Erik van Blokland, LetError

Etienne Posthumus
Django

Jan Murre, Pareto
PloneMall

Reinout van Rees, Zest

Running Zope3 as daemon service

August 3, 2005

The first Zope3 site I built a few months ago is still running on our development server. Which was a decision. We did not want to experiment with this new technique on a server also serving customer sites.

To be honest. I also did not get to installing Zope3 in such a way that it would fire up my z3 application when the server is restarted. Until yesterday, everytime the server was rebooted—not too uncommon for a development server—I had to restart my Zope application manually.

How nice would it be to be able to just reboot without bothering about restarting my Zope application. And eventually I should get this site onto one of our production servers of course.

Anyway, my Linux skills do not go far beyond ‘user’ level. With the difference that I have ‘root’ access. A dangerous combination 🙂

After some searching (thanks fromdownunder) I succeeded.

Assuming you have

  • RedHat Linux Fedora Core3
  • a Zope3 instance installed that you can start manually

Here’s the How-To get Zope3 running as a Linux daemon service.

  1. Change to root with
    su
  2. Copy <your z3 instance path>/bin/zopectl to /etc/init.d/zope3ctl
  3. Edit /etc/init.d/zope3ctl to include (new: lines 2-3)
    #!/usr/bin/python
    # chkconfig: 345 30 70
    # description: Zope - My installation
  4. Then run from the command line
    /sbin/chkconfig --add zope3ctl
    and
    /sbin/service zope3ctl start

If all went well, you should read something about a process having been started.

You can check if your zope3ctl was added to the services list, run
/sbin/chkconfig --list zope3ctl

Comments are welcome.

PUN meeting next thursday

August 1, 2005

I will be attending the Python Users Nederland meeting thursday the 4th of August in The Hague.

One of the advantages of living in the Randstad: one is always closer to interesting events.