JSONResponse – Trabalhando com JSON em Django, o jeito fácil.

14 Apr


There are dozen of articles and snippets about how work with JSON and Django, however I saw that most are a bit vague and solution involves use of simplejson to serialize and HttpResponse to send response from the view. There are some details that normally aren’t covered and now I show a easy way and […]

Vim confs prontas para trabalhar com Python e Django

7 Mar

original wombat theme with my custom wombat theme

This weekend I reworked on my .vimrc and put some extra time in make things work better for me in python and django coding :). I did a nice job and now I can code with much more goodies. Results are: A very commented and customized .vimrc. Support for python omnicompletion. Adding django and python […]

Mudar charset e quebra de linha recursivamente no Linux

26 Feb

Sometime ago I have to change the charset and line breaks of a web application from charset iso-8859-1 (US-Latin) to UTF-8 and linux break lines to windows break lines. At that time chronos helped to create this small script that I’m sharing now: #!/bin/sh #change extensions filter as you need 😉 find -type f | […]

Migrando bases de dados LATIN1 para UTF-8 com o PostgreSQL

6 Feb

Nowadays it is a standard that all web sites and servers run at least with UTF-8 encoding as default, however you can find cases where it is LATIN1 or even ASCII. The case we are dealing with today is a Debian server, version 5.0.3 (etch), which used encode LATIN1 as default encoding when installed and […]

Configurando múltiplos ambientes Python

27 Jan

Multiple python environments Work with various python versions with multiple versions of python environments has become something common in my life, and, I believe that an easy way of setting this environments are something very useful, and not simple for most of people. I created a simple shell script that set this environment, that is […]

Compilando fácil com Debian/Ubuntu

3 Jan

As a user of the old friend gentoo I always missed the lack of possibilities to compile softwares to have a better performance.Mainly in server-side softwares like Java, PHP, Apache, Mysql and Postgres.In my tests I always felt the diference between pre-compiled versions and the softwares compiled in loco. In Debian/Ubuntu the discover of apt-build […]

Manipulando erros Http 403 (permissão negada) no Django

24 Nov


In this post, I show a new Middleware, built to deal with errors 403 (Http Forbidden, access denied) like we work with 404 error in Django.

Pensamento rápido – “ilike” SQL

4 Sep

Today I saw a post at one of the blogs I often watch, where a guy said he got 1000% of speed boost in a aplication by changing: uma aplicação trocando um: SELECT * FROM table WHERE fieldname ILIKE ‘abc%’; For SELECT * FROM table WHERE lower(fieldname) LIKE ‘abc%’; (changed ilike to lower … like) […]

Atualize o hosts.deny para bloquear tentativas de brute force

2 Sep

Here I show a sinple script to block IPs that try brute force at your host, preventing you from use a alternative ssh port, as example. The script runs over /var/log/messages and detect via regex brute force attemps, and add IPs to /etc/hosts.deny Code: #!/bin/bash cp /etc/hosts.deny /var/tmp/hosts.deny # Jun 8 00:39:43 mintaka sshd[23332]: User […]

Fast quote on #django

26 Jul

Fast quote on #django <the-teacher> the-man: welcome to Python <the-man> the-teacher: welcome to what? <the-man> the-teacher: what is a python? <some-people> lol <the-teacher> the-man: the language Django is written in, you twit <chronos> husahduas… I’m reading it.. <the-man> the-teacher: language? <some-people-2> the-man, … <the-man> the-teacher: like, english? <chronos> need a quote… <some-people> ” <the-man> oh […]