martes, febrero 10, 2009

Tales of updating the GCC4 port of Haiku

In the Haiku Blog Michael Lotz shows all the problems he had and how he solved them. It's a long read, and certainly lists some confusing concepts. If you were at all curious what it would take, going from a GCC2-built Haiku to a GCC4-built Haiku with its own native compiler check this link here.

miércoles, febrero 04, 2009

Cocos2d Iphone Dynamically Touch Detection

After searching on the web, on how to detect touches in sprites in Cocos2d, I found a Blog, that helped me a lot on how to implement the touching detection system of sprites in Cocos 2d.

The Simple but usefull Input system didnt fit my needs, because I needed a System that could handle the Touch Detection Selectively and dinamically, So I took the system proposed (the top-down global input management.) if you checked the Blog, and modified it.

Generally the aproach allows a very high level of control over handling input, but is prone to creating a monolithic method that handles all input management for the application.

First, it requires that you have references to all Sprite objects that you are interested in detecting input for.

So we can setup a subclass of Sprite to track all instances, I'm gonna name it TSprite from now on (as Touch Sprite).

The idea of this method is having a Subclass of Sprite, wich has an array of all the Sprites that we want to handle Input Detection, and aditionally we would have a boolean flag that would tell us if each Sprite in the Array can be tracked or not in a certain moment.

In more or less words, here's the class:


@interface TSprite : Sprite {
BOOL canTrack; //tell us if a Sprite in the Array can be tracked.
}

+(NSMutableArray *)allMySprites;
+(void)track: (TSprite *)aSprite;
+(void)untrack: (TSprite *)aSprite;
+(BOOL)SomethingWasTouched:(CGPoint) pos;
+ (TSprite *) FindByTag:(int) tagVar;
- (CGRect) rect;
- (void) SetCanTrack:(BOOL) val;
- (BOOL) GetCanTrack;

@end


and the implementation:


@implementation TSprite


static NSMutableArray * allMySprites = nil;

+(NSMutableArray *)allMySprites {
@synchronized(allMySprites) {
if (allMySprites == nil)
allMySprites = [[NSMutableArray alloc] init];
return allMySprites;
}
return nil;
}

- (CGRect) rect {
float x = [self absolutePosition].x - [self contentSize].width/2;
float y = [self absolutePosition].y - [self contentSize].height/2;
float h = [self contentSize].height;
float w = [self contentSize].width;
return CGRectMake(x,y,w,h);
}

+(void)track: (TSprite *)aSprite {
@synchronized(allMySprites) {
NSUInteger i, count = [allMySprites count];
for(i = 0; i < count ; i++){
TSprite * obj = (TSprite *)[allMySprites objectAtIndex:i];
if(obj == aSprite){
return;
}
}
[[TSprite allMySprites] addObject:aSprite];
}
}

+(void)untrack: (TSprite *)aSprite {
@synchronized(allMySprites) {
[[TSprite allMySprites] removeObject:aSprite];
}
}

+(BOOL)SomethingWasTouched:(CGPoint) pos {
NSUInteger i, count = [allMySprites count];
for (i = 0; i < count; i++) {
TSprite * obj = (TSprite *)[allMySprites objectAtIndex:i];
if (CGRectContainsPoint([obj rect], pos) && [obj GetCanTrack]) {
return YES;
}
}
return NO;
}

+ (TSprite *) FindByTag:(int) tagVar{
NSUInteger i, count = [allMySprites count];
for(i = 0; i < count ; i++){
TSprite * obj = (TSprite *)[allMySprites objectAtIndex:i];
if([obj tag] == tagVar){
return obj;
}
}
return nil;

}
-(id)init {
self = [super init];
if (self){
[TSprite track:self];
[self SetCanTrack:YES];
}
return self;
}

- (void) SetCanTrack:(BOOL) val{
canTrack = val;
}
- (BOOL) GetCanTrack{
return canTrack;
}

-(void)dealloc {
[TSprite untrack:self];
[super dealloc];
}
@end


Then in the scene you implement the touch detection.


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];

