If it ain’t broken don’t fix it

Yet another worthless blog… by Uberto Barbini

Posts Tagged ‘django’

157 + 486 = 157486!!

Posted by Uberto Barbini on March 23, 2008

At least according my first Django site!

(bug fixed in version 2.0 almost 12 seconds later…)

Anyway as little spike I created a (very useful) site that adds two numbers, for example


of course you’re free to change the numbers. Not sure how long I’ll keep it running up.

What’s the point? Actually I wanted to deploy something on my virtual host but creating this site took me 5 minutes and 8 lines of code.

from django.http import HttpResponse
import datetime
def plus(request, n1, n2):
n1 = int(n1)
n2 = int(n2)
html = "%s + %s = %s" % ( n1, n2, n1+n2)
return HttpResponse(html)

These are 7, the last one is in the urls.py (one of the 4 files automatically created by django for a new project).

from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('',
(r'^calc/(\d+)/plus/(\d+)/$', plus),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),

So, all in all it’s not such a big effort! I know that maybe with Rails I could do the same in half the lines , you could do it in Python too for what it matters.

Anyway I’m still fond of Python values (aka “import this”) and Django is really really elegant.

I haven’t yet configured postgreSQL on the server, so you have to wait a little before seeing something interesting.


Posted in django | Tagged: | Leave a Comment »

Forums are dead, long life to groups

Posted by Uberto Barbini on March 19, 2008

At first there was NNTP, a dedicated protocol unfairly killed by firewalls and proxies.

Then came the mighty Mailing lists, with their burdens of mails, daily digest, problems with reply, complicated majordomos and the ultimate lame who cannot unsubscribe from them.

In the Php era, Forums ruled unchallenged. Reasonably easy to setup, with lots of implementations to choose from, full of smileys for every users they seemed the ultimate solution.

But how are they doing now, in this era of Web2.0, Social web and Ajax scripts?

Not so well after all. I’ve tried the “groups” feature of Google Groups, Facebook, Flickr and Mixi, and I foundĀ  them much more powerful and flexible of forums.

Especially Facebook groups have a lots of very cool features (privacy levels, officials, the wall, files). It’s hard to imagine more than 4 million of people on a single forum or mailing list!

So cool as a matter of fact, that I decided to implement something similar (but simpler) for my Django project.
Stay tuned…

Posted in django | Tagged: , , , | 1 Comment »