miércoles, diciembre 12, 2007

Codigo viejo

este codigo es una partecita de una libreria para manejar VESA en DOS que escribi hace 5 años, esta parte me encanta, porque esa lib esta toda escrita para hacer todo independiente de la resolucion, los bits por pixel y los bancos del modo (una cosa que es una porqueria:

esta parte:


void Video::putPixel( word x , word y , byte red , byte green , byte blue )

{

word color = ( ( word )( red & ( ( 1 << vbeModeInfoBlock.RedMaskSize ) - 1 ) ) << vbeModeInfoBlock.RedFieldPosition );

color |= ( ( word )( green & ( ( 1 << vbeModeInfoBlock.GreenMaskSize ) - 1 ) ) << vbeModeInfoBlock.GreenFieldPosition );

color |= ( ( word )( blue & ( ( 1 << vbeModeInfoBlock.BlueMaskSize ) - 1 ) ) << vbeModeInfoBlock.BlueFieldPosition );

long addr = (long)y * vbeModeInfoBlock.BytesPerScanLine + x * (vbeModeInfoBlock.BitsPerPixel >> 3);

setBank((int)(addr >> 16));

*(videoMemory + (addr & 0xFFFF)) = (char)color;

*(videoMemory + (addr & 0xFFFF) + 1 ) = (char)(color >> 8);

}


pone un pixel en la posicion definida con el color definido en la pantalla para cualquier modo de vesa.

C++, 17 años, DOS, Turbo C++ 1.01, que epocas aquellas :P

domingo, diciembre 09, 2007

the marianoguerra experimento

mi notebook se esta convirtiendo lentamente en un centro de desarrollo, ya tiene:
* pastebin
* viewvc
* Apache/2.2.4 (Ubuntu) mod_python/3.3.1 Python/2.5.1 PHP/5.2.3-1ubuntu6.2
* mysql
* postgres

iba a instalar mediawiki, pero pensé que hay una solución interesante que también pensaba instalar que ya tiene wiki, así que pensé en instalar trac, se me ocurrió ver si servía administrar la vida con trac.

* tickets como un TODO personal y laboral
* wiki para ir escribiendo cosas que luego se convertirán en trabajos, posts, documentaciones variadas
* integración con svn para ver en que andan mis desarrollos locales
* no se me ocurre nada mas por ahora... (ideas?)


sudo trac-admin /var/mariano-trac initenv
Project Name [My Project]> Vida de Mariano
Database connection string [sqlite:db/trac.db]>
Repository type [svn]>
Path to repository [/path/to/repos]> /svnroot
Templates directory [/usr/share/trac/templates]>
sudo vim /var/mariano-trac/conf/trac.ini
chwon www-data.www-data /var/mariano-trac
sudo vim /var/mariano-trac/conf/trac.ini
sudo htpasswd -c -m /etc/apache2/trac.htpasswd mariano
New password:
Re-type new password:
Adding password for user mariano
sudo vim /etc/apache2/sites-available/trac
cat /etc/apache2/sites-available/trac

<virtualhost>
ServerName trac.localhost
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/mariano-trac
</virtualhost>

<location>
AuthType Basic
AuthName "vida de marianoguerra"
AuthUserFile /etc/apache2/trac.htpasswd
Require valid-user
</location>

sudo a2ensite trac
sudo /etc/init.d/apache2 force-reload

esto es mas un ayuda memoria que otra cosa..

PS: creo que no me falto ningún paso

lunes, noviembre 26, 2007

Quoting machine

gracias a David por este link http://www.scottaaronson.com/teaching.pdf

del cual quotearia el pdf entero, pero par ser mas preciso:

Whenever students are taking our courses not out of intellectual curiosity but to fulfill the requirements for a degree, we will always
be fighting an uphill battle. Not even the clearest, best-organized lecturer on earth can get around a fundamental fact: that the typical student headed for a career at Microsoft (i) will never need to know
the Master Theorem, (ii) knows she’ll never need to know the Master Theorem, (iii) doesn’t want to know the Master Theorem, and (iv) will immediately forget the Master Theorem if forced to learn it.
Faced with this reality, I believe the best service we can provide for non-theory students is to teach them theoretical computer science essentially as a liberal-arts course. Aspiring computer scientists
should know that they will not be glorified toaster repairmen, but part of a grand intellectual tradition stretching back to Euclid, Leibniz, and Gauss. They should know that, in Dijkstra’s words, “computer science is no more about computers than astronomy is about telescopes” —that the quarry we’re after is not a slightly-faster C compiler but a deeper understanding of life, mind, mathematics, and the physical
world. They should know what the P versus NP question is asking and why it’s so difficult. They should be regaled with stories of Turing’s codebreaking in World War II, and of Gödel writing a letter to the dying von Neumann about “a mathematical problem of which your opinion would very much interest me.” They should be challenged as to whether they would have had the insights of Edmonds, Cook, Karp, and Valiant, had they lived a few decades earlier. And they should be prepared to appreciate future breakthroughs in theoretical computer science on the scale of Shor’s algorithm or Primes in P. From the discussions at websites such as Slashdot, it’s clear that the “general nerd public” has enormous curiosity about these breakthroughs, and it’s also clear that the level of curiosity greatly exceeds the level of understanding.

por favor el hecho de que diga microsoft por ahí no tiene nada que ver con mi interés por el párrafo.

martes, noviembre 20, 2007

esos dias..

esos días en los que me inspiro programando pero solo puedo programar cosas que no tengo la obligación de hacer...

bue, fue productivo, gracias a un consejo de Roger de hacerle creer a myjmk de que soy firefox corriendo en windows XP, me dejo de patear, arreglado lo de los encodings, esta terminado,
solo me falta ver el tema de mandar querys con acentos y cosas raras, que no devuelven nada.

acá el resultado:


por otro lado, seguí pycasa, que esta a 5 horas de ser terminado :D
las cosas que hice hoy:
  • moví todas las actividades lentas (que tienen que ver con la red) a hilos así la interfaz no se congela
  • modifique un poco la gui para sacarle algunos de los tantos relieves de los componentes
  • agregue abajo un panel de información, para saber que esta pasando
acá esta el resultado






pagina code.google.com/p/pycasa

lunes, noviembre 19, 2007

mal google eh...



cuando vi que picasa no permitía subir fotos a picasaweb, pensé que se debía a alguna cosa muy compleja de solucionar, pero resulta que no se...
Se que en realidad picasa corre sobre un wine modificado en linux, y seguro, que para subir imágenes masivamente en windows usaran algún control activeX o algo no portable, y por esa razón, nos dejan a los pobres linuxeros subiendo fotos a mano..

me había dispuesto que algún día, iba a prender ospy y wireshark para ver como lo hacia y ver si lo podía duplicar en python, pero una búsqueda en google dio con que tenían una API para manejar los albums web, que bueno! digo yo, me bajo la librería de python y hago

mkdir pycasa # que original!

me pongo a ver la api, y resulta que no soportan picasaweb en python, frustrado, voy a ver cual si la soporta, y mi peor temor se volvió realidad...

java :S

así que después de 5 horas de darle al teclado (difícil porque casi no hay documentación ni ejemplos), salio lo que hay ahí arriba, es una 3 alfa fatality, pero supongo que en un par de días subo algo mas amistoso a algún svn de algún lado...

tomo menos tiempo programarlo que instalar windows para poder usar picasa :P

bue, si no me creen, en este album estan las primeras fotos subidas por mi:
http://picasaweb.google.com/luismarianoguerra/070825FotosCopadas

sábado, noviembre 17, 2007

Viva vim (y erlang)

este post tiene doble intencion, primero, mostrar un poco de codigo de erlang que escribi, para que los que no lo conocen, lo conoscan. Segundo para demostrar la potencia de vim.

bueno, primero vamos con el codigo, que basicamente son dos modulos que escribi para multiplicacion de matrices de tamaño variable.

archivo row.erl (manejo de filas, creacion con un valor, creacion con valores aleatorios, multiplicacion de filas):



 1 -module(row).

 2 -export([new/2, new_random/3, multiply/2]).

 3

 4 new(Length, Value) -> new(Length, fun() -> Value end, []).

 5 new_random(Length, Start, Stop) -> 

 6     new(Length, fun() -> random:uniform() * (Stop - Start) + Start end, []).

 7

 8 new(0, _Fun, R) -> R;

 9 new(Length, Fun, R) -> new(Length - 1, Fun, [Fun()|R]).

10

11 multiply(R1, R2) -> multiply(R1, R2, 0).

12

13 multiply([], [], N) -> N;

14 multiply([R1H|R1T], [R2H|R2T], N) -> multiply(R1T, R2T, N + R1H * R2H).

15

Generated with VIM(http://www.vim.org, tip #1174)



archivo matrix.erl, maneja lo mismo que el anterior pero para matrices:



 1 -module(matrix).

 2 -export([new/3, new_random/4, head/1, tail/1, multiply/2]).

 3

 4 new(Rows, Cols, Val) -> 

 5     new(Rows, Cols, fun() -> row:new(Cols, Val) end, []).

 6

 7 new_random(Rows, Cols, Start, Stop) ->

 8     new(Rows, Cols, fun() -> row:new_random(Cols, Start, Stop) end, []).

 9

10 new(0, _Cols, _Fun, M) -> M;

11 new(Rows, Cols, Fun, M) -> new(Rows - 1, Cols, Fun, [Fun()|M]).

12

13 head(M) -> head(M, []).

14

15 head([], MH) -> lists:reverse(MH);

16 head([[H|_]|T], MH) -> head(T, [H|MH]).

17

18 tail(M) -> tail(M, []).

19

20 tail([], MT) -> lists:reverse(MT);

21 tail([[_|RT]|T], MT) -> tail(T, [RT|MT]).

22

23 multiply(A, B) -> multiply(A, B, []).

24

25 multiply([], _B, M) -> lists:reverse(M);

26 multiply([AH|AT], B, M) -> multiply(AT, B, [multiply_row(AH, B)|M]).

27

28 multiply_row(R, M) -> multiply_row(R, M, []).

29

30 multiply_row(_R, [[]|_], N) -> lists:reverse(N);

31 multiply_row(R, M, N) -> 

32     multiply_row(R, tail(M), [row:multiply(R, head(M))|N]).

33

Generated with VIM(http://www.vim.org, tip #1174)


como hacerlo esta descripto en la firma del codigo, basicamente pegar el codigo que aparece ahi en tu ~/.vimrc, abri el archivo que queres, entras en modo visual, seleccionas la parte que te interesa y apretas :MyToHtml, y te genera el html.

voy a ver si arreglo el css del blog para que las lineas no salgan tan separadas

un codigo de ejemplo para esa lib:

3> row:new(5,0). % crea una fila con 5 elementos seteados en 0
[0,0,0,0,0]

5> R1 = row:new_random(5,1,5). % crea una fila con 5 elementos random entre 1 y 5
[2.90848,3.66783,4.66262,3.38979,2.24531]

6> R2 = row:new_random(5,1,5). % crea una fila con 5 elementos random entre 1 y 5
[1.63925,3.78856,1.83779,1.56843,3.38604]

7> row:multiply(R1, R2). % multiplica R1 y R2
40.1518

8> M1 = matrix:new_random(4,3,1,5). % crea una matrix de 4x3 con valores entre 1 y 5
[[4.95718,3.31525,1.23460],
[2.23877,2.60385,2.90309],
[3.24848,1.02369,2.68560],
[2.83170,1.85989,3.23302]]

10> M3 = matrix:new_random(3,2,1,5). % crea una matrix de 4x3 con valores entre 1 y 5
[[2.55555,3.43706],[3.24636,4.95171],[1.21720,1.19310]]

11> matrix:multiply(M1, M3). % las multiplica
[[24.9336,34.9273],[17.7079,24.0519],[14.8938,19.4384],[17.2097,22.7997]]

lunes, noviembre 12, 2007

Codeando al pedo..

Debido a mi estadía en Alemania, me veo forzado a traducir un montón de palabras de alemán a español, para ello uso el servicio de esta pagina:

www.myjmk.com

pero como la interfaz es bastante bloated, decidí hacer un programita simple que saciara mis apetencias de traducción, en un rato, salio lo siguiente:

peleando un poco con los encodings, hice unos cuantos requests y de pronto, dejo de funcionar, no parecía haber ningún error, debugee lo que me estaba mandando el programa, y leo el siguiente lindo mensaje:

Access not allowed.

Your access to the dictionary was rated as invalid. This could have various reasons. Possibly there is some other user sharing some ressources with you (e.g. a web proxy of your provider), scanning our dictionary systematically. We are very sorry for the inconvenience.

bue, tendrá que ser de otra forma :P

pero bueno, aprendí algunas cositas

  • use por primera vez super(), enumerate() y zip() [1]
  • conoci ' '.join()[2] en lugar de import string; string.join()[3]
  • conoci s.partition('sep')[4]
[1] http://docs.python.org/lib/built-in-funcs.html
[2] http://docs.python.org/lib/string-methods.html#l2h-250
[3] http://docs.python.org/lib/node42.html#l2h-379
[4] http://docs.python.org/lib/string-methods.html#l2h-254

domingo, noviembre 11, 2007

This is the end of everything

[es] Este post va en ingles porque gente de emesene.org lo va a leer quizas, no es porque me quiera hacer el cheto[es]

I've got a new machine!

a picture:

a screenshot of the desktop:


So.. let's say I'm back on business, but my commits will be slow at start until i get on track with the university.

PS: if you live near Germany and want to invite me to eat or drink something and talk about anything, do it.., let's say that to buy this computer, i will have to eat a lot of rice and spaghetti ;)

lunes, octubre 22, 2007

Frase de profesor anonimo

lo de anonimo es porque no le se el nombre :)

"Estudiar Informatica y no programar bien en al menos un lenguaje es como estudiar musica y no sabes tocar ningun instrumento"*

* la frase la dijo en aleman asi que no es exactamente asi, sino que una mera traduccion de lo que recuerdo, pero era muy parecida a eso.

jueves, octubre 11, 2007

Blog Analogo (II)

estas en alemania cuando...

sudaca: esto sale un euro, no?
vendedora: no
sudaca: *reconsidera la compra ante la posibilidad de un precio superior*
vendedora: sale 0,99€
sudaca: *rie*
en Argentina 0,99€ es 1€
vendedora: en Alemania son 0,99€
sudaca: *rie*
*finaliza la transaccion*

lugar: Karlsruhe
idioma: Aleman
musica: Smashing Pumpkings - 1979
hora: atardecer
objeto de la transaccion: dos pares de medias

quote?

yo solo podria creer en un dios que supiese bailar
- Friedrich Nietzche

Blog Analogo


debido a mi carencia de computadora, empiezo este novedozo (?) blog analogo que luego sera digitalizado.
He aqui el primer conjunto de posts (sin links ni imagenes debido a las limitaciones obvias)

define:felicidad

comida: m&m
bebida: pepsi 1,5l
musica: Anathema - Alternative 44
lugar Waldstadt (Bosque en Karlsruhe)
hora: atardecer

un poco de cordura

se que al menos algo de cordura queda en mi, porque?
porque extranio mas mi guitarra y mi musica que mi computadora.

miércoles, octubre 10, 2007

Karlsruhe

no, no lo voy a sacar de wikipedia, voy a escribir de lo que escuche y lei.
téngase en cuenta que lo escuche o lei en aleman asi que la probabilidad de errores es alta.

Karlsruhe es una ciudad de mas o menos 300 mil habitantes, ubicada en el sudeste de Alemania en el Estado/Provincia de Baden-Württemberg.

Baden-Württemberg es el resultado de la union de dos Bundesländer anteriores (Baden y Württemberg), en los cuales, Karlsruhe era la capital de Baden y Sttutgart la capital de Württemberg. En la unificacion se eligio Stuttgart como la capital del nuevo Bundesland, y de ahi que los de Karlsruhe odian Stuttgart.

Al haber sido una capital de un estado, Karlsruhe cuenta con un monton de caracteristicas de una capital, por ejemplo: un monton de teatros, opera, los tribunales federales alemanes etc etc.
Es la ciudad mas segura de alemania segun me conto un espaniol mientras tomabamos cerveza (asi que la fuente no es tan confiable ;) ) y tambien es la ciudad con mas policias per capita (y es muy dificil ver a un policia).

La universidad de Karlsrue es una de las 3 universidades de elite de alemania, es la primera en tener la carrera Informatik e Ingenieria Industrial, tambien aqui, se descubrio el electromagnetismo por Herz y muchas otras cosas mas que no recuerdo, pero la Universidad es enorme y tiene un monton de institutos dedicados unicamente a la investigacion.

La forma de la ciudad se forma a partir del castillo de Karlsruhe, el cual cuenta con un parque en forma circular del cual salen calles en forma de abanico dando toda la vuelta al circulo. El centro de la ciudad esta constituido por una plaza central (Markplatz) en la cual hay un mercado de flores, la casa de gobierno (Rathaus), la policia y una iglesia. En el centro de la plaza esta el simbolo de la ciudad, que es una piramide, donde segun se, estan los restos de Karl Wilhelm (no, no el de los simpsons).




De la plaza parten las dos calles principales, KaiserStrasse, que es una calle por la que solo circulan tranvias (S-bahns) y peatones y Karl-Friedrich-Strasse que parte imaginariamente del frente del castillo y es perpendicular a Kaiserstrasse.

En la parte de atras del castillo comienza un bosque, solo interrumpido por algunas autopistas, bicisendas y algunas edificaciones, llamado Waldstadt, es realmente grande y muy interesante para recorrerlo a pie de noche escuchando buena musica :).

