jueves, 22 de agosto de 2013

Where is php.ini located?

The simplest way to find php.ini:

find / -name php.ini

How-To Create A MySQL Database And Set Privileges To A User

Install mysql:

1. apt-get install mysql-server

2. $ mysql -u root -p
Enter password:

3. mysql > create database amarokdb;
Query OK, 1 row affected (0.00 sec)

4.mysql > grant usage on *.* to amarokuser@localhost identified by ‘amarokpasswd’;
Query OK, 0 rows affected (0.00 sec)

5.mysql > grant all privileges on amarokdb.* to amarokuser@localhost ;
Query OK, 0 rows affected (0.00 sec)

6.$ mysql -u amarokuser -p’amarokpasswd’ amarokdb

Source: http://www.debuntu.org/how-to-create-a-mysql-database-and-set-privileges-to-a-user/

Install mysql php ubuntu

Install mysql

$ apt-get install apache2
$ apt-get install mysql-server
$ apt-get install php5
$ apt-get install libapache2-mod-php5
$ apt-get install php5-gd
$ apt-get install php5-dom
$ apt-get install php5-pgsql
$ apt-get install php5-mysql


* Mysql con PHP5

Cómo ver todas las contraseñas guardadas en Chrome

Cómo ver todas las contraseñas guardadas en Chrome

chrome://settings/passwords

Uploading Files With Secure Copy (SCP)

You can upload files to the server using the following syntax:

scp SourceFile user@host:directory/TargetFile

miércoles, 12 de junio de 2013

mysql create utf8 database

mysql create utf8

 database CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;

viernes, 7 de junio de 2013

jueves, 6 de junio de 2013

How To Restore MySQL database

How To Restore MySQL database

 # mysql -u root -ptmppassword mysql > create database sugarcrm;
Query OK, 1 row affected (0.02 sec)

 # mysql -u root -ptmppassword sugarcrm > /tmp/sugarcrm.sql

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

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

lunes, 20 de mayo de 2013

How do I make a semi transparent background? - css3


use rgba()

.transparent{
background:rgba(255,255,255,0.5);
}
This will give u 50% opacity while the content of the box will continue to have 100% opacity.

How to install mail in ubuntu server

How to install mail in ubuntu:

apt-get install sendmail-bin

 sudo sendmailconfig

martes, 14 de mayo de 2013

Codeigniter's url_title() change UTF8 Characters to specified Latin


Just tie into the convert_accented_characters function:

$this->load->helper('text');
url_title(convert_accented_characters('čolić'));

CodeIgniter global variable

It's not necessary to use global variable in codeigniter, you can do this:

class MY_Controller extends Controller {
  var $data;    
  //constructor function            
}

class Contact extends Controller { //to.. }

class Contact extends MY_Controller {
 $this->load->view('contact_view', $this->data);
}

lunes, 6 de mayo de 2013

Apache Restart / Stop


Restart Apache 2 web server, enter:

# /etc/init.d/apache2 restart

If you are using Ubuntu use sudo:

$ sudo /etc/init.d/apache2 restart

To stop Apache 2 web server, enter:

# /etc/init.d/apache2 stop

$ sudo /etc/init.d/apache2 stop

To start Apache 2 web server, enter:

# /etc/init.d/apache2 start

$ sudo /etc/init.d/apache2 start

domingo, 5 de mayo de 2013

Downloading file from my server to my local


To download the file "serials.txt" from your remote home dir to the local computer:

scp user@server.com:serials.txt .

To download the remote file "something" using it's full path to your local computer:

scp user@server.com:/path/to/file/something.txt .

Now the tricky part: using the recursive switch (-r) to download a whole folder to your local computer. The issue you may have is that you DO NOT place a trailing forward slash after the directory name. For instance, this command will NOT work (notice the bold forward slash):

scp -r user@server.com:/path/to/directory/ .

This will give you a message saying the server is trying to write to the parent directory. REMOVE the last foward slash on the path and try again. The next command is CORRECT:

scp -r user@server.com:/path/to/directory .

I have been using a period when talking about downloading so far. Reason: this brings the file into the directory you are currently in. If you wish to take the last command and download it to somewhere else, the command would be:

scp -r user@server.com:/path/to/directory /new/local/location/

jueves, 25 de abril de 2013

How to remove all .svn directories from my application directories

find . -name .svn -exec rm -rf {} \;

Before running a command like that, I often like to run this first:

find . -name .svn -exec ls {} \;

Apuntes subversion

# Entramos con root al servidor e instalamos el paquete de subversion
apt-get install subversion

# Creamos una carpeta para guardar los repositorios
mkdir -p /srv/subversion

# Accedemos a la carpeta y creamos un repositorio llamado 'pruebas'
cd /srv/subversion/
svnadmin create pruebas

# Editamos la configuracion del nuevo repositorio
vi /srv/subversion/pruebas/conf/svnserve.conf

# Modificamos las lineas
# anon-access = read
# auth-access = write

por:

anon-access = none
auth-access = write

y descomentamos la de:

# password-db = passwd

# Creamos los usuarios que tendran acceso al repositorio
vi /srv/subversion/pruebas/conf/passwd

# Iniciamos el servicio
svnserve -d -r /srv/subversion/ &

# Ahora tenemos corriendo un servicio que sirve la carpeta /srv/subversion
# y todos los repositorios que existan en ella
# la url para acceder será: svn://IP_DE_LA_MAQUINA/NOMBRE_REPOSITORIO
#
# en mi caso: svn://servidor/pruebas

# Bajamos el codigo en el portatil y ya podemos trabajar
svn co svn://servidor/pruebas /var/www/pruebas/

# Cre una carpeta y un fichero y los envio
cd /var/www/pruebas/
mkdir trunk
svn add trunk
svn commit -m 'Creando el trunk'

# Y a trabajar!!!!

martes, 23 de abril de 2013

Como saber que programas tengo instalados en mi ubuntu


Fácil, vez a consola y ejecuta:

dpkg --get-selections | grep -v deinstall

Si la lista es larga y quieres puedes generar un archivo por ejecplo en tu ruta por defecto, tu home:

dpkg --get-selections | grep -v deinstall > paquetes-instalados-en-ubuntu



...espera! quieres la lista más completa y con fechas???

prueba esto:

cat /var/log/dpkg.log | grep "status installed"

Diferencia entre apt-get update y apt-get upgrade


Seguramente, muchas veces hemos usado:
# apt-get update
# apt-get upgrade
Pero, ¿qué hace cada orden o comando?

Cuando nosotros utilizamos #apt-get update, lo que en realidad estamos haciendo es actualizar los repositorios --ver si hay algo nuevo--, es decir actualizar la lista de todos los paquetes, con la dirección de dónde obtenerlos para que a la hora de hacer la búsqueda y su posterior descarga, sea más rápida.

En cambio, cuando utilizamos #apt-get upgrade, lo que hacemos es una actualización de nuestro sistema con todas las posibles actualizaciones que pudiera haber, es decir no sólo actualiza nuestro sistema operativo sino que también las aplicaciones que están contenidas en los repositorios.

En resumen: el update lista los paquetes de los repositorios y el upgrade instala las actualizaciones.

Entradas populares