06/01 Corrientes -> Monte Quemado

January 7th, 2010

Ontem não tivemos como acessar as internets, então ficou pra hoje o relato. Estou subindo mais algumas fotos também (aproveitando que a internet aqui do hostel é boa :D ).

Ontem fizemos “apenas” 490km. Fizemos também a nossa primeira mudança de planos. Como estávamos muito cansados depois do dia puxado de propina, retas e muito calor achamos melhor descansar bem em Corrientes antes de continuar a viagem, acordamos tarde e o plano de seguir para Salta (800km+-) no mesmo dia ficou de lado, resolvemos parar na que parecia ser a maior cidade no meio do caminho, Monte Quemado.

A estrada que liga Corrientes a Monte Quemado é a Ruta 16, praticamente uma reta sem fim que atravessa a Província del Chaco. Além de reta sem fim (o que ja a torna chata) a paisagem não muda. São praticamente 800km de retas, plano e com a mesma paisagem (e alguns campos de girassóis).

A única distração dessa estrada são os animais. Muitos pássaros pela rodovia. Não voando por ela, mas NA ESTRADA. Sim, você tem que praticamente desviar deles. Eles ficam esperando o carro chegar bem perto para levantar vôo. Outros animais também dão as caras pela estrada como vacas, cabritos, porcos e cachorros. Alguns deles ficam no meio da estrada sentados e só saem se você buzina para eles. Folgados!

Depois de percorrer os 490km de tédio, chegamos a Monte Quemado. é Uma “quase cidade”, deve ter menos de 10.000 habitantes, não tem lugar para comer e o hotel que ficamos que aparentava ser o melhorzinho do lugar tinha aranhas pelo quarto além de um banheiro sujo.

A impressão que fica dessa região é que é tudo muito pobre e abandonado. Enfim, Resolvemos deitar cedo para pegar a estrada o quanto antes e finalmente ir para Salta.

05/01 Santa Terezinha -> Corrientes (Arg)

January 6th, 2010

Estamos em Corrientes, cidade quente pra @&#*$. Nossas tentativas de CouchSurfing em Corrientes não foram respondidas, portanto estamos hospedados no hotel San Martin, perto do centro da cidade.

Hoje dirigimos 680km, passando por Foz do Iguaçu e Posadas (já na argentina). Cruzamos a fronteira por volta das 13h00 pois acordamos tarde e resolvemos tomar um bom café da manhã em Foz. Alias o café merece destaque: pão com ovo e queijo quente pra mim, misto quente com ovo pra Gabi e assim seguimos felizes =)

O caminho todo na Argentina fizemos pela Ruta 12, passando por Posadas. A estrada é muito boa (asfalto impecável) e são poucos pedágios, porém pista simples todo o caminho.

Após a fronteira tivemos contato com os famoso policiais argentinos. Famosos pela propina que cobram de quem vem do Brasil. O guarda que nos parou foi muito simpático e sorriu quando dissemos que íamos para Salta, Jujuy e depois para San Pedro de Atacama, porém na segunda parada tivemos um péssimo encontro. Eu estava dirigindo, o guarda nos parou e disse que eu estava muito rápido e que passei a mais de 40km/h num radar logo “ali atrás, no trevo”. O legal é que todas as placas da rodovia indicavam 60km/h ou 80km/h.

Fingi que não sabia de nada e ele me disse que deveria pagar na cidade uma multa muito cara por essa infração. Eu fiz que sim e pedi os documentos, aí ele disse que poderia facilitar minha vida pois se eu fosse pagar a multa na cidade o carro teria que ficar la com ele, portanto ele me “ofereceu” que eu pagasse a multa ali mesmo, por apenas 100 pesos argentinos (que na cotação dele valiam 100 reais). Eu disse que preferia pagar na cidade, mesmo que o carro ficasse preso por um dia, na esperança de ele me liberar. Mas não, o cara me chamou pro carro dele e falou que me levava até a cidade, pois eu poderia me perder. Além disso quando perguntei sobre onde eu devia pagar a multa ele disse que não adiantaria perguntar pela prefeitura porque ninguém conhecia a prefeitura, deveria perguntar pelo local onde se paga multas.

Neste momento tive que escolher entre ir com ele e o amigo dele na viatura até sei la onde e deixar a Gabi no carro sozinha na estrada ou pagar ali mesmo. Pagamos a propina e em 3 minutos estavamos liberados. Isso nos deixou bastante tristes e decepcionados.

Depois desses policiais a Gabi dirigiu até Corrientes e passamos por outros policiais. O engraçado é que com ela no volante eles nos paravam e apenas desejavam boa viagem e boa “vacaciones”, mesmo quando passamos por uma barreira policial com o farol apagado (andar com o farol aceso mesmo durante o dia é obrigatório na argentina). Sexismo pouco é bobagem =P

O resto da viagem foi um tanto cansativo, como esses argentinos gostam de retas! Foram 300km de retas com pouquíssimas curvas (a Gabi dirigiu esse trecho, coitada! :P ).

