Oracle Database 10g Administrator Certified Associate

| No Comments | No TrackBacks
Several weeks have passed since the last post. Well, I have been busy attending an Oracle course kindly paid by my employer.
This monday was the first certification exam and I passed it. So, now I am an

Oracle Certified Associate

Now to update my Curriculum Vitae.

The last week of November I will be attending the second course and in early December the second exam will take place, this time for the Oracle Certified Professional. That will be harder than this one, I am sure. So to practice.

Gemstone/S and FastCGI with lighttpd

| 4 Comments | No TrackBacks
I was reading the post from James Foster about configuring Apache/FastCGI for serving Seaside. I prefer Lighttpd because, as its name implies, it needs less resources to run. And with virtual hosting, as I have my servers, memory it is a big factor.

I followed the steps to install Gemstone/S in my machine. Instead of a hosted server, I used my laptop with my user as server.
After testing that Seaside was running OK in my machine, using:

miguel@laptop:~$ source /opt/gemstone/product/seaside/defSeaside
miguel@laptop:~$ startGemstone
miguel@laptop:~$ startSeaside_Hyper 8080

and navigating to:

http://localhost:8080/seaside

I stoped the Hyper Webserver with Ctrl+C.

Now to install lighttpd in my Debian GNU/Linux 4.0 etch machine. As root:

laptop:~# aptitude install lighttpd lighttpd-doc

and backup the default config file:

laptop:~# cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bak

then use this configuration for lighttpd.conf:

