Ir para o conteúdo
ou

Software livre Brasil

Tela cheia
 Feed RSS

Thiago Avelino

27 de Maio de 2009, 0:00 , por Software Livre Brasil - | Ninguém está seguindo este artigo ainda.

Go vs Python more request per second

17 de Janeiro de 2015, 5:16, por Software Livre Brasil - 0sem comentários ainda

not everyt hing is nail, to use hammer

I use python because it is a simple and powerful language, but never used by be excellence in performance (But for python web serves very well)! I know that benchmark based on “Hello World” does not want to say too much, but it's interessanta we know what technology (framework) is more time to answer performance web support request.

There is a python framework named Falcon(Falcon follows the REST architectural style, meaning (among other things) that you think in terms of resources and state transitions, which map to HTTP verbs) which is extremely performance, even using asynchronous backup processing library (as gevent, is a coroutine-based Python networking library that uses greenlet to provide a high-level asynchronous API on top of the libev event loop).

These days I commented on the social network about the performance of the falcon and some people commented that it would be interesting to do a benchmark with Go, and here I am writing a blogpost for the performance of a webserver written in Go and Python to see which responds more request per second!

Let's go…

Falcon application

import falcon

class ThingsResource:
    def on_get(self, req, resp):
        resp.status = falcon.HTTP_200
        resp.body = ("Hello World")

app = falcon.API()

things = ThingsResource()

app.add_route('/', things)

if __name__ == '__main__':
    from gevent.wsgi import WSGIServer
    http_server = WSGIServer(('', 8080), app, log=None)
    http_server.serve_forever()

Go application

package main

import (
    "fmt"
    "net/http"
)

func main() {
    http.HandleFunc("/", viewHandler)
    http.ListenAndServe(":8080", nil)
}

func viewHandler(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-type", "text/plain")
    fmt.Fprintf(w, "Hello World")
}

Benchmark

Used:

ab -n10000 -c500 http://localhost:8080/
Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
8GB RAM

Falcon

Requests per second: 4888.35 in 2.046 seconds