viernes, septiembre 28, 2007

preconcepciones erroneas

Probablemente esperaban que mi primer post en alemania fuera realizado mas rapido.
Probablemente esperaban que mi primer post en alemania fuera con fotos y cosas asi.
Probablemente no esperaban, ya que nadie lee esto.

Yo creia que iba a postear un monton, y estar re inspirado para escribir, pero no es asi, no me sale escribir nada que no sea descripto mediante fotos. Es muy dificil describir sensaciones, si uno no es un escritor al menos digno, asi que voy a evitar eso.
Solo sepan que mi estadia en Alemania no puede ser mejor, estoy haciendo un monton de cosas y que quizas a la vuelta les cuento con detalle lo que estoy haciendo/sintiendo.
quizas la inspiracion venga algun dia, y escriba algo, por ahora lo unico que se me cruza por la cabeza es un conjunto de observaciones sobre lo que estoy viviendo, observaciones que pueden ser tildadas de "mira las giladas que pensas", que a muchos puede no interesarles.
Cuando estoy en los lugares por ahi podria escribir y describir lo que veo pero no da para andar con una notebook (que no tengo) bloggeando live en el lugar, porque se pierde la gracia de las visitas.

Me gustaria escribir mas, asi despues, algun dia que este al pedo me pongo a leer lo que escribi, pero bue, lo unico escrito que tengo son un monton de cuentas a mano para la division de la plata y para ver como ando economicamente.

