This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1)Modificamos el config/environment.rb: | |
Rails::Initializer.run do |config| | |
config.gem 'will_paginate', :version => '~> 2.3.15', :source => 'http://gemcutter.org' | |
2) en el controlador: | |
@arrDatos = Modelo.paginate(:all, :per_page =>10, :page => params[:page]) | |
3) en la vista: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION int_to_text(INT4) RETURNS TEXT AS ' | |
SELECT textin(int4out($1)); | |
' LANGUAGE SQL STRICT IMMUTABLE; | |
CREATE CAST (INT4 AS TEXT) | |
WITH FUNCTION int_to_text(INT4) | |
AS IMPLICIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cid=1000 | |
vzctl set ${cid} --vmguarpages 512M --save | |
vzctl set ${cid} --oomguarpages 512M --save | |
vzctl set ${cid} --privvmpages 512M:1024M --save | |
#Fuente: http://www.linux-os.com.ar/linuxos/como-ampliar-la-memoria-de-un-contenedor-openvz-add-memory-to-a-container-openvz/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install sqlite3-ruby | |
require 'sqlite3' | |
db=SQLite3::Database.new('bdprueba.db'); | |
db.execute("SELECT sqlite_version()") do |reg| | |
puts "SQLite version: #{reg[0]}" | |
end | |
db.close |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Nota: Se deben sustituir los RAISE por INSERT en las tablas de auditoria | |
CREATE OR REPLACE FUNCTION auditoria() RETURNS TRIGGER | |
AS $aud$ | |
DECLARE | |
inst TEXT; | |
old_v TEXT; | |
new_v TEXT; | |
metadata_record RECORD; | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the ruby version | |
# * the branch/status of the current git repository | |
# * the branch of the current subversion repository | |
# * the return value of the previous command | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys 437D05B5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION proteger_datos() RETURNS TRIGGER AS $proteger_datos$ | |
DECLARE | |
BEGIN | |
-- | |
-- Esta funcion es usada para proteger datos en un tabla | |
-- No se permitira el borrado de filas si la usamos | |
-- en un disparador de tipo BEFORE / row-level | |
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Instalacion de Servidor LAMP en Debian/Ubuntu | |
#William Yanez ([email protected]) @wryanez | |
aptitude install -y apache2 apache2-doc | |
aptitude install -y php5 php5-cli php5-common php5-dev php5-mysql | |
aptitude install -y mysql-server | |
#Habilitar soporte para postgres y sqlite3 | |
#aptitude install -y php5-pgsql php5-sqlite3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script para respaldo de las VM con VirtualBox | |
# William Yanez - 07/2012 | |
VM_RUNNING=$(VBoxManage list runningvms | wc -l) | |
if [ $VM_RUNNING -gt 0 ]; then | |
echo "Error: Hay $VM_RUNNING VM's Activas" | |
VBoxManage list runningvms | |
exit |