The rewrite ritual

June 6, 2010

Not that I am a fan of rewriting stuff, but there are some applications that I use to showcase technologies and from time to time I set up to rewrite them. As there is already a specification, its a matter of an exercise for new technologies. No over-specification and a very delimited time box.

Lately, two of these apps are a pastie clone and an url shortener. First I wrote them in ruby, them in python, python with twisted and now using Erlang and Mochiweb.

The code is on http://github.com/gleicon at uurl-erl and pasteme-erl repos, and as usual the html/css part is barely minimal. Also they are online at http://7co.cc and http://pasteme.7co.cc.

Both of them use Redis as a global increment and cache server, along with MongoDB for storing documents and stats. I find this to be a good match due to Redis atomic operations and pub/sub capabilities.

Advertisements

Last saturday I presented an updated version of what sent me the noSQL way at nosqlbr – the first noSQL conference in Brazil. Basically I talked about stuff I did and I saw when I gave consulting to legacy systems. Life is not pretty but there are ways out.

The event was great and I sent a recap to myNoSQL . I got really surprised that so many people got interested on noSQL and alternative/emergent technologies.

Sounds cocky but that’s it. Using RestMQ, which builds on twisted, cyclone and a stack of well proven software, you can provide your applications with a robust and flexible queue over http protocol. It already was possible using COMET and GET/POST/DELETE requests, but now with websockets support it got to a new level.

Release gibberish apart there is a cool small app which streams twitter data to a html/css/js based app. Why all that work, would you say, if I can use it directly (well, not that easy because you need to provide username/pass to twitter streaming service) ? Well, for mashing up data and filtering it before delivery. Also, twitter is a convenient source of streaming data for tests, but usually you would roll up your own data source.

An actor based concurrency model or browser-based map/reduce is trivial, just like retrieving data, programming the proper javascript code to do all the work and post i back to a new queue.

Check the repository at http://github.com/gleicon/restmq_websockets and a live demo at http://cowcat.net/restmq_ws/. Note that it needs a websockets capable browser (chrome or a recent webkit build) and it may be down due to my bandwidth constraints 🙂

I’ve wanted to prototype an URL shortener some time ago to have a measure on how long it would take to do using a NoSQL DB to store stats and do analytics. The main reason would do it using cyclone and MongoDB, and later build over it to create a tracker, web analytics tool and maybe a NGINX module.

Read the rest of this entry »

Testing Bottle and MongoDB

February 3, 2010

Seems like DSLs for web development are getting more solid in the python camp (alto I’m yet to see something like sinatra out of the box or something that spare me from too much CSS’ing).

Today I read about Bottle and Redis, and to keep things fresh, cooked up a PasteBin clone using Bottle and MongoDB. I may do it using Redis too, just to showcase the differences. It’s really easy to come up with prototypes using Bottle.

Check it here: http://github.com/gleicon/pasteme

Node.js and COMET

January 31, 2010

Today I started to study node.js, for these last days there was a lot of interesting posts about it.

So to begin understanding it, I setup to port two COMET based examples I did back when I started using twisted to do it.

Note that this may contain javascript misconceptions, as I’m not experienced with it and my js idiom is more geared towards python than proper js.

The first example is a basic comet server which prints a string to each connected user

simple comet

The other example sends the result of twitter searchs to all connected users:

twitter and comet

Node.JS presents a different toolset to solve the current problems we have. It used the excellent libev, among V8 and other cool stuff, and JS is a very modern and flexible language (at least more than I thought about it when trying to do web stuff).

Cheers

Notes about Redis

January 31, 2010

I’ve come up with some notes about Redis, RestMQ and mongodb. Uploaded them to slideshare.