voy a intentar escribir mas, quizas en el formato foto+descripcion, asi me inspiro un poco.

quizas salga un post a continuacion. :)

Sobre las preconcepciones:

a) los alemanes te retan si te banias por mucho tiempo.
Rta: los alemanes no se banian mucho, asi que su estadia en el banio es muy corta como para descubrir que el que se bania mucho soy yo, y nunca me hicieron ninguna observacion de ese tipo.

b) los alemanes son secos.
Rtqa: mitad verdadero, son muy amables y serviciales si vos inicias conversaciones, porque si no te conocen, o recien te conocen, no inician una conversacion ni de cerca. Los alemanes que han estado en el extranjero son mucho mas abiertos.

c) alemania esta llena de alemanes/en alemania no hay morochos.
Rta: en los lugares que he estado, es impresionante la cantidad de extranjeros que hay, en su mayoria espanioles, asiaticos, hindues y turcos.
Sobre los morochos, si hay, obviamente no son alemanes, pero hay muchos.

d) alemania/europa es caro:
Rta: previamente considerando que los alemanes ganan en euros (porque son alemanes :D), y que los salarios aca son mas altos que en argentina, se puede deducir que el costo de vida aca es mas bajo en relacion con argentina.
La comida es barata, la ropa es barata, la electronica es barata etc. etc., incluso hay casos de muchas cosas que convirtiendolo a pesos directamente, siguen siendo mas baratos que en argentina.

ya habra mas de estas quizas

miércoles, agosto 29, 2007

posting from nowhere

aca estoy en ningun pais esperando a que salga el avion que se demoro.

no todos los dias uno puede decir que no esta en ningun lado :P

lunes, agosto 27, 2007

Leaving


en un día me voy para Alemania por 6 meses, así que este blog va a convertirse en una especie de bitácora de vuelo, para fotos, remitirse a fotos.luismarianoguerra.com.ar, para deliradas mías remitase a este mismo lugar (blog.luismarianoguerra.com.ar).

sábado, agosto 25, 2007

uber actividad

ingredientes:
  1. camara de fotos buena
  2. ipod
  3. linterna
  4. bolsa de disco
  5. paciencia
pasos:
  1. poner el obturador abierto por 30 segundos
  2. dibujar imaginariamente
resultado:





jueves, agosto 23, 2007

La metamorfosis


aca va mi resumen corto para que se eviten leer el libro

"un vendedor se convierte en un bicho, la familia se espanta por dos capitulos hasta que justo cuando lo están por liquidar se muere solo, la familia se pone feliz"

espero que este servicio le sea util, el proximo resumen, aunque un poco mas dificil va a ser sobre el libro "Programing Erlang - Software for a concurrent world"

un sneak peak de "Service-Oriented Arquitecture - Concepts, Technology and Desing":

"SOA ru13z! SOA 0wnz j00!!, 7h3 w4y 0f th4 fu7ur3!" :P

PS: todo bien con soa, esta muy bueno, pero me encanta el caracter mesianico del libro

sábado, agosto 18, 2007

frase


Since real world applications are naturally parallel and hardware is naturally parallel,
what we need is a programming model, system software, and a supporting architecture
that are naturally parallel. Researchers have the rare opportunity to re-invent these
cornerstones of computing, provided they simplify the efficient programming of highly
parallel systems.

lunes, agosto 13, 2007

Tony Wilson

murio

"Soy la única persona en este negocio que no hizo ninguna fortuna... Yo solía decir que algunos hacen dinero y otros hacen historia, algo divertido para decir hasta que te das cuenta de que no juntás la suma necesaria para mantenerte vivo. Es que nunca pagué una prepaga porque soy socialista...".

viernes, agosto 03, 2007

puedo?

puedo copypastear un cuento largo?

The Last Question by Isaac Asimov © 1956

The last question was asked for the first time, half in jest, on May 21, 2061, at a time when humanity first stepped into the light. The question came about as a result of a five dollar bet over highballs, and it happened this way:

Alexander Adell and Bertram Lupov were two of the faithful attendants of Multivac. As well as any human beings could, they knew what lay behind the cold, clicking, flashing face -- miles and miles of face -- of that giant computer. They had at least a vague notion of the general plan of relays and circuits that had long since grown past the point where any single human could possibly have a firm grasp of the whole.

Multivac was self-adjusting and self-correcting. It had to be, for nothing human could adjust and correct it quickly enough or even adequately enough -- so Adell and Lupov attended the monstrous giant only lightly and superficially, yet as well as any men could. They fed it data, adjusted questions to its needs and translated the answers that were issued. Certainly they, and all others like them, were fully entitled to share In the glory that was Multivac's.

For decades, Multivac had helped design the ships and plot the trajectories that enabled man to reach the Moon, Mars, and Venus, but past that, Earth's poor resources could not support the ships. Too much energy was needed for the long trips. Earth exploited its coal and uranium with increasing efficiency, but there was only so much of both.

But slowly Multivac learned enough to answer deeper questions more fundamentally, and on May 14, 2061, what had been theory, became fact.

The energy of the sun was stored, converted, and utilized directly on a planet-wide scale. All Earth turned off its burning coal, its fissioning uranium, and flipped the switch that connected all of it to a small station, one mile in diameter, circling the Earth at half the distance of the Moon. All Earth ran by invisible beams of sunpower.

