jueves, 6 de junio de 2013

How To Backup MySQL database

How To Backup MySQL database

backup:

# mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql 

restore:

# mysql -u root -p[root_password] [database_name] > dumpfilename.sql

martes, 4 de junio de 2013

How can I change the default width of a Twitter Bootstrap modal box?

body .modal-admin {
 /* new custom width */
 width: 750px;
 /* must be half of the width, minus scrollbar on the left (30px) */
 margin-left: -375px; }

jueves, 30 de mayo de 2013

Guardar imagen en codeigniter


public function guardarImagen($object){

$directorio = IMG_PATH.'/'.$object->directorio.'/';
$nombre_imagen = $object->nombre_imagen;
$ext = $object->ext;
$field_name = $object->field_name;

$config['upload_path'] = $directorio;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '15000';
$config['encrypt_name'] = FALSE;
$config['overwrite'] = FALSE;
$config['file_name'] = $nombre_imagen.'.'.$ext;
$this->load->library('upload');
$this->upload->initialize($config);

$data = array();
if(!$this->upload->do_upload($field_name)){
$this->upload->display_errors();
}else{
$data = $this->upload->data();
}
return $data;
}

martes, 28 de mayo de 2013

jQuery Validate img - add method


Create / add a new method:

jQuery.validator.addMethod("imgType", function(value, element) {
var extension = value.substr( (value.lastIndexOf('.') +1) );
    if(extension=='jpg' || extension=='gif' || extension=='png'){
    return true;
}else{
return false;
}
}, "=$this->lang->line('error_img')?>");

rules:{
   inputImg: {required:true,imgType:true}

}

domingo, 26 de mayo de 2013

viernes, 24 de mayo de 2013

How to do a google static map - tool

How to do a google static map:

You can use Google static map tool for creating maps.

Use multiple custom fonts using @font-face?

You only have to include diferents @font-face


@font-face {
    font-family: CustomFont;
    src: url('CustomFont.ttf');
}

@font-face {
    font-family: CustomFont2;
    src: url('CustomFont2.ttf');
}

miércoles, 22 de mayo de 2013

Actualizar página en codeigniter


Cambiando las cabeceras conseguimos que se refresque la página sin tener que forzar una recarga de nuestro navegador.

$this->output->set_header("HTTP/1.0 200 OK");
$this->output->set_header("HTTP/1.1 200 OK");
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");

martes, 21 de mayo de 2013

Google maps in codeigniter


 CodeIgniter Google Maps API V3 Class

 Displays a Google Map

 @package CodeIgniter
 @subpackage Libraries
 @category Libraries
 @author BIOSTALL (Steve Marks)
 @link http://biostall.com/codeigniter-google-maps-v3-api-library
 @docs http://biostall.com/wp-content/uploads/2010/07/Google_Maps_V3_API_Documentation.pdf

Entradas populares