avelino@klm ~ $ ab -n10000 -c500 http://127.0.0.1:8080/                             
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      500
Time taken for tests:   2.046 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      1530000 bytes
HTML transferred:       110000 bytes
Requests per second:    4888.35 [#/sec] (mean)
Time per request:       102.284 [ms] (mean)
Time per request:       0.205 [ms] (mean, across all concurrent requests)
Transfer rate:          730.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   29 166.7      0    1004
Processing:     2   29  37.8     23     436
Waiting:        2   29  37.8     23     436
Total:         14   58 193.7     23    1438

Percentage of the requests served within a certain time (ms)
  50%     23
  66%     25
  75%     25
  80%     25
  90%     28
  95%     50
  98%   1029
  99%   1232
 100%   1438 (longest request)

Go

Requests per second: 15711.36 in 0.636 seconds

avelino@klm ~ $ ab -n10000 -c500 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      500
Time taken for tests:   0.636 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      1130000 bytes
HTML transferred:       110000 bytes
Requests per second:    15711.36 [#/sec] (mean)
Time per request:       31.824 [ms] (mean)
Time per request:       0.064 [ms] (mean, across all concurrent requests)
Transfer rate:          1733.77 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.7      0      12
Processing:     2    6   5.5      5     205
Waiting:        2    6   5.5      5     205
Total:          4    7   6.4      5     205

Percentage of the requests served within a certain time (ms)
  50%      5
  66%      6
  75%      6
  80%      6
  90%      7
  95%     13
  98%     28
  99%     33
 100%    205 (longest request)

We can let Go more performer (compiling software), follows the result after compiling:

Requests per second: 20978.30 in 0.415 seconds

Conclusion

Yes Go is much more performatico than Python in web requests, nor why I stop programming in Python. Today we have a very large ecosystem in the world of Python where does Python be very powerful (and good), an example is mathematical libraries such as numpy, pandas and etc.

This blogpost is to show that Python (or what you want other technology) is not the silver bullet (solution to all the problems). Choose the right technology for your problem, not everything is nail, to use hammer!



Bottle, full stack without Django

1 de Dezembro de 2014, 15:43, por Software Livre Brasil - 0sem comentários ainda

This blogpost is based in a lecture I presented here in Brazil, follows the slides!

Bottle micro framework web

Bottle is a micro web framework compatible with WSGI, depends only on the Python standard library is compatible with python 2.6, 2.7, 3.2, 3.3 and 3.4, single source file. It was created by Marcel Hellkamp (@defnull) and maintained by the community that raised surrounding framework.

Django is a framework for rapid development for web, written in Python, which uses the standard MTV (model-template-view) and pragmatic. Was originally created as a system to manage a journalistic site in the city of Lawrence, Kansas. Became an open source project and was published under a BSD license in 2005. The name Django was inspired by the jazz musician Django Reinhardt. Django became very known for having included batteries, i.e. several distributed libraries join the Centre of the framework for simplicity work (called “full stack”).

Pragmatic is what contains practical, realistic considerations, with well-defined target. Be pragmatic is to be practical is to have goals defined. In other words, the team that developed the Django take some description of architecture and who uses Django follows this architecture without being able to change easily.

It's good a web framework have batteries included? Depends, if you use everything that the framework gives you Yes, but not all web designs are the same.

Many project does not use 80% than Django offers, in those cases that don't use more than 50% of what we pay the cost of offering Django someone have defined the architecture, i.e. lost in performance because the Django has many modules that will not be using and yet he will climb a few modules that we don't use. When we use a micro framework we do the role of architect of application development, since we don't have a set before architecture begins to develop is necessary to devote time to define the architecture of the application.

All the packages that we have on the Django Python library that can substitute for use in a micro framework!

SQLAlchemy

The SQLAlchemy exists before Django (yes before Django) and since 2005 we have a team focuses on development of an ORM, unlike Django it's a time to take care of a web framework + ORM (I believe I don't need to talk to a developer focused render more than a developer not focused).

Structure of a model:

class Entity(Base):
    __tablename__ = 'entity'
    id = Column(Integer, Sequence('id_seq'), primary_key=True)
    name = Column(String(50))

    def __init__(self, name):
        self.name = name

    def __repr__(self):
        return "<Entity('%d', '%s')>" % (self.id, self.name)

WTForms

A workaround for those who do not use Django and need to work with forms we have the WTForms, was created in 2008 and maintained until today!

Structure of a form:

class UserForm(Form):
    name = TextField(validators=[DataRequired(), Length(max=100)])
    email = TextField(validators=[DataRequired(), Length(max=255)])

Template Engine

Jinja2 is a modern and designer-friendly templating language for Python, modelled after Django’s templates. It is fast, widely used and secure with the optional sandboxed template execution environment

Structure of a template:

<title>{% block title %}{% endblock %}</title>
<ul>
{% for user in users %}
  <li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% endfor %}
</ul>

Migration

Usage of Alembic starts with creation of the Migration Environment. This is a directory of scripts that is specific to a particular application. The migration environment is created just once, and is then maintained along with the application’s source code itself.

Structure of a migration:

revision = '1975ea83b712'
down_revision = None

from alembic import op
import sqlalchemy as sa

def upgrade():
    pass

def downgrade():
    pass

How to make the evolution and downgrade:

def upgrade():
    op.create_table(
        'account',
        sa.Column('id', sa.Integer, primary_key=True),
        sa.Column('name', sa.String(50), nullable=False),
        sa.Column('description', sa.Unicode(200)),
    )

def downgrade():
    op.drop_table('account')

Structure of a alter table:

"""
$ alembic revision -m "Add a column"
"""

revision = 'ae1027a6acf'
down_revision = '1975ea83b712'

from alembic import op
import sqlalchemy as sa

def upgrade():
    op.add_column('account', sa.Column('last_transaction_date', sa.DateTime))

def downgrade():
    op.drop_column('account', 'last_transaction_date')

Conclusion

Exactly what you see, everything that Django has found out the stack of Django. I didn't write this blogpost to speak ill of Django and Yes to shows that exist other solutions for full development stack. Many people use Django by not understanding the environment with Python, today the Django brings much ready that makes some developers get lazy and not gain skills of software architecture.

Come help with the Bottle, we are a growing community, to contribute with code of Bottle look at the issue that we have open. In case of doubt we have mailing list and IRC channel.