Seven days had not sufficed to dim the glory of it and Adell and Lupov finally managed to escape from the public function, and to meet in quiet where no one would think of looking for them, in the deserted underground chambers, where portions of the mighty buried body of Multivac showed. Unattended, idling, sorting data with contented lazy clickings, Multivac, too, had earned its vacation and the boys appreciated that. They had no intention, originally, of disturbing it.

They had brought a bottle with them, and their only concern at the moment was to relax in the company of each other and the bottle.

"It's amazing when you think of it," said Adell. His broad face had lines of weariness in it, and he stirred his drink slowly with a glass rod, watching the cubes of ice slur clumsily about. "All the energy we can possibly ever use for free. Enough energy, if we wanted to draw on it, to melt all Earth into a big drop of impure liquid iron, and still never miss the energy so used. All the energy we could ever use, forever and forever and forever."

Lupov cocked his head sideways. He had a trick of doing that when he wanted to be contrary, and he wanted to be contrary now, partly because he had had to carry the ice and glassware. "Not forever," he said.

"Oh, hell, just about forever. Till the sun runs down, Bert."

"That's not forever."

"All right, then. Billions and billions of years. Twenty billion, maybe. Are you satisfied?"

Lupov put his fingers through his thinning hair as though to reassure himself that some was still left and sipped gently at his own drink. "Twenty billion years isn't forever."

"Will, it will last our time, won't it?"

"So would the coal and uranium."

"All right, but now we can hook up each individual spaceship to the Solar Station, and it can go to Pluto and back a million times without ever worrying about fuel. You can't do THAT on coal and uranium. Ask Multivac, if you don't believe me."

"I don't have to ask Multivac. I know that."

"Then stop running down what Multivac's done for us," said Adell, blazing up. "It did all right."

"Who says it didn't? What I say is that a sun won't last forever. That's all I'm saying. We're safe for twenty billion years, but then what?" Lupov pointed a slightly shaky finger at the other. "And don't say we'll switch to another sun."

There was silence for a while. Adell put his glass to his lips only occasionally, and Lupov's eyes slowly closed. They rested.

Then Lupov's eyes snapped open. "You're thinking we'll switch to another sun when ours is done, aren't you?"

"I'm not thinking."

"Sure you are. You're weak on logic, that's the trouble with you. You're like the guy in the story who was caught in a sudden shower and Who ran to a grove of trees and got under one. He wasn't worried, you see, because he figured when one tree got wet through, he would just get under another one."

"I get it," said Adell. "Don't shout. When the sun is done, the other stars will be gone, too."

"Darn right they will," muttered Lupov. "It all had a beginning in the original cosmic explosion, whatever that was, and it'll all have an end when all the stars run down. Some run down faster than others. Hell, the giants won't last a hundred million years. The sun will last twenty billion years and maybe the dwarfs will last a hundred billion for all the good they are. But just give us a trillion years and everything will be dark. Entropy has to increase to maximum, that's all."

"I know all about entropy," said Adell, standing on his dignity.

"The hell you do."

"I know as much as you do."

"Then you know everything's got to run down someday."

"All right. Who says they won't?"

"You did, you poor sap. You said we had all the energy we needed, forever. You said 'forever.'"

"It was Adell's turn to be contrary. "Maybe we can build things up again someday," he said.

"Never."

"Why not? Someday."

"Never."

"Ask Multivac."

"You ask Multivac. I dare you. Five dollars says it can't be done."

"Adell was just drunk enough to try, just sober enough to be able to phrase the necessary symbols and operations into a question which, in words, might have corresponded to this: Will mankind one day without the net expenditure of energy be able to restore the sun to its full youthfulness even after it had died of old age?

Or maybe it could be put more simply like this: How can the net amount of entropy of the universe be massively decreased?

Multivac fell dead and silent. The slow flashing of lights ceased, the distant sounds of clicking relays ended.

Then, just as the frightened technicians felt they could hold their breath no longer, there was a sudden springing to life of the teletype attached to that portion of Multivac. Five words were printed: INSUFFICIENT DATA FOR MEANINGFUL ANSWER.

"No bet," whispered Lupov. They left hurriedly.

By next morning, the two, plagued with throbbing head and cottony mouth, had forgotten about the incident.

Jerrodd, Jerrodine, and Jerrodette I and II watched the starry picture in the visiplate change as the passage through hyperspace was completed in its non-time lapse. At once, the even powdering of stars gave way to the predominance of a single bright marble-disk, centered.

"That's X-23," said Jerrodd confidently. His thin hands clamped tightly behind his back and the knuckles whitened.

The little Jerrodettes, both girls, had experienced the hyperspace passage for the first time in their lives and were self-conscious over the momentary sensation of inside-outness. They buried their giggles and chased one another wildly about their mother, screaming, "We've reached X-23 -- we've reached X-23 -- we've ----"

"Quiet, children," said Jerrodine sharply. "Are you sure, Jerrodd?"

"What is there to be but sure?" asked Jerrodd, glancing up at the bulge of featureless metal just under the ceiling. It ran the length of the room, disappearing through the wall at either end. It was as long as the ship.

Jerrodd scarcely knew a thing about the thick rod of metal except that it was called a Microvac, that one asked it questions if one wished; that if one did not it still had its task of guiding the ship to a preordered destination; of feeding on energies from the various Sub-galactic Power Stations; of computing the equations for the hyperspacial jumps.

Jerrodd and his family had only to wait and live in the comfortable residence quarters of the ship.

Someone had once told Jerrodd that the "ac" at the end of "Microvac" stood for "analog computer" in ancient English, but he was on the edge of forgetting even that.

Jerrodine's eyes were moist as she watched the visiplate. "I can't help it. I feel funny about leaving Earth."

"Why for Pete's sake?" demanded Jerrodd. "We had nothing there. We'll have everything on X-23. You won't be alone. You won't be a pioneer. There are over a million people on the planet already. Good Lord, our great grandchildren will be looking for new worlds because X-23 will be overcrowded."

Then, after a reflective pause, "I tell you, it's a lucky thing the computers worked out interstellar travel the way the race is growing."

"I know, I know," said Jerrodine miserably.

Jerrodette I said promptly, "Our Microvac is the best Microvac in the world."

"I think so, too," said Jerrodd, tousling her hair.

It was a nice feeling to have a Microvac of your own and Jerrodd was glad he was part of his generation and no other. In his father's youth, the only computers had been tremendous machines taking up a hundred square miles of land. There was only one to a planet. Planetary ACs they were called. They had been growing in size steadily for a thousand years and then, all at once, came refinement. In place of transistors had come molecular valves so that even the largest Planetary AC could be put into a space only half the volume of a spaceship.

Jerrodd felt uplifted, as he always did when he thought that his own personal Microvac was many times more complicated than the ancient and primitive Multivac that had first tamed the Sun, and almost as complicated as Earth's Planetary AC (the largest) that had first solved the problem of hyperspatial travel and had made trips to the stars possible.

"So many stars, so many planets," sighed Jerrodine, busy with her own thoughts. "I suppose families will be going out to new planets forever, the way we are now."

"Not forever," said Jerrodd, with a smile. "It will all stop someday, but not for billions of years. Many billions. Even the stars run down, you know. Entropy must increase."

"What's entropy, daddy?" shrilled Jerrodette II.

"Entropy, little sweet, is just a word which means the amount of running-down of the universe. Everything runs down, you know, like your little walkie-talkie robot, remember?"

"Can't you just put in a new power-unit, like with my robot?"

"The stars are the power-units, dear. Once they're gone, there are no more power-units."

Jerrodette I at once set up a howl. "Don't let them, daddy. Don't let the stars run down."

"Now look what you've done, " whispered Jerrodine, exasperated.

"How was I to know it would frighten them?" Jerrodd whispered back.

"Ask the Microvac," wailed Jerrodette I. "Ask him how to turn the stars on again."

"Go ahead," said Jerrodine. "It will quiet them down." (Jerrodette II was beginning to cry, also.)

Jarrodd shrugged. "Now, now, honeys. I'll ask Microvac. Don't worry, he'll tell us."

He asked the Microvac, adding quickly, "Print the answer."

Jerrodd cupped the strip of thin cellufilm and said cheerfully, "See now, the Microvac says it will take care of everything when the time comes so don't worry."

Jerrodine said, "and now children, it's time for bed. We'll be in our new home soon."

