2013-09-03

Gallo has been moved to GitHub

After been using source for my project I have decide to move my two projects to GitHub, and now and available here
Both of them were used for me on some pages in order to have a tool for make web sites on a easily and simple and smarty

2010-01-28

Gallo Released

Gallo is a simple php framework

2009-10-04

Model Library for Codeigniter

I have made a model library for codeigniter. It is based on the article http://maestric.com/doc/php/codeigniter_models


if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Model extends Model {

var $table = "";

function My_Model()
{
parent::Model();
$this->load->database();
}

function find($type = 'all', $options = array())
{
if ($type == 'first')
{
$this->db->limit(1);
}
if(array_key_exists('fields', $options))
{
$this->db->select(implode(",", $options['fields']));
}
if(array_key_exists('where', $options))
{
foreach ($option['where'] as $key=>$value)
{
$this->db->where($key, $value);
}
}
if(array_key_exists('order', $options))
{
foreach ($option['where'] as $key=>$value)
{
$this->db->order_by($key, $value);
}
}
if(array_key_exists('limit', $options))
{
$limit = $options['limit'];
if(array_key_exists('limit', $limit) && !array_key_exists('offset', $limit))
{
$this->db->limit($limit['limit']);
}
if(array_key_exists('limit', $limit) && array_key_exists('offset', $limit))
{
$this->db->limit($limit['limit'], $limit['offset']);
}
}
$query = $this->db->get($this->table);
$result = $query->result_array();
return (count($result) > 0 ? $result[0] : NULL);
}

function find_first($options)
{
return $this->find('first', $options);
}

function find_all($options)
{
return $this->find('all', $options);
}

function find_id($id)
{
if ($id == NULL)
{
return NULL;
}
return $this->find('first', array('where'=>array('id'=>$id)));
}

function insert($data)
{
$this->db->insert($this->table, $data);
return $this->db->insert_id();
}

function update($id, $data)
{
$this->db->where('id', $id);
$this->db->update($this->table, $data);
}

function delete($id)
{
if ($id != NULL)
{
$this->db->where('id', $id);
$this->db->delete($this->table);
}
}
}
?>

2009-09-28

Cómo poner color a tail

Hacer un tail -f para hacer el seguimiento de alguna tarea o proceso, algunas veces no es mucha ayuda, esto debido a la forma de visualizar dicha información. Una forma de mejorar esta tarea es con el comando ccze. Para esto, habrá que instalar dicho programa.


$ sudo aptitude install ccze

Una vez instalado, lo uso ayudándome de un pipe, por ejemplo para ver el log de los daemons.

$ sudo tail -f /var/log/daemon.log | ccze

El resultado, es un tail con colores, que facilita mucho la visualización.

2009-09-17

Cómo convertir flv a mpg

En este cómo doy los pasos para convertir un archivo flv a un archivo mpg usando el programa ffmpeg.

$ sudo apt-get install ffmpeg

Ya instalado el ffmpeg procedo a convertir los archivos flv que deseo, abriendo un terminal y dando como parámetros el archico que deseo convertir y el nombre del archivo mpeg resultante

ffmpeg -i tu_archivo.flv tu_nuevo_archivo.mpeg

Cómo unir varios archivos flv en uno solo

En este cómo estan los pasos para unir varios archivos flv en uno solo con el programa mencoder. Primer instalo mencoder

$sudo aptitude install mencoder

Ahora uno los archivos clip1.flv clip2.flv clip3.flv en uno solo llamado output.flv

mencoder -forceidx -of lavf -oac copy -ovc copy -o output.flv clip1.flv clip2.flv clip3.flv

2009-09-15

Cómo monitorizar el ancho de banda en debian

Este como es muy pequeño, hecho solo para saber el ancho de banda consumido por nuestra interfaz de red. Para ello hay que instalar el ifop:

$ sudo aptitude install iftop

Ahora solo queda ejecutarlo

$ sudo iftop -i eth0