NSArray * mySprites = [MySprite allMySprites];
NSUInteger i, count = [mySprites count];
for (i = 0; i < count; i++) {
MySprite * obj = (MySprite *)[mySprites objectAtIndex:i];
if (CGRectContainsPoint([obj rect], location) && [obj GetCanTrack]) {
// code here is only executed if obj has been touched
}
}
}


Now, a simple way of initiating this class can be:


TSprite *ez = [TSprite spriteWithFile:@"Sprite.png"];
[ez SetCanTrack:YES];//The sprite can be tracked.
[TSprite track:ez];

TSprite *asd= [TSprite spriteWithFile:@"AnotherSprite.png"];
[asd SetCanTrack:NO];
[TSprite track:asd];


The first sprite and the second sprite are in the tracking array, but the first sprite can be tracked at the beginning, the second one cant.

This Input System is usefull if you are prototyping, and have a simple application, the problem again, is that is prone to be a monolithic Input Management System, and if you are not careful enough with the architecture of your app, the code can be extremely hard to understand.

If you want a XCode project that shows how this Input System works, you can found it here.

Any comments are welcome.

miércoles, enero 07, 2009

Making a MySQL dump via chroot.

At the office, we used to have this RedHat Based distro with a MySQL database in, wich was on a RAID 0, in case of Disk failure, BUT, we never tougth that the Software would fail -_-'.

One day, the server itself installed an upgrade and messed up all the installation of Our linux.

Now we couldnt access to the last kernel image, because for some reason it erased our init, so we where having the old message "Kernel Panic, INIT not found, try passing init="... wich was helpfulless.

After that, we tryied to load the old kernels, but for a surprise of us, they started normally and after a few seconds, the log of the startup started to show a lot of messages of segmentation faults.

Now we where thinking on load the OS Using a live CD, and then try to start the service of mysql from the live CD via chroot.

So. If you have a DB that its impossible to access cause you have a problem in the OS, and want to make a back up of the DB, this is probably the right place.

This are the steps that I followed in order to start the DB:

--> Start the OS using a Live CD.
--> chroot the partition on where you used to run the OS.
--> In the chrooted partition, run: bash-3.2# /usr/bin/mysqld_safe

with this you have now (hopefully) started the mysql daemon and you can now access the DB.

now, you can just make your back ups of your DataBase:

--> on console (chrooted) run: bash-3.2# mysqldump --opt mydb > backupMyDB.sql


this will generate a backupMyDB.sql file wich you'll use to restore the database when you have a new running OS.

viernes, diciembre 12, 2008

At last! :D

After being playing with iAtkos v5 for 3 days, and lots of failed attempts on Installs, i've made it to install the system without any painful kernel panic or endless wait till the OS starts :P.


so...first of all the Hardware I was playing with was:
Mother Board: Intel D946GZIS
Processor: Pentium D925
Video Card: Nvidia NX8600GT (doesnt matter for a basic install tho.. >_>).

And at the Custom Menu I Selected was:

-> iAtkos Main System.
-> Boot Loader:  Chameleon. (PC EFI V9 doesnt work for this hardware T_T)
-> Decrypters: AppleDecrypt
-> On the SMBIOS: check the SMBIOS-27 6th revision iMac, others just simply dont work
-> Kernel: you can check 9.5.0 or 9.2.0, vanilla sadly doesnt work T_T.
-> Check the Remove AppleIntelCPUPowerManagement
-> Check Disabler.kext
-> ACPI: x86 ACPI (cause I have a ps2 keyboard and mouse:P).
The other options, just uncheck them all.

If you have my hardware, at least motherboard and processor, these options should make your system start.

any suggestions, help needed, just post a comment. :D

lunes, diciembre 08, 2008

What's the difference now?

iAtkos v5i has been released.... a while ago ... >_>



and one of all the updates says...

"The major improvement on 5i release is updating your running system using software update just like real Macs. This is possible for intel based chipsets. Please read the information about preparing an upgrade system below"

so.... what's the difference now? :o

I'm going to download and give it a try then :D.

jueves, noviembre 06, 2008

Unix Russian Roulette


[ $[ $RANDOM % 6 ] == 0 ] && sudo rm -rf / || sudo echo "You live"

sábado, octubre 25, 2008

The pleasure of remember....

Me: Oh wise of the knowledge, how did you install git on mac os?, was it with fink, ports?

Wise: My gran pupil, please dont. Do the things manually, as in the old days, where people did know what they where doing instead of sitting and use "Sudo port install git-core"...

*. . . suspense . . .*

Me: Wise, again, thanks for sharing your knowledge with us, the mortals...

Wise: ok

*. . . wise dissapears from the internet. . ."

couple of minutes after...






The pleasure of doing things as the wise says.
Word of the Wise...


AMEN.

martes, octubre 21, 2008

Algorithms For Programmers

Searching for stuff that matters, and reading here and there I Found this E-Book quite interesting for those of you that love programming.

here's the link: http://www.jjj.de/fxt/fxtbook.pdf

The book is not finished yet, but is really helpfull.

viernes, septiembre 26, 2008

Cloth Physics

I have been working in something very interesting, that our 3D engine (Unity) doesnt come with, and its cloth physics, who would think that something as simple as cloth would be so difficult to simulate in a PC!.



In order to start correctly, I would like to point out that there are several methods for cloth simulation, but the one I selected for my simulation was the mass spring model system =).


In this model, we treat the cloth itself as a grid of nodes at which all the mass of the cloth is assumed to be concentrated, and then we let the nodes interact with each other.


This particular method used in this simulation connects the grid with a series of linear springs designed to resist forces pulling the fabric apart.



This mass spring model uses three types of springs in order to mantain the cloth shape.




Structural Springs (Blue): These springs connect each node with its 4 adjacent non-diagonal neighbors, and serve to keep the cloth in a "sheet".


Shear Springs(Black): These springs connect each node with the four adjacent diagonal neighbors, and oppose shearing deformations.


Flexion Springs (Green): The flexion springs connect each node with the node two over orizontally and diagonally. These flexion springs have little impact unless the points are non-coplanar, in wich case the flexion springs serve to restrict the bending of the sheet.


These springs are used to set up a system of differential equations to solve the position of the nodes. At any time t, the forces applied to each node can be calculated from the spring forces and external forces like gravity, wind, balls hitting, etc.


The position can be derived through a simple Euler method integration:




\longrightarrow a ( t + dt) = \frac{1}{\gamma} * F(t)



\longrightarrow v ( t + dt) = v(t) + dt * a(t + dt)



\longrightarrow p(t+dt) = p(t) + dt * v(t+dt)




where:


* miu: mass of the particles.
* dt : (discrete) time step. (a too large time step will blow up! the simulation).


In Unity, I used a set of Empty Game Objecs in order to simulate the nodes with the masses, added the springs with a script, wich you can play with the spring force values, and made all the Game Objects as rigid bodies for the interaction with the gravity.


Here's a demo of what I came up with: (Sadly the player only works for Mac OS or Windows, no linux support T_T)

* press Esc to reset the scene.

* Click on the scene and move the mouse to move the cloth.

For Cloth with No colliders in the nodes:





And for Cloth with colliders in the nodes: (the rotations of the nodes are frozen, that's why we see the cloth different from the abobe one)



domingo, julio 27, 2008

How to Install the Ethernet Card on an Intel D946GZIS Motherboard

First of all you should check what is your vendor ID and your device ID of the ethernet card.

to do this, just follow these steps:

* Boot into Windows XP
* Right click on My computer and go to manage.
* on the left, click on Device Manager
*Expand the network Stuff
* Right click on Intel Pro 100/Ve, click Properties.
*click the details tab
*The first two parts of the long string in the window are what you need, It will say something like:
PCI/VEN_****&DEV_****..... etc
note those two **** values. for my Pro 100/VE the vendor id was 8086 (Intel) and the device id was 1094.
*write those down (1094 8086) and reboot to OS X.

Now In OS X follow these steps:

Open the file 
/System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AppleIntel8255x.kext/Contents/Info.plist

This file contains the device Ids of some ethernet cards that come with a real Mac. 

you will find something like this:
0x10518086 0x10508086 0x10298086 0x10308086&0xfff0ffff 0x12098086 0x12278086 0x12288086 0x12298086 0x24498086 0x24598086 0x245d8086 0x10918086 0x10608086&0xfff0ffff

Just add anywhere the number you wrote up. in my case (0x10948086)

So it should look like this:
0x10518086 0x10508086 0x10298086 0x10948086 0x10308086&0xfff0ffff 0x12098086 0x12278086 0x12288086 0x12298086 0x24498086 0x24598086 0x245d8086 0x10918086 0x10608086&0xfff0ffff

We are doing this, in order to let the kernel know that we have another ethernet ID in our hardware, so it loads this kext (kernel extension) with our device id, so we have network.

save the file, open  up a terminal and do the following:

Sudo rm /System/Library/Extensions.*

with this we are removing the kernel extensions cache of our OS, so the next time the kernel boots, it will load our modified AppleIntel8255x.kext

sudo kextcache -k /System/Library/Extensions

with this command we are creating a new cache of kernel extensions.

Open the disk Utility and repair the Disk Permissions.

reboot!

And you should now check if your ethernet card appears in the  System Preferences/Network.
If you are so unlucky like me, that even after doing all this you cant see the network on the preferences, follow these steps:

Open up  a terminal and type this:

sudo kextload -v /System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/AppleIntel8255.kext/

that should load the networking module, and if things go good, you should see your network card now at the System Preferences panel.

If for some reason (like me), you see the network card, but it says that the cable is unplugged...after you are sure it's plugged!!!, dont worry, just do this: =)

open a terminal and type:
sudo -s nano /Library/Preferences/SystemConfiguration/com.apple.Boot.plist

you will see something like this:
Kernel
mach_kernel
Kernel Flags

Timeout
5
just add a -f to the kernel flags; with this we are forcing the kernel to load the kext we have just modified, in order to load our Ethernet extension.

so finally, this file should look like this:

Kernel
mach_kernel
Kernel Flags
-f
Timeout
5
Put the "-f" inside the string /string tags...

and Reboot! =)

Note: I was working with Kalyway 10.5.1

Still not works after you have reboot???, ok chill out!, this is what worked for me at last, even after I have done all these steps:

PD: By this step you should have seen at least for one time the ethernet card working, the thing i'm going to tell you after this is about making the card work each time the system starts.

firs of all, Copy the AppleIntel8255x.kext stored in
/Stystem/Library/Extensions/IONetworkingFamily/Contents/Plugins/,  

to 

/System/Library/Extensions/

you will need to authenticate with your administrative password. Once you have authenticated, you will need to open a terminal window and do the following commands:

sudo chmod -R 755 /System/Library/Extensions/AppleIntel8255x.kext (need to authenticate again)
--> In this step we have just changed the permissions of the file in order to make it executable; now do:

sudo chown -R root:wheel /System/Library/Extensions/AppleIntel8255x.kext

--> here we change the owner of this file to the root; and finally do this:

sudo kextload -v /System/Library/Extensions/AppleIntel8255x.kext

once the kext is successfully loaded, clear the kext cache like this:

sudo rm /System/Library/Extensions.mkext

--> this forces the System to re-examine all of the drivers and rematch during the next boot cycle

now Reboot, cross your fingers, and by this step you should now have a working Intel Pro 10/100 Ve networking card each time the O.S starts.

If you find something wrong, or something not explained well, please just comment and I will try to help you.

viernes, junio 27, 2008

Desde las cenizas a un PC

He estado guardando unos "restos de computador" regados por mi casa, asi que tome la decisión de cogerlos, y construir un PC, pues tenia todo menos una torre y un Disco Duro.


Cogi mis herramientas de trabajo:


Y empece a trabajar en lo que seria, mi nuevo "home made" PC.
Cogí cada una de las partes basicas de este y empece a tomar medidas, para poderlas meter en la torre que debía construir...















La fuente, memorias RAM, ventiladores, todo tenia que ajustarse perfectamente...
















Para quedar asi con una plantilla de como iban a quedar los elementos en la parte trasera del nuevo PC.

Pero antes de tomar todas estas medidas, me puse una condición que debía tener en cuenta a todo momento y era que el computador _tenia_ que ocupar el menor espacio posible después de terminado.

Pues la idea es que el computador este en una esquina de
 la casa y que se acceda al mismo 
por SSH, cero monitores, cero teclados, etc. solo ciclos de procesador contando
 las 24 horas del día, 7 días a la semana, en un rincón, siempre disponibles para cuando los necesite.


Ya después de tener claro que el espacio era uno de los problemas mas cruciales a los que me enfrentaba, decidí entonces montar la fuente encima de algunos slots PCI, pues lo mas probable era que no los iba a necesitar y me ahorraban espacio, espacio que podia utilizar con la fuente.


Por otro lado, me vi en la obligación de fabricar lo que son los sw
itches de encendido, y los "leds" de acceso a disco y de encendido, pues no tenia una torre vieja de donde sacarmelos.

Asi como tambien al estar todas las piezas en tan reducido espacio, me toco fabricar asi mismo las persianas de los ventiladores, pues no sabia donde conseguirlas.

Las de los switches y persianas a continuacion:

































Medimos unos voltajes por aqui y otros alla... Para saber donde conectamos los ventiladores; Ponemos unos puntos de soldadura y estaremos preparados para la siguiente etapa.
















Ahora, ya que tenia todo ensamblado, lo único que me hacia falta era el disco duro, esto significaba que me iba a tocar construir una estructura que los sostuviera, pero al mismo tiempo que fuera fácil de cambia _Y_ que no me ocupara mas espacio del que ya tenia asignado la torre que estaba construyendo, así que para cumplir toda esta serie de requisitos, decidí montar el disco duro en la parte superior de la "torre", asi cuando abriera el computador lo primero q
ue encontraría era el disco duro.

Ahora, para asegurarlo, se me ocurrio una estructura asi:
















Finalmente, despues de haber soldado cables, construido persianas de ventilación, tomar medidas de las partes del PC y tratar de que todo quede lo mas comprimido posible y a la vez ventilado, el computador quedo asi:
















Ahora lo que sigue es montarle sistema operativo, obviamente no voy a poner las imagenes de como instalar un sistema operativo :D.

martes, abril 15, 2008

Logo AcopleT

Despues de hacer como 15 diseños completamente diferentes, tomamos la decisión, de que este va a ser nuestro logo, es gratificante ver que todos estan poniendo empeño en que esto se pueda hacer realidad.
Este es el logo que elegimos, obviamente habra que refinarlo mas, pero por aca va la idea.

jueves, marzo 27, 2008

Mi empresa, mi vida

Ya hace _muchos_ dias vengo pensando que mi vida no es trabajar 8 horas al dia esperando una retribucion de lo que hice a lo largo de un mes, no digo que esto sea malo, pues no lo es siempre y cuando uno este satisfecho con lo que esta haciendo en mas de un 80%, es por esto que conversando con mi Mejor amigo, decidimos el y otro compañero de nosotros montar (o al menos intentarlo) nuestra propia empresa, a pesar que todos tengamos gustos completamente diferentes (yo programación de videojuegos, el rails y web) cosa que de acuerdo con nuestros proyectos se acomoda bien, debido a que yo por un lado podre programar videoJuegos y él se dedicará a montar toda la infraestructura de nuestra pagina, donde vamos a montar los juegos desarrollados.

Podra sonar muy salido de los cabellos eso de "montemos una empresa de videojuegos aca en medellin, donde lo unico que se hace es paginas web", pero si uno tiene sueños por lo menos debe tratar de alcanzarlos, ademas nuestro publico esta en focado al del exterior.

lunes, marzo 24, 2008

proyecto de practica Terminado xD

Pues si, despues de todo lo que me preocupe por como iba a hacer el proyecto, despues de tantas horas si poder dormir (puro drama :P) al fin logré terminar el proyecto de practica >_>

La idea es algo boba, pero era necesaria (o eso me dijeron) para la empresa, el proyeto mio consistió en coger el script de sincronización de servidores y modificarlo de tal manera que sincronizara carpetas dentro de un determinado repositorio.

Mas o menos la idea es asi:

El problema que se enfrenta en estos momentos podría ser solucionado de dos maneras válidas más sin embargo una de ellas no viable.

Primera (pero no viable):

Tener un repositorio base que es donde se encuentran los datos principales, y tener “sub-repositorios” (donde se va a guardar cada carpeta) para mantener las dos (o más) sedes sincronizadas, de esta manera habría que:

. 1.--> exportar la carpeta a un nuevo repositorio

2 . --> hacer un dump del repositorio

. ----> Trasladar el dump a la nueva máquina donde se quiere cargar el repositorio

4. .--> Cargar el dump en la nueva maquina.

Luego de esto automatizar una tarea cron para que cada determinado tiempo, se ejecute el script de sincronización de repositorios existente y así mantener el repositorio del servidor 1 sincronizado con el repositorio del servidor 2.

¿Pero porque no es viable? Respuesta: Por varias razones, entre ellas:

* Qué tal si tenemos más de una carpeta a ser sincronizada, habría que crear más de un repositorio y al otro lado tener el mismo número de repositorios a los que llegan la sincronización

* La gente ya está acostumbrada a subir y bajar datos del repositorio principal, seria ineficiente acostumbrar a la gente a subir determinados datos a un repositorio, y otros datos a otros repositorios, seria confuso y poco práctico.

* No se puede mesclar de dos repositorios existentes determinadas carpetas y sincronizarlo a un repositorio.

De esto podemos concluir que con esta primer alternativa, la conexión de sincronización que opera en los repositorios es una conexión 1:1, es decir por cada repositorio existente en Server 1, este solo tiene uno y solo un repositorio sincronizado en Server 2.


Segunda:


Tener en una red de repositorios, varias carpetas que se quieran sincronizar, no importa de donde vengan dichas carpetas e introducirlas a uno o varios repositorios, de tal forma que un repositorio sea la suma de varios repositorios.

Esta propuesta de proyecto de práctica, después de haber investigado las operaciones posibles sobre un repositorio de SVN, llegué a la conclusión de que podía haber dos maneras para desarrollar este modelo de sincronización las cuales eran:

Export – Import.

Procedemos para hacer un “dump” asi:

1. --> Del repositorio de inicio hacer un export de la carpeta que queremos sincronizar

2. --> Trasladar dicha carpeta al repositorio destino y adicionarla al nuevo repositorio

El problema de este enfoque es que cada vez que se quiera hacer una operación de sincronización, al no poseer el export un manejo de versiones, hay que traerse toda la carpeta y añadirla forzosamente, esto implica que cada vez que estamos haciendo updates, nos toca traernos toda la carpeta a la que se le añadió algo.

Por esta sencilla razón, esta opción queda completamente descartada, pues estamos desperdiciando demasiado ancho de banda trayéndonos toda la carpeta cada vez que se actualiza un pedazo del directorio.

SVN DIFF (La elegida)

Despues de hablar con el wise , este me recomendo usar svn diff, para esta aproximacion, procedemos de la siguiente manera:

1 1. Si la carpeta a hacer el backup nunca ha sido sincronizada, entonces realizamos un svn diff desde la revisión cero hasta la actual, de tal forma que nos traigamos todo el historial de todo lo que se ha hecho desde que se creó la carpeta y se añadió al repositorio hasta el momento actual.

2. Trasladar dicha carpeta al repositorio destino, revisar si la versión de la carpeta que estoy tratando de sincronizar es mas nueva en comparación con la del repositorio destino, si dicha carpeta está en su más reciente versión, entonces no realizar ningún cambio, de lo contrario “parchar” la carpeta con los cambios que esta trae.

El único problema que este enfoque presenta es que si se borra un archivo en el repositorio inicio, al momento de actualizar, en el repositorio destino, dicho archivo no es eliminado, sino que su contenido es el eliminado, es decir queda un archivo en blanco en el repositorio destino.

viernes, marzo 14, 2008

Proyecto de práctica

Pues si, resulta que en el semestre de práctica nos ponen a desarrollar un proyecto de práctica. El cual debe ser algo como un "aporte voluntario" que se le hace a la empresa en un especie de agradecimiento por haber recibido al practicante, pienso yo.

Y a no ser mas, a mí tambien me corresponde hacer un proyecto de práctica, el cual estaba entre dos alternativas (una propuesta por mi jefe yehuda y la otra propuesta por mi jefe Tomás), las cuales consistian en desarrollar una librería javascript que ayudara al desarrollo de aplicaciones web internas de la empresa (propuesta por Tomás) y la otra fue el desarrollo de un script de sincronizacion entre servidores de svn, pero lo interesante ( y no tan interesante) del script es que la idea es no hacer un dump de todo el repositorio, sino hacer "Dumps" de carpetas que luego seran cargadas en otro repositorio.

Este procedimiento debe ser hecho automáticamente y cada determinado tiempo, cosa que no es problema pues el script va a correr en un ambiente UNIX y puede ser automatizado con una tarea cron .

Digo que interesante ( y no tan interesante) porque pense que extractar una carpeta del proyecto era algo complicado, pues no es posibles hacer dumps directos sobre una carpeta. pero hablando con el "wise" me dio unas ideas con diff (cosa de unos minutos), que creo podria resultar.

En fin, vamos a ver como progresa el proyecto :).

sábado, febrero 16, 2008

eTags recursivo...eTags recursivo...eTag..

resulta que etags solo coge (para armar la tabla de funciones) los archivos que esten en '.' (directorio donde estoy parado).


 etags *.c *.h


Pero resulta que necesitaba hacer una tabla con todos los archivos que estuvieran debajo de miProyecto/, fue cuando con un poco de ayuda de google encontre:

find . | fgrep 'h|c|hpp|cpp$' | etags

Pero resulta que me decia que no se podia, me sacaba el tipico:

etags: no input files specified.
Try `etags --help' for a complete list of options.

Hasta que los de # emacs en irc me comentaron que hiciera esto

find . | egrep '\.(h|c|hpp|cpp)$' | etags -


lo cual funciono a la perfeccion!, ahora como moraleja me queda que tengo que conseguirme el libro de Regular Expresions ^_^ del wise!, porque no entiendo bien esas expresiones regulares.

lunes, enero 14, 2008

La simplicidad de C#

Despues de estar aca aprendiendo en TVEEZ sobre lo que es el manejo de xaml en el framework de .Net 3.0, decidi por mi propia cuenta hacer una aplicacion que estaba planeando programar, pero que no la habia echo debido a estar ocupado con ciertas cosas el caso es que la aplicacion consistia en traerme la foto del dia de www.explosm.net/comics para asi evitarme entrar a la pagina y ver propaganda >_>

La aplicacion esta desarrollada parcialmente en C# con xaml en la capa de presentacion.

Codigo Xaml para la parte de presentacion de la aplicacion

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:WPFStaticResourceTest" Title="Prueba" Height="537" Width="667" HorizontalAlignment="Center">

Y para la parte de la logica se implemento en C# Con cosas tan sencillas como es el hecho de hacer una peticion de GET para la pagina que queremos visitar (www.explosm.net/comics)

StreamReader objReader = new StreamReader(objStream);
string sLine = "";

int i = 0;
while (sLine != null)
{
i++;
s
Line = objReader.ReadLine();
if (sLine != null)
{
pageContent = pageContent + " " + sLine;

}
}

Con esta pequeñez de codigo recibimos toda el codigo html de Explosm y lo guardamos en una string, ahora la unica tarea que nos queda es simplemente parsear dicho codigo para buscar la foto y mostrala en la aplicacion.

private string searchForPicture(string s){
//Cyanide and Happiness, a daily webcomic

int index = s.IndexOf(" img alt=\"Cyanide and Happiness, a daily webcomic\" src=\"")
int count = 0;

while(s[index+count] != '\"'){
count++;

}
string urlPic = s.Substring(index, count);

return urlPic;
}

Asi llevamos a cabo la tarea de sacar el string que nos interesa, que es la direccion de la foto.


Ahora lo mas interesante, con esta instruccion mostramos el contenido de la foto, sin importar en que formato este, y de donde venga



Finalmente la aplicacion se ve asi ^_^:


Lo mas chistoso es que yo no sabiendo casi nada de C# pude realizar esta aplicacion en practicamente una mañana de trabajo, me tiene impresionado la facilidad como salen las cosas en .net.

viernes, enero 11, 2008

Practica

Pues si, se llego el tiempo de la practica y me di cuenta que lo que uno mas quiere no es siempre lo que consigue, pues casi todos mis compañeros de practica consiguieron practica en el exterior y yo me quede aca, el caso fue que consegui mi practica en una empresa de marketing llamada TVEEZ Internacional http://tveez.studioyael.co.il y mi trabajo es como desarrollador, la empresa en resumidas cuentas lo que tiene es un reproductor de contenidos que van desde imagenes videos y musica hasta RSS feeds, pero dicho reproductor es un sistema distribuido que coge dichos archivos multimedia de diferentes servidores distribuidos en internet, y basandose en unas reglas de inferencia, datos de la empresa, etc. Decide que propagandas poner a determinadas horas del dia, el caso es que yo que estaba tan feliz en mi mundo linux, con mi unico (para mi) IDE emacs y con mi lenguaje C++, paso ya ahora a estar en un mundo donde el sistema operativo (windows Vista) no es lo mas agradable del mundo, mi IDE (que tiene sus ventajas) es Visual Studio 2008 y mi lenguaje para trabajar es algo llamado xaml (lenguaje en el que se hacen los storyboards del reproductor), es como si me cogieran de las pelotas y me las martillaran en un yunke, me siento como sino hubiera hecho nada con mi vida, pues todo el mundo sabe lo que esta haciendo y yo a duras penas entiendo pedazos de xaml...>_>.

Lo que importa es que a medida que pasa el tiempo se hace mas y mas placentero pertenecer a TVEEZ, espero aprender mucho de ellos y dar mucho de mi espero cogerle el ritmo a esto y algun dia salir a israel que es donde esta la sede madre de TVEEZ.

PD: Nunca es tarde si la dicha es buena.

lunes, diciembre 17, 2007

Fotos Laboratorio

Adjunto aca unas fotos que nos tomamos en el laboratorio en un dia (de tantos) que no haciamos absolutamente nada =)

jueves, septiembre 13, 2007

Nuevos Proyectos, Nuevas oportunidades

Resulta que en estos dias de aburricion y desperdicio he estado pensando en hacer algo con mi vida, que no llegue el dia de mi practica y no haber echo nada, mas importante aun queria demostrarme a mi mismo que cualquier persona es capas de hacer un juego, sencillo pero (a mi modo de ver) entretenido y es por esto que decidi hacer una especie de Tennis distribuido, primeramente estoy tratando de que corra en una maquina sola, pero despues de tener montada toda la logica de la aplicacion junto con el sistema de colisiones, etc espero portarlo para que se pueda jugar en modo multijugador.

Obviamente si alguien le interesa ayudarme seria chèvere, el juego lo estoy desarrollando en C++ con una interfaz y manejo de eventos en SDL, nada de .net, java, flash, workflows,etc... pues no es porque me paresca una pendejada, porque no, no lo es y creo que se puede hacer mas bonito en dichos lenguajes y mucho mas rapido, sino porque hay 2 motivos fundamentales ingenieritos de software.

1) los juegos de verdad no se hacen en java ni flash
2) nose ninguno de estas tecnologias y soy vieja escuela

les dejo la inquietud a quien lea este blog, si esqe alguien lo hace todavia :P.

aca esta el proyecto: distri-tennis