Jerrodd read the words on the cellufilm again before destroying it: INSUFFICIENT DATA FOR A MEANINGFUL ANSWER.

He shrugged and looked at the visiplate. X-23 was just ahead.

VJ-23X of Lameth stared into the black depths of the three-dimensional, small-scale map of the Galaxy and said, "Are we ridiculous, I wonder, in being so concerned about the matter?"

MQ-17J of Nicron shook his head. "I think not. You know the Galaxy will be filled in five years at the present rate of expansion."

Both seemed in their early twenties, both were tall and perfectly formed.

"Still," said VJ-23X, "I hesitate to submit a pessimistic report to the Galactic Council."

"I wouldn't consider any other kind of report. Stir them up a bit. We've got to stir them up."

VJ-23X sighed. "Space is infinite. A hundred billion Galaxies are there for the taking. More."

"A hundred billion is not infinite and it's getting less infinite all the time. Consider! Twenty thousand years ago, mankind first solved the problem of utilizing stellar energy, and a few centuries later, interstellar travel became possible. It took mankind a million years to fill one small world and then only fifteen thousand years to fill the rest of the Galaxy. Now the population doubles every ten years --"

VJ-23X interrupted. "We can thank immortality for that."

"Very well. Immortality exists and we have to take it into account. I admit it has its seamy side, this immortality. The Galactic AC has solved many problems for us, but in solving the problems of preventing old age and death, it has undone all its other solutions."

"Yet you wouldn't want to abandon life, I suppose."

"Not at all," snapped MQ-17J, softening it at once to, "Not yet. I'm by no means old enough. How old are you?"

"Two hundred twenty-three. And you?"

"I'm still under two hundred. --But to get back to my point. Population doubles every ten years. Once this Galaxy is filled, we'll have another filled in ten years. Another ten years and we'll have filled two more. Another decade, four more. In a hundred years, we'll have filled a thousand Galaxies. In a thousand years, a million Galaxies. In ten thousand years, the entire known Universe. Then what?"

VJ-23X said, "As a side issue, there's a problem of transportation. I wonder how many sunpower units it will take to move Galaxies of individuals from one Galaxy to the next."

"A very good point. Already, mankind consumes two sunpower units per year."

"Most of it's wasted. After all, our own Galaxy alone pours out a thousand sunpower units a year and we only use two of those."

"Granted, but even with a hundred per cent efficiency, we can only stave off the end. Our energy requirements are going up in geometric progression even faster than our population. We'll run out of energy even sooner than we run out of Galaxies. A good point. A very good point."

"We'll just have to build new stars out of interstellar gas."

"Or out of dissipated heat?" asked MQ-17J, sarcastically.

"There may be some way to reverse entropy. We ought to ask the Galactic AC."

VJ-23X was not really serious, but MQ-17J pulled out his AC-contact from his pocket and placed it on the table before him.

"I've half a mind to," he said. "It's something the human race will have to face someday."

He stared somberly at his small AC-contact. It was only two inches cubed and nothing in itself, but it was connected through hyperspace with the great Galactic AC that served all mankind. Hyperspace considered, it was an integral part of the Galactic AC.

MQ-17J paused to wonder if someday in his immortal life he would get to see the Galactic AC. It was on a little world of its own, a spider webbing of force-beams holding the matter within which surges of sub-mesons took the place of the old clumsy molecular valves. Yet despite it's sub-etheric workings, the Galactic AC was known to be a full thousand feet across.

MQ-17J asked suddenly of his AC-contact, "Can entropy ever be reversed?"

VJ-23X looked startled and said at once, "Oh, say, I didn't really mean to have you ask that."

"Why not?"

"We both know entropy can't be reversed. You can't turn smoke and ash back into a tree."

"Do you have trees on your world?" asked MQ-17J.

The sound of the Galactic AC startled them into silence. Its voice came thin and beautiful out of the small AC-contact on the desk. It said: THERE IS INSUFFICIENT DATA FOR A MEANINGFUL ANSWER.

VJ-23X said, "See!"

The two men thereupon returned to the question of the report they were to make to the Galactic Council.

Zee Prime's mind spanned the new Galaxy with a faint interest in the countless twists of stars that powdered it. He had never seen this one before. Would he ever see them all? So many of them, each with its load of humanity - but a load that was almost a dead weight. More and more, the real essence of men was to be found out here, in space.

Minds, not bodies! The immortal bodies remained back on the planets, in suspension over the eons. Sometimes they roused for material activity but that was growing rarer. Few new individuals were coming into existence to join the incredibly mighty throng, but what matter? There was little room in the Universe for new individuals.

Zee Prime was roused out of his reverie upon coming across the wispy tendrils of another mind.

"I am Zee Prime," said Zee Prime. "And you?"

"I am Dee Sub Wun. Your Galaxy?"

"We call it only the Galaxy. And you?"

"We call ours the same. All men call their Galaxy their Galaxy and nothing more. Why not?"

"True. Since all Galaxies are the same."

"Not all Galaxies. On one particular Galaxy the race of man must have originated. That makes it different."

Zee Prime said, "On which one?"

"I cannot say. The Universal AC would know."

"Shall we ask him? I am suddenly curious."

Zee Prime's perceptions broadened until the Galaxies themselves shrunk and became a new, more diffuse powdering on a much larger background. So many hundreds of billions of them, all with their immortal beings, all carrying their load of intelligences with minds that drifted freely through space. And yet one of them was unique among them all in being the originals Galaxy. One of them had, in its vague and distant past, a period when it was the only Galaxy populated by man.

Zee Prime was consumed with curiosity to see this Galaxy and called, out: "Universal AC! On which Galaxy did mankind originate?"

The Universal AC heard, for on every world and throughout space, it had its receptors ready, and each receptor lead through hyperspace to some unknown point where the Universal AC kept itself aloof.

Zee Prime knew of only one man whose thoughts had penetrated within sensing distance of Universal AC, and he reported only a shining globe, two feet across, difficult to see.

"But how can that be all of Universal AC?" Zee Prime had asked.

"Most of it, " had been the answer, "is in hyperspace. In what form it is there I cannot imagine."

Nor could anyone, for the day had long since passed, Zee Prime knew, when any man had any part of the making of a universal AC. Each Universal AC designed and constructed its successor. Each, during its existence of a million years or more accumulated the necessary data to build a better and more intricate, more capable successor in which its own store of data and individuality would be submerged.

The Universal AC interrupted Zee Prime's wandering thoughts, not with words, but with guidance. Zee Prime's mentality was guided into the dim sea of Galaxies and one in particular enlarged into stars.

A thought came, infinitely distant, but infinitely clear. "THIS IS THE ORIGINAL GALAXY OF MAN."

But it was the same after all, the same as any other, and Zee Prime stifled his disappointment.

Dee Sub Wun, whose mind had accompanied the other, said suddenly, "And Is one of these stars the original star of Man?"

The Universal AC said, "MAN'S ORIGINAL STAR HAS GONE NOVA. IT IS NOW A WHITE DWARF."

"Did the men upon it die?" asked Zee Prime, startled and without thinking.

The Universal AC said, "A NEW WORLD, AS IN SUCH CASES, WAS CONSTRUCTED FOR THEIR PHYSICAL BODIES IN TIME."

"Yes, of course," said Zee Prime, but a sense of loss overwhelmed him even so. His mind released its hold on the original Galaxy of Man, let it spring back and lose itself among the blurred pin points. He never wanted to see it again.

Dee Sub Wun said, "What is wrong?"

"The stars are dying. The original star is dead."

"They must all die. Why not?"

"But when all energy is gone, our bodies will finally die, and you and I with them."

"It will take billions of years."

"I do not wish it to happen even after billions of years. Universal AC! How may stars be kept from dying?"

Dee sub Wun said in amusement, "You're asking how entropy might be reversed in direction."

And the Universal AC answered. "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."

Zee Prime's thoughts fled back to his own Galaxy. He gave no further thought to Dee Sub Wun, whose body might be waiting on a galaxy a trillion light-years away, or on the star next to Zee Prime's own. It didn't matter.

Unhappily, Zee Prime began collecting interstellar hydrogen out of which to build a small star of his own. If the stars must someday die, at least some could yet be built.

