Site mainly dedicated to diffusion of Ruby/RoR, Security, Evolutionary Algorithms and BSD/GNU Linux Operating Systems.
viernes, 20 de febrero de 2009
EJEMPLO DEL ALGORITMO DE EVOLUCION DIFERENCIAL
La evolución diferencial (ED) es un algoritmo evolutivo para la solución de problemas con estas características, empleando un novedoso esquema simple de mutación auto-adaptada.
La ED fue desarrollada por Rainer Storn y Kenneth Price para optimización en espacios continuos.
En la ED, las variables se representan mediante vectores de números reales. La población inicial se genera de forma aleatoria y se seleccionan tres individuos para llevar a cabo la generación de una nueva solución. Uno de ellos es el llamado vector base que se perturba con el vector diferencia de los otros dos vectores. Si el vector resultante es mejor que el padre, entonces lo reemplaza. De otra forma, se retiene al padre al menos una generación más.
La evolución diferencial es una técnica estocástica de búsqueda directa que no requiere calcular derivadas de la función a optimizar. La cual ha demostrado ser un método robusto de búsqueda al ser aplicado en una gran variedad de problemas
el siguiente enlace posee un documento donde se presenta un pequeño ejemplo de como se aplica el algoritmo de evolucion diferencial para una funcion sencilla.
EJEMPLO DE EVOLUCION DIFERENCIAL ESCRITO POR CARLOS MONTERROSA
viernes, 19 de diciembre de 2008
Guia Rapida de Instalacion de IBM Informix Dynamic Server 11.10 en Sun Solaris 10
$ grpadd informix
Posteriormente crearemos el usuario informix
$sudo useradd -g informix -d /usr/informix -s /usr/bin/bash -m informix
-g grupo, -d directorio del home, -s shell y -m usuario
como usuario informix crear un directorio dentro de /usr/informix donde copiaremos el archivo C1221NA.tar que esta disponible en la página de IBM www.ibm.com.
descomprimimos
$gtar -xf C1221NA.tar
ejecutamos el instalador
$./ids_install
configurar los servicios en
$sudo vi /etc/servicesAgregar
sqlexec 9088/tcp # Informix
una vez instalado es necesario tomar los archivos de configuracion por defecto y modificarlos para adecuarlo a las rutas y servidor predeterminados.
$cp /usr/informix/etc/sqlhost.std /usr/informix/etc/sqlhost && vi /usr/informix/etc/sqlhost
$cp /usr/informix/etc/onconfig.std /usr/informix/etc/onconfig && vi /usr/informix/etc/onconfig
#**************************************************************************
#
# Licensed Material - Property Of IBM
#
# "Restricted Materials of IBM"
#
# IBM Informix Dynamic Server
# (c) Copyright IBM Corporation 1996, 2007. All rights reserved.
#
# Title: onconfig.std
# Description: IBM Informix Dynamic Server Configuration Parameters
#
#**************************************************************************
# Root Dbspace Configuration
# Warning: Always verify ROOTPATH before performing
# disk initialization (oninit -i/-iy) to
# avoid disk corruption of another instance
ROOTNAME rootdbs # Root dbspace name
ROOTPATH /dev/informix/rootdbs # Path for device containing root dbspace
ROOTOFFSET 0 # Offset of root dbspace into device (Kbytes)
ROOTSIZE 1058304 # Size of root dbspace (Kbytes)
En las variables ROOTPATH y ROOTSIZE colocamos la ruta y el tamaño donde se alojará el rootdbs
el cual contendrá un enlace simbólico al slide del Disco Duro. En este archivo de configuración también se hace referencia a otros aspectos importantes, como respaldos en cintas, numero de procesadores, etc..
Para saber el nombre del disco duro y el slide
$sudo formatComo ejemplo tomaremos el nombre del disco duro que he utilizado
Ubicamos el enlace simbolico del slide del disco duro
Esta es la ruta real del enlace a la particion del disco duro
$ls -l c1t1d0s0
lrwxrwxrwx 1 root root 47 Dec 16 11:01 c1t1d0s0 -> ../../devices/pci@1f,700000/scsi@2/sd@1,0:a,raw
El enlace simbolico lo creamos de la siguiente manera:
$cd /dev/rdsk/ && ln -s c1t1d0s0 rootdbshacemos lo mismo para:
1.- dblogs
2.- dbtemp
3.- dbdata, dbdata1, dbdata2, dbdata3, dbdata4, dbdata5, dbdata6
preparamos las variables del servidor por defecto en el .profile del
usuario antes de iniciar informix por primera vez.
INFORMIXDIR=/usr/informix
INFORMIXSERVER=boreas_shm
EXPORT INFORMIXDIR INFORMIXSERVER
reiniciamos el profile
$. .profileIniciamos el servidor de Informix (la opcion -iv solo debe ejecutarse cuando se realiza por primera vez)
$oninit -iv
Creamos los dbspaces
$onmonitorel dbspace rootdbs se crea por defecto, por lo que empezaremos a agregar dblogs, dbtemp, dbdata, el tamaño de pagina de 2k, el path /dev/informix/dblogs por ejemplo, el offset de 2k y el tamaño es en bloques de 1024 kbytes, así que es hay que tomar el tamaño que nos da la instruccion format que es en bloques de 512 kbytes y dividirla entre 2. Si utilizaremos más particiones para dbdata, es necesario agregar chunks dentro del menu de onmonitor.
jueves, 30 de octubre de 2008
Como crear un repositorio en una Red Local para Ubuntu 8.04 Hardy Heron (Spanish)
Todo ello se realiza con el objetivo de descargar los paquetes necesarios para la operatividad del sistema, desde cualquier lugar dentro de la red local sin necesidad de una conexión a internet, a excepción de la máquina que será designada como servidor de actualizaciones.
La principal ventaja es que una vez descargado un paquete del repositorio oficial, todas las demás máquinas podran descargarlo a través de la red local, de esta manera no se descargará un paquete más de una vez de los repositorios oficiales.
CONFIGURACIÓN DEL SERVIDOR
1. Instalación de Paquetes
Como es normal, en primer lugar necesitas instalar los paquetes necesarios. En la terminal escribimos:
$sudo apt-get install apt-cacher |
Una vez está hecho, es el momento de empezar la configuración que se encuentra en /etc/apt-cacher/apt-cacher.conf
Configurando Apt-Cacher
2.1. apt-cacher.conf
Una vez abierto el archivo principal de configuración de apt-cacher: /etc/apt-cacher/apt-cacher.conf podemos comenzar a editarlo de acuerdo a las necesidades.
El puerto por defecto y el que estamos utilizando para apt-cacher es el 3142. Si quieres puedes cambiar este valor de acuerdo a tus necesidades.
allowed_hosts: por defecto, todos los host tienen permiso de acceder a tu repositorio cache. Se puedes cambiar este valor si quieres permitir que sólo ciertos host accedan a él. En nuestro caso, le permitimos el acceso a todos
generate_reports: Esta opción hace que apt-cacher cree un informe sobre como de eficiente es tu cache en el uso diario. El valor por defecto es 1, si quieres deshabilitarlo deberás ponerlo a 0
path_map: Esta es una opción interesante. Aquí puedes definir diferentes redirecciones a diferentes repositorios. Para la versión 8.04 de Ubuntu que estamos utilizando, debemos descomentar el path_map y agregar las siguientes lineas, en este caso hacemos referencia a los servidores de México y de seguridad:
# Server mapping - this allows to hide real server names behind virtual paths # that appear in the access URL. This method is known from apt-proxy. This is # also the only method to use FTP access to the target hosts. The syntax is simple, the part of the beginning to replace, followed by a list of mirror urls, all space separated. Multiple profile are separated by semicolons path_map = debian ftp.uni-kl.de/pub/linux/debian ftp2.de.debian.org/debian ; ubuntu archive.ubuntu.com/ubuntu ; security security.debian.org/debian-security ftp2.de.debian.org/debian-security ; ubuntumexico http://mx.archive.ubuntu.com/ubuntu ; seguridad http://security.ubuntu.com/ubuntu |
Ahora, para acceder a un repositorio específico, necesitamos simplemente añadir el nombre del mapeado a nuestro servidor repositorio cache, de esta forma:
Para acceder al repositorio ubuntumexico a través de http://archive:3142/ubuntumexico y al repositorio seguridad a través de http://archive:3142/seguridad
en este caso archive es el nombre de nuestro servidor
2.2. Activando apt-cacher al comienzo
Para arrancar apt-cacher necesitamos activarlo desde /etc/default/apt-cacher. Abre /etc/default/apt-cacher y configura AUTOSTART a 1:
AUTOSTART=1
Ahora reinicia apt-cacher:
$sudo /etc/init.d/apt-cacher restart |
Ahora que apt-cacher arranca, es hora de actualizar el /etc/apt/sources.list de todos tus clientes para que que puedas usar nuestro repositorio cache.
3. Configurando el sources.list de los clientes y el Servidor
Ahora es el momento de configurar el sources.list de los clientes: /etc/apt/sources.list. Es importante utilizar nuestro repositorio cache en el servidor también, ya que, cualquier actualización hecha por el servidor repercutirá en la cache.
Aquí esta el /etc/apt/sources.list original:
#deb cdrom:[Ubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution.
deb http://mx.archive.ubuntu.com/ubuntu/ hardy main restricted deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy main restricted
## Major bug fix updates produced after the final release of the ## distribution. deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates main restricted deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://mx.archive.ubuntu.com/ubuntu/ hardy universe deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy universe deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates universe deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://mx.archive.ubuntu.com/ubuntu/ hardy multiverse deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy multiverse deb http://mx.archive.ubuntu.com/ubuntu/ hardy-updates multiverse deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-updates multiverse
## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse # deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is ## offered by Canonical and the respective vendors as a service to Ubuntu ## users. # deb http://archive.canonical.com/ubuntu hardy partner # deb-src http://archive.canonical.com/ubuntu hardy partner
deb http://security.ubuntu.com/ubuntu hardy-security main restricted deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted deb http://security.ubuntu.com/ubuntu hardy-security universe deb-src http://security.ubuntu.com/ubuntu hardy-security universe deb http://security.ubuntu.com/ubuntu hardy-security multiverse deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse |
Para utilizar nuestro repositorio cache, necesitamos cambiar las líneas en color rojo.
# deb cdrom:[Ubuntu 8.04 _Hardy Heron_ - Release i386 (20080423)]/ hardy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution.
deb http://archive:3142/ubuntumexico hardy main restricted deb-src http://archive:3142/ubuntumexico hardy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://archive:3142/ubuntumexico hardy-updates main restricted deb-src http://archive:3142/ubuntumexico hardy-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://archive:3142/ubuntumexico hardy universe deb-src http://archive:3142/ubuntumexico hardy universe deb http://archive:3142/ubuntumexico hardy-updates universe deb-src http://archive:3142/ubuntumexico hardy-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://archive:3142/ubuntumexico hardy multiverse deb-src http://archive:3142/ubuntumexico hardy multiverse deb http://archive:3142/ubuntumexico hardy-updates multiverse deb-src http://archive:3142/ubuntumexico hardy-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse # deb-src http://mx.archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is ## offered by Canonical and the respective vendors as a service to Ubuntu ## users. # deb http://archive.canonical.com/ubuntu hardy partner # deb-src http://archive.canonical.com/ubuntu hardy partner
deb http://archive:3142/seguridad hardy-security main restricted deb-src http://archive:3142/seguridad hardy-security main restricted
deb http://archive:3142/seguridad hardy-security universe deb-src http://archive:3142/seguridad hardy-security universe
deb http://archive:3142/seguridad hardy-security multiverse deb-src http://archive:3142/seguridad hardy-security multiverse |
Bien, ahora, cada cliente debe ser capaz de descargar los paquetes .deb desde nuestro repositorio cache:
$sudo apt-get update |
debe ser ejecutado en cada cliente.
4. Importando los paquetes desde /var/cache/apt/archives/ al repositorio apt-cacher
Puede que tu servidor ya tenga una gran cantidad de paquetes en su cache local: /var/cache/apt/archives/. apt-cacher ofrece una herramienta para importar estos archivos al repositorio de apt-cacher.
Hay unos scripts muy útiles que se encuentran en /usr/share/apt-cacher/. El que nos interesa es apt-cacher-import.pl. Para importar archivos .deb desde /var/cache/apt/archives al repositorio de to apt-cacher ejecuta:
$sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives
Debe ejecutarse como root o los archivos .deb no serán copiados a nuestro repositorio cache
Ahora, en el directorio /var/cache/apt-cacher/packages/ habrá unos cuantos paquetes.
5. Obteniendo el informe de uso del repositorio cache
Si dejas la opción generate_reports configurada a 1, apt-cacher generará un informe de uso diario de la cache.
Podrás acceder a él en la dirección:
http://archive:3142/report |
Si necesitas regenerar el informe, ejecuta:
$sudo /usr/share/apt-cacher/apt-cacher-report.pl |
Dudas o comentarios a:
cmonterrosa@sef-chiapas.gob.mx
Más informacion:
http://www.debuntu.org/how-to-set-up-a-repository-cache-with-apt-cacher
viernes, 3 de octubre de 2008
METODOS NUMERICOS EN RUBY (in Spanish)
He trabajado con algunos de los más elementales métodos numéricos para la solución de ecuaciónes lineales en ruby, a diferencia de C++, los scripts hechos en ruby, se enfocan más a la lógica del problema, hacen sentir cómodo al programador, y tienen una potencia muy significativa,
"ha tomado lo mejor de varios lenguajes tales como pearl, smalltalk y lisp."
Comparto lo siguiente con ustedes, Los links siguientes contienen los archivos fuente.
Comentarios o dudas
cmonterrosa@sef-chiapas.gob.mx
miércoles, 27 de agosto de 2008
Using Git Fast Version Control in Windows
An official definition from http://git.or.cz/ says:
Git is an open source version control system designed to handle very large projects with speed and efficiency, but just as well suited for small personal repositories; it is especially popular in the open source community, serving as a development platform for projects like the Linux Kernel, Ruby on Rails, WINE or X.org.
Yesterday I downloaded a version from windows in order to try Sproutcore Demos, a link is above, but remember git is multiplataform. I tried on Sun Solaris and the performance is excellent.
http://www.cygwin.com/setup.exe
a guide with the basic commands is on
http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
sábado, 12 de julio de 2008
SproutCore, a new Javascript framework for building web applications!

Sproutcore makes building javascript applications fun and easy, It's the alternative against Microsoft Silverlight and Adobe Flex. Sproutcore it's like Cocoa, have the style, the mark and the support from Apple. Sproutcore is a new Javascript framework that it's similar to Objective-C and Cococa. Objective-C is the lenguage of programming that it's the basis of he most of Apple's MacOSX applications.
Visit the sproutcore official site, you can see demos and documentation
Carlos Monterrosa
carlos@monterrosa.com.mx
lunes, 30 de junio de 2008
Ruport, Creating Reports with Ruby on Rails
A simple, extensible reporting system for Ruby on Rails
It's amazing and easy to use. Only you need download the gem since rubyforge with the next command:gem install ruport
previously yo need to install Ruby for Win, Linux or MacOSX, after that you need to have Rails installed (gem install rails -v VERSION_YOU_NEED) for example
gem install rails -v 1.2.6
I recommend use Rails 1.2.6 and NetBeans like IDE. It's the perfect partner for create a great website!!
Comments and doubts you can send me an email in
carlos@monterrosa.com.mx
see you in the next post!
references
[1] Ruport.- http://rubyreports.org/