# Modules activated
server.modules = ( "mod_access", "mod_alias", "mod_accesslog", "mod_fastcgi" )
# Document root, maybe there you have other sites also
server.document-root = "/var/www/"
# logs
server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"
# Welcome file
index-file.names = ( "index.html" )
# Do not server files beginning with
url.access-deny = ( "~", ".inc" )
# Server config
server.port = 80
server.pid-file = "/var/run/lighttpd.pid"
dir-listing.encoding = "utf-8"
server.dir-listing = "disable"
server.username = "www-data"
server.groupname = "www-data"
# FastCGI
# Debug enabled, disable on production sites
fastcgi.debug = 1
# Do FastCGI for anything with prefix /seaside
# load-balancing with 3 hosts
# check-local disable searching the requested file in the lighttpd document root and
# forward the request to the fastcgi hosts
fastcgi.server = ( "/seaside" => (
    ( "host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
    ( "host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
    ( "host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
  )
)

Instead of starting Seaside over Gemstone/S with startSeaside_Hyper <port>, I used the provided script to start 3 gems for fastcgi as per James' instructions:

miguel@laptop:~$ runSeasideGems start

This started 3 fastcgi gems, listening in ports 9001, 9002 and 9003.

Then I restarted lighttpd:

laptop:~# /etc/init.d/lighttpd restart
Stopping web server: lighttpd.
Starting web server: lighttpd.

And tested that the default index page for lighttpd (located in /var/www/index.html) was served statically (you can add anything here)  from the server document root (/var/www/), pointing the browser to:

http://localhost/

Finally, I tested that the /seaside part was correctly delegated to Gemstone/S using FastCGI, pointing the browser to:

http://localhost/seaside

This time I get the dispatcher from Seaside, from where you can navigate the links from Seaside without problems.

This way you can use, for example, blueprint for the CSS style of your app, or maybe TinyMCE, for having a full fledged text editor. All you have to do is to put them in a directory inside the document root of lighttpd (/var/www in this example) and in the Seaside application, you reference them with the absolut path to your website, for example:

http://mysite.com/styles/blueprint.css

or

http://mysite.com/tinymce/jscripts/tiny_mce/tiny_mce.js

So, the webserver to serve the static content of your site (faster) and Seaside to serve your webapp.

Enjoy.




Okcoba Fest

| 3 Comments | No TrackBacks
Yo, Miguel Cobá, en mi carácter de representante absoluto y vitalicio de mí mismo, con fecha 24 de setiembre del año del señor 2008, siendo las 16:39 horas en el horario local, 21:39 hrs en el horario universal, en la centenaria, hermosa y ahora muy atribulada Ciudad de México

DECLARO

oficialmente iniciados los festejos conmemorativos del natalicio de nuestro humilde, sonriente, amigable, entrañable, guapo, inteligente, trabajador y muy modesto representado.
En este tenor

ORDENO

que, a partir de las 23:59 minutos en tiempo local y durante un periodo no menor a 3 días y no mayor a lo que sea saludable para el buen mantenimiento de la salud del hígado humano normal de una persona adulta de 29 años, deberá festejarse, en cualquier lugar donde se encuentre uno, a la hora en que así sea conveniente, solo o en compañía, de manera preferente con el interesado, con toda suerte de sustancias y actividades tradicionalmente usadas al efecto en ocasiones de similar trascendencia, y apegados a la tradición, tanto mexicana como ingenieríl, incluyendo sin limitar:
  • derivados etílicos de la uva, la cebada, el agave azul, el arroz y las frutas dulces, así como bebidas dulces, derivadas de frutas o carbonatadas que produzcan una combinación agradable al gusto humano
  • los derivados lácteos en sus diversas variedades generalmente conocidas como quesos, preferentemente en sus presentaciones edam, de cabra, manchego y con ceniza
  • abrazos, besos (preferentemente de personas del sexo femenino, aunque del pequeño caballero de la mesa redonda se aceptan sin chistar y con emoción), actividades intimas y lúdicas para adultos (con exclusividad total para la filósofa y aspirante a curadora de arte, mejor conocida como Frau Kunst)
  • actividades de mesa incluyendo sin excepción, cartas, dominó, jenga, así como concursos coloquialmente conocidos como fondos y muppets
  • narración de anécdotas típicas, emotivas, avergonzantes, divertidas, por n-ésima ocasión al calor de la velada, así como la tradicional reinterpretación del sentido de la vida, del hombre y sus motivaciones, el espíritu del vino y el secreto escondido en el cuerpo de las mujeres y en la risa de los niños.
  • música al gusto del momento, con especial atención a la preferida por nuestro conmemorado
Sin otro afán que el de agradar y hacer patente nuestro amor y la felicidad que nos da el pretexto para honrar a Baco en su más mundana faceta y a participar de Eros en su más práctica y apapachante expresión, decreto:

QUE INICIE EL "OKCOBA FEST" 2008

PD. La sede principal de los festejos será, como siempre, la residencia oficial de nuestro conmemorado donde se les espera el día sábado 27 a las 19 horas tiempo local y hasta que el cuerpo (o el hígado) aguanten.

PPD. No se aceptan regalos, solamente asistencias, risas, "saluds", abrazos y llamadas telefónicas (así como sus equivalentes modernos Web 2.0). Abstemios, se les insta a hacer un esfuerzo y dejar atrás sus arcaicas y no sociales prácticas :).

PPPD. Si alguien quiere traer regalos, estos no serán despreciados sino que se aceptarán con el más humilde y sincero agradecimiento.

PPPPD. Pero no son obligatorios los regalos.


Al margen un sello con el escudo nacional que dice: "Patronato Oficial para el Festejo del 29-nario del Natalicio de Miguel Cobá". Una firma ilegible. Secretario General del Patronato para el festejo de Miguel Cobá.

Extiendo la presente en 2 fojas útiles, en México, Distrito Federal, a los 24 días del mes de setiembre del año de nuestro señor dos mil ocho, a fin de que sea publicada en el diario oficial de la federación, y en los diarios de mayor circulación nacional a fin de que sea de conocimiento general de la ciudadanía.

Miguel Cobá, Presidente del Consejo de Administración del Fideicomiso 2008/09/25MCM/ aprobado por la H. Cámara de Diputados, en su sesión extraordinaria y urgente del 23 de setiembre del año de nuestro señor dos mil ocho, para la creación del Patronato para el Festejo del N-ario del Natalicio de Miguel Cobá. Presente.



F***ing MySQL

| 1 Comment | No TrackBacks
One more time, I am having trouble with the MySQL database I administer.
Look, this MySQL database was inherited. It contains ~30 databases, most of them MyISAM type. One of them, the biggest, with more than 30GB of data (150 millions registers). The configuration for MySQL especified a first innodb tablespace file of 20GB and a second file of 10MB, with autoextend. From my.cnf:

innodb_data_home_dir = /data/mysql/data
innodb_data_file_path = ibdata1:20000M;ibdata2:10M:autoextend

I was in the migration from MyISAM to InnoDB, in order to have transaction support. But, as I noted after starting the migration of tables, the innodb files used for storing the mysql tables NEVER shrinks. Never, even if you delete tables, drop tables or drop databases. Always grows but never returns unused space to the operating system. Unbelievable.
According to the bug tracking system for mysql (bugs 1341, 1287) this is a design decision to improve performance: if the space were disposed each time a delete is peformed, it would need to be allocated again when more data were written to the database. So it is only marked as deleted but not returned to the operating system. That is reasonable. In fact it is a good point. But there are times when you just need to free the innodb unused space and IT IS NOT possible, in an automatic or, at least, in a manual way.
Why would you need this. Supose, for example, that I have a 100 GB disk. It is used only for mysql. There is only a database of 40GB in it. So I have ~60GB of space free. One day I need to restore an old backup for this database. I create a new database and restore the old backup inside this database. If I have MySQL configured as all Innodb, the new database would be created in the innodb tablespace, so MySQL will grow the tablespace to say 80GB so the restored backup can be loaded. At this moment, I have 80GB used by the tablespace and only 20GB of free space in the disk. After extracting the data from the backup, I delete the restored database. One would think that the 40GB would be returned to the OS, but NO! The table space size is 80GB although only 40GB are really used, in fact, SHOW TABLE STATUS would show that it is only 50% used. If my original database doesn't grows to fill the 80GB used by the innodb tablespace or grows very slowly I have actually lost 40GB from my disk and I can not do anything easy to recover that space. In other words, I have lost that space.
Of course there are workarounds for this problem, but they involve dumping and restoring the databases and more important, YOU MUST shutdown the database. That is not always posible. Maybe in a weekend or in the night, but that can be too late if you are running out of disk space.
It is needed a command to force MySQL to free unused space, under the responsability of the DB administrator. At this time, there isn't any.
So the only way to add more free space to my database was by means of the operating system. My filesystem was like this:

[root@usp02 root]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p3      64G   36G   26G  59% /
/dev/cciss/c0d0p2      99M   11M   83M  12% /boot
/dev/cciss/c0d1p1      67G   62G  2.4G  97% /data
none                  2.9G     0  2.9G   0% /dev/shm

and there were still 3 tables in the migration process. I was feeling real panic. Besides, it is Monday morning. The only feasible moment for shutdown is the next weekend or, in case of extreme urgency, until tonight.
Finally, after several hours searching for a solution for the problem in MySQL, I decided to search ways to free space in the filesystem of the operating system. Happily I found a way to reduce the space reserved for root in a ext2 filesystem from the default 5% of the disk size to 1%. The instructions are here. And I don't even have to remount the filesystem. The change was applied inmediately.
I just typed:

[root@usp02 root]# tune2fs -m 1 /dev/cciss/c0d1p1
tune2fs 1.32 (09-Nov-2002)
Setting reserved blocks percentage to 1 (177816 blocks)
[root@usp02 root]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p3      64G   36G   26G  59% /
/dev/cciss/c0d0p2      99M   11M   83M  12% /boot
/dev/cciss/c0d1p1      67G   62G  5.1G  93% /data
none                  2.9G     0  2.9G   0% /dev/shm

So I could get 2.7GB that hopefully will last until I can shutdown MySQL, remove the autoextend from the second innodb file and add a third tablespace in another filesystem with enought free space.

One more thing I don't like about MySQL.

Uff.

Mon premier post en français

| 4 Comments | No TrackBacks
Je m' appelle Miguel. Ma femme s' appelle Aline. J' ai un garçon. Il s' appelle Tristán et il a 1 ans. J' habite à Mexico, en Mexique. Je suis mexicain. J' aime Aline et Tristán. Je suis ingenieur et je parle espagnol, anglais, allemand et un peu français.
Comment allez-vous?

Au revoir!

Je ne comprends pas!

| 1 Comment | No TrackBacks
El lunes anterior inicié mis clases de francés. No sé muchas cosas aún, sólo números y algunas frases sueltas:

un
deux
trois
quatre
cinq

Je ne comprends pas!

Bonjour, je suis Miguel Cobá.

:)

Stand by

| 4 Comments | No TrackBacks
Hoy es domingo, un domingo como tantos, aunque este está nublado y nosotros enfermos. Cansados. Cansados de lo cotidiano y de las fiestas que rompen lo cotidiano. Desveladas, desmañanadas. Cansancio.
Tristán está imparable. Agotador. Ahora que camina es muy difícil aguantarle el paso. Yo tengo gripe, Aline tiene la espalda lastimada. Tristán sigue camine y camine. Hermoso. Y agotador.
En este momento esta en su sillón favorito. Recién acaba de tomar su jugo. Esta "platicando" con su perro de peluche. Aline recostada para aliviar el dolor de su espalda, yo aqui escribiendo.
Estas semanas que han pasado han sido grises. Al menos para mí. No he sentido ganas de hacer nada. Trabajo, curso, transporte público, problemas del trabajo que una vez que cruzas la puerta de salida parecen tan irreales, tan poco merecedoras del estres al que nos sometieron.
Nos mandaron a curso de certificación de una tecnología que no me gusta (es como programar jsp hace 6 años: javascript, html, codigo en una sola página. spaguetti code). Dos semanas de absoluto aburrimiento, desesperación por no aprender algo nuevo, algo INTERESANTE. Además sin internet. Sólo con Windows y sin internet. Es como mi idea del infierno. Al menos estaba instalado el Spider. Pero luego de 30 juegos también es aburrido. Leí 2 libros en ese curso.
Me falta motivación, los libros que comencé a escribir siguen detenidos. Y yo sin ganas de continuarlos. Las tres ideas que tenía para proyectos propios siguen en eso, en ideas.
El tiempo sigue pasando, día tras día, sin detenerse. Sin esperarnos.
Ojalá nos esperara.

Tristán ya camina

| 3 Comments | No TrackBacks
Así es, ayer Tristán, sin ninguna duda, caminó.
No fueron cuatro pasitos, tampoco fue quedarse de pie sin oscilar. No. Caminó de un sillón a otro durante 20 minutos, incansable, emocionado, fantástico.
Tristán caminó el 07/07/2008

:)

