Showing posts with label UNAM. Show all posts
Showing posts with label UNAM. Show all posts

Tuesday, March 31, 2015

#FixIT@UNAM: How We Got Over A Hundred Latinas In Our Hackathon



[Image Caption: Group photo of #FixIT: Latina Hackathon @ UNAM

[Image Caption: #FixIT was a success because we worked with the community to 
make Latinas feel welcomed] 


Highlights

  • Organized  a large scale Latina Hackathon #FixIT with almost 300 registered females and 147 female Hackers on February 26-27 2015 at the National Autonomous University of Mexico (UNAM).
  • The Hackathon had a large female turnout because we created a space welcoming for Latinas.
  •  Hackers designed innovative smart home appliances using arduinos, and collaborated with other very diverse females, such as high school students, young professionals, graduate and undergraduates in Computer Engineering, Mechatronics, Industrial Design, Philosophy, Politial Science, among others.
  • The Hackathon's organization  had powerful team work between Google Anita Borg Scholars, US and Mexican universities (UNAM, UCSB, UC Berkeley, UCD, Georgia Tech) and non-profits (Major League Hacking, SocialTIC).


Many organizations have been fighting to bring diversity into IT. But it has been a sloooow loooong progress. I don't like slow! I decided to take things into my own hands :) So I did what you always do when you’re a little guy facing a terrible future with long odds and little hope of success: I teamed up with my friends.

I was very fortunate to have been awarded to join the planning committee of Google Anita Borg Scholars. This new organization has the mission to increment world-wide the number of women participating in computer science. I started to work closely with Miray Kas, and Sarah Safir. These two women gave me the motivation and inspiration to start dreaming and making a reality: the idea of Fixing IT, rapidly bringing diversity. It gave me the drive to stay up multiple nights with friends further devising a plan.

Online I got introduced to many new great people, from other Googlers who had careers focused in fostering diversity, to 19 year old UNAM students, like Juan Pablo Flores, who organized large scale Hackathons throughout their country. I’ve worked with some of the strongest teams in industry, academia, and even sport (Olympic medalists!) But I’ve never seen anything like this.
Starting from literally nothing, we went to having a fast moving plan: We would do a Hackathon! A female Hackathon, a Latina Hackathon. We would be fighting to incorporate two minorities at once!

[Image Caption: Latinas in 
#FixIT hacking away.]

Why a Hackathon?
We saw Hackathons as a fast way to turn anyone into creators, not just consumers of, technology. We wanted to create a space that would empower these minorities to build and present their own visions of what technology looks like.

We were a strong motivated team, but in a certain sense we were also just newbies, running around telling everyone we were going to create this new awesome more inclusive hackathon. You can ask anyone, I was constantly inviting everyone to join and participate in my Hackathon. The problem was that we didn't really know any latinas interested in tech; we didn't have a space to hold the Hackathon. Heck, we didn't even have a budget. We had no funds to even run it.  Even I began to doubt myself. It was a rough period.

But December hit and suddenly things started moving.  Suddenly all the work we had done started coming together. All the folks we talked  to about it suddenly began getting really involved and getting others involved. Everything started snowballing. It happened so fast.

So... How did we make it happen?


[Image Caption: UNAM Professors helping to explain Hackathon dynamics.
The professors helped to secure the spaces, 
prepare bootcamps, and connect with students.]




A. Professors from the National Autonomous University of Mexico (UNAM) got involved.
[Note that UNAM is one of the largest public universities in the world, and also one with  high academic ranking] The professors played a key role in the Hackathon's success because they helped us secure a space where we could run the Hackathon. From interviews with latinas we found that: 1) some latinas did not attend Hackathons because they lacked their own equipment; 2)  some parents from latinas only allowed their daughters to  participate in  the Hackathon if it happened during the school week and it was part of a school activity; 3) some Latinas felt insecure of their technical skills and this made them hide away from hackathons
This lead us to want  to create a Hackathon that covered the needs of these girls, and made it easy for them to participate.
1. The UNAM professors helped us secure computer labs so that participants would not need to bring their own equipment.

2. The professors also gave us access to their network of high school and college professors (UNAM also has high schools!) These professors kindly invited their Latina students to our event; many physically drove them there; and some even turned it into an official school activity.

[Image Caption: Latinas with Mentors
@ #FixIT bootcamp.]


3. The UNAM professors and also UNAM senior students helped us to prepare a bootcamp. We felt the bootcamp would give participants more security in themselves and help them thrive. The bootcamps helped participants regardless of their programming knowledge or skill to start designing and building smart houses using Arduino. UNAM also gave us many mentors  that helped participants throughout the hackathon. These mentors were very engaged students that also helped to create security in participants.

From interviews, we also suddenly realized that this might be one of the first large scale latina Hackathon in the region. It then made sense to try to help participants to build a network, and inspire and help each other to succeed. We thus decided to have talks for the Hackathon. Female professors, such as Dr. Cindy Rubio from UC Davis,  and graduate students, such as Deana Brown from Georgia Tech. They  all came down to UNAM to give inspiring talks on their research, career paths, and how they managed to succeed. Here again the UNAM professors managed to secure for us a large auditorium for the talks.
**For all of this thanks to Prof. Norma Elva Chavez and Dr. Jesus Savage. 


B. Amazing Google Anita Borg Scholars Support
The network of Google Anita Borg Scholars, specifically Miray Kas,  connected me with a group of very passionate Googlers, e.g., Rohan Lamba,  who had the vision of creating large scale hackathons across the world. The group helped cover all of the costs of the hackathon, and helped immensely with the planning and logistics. Rohan also came to the hackathon at UNAM and was up with me since 4 am the day of the Hackathon planning and hacking away!  Thanks to Google, our Hackathon gave participants:

1) Awesome Swag (Tshirts, bags, stickers, Tech Girls are Superheroes book! **This was actually written and created by another Google Anita Borg Scholar, Jenine Beekhuyzen!)
2) Kits to build and design Smart Houses using arduino.
3) Lots of great delicious Mexican food!
4)Awesome Prizes! (This was important to motivate participants. )