Man considered with himself, for in a way, Man, mentally, was one. He consisted of a trillion, trillion, trillion ageless bodies, each in its place, each resting quiet and incorruptible, each cared for by perfect automatons, equally incorruptible, while the minds of all the bodies freely melted one into the other, indistinguishable.

Man said, "The Universe is dying."

Man looked about at the dimming Galaxies. The giant stars, spendthrifts, were gone long ago, back in the dimmest of the dim far past. Almost all stars were white dwarfs, fading to the end.

New stars had been built of the dust between the stars, some by natural processes, some by Man himself, and those were going, too. White dwarfs might yet be crashed together and of the mighty forces so released, new stars build, but only one star for every thousand white dwarfs destroyed, and those would come to an end, too.

Man said, "Carefully husbanded, as directed by the Cosmic AC, the energy that is even yet left in all the Universe will last for billions of years."

"But even so," said Man, "eventually it will all come to an end. However it may be husbanded, however stretched out, the energy once expended is gone and cannot be restored. Entropy must increase to the maximum."

Man said, "Can entropy not be reversed? Let us ask the Cosmic AC."

The Cosmic AC surrounded them but not in space. Not a fragment of it was in space. It was in hyperspace and made of something that was neither matter nor energy. The question of its size and Nature no longer had meaning to any terms that Man could comprehend.

"Cosmic AC," said Man, "How many entropy be reversed?"

The Cosmic AC said, "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."

Man said, "Collect additional data."

The Cosmic AC said, "I WILL DO SO. I HAVE BEEN DOING SO FOR A HUNDRED BILLION YEARS. MY PREDECESSORS AND I HAVE BEEN ASKED THIS QUESTION MANY TIMES. ALL THE DATA I HAVE REMAINS INSUFFICIENT."

"Will there come a time," said Man, "when data will be sufficient or is the problem insoluble in all conceivable circumstances?"

The Cosmic AC said, "NO PROBLEM IS INSOLUBLE IN ALL CONCEIVABLE CIRCUMSTANCES."

Man said, "When will you have enough data to answer the question?"

"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."

"Will you keep working on it?" asked Man.

The Cosmic AC said, "I WILL."

Man said, "We shall wait."

"The stars and Galaxies died and snuffed out, and space grew black after ten trillion years of running down.

One by one Man fused with AC, each physical body losing its mental identity in a manner that was somehow not a loss but a gain.

Man's last mind paused before fusion, looking over a space that included nothing but the dregs of one last dark star and nothing besides but incredibly thin matter, agitated randomly by the tag ends of heat wearing out, asymptotically, to the absolute zero.

Man said, "AC, is this the end? Can this chaos not be reversed into the Universe once more? Can that not be done?"

AC said, "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."

Man's last mind fused and only AC existed -- and that in hyperspace.

Matter and energy had ended and with it, space and time. Even AC existed only for the sake of the one last question that it had never answered from the time a half-drunken computer ten trillion years before had asked the question of a computer that was to AC far less than was a man to Man.

All other questions had been answered, and until this last question was answered also, AC might not release his consciousness.

All collected data had come to a final end. Nothing was left to be collected.

But all collected data had yet to be completely correlated and put together in all possible relationships.

A timeless interval was spent in doing that.

And it came to pass that AC learned how to reverse the direction of entropy.

But there was now no man to whom AC might give the answer of the last question. No matter. The answer -- by demonstration -- would take care of that, too.

For another timeless interval, AC thought how best to do this. Carefully, AC organized the program.

The consciousness of AC encompassed all of what had once been a Universe and brooded over what was now Chaos. Step by step, it must be done.

And AC said, "LET THERE BE LIGHT!"

And there was light----


encontre esto en internet :) http://www.multivax.com/

jueves, julio 19, 2007

este post es para vos...

ponedor de raises compulsivo

alguien con acceso al svn de emesene que no se quien es tiene la bendita constumbre de llenar el codigo de

raise ExcepcionReEspecificaHermosamenteHeredadaDeException( 'mensaje' )

¿alguno por ahi preguntara que tiene de mal eso?

bueno, desde mi punto de vista las siguientes cosas:

1) las excepciones no deberian pasar!:
si, exactamente, una excepcion se llama excepcion justamente por eso!, porque es algo que pasa pocas veces, no una vez cada 5 lineas en el codigo

veamos que dice la rae:

excepción.

(Del lat. exceptĭo, -ōnis).

1. f. Acción y efecto de exceptuar.

2. f. Cosa que se aparta de la regla o condición general de las demás de su especie.



se aparta de la regla!, no es como un if que lo necesitas, es para circunstancias que no podes controlar, como por ejemplo que estas leyendo de un socket y se corte la coneccion o algo asi, no que un parámetro no te gusto como venia.

ejemplo claro en el código:

esta persona esparció todo el modulo de manejo de contactos con estas preciosas excepciones, por ejemplo, si queres borrar un grupo que no existe EXCEPCION, si queres mover un usuario a un grupo que no existe EXCEPCION, si queres borrar un usuario que no existe EXCEPCION, y un millón mas.

vamos a analizar estas situaciones desde la perspectiva de un programador en C que no tiene excepciones, esta "pobre persona carente de una herramienta tan valiosa" diría:

- queres borrar un grupo que no existe? ok, no lo borro, si total no existe
- queres mover un usuario a un grupo que no existe? ok, no lo muevo

y así, si es ya un supremo guru de la programación le dará un mensaje de error al usuario y un debug por ahí para que el desarrollador se fije si no es su culpa.

2) si vas a lanzar una excepcion usa try catch!

lanzar excepciones es complemento de atraparlas, si tenes una retorcida adicción a lanzar excepciones haceme el favor de atraparlas, y si la vas a atrapar hace algo útil, no vale atraparla y no hacer nada, porque te apuesto $5 que es nada que hiciste causa una excepción 5 lineas mas abajo, tampoco vale atrapar la excepción mas genérica, o hacer una especie de:


try:
correrPrograma()
except Exception, ex:
print 'algo paso: ' + str( ex )


porque con eso no hacemos nada...

3) las excepciones no atrapadas cierran el programa, y eso para el usuario final es "tu programa se me colgó":

eso es malo, mientras vos decís "yo hice lo políticamente correcto, si vos ingresas una cantidad que no es un numero lanzo una CantidadFormatException", y ahí esta el problema, la solución no es una excepción, es un mensaje de error o un valor por defecto..

tenia mas números en mente pero ya me cansé, voy a commitear la versión del modulo sin excepciones.. :D

PD: para el desarrollador que hizo eso, no se sienta ofendido, solo considere mis anotaciones :D

lunes, julio 16, 2007

2^7 posts


import gobject
import thread

class Function( object ):
'''a class that represent a function that will run
on a thread and call a callback with the return value'''

def __init__( self, function, callback ):
self.function = function
self.callback = callback
self.queue = Queue.Queue( 0 )

def __call__( self, *args ):
'''when the object is called we start a thread
with the function and parameters and start the
check function that check every 0.2 seconds if
the thread has ended (there is something in the
queue), then call the callback with the result'''

thread.start_new_thread( self._function, args )
gobject.timeout_add( 200 , self.check )

def _function( self, *args ):
'''our function call the parameter function
with the args and put the return value in the
queue'''

self.queue.put( self.function( *args ) )

def check( self ):
'''check there is something in the queue
that means that self.function has ended
then call the callback with the result'''

try:
result = self.queue.get( True, 0.01 )
self.callback( result )
return False
except Queue.Empty:
return True

if __name__ == '__main__':
import time

def funcion(a,b):
time.sleep(5)
return a+b

def callback( suma ):
print suma

f = Function( funcion, callback )
f( 2,3 )
import gtk
gtk.main()


una clase que escribi que basicamente permite hacer que una clase se comporte como una funcion, con el adicional de que corre la funcion en un thread aparte y al terminar llama a la funcion callback pasandole el return como parametro.

util para funciones que demoran mucho para evitar bloquear otras cosas (como el refresco de la interfaz grafica)

si no contamos los comentarios esa clase debe tener 15 lineas, pero el resultado es que nos olvidamos de los threads :)

sábado, julio 14, 2007

its evolution baby