GET INVOLVED



Swift Language (Apple) first steps

4 de Junho de 2014, 4:20, por Software Livre Brasil - 0sem comentários ainda

Apple launched the Swift language (Looking for the Swift parallel scripting language? Please visit swift-lang.org) at WWDC 2014. A modern language to program for Mac and iOS!

Strongly typed language, where you explicitly what type (variable, arguments, and function returns), syntax reminds dynamic languages with Python, Go, Ruby and JavaScript.

Apple offers a free comprehensive guide on language in HTML and iBook formats.

  • We can put zero left freely to improve readability, insert _ to separate groups of numbers and add the + in front. That server to improve readability of the program (does not alter the value of the number):
let a = 1000000
let b = 0.0000001

// readable
let a = 1_000_000
let b = 0.000_000_1
  • Practical numerical ranges: 0..5 and 0...5 (Ruby)

  • Unicode variables:

let π = 3.1415926
  • Tween strings (expand variables and expressions inside strings):
var name = "Thiago Avelino"
var yaer = 25
println "Hi, my name \(name), 'm \(year) years."
  • Few functions/methods native to strings works:

    • hasPrefix
    • hasSuffix
    • uppercaseString
    • lowercaseString
    • countElements
    • isEmpty
  • Not have regular expressions

  • Ternary operators: (condition ? yes : no)

I liked the language, as 'm used to not bother me Go explicit types, lack of regular expression can be a problem seems, but it is a pleasant language to learn!



Golang, C and Python the benchmark time

6 de Março de 2014, 12:03, por Software Livre Brasil - 0sem comentários ainda

I was wondering how performant Golang is, so I decided to put together a little benchmarking example for myself.

The benchmark will be done in my personal computer:

Processor  3 GHz Intel Core i7
Memory  8 GB 1600 MHz DDR3
Software  OS X 10.9.2 (13C64)

So I started with Python, which is what I know best and created the following simple script;

#!/usr/bin/env python

def fac(n):
    if n == 0:
        return 1
    return n * fac(n - 1)

if __name__ == "__main__":
    t = 0
    for j in range(100000):
        for i in range(8):
            t += fac(i)
    print("total: {0}".format(t))

The reason for the total output, was to have a check to ensure that I was getting the same results in each of the scripts. To make sure that they are doing the same amount of work.

Running the script gives us the following execution time;

$ time python factorial.py

total: 591400000

0.68s user
0.01s system
99% cpu
0.688 total

So I am getting about 1s in total execution time. Not bad.

Now the same code sample in C, to see what the time execution would be;

#include <stdio.h>

int fac(int);

int fac(int n) {
  if (n == 0) {
    return 1;
  }
  return n * fac(n - 1);
}

main() {
  int i, j;
  int t = 0;

  for (j = 0; j < 100000; j++) {
    for (i = 0; i <= 7; i++) {
      t += fac(i);
    }
  }

  printf("total: %d\n", t);
}

Compile and execute the above snippet of code;

$ gcc factorial.c -o factorial
$ time ./factorial

total: 591400000

0.01s user
0.00s system
91% cpu
0.016 total

Ok, that's quite an improvement. This is C, so we do expect there to be a great improvement.

Finally we create our code sample in Go;

package main

import "fmt"

func fact(n int) int {
    if n == 0 {
        return 1
    }
    return n * fact(n-1)
}

func main() {
    t := 0
    for j := 0; j < 100000; j++ {
        for i := range []int{1, 2, 3, 4, 5, 6, 7, 8} {
            t += fact(i)
        }
    }
    fmt.Println("total: ", t)
}

Then build and run the code sample and we get the following;

$ go build factorial.go
$ time ./factorial

total:  591400000

0.01s user
0.00s system
93% cpu
0.018 total

So, that's pretty much the same as C, which is excellent. The best part of it all, is that it is actually fun to code in Go compared to C. Python was always an attraction for me as the language is a breeze to work with and enjoyable programming with it. Go is also a nice language to work with and it's really fast to boot. So I'm very excited about the language.



Business Intelligence (BI) Application Server written in Python

21 de Fevereiro de 2014, 4:13, por Software Livre Brasil - 0sem comentários ainda