En línea (otra vez)

| 1 Comment | No TrackBacks
Bueno, aquí estoy nuevamente. De vuelta insertado en la Matrix.
Mi server fue atacado exitosamente por un script automatizado cuyo vector fueron los comentarios con links. Cuando hicimos click en uno de esos links, un código malicioso instaló algunos archivos php ocultos en el directorio /tmp del server y además, se encargó de sustituir algunos binarios del sistema para ocultar su presencia. En fin. El servidor ya no era confiable así que tuve que reinstalar completo todo.
Generé un respaldo del wordpress, mis datos y todo lo importante y reinstalé.
Ahora estamos usando Movable Type en lugar de Wordpress.
Es distinto. Es difícil acostumbrarse a una nueva plataforma después de usar Wordpress por 2 años. Tiene algunas ventajas: usa PostgreSQL en lugar de MySQL, genera archivos estáticos (previa recompilación del sitio) lo cual permite aguantar una mayor carga de visitantes simultáneos, no usa PHP, sino Perl, tiene OpenID como método para autenticarse al escribir comentarios, entre otras cosas.
Así que aqui andamos de nuevo.

Primer cumpleaños de Tristán

| 2 Comments | No TrackBacks

El pasado 25 de mayo Tristán cumplió un año. Su primer año.

Largo por tantas cosas que pasaron y tan corto porque el tiempo pasa volando.  Muchas cosas ha aprendido, muchas (más de las que merecemos) alegrías nos ha traído. También sustos (varias caídas) y mucho cansancio (es agotador criar a un bebé). Pero nunca habíamos sido tan felices Aline y yo. Eso no lo cambiamos por nada y aguantaríamos muchas veces más lo mismo con tal de verlo reír nuevamente.

