So I set out to learn a bit of Iphone programming, still going on..
first project I got serous was a "dots game"
here it is
source code is here
I'm in no way a game programmer, and am just learning, there is lots of spaguetti code in there, and I'd love to see improvements on this, the "right" way to do things, this was just a challenge for me to learn how to solve a problem ( the data structure and math on this was really fun to solve).
if you do improve on this comment on it so I an see how it's supposed to be done.
Thursday, December 16, 2010
Sunday, November 15, 2009
Venezuela en el exilio
Me mandaron esto, y estando fuera de venezuela, me parecio propio leerlo con calma.
Tiene algunos puntos muy ciertos que comparto.. otros que no.
Yo me muero de ganas de volver a Venezuela, pero otra Venezuela que no existe ya.
Si les da ladilla leerlo completo, por lo menos lean esto, que es lo que mas comparto del articulo
Pero la cosa que no le perdonaré nunca a Venezuela es que me enseñó a tener miedo. Miedo de salir a la calle de noche, de ir caminando a comprar cualquier cosa. Miedo de reprender a dos ladrones que roban a una muchacha a plena luz del día. Miedo a volver todas las noches de la universidad a mi casa porque, entrando, podrían secuestrarme o asesinarme para llevarse el auto.
es lo mas jodido de todo...
A lo mejor algunos no lo comparten, solo me parecio interesante.
Tiene algunos puntos muy ciertos que comparto.. otros que no.
Yo me muero de ganas de volver a Venezuela, pero otra Venezuela que no existe ya.
Si les da ladilla leerlo completo, por lo menos lean esto, que es lo que mas comparto del articulo
Pero la cosa que no le perdonaré nunca a Venezuela es que me enseñó a tener miedo. Miedo de salir a la calle de noche, de ir caminando a comprar cualquier cosa. Miedo de reprender a dos ladrones que roban a una muchacha a plena luz del día. Miedo a volver todas las noches de la universidad a mi casa porque, entrando, podrían secuestrarme o asesinarme para llevarse el auto.
es lo mas jodido de todo...
Viví en Caracas durante dieciséis años.
Caí preso en las marchas estudiantiles del año 2007 a favor de la libertad de expresión, fui víctima de un secuestro express y meses después víctima de treinta motorizados, los cuales, además de darme una golpiza, destruyeron mi auto. Después de estos hechos desconcertantes, decidí tomar un avión sin boleto de regreso.
Ahora trabajo en un bar en un lugar perdido de Europa, día a día, sin descanso.. La gente que pasa me pregunta si extraño a mi país y si algún día volveré. A todos les respondo que no, que nunca más. Ante esta dura afirmación, muchos se entristecen y me dicen que soy d emasiado joven para sentenciar tal cosa. Tomando el consejo que me dan, intento despistar mi adversidad y me pregunto: "¿amo a mi país?". La única respuesta es un "¿Por qué debería?". Retomo apuntes mentales y me pongo a pensar en mi infancia y mi adolescencia, en los hechos de mi vida allá y me doy cuenta de que no, de que no lo extraño en lo más mínimo y no volvería con o sin el actual gobierno.
¿Por qué?
Mi país me enseñó que quien trabaja, sueña y se esfuerza, termina mal: la idiosincracia del venezolano está basada en la picardía. Es alabado aquel que se comporta como un oportunista y el honrado que se esfuerza, es descaradamente rechazado. Mi país me enseñó que la vida de ningún hombre vale nada: en las calles matan un centenar de personas, en el este y el oeste de la capital, con toda impunidad, sin estar en guerra, sin justificaciones razonables. Mi país me puso una pistola tres veces en la cabeza y tres veces tuve la certeza de que moriría, entregándome a ella, sintiéndome en el absurdo de que moriría como un perro porque así morimos los venezolanos. Mi país me enseñó que es peligroso tener un automóvil propio, vestirse bien o hablar educadamente, con un acento diferente: cualquier excusa es buena para robarte o secuestrarte o matarte..
Soy el hijo de un italiano y una venezolana de izquierda. Me enseñaron valores socialistas desde pequeño. Más que catalogarlos en una ideología, debería llamarlos "humanos". Valores congruentes al humanismo, como que todos deberíamos tener las mismas oportunidades, los mismos derechos. Como que todos deberíamos tener la posibilidad de reformar, porque no es culpa del individuo sino del sistema que está podrido. Mis padres me enseñaron que no todos somos iguales pero todos, de donde sea que vengamos, cual sea nuestra educación, valemos lo mismo y eso debe respetarse para poder vivir en armonía y progresar. Eso me enseñaron en casa pero mi país me hizo racista y clasista, al punto de que veía un negro mal vestido y con jerga callejera y le tenía miedo, desconfianza.. Por lo mismo que parte de la idiosincracia venezolana, me hizo sentir que todo aquel que era pobre, era un posible criminal.
Trabajando como mesonero en Europa gano como debería ganar un profesor allá (no como gana). Y no tanto lo que gano sino el poder adquisitivo que existe: un sueldo mínimo me ayuda a vivir en una habitación con servicios pagos y comer bien durante un mes, cosa que allá sería imposible haciendo el mismo trabajo. Un estudiante de clase media aquí tiene una vida digna, con un transporte público que se conecta con toda la ciudad, precios favorables en ropa, comida y materiales de estudio. Cosas tan precisas para el bienestar del Hombre, en mi país ya ni siquiera se ponen en duda. Es impresionante.
Una clase social dividida en extraños estratos: la pobre, que vive en los barrios; la media, que va en extinción y gasta dinero en cosas desproporcionadas e inecesarias, como ir a lugares de moda a no hacer nada; la rica, que sobrevive a los ataques actuales del comunismo; y la nueva rica, que acelera su crecimiento por parte de los dirigentes del gobierno. Se han perdido valores necesarios, como leer un buen libro, viajar por conocer, luchar porque las cosas cambien. Por eso no tenemos ni tendremos nunca un Nobel escritor. No tenemos bases suficientes a nivel educativo ni de valor humano.
Pero la cosa que no le perdonaré nunca a Venezuela es que me enseñó a tener miedo. Miedo de salir a la calle de noche, de ir caminando a comprar cualquier cosa. Miedo de reprender a dos ladrones que roban a una muchacha a plena luz del día. Miedo a volver todas las noches de la universidad a mi casa porque, entrando, podrían secuestrarme o asesinarme para llevarse el auto.
Todo ese miedo que me enseñó mi país, lo convertí en rabia. Una rabia amarga e insoportable que me hace no querer volver nunca más. Una rabia donde metí mis militancias políticas donde creía que un mundo mejor era posible, donde guardé mis sueños de vivir de playa y ciudad a veinte minutos de distancia, donde dejé solo el cariño hacia mis conciudadanos. Una rabia que me hizo cínico ante cualquier idealismo joven e inocente. Un cinismo que me rompió la imagen del Che (menos mal ), me rompió el sentido de las canciones de Lennon, las de Silvio Rodríguez, las de la Primavera de Praga, las de las fuerzas Aliadas haciendo Jaque Mate a Hitler, el valor de las Madres de Plaza de Mayo, el rostro de Rómulo Betancourt llevándonos a la democratización, el sentido de mi amado Bolívar y rompió la fuerza de Francisco de Miranda y las ideas del Ilustrismo. Mi país acabó con cualquier decencia, con cualquier pedazo bueno que tiene la juventud, ocasionando un vacío ridículo y un cinismo aún mucho más grande.
Estoy seguro que las cosas allá no cambiarán ahora ni nunca. Estaban mal antes de este gobierno. Empeoraron pero ahora se enfocan por echar culpas y no por resolver. Después de esto (suponiendo que exista un después), habrá cada vez más caos. Nuestra juventud parte del principio de la picardía y muchos intentan buscar dinero y protagonismos. Ninguno tiene bolas para dejar la piel en el asfalto porque ninguno realmente quiere una República. Nuestra educación nos inyectó una vida demasiado relajada y leve, donde los valores de pureza, honor y verdad, están menospreciados. Por eso nuestros militares reciben dinero sin reclamar desde sus puestos de guardia. Por eso cierran radios y atentan contra la libertad de expresión sin nadie que haga ni diga nada realmente significativo. La culpa no está en ese ignorante que nos comanda sino en las bases que parten de un mal principio de nuestra equivocada sociedad.
Nada de esto lo digo para crear un debate ni para intentar que me cambien la visión. No lo digo para que me cataloguen en una izquierda o en una derecha. Lo digo como alguien que ahora es externo y que no le interesa en lo más mínimo lo que ocurra. Dejé que me interesara hace tiempo, sin quererlo.
Entonces no, no extraño ni extrañaré nunca aquel caos injusto de donde vengo.
A lo mejor algunos no lo comparten, solo me parecio interesante.
Thursday, February 19, 2009