I started a new project with the name OpenMining, new application server written in Python.

OpenMining

OpenMining is software for creating OLAP (online analytical processing) cubes (multi-dimensional) using Numpy, Scipy and Pandas for data management and flexibility in processing dynamical filters. Open-source provider of reporting, analysis, dashboard, data mining and workflow capabilities.

Our goals

  • Business Intelligence software (Pentaho/Jaspersoft) alternative;
  • OLAP manager;
  • Generate report (grid, charts, pdf and etc);
  • Dashboard manager, link one or more element (report);
  • Easy dashboard generate;
  • Not one data is processed on the basis of source data;
  • Friendly interface;
  • Used websocket on cube load;

Python libs used

  • Pandas
  • Numpy
  • numexpr
  • ipython
  • Tornado
  • SQLAlchemy
  • RQ
  • Riak client
  • Redis client
  • Memcached client

More about OLAP cube

A cube can be considered a generalization of a three-dimensional spreadsheet. For example, a company might wish to summarize financial data by product, by time-period, and by city to compare actual and budget expenses. Product, time, city and scenario (actual and budget) are the data's dimensions.

Cube is a shortcut for multidimensional dataset, given that data can have an arbitrary number of dimensions. The term hypercube is sometimes used, especially for data with more than three dimensions.

Each cell of the cube holds a number that represents some measure of the business, such as sales, profits, expenses, budget and forecast.

OLAP data is typically stored in a star schema or snowflake schema in a relational data warehouse or in a special-purpose data management system. Measures are derived from the records in the fact table and dimensions are derived from the dimension tables.

Screenshot

Screenshot Screenshot Screenshot

The MIT License (MIT)

Copyright © 2014 Thiago Avelino

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contribute

Star and fork in github.com/avelino/mining, send pull request!

Bug tracker



Corretor Ortográfico no VIM

8 de Dezembro de 2013, 4:32, por Software Livre Brasil - 0sem comentários ainda

Desde 2007 escrevo aqui no meu blog, com isso já passei por diversas plataforma de blog (Blogspot, Wordpress, Django, Django Diario, Pelican, entre outras), hoje estou usando liquidluck (ferramenta escrita em Tornado Python para gerar arquivos estático), minha escolha para essa mudança foi simplificar o processo de escrever texto, ou seja, usar o que eu uso no dia a dia para programar, com isso tive algumas perda como corretor ortográfo!

Olhando o LibreOffice achei o plugin chamado VERO – VERificador Ortográfico, e para mim seria excelente ter ele dentro do VIM, pois bem consegui fazer o que eu queria, usar o VERO dentro do VIM.

Instalando o VERO

Primeiro precisamos baixar o plugin VERO (vou criar uma pasta dentro do /var/tmp para deixar centralizado os arquivos) e descompactar

mkdir /var/tmp/vero
cd /var/tmp/vero
wget
http://extensions.libreoffice.org/extension-center/vero-verificador-ortografico-e-hifenizador-em-portugues-do-brasil/pscreleasefolder.2012-01-04.1563120832/2.1/vero_pt_br_v210aoc.oxt
unzip -x vero_pt_br_v210aoc.oxt

Abra o vim e digite:

mkspell pt pt_BR

Precisamos colocar um configuração dentro com seu .vimrc:

echo 'set spell spelllang=pt' >> ~/.vimrc

Precione enter até acabar todas as perguntas e pronto você tem o VERO instalado dentro do seu VIM, agora basta usar o corretor ortográfo!

Veja alguns comando do corretor ortográfico, aqui!

Se você gosta de VIM de uma olhada na configuração que eu mantenho https://github.com/avelino/.vimrc!



Prazo no desenvolvimento de software, qual é a ciência exata?

21 de Novembro de 2013, 20:57, por Software Livre Brasil - 0sem comentários ainda

Pensando igual macaco

Falar de prazo é uma tarefa muito complicada hoje e sempre, pois não existe uma ciência exata (tirando 42), outro ponto que prazo é uma promessa e consequentemente promessa tem que ser cumprida (e você vai fazer de tudo para cumpri-las), com isso trabalhar muito mais para cumprir o que você assumiu (prazo).