Chegamos em Corrientes as 21h30 +- e fomos direto procurar um hotel, enquanto isso achamos um restaurante (ou Parrillaria) bonitinho e resolvemos parar. A melhor coisa que fizemos! Que delícia de carne e vinho. E tudo bem barato (pensando na conversão real->pesos). Depois do jantar pedimos informações sobre hoteis, o hotel indicado estava lotado, o do lado não tinha garagem e então viemos parar no San Martin, num quarto com camas de solteiro pois os outros estão lotados.

Estou subindo algumas fotos pro flickr, espero que de certo!

Hasta! =D

04/01 São Paulo -> Santa Terezinha de Itaipu

January 4th, 2010

Dos dias planejados este é o de maior quilometragem. Rodamos 1040km de São Paulo a Santa Terezinha de Itaipu. Saimos de São Paulo pela Castello e seguimos até Ourinhos. De lá seguimos sentido Londrina, Maringá e Cascavel. Em Cascavel pegamos uma estrada (PR-277 se não me engano) que vem direto pra Santa Terezinha e Foz. A paisagem no Paraná é basicamente de plantações e plantações de algo estranho que não conheciamos, além de algum milho, pouca cana e um tanto de mandioca.

Aqui em Santa Terezinha estamos hospedados na casa da família da LuH. Nos receberam muito bem, com direito a cafézinho e lanche (pão com mortadela e pão com doce de leite)!! =)

Logo que chegamos tomamos um banho gelado e saímos para dar uma volta com as bicicletas (duas dahons que estamos carregando no carro). Conhecemos um pedaço de Santa Terezinha pedalando e foi bem divertido pedalar depois de dirigir tanto. Tinha muita gente de bicicleta às 22h, inclusive um senhor levando a mulher no bagageiro/garupa hehe. Depois do lanche ficamos conversando sentados no quintal já que dentro de casa é insuportável por causa do calor. A LuH nos contou que a tal plantação desconhecida é de soja.

Tiramos algumas fotos da estrada e da casa da LuH, principalmente da Penelope, uma gatinha que deve ter uns 2 meses no máximo =D.

Amanhã seguimos para Corrientes na Argentina.

Até o próximo ponto com internet =D

(depois atualizo com informações sobre os pedágios).

Viagem para San Pedro de Atacama

January 4th, 2010

Olás!

É isso, estamos indo para o deserto de carro. Eu e a Gabi saímos de São Paulo no dia 4 de Janeiro (hoje). Pretendemos rodar mais de 8.000km em 22 dias. O roteiro planejado é esse:


View São Paulo -> San Pedro de Atacama in a larger map

mas obviamente pode/deve sofrer alterações pelo caminho =)

Resolvi escrever em português pois acredito que um relato desses pode ser mais útil para brasileiros.

Algumas informações úteis pré-viagem

Para rodar pela Argentina e Chile são necessários dois triângulos, cambão, Seguro Carta Verde [consegui online pela luma seguros, chegou em dois dias úteis], Kit de primeiros socorros e Carteira internacional de motorista [recomendado, R$ 174,00 no detran de São Paulo].

Prometo tentar manter esse blog atualizado =P

Boa viagem pra nóis =D

Django model history with django-reversion

October 13th, 2009

I’m currently working on a django project and I needed to track all changes to a model and provide a log showing what has changed (like a wiki).

I’ve found three extensions/libs that apparently could do the job for me (fullhistory, django-history and django-reversion) so I decided to test them, but because of the lack of structure/documentation of the other two I tried just the last one.

django-reversion

