RSS Twitter @

Programación


25
Jul 10

CSS2 Trick: Cambiar estilo de un elemento hermano

Las últimas semanas he estado trabajando muchísimo con CSS, Javascript (con Jquery) y XHTML. En el camino me he preguntado si hay formas de realizar ciertas cosas de manera declarativa, es decir, solo escribiendo lo que se debería hacer, sin dar una explicación de cómo hacerlo.
Continue reading →


26
May 09

First report for MPTT on WordPress

This post is a report about my proposal “Implementing MPTT technique for store hierarchical data” on WordPress, at the Google Summer of Code program. If you don’t know the MPTT algorithm, you can read this article.

The plan for this proposal is understand the actual way for get tree data in categories and make the modifications for get/store the tree data. Later, when all has been ready for categories, add the code for pages.

My deliverable will be a plugin with a new Walker class that use MPTT algorithm, some functions for get data from the database, and a few modifications to the core, for attach the plugin functions.

In the last days, I read the code where WordPress has been using the actual way for get/store the tree data. For get that information, I used the phpdoc page of WordPress.

The main class for get tree data is called “Walker“. It have some subclasses that extend the function of Walker class, getting the html code for list categories, pages, etc…:

But, these classes don’t get the data directly from the database. The way for get that data it’s calling the function get_terms (it’s was defined on the line 605, in the file /wp-includes/taxonomy.php) from another functions. These functions are (each function use a subclass of Walker class):

Now, I have an small idea about the actual scenario for get tree data in WordPress, but for to implement the MPTT, I need to modify the database. I add two new columns y the table “wp_terms_taxonomy” called left and right. These colums are for store the data for get the tree with some sql queries.

I wrote a few lines for start my plugin. It have the original get_terms function with a little modifications for get a tree data using the MPTT algorithm.

Old query:

$query = “SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit”;

New query:

$subquery = “SELECT node . * , ( COUNT( parent.term_id ) -1) AS depth
FROM $wpdb->term_taxonomy AS node, $wpdb->term_taxonomy AS parent
WHERE node.left BETWEEN parent.left AND parent.right
GROUP BY node.term_id
ORDER BY node.left”;
$query = “SELECT $select_this FROM ($subquery) AS tt INNER JOIN $wpdb->terms AS t ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit”;

It’s works, but it need some modifications for get the tree data with options (get a sub-tree, show only when is a not empty tree, etc…).

The next step is make a new Walker class for print the tree data of categories.

Note: if my post have a mistake, just let me know for fix it ;) .


12
May 09

How to develop in WordPress using Netbeans

Easy, read configuring Netbeans project for WordPress and download the last beta of Netbeans 6.7 :) .

That’s all folks.


12
May 09

Cómo desarrollar en WordPress usando Netbeans

Fácil, leyendo configurando un proyecto Netbeans para WordPress y bajando la última beta de Netbeans 6.7 :) .

That’s all folks.


9
Nov 06

Programación en Talca

Saludos terrícolas, soy Diego contándoles que mañana me voy a Talca a participar en el campeonato nacional de programación de la ACM, representando al DIICC (Departamento de Ingeniería Informática y Ciencias de la Computación) de la Universidad de Concepción.

El campeonato nacional de programación de la ACM (Chile) se realiza cada año en alguna Universidad de nuestro Chilito lindo, para poder seleccionar al mejor de los mejores en programación/algoritmos/codificación y mandarlo con todas sus petacas al campeonato mundial ACM-ICPC (ACM International Collegiate Programming Contest).

Pero no voy solo… Voy con mi gran equipo conformado por los señores Mauricio Arenas y Rodrigo Torres.

Esperamos ganar, así que cuidado!. Después les cuento como nos fue…


4
Abr 06

Renovando la Bitácora De Letras

Desde el verano que tengo planeada una nueva versión de la Bitácora de letras. No he tenido mucho tiempo extra para cambiar el diseño o agregarle funciones al estilo "web 2.0".

En grandes rasgos lo que hice fue modular el código, crear plantillas para el diseño, además de abstraer la capa de base de datos y plantillas. Todo programado por mí (no todo, pero la gran mayoría, pues el usar adodb + smarty hacía muy lenta la carga de la página). Además logré hacerla funcionar con sqlite y mySQL (así puedo correrla en atenea sin andar rogando una cuenta mysql en el diicc……… ?=)(/&%$·"!··).

Muchas gracias a Rodrigo Linfati por la paciencia de tenerme como usuario de tarro y aguantar mis peticiones durante taaaaanto tiempo.

Saludos!


1
Abr 06

Error al escribir en sqlite

Como algunos saben (alguien sabe?), estoy escribiendo la BitacoraDeLetras (codename xxxx, por ahora :P , no me vayan a registrar el dominio!) para que sea utilizada por mysql y sqlite.

Estaba yo probando probando, hasta que recibo un error como este:

Warning: sqlite_query(): unable to open database file in /home/emcnabb/public_html/mydb/index.php on line 26

14: unable to open database file

El problema no es el hecho de que no se pueda escribir en el archivo (con permisos 666), si no, que no se puede escribir en el directorio donde está algojada la base de datos (sqlite crea unos archivos temporales en el directorio de la base de datos para poder trabajar).

Solución

La solución es darle permisos de escritura al grupo apache al directorio en cuestion, o en su defecto, cambiar los permisos del directorio donde está la base de datos a 777.

Fuente: caché de google.


25
Mar 05

ArchivadorPHP

Acabo de lanzar la versión 0.3 de este mini script :D .

http://chileforge.cl/projects/archivador/