Levantando conteúdo para esse blogpost achei no Quora o seguinte topico “What is the hardest thing you do as a software engineer?” (Qual a coisa mais difícil para um engenheiro de software?) e os termos que tem haver com tempo, prazo, horas e etc são os mais falado.

Sou engenheiro de software a mais de 7 anos de experiência passando por diversas empresas, mercados, equipes, é que praticamente todo engenheiro de software que conheci começa com a premissa que “código” é o objetivo e a solução de todo problema.

Para falar mais sobre esse assunto acho necessário sairmos de nossa área de atuação (desenvolvimento de software) e olhar outras área:

  • Ilustrador
  • Produtor de video
  • Design
  • Entre outras profissão que trabalha com a mente…

As áreas relatadas acima trabalham com uma parte mais intelectual onde precisa ter a criatividade para conseguir produzir um conteúdo. Esse final de semana estava almoçando com outros desenvolvedores e um deles foi no evento InterCon onde um palestrante estava apresentando um case de um video de no máximo 1 minuto onde esse 1 minuto envolvia no minimo 5 profissionais e a produtora levou media de 5 mês para desenvolver esse projeto.

Desenvolvimento de software não é diferente das área relatada acima, é uma área intelectual onde você precisa pensar como o software escalar, se o banco de dados relacional vai se sair bem na hora que tiver muito trafego (caso não, qual é a melhor alternativa), qual é melhor design pattern para a implementação a ser feita e outros pontos que envolvem o desenvolvimento de software.

Então aprendam a primeira e mais difícil verdade do mundo: Software normalmente não é resolvido com Software, é resolvido com capacidades Humanas. Numa distribuição de Paretto eu diria que 80% de todo problema de software somente é resolvido quando você investe aqueles 20% restantes em Comunicação, Articulação, Pensamento Claro e Racional, quebra Ambiguidades, Negociação, Compromisso.

Quando você passa um prazo (faz uma promessa) você vai ter que assumir o risco que a proposta inicial vai realmente resolver o problema proposto, e isso nem sempre é possível pois estamos trabalhando com tecnologia e a evolução é constando. Outra que nos engenheiro de software não somos maquinas onde usamos software para escrever software e sim uma cabeça pensante de onde sai toda a logica.

Dito isso, é possível cumprir todas as promessas? Não, infelizmente não é. Mas é nossa responsabilidade como profissionais estar sempre em busca desse ideal, não criar maneiras de evitá-las.

Ou seja, não existe uma ciência exata para prazo!



A volta dos que nao foram, software livre para sempre

29 de Outubro de 2013, 5:20, por Software Livre Brasil - 0sem comentários ainda

Chromebook Pixel; MacBook Pro Retina display (Image: ZDNet)

Durante 5 anos usei o sistema operacional da Apple (OS X), o OS X é um ótimo sistema operacional principalmente o ambiente gráfico que é sensassional, sistema de áudio entre outros recursos, os 3 primeiro anos usei sem problema nem um ate que a Apple veio com uma historia de cobrar pelo Xcode (The Xcode interface seamlessly integrates code editing, UI design with Interface Builder, testing, and debugging, all within a single window. The embedded Apple LLVM compiler underlines coding mistakes as you type, and is even smart enough to fix the problems for you automatically), ou seja, é a IDE para escrever projetos para plataforma Apple (OS X e iOS) mais o compilador vugo GCC, essa foi a gota d'agua, eles estavam vendendo o GCC, mas como eu já tinha me acostumado com o ambiente (que não é um trabalho muito complicado pois a Apple faz ótimos produtos) não quiz parar de usar e comprei o Xcode, depois de um tempo a Apple voltou a traz colocando novamente de graça.

Depois dessa dramática historia acima comecei olhar valores de notebook (e ultrabook) a tentativa de parar de usar OS X, logo após olhar valores fica pensando, acho que não vou conseguir voltar usar Linux como estação de trabalho novamente pois vou sentir falta dos aplicativos Apple e deixei a ideia para lá, e nisso se passou mais 1 ano.

Ate que parei para refletir o que eu usava do OS X, segue abaixo a lista de aplicativos:

  • iTerm2
  • vim (via linha de comando)
  • Python
  • ssh
  • PostgreSQL
  • Chrome (e diversos serviços web)

