Arquivo da categoria ‘programação’

Como tomar decisões

Sábado, 22 de Novembro de 2008 - Lucindo

Agora pouco, no IM:
trajber: vou pedir ajuda ao meu querido PC
trajber: mauro@trajber:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import random
>>> print random.randint(0,1)
trajber: 0 = ignorar
trajber: 1 = comer
trajber: ok ?
trajber: 0
>>>
trajber: foi justo…
Outro também fez algo parecido: http://twitter.com/igorrs/status/896944758

ACE_Task-like em Python

Domingo, 28 de Setembro de 2008 - Lucindo

Nos últmos dias me reanimei a voltar a postar nesse blog.
Estou tentando mudar para Python como a minha principal linguagem de script, mas ainda preciso aprender a programar direito nessa linguagem. Enquanto isso não acontece, eu fico replicando código de outros lugares, como a cópia de pobre da ACE_Task abaixo:

import threading, Queue, signal

class Task(object):
[…]

HT-AJAX e jQuery

Domingo, 1 de Junho de 2008 - Lucindo

HT-AJAX (documentação aqui) é uma extenção do Hunchentoot que permite exportar suas funções lisp de modo que elas podem ser acessadas via JavaScript, usando AJAX. Um pequeno exemplo de uso dessa biblioteca está nesse post.
HT-AJAX suporta vários AJAX processors, como Prototype e Dojo, mas não jQuery. Então fiz um pequeno patch adicionando suporte a jQuery.
Download: […]

About State

Sábado, 31 de Maio de 2008 - Lucindo

State: you’re doing it wrong!
Two options for lispers:

Purely functional Lisps (subset of CL or something like Clojure, LFE, etc)
Cells!!!

Logo legal

Quinta, 22 de Maio de 2008 - Lucindo

Logo do IRRLAB (site pessoal do Ivan):

State: you’re doing it wrong

Quinta, 22 de Maio de 2008 - Lucindo

I’m completely convinced that mutable objects and the whole approach that is sort of implied by the design of Java, C#, Python, all the languages that followed along this path, is very much the wrong way to do most things… it is ok to do somethings, but it’s the wrong way to do most things.
Mutable […]

The Zen of Python

Quinta, 1 de Maio de 2008 - Lucindo

marvin:~ lucindo$ python
Python 2.5.2 (r252:60911, Apr 26 2008, 14:32:15)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than […]

Para lembrar sempre

Quarta, 30 de Abril de 2008 - Lucindo

Hunchentoot e REST, parte 2: suporte a ETags

Domingo, 27 de Abril de 2008 - Lucindo

Bom, esse post é mais um snippet de como implementar um serviço REST usando Hunchentoot. Dessa vez adicionei suporte a ETags no código do outro post. Ficou assim o tratamendo das requisições:
(defvar *data-id* “e8d8993494ffc11:b8e”)
(defun get-data-id (target)
“get the last id for requested data”
*data-id*)

(defmethod handle :around (request-method)
“ETag support for all methods”
[…]

Testes unitários

Domingo, 27 de Abril de 2008 - Lucindo

As to your real question, the idea of immediate compilation and “unit tests” appeals to me only rarely, when I’m feeling my way in a totally unknown environment and need feedback about what works and what doesn’t. Otherwise, lots of time is wasted on activities that I simply never need to perform or even think […]

(blog ‘lucindo) | http://blog.lucindo.com.br