The Google Anita Borg Scholar network also gave us inspiring speakers and mentors. Both Dr. Cindy Rubio and Deana Brown were Anita Borg Scholars. They came down to UNAM to give inspiring strong talks.

[Image Caption: Dr. Cindy Rubio was the
keynote speaker of #FixIT]


C. Awesome UNAM Students
Our Hackathon had a large turnout, perhaps one of the largest Latina Hackathons to date. How did this happen? I believe it helped us immensely to listen to the needs of these young latinas. Undergraduate students from UNAM connected us with large networks of females who explained to us what it would take to have them attend the hackathon. We created spaces that facilitated their participation and they came! We had participation from schools and universities across the globe. Some examples were Universidad nacional Autonoma de Mexico (UNAM); Instituto Politecnico Nacional (IPN);  ITAM; Tec de Monterrey; Georgia Tech; University of California Santa Barbara, UC Berkeley; UC Davis; Oxford.

The biggest takeaway from this is that perhaps the success of our Hackathon came not necessarily because we had big tech players on our side. We succeed because there was this enormous mental shift in the students, professors, and just everyone involved. All of them were thinking of ways they could help to recruit and bring their latina friends to our event. Often really clever, ingenious ways. Students made videos. They designed ads. They bought billboards. They announced massively and repeatedly on social media. They had rallies. Students saw it as their responsibility to help.
Here a big shoutout to Juan Pablo Flores, Alejandra Monroy!





















D. The Designers
Laura Ballroom and Ariadna Gómez Dessavre were the designers of the Hackathon. Ari made the awesome #FixIT logo; and Laura designed the tshirts, stickers and certificates.


The designers were key for the event because they created products that were used and adopted by participants. This helped to create a collective identity for the event and build a community. I loved seeing on social media people share selfies with their Hackathon tshirts and feel proud to wear them.

I loved seeing the senior female student add our sticker to her laptop (along with the multiple other stickers she proudly shows to present all the tech events she has attend) and the young high school student add our sticker to her bare laptop (representing this is her first tech events. But seems to be likely to attend now more :)


I believe we won this fight, we were able to have a hackathon with hundreds of latinas; rapidly bringing diversity into technology, because everyone made themselves the hero of their own story. Everyone took it as their job to have an event where more audiences could be included; where more voices could be empowered to design and construct technology. They threw themselves into it. They did whatever they could think of to do. They didn’t stop to ask anyone for permission.

We, the people decided to make a difference. We decided to make it our responsibility to do this work. To change who is empowered to participate in a Hackathon. Who is empowered to define technology. Let's not forget that we do have the power to change our reality.
"Juntas Creando y Transformando la Realidad"
[This was the main quote for #FixIT, it reads in Spanish: Together Creating and Transforming Reality]


[Image Caption: #FixIT was a success because we worked with the community to 
make Latinas feel welcomed] 

























This text is a remix of Aaron Swartz's inspiring speech: How we Stopped SOPA." We miss you Aaron. 

Friday, October 14, 2011

Alles Auf Anfang, o la cancion para empezar tu vida

Tenia meses que queria compartir esta cancion. Es una cancion alemana de uno de mis grupos favoritos: Wir sind Helden. (Nosotros somos los heores!) . Esta cancion me encanta la melodia, es de esas cancione que me pone de buen humor escucharla, me dan ganas de bailar. Pero lo mejor que tiene esta cancion es la letra. El mensaje que yo entiendo es que debes tomar accion! Si hay cosas que no te agradan de la vida, esta en tus manos cambiarlas. Ponte las pilas. Da todo cada dia! Alles auf anfang! Da todo en este principio que viene! Venga Pumas vamos!

Aqui esta la cancion. Enjoy!


Version Alemana:


23.55: Alles auf Anfang
Du wirst zahnlos geboren und ohne Zähne gewogen
Kriegst sie bis Mitte zwanzig, schon wieder gezogen
Bist oh so verschüchtert, verzagt und vernagelt
Kein Licht dringt zu dir, so geplagt bist du, sternhageldicht
Was dich runterzieht, sind deine schweren Arme
Wer schleicht, dem wird leicht kalt, darum schleichst du ins Warme
Du nennst es Weltschmerz, ich nenn' es Attitüde
Es ist erst fünf vor zwölf und du bist schon so müde

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"

Nimm deine Zähne, leg sie unter dein Kissen
Und sag der Fee du möchtest folgendes wissen:
"Warum sinkt mir mein Herz in meine schweren Beine?
Ich kann kein Ende sehen von meiner langen Leine"
Das was dich so beschwert, das sind die dicken Bären
die sie dir aufbinden, du könntest dich beschweren
Ob das von Bein haut, das wäre nun zu klären
Wenn die kleinlauten, kleinen Leute im Kleinen deutlich lauter wären

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"

Wer "A" sagt muss auch "B" sagen
Nach dem ganzen "ABC" fragen
Wer "ach" sagt muss auch wehklagen
Wer "ja" sagt auch "ach nee" sagen

Fühlst du dich mutlos? Fass endlich Mut, los!
Fühlst du dich hilflos? Geh' raus und hilf, los!
Fühlst du dich machtlos? Geh' raus und mach, los!
Fühlst du dich haltlos? Such Halt und lass los!

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"

Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Fünf vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Vier vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Drei vor zwölf, alles auf Anfang"
Ihr sagt: "Kein Ende in Sicht"
Wir sagen: "Zwei, eins, auf die Zwölf"



Version En Espa~ol!

23.55: Listos para empezar!
Naciste sin dientes y sin ellos te pesaron ,
Haz que lleguen hasta tus veinti-tantos
Con buena fe arragantelos.
Estas tan intimidado, tan fracasado y atrapado,
Ningun rayo de luz llega a ti, estas tan molesto

Lo que a ti te cansa, son tus brazos pesados,
quien anda a hurtillas, a escondidas, estara un poco friolento, por eso entras tu al calor a escondidas.
Tu lo llamas "Cansancio de estar vivo", yo lo llamo 'Actitud'
Ya son 5 para las doce, y tu ya estas cansado

Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia"
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Toma tus dientes y dejalos debajo de tu cojin,
y preguntale al raton de los dientes, todo lo que quieras saber:
"Por que mi corazon se cae hasta mis pesadas piernas?
No puedo ver el fin desde mi larga linea"
Lo que a ti te pesa es que te estan haciendo pendejo,te puedes ir a quejar,
talvez sea un problema con la piel de tu pierna, se puede eso aclarar,
cuando la gente chiquita y docil se une, es mucho mas fuerte.

Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Ustedes dicen: "No se ve el fin"
Nosotros decimos:"Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Quien dice A tiene tambien que decir B
Pide por todo el alfabeto
Quien dice "ahh": tambien debe empezar a llorar
Quien dice "si" debe tambien decir "duh!, obvio!"

te sientes sin animos? Vamos animate!
Te sientes sin ayuda? Vamos sal a ayudar a la gente!
Te sientes impotente? Vamos sal y hazte cargo!
Te sientes desorientado? Vamos sal y orientate!

Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: "Son las cinco para las doce, vamos a dar el todo en este nuevo dia

Ustedes dicen: "No se ve el fin"
Nosotros decimos:"Son las cinco para las doce, vamos a dar el todo en este nuevo dia
Ustedes dicen: "No se ve el fin"
Nosotros decimos: dos, uno...vamos por el doce!




Algo que me agrado de hacer esta traduccion, fue que aprendi una frase en aleman nueva:
" jmd. einen Bären aufbinden", es como bromear con alguien, yo lo tome como vacilarlo, hacerlo pendejo etc. Se me hace una frase rara porque Bären es oso. O.o

Sunday, October 18, 2009

¡¡¡Quiero ver las fotos de mi amorcino desde mi celular!!!

Siendo que recibí muchas peticiones al respecto, he decido que expondré como hacer otra pequeña aplicación para el nokia n900.
Hoy expondré cómo hacer un programa para visualizar imágnes.
La dinámica es muy sencilla, el usuario en un textbox escribirá la dirección de la imágen que se desea visualizar y la aplicación buscará la imágen y la desplegará.

En el post anterior habia explicado como se podía hacer un pequeño hola_mundo.c para nuestro celular nokia n900, usaremos este mismo principio para hacer esta aplicación.
Para hacer la parte gráfica usaremos GTK. Quien necesite más ayuda en entender que demónios es GTK, recomiendo esta lectura.
Lo primero que haremos es el programa en C. Antes de emepzar el código, sería importante explicar como se manejan los eventos con GTK. Cuando digo eventos, me refiero al hecho de que el usuario oprima un botón por ejemplo. Cuando sucede algo así, debemos tener alguna manera de poder detectar que eso sucedió, y de decir, hmm el usuario oprimió el botón de enviar, entonces quiero, por ejemplo, leer lo que el usuario escribió en el textbox, y procesar después esa información.
Con GTK para poder hacer esto, lo que debemos hacer es conectar las señales que envía el botón (señales de que ya fue oprimido) con alguna función que hará lo que deseamos que suceda cuando se oprima ese botón. La función g_signal_connect, logra esto.
La funcion recibe los siguientes parámetros:
g_signal_connect(Objeto_Que_Emite_Las_Señales,tipo_de_señal_a_detectar,funcion_que_procesará_la_info,variable_a_procesar_en_la_funcion).
En este caso, esa función, nos quedaría de la siguiente manera:
g_signal_connect (G_OBJECT(button), "clicked",G_CALLBACK (on_button_clicked),&valorcitos);

En donde on_button_clicked, es la función que procesará que se hará cuando se oprima el botón.Y valorcitos, es de hecho una estructura que guardará todos los valores que queremos modificar en la función cuando se oprima el botón. En este caso, se escojió una estructura, porque en sí, sólo se puede enviar una variable a la función de on_button_clicked. Pero en este caso, necesitamos minímo enviar dos: la variable de tipo imagen, y la variable de tipo textbox, pues necesitamos leer lo que el usuario escribió, y dependiendo de eso, desplegar la imagen adecuada.

Resumiendo...Nuestro código nos quedaría de la siguiente forma:(Disculpen que los comentarios esten en inglés,no sé que me está sucediendo que programo ya con comentarios en inglés..:-(



/*
Program that displays a desired image
specified by the user.
by:saiph*/

#include stdlib.h/* EXIT_* */
#include stdio.h
/* Introduce types and prototypes of GTK+ for the compiler. */
#include gtk/gtk.h

/*This struct will store some of the variables that will be modified when the user clicks the button */

struct values
{

GtkWidget *image;
GtkWidget *entry;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
};

/*The function that will say what will happen when the user clicks the button, user_data stores the variables that we need to retrive from the main
function to play around with.
*/
G_MODULE_EXPORT void on_button_clicked(GtkButton *object, gpointer user_data)
{

gchar * name_file; /*gchar will store the name of the image that we wish to display*/
struct values *valorcitos;
valorcitos=user_data;/*we obtain a struct that stores the needed variables.*/

// we read the name of the image that the //user wants to display
name_file=(gchar*)gtk_entry_get_text(GTK_ENTRY
(valorcitos->entry));


/* we check to see if the image exists.
If it does, we will display it!=)
If not, we will print a label that says it doesn't */

if(g_file_test(name_file,
G_FILE_TEST_EXISTS))

{
/*The image exists, we will first remove the previous image we had*/
gtk_container_remove(GTK_CONTAINER
(valorcitos->vbox),valorcitos->image);

g_print ("File found it is %s. \n",name_file);
/*We read and assign the desired image to our variable image*/
valorcitos->image=
gtk_image_new_from_file((gchar*)
name_file);

/*We remove the pervious label we had, since it would say that
the image was not found. */
gtk_container_remove(GTK_CONTAINER
(valorcitos->table),valorcitos->label);

/*We set the adequete value for our lable*/
valorcitos->label = g_object_new(GTK_TYPE_LABEL,
"label", "Ex:pumas.jpg or pics/1.jpg",
NULL);
/*we place our lable adequetely where it belonged*/
gtk_table_attach_defaults((GtkTable * )valorcitos->table,valorcitos->
label,0,1,2,3);

/*we show our lable*/
gtk_widget_show(valorcitos->label);
/*we place the image where it belongs*/
gtk_box_pack_start(GTK_BOX(
valorcitos->vbox),(valorcitos->image),FALSE, FALSE,0);

/*we show our image*/
gtk_widget_show(valorcitos->image);

}

/*the image that the user wanted to see was
not found*/
else
{
g_print ("File not found. \n");
/*we remove the lable we had, since we wnat to tell the user that the image was not found*/
gtk_container_remove(GTK_CONTAINER(
valorcitos->table),valorcitos->label);

/* we prepare the lable to say that the image was not found*/
valorcitos->label = g_object_new(GTK_TYPE_LABEL,
"label", "That image was not found!",
NULL);
/*we place the lable adequetly*/
gtk_table_attach_defaults((GtkTable * )valorcitos->table,valorcitos->
label,0,1,2,3);

gtk_widget_show(valorcitos->label);
/* we remove the previous image that we were displaying.*/
gtk_container_remove(GTK_CONTAINER(
valorcitos->vbox),valorcitos->image);


}


}
int main(int argc, char** argv)
{
/* we create a struct that will store the variables that we will use when the button is clicked.*/
struct values valorcitos;

/* We create the other GTK+ widgets which we will use */
GtkWindow* window;

GtkWidget *label;

GtkWidget *button;
/* Initialize the GTK+ library. */
gtk_init(&argc, &argv);

/* Create a window with window border width of 12 pixels and a
title text. */
window = g_object_new(GTK_TYPE_WINDOW,
"border-width", 12,
"title", "Image Viewer",
NULL);

/* Create the label widget. */
label = g_object_new(GTK_TYPE_LABEL,
"label", "Type in the address of the image:",
NULL);
/*Prepare the lable we will modify when the user clicks the button*/
valorcitos.label = g_object_new(GTK_TYPE_LABEL,
"label", "Ex:pumas.jpg or pics/1.jpg",
NULL);
/*prepare the textbox*/
valorcitos.entry=gtk_entry_new();
int text_width =5; // Width of field in characters
gtk_entry_set_width_chars(
GTK_ENTRY(valorcitos.entry), text_width);

/*prepare the image*/
valorcitos.image=gtk_image_new();
/*prepare the button*/
button=gtk_button_new_with_label("OK");
/* connect the signals to the button, when clicked we will
call the on_button_clicked function and send in the struct valorcitos
that stores the variables we need to manipulate* */
g_signal_connect (G_OBJECT(button), "clicked",
G_CALLBACK (on_button_clicked),&valorcitos);

/*We prepare a virtical box that will store a table and the image*/
valorcitos.vbox=gtk_vbox_new(FALSE,0);
/*we prepare a table that will store the textbox,lables and button*/
valorcitos.table= gtk_table_new(1,1,TRUE);
/*We pack the table with the variables */
gtk_table_attach_defaults ((GtkTable * )valorcitos.table,label,0,1,0,1);
gtk_table_attach_defaults ((GtkTable * )valorcitos.table,valorcitos.entry,0,1,1,2);
gtk_table_attach_defaults((GtkTable * )valorcitos.table,valorcitos.label,0,1,2,3);
gtk_table_attach_defaults((GtkTable * )valorcitos.table,button,1,2,1,2);


/*we add the table to the vbox*/
gtk_box_pack_start(GTK_BOX(
valorcitos.vbox),valorcitos.table, FALSE, FALSE, 0);

/*we add the image to the vbox*/
gtk_box_pack_start(GTK_BOX(
valorcitos.vbox),valorcitos.image,FALSE, FALSE, 0);



/* Pack the vbox into the window layout. */
gtk_container_add(GTK_CONTAINER(
window), GTK_WIDGET(valorcitos.vbox));


/* Show all widgets that are contained by the window. */
gtk_widget_show_all(GTK_WIDGET(
window));


/* Start the main event loop. */
g_print("main: calling gtk_main\n");
gtk_main();
/* Display a message to the standard output and exit. */
g_print("main: returned from gtk_main and exiting with success\n");

/* The C standard defines this condition as EXIT_SUCCESS, and this
symbolic macro is defined in stdlib.h (which GTK+ will pull in
in-directly). There is also a counter-part for failures:
EXIT_FAILURE. */
return EXIT_SUCCESS;
}



Con esto tenemos ya listo el codigo, y ahora sólo falta compilar y correrlo.
Para ellos, llevaremos acabo los siguientes pasos.
1)Correr Xephyr, para ello desde una terminal escribimos simplemente:
Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac
Y se nos deberá abrir una ventanita negra.
2)Preparamos todo en scratchbox
-En otra terminal, escribimos /scratchbox/login
-Creamos el programa que ejutaremos: nano imagencitas.c
y alli pegaremos el código que acabamos de escribir.
- Compilamos el programa:
gcc -Wall -g imagencitas.c `pkg-config --cflags gtk+-2.0 gmodule-2.0` -o imagencitas `pkg-config --libs gtk+-2.0` `pkg-config --libs gmodule-2.0`
-Preparamos el ambiente para dibujar en el Xephyr :
En una consola escribimos: export DISPLAY=:2
af-sb-init.sh start

Y ahora simplemente con el siguiente comando correremos nuestro programa:
run-standalone.sh ./imagencitas

Y con esto deberíamos tener los siguiente:


Allí el usuario ha escrito que quiere ver la Imágen Pumas, pero aun no aprieta el botón.
Una vez que lo haya apretado tendríamos lo siguiente:


Y si el usuario escribiera el nombre de una imágen que no existe dentro del sistema, recibiría lo siguiente:


Y así es como, se podría crear una aplicación para ver imágenes en el n900.
Supongo que el código está medio sucio, pero es mi primera vez usando GTK y tengo además muchas otras responsabilidades...=(
Espero seguir jugando con esto, y mejorando.
Los dejo con la imágen de un comic, que me dió mucha risa:



Thursday, September 24, 2009

¿Cómo hacer un HolaMundo para celulares nokia n900?

Hoy desperté con un humor muy peculiar, sentí de pronto unas INMENSAS ganas de tener un celular nuevo, y cuando digo un celular nuevo, realmente me refiero a lo más más nuevo. I'm talking about the NEW Nokia phone!
Sí el neuvo celular de nokia, que aún no sale al mercado. (Yo ya tengo mi pre-order listissimo.)
El nokia n900.



¿Que cosas tiene el n900?
En su página algunas de las especificaciones son:
* Procesador de tipo ARM CortexTM-A8 corriendo a 600 MHz. El cual es el primer procesador de aplicaciones basado en la arquitectura ARMv7 y es actualmente el procesador con mejor rendimiento y más efficiente con respecto al consumo de energía que ARM ofrece.
La arquitectura ARMv7 también incluye la tecnología NEON™ para incrementar el procesamiento digital de señales que se tiene en un 400% !
También ofrece una mejora en punto flotante, para poderse adaptar a las necesidades que existen con la siguiente generación de gráficos 3D, las leyes de física que se aplican a los juegos, así como aplicaciones de control embebidas.( Un controlador embebido, término que de hecho NO conocía ja!, es un dispositivo que lleva acabo control embebdio...Y control embebido es un subconjunto de la adquisición de datos, esto es, el sistema de entrada/salida que se tiene no está conectado con una PC externa, sino que la PC o el procesador que está corriendo está realmente incorporado fisicamente con el dispositivo de entrada y salida.)
*Hasta 1 GB de memoria para las aplicaciones (256 MB RAM, 768 MB memoria virtual)
* Un sistema operativo de tipo Linux
* Un acelerador de gráficos 3D con soporte para OpenGL ES 2.0 (Si son medios neewbies, como yo a esto, (which is totally cool too, en algun lado se empieza!) Un acelerador de gráficos es una especie de adaptador de video que contiene su propio procesador para mejor los niveles de rendimiento. Estos procesadores están especializados en las transformaciones de computo gráfico, así que alcanan mejores resultados que la CPU de uso general type que usa la computadora. Además liberan el resto del CPU, para que pueda hacer otras operaciones, mientras que el acelerador de gráficos se encarga del trabajo sucio i.e. las computaciones gráficas.)
*32 GB en almacenamiento interno
*Pantalla de tipo Touch Screen

...Y muchas muchas más cosas, que en la página oficial pueden checar...

Entremos ahora a lo interesante.
¿Cómo podría yo, una chica solitaria de ingeniería en la UNAM jugar a gusto con este dispositivo?

-Hmmm, pensemos un rato...Thinking thinking thinking hard...Podría usarlo! Es lo suficientemente lindo para divertirte mucho si lo pudiera usar, además está lindo para presumirse en todos lados!...Peeero eres una estudiante de ingeniería de la UNAM... y en computación, así que a eso AUN le falta!!....mmmm...oh I know!...Programemosle una aplicación hecha por nosotros!!!

Lo primero es que entendamos lo que queremos hacer:
Queremos crear un ambiente en el cual podamos probar y compilar aplicaciones que bajaremos al celular.Es entonces muy importante crear un ambiente que pueda compilar y correr programas tanto en plataformas ARM (la plataforma del celular)) como x86 (Plataforma de la PC). Debido a que el N800 corre en un procesador ARM, no podemos tomar los bianrios que se generen en nuestra máquina e insertarlos así nomás al celular y esperar que funcionen. No funcionará debido a que cada procesador tiene su PROPIO set de instruciones, así que el bianrio creado por un compilador en un procesador x86 no significará nada en un procesador ARM, es por esto que debemos agregar una capa de abstración:
La solución es INSTALAR Scratchbox.
Scratchbox es un compilador cruzado (Un compilador cruzado según Wikipedia es un compilador capaz de crear código ejecutable para otra plataforma distinta a aquélla en la que él se ejecuta.)
el cual hace el desarrollo de aplicaciones embebidas en Linux mucho más fácil, además de eso brinda una serie de herramientas para compilar cruzado e integrar toda una distribución de Linux.
Con los siguientes 3 comando, se instalará scratchbox, se volverá ejecutable y después se correrá:
wget http://repository.maemo.org/unstable/5.0beta2/maemo-scratchbox-install_5.0beta2.sh
chmod +x maemo-scratchbox-install_5.0beta.sh
(Entre este paso y el siguiente, recomiendo mucho salirse de su sesión actual que tienen en su máquina, en mi caso no cobró efecto imediatamente.)
./maemo-scratchbox-install_5.0beta2.sh –u USER -F

Con estos pasos se debió haber instalado scratchbox y haber recibido un mensaje como el siguiente:
Installation was successful!

----------------------------



You now have Scratchbox 1.1.4 'apophis' release installed.



Scratchbox cannot be run as user root. Instead, use your normal login

user account. Add additional scratchbox users and sandboxes with the

following command (outside scratchbox with root permissions):



# /scratchbox/sbin/sbox_adduser USER yes



Running this command will create sandbox environment for that user and

add user to the 'sbox' scratchbox user group.

You will need to start a new login terminal after being added to the

'sbox' group for group membership to be effective.



Login to scratchbox session using the following command (as user):



$ /scratchbox/login



Refer to scratchbox.org documentation for more information re scratchbox:

http://scratchbox.org/documentation/user/scratchbox-1.0/
saiph@ubunt:~$


Una vez que ya se corrió eso, en una terminal se debe escribir:
~$ /scratchbox/login
(Entre este paso y el anterior, recomiendo mucho salirse de la sesión actual que tienen en su máquina, en mi caso no cobró efecto imediatamente, y me dijo unas cosas acerca de que NO tenía los permisos para hacer esa operación)
Con ese comando debe salir lo siguiente:
You dont have active target in scratchbox chroot.
Please create one by running "sb-menu" before continuing
Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.

See /scratchbox/doc/ for documentation.



sb-conf: No current target

[sbox-: ~] >

Si ya se tiene el prompt de sbox es que se instaló scratchbox adecuadamente, ahora lo que se debe hacer es instalar el sdk de maemo dentro de nuestro entorno. (El sdk de maemo nos permitirá desarrollar aplicaciones para el celular,recordemos que el n900 corre sobre el sistema operativo de maemo.)
Para instalar se debe escribir:
wget http://repository.maemo.org/unstable/5.0beta2/maemo-sdk-install_5.0beta2.sh
chmod +x maemo-sdk-install_5.0beta2.sh
./maemo-sdk-install_5.0beta2.sh

Dentro de esta instalación, yo selecioné los valores que venían por default.
Una vez que se termina la instalación se nos presenta en la consola un mensaje que dice lo siguiente:


Nokia EUSA binaries

-------------------



The package maemo-explicit is a metapackage of Nokia EUSA licensed

binaries which can be installed to scratchbox targets. It is highly

recommended to install this package on both targets to ensure a fully

working system.



If you want to install these, login to scratchbox (see commands above)

and run the command 'fakeroot apt-get install maemo-explicit' for both

armel (CHINOOK_ARMEL) and i386 (CHINOOK_X86) targets.



Happy hacking!

Lo que este mensaje basicamente nos está diciendo es que el paquete que acabamos de instalar contiene binarios que se pueden instalar como objetivos o "targets" dentro de scratchbox.Un target u Objetivo dentro de Scratchbox es una "caja de arena" configurada.(y una "caja de arena" dentro de Scratchbox es simplemente un área definida para cada usuario.)
Así que precisamente hagamos esto que nos dice el mensajito:
Nos volvemos a meter a scratchbox:

pete@ubunt:~$ /scratchbox/login



Welcome to Scratchbox, the cross-compilation toolkit!



Use 'sb-menu' to change your compilation target.

See /scratchbox/doc/ for documentation.



[sbox-CHINOOK_ARMEL: ~] >


Instalaremos el paquete explicito de maemo, al correr lo siguiente:

fakeroot apt-get install maemo-explicit

Una vez que la actualización sucedió. nos debemos cambiar al otro obejtivo que está ya "build" al invocar el comando en el menu sb.Esto hara que salga un sistema de menu, y usanado las flechitas selecione la opcion de Activate a target, y escoje el ambiente que aun no se ha actualizado, en este caso es CHINOOK_X86. Se debe correr el mismo comando de la vez pasada y ya deberíamos tener ambos ambientes listos calistos!

Ahora lo probaremos graficamente:
Abriremos otra terminal para probar graficamente que el sistema maemo está ya corriendo, también compilaremos un programa de prueba y lo correremos sobre el objetivo ARMEL .
En la nueva terminal, correremos primero los siguientes comandos:

sudo apt-get install xserver-xephyr


Con este comando se instala el X server embebido, el cual se requiere para probar correr la emulación gráfica del N900.
Posteriormente se deberá correr el siguiente comando:

$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -kb &

Con esto se prende el servidor Xephyr .( el servidor Xephyr es un servidor basado en KDrive, KDrive es una pequeña implementación del server que hay en el sistema X Window.Xephyr tiene como objetivo o "target" de framebuffer una ventana localizada dentro de un host X Server.->Un framebuffer representa cada uno de los píxeles de la pantalla como localidades de memoria en RAM)
Con esto lo que se verá es que se abrió una nueva ventana:

* Ahora entremos a Scratchbox y al objetivo de X86.

$ /scratchbox/login
[sbox->:~]> sb-conf se FREMANTLE_X86

* Hacemos que la variable DISPLAY corresponda a la configuración dada para el display que hay en el servidor Xephyr.

[sbox-FREMANTLE_X86: ~] > export DISPLAY=:2

* Prendemos el framework de la IU (Interfaz de Usuario) .

[sbox-FREMANTLE_X86: ~] > af-sb-init.sh start

Con esto se verá el framework de la UI lista y corriendo en la ventana Xephyr



El framework UI realmente es suuuper lindo. Después jugaremos más con él.
Por ahora sólo quería que todos lo tuvieran trabajando. Regresemos a lo que queríamos hacer...
Un aplicación "HolaMundo" para el n900:
Abra otra terminal y vayas a su directorio de home y allí debes crear un nuevo archivo en el cual pegaremos lo siguiente:


#include stdlib.h /* EXIT_* */
#include stdio.h
/* Introduce types and prototypes of GTK+ for the compiler. */
#include

int main(int argc, char** argv)
{

/* We'll have two references to two GTK+ widgets. */
GtkWindow* window;
GtkLabel* label;
GtkWidget *image;

/* Initialize the GTK+ library. */
gtk_init(&argc, &argv);

/* Create a window with window border width of 12 pixels and a
title text. */
window = g_object_new(GTK_TYPE_WINDOW,
"border-width", 12,
"title", "Hello GTK+",
NULL);

/* Create the label widget. */
label = g_object_new(GTK_TYPE_LABEL,
"label", "Hello World!",
NULL);

/* Pack the label into the window layout. */
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(label));

/* Show all widgets that are contained by the window. */
gtk_widget_show_all(GTK_WIDGET(window));

/* Start the main event loop. */
g_print("main: calling gtk_main\n");
gtk_main();

/* Display a message to the standard output and exit. */
g_print("main: returned from gtk_main and exiting with success\n");

/* The C standard defines this condition as EXIT_SUCCESS, and this
symbolic macro is defined in stdlib.h (which GTK+ will pull in
in-directly). There is also a counter-part for failures:
EXIT_FAILURE. */
return EXIT_SUCCESS;
}


Guarda el archivo como maemo_hello.c. y copialo como se demuestra a continuación:(Se ha dejado mientras prendido el scratchbox, asi como se dejó corriendo la ventana Xephyr )

cp maemo_hello.c /scratchbox/users/saiph/home/saiph/


Observese donde esá su directorio de home dentro de scratchbox, ahora si en la ventana que tiene corriendo scratchbox escribes ls, deberás de ver un archivo maemo_hello.c dentro de tu directorio de home:
[sbox-FREMANTLE_X86: ~] > ls
:~] maemo-sdk-rootstrap_5.0beta2_armel.tgz maemo_hello sb-conf
MyDocs maemo-sdk-rootstrap_5.0beta2_i386.tgz maemo_hello.c