Ou seja, tudo que eu usava e acha que iria sentir falta eu conseguiria rodar em Linux. Logo depois dessa reflexão eu lembrei que tinha ganhado um CR-48 (Chromebook) do Google e resolvi começa brinca com ele para ver como era à experiência, apesar da maquina não ser potente como o Macbook Retina (i7) que eu usava estava atendendo minha necessidade, a primeira vista é um notebook que tem apenas um Chrome e com isso todos os serviços web funciona perfeitamente. Olhando o Chrome OS mais de perto vi que é um Linux (baseado em Gentoo) ao meu ver o Google fez um ótimo trabalho principalmente no ambiente X (mais para frente escrevo um blog post falando sobre o que achei do Chrome OS).

Depois desse lero lero todo, achei uma distribuição Linux que atendia minha necessidade ( browser e console para desenvolver), para quem não sabe é possível instalar Linux via chroot dentro de uma pasta no Chrome OS.

Eis que resolvi compra o Chromebook Pixel, que por sinal tem uma hardware ótimo para trabalhar com Chrome OS.

Caixa do Chromebook Pixel

Estou trabalhando a uma semana no Chrome OS e ate agora não tive necessidade de pegar o Macbook para nada, ou seja, voltei usar Linux e agora posso dizer novamente que não uso nem um software propietario no meu notebook. Tudo que achei que iria sentir falta do ambiente Apple era nada mais nada menos que coisa da minha cabeça.

Estou de volta ao desktop livre.



New web framework asynchronous to Python 3

11 de Agosto de 2013, 0:09, por Software Livre Brasil - 0sem comentários ainda/static/images/nacho.jpg

I started a new project with the name nacho, asynchronous web framework for Python 3.

Our goals

  • It was designed to work on Python 3.x
  • Some of syntax were inspired on Tornado's syntax
  • Tornado is the default server, but Eventlet is stable as well
  • Templates are done by Jinja2
  • HTML5 as the big-main-thing
  • Work friendly with NoSQL (otherwise we should stop talking about them)
  • Handle asynchronous requests properly

Example

class MainHandler(ApplicationController):
    def get(self):
        data = {'title': 'testando lero lero'}
        self.render("home.html", **data)


r = Routers([(r"/", MainHandler),])


Chromium as the default browser

2 de Março de 2013, 0:00, por Software Livre Brasil - 0sem comentários ainda

Logo ChromiumThe code of Google Chrome is based on Chromium, all the feature implemented in Chromium comes in Google Chrome.

What do you think of being one of the first to test new feature of Google Chrome? Interesting huh!

Download a bleeding-edge build of Chromium for Mac!

Chromium does not update automatically, for this reason I wrote a shell script which updates the Chromium on Mac:

#!/bin/sh
#
# Note, this will remove /Applications/Chromium.app
#

echo '..'
rm -f chrome-mac.zip chrome-mac
export CHROME_VERSION=`curl http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/LAST_CHANGE`
echo "   latest version: $CHROME_VERSION"
echo '..'
export CHROME_OLD_VERSION=`cat ~/dotfile/CHROME_VERSION`
if [ $CHROME_VERSION == $CHROME_OLD_VERSION ]; then
  echo '   latest version!'
	echo '..'
	exit 2
fi
echo $CHROME_VERSION > ~/dotfile/CHROME_VERSION
echo "   save latest version: $CHROME_VERSION"
echo '..'
echo "   get latest version: $CHROME_VERSION"
echo '..'
wget http://commondatastorage.googleapis.com/chromium-browser-continuous/Mac/$CHROME_VERSION/chrome-mac.zip
echo "   compile latest version: $CHROME_VERSION"
echo '..'
unzip chrome-mac.zip
rm -rf /Applications/Chromium.app
echo "   install latest version: $CHROME_VERSION"
echo '..'
mv chrome-mac/Chromium.app /Applications/Chromium.app
rm -rf chrome-mac chrome-mac.zip
killall -9 Chromium
open /Applications/Chromium.app
echo 'DONE'

base source: https://github.com/avelino/dotfile/blob/master/chromium_update.sh

The post Chromium as the default browser appeared first on Thiago Avelino.



Tags deste artigo: tecnologia software livre python django mongodb nosql