Como típicos padres enceguecidos por el amor, para nosotros Tristán es el más hermoso e inteligente de todos los niños. Hace cosas que nos dejan con la boca abierta. Nos impresiona cada día con algo que ni siquiera imaginábamos que sabía. También es notable la manera en que se da a enteder, aún sin poder hablar. Y tiene un carácter tan marcado que a veces nos preocupa. Pero es maravilloso.

Hay tantas cosas que ya sabe hacer que no quiero dejar pasar el tiempo y olvidarlo, así que aquí van:

Sabe qué son y dónde están las siguientes cosas:


  • Mamá

  • Papá

  • Pelota

  • Cabeza

  • Boca

  • Oreja

  • Auto

  • Auto rojo

  • Pingüino

  • Televisión

  • Puerta

  • Calle

  • Plantas

  • Flores (sabe la diferencia entre planta y flor, increible)

  • Árbol

  • Perro

  • Leche

  • Trapito (el trapito que usa para dormir, como Linus el de Charly Brown)

  • Pie

  • Zapato

  • Mano

  • Libros

  • Conejos

  • Ventana


Además, sabe hacer las siguientes cosas:

  • Pasar algo (como "pásame la pelota")

  • Pasarle algo a alguien (como "pásale la pelota a Mamá")

  • Gatear a toda velocidad

  • Caminar sosteniéndose de nuestras manos

  • Subirse a los sillones

  • Bajarse de los sillones y de la cama

  • Subir y bajar escaleras, tanto gateando como sostenido de nuestras manos

  • Soplar (le sopló a su vela de cumpleaños)

  • Le gusta pasar por debajo de túneles (entre las piernas; debajo de las piernas cuando estamos sentados)

  • Empujar sus autos de juguete con su dedito

  • Abrir y hojear sus libros

  • Tocar su xilófono

  • Mover las sillas para abrirse camino

  • Prender y apagar la televisión (también la de la casa de su abuelita)


Finalmente, el día de su cumpleaños se quedó parado sin ayuda durante unos 10 segundos y ayer por la tarde yo lo solté y Aline lo llamó y dio dos pasitos antes de sentarse en el piso. ¡Maravilloso!