(http://code.google.com/p/django-reversion/)

It has a good documentation, integration with the admin and the most important for me a low level api, as I am not using the admin app for this project.

The installation went pretty well (svn co http://django-reversion.googlecode.com/svn/tags/1.1.2/src/reversion to your PYTHONPATH, add the reversion app to your INSTALLED_APPS in settings.py and the usual python manage.py syncdb).

To track the changes of a model you must register it with the reversion framework (importing reversion and calling reversion.register(YourModel)).

Reversion provides some ways for creating revisions of your model and the docs recommend that you choose one of them to use in your project. I chose the MiddleWare method because it seemed the better option for our project, but you should look the reversion documentation and decide which one is the best for you.

After registering the model and installing the MiddleWare no more changes are needed, whenever I save a model a new revision is created on the database. Another cool feature is the follow argument when registering a model. That way you can specify a ForeingKey/ManyToMany field to follow. This means that when you save the model a new revision is created with all “followed” fields in its current state. It’s very useful. See the docs for an example.

The only thing that’s not so clear for me is: what happens if I delete a field from a model that’s registered within reversion? Can you still restore its versions?

Creating a tweet gadget for Google Wave

October 10th, 2009

This week bani sent me an invite for trying Google Wave. It’s a great tool and if it remains as open as Google says it will I think it can really change the way we communicate over the internets. I mean, it’s much more flexible than e-mail and it takes collaboration to another level. But, as I said, IMO the “key for success” in this case is to stay open and to support the creation of other servers and implementations(as PyGoWave [which deserves a blog post]).

But enough of cheap talk, I’ll show you the code.

My first “useful” piece of code for Wave is a Tweet Gadget. It’s a simple Google Gadget that takes advantage of the Wave extensions for interacting with the Wave user. What the gadget does is very simple, it takes a tweet id and using the Twitter API it places the tweet inside the Wave. It’s a simple way to quote a tweet.

I must say that the original idea is not mine, it’s rbp‘s idea. We were chatting using Google Wave and he wanted to quote a tweet. That’s how we started looking ways of doing it.

Stateless gadget

I started writing a simple gadget that using the Google Gadgets API makes a request using the Twitter API and shows the tweet in the wave. The problem of this first version was that it does not keep the state, so if you reload/rejoin the wave, you won’t see the tweet, but instead you will see the text box for entering the tweet id.

In this first version you can see how to make a JSON Async Request using the Google Gadgets API. It’s very simple, all you need to do is to set the parameter gadgets.io.RequestParameters.CONTENT_TYPE to gadgets.io.ContentType.JSON and then call gadgets.io.makeRequest(url, callback, params) where callback is a function that receives the JSON object.A very simple example:


function myCallback(obj) {
jsondata = obj.data;
// access the attributes as jsondata['key']
// ...
}
function makesJSONRequest(url) {
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
gadgets.io.makeRequest(url, myCallback, params);
}

Adding state

Until now the gadget is a simple Google Gadget as it does not use any feature of Google Wave. Also it’s not so useful because it can’t keep the tweet id when you leave the Wave. And worse, people will never see the tweet you quoted. One of the main differences between simple Google Gadgets and Wave Gadgets is their ability to keep, set and change state. By state I mean information. You can keep user preferences, a game score or a tweet id (or even a tweet).

I decided that the easiest way was to store the tweet as it will appear in the wave (with HTML entities and everything). The new version will keep the tweet information when the user enters the tweet id, so everybody in the wave can see the quoted tweet.

You can see the Gadget code to understand how state works in Google Wave, but what’s most important:

  • use a callback (with wave.setStateCallback()) to be aware of state changes
  • wave.getState() returns an state dict-like object which you can set and get information from
  • use wave.getState().get(‘key’) for getting an information
  • and wave.getState().submitDelta({‘key1:’ value1, ‘key2′: value2} for setting information

And that’s it. It’s very simple, hope you enjoy it :)

Transparência HackDay

October 2nd, 2009

“Two days for hacking the Brazilian politics”

This weekend (October 3rd and 4th) will happen the first “Transparência HackDay” (“Transparency HackDay” in english), a free and open hacking event with focus on bringing together hackers, activists, managers and people with ideas to make government information/public data more accessible for everyone using and writing web tools.

I’m attending and one of my ideas is to hack CET (Companhia de Engenharia de Tráfego / Traffic Engineering Company) data and make them available. The idea is to improve a crawler I wrote (in python ;) ) that downloads and stores data about the traffic in São Paulo every 30 minutes from the “traffic now” CET website (as they don’t store it [or at least don't provide anything]).

More information about the HackDay (in portuguese):
http://www.slideshare.net/esferamobi/transparencia-hackday-proposta

Car-addiction has a cure

September 22nd, 2009

car-addiction has a cure

São Paulo, September 22, World Carfree Day.

Av. Sumaré.

Pictures

http://www.flickr.com/photos/brunogola/3944808600/
http://www.flickr.com/photos/brunogola/3944024499/
http://www.flickr.com/photos/brunogola/3944018159/

São Paulo Intermodal Challenge 2009

September 18th, 2009

Yesterday, September 17th, occurred the São Paulo Intermodal Challenge that happens yearly since 2006.

The following table shows the results:

Results

Modal Time min Cost (R$) CO2 (kg)
Pedestrian 92 0 0
Pedestre running 66.30 0 0
Bike courrier 25.30 0 0
Biker (begginner) 66 0 0
Biker (alternative route) 38.20 0 0
Biker 37 0 0
Folding bike + subway 68 2.40 0.24
Fixedgear bike 22.33 0 0
Motoboy 42.28 1.50 1.44
Motorcycle 25 1.50 1.81
Car 82 15 2.63
Bus 71.20 2.30 0.24
Subway+Train 84 3.70 0
Train+Bus 89 3.70 0.21
Bus+Subway 109 3.70 0.24
Train+Bus+Subway 99 2.55 0
Scooters 58 0 0
Wheelchair+public transportation 108 3.70 0.21
Hellicopter 33.50 2.600 3.75?

I’ll post more details later.

São Paulo Python User Group – May Meeting

May 16th, 2009

Every month the GruPy-SP members get together to discuss, chat and/or code.

This month we will meet to watch/present some lightning talks and to talk about our participation at the Fórum Internacional de Software Livre (FISL 10).

The meeting will be hold at the SP HackLab, May 23. More details (in pt-br): GruPy-SP wiki.

See you there :-)