If it ain’t broken don’t fix it

Yet another worthless blog… by Uberto Barbini

Archive for the ‘django’ Category

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

http://uberto.user.openhosting.com:8000/calc/156/plus/418/

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 »

Step2: decide the scope

Posted by Uberto Barbini on March 10, 2008

It has taken some time, but finally I decided which kind of site I want to create.

It’ll be an experiment, half on technology side and half on social-web side.

So for the technology I already made the main choices:

Django -> the more I’m using it the more I like it.

PostgreSQL -> Although I knew it, I was surprised at Fosdem to see which level of speed and reliability it has archived lately. I don’t need to use sqllite anymore for tests. At least for the moment.

Rest architecture -> I bought this book at Fosdem because I was intrigued by a (not so good) lecture on Rest. I’m still not sure if there is some value in being 100% RESTful, but definitely most of the suggestions are very good indeed.

Hijax -> Another book that changed the way in which I’ve been looking at Javascript.

As for the content side, I have almost chosen a name, following the immortal guidelines of “must be cheap, can be lame”.

Posted in django | Leave a Comment »

Step 1: convince yourself

Posted by Uberto Barbini on February 21, 2008

Yesterday I installed Django, you basically need only a python installed (any recent version should be fine) and a svn client (they suggest me to use the TRUNK).

10 minutes including the download. It’s not completely fool-proof because you need to create two symlinks (err… only 1 is really necessary).

And we know as in these days programmer who can create a symlink are to be placed near the expert end of the skill gradient.

But before doing that, while not enjoying a very funny, I mean really funny not “funny” as in Jobs’ speeches, video about Django history?

Posted in django | Leave a Comment »

Let’s start with Django!

Posted by Uberto Barbini on February 20, 2008

Ok, guys I’m ready.

About two weeks ago I had a certain idea about a site, so I began to explore some cool ways to implement it.

Php? Naaah!

Grails, Rhino, Seaside? mmh… a bit too esoteric and not really appealing to me.

Java? mmh… maybe. But it would resemble actual work…

RubyOnRails? almost there but I’m still afraid of the dark side of Ror magic.

And while thinking this, I recalled a suggestion from a friend of mine (http://www.oluyede.org/blog/) and I gave a try to Django.

So far I’m in love with it. All the niceties of ROR without the dark arts part. Of course if you are able to read and enjoy The little LISPer you probably are much more intelligent than me.

Anyway, for the time being, django seems the Perfect Framework, written in the Perfect Language(TM).

Only time will tell…

Posted in django | 2 Comments »

 
Follow

Get every new post delivered to your Inbox.