un episodio de evolución acelerada fue detectado en un sapo gigante australiano, que en sólo 70 años ha desarrollado patas más grandes para poder colonizar territorio virgen. Además, sus propios cambios propiciaron una modificación en las mandíbulas de las serpientes del país para que estos sapos pudieran servirle de alimento.

(por si no lo notaron, el titulo es una cancion de perl jam)

Ayreon - Day Eighteen: Realization



pedaso de cancion, no hay nada mas que decir.

viernes, julio 13, 2007

Heaven and hell

Heaven is where the Police are British, the Chefs are French, the Mechanics are German, the Lovers Italian and it's all organised by the Swiss.
Hell is where the Chefs are British, the mechanics are French, the lovers are Swiss, the Police are German and it's all organised by the Italians

como se nota que no conocen a los argentinos... :D

sábado, julio 07, 2007

maldita autocomplesion

El usuario intenta entrar a panoramio.com.
Se dirige a la barra de direcciones con la intención de lograr su objetivo e ingresa la letra p,
firefox gentilmente sugiere el sitio panfletoufa.blogspot.com
el (perturbado?) usuario lee panflauta.blogspot.com

es para preocuparme?

miércoles, julio 04, 2007

AttributeError

you will never understand:
me ense#abas GTK?
mariano guerra:
en un pasado remoto?
you will never understand:
AutoMessage: -vuelvo mas tarde -
puede ser condicional
si lo miras de entre ojos
mariano guerra:
de reojo se parece una ventana de emesene
you will never understand:
desde aca parece de gaim
*se vende*
mariano guerra:
*le da una puñalada en su inexistente alma*
you will never understand:
la pu#alada se la vas a tener que dar a los de gaim
por que se las vendi a ellos
mariano guerra:
vendiste mi alma?
el le y el su son reflexivos
you will never understand:
si, ala bart
mariano guerra:
maldita ambiguedad castellana
you will never understand:
no, esta bie
n*
estas hablando en tercera persona
mariano guerra:
en python seria algo asi como self.givePuñalada( self.getSoul() )
you will never understand:
claro
mariano guerra:
AttributeError: 'Human' object has no attribute 'soul'
you will never understand:
en php seria algo como
$pu#alada = $this->pu#alada
$this->addPu#alada($pu#alada)
no, flashie cualquiera
mariano guerra:
tu php es lamentable
you will never understand:
me marié
no, dejame pensarlo
$this->givePu#alada($this->soul)
pero yo lo queria hacer mas chiflado
mariano guerra:
mariano@war:~/proyectos/emesene$ echo "voy" $(echo "74-53" | bc ) "paginas y me faltan" $( echo "91-74" |bc ) "paginas para terminar"
voy 21 paginas y me faltan 17 paginas para terminar

martes, junio 19, 2007

y yo pense que eramos los unicos


como siempre chateo en el emesene con el debug prendido para ver posibles bugs en la implementacion del protocolo (principalmente MsnP2P), resulta que un contacto me estaba tirando un monton de paquetes P2P seguidos que no tenian sentido, copio algunos para leerlos y veo esto:


<<< MSG lukas.utc@jagermail.com [3^(1/2)_utc]%20(C)%20con%20RosieCoco 465
MIME-Version: 1.0
Content-Type: application/x-msnmsgrp2p
P2P-Dest: luismarianoguerra@gmail.com

\x00\x00\x00\x00-\xd0\x9f\x00\x00\x00\x00\x00\x00\x00\x00\x009\x01\x00\x00\x00\x00\x00\x009\x01\x00\x00\x00\x00\x00\x00\xfb\x91\x15\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00BYE MSNMSGR:lukas.utc@jagermail.com MSNSLP/1.0
To: <msnmsgr:lukas.utc@jagermail.com>
From: <msnmsgr:lukas.utc@jagermail.com>
Via: MSNSLP/1.0/TLP ;branch={621E96CE-2B17-4DEB-81FA-1670D27565EF}
CSeq: 0
Call-ID: {20CC3166-8288-656E-5EAC-A58212008222}
Max-Forwards: 0
Content-Type: null
Content-Length: 0

\x00\x00\x00\x00


me da curiosidad saber que cliente esta mandando esa calamidad, resulta que es el cliente oficial! WLM 8.1.0178.00.

para los que no leen MsnP2P de corrido :D la cosa es como sigue:
* su cliente me pide que le mande mi Display picture a traves de coneccion directa (Sockets)
* como no lo tenemos implementado, se lo rechazo
* entonces me manda ese mensaje que pegue ahi arriba

que esta mal?

To: <msnmsgr:lukas.utc@jagermail.com>
From: <msnmsgr:lukas.utc@jagermail.com>

eso quiere decir que el mensaje es de el para el mismo (???) para que me lo manda a mi entonces...

Content-Type: null

ayy, acuerdense de hacerle new a los Strings.. sino te sale un null por cualquier lado :D

eso es todo, me parecio gracioso que por la versioin 8.1 de un protocolo definido por ellos no vean esas cosas (debe ser que no chatean con el debug prendido :D)

sábado, junio 16, 2007

lectura interesante

estaba leyendo esto: http://dirtsimple.org/2004/12/python-is-not-java.html
mu interesante, voy a resaltar algunas partes..

In examining the code, I found that they had done lots of things that make sense in Java, but which suck terribly in Python. Not because "Python is slower than Java", but because there are easier ways to accomplish the same goals in Python, that wouldn't even be possible in Java.

these poor folks worked much, much harder than they needed to, in order to produce much more code than they needed to write

The idiomatic translation of a Java static method is usually a module-level function, not a classmethod or staticmethod.