Ok, pues he aqui un clientico twitter minimalista!
Una consola, con las funcionalidades basicas de twitter, con notificaciones en growl.
los requerimientos son simples
python con los modulos
twitter api Aqui
y el modulo de growl, lo pueden conseguir en la pagina de growl GROWL
Se debe instalar y verificar la configuracion de growl en system preferences. y aparte en los extras, instalar el binding de python.
LInk de git y sourceforge vienen pronto

Minimalist Twitter client
Console, growl notifications,, basic functionality
Simple requirements
python with a few modules
twitter api Here
Growl bindings for pythonGROWL
Install and configure growl, and install python bindings from extras.
Git site
Tuesday, November 4, 2008
Wednesday, April 2, 2008
open ssl crypto library sample code
Recently I had the need to code some crypto stuff on C ( doing my undergrad thesis), so i set off to find a good library, went through a few of them , but they all had the same thing in common : hard to read documentation, and almost no sample code to view ( the little sample code that there was, was very badly commented).
Context : initial state of cipher, since these functions are interfaces to lower lvl functions, you have to initiate a context in order to tell the libraries what to do.
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl):
this function does 99% of the encryption, basically since bf is a block cipher there is padding at the end of a non-aligned block, so this will encrypt in, and put it in out, the quantity of bytes encripted ( written in out) will be placed in outl. Now it will encrypt inl number of bytes from in, but it will not encrypt the last bytes that don't fill up a whole block. For instance, lets say the block size is 8, and you have to encrypt 22 , the function is called like this : EVP_EncryptUpdate(ctx,out,outl,in,22)
it will actually encrypt 16 bytes ( 2 blocks) and leave a 6 byte block behind, outl will have 16 in it. How do you encript the last block ( which by the way has to be padded) :
EVP_EncryptFinal_ex(ctx,out+outl,tmpcounter);
this is just : encrypt last block with ctx, you will put it in out buffer but at outl offset ( so not to overwrite previous decryption, and the new quantity of bytes encrypted is tmpcounter.
At last outl + tmpcounter have the total bytes encripted, and out has the crypted text.
decription is the same but done backwards.
Hope this helps, leave a comment if it did, or leave it anyway.
This is how I understood it, if there is somekind of error in my explanation, please msg me so i ll correct it.
Some sample code I made ( adapted from link above) here.
Main functions :
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
creates the context.
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
ENGINE *impl, unsigned char *key, unsigned char *iv);
EVP_EncryptInit_ex() sets up cipher context ctx for encryption with cipher type from ENGINE impl. ctx must be initialized before calling this function. type is normally supplied by a function such as EVP_des_cbc(). If impl is NULL then the default implementation is used. key is the symmetric key to use and iv is the IV to use (if necessary), the actual number of bytes used for the key and IV depends on the cipher. It is possible to set all parameters to NULL except type in an initial call and supply the remaining parameters in subsequent calls, all of which have type set to NULL. This is done when the default cipher parameters are not appropriate.
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl);
EVP_EncryptUpdate() encrypts inl bytes from the buffer in and writes the encrypted version to out. This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the encrypted data: as a result the amount of data written may be anything from zero bytes to (inl + cipher_block_size - 1) so outl should contain sufficient room. The actual number of bytes written is placed in outl.
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl);
If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts the ``final'' data, that is any data that remains in a partial block. It uses standard block padding (aka PKCS padding). The encrypted final data is written to out which should have sufficient space for one cipher block. The number of bytes written is placed in outl. After this function is called the encryption operation is finished and no further calls to EVP_EncryptUpdate() should be made.
If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more data and it will return an error if any data remains in a partial block: that is if the total data length is not a multiple of the block size.
(source).
After about 6 days I finally understood how to use openssl s crypto library to encrypt and decrypt using blowfish algorithm, so I though i d open this blog and put it out there.... maybe i ll save someone some time.
Background info on blowfish : symmetric cipher, 8 byte block size ( 64bits), usually with a 128bit key.
i ll first explain how it works, then paste the documentation which I reordered to get a better view, as I found it very confusing the way it was explained in the oficial site ( maybe its just me).
i ll first explain how it works, then paste the documentation which I reordered to get a better view, as I found it very confusing the way it was explained in the oficial site ( maybe its just me).
Context : initial state of cipher, since these functions are interfaces to lower lvl functions, you have to initiate a context in order to tell the libraries what to do.
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl):
this function does 99% of the encryption, basically since bf is a block cipher there is padding at the end of a non-aligned block, so this will encrypt in, and put it in out, the quantity of bytes encripted ( written in out) will be placed in outl. Now it will encrypt inl number of bytes from in, but it will not encrypt the last bytes that don't fill up a whole block. For instance, lets say the block size is 8, and you have to encrypt 22 , the function is called like this : EVP_EncryptUpdate(ctx,out,outl,in,22)
it will actually encrypt 16 bytes ( 2 blocks) and leave a 6 byte block behind, outl will have 16 in it. How do you encript the last block ( which by the way has to be padded) :
EVP_EncryptFinal_ex(ctx,out+outl,tmpcounter);
this is just : encrypt last block with ctx, you will put it in out buffer but at outl offset ( so not to overwrite previous decryption, and the new quantity of bytes encrypted is tmpcounter.
At last outl + tmpcounter have the total bytes encripted, and out has the crypted text.
decription is the same but done backwards.
Hope this helps, leave a comment if it did, or leave it anyway.
This is how I understood it, if there is somekind of error in my explanation, please msg me so i ll correct it.
Some sample code I made ( adapted from link above) here.
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
creates the context.
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
ENGINE *impl, unsigned char *key, unsigned char *iv);
EVP_EncryptInit_ex() sets up cipher context ctx for encryption with cipher type from ENGINE impl. ctx must be initialized before calling this function. type is normally supplied by a function such as EVP_des_cbc(). If impl is NULL then the default implementation is used. key is the symmetric key to use and iv is the IV to use (if necessary), the actual number of bytes used for the key and IV depends on the cipher. It is possible to set all parameters to NULL except type in an initial call and supply the remaining parameters in subsequent calls, all of which have type set to NULL. This is done when the default cipher parameters are not appropriate.
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl, unsigned char *in, int inl);
EVP_EncryptUpdate() encrypts inl bytes from the buffer in and writes the encrypted version to out. This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the encrypted data: as a result the amount of data written may be anything from zero bytes to (inl + cipher_block_size - 1) so outl should contain sufficient room. The actual number of bytes written is placed in outl.
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
int *outl);
If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts the ``final'' data, that is any data that remains in a partial block. It uses standard block padding (aka PKCS padding). The encrypted final data is written to out which should have sufficient space for one cipher block. The number of bytes written is placed in outl. After this function is called the encryption operation is finished and no further calls to EVP_EncryptUpdate() should be made.
If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more data and it will return an error if any data remains in a partial block: that is if the total data length is not a multiple of the block size.
(source).
Subscribe to:
Posts (Atom)
