- width
- height
- Padding
- Border
- Margin
jueves, 28 de agosto de 2014
Find all con parametros
$data =Trimestres::model()->findAll((array(
'condition'=>"id_periodo=$_POST[id_periodo]",
'order'=>'id'
)));
'condition'=>"id_periodo=$_POST[id_periodo]",
'order'=>'id'
)));
miércoles, 30 de julio de 2014
montar conexiones remotas
SSH
Para mapear/montar una carpeta de un servidor remoto como lo cal hay que utilizar sshfs, si no lo teneis instalado bastan con ejecutar en debian o derivados:
sudo apt-get install sshfs
Una vez instalado el programa tenemos que crearnos una carpeta en disco donde mapearemos el la ruta del servidor remoto, por ejemplo:
ruta local: /home/depruebas/www/servidor_remoto
En el servidor remoto queremos mapear la ruta:
/var/www/html/mi_proyecto_guay
La instrucción es la siguiente:
sshfs root@servidor.remoto.com:/var/www/html/mi_proyecto_guay /home/depruebas/www/servidor_remoto
Esto crea una carpeta en tu disco con los datos de la ruta del servidor remoto.
Para mapear/montar una carpeta de un servidor remoto como lo cal hay que utilizar sshfs, si no lo teneis instalado bastan con ejecutar en debian o derivados:
sudo apt-get install sshfs
Una vez instalado el programa tenemos que crearnos una carpeta en disco donde mapearemos el la ruta del servidor remoto, por ejemplo:
ruta local: /home/depruebas/www/servidor_remoto
En el servidor remoto queremos mapear la ruta:
/var/www/html/mi_proyecto_guay
La instrucción es la siguiente:
sshfs root@servidor.remoto.com:/var/www/html/mi_proyecto_guay /home/depruebas/www/servidor_remoto
Esto crea una carpeta en tu disco con los datos de la ruta del servidor remoto.
domingo, 27 de julio de 2014
Codigo de NodeBots
var keypress = require('keypress'),
five = require("johnny-five"),
board = new five.Board({
//port: '/dev/cu.itead-DevB'
port: '/dev/cu.usbmodem1411'
});
board.on("ready", function() {
console.log("Testint motors... ");
// motor = new five.Motor({
// pins: {
// pwm: 4,
// dir: 5
// }
// });
motor1Fwd = new five.Led({
pin: 5
});
motor1Rev = new five.Led({
pin: 4
});
motor2Fwd = new five.Led({
pin: 6
});
motor2Rev = new five.Led({
pin: 7
});
board.repl.inject({
motor1Fwd: motor1Fwd,
motor1Rev: motor1Rev,
motor2Fwd: motor2Fwd,
motor2Rev: motor2Rev
});
// make `process.stdin` begin emitting "keypress" events
keypress(process.stdin);
// listen for the "keypress" event
process.stdin.on('keypress', function (ch, key) {
if (key && key.ctrl && key.name == 'c') {
process.exit(0);
}
if ( key ){
switch ( key.name ){
case 'up':
console.log(' => Up: ');
motor1Fwd.on()
motor2Rev.on()
break;
case 'down':
motor2Fwd.on();
motor1Rev.on();
break;
case 'left':
motor1Fwd.off()
motor2Rev.on()
console.log(' => Left: ');
break;
case 'right':
motor1Fwd.on()
motor2Rev.off()
console.log('right');
break;
case 'space':
console.log(' => Stoping...');
motor1Fwd.off();
motor2Fwd.off();
motor1Rev.off();
motor2Rev.off();
break;
default:
console.log('Ignoring key: ' + key.name);
}
}
});
process.stdin.setRawMode(true);
process.stdin.resume();
});
viernes, 13 de junio de 2014
Instalar smartgit en ubuntu
1993 sudo add-apt-repository ppa:eugenesan/ppa
1994 sudo apt-get update
1995 sudo apt-get install smartgit
1996 sudo apt-get install smartgithg
viernes, 6 de junio de 2014
Uso de GIT y github
Instalar GIT
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
Separar la logica de la aplicacion con templates
var source =$("#song-template").html();
undefined
source
"
<span>
{{name}} - {{author}}
</span>
<span class="right">
<a href="" class="action icon-add gray"></a>
<a href="" class="action icon-love gray"></a>
<a href="" class="action icon-share gray"></a>
</span>
"
var template = Handlebars.compile(source);
undefined
var song = new Sfotipy.Song ({ name:"Marinlyn Monroe", author : "Pharell Williams" });
undefined
song.toJSON();
Object {name: "Marinlyn Monroe", author: "Pharell Williams"}
var html = template(song.toJSON());
undefined
var song = new Sfotipy.Song ({ name:"Thuder", author : "ACDC" });
undefined
var song1 = new Sfotipy.Song ({ name:"One", author : "Metallica" });
undefined
var songs = new Sfotipy.Songs([song, song1]);
undefined
songs
child {length: 2, models: Array[2], _byId: Object, constructor: function, model: function…}
songs.at(0);
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
songs.at(0).toJSIN();
TypeError: undefined is not a function
songs.at(0).toJSoN();
TypeError: undefined is not a function
songs.at(0).toJSON();
Object {name: "Thuder", author: "ACDC"}
songs.at(1).toJSON();
Object {name: "One", author: "Metallica"}
song.forEach(function(s){console.log(s.toJSON());});
TypeError: undefined is not a function
songs.forEach(function(s){console.log(s.toJSON());});
Object {name: "Thuder", author: "ACDC"} VM6044:2
Object {name: "One", author: "Metallica"} VM6044:2
[
,
]
child
child
songs.where({name: "One"});
var song = new Sfotipy.Song ({ name:"Thuder", author : "ACDC" });
undefined
var songView = new Sfotipy.SongView({ model: song, el: $(".list")});
undefined
songView.render();
undefined
song.set({name: "Marilyn Monroe", author:"Pharrell Williams"});
child {cid: "c1", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
Suscribirse a:
Entradas (Atom)