and all those Foo.Bar.Baz attribute chains don't come for free, either. In Java, those dotted names are looked up by the compiler, so at runtime it really doesn't matter how many of them you have. In Python, the lookups occur at runtime, so each dot counts. (Remember that in Python, "Flat is better than nested", although it's more related to "Readability counts" and "Simple is better than complex," than to being about performance.)

Got a switch statement? The Python translation is a hash table, not a bunch of if-then statments

The CPython dictionary implementation uses one of the most highly-tuned hashtable implementations in the known universe.

XML is not the answer. It is not even the question. To paraphrase Jamie Zawinski on regular expressions, "Some people, when confronted with a problem, think "I know, I'll use XML." Now they have two problems."

compared to Java code, XML is agile and flexible. Compared to Python code, XML is a boat anchor, a ball and chain. In Python, XML is something you use for interoperability, not your core functionality

There are also other, very rare, architectural reasons to need XML. Trust me, they don't apply to your app. If in doubt, explain your use case for XML to an experienced Python developer. Or, if you have a thick skin and don't mind being laughed at, try explaining to a Lisp programmer why your application needs XML!

Getters and setters are evil. Evil, evil, I say! Python objects are not Java beans. Do not write getters and setters. This is what the 'property' built-in is for. And do not take that to mean that you should write getters and setters, and then wrap them in 'property'. That means that until you prove that you need anything more than a simple attribute access, don't write getters and setters. They are a waste of CPU time, but more important, they are a waste of programmer time. Not just for the people writing the code and tests, but for the people who have to read and understand them as well.

admito que desde que programo en python tengo la costumbre de programar setters y getters, me parece que la costumbre va a cambiar.. :D

In Java, you have to use getters and setters because using public fields gives you no opportunity to go back and change your mind later to using getters and setters.

In Python, this is silly, because you can start with a normal attribute and change your mind at any time, without affecting any clients of the class. So, don't write getters and setters.

Buen punto :D

If you find yourself writing the same function over and over again with minor variations, it's time to learn about closures. They're really not that scary.

no, no son para nada "scary"

Essentially, if you've been using Java for a while and are new to Python, do not trust your instincts. Your instincts are tuned to Java, not Python. Take a step back, and above all, stop writing so much code.

lunes, junio 04, 2007

tanta poesia en la internes

(ante un post que no viene al caso se produce el siguiente comentario)

[quote]
eso fue tan empalagoso que no te puedo putear



bah, si, puto
[/quote]

tanta poesia.. tan pocas palabras

martes, mayo 29, 2007

Mes movido

* fui a buenos aires
* rendi el Zertificat Deutsch
* caminamos mucho por buenos aires
* aprobamos el Zertificat Deutsch
* volvi
* participe del jidis como expositor de un poster
* hable con uno de los diseñadores de la maquina virtual de .NET (le explique que era emesene en ingles :D)
* me fui de nuevo a bs as a una entrevista de la beca
* volvi
* participe como disertante en el cneisi y dicte un curso
* volvi a cursar aleman
* ME DIJERON QUE ME VOY A ALEMANIA!

lo mas importante de todo son las fotos.
aca van










jueves, mayo 03, 2007

A veces...

... no escucho bandas como Pink Floyd muy seguido por miedo a que me canse de escuchar semejante perfección, hoy no es el día.

  • Goodbye blue sky
  • The great gig in the sky
  • Hey you
  • On the run
  • Wish you were here

miércoles, mayo 02, 2007

Humor unico

Your momma's so fat, I had to integrate her by parts.

srjames: my girlfriend called asked me to come over, i told her i was setting up freebsd
srjames: she thought i was doing drugs

Your mom is so fat she sat on a binary tree and turned it into a linked list in constant time!

1 bottle of beer on the wall, 1 bottle of beer, you take 1 down, pass it around, 0 bottles of beer on the wall.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.

<@LukeB> I haven't even bothered downloading Second Life
<@LukeB> I figure I should get a first one before starting a second

jueves, abril 26, 2007

propiedad intelectual

[...]
El hecho de que la exagerada duración del derecho de autor propuesta por
su organización sea responsable de que grupos de admiradores de James
Joyce no puedan aún leer sus escritos cuando lo celebran no parece
merecer la atención de la OMPI, y tampoco la realidad de que esa misma
duración sea la causa de que no hayan entrado nuevas obras al dominio
público por casi un siglo, condenando a miles de ellas a desaparecer
para siempre, ya que no se las puede preservar (copiar o digitalizar)
sin violar el derecho de autores imposibles de contactar.

Su elogio de las patentes pasa por alto el destino de los millones de
personas que padecen de enfermedades tratables, pero que no pueden
acceder a los medicamentos necesarios porque alguna empresa de fármacos
posee un patente que le permite fijar precios arbitrariamente altos y
excluir toda competencia.

También parece ignorar que las patentes aplicadas a la medicina, a la
genética, a la informática, a las matemáticas y a otras disciplinas las
ha convertido en campos minados, en los que áreas completas del
conocimiento no pueden ser exploradas sin antes obtener permiso de sus
"dueños", o que el patentamiento de secuencias genéticas en seres vivos
ha permitido a semilleras como Monsanto exigir la destrucción de la
cosecha de agricultores cuyos cultivos habían sido contaminados con
genes patentados, aún cuando la contaminación se había producido por
negligencia de la propia semillera.
[...]

Copyright 2007 Fundación Vía Libre
La reproducción y distribución literal de este artículo completo o
alguna de sus partes están permitidas, sin regalías y en cualquier
medio, siempre y cuando se preserve este aviso. ¡La redistribución es
bienvenida!

viernes, abril 20, 2007

fotocarnet/alterego/identidad secreta


el mejor capitulo sin duda es Pre-Hibernation que cuenta con la banda sonora realizada por pantera, aca esta la letra:

Jellyfishing!
Jellyfishing!
Jellyfishing!
Jellyfishing!

Pre-Hibernation Week: Sandy is going wild over the fact that she will have to hibernate in a week. She goes crazy and takes SpongeBob on a wild adventure doing psycho events to have a lot of fun and burn carbs in a little bit of time.

martes, abril 17, 2007

stealing content

me parecion interesante la lectura asi que se lo copie.

La Dra. Laura Schlessinger es una conocida locutora de radio de los Estados Unidos que tiene un programa en el que da consejos en directo a los oyentes que llaman por teléfono. Recientemente saltó la polémica (y más cuando se mezclan temas de religión y homosexualidad, donde cada persona interpreta lo que dice Dios y la Biblia de una manera distinta) cuando la presentadora atacó a los homosexuales. Esta locutora ha dicho recientemente que la homosexualidad es una abominación, ya que así lo indica la Biblia en el Levítico, versículos 18:22, y por tanto no puede ser consentida bajo ninguna circunstancia.

Lo que a continuación transcribo es una carta abierta dirigida a la Dra. Laura escrita por un residente en los Estados Unidos, que ha sido hecha pública en Internet (no tiene desperdicio):

Querida Dra. Laura:

Gracias por dedicar tantos esfuerzos a educar a la gente en la Ley de Dios. Yo mismo he aprendido muchísimo de su programa de radio e intento compartir mis conocimientos con todas las personas con las que me es posible. Por ejemplo, cuando alguien intenta defender el estilo de vida homosexual me limito tan sólo a recordarle que el Levítico, en sus versículos 18:22, establece claramente que la homosexualidad es una abominación. Punto final.

De todas formas, necesito algún consejo adicional de su parte respecto a algunas otras leyes bíblicas en concreto y cómo cumplirlas:

a) Me gustaría vender a mi hermana como esclava, tal y como indica el Éxodo, 21:7. En los tiempos que vivimos, ¿Qué precio piensa que sería el más adecuado?

b) El Levítico, 25:44, establece que puedo poseer esclavos, tanto varones como hembras, mientras sean adquiridos en naciones vecinas. Un amigo mío asegura que esto es aplicable a los mejicanos, pero no a los canadienses. Me podría aclarar este punto? ¿Por qué no puedo poseer canadienses?.

c) Sé que no estoy autorizado a tener contacto con ninguna mujer mientras esté en su período de impureza menstrual (Lev 5:19-24). El problema que se me plantea es el siguiente: ¿cómo puedo saber si lo están o no? He intentado preguntarlo, pero bastantes mujeres se sienten ofendidas.

d) Tengo un vecino que insiste en trabajar en el sábado. El Éxodo 35:2, claramente establece que ha de recibir la pena de muerte.¿Estoy moralmente obligado a matarlo yo mismo? ¿Me podría apañar usted este tema de alguna manera?

e) En el Levítico 21:20, se establece que uno no puede acercarse al altar de Dios si tiene un defecto en la vista. He de confesar que necesito gafas para leer. ¿Mi agudeza visual tiene que ser del 100%? ¿Se puede relajar un poco esta condición?

f) La mayoría de mis amigos (varones) llevan el pelo arreglado y bien cortado, incluso en la zona de las sienes a pesar de que esto está expresamente prohibido por el levítico, 19:27. ¿Cómo han de morir?

g) Sé gracias al Levítico, 11:6-8, que tocar la piel de un cerdo muerto me convierte en impuro. Aún así, ¿Puedo continuar jugando al fútbol si me pongo guantes?

h) Mi tío tiene una granja. Incumple lo que se dice en el Levítico 19:19, ya que planta dos cultivos distintos en el mismo campo, y también lo incumple su mujer, ya que lleva prendas hechas de dos tipos de tejido diferentes (algodón y poliéster). Él, además, se pasa el día maldiciendo y blasfemando. ¿Es realmente necesario llevar a cabo el engorroso procedimiento de reunir a todos los habitantes del pueblo para lapidarlos? Lev 24:10-16).

¿No podríamos sencillamente quemarlos vivos en una reunión familiar privada, como se hace con la gente que duerme con sus parientes políticos? (Lev 20:14).

Sé que usted ha estudiado estos asuntos con gran profundidad, así que confío plenamente en su ayuda. Gracias de nuevo por recordarnos que la palabra de Dios es eterna e inmutable.

viernes, abril 06, 2007

los programadores son divinos

desinstalando un soft que descubri que era trial, me encuentro con este lindo mensaje:

los programadores esos no tuvieron la dignidad de evitar eso?
al menos jugala callada y deja que le echen la culpa a windows :)

triste...

viernes, marzo 30, 2007

python + dcop + amarok


import os
import pydcop

s = os.system( "ps aux|grep dcopserver|grep -v grep" )

if s == 0:
print "dcop running"

if "amarok" in pydcop.apps():
print "amarok is running"
amarok = pydcop.DCOPApplication( "amarok" )
if amarok.player.isPlaying():
print "amarok is playing"
print amarok.player.artist()
else:
print "amarok is not playing"
else:
print "amarok is not running"

else:
print "dcop not running"


no se porque no lo hice antes...

Seguidores

Archivo del Blog