Y ahora usando el mismo comando de sb-menu que habiamos usado antes,verificamos que estemos sobre el objetivo de ARMEL. (Esto hace que los binarios que compilemos sean hechos especificamente para el N800) .
Ahora simplemente compilamos:
gcc -o maemo_hello maemo_hello.c `pkg-config --cflags gtk+-2.0 hildon-1` -ansi -Wall `pkg-config --libs gtk+-2.0 hildon-1`

El archivo bianrio generado puede ser copiado a cualquier celular n900 y corrido sin ningun problema. Ahora lo unico que debemos hacer, es probarlo sobre nuestro ambiente de scratchbox (Que justamente está emulando el celular, tonz aunque no tengamos aun el celular, nos permitirá ver la aplicación como si se hubiese corrrido sobre el n900)
Para probarlo, sobre la terminal que tiene el scratchbox, ponemos a la variable de display=2, lo cual como ya se explicó antes, provoca que se apunte al Xephyr server, posteriormente corremos el script para prender el ambiente de prueba de maemo:n
export DISPLAY=:2

af-sb-init.sh start

Saldrán muchas letritas aqui, espera a que termine, y una vez listo aprieta enter, verás el prompt de scratchbox de regreso, y ahora ponremos:
./maemo_hello
Y finalmente deberás tener una ventanita similar a lo siguiente:


Y así hemos hecho nuestro propio HolaMundo para celulares n900!! ñ_ñ
OJO:Los pasos puestos en el blog, son para maquinas de 64 bits!!
Refrencias:
http://maemo.org/development/sdks/maemo_5_beta_2_sdk_installation/#close=1
http://www.reviewlinux.com/forums/news/12492-pete-savage-howto-scratchbox-maemo-4-0-ubuntu-gutsy-nokia-n800-dev-environment.html