<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Segmentation Fault! &#187; Software</title>
	<atom:link href="http://www.segmentationfault.es/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.segmentationfault.es</link>
	<description>La formulación de un problema es más importante que su solución.</description>
	<lastBuildDate>Tue, 29 Jun 2010 19:45:33 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to backup your server to Amazon S3</title>
		<link>http://www.segmentationfault.es/2010/06/how-to-backup-your-server-to-amazon-s3/</link>
		<comments>http://www.segmentationfault.es/2010/06/how-to-backup-your-server-to-amazon-s3/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 19:39:27 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[7z]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[s3cmd]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=1725</guid>
		<description><![CDATA[This post is a HowTo about backups to Amazon S3 using some tools like 7z, s3cmd and a couple of bash scripts.]]></description>
			<content:encoded><![CDATA[<p>Since a few months ago I&#8217;m taking care of three ubuntu servers with different services like svn, mysql, websites, etc. and for sure I want to provide a flexible, secure and cheap backup system to my customers.</p>
<p>I started playing around with <a href="http://s3tools.org/s3cmd" target="_blank">s3cmd</a> command line utility and I realize that is really powerful so, I decide to write my own scripts to be able to backup automatically all the important files of my servers to the cheaper and easy to use <a href="http://aws.amazon.com/s3/" target="_blank">Amazon S3</a> service.</p>
<p>The whole system is based on two bash scripts, the crontab and a few extra applications like <a href="http://p7zip.sourceforge.net/" target="_blank">7zip</a> and s3cmd. I will explain step by step how I build up the system and at the end I&#8217;ll provide the full code of the scripts.</p>
<h4>Requirements</h4>
<p>The first step is to be sure that you have installed the 7zip and s3cmd tools, in my case I&#8217;m using ubuntu so, for me the command to install the tools is:</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install p7zip s3cmd
</pre>
<h4>Basic setup</h4>
<p>Now we can follow with the basic setup, I created a folder in the root of the filesystem called backups, the inside this folder I create serveral folders, at the end the structure is like follow:</p>
<pre class="brush: bash; title: ; notranslate">
/backups
    /compressed
    /data
        /db
        /svn
        /www
    /scripts
</pre>
<p>The compressed folder is used at the end of the script to compress all the files to one .7z file, in the data folder we will copy the information we want to backup and in the scripts folder we will store as it&#8217;s name says the two scripts we will use.</p>
<h4>Backup script</h4>
<p>Now, let&#8217;s have a look at those scripts. The first one is to do the backup, in my case I&#8217;m doing a backup of the subversion, mysql and files under /var/www.</p>
<p>The script starts with the following block:</p>
<pre class="brush: bash; title: ; notranslate">
echo `date '+%F %T'`: Starting the backup

#Dumping the repos
echo `date '+%F %T'`: Starting the dump of the repos
for i in /user/local/svn/*/; do
    repo=`basename $i`
    echo `date '+%F %T'`: Dumping repo $repo
    /usr/bin/svnadmin dump /usr/local/svn/$repo &gt; /backups/data/svn/$repo.dump
    echo `date '+%F %T'`: Repo $repo dumped
done
</pre>
<p>We suppose that the svn folder is located at /usr/local/svn, basically here we are going through each folder inside /usr/local/svn/ and we call svnadmin dump to dump that repository in one file, that file is stored in /backups/data/svn/.</p>
<pre class="brush: bash; title: ; notranslate">
#Dumping the DB
echo `date '+%F %T'`: Starting the dump of the DataBases
for i in /var/lib/mysql/*/; do
    db=`basename $i`
    echo `date '+%F %T'`: Dumping DB $db
    /usr/bin/mysqldump -uroot -p$db_password $db &gt; /backups/data/db/$db.sql
    echo `date '+%F %T'`: Database $db dumped
done
</pre>
<p>In this second block we are doing more or less the same thing, we are going through each folder on /var/lib/mysql/ and calling mysqldump to export each DB in one file stored at /backups/data/db/.</p>
<pre class="brush: bash; title: ; notranslate">
#Copy all the websites
echo `date '+%F %T'`: Starting the dump of websites
for i in /var/www/*/; do
    site=`basename $i`
    echo `date '+%F %T'`: Dumping site $site
    /usr/bin/7z a -mx6 -t7z /backups/data/www/$site.7z -p$compression_password /var/www/$site
    echo `date '+%F %T'`: Site $site dumped
done
</pre>
<p>In the third block we are dumping the websites, I have the websites stored at /var/www folder and each site is inside a folder with the domain as folder name. Basically we are doing the same, loop through /var/www/ and compressing each site individually in a .7z file with a compression level of 6 and secured with a password.<br />
I store each site in a separate file because if I have to restore a site I don&#8217;t need to uncompress all the sites, just the main file and then the compressed site.<br />
I was playing with different compression levels and 6 is the most suitable to maintain a good compression ratio without wasting a lot of time.</p>
<pre class="brush: bash; title: ; notranslate">
#Compressing all the data
echo `date '+%F %T'`: Compressing the info
filename=$(date +%Y%m%d)
/usr/bin/7z a -mx6 -t7z /backups/compressed/$filename.7z -p$password /backups/data/*
echo `date '+%F %T'`: Info compressed
</pre>
<p>Now with all the information we want to backup in place we will compress all together in one single file, that&#8217;s the purpose of this block of code, the final filename is a timestamp of today using the date command.</p>
<pre class="brush: bash; title: ; notranslate">
#Upload to Amazon S3
echo `date '+%F %T'`: Uploading to Amazon S3
/usr/bin/s3cmd put --no-progress /backups/compressed/$filename.7z s3://BUCKET_NAME/$filename.7z
echo `date '+%F %T'`: Upload completed
</pre>
<p>Ok, we have the compressed file and one of the final steps is upload this file to Amazon S3. For that task we are using the s3cmd tool passing the parameter &#8211;no-progress to avoid an &#8220;interactive&#8221; output of the upload status.</p>
<pre class="brush: bash; title: ; notranslate">
#Delete the local backups
echo `date '+%F %T'`: Cleaning up
rm -Rf /backups/data/svn/*
rm -Rf /backups/data/db/*
rm -Rf /backups/data/www/*
rm -Rf /backups/compressed/*
echo `date '+%F %T'`: Clean completed
echo `date '+%F %T'`: Backup completed
</pre>
<p>And the final block of code is just a clean up, after the upload to amazon we delete all the files we have generated inside the /backups folder.</p>
<p>Ok, seems complex but is pretty strightforward, also if you take a look you&#8217;ll see that all the messages contains a timestamp, with that information we are able to determine how many time we spend in each task.<br />
One disadvantage of this script is that we are not checking if the file was uploaded correctly to Amazon, maybe this will be a future improvement.</p>
<h4>Maintenance script</h4>
<p>Now let&#8217;s take a look at the other script, the purpose is just delete old backups based on a timestamp, in my case we&#8217;re storing the backups for one month, it&#8217;s very affordable with the Amazon prices. </p>
<pre class="brush: bash; title: ; notranslate">
for filename in `s3cmd ls s3://$bucket`; do
    if [[ $filename =~ ([0-9]*)\.7z ]]; then
        timestamp=${BASH_REMATCH[1]}
        echo `date '+%F %T'` - Reading metadata of: $filename
        echo -e &quot;\tFilename: $filename&quot;
        echo -e &quot;\tTimestamp: $timestamp&quot;
        if [[ $timestamp -le $limit ]]; then
            let &quot;total=total+1&quot;
            echo -e &quot;\tResult: Backup deleted\n&quot;
            /usr/bin/s3cmd del $filename
        else
            echo -e &quot;\tResult: Backup keeped\n&quot;
        fi
    fi
done
</pre>
<p>This is the only code block we have in the maintenance script, the idea is to retrieve the list of files we have in the bucket with s3cmd, then we check if the gived part contains the pattern ([0-9]*)\.7z (because the command s3cmd ls gives more information rather than just the filenames).<br />
If we detect a segment that matches the regex we get the filename without the extension (the timestamp of the backup), and we check in this case if the timestamp is older than one month (the timestamp of one month ago is stored in the $limit variable). If the backup is older we remove it calling the s3cmd del command.</p>
<p>If you need to store the files more time just change the $limit variable and that&#8217;s it.</p>
<p>Wow, seems a large process, ok, now let&#8217;s have a look at the last step to let this work, the cronjobs.<br />
I created to cronjobs and redirected the output of them to the stdout because I want to receive an email after the backup, my crontab look like this:</p>
<pre class="brush: bash; title: ; notranslate">
# m h  dom mon dow   command
MAILTO=YOUR_EMAIL_ADDRESS_HERE
00 22 * * * /backups/scripts/s3backup 2&gt;&amp;1
00 23 * * * /backups/scripts/s3backup-maintenance 2&gt;&amp;1
</pre>
<p>Just put there the values you want to run the crons and don&#8217;t forget to put at the end 2>&#038;1.</p>
<h4>Conclusion</h4>
<p>With this system you&#8217;ll have your backups in a safe and cheap place without headaches and with a full report in you email every time the script runs. For sure these scripts can be impoved with a few checks and you can extend it to fit your needs.<br />
I hope you have enjoyed this HowTo and begin to use this scripts! For sure improvements are welcomed, don&#8217;t hesitate to comment!.</p>
<h4>Source code</h4>
<p>Grab the full source code of the <a href="http://pastie.textmate.org/1023939" target="_blank">backup script</a> and the <a href="http://pastie.textmate.org/1023947" target="_blank">maintenance script</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2010/06/how-to-backup-your-server-to-amazon-s3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Instalar Subversion Server en Ubuntu</title>
		<link>http://www.segmentationfault.es/2009/11/subversion-server-ubuntu/</link>
		<comments>http://www.segmentationfault.es/2009/11/subversion-server-ubuntu/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 15:07:23 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[Sistemas Operativos]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[comando]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=1325</guid>
		<description><![CDATA[Subversion es un sistema de control de versiones ideado para reemplazar al popular CVS. Subversion nos permite entre muchas otras cosas mantener versiones antiguas de ficheros y poder trabajar de manera colaborativa sin pisar el trabajo de otros.

En este tutorial vamos a ver como instalar el servidor de subversion en una maquina ubuntu.]]></description>
			<content:encoded><![CDATA[<p>Subversion es un sistema de control de versiones ideado para reemplazar al popular CVS. Subversion nos permite entre muchas otras cosas mantener versiones antiguas de ficheros y poder trabajar de manera colaborativa sin pisar el trabajo de otros.</p>
<p>En este tutorial vamos a ver como instalar el servidor de subversion en una maquina ubuntu.</p>
<p>Para ello el primer paso es instalar los paquetes necesarios</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install subversion libapache2-svn subversion-tools
</pre>
<p>Creamos la carpeta para guardar los ficheros</p>
<pre class="brush: bash; title: ; notranslate">
sudo mkdir /home/&lt;user&gt;/svn
</pre>
<p>Editamos el fichero de configuración</p>
<pre class="brush: bash; title: ; notranslate">
sudo nano /etc/apache2/mods-enabled/dav_svn.conf
</pre>
<p>Hay que modificar el archivo hasta que se parezca a esto</p>
<pre class="brush: bash; title: ; notranslate">
# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.# &lt;location URL&gt; ... &lt;/location&gt;
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
&lt;location /svn&gt;
# Uncomment this to enable the repository,
DAV svn
# Set this to the path to your repository
SVNParentPath /home/&lt;user&gt;/svn

# The following allows for basic http authentication.  Basic authentication
# should not be considered secure for any particularly rigorous definition of
# secure.
# to create a passwd file
# # rm -f /etc/apache2/dav_svn.passwd
# # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
# New password:
# Re-type new password:
# Adding password for user dwhedon
# #
# Uncomment the following 3 lines to enable Basic Authentication
 AuthType Basic
 AuthName &quot;Subversion Repository Access&quot;
 AuthUserFile /etc/apache2/dav_svn.passwd
 Require valid-user
# Uncomment the following line to enable Authz Authentication
# AuthzSVNAccessFile /etc/apache2/dav_svn.authz
# The following three lines allow anonymous read, but make
# committers authenticate themselves.
#&lt;limitexcept GET PROPFIND OPTIONS REPORT&gt;
#Require valid-user
#&lt;/limitexcept&gt;
&lt;/location&gt;
</pre>
<p>Creamos el fichero de usuarios y claves</p>
<pre class="brush: bash; title: ; notranslate">
sudo htpasswd -cm /etc/apache2/dav_svn.passwd &lt;username&gt;
</pre>
<p>Usamos este comando si queremos añadir mas usuarios</p>
<pre class="brush: bash; title: ; notranslate">
sudo htpasswd /etc/apache2/dav_svn.passwd &lt;another username&gt;
</pre>
<p>Reiniciamos apache</p>
<pre class="brush: bash; title: ; notranslate">
sudo /etc/init.d/apache2 restart
</pre>
<p>Creamos la carpeta que contendrá el proyecto</p>
<pre class="brush: bash; title: ; notranslate">
sudo mkdir -p /home/&lt;user&gt;/svn/&lt;project&gt;
</pre>
<p>Creamos el repositorio</p>
<pre class="brush: bash; title: ; notranslate">
sudo svnadmin create /home/&lt;user&gt;/svn/&lt;project&gt;
</pre>
<p>Conectamos al subversion localmente y creamos las carpetas Trunk, Tags y Branches</p>
<pre class="brush: bash; title: ; notranslate">
sudo svn mkdir file:///home/&lt;user&gt;/svn/&lt;project&gt;/trunk -m &quot;Trunk&quot;
sudo svn mkdir file:///home/&lt;user&gt;/svn/&lt;project&gt;/tags -m &quot;Tags&quot;
sudo svn mkdir file:///home/&lt;user&gt;/svn/&lt;project&gt;/branches -m &quot;Branches&quot;
</pre>
<p>Otorgamos permisos a apache</p>
<pre class="brush: bash; title: ; notranslate">
sudo chown -R www-data.www-data /home/&lt;user&gt;/svn
</pre>
<p>Navegamos a la carpeta /etc/init.d, creamos un fichero llamado init-svnserve y lo abrimos con nano para editarlo</p>
<pre class="brush: bash; title: ; notranslate">
cd /etc/init.d/
sudo touch init-svnserve
sudo nano init-svnserve
</pre>
<p>En el fichero añadimos esta linea</p>
<pre class="brush: bash; title: ; notranslate">
svnserve -d -r /home/&lt;user&gt;/svn
</pre>
<p>Damos permisos de ejecución al fichero</p>
<pre class="brush: bash; title: ; notranslate">
sudo chmod +x init-svnserve
</pre>
<p>Actualizamos el arranque del sistema para que detecte el nuevo fichero</p>
<pre class="brush: bash; title: ; notranslate">
sudo update-rc.d init-svnserve defaults
</pre>
<p>Reiniciamos el servidor y todo funcionando!</p>
<pre class="brush: bash; title: ; notranslate">
sudo shutdown -r now
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/11/subversion-server-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.10 (Karmic Koala)</title>
		<link>http://www.segmentationfault.es/2009/10/ubuntu-9-10-karmi-koala/</link>
		<comments>http://www.segmentationfault.es/2009/10/ubuntu-9-10-karmi-koala/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 14:55:54 +0000</pubDate>
		<dc:creator>Noemí Losada</dc:creator>
				<category><![CDATA[Sistemas Operativos]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[software libre]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=1292</guid>
		<description><![CDATA[Ya está aquí el nuevo Ubuntu Karmic Koala y trae consigo novedades tan interesantes como las que destacamos aquí:
Podemos obtener Ubuntu desde: http://www.ubuntu.com/getubuntu]]></description>
			<content:encoded><![CDATA[<p>Ya está aquí el nuevo <a href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> Karmic Koala y trae consigo novedades tan interesantes como las que destacamos aquí:</p>
<p><a href="http://www.segmentationfault.es/wp-content/2009/10/logo-Ubuntu1.png"><img class="aligncenter size-full wp-image-1316" title="logo-Ubuntu" src="http://www.segmentationfault.es/wp-content/2009/10/logo-Ubuntu1.png" alt="logo-Ubuntu" width="373" height="97" /></a></p>
<ul>
<li><strong>Ubuntu Software Center</strong> →Substituye a la aplicación &#8220;Agregar y quitar&#8221; del menú Aplicaciones.</li>
<li><strong>Gnome 2.28</strong> → Nueva versión del entorno de escritorio.</li>
<li><strong>Empathy</strong> → El cliente de mensajería Empathy substituye a Pidgin.</li>
<li><strong>Quickly</strong> → Permite a los desarrolladores más facilidades para la creación de aplicaciones en Ubuntu y compartir los archivos a través de paquetes .deb entre otros.</li>
<li><strong>Kernel</strong> → 2.6.31-14.48 <a href="http://kernel.org/">kernel</a> basado en 2.6.31.1.</li>
<li><strong>Grub 2 </strong>→ El gestor de arranque substituye a Grub Legacy. Sólo podremos hacer uso de él desde Karmic Koala y no podremos actualizar desde otras versiones al tratarse de una operación arriesgada.</li>
<li><strong>Ubuntu One → </strong>2Gb de almacenamiento gratuito online y la facilidad de compartir archivos ya sea con ordenadores propios o con los de otros. Por un precio a bajo costo podemos ampliar esta capacidad.</li>
</ul>
<p>Para más información acerca del Ubuntu 9.10 ir a: <a href="http://www.ubuntu.com/products/whatisubuntu/910features" target="_blank">http://www.ubuntu.com/products/whatisubuntu/910features</a></p>
<p>Podemos obtener Ubuntu desde: <a href="http://www.ubuntu.com/getubuntu" target="_blank">http://www.ubuntu.com/getubuntu</a></p>
<p><script src="http://www.ubuntu.com/files/countdown/display.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/10/ubuntu-9-10-karmi-koala/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Algoritmos genéticos – Creando a nuestros ciudadanos</title>
		<link>http://www.segmentationfault.es/2009/09/algoritmos-geneticos-ciudadanos/</link>
		<comments>http://www.segmentationfault.es/2009/09/algoritmos-geneticos-ciudadanos/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 21:00:36 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[algoritmos genéticos]]></category>
		<category><![CDATA[hello world]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=1138</guid>
		<description><![CDATA[En esta segunda parte vamos a crear la clase que va a representar a nuestros ciudadanos, recordad que por cuestiones prácticas vamos a utilizar php y por si no habéis leído el post anterior sobre la teoría de algoritmos genéticos aquí os dejo el enlace. Una vez dicho esto pasemos a la acción. ]]></description>
			<content:encoded><![CDATA[<p>En esta segunda parte vamos a crear la clase que va a representar a nuestros ciudadanos, recordad que por cuestiones prácticas vamos a utilizar php y por si no habéis leído el post anterior sobre la teoría de algoritmos genéticos <a href="http://www.segmentationfault.es/2009/08/algoritmos-geneticos-teoria/" target="_blank">aquí os dejo el enlace</a>. Una vez dicho esto pasemos a la acción.</p>
<p>En primer lugar nuestra clase ciudadano va a necesitar guardar dos valores referentes al ciudadano al que representa, el primer dato será el material genético a guardar y el segundo caso el fitness actual del ciudadano, para ello emplearemos dos variables privadas ya que queremos controlar exactamente que se almacena en estas variables. Por lo tanto para poder manipular y ver estos datos vamos a necesitar los respectivos setters/getters.</p>
<p>Por último necesitaremos crear una función para calcular el fitness del ciudadano.</p>
<p>El fitness va muy ligado al problema a resolver, en nuestro caso como estamos desarrollando un Hello World el algoritmo va a tratar de llegar a una string objetivo a partir de una string aleatoria, con lo cuál una buena función de fitness debe atorgar una puntuación mas alta o baja dependiendo de lo cerca que estemos del objetivo. En mi caso voy a calcular la distancia entre las letras de la cadena objetivo y la cadena del ciudadano actual.</p>
<p>Atención, no me estoy refiriendo a la distancia Levenshtein. La distancia Levenshtein es el número mínimo de operaciones requeridas para transformar la cadena A en la cadena B, por ejemplo si tenemos la cadena &#8220;Manzana&#8221; y queremos conseguir &#8220;Manzanas&#8221; la distancia Levenshtein será 1.</p>
<p>Nuestra función de fitness para calcular lo bueno que es nuestro ciudadanos  va a sumar la diferencia carácter a carácter entre la string objetivo y la string actual a partir del número correspondiente ASCII de los caracteres. Es decir, entre la letra &#8220;A&#8221; (número 65 en la tabla ASCII) y la letra &#8220;P&#8221; (número 80 en la tabla ASCII) nuestra función debería retornar el número 15. Por lo tanto si tenemos la cadena &#8220;Manzana&#8221; y la cadena &#8220;Manzano&#8221; nuestra función retornará 14.</p>
<p>Cabe destacar que para que el algoritmo funcione correctamente hay que establecer unas cuantas limitaciones, de momento debemos establecer que las strings siempre van a ser del mismo tamaño, es decir en el momento de comparar las strings en nuestra función de fitness vamos a suponer que las strings miden lo mismo.</p>
<p>Por otra parte también quiero hacer notar que en el constructor de la clase inicializamos los datos de las variables, el fitness a -1 y el string a vacío.</p>
<p>Sin mas dilaciones aquí os dejo el código completo de nuestra clase Citizen.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class Citizen{

 private $data;
 private $fitness;

 public function __construct(){
   $this-&gt;data = '';
   $this-&gt;fitness = -1;
 }

 public function getData(){
   return $this-&gt;data;
 }

 public function setData($newData = NULL){
   try{
     if(!is_null($newData)){
     $this-&gt;data = $newData;
     }
   }catch(Exception $e){
     die($e-&gt;getMessage());
   }
 }

 public function getFitness(){
   return $this-&gt;fitness;
 }

 public function setFitness($newFitness = NULL){
   try{
     if(!is_null($newFitness)){
     $this-&gt;fitness = $newFitness;
     }
   }catch(Exception $e){
     die($e-&gt;getMessage());
   }

 }

 public function calculateFitness($objective = NULL){
   try{
     if(is_null($objective)){
       throw new Exception('Error, no se ha especificado objetivo');
     }

     $fitness = 0;
     for($x=0;$x&lt;strlen($objective);$x++){
       $fitness += abs(ord($objective[$x]) - ord($this-&gt;data[$x]));
     }

     $this-&gt;setFitness($fitness);
   }catch(Exception $e){
     die($e-&gt;getMessage());
   }

 }

}

?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/09/algoritmos-geneticos-ciudadanos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Algoritmos genéticos &#8211; Teoría</title>
		<link>http://www.segmentationfault.es/2009/08/algoritmos-geneticos-teoria/</link>
		<comments>http://www.segmentationfault.es/2009/08/algoritmos-geneticos-teoria/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 13:52:54 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[algoritmos genéticos]]></category>
		<category><![CDATA[crossover]]></category>
		<category><![CDATA[hello world]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=1074</guid>
		<description><![CDATA[Esta primera parte de una serie de artículos sobre algoritmos genéticos (GA por sus siglas en inglés). Principalmente voy a tratar de explicar en este post el fundamento teorico (de manera muy básica) del funcionamiento de este tipo de algoritmos.]]></description>
			<content:encoded><![CDATA[<p>Después de unos días me he decidido a postear esta primera parte de una serie de artículos sobre algoritmos genéticos (GA por sus siglas en inglés). Principalmente voy a tratar de explicar en este post el fundamento teórico (de manera muy básica) del funcionamiento de este tipo de algoritmos. Después en los siguientes posts crearemos un ejemplo de GA utilizando como siempre nuestro amado Hello World!</p>
<p>Los algoritmos genéticos o GA se utilizan básicamente para realizar búsquedas en un espacio de soluciones amplias y con muchos máximos y mínimos locales, generalmente en funciones no derivables o de derivación muy compleja. Cabe destacar que el hecho de utilizar un GA no implica hallar la solución óptima puesto que la búsqueda puede converger prematuramente en un mínimo o máximo local y no poder encontrar el máximo/mínimo general.</p>
<p>Algunos ejemplos de uso de este tipo de algoritmos son:</p>
<ul>
<li>Diseño automatizado de sistemas de comercio en el sector financiero.</li>
<li>Optimización de carga de contenedores.</li>
<li>Diseño de topologías de circuitos impresos.</li>
<li>Aprendizaje de comportamiento de robots.</li>
<li>Infraestructura de redes de comunicaciones móviles.</li>
<li>Predicción.</li>
<li>Aplicaciones en planificación de procesos industriales.</li>
<li>Construcción de horarios en grandes universidades, evitando conflictos de clases.</li>
<li>Optimización de producción y distribución de energía eléctrica.</li>
</ul>
<p>Los GA se inspiran en la evolución biológica para realizar la búsqueda creando una analogía entre el conjunto de soluciones de un problema, llamado fenotipo, y el conjunto de individuos de una población natural, codificando la solución del problema en forma binaria, u otro tipo de codificación, en una cadena llamada cromosoma. Cada símbolo que conforma el cromosoma es un gen.</p>
<p>La búsqueda de la solución óptima del problema se realiza mediante iteraciones llamadas generaciones, en cada generación se realiza una serie de operaciones sobre los cromosomas o ciudadanos de la población.</p>
<p>Ahora vamos a ver el proceso que sigue un algoritmo genético para buscar una solución:</p>
<ol>
<li>Generamos aleatoriamente los ciudadanos (cromosomas) que van a conformar nuestra <strong>población inicial</strong>.</li>
<li>Realizamos una <strong>evaluación</strong> (fitness) de los ciudadanos para saber que tan &#8220;buena&#8221; es la solución.</li>
<li>Verificamos si debemos acabar la ejecución del algoritmo ya sea mediante el número máximo de generaciones o habiendo encontrado la solución óptima ya sea con tolerancia o no.</li>
<li>Una vez conocemos la calidad de nuestros ciudadanos <strong>seleccionamos</strong> a los mejores para reproducirlos.</li>
<li>Aplicamos <strong>operadores genéticos </strong>ya sea el de cruzamiento u otros para reproducir a los mejores ciudadanos y obtener descendencia de estos.</li>
<li>Aplicamos <strong>operadores de mutación</strong> para ampliar la zona de búsqueda no cubierta por los ciudadanos actuales.</li>
<li><strong>Reemplazamos</strong> la generación actual con la descendencia recién obtenida de los mejores ciudadanos.</li>
</ol>
<p>El proceso se repite ejecutando los pasos del 2 al 7 hasta encontrar la solución o llegar al máximo de generaciones. A modo de apunte cabe destacar que hay diferentes métodos de selección tales como el elitismo, la ruleta de selección, etc. Por otra parte también existen diferentes métodos de reproducción tales como crossover sexual, asexual, etc.</p>
<p>Más adelante y para no hacer más denso este post,  explicaré detalladamente cada punto de los vistos aquí.</p>
<p>Una vez visto esto y con una pequeña idea del funcionamiento de los GA construiremos nuestro GA Hello World, para ello utilizaremos PHP (la explicación es extensible a otros lenguajes tales como C) ya que al ser interpretado nos permitirá cambiar valores sin necesidad de recompilar el GA cada dos por tres. La programación de este GA esta realizada mediante POO con lo cuál el próximo post se basará en crear la primera clase necesaria que representará al cromosoma o ciudadano.</p>
<p>Evidentemente cuando un GA se va a utilizar en alguna aplicación se desarrolla en un lenguaje que se pueda compilar para ganar velocidad y minimizar los recursos ya sea C, C++, Java, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/08/algoritmos-geneticos-teoria/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Instalar y configurar Nano en Ubuntu y MacOS X</title>
		<link>http://www.segmentationfault.es/2009/07/instalar-y-configurar-nano-en-ubuntu-y-macos-x/</link>
		<comments>http://www.segmentationfault.es/2009/07/instalar-y-configurar-nano-en-ubuntu-y-macos-x/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 21:52:09 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Trucos]]></category>
		<category><![CDATA[comando]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Sistemas Operativos]]></category>
		<category><![CDATA[software libre]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=987</guid>
		<description><![CDATA[Nano es un editor de ficheros por terminal, nos puede ser muy util sobretodo si tenemos que editar ficheros en un servidor o maquina remota mediante una conexión SSH. Aparentemente puede parecer muy sencillo pero tiene algunas características que lo hacen muy potente como las búsquedas por expresiones regulares, coloreado de sintaxis, etc.]]></description>
			<content:encoded><![CDATA[<p>Después de mucho tiempo sin actividad volvemos a la carga con este post, hoy voy a explicar como instalar y configurar Nano en Ubuntu y MacOS, el apartado de instalación difiere dependiendo del sistema operativo utilizado, en Mac OS por ejemplo nano ya viene instalado por defecto, en ubuntu deberemos ejecutar un comando en el terminal en caso de que no venga instalado y en el resto de sistemas operativos cada uno tendrá su propio método de instalación.</p>
<p>Nano es un editor de ficheros por terminal, nos puede ser muy util sobretodo si tenemos que editar ficheros en un servidor o maquina remota mediante una conexión SSH. Aparentemente puede parecer muy sencillo pero tiene algunas características que lo hacen muy potente como las búsquedas por expresiones regulares, coloreado de sintaxis, etc.</p>
<p>Actualmente nano viene instalado o se puede instalar en aquellos sistemas operativos que son compatibles con UNIX como Linux, BSD o MacOS X incluso existe en la web oficial una versión para Windows utilizando las herramientas Cygwin. En principio suele venir ya pre-instalado, como es el caso de MacOS X o Ubuntu Desktop pero en otros sistemas operativos como Ubuntu server será necesario instalarlo desde el terminal o algún programa de gestión de paquetes.</p>
<p><strong>Cómo instalar Nano</strong></p>
<p>Para instalar nano desde el terminal en sistemas Debian basta con ejecutar este comando:</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install nano
</pre>
<p>Como he comentado antes en el sistema operativo MacOS X nano ya viene pre-instalado así que no hará falta hacer nada para tenerlo.</p>
<p><strong>Configuración de nano<br />
</strong></p>
<p>La configuración de nano es extremadamente sencilla, solo debemos editar un fichero de configuración. La ruta a este fichero puede variar dependiendo del sistema operativo, en el caso de Ubuntu y MacOS X lo podremos encontrar en /etc/nanorc.</p>
<p>Para proceder a editarlo podemos ejecutar este comando en el terminal:</p>
<pre class="brush: bash; title: ; notranslate">
sudo nano /etc/nanorc
</pre>
<p>Básicamente nos encontraremos con tres casos, el primero es que no exista el fichero con lo cuál lo crearemos, el segundo caso es que el fichero este vacío y el último caso es que el fichero venga con contenido por defecto. En este último caso solo tendremos que ir descomentando las líneas que nos interesen, en los otros dos casos simplemente escribimos las líneas de configuración que queremos utilizar.</p>
<p>Aquí debajo podremos encontrar una muestra de cómo puede ser el fichero nanorc.</p>
<pre class="brush: bash; title: ; notranslate">
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read!  Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
##
## To make sure a value is disabled, use &quot;unset &quot;.
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
##
## Quotes inside string parameters don't have to be escaped with
## backslashes.  The last double quote in the string will be treated as
## its end.  For example, for the &quot;brackets&quot; option, &quot;&quot;')&gt;]}&quot; will match
## &quot;, ', ), &gt;, ], and }.

## Use auto-indentation.
# set autoindent

## Backup files to filename~.
# set backup

## The directory to put unique backup files in.
# set backupdir &quot;&quot;

## Do backwards searches by default.
# set backwards

## Use bold text instead of reverse video text.
# set boldtext

## The characters treated as closing brackets when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
##
# set brackets &quot;&quot;')&gt;]}&quot;

## Do case sensitive searches by default.
# set casesensitive

## Constantly display the cursor position in the statusbar.  Note that
## this overrides &quot;quickblank&quot;.
# set const

## Use cut to end of line by default.
# set cut

## Set the line length for wrapping text and justifying paragraphs.
## If fill is 0 or less, the line length will be the screen width less
## this number.
##
# set fill -8

## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

## The opening and closing brackets that can be found by bracket
## searches.  They cannot contain blank characters.  The former set must
## come before the latter set, and both must be in the same order.
##
# set matchbrackets &quot;(&lt; [{)&gt;]}&quot;

## Use the blank line below the titlebar as extra editing space.
# set morespace

## Enable mouse support, if available for your system.  When enabled,
## mouse clicks can be used to place the cursor, set the mark (with a
## double click), and execute shortcuts.  The mouse will work in the X
## Window System, and on the console when gpm is running.
##
# set mouse

## Allow multiple file buffers (inserting a file will put it into a
## separate buffer).  You must have configured with --enable-multibuffer
## for this to work.
##
# set multibuffer

## Don't convert files from DOS/Mac format.
# set noconvert

## Don't follow symlinks when writing files.
# set nofollow

## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp

## Don't add newlines to the ends of files.
# set nonewlines

## Don't wrap text at all.
# set nowrap

## Set operating directory.  nano will not read or write files outside
## this directory and its subdirectories.  Also, the current directory
## is changed to here, so any files are inserted from this dir.  A blank
## string means the operating directory feature is turned off.
##
# set operatingdir &quot;&quot;

## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve

## The characters treated as closing punctuation when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
##
# set punct &quot;!.?&quot;

## Do quick statusbar blanking.  Statusbar messages will disappear after
## 1 keystroke instead of 26.  Note that &quot;const&quot; overrides this.
##
# set quickblank

## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string.  Default:
# set quotestr &quot;^([     ]*[#:&gt;\|}])+&quot;
## if you have extended regular expression support, otherwise:
# set quotestr &quot;&gt; &quot;

## Fix Backspace/Delete confusion problem.
# set rebinddelete

## Fix numeric keypad key confusion problem.
# set rebindkeypad

## Do extended regular expression searches by default.
# set regexp

## Make the Home key smarter.  When Home is pressed anywhere but at the
## very beginning of non-whitespace characters on a line, the cursor
## will jump to that beginning (either forwards or backwards).  If the
## cursor is already at that position, it will jump to the true
## beginning of the line.
# set smarthome

## Use smooth scrolling as the default.
# set smooth

## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
# set speller &quot;aspell -x -c&quot;

## Allow nano to be suspended.
# set suspend

## Use this tab size instead of the default; it must be greater than 0.
# set tabsize 8

## Convert typed tabs to spaces.
# set tabstospaces

## Save automatically on exit, don't prompt.
# set tempfile

## Disallow file modification.  Why would you want this in an rcfile? <img src='http://www.segmentationfault.es/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
# set view

## The two single-column characters used to display the first characters
## of tabs and spaces.  187 in ISO 8859-1 (0000BB in Unicode) and 183 in
## ISO-8859-1 (0000B7 in Unicode) seem to be good values for these.
# set whitespace &quot;  &quot;

## Detect word boundaries more accurately by treating punctuation
## characters as parts of words.
# set wordbounds

## Color setup
##
## Format:
##
## syntax &quot;short description&quot; [&quot;filename regex&quot; ...]
##
## The &quot;none&quot; syntax is reserved; specifying it on the command line is
## the same as not having a syntax at all.  The &quot;default&quot; syntax is
## special: it takes no filename regexes, and applies to files that
## don't match any other syntax's filename regexes.
##
## color foreground,background &quot;regex&quot; [&quot;regex&quot;...]
## or
## icolor foreground,background &quot;regex&quot; [&quot;regex&quot;...]
##
## &quot;color&quot; will do case sensitive matches, while &quot;icolor&quot; will do case
## insensitive matches.
##
## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
## For foreground colors, you may use the prefix &quot;bright&quot; to get a
## stronger highlight.
##
## To use multi-line regexes, use the start=&quot;regex&quot; end=&quot;regex&quot;
## [start=&quot;regex&quot; end=&quot;regex&quot;...] format.
##
## If your system supports transparency, not specifying a background
## color will use a transparent color.  If you don't want this, be sure
## to set the background color to black or white.
##
## If you wish, you may put your syntaxes in separate files.  You can
## make use of such files (which can only include &quot;syntax&quot;, &quot;color&quot;, and
## &quot;icolor&quot; commands) as follows:
##
## include &quot;/path/to/syntax_file.nanorc&quot;
##
## Unless otherwise noted, the name of the syntax file (without the
## &quot;.nanorc&quot; extension) should be the same as the &quot;short description&quot;
## name inside that file.  These names are kept fairly short to make
## them easier to remember and faster to type using nano's -Y option.
##
## All regexes should be extended regular expressions.

## Key bindings
## Please see nanorc(5) for more details on this
##
## Here are some samples to get you going
##
# bind M-W nowrap main
# bind M-A casesens search
# bind ^S research main

## Set this if your backspace key sends delete most of the time (2.1.3+)
# bind kdel backspace all

## Nanorc files
# include &quot;@PKGDATADIR@/nanorc.nanorc&quot;

## C/C++
# include &quot;@PKGDATADIR@/c.nanorc&quot;

## Cascading Style Sheets
# include &quot;@PKGDATADIR@/css.nanorc&quot;

## Debian files
# include &quot;@PKGDATADIR@/debian.nanorc&quot;

## Gentoo files
# include &quot;@PKGDATADIR@/gentoo.nanorc&quot;

## HTML
# include &quot;@PKGDATADIR@/html.nanorc&quot;

## PHP
# include &quot;@PKGDATADIR@/php.nanorc&quot;

## TCL
# include &quot;@PKGDATADIR@/tcl.nanorc&quot;

## TeX
# include &quot;@PKGDATADIR@/tex.nanorc&quot;

## Quoted emails (under e.g. mutt)
# include &quot;@PKGDATADIR@/mutt.nanorc&quot;

## Patch files
# include &quot;@PKGDATADIR@/patch.nanorc&quot;

## Manpages
# include &quot;@PKGDATADIR@/man.nanorc&quot;

## Groff
# include &quot;@PKGDATADIR@/groff.nanorc&quot;

## Perl
# include &quot;@PKGDATADIR@/perl.nanorc&quot;

## Python
# include &quot;@PKGDATADIR@/python.nanorc&quot;

## Ruby
# include &quot;@PKGDATADIR@/ruby.nanorc&quot;

## Java
# include &quot;@PKGDATADIR@/java.nanorc&quot;

## AWK
# include &quot;@PKGDATADIR@/awk.nanorc&quot;

## Assembler
# include &quot;@PKGDATADIR@/asm.nanorc&quot;

## Bourne shell scripts
# include &quot;@PKGDATADIR@/sh.nanorc&quot;

## POV-Ray
# include &quot;@PKGDATADIR@/pov.nanorc&quot;

## XML-type files
# include &quot;@PKGDATADIR@/xml.nanorc&quot;
</pre>
<p>Básicamente las líneas que deberíamos descomentar son las siguientes:</p>
<p><span style="text-decoration: underline;">set const</span> (Esta funcionalidad muestra constantemente la posición del cursor file/columna en el cuadro de abajo)<br />
<span style="text-decoration: underline;">set mouse</span> (Habilita el uso del ratón para poder seleccionar texto, pegarlo y demás)<br />
<span style="text-decoration: underline;">set rebinddelete</span> (Configura el botón de borrar como acción borrar y no suprimir como puede venir en algunos sistemas)<br />
<span style="text-decoration: underline;">set smooth</span> (Mejora el salto del texto al hacer scroll)<br />
<span style="text-decoration: underline;">set tabsize 2</span> (Especificamos el numero de columnas que va a ocupar una tabulación)<br />
<span style="text-decoration: underline;">set tabstospaces</span> (Especificamos que el programa debe utilizar espacios en lugar de tabulaciones, muy útil si modificamosficheros YAML)</p>
<p>Y además también descomentamos todos los includes que hay al final del fichero (solo en sistemas linux, no sirve en MacOS X) para poder activar el coloreado del texto dependie<span><span style="margin-left: 0px ! important;">ndo del tipo de fichero. Como podréis comprobar la línea <em>set tabsize 2</em> es la línea <em>set tabsize 8</em> en el fichero de arriba, además de descomentarla le hemos modificado el tamaño de 8 a 2.</span></span></p>
<p><span><span style="margin-left: 0px ! important;">Una vez realizados todos estos cambios pulsamos las teclas Ctrl+X escribirmos &#8220;Y&#8221; y pulsamos Enter.</span></span></p>
<p><span><span style="margin-left: 0px ! important;">Ahora al abrir un fichero ANSI C por ejemplo podremos ver que nos muestra algo similar a esto.</span></span></p>
<p><div id="attachment_992" class="wp-caption aligncenter" style="width: 464px"><a href="http://www.segmentationfault.es/wp-content/2009/07/Imagen-1.png"><img class="size-full wp-image-992 " title="Editor NANO" src="http://www.segmentationfault.es/wp-content/2009/07/Imagen-1.png" alt="Imagen 1" width="454" height="322" /></a><p class="wp-caption-text">Fichero ANSI C abierto en nano después de configurarlo</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/07/instalar-y-configurar-nano-en-ubuntu-y-macos-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Guía básica de Subversion</title>
		<link>http://www.segmentationfault.es/2009/05/guia-subversion/</link>
		<comments>http://www.segmentationfault.es/2009/05/guia-subversion/#comments</comments>
		<pubDate>Sun, 31 May 2009 17:03:26 +0000</pubDate>
		<dc:creator>Noemí Losada</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[comandos]]></category>
		<category><![CDATA[software libre]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=890</guid>
		<description><![CDATA[Subversion es un software open source, para el trabajo en equipo, que consiste en un sistema de control de versiones. Los usuarios conectados a internet o a una red local pueden participar intercambiando modificaciones de los archivos. Todas las modificaciones se guardan en un servidor común creando un historial de todos los cambios por lo que nos permite recuperar cualquier versión si nos equivocamos.]]></description>
			<content:encoded><![CDATA[<p><strong>¿Qué es Subversion?</strong></p>
<p>Subversion es un software open source, para el trabajo en equipo, que consiste en un sistema de control de versiones. Los usuarios conectados a internet o a una red local pueden participar intercambiando modificaciones de los archivos. Todas las modificaciones se guardan en un servidor común creando un historial de todos los cambios por lo que nos permite recuperar cualquier versión si nos equivocamos. Cuando un usuario realiza una modificación sólo tiene que subirla para que el resto de usuarios puedan descargar la nueva información.</p>
<p>Podéis descargar Subversion en <a href="http://subversion.tigris.org/" target="_blank">http://subversion.tigris.org/</a></p>
<p>Aquí os dejamos una lista de los comandos más utilizados:</p>
<p><strong>Descargar un proyecto:</strong></p>
<p>En primer lugar nos situamos en el directorio dónde vayamos a descargar el proyecto (<em>cd directorio</em>) y escribimos: <em></em></p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn checkout https://servidorsvn/ruta/proyecto
</pre>
<p>*Podemos escribir <em>co </em>en lugar de <em>commit.</em><br />
<strong>Actualizar una copia en local:</strong></p>
<p>Para descargarnos la última versión escribimos:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn update
</pre>
<p>Si sólo queremos actualizar un directorio:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn -N update
</pre>
<p>Si queremos actualizar un fichero:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn update fichero
</pre>
<p>Si queremos actualizar una determinada versión:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn update -r número_de_versión
</pre>
<p>*Podemos escribir <em>up </em>en lugar de <em>update.</em></p>
<p><span style="color: #ff6600;"><span style="color: #000000;"><strong>Subir modificaciones al servidor:</strong></span></span></p>
<p><span style="color: #ff6600;"><span style="color: #000000;">Para subir los cambios que hayamos realizado al servidor debemos escribir:</span></span></p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn commit -m &quot;Explicación_de_los_cambios_realizados&quot;
</pre>
<p>*Podemos escribir <em>ci </em>en lugar de <em>commit.</em></p>
<p><span style="color: #ff6600;"><span style="color: #000000;"><strong>Eliminar, añadir y mover un directorio o fichero:</strong></span></span></p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn remove fichero_o_directorio
</pre>
<p>*Podemos escribir <em>rm </em>en lugar de <em>remove.</em></p>
<p>Añadir un fichero o un directorio:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn add directorio
</pre>
<p>Si queremos añadir también los subdirectorios escribimos:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn add -R directorio
</pre>
<p>Si queremos mover un fichero o directorio escribimos:</p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn move fichero_de_origen fichero_de_destino
</pre>
<p><strong>Mostrar ayuda general de Subversion:</strong></p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn help
</pre>
<p><strong>Comprobar el estado de la copia en local:</strong></p>
<pre class="brush: bash; title: ; toolbar: false; notranslate">
svn status
</pre>
<p>Este comando nos mostrará por ejemplo qué archivos falta añadir, si han sido modificados localmente, eliminados o si existe algún conflicto.</p>
<p><span style="text-decoration: underline;">Más información en:</span></p>
<p><a href="http://subversion.tigris.org/" target="_blank">http://subversion.tigris.org/</a></p>
<p><a href="http://es.wikipedia.org/wiki/Subversion" target="_blank">http://es.wikipedia.org/wiki/Subversion</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/05/guia-subversion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows 7 Review</title>
		<link>http://www.segmentationfault.es/2009/05/windows-7/</link>
		<comments>http://www.segmentationfault.es/2009/05/windows-7/#comments</comments>
		<pubDate>Wed, 06 May 2009 11:02:29 +0000</pubDate>
		<dc:creator>Christopher Vallés</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Sistemas Operativos]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[seguridad]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=755</guid>
		<description><![CDATA[Microsoft lanzó ayer la versión Beta RC (Release Candidate) de su novedoso Windows 7 que reemplazará al nefasto Windows Vista. Esta versión beta se asemeja o debería asemejarse bastante a la versión RTM (ReleaseTo Manufacturing). Siguiendo el camino de Windows Vista se espera que la nueva versión del sistema operativo salga en diferentes ediciones dependiendo del uso que le vamos a dar.]]></description>
			<content:encoded><![CDATA[<p>Microsoft lanzó ayer la versión Beta RC <em>(Release Candidate)</em> de su novedoso Windows 7 que reemplazará al nefasto Windows Vista. Esta versión beta se asemeja o debería asemejarse bastante a la versión RTM <em>(ReleaseTo Manufacturing)</em>. Siguiendo el camino de Windows Vista se espera que la nueva versión del sistema operativo salga en diferentes ediciones dependiendo del uso que le vayamos a dar.</p>
<p><div id="attachment_756" class="wp-caption alignleft" style="width: 205px"><a href="http://www.segmentationfault.es/wp-content/2009/05/cx1_photo1.jpg"><img class="size-full wp-image-756" title="CRAY CX" src="http://www.segmentationfault.es/wp-content/2009/05/cx1_photo1.jpg" alt="CRAY CX" width="195" height="165" /></a><p class="wp-caption-text">Superordenador CRAY CX</p></div></p>
<p>Los puntos que destaca Microsoft sobre este nuevo Windows es que no necesitará un ordenador del estilo CRAY para funcionar, es decir, &#8220;supuestamente&#8221; en un PC normalito debería correr perfectamente y que han solucionado la gran mayoría de incompatibilidades que presenta Vista con el hardware de otros fabricantes, para ello han inventado el Windows XP Mode.</p>
<p>El Windows XP mode permite arrancar el ordenador con Windows XP, según ellos, una máquina virtual completa. Este modo estará disponible preinstalado en las versiones más profesionales (y más caras, evidentemente) o mediante descarga desde su web.</p>
<p>Windows 7 ha heredado de su hermano menor Vista la plataforma e implementaciones de seguridad que, según Microsoft, fué el mayor avance conseguido hasta el momento (cuestionable por muchos otros).</p>
<p><div id="attachment_773" class="wp-caption alignright" style="width: 250px"><a href="http://www.segmentationfault.es/wp-content/2009/05/screenshot_pinned1.jpg"><em><img class="size-full wp-image-773" title="Toolbar" src="http://www.segmentationfault.es/wp-content/2009/05/screenshot_pinned1.jpg" alt="Barra de tareas al mas puro estilo KDE" width="240" height="88" /></em></a><p class="wp-caption-text">Barra de tareas al mas puro estilo KDE</p></div></p>
<p>Entre las nuevas funcionalidades y mejoras también podemos encontrar una barra de tareas más grande, a algunos os recordará al entorno KDE, así como una lista de acciones más frecuentes. Han implementado esquinas activas al puro estilo Macintosh, si ponemos el ratón en la esquina inferior derecha las ventanas que tengamos abiertas se volverán transparentes dejando a la vista el escritorio. Windows Search está más integrado en el sistema y consume menos recursos, con él podremos buscar dentro de documentos, correos electrónicos, etc. Windows 7 también integra por defecto Internet Explorer 8 que, según ellos, se podrá desinstalar completamente (yo hasta que no lo vea no me lo creo)&#8230; También han mejorado el panel de control consiguiendo una mejor integración del centro de impresión y del administrador de dispositivos. Por otra parte han integrado toda una tecnología al mismísimo estilo iPhone.</p>
<p><div id="attachment_774" class="wp-caption alignleft" style="width: 250px"><a href="http://www.segmentationfault.es/wp-content/2009/05/screenshot_opaque2.jpg"><img class="size-full wp-image-774" title="Active Rounds Opaque" src="http://www.segmentationfault.es/wp-content/2009/05/screenshot_opaque2.jpg" alt="Antes de usar las esquinas activas" width="240" height="152" /></a><p class="wp-caption-text">Antes de usar las esquinas activas</p></div></p>
<p><div id="attachment_776" class="wp-caption alignleft" style="width: 250px"><a href="http://www.segmentationfault.es/wp-content/2009/05/screenshot_clear.jpg"><img class="size-full wp-image-776" title="Active Rounds Clear" src="http://www.segmentationfault.es/wp-content/2009/05/screenshot_clear.jpg" alt="Usando las esquinas activas" width="240" height="152" /></a><p class="wp-caption-text">Usando las esquinas activas</p></div></p>
<p>Como podemos observar Microsoft hace esfuerzos por ponerse a la altura del mercado, tanto iPhone como Macintosh y Linux han revolucionado el mercado e instaurado nuevas funcionalidades que para muchos ya son imprescindibles, como las esquinas activas, y evidentemente en el mundo de la informática o te pones al día o pierdes muchos usuarios.</p>
<p>A mi manera de ver Microsoft debe mejorar muchísimos aspectos en sus sistemas operativos, la política que ha adoptado de lanzar nuevas versiones tan diferentes entre ellas hace pensar en la cantidad de fallos que se habrán cometido en el proceso y quizás debería implementar procesos menos cambiantes, es decir, sacar una versión del sistema operativo e ir actualizándolo y mejorándolo (tal y como hace Apple o algunas distribuciones como Ubuntu) en lugar de crear uno totalmente nuevo cada vez.</p>
<p>Según los rumores que rondan por internet Windows podría tener fecha de caducidad debido a la dificultad que están teniendo al adaptarse a los nuevos tiempos y que Windows ya no es capaz de afrontar con solvencia los nuevos retos de la sociedad de la información. El nuevo sistema operativo que sustituiría a Windows se llamaría Midori y funcionaría de una manera virtualizada.</p>
<p>Si queréis descargar la RC de Windows 7 podéis ir a la <a title="Descargar Windows 7" href="http://www.microsoft.com/windows/downloads/default.aspx" target="_blank">web oficial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/05/windows-7/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 RC (Jaunty Jackalope)</title>
		<link>http://www.segmentationfault.es/2009/04/ubuntu-jaunty-jackalope/</link>
		<comments>http://www.segmentationfault.es/2009/04/ubuntu-jaunty-jackalope/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 12:39:53 +0000</pubDate>
		<dc:creator>Noemí Losada</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Sistemas Operativos]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[software libre]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=485</guid>
		<description><![CDATA[El 23 de Abril nace un nuevo Ubuntu la versión 9.04 Jaunty Jackalope con muchas mejores respecto a su antecesor Intrepid Ibex.

De momento podemos descargarnos la versión Release Candidate. Las mejoras más considerables en esta RC según la web de Ubuntu son:]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-501" title="Ubuntu" src="http://www.segmentationfault.es/wp-content/2009/04/ubuntu.png" alt="Ubuntu" width="211" height="63" /></p>
<p>El 23 de Abril nace un nuevo Ubuntu la versión 9.04 Jaunty Jackalope con muchas mejoras respecto a su antecesor Intrepid Ibex.</p>
<p>De momento podemos descargarnos la versión <a href="http://www.ubuntu.com/getubuntu/releasenotes/904overview" target="_blank">Release Candidate</a>.</p>
<p>Las mejoras más considerables en esta RC según la web de <a href="http://www.ubuntu.com/getubuntu/releasenotes/904overview#New%20features%20since%20Ubuntu%208.10" target="_blank">Ubuntu</a> son:</p>
<ul>
<li>El entorno de escritorio <a href="http://live.gnome.org/TwoPointTwentyfive" target="_blank">GNOME 2.26</a> que incluye la novedad del todo en uno en grabración de CD (Brasero) y las mejorías en la manipulación de multiples monitores (actualización de Gnome-display-properties).</li>
<li>La versión 1.6 <a href="http://www.x.org/wiki/" target="_blank">X.Org Server</a>.</li>
<li>Wacom tablet hotplugin (se activa automáticamente cuando está conectado ya no necesita modificación en xorg.conf.</li>
<li>Nuevo estilo para las notificaciones y para las preferencias de las notificaciones. Mira el <a href="http://www.markshuttleworth.com/wp-content/uploads/2008/12/jaunty904_notifications_example1_web_092.swf" target="_blank">vídeo demostrativo</a> que ofrece la web de Ubuntu.</li>
<li>Mejor rendimiento de arranque.</li>
<li>Linux Kernel 2.6.28</li>
<li>Nuevo sistema de archivos <a href="http://ext4.wiki.kernel.org/index.php/Ext4_Howto#Converting_an_ext3_filesystem_to_ext4" target="_blank">Ext4</a>.</li>
<li>Nube de computación (múltiples aplicaciones en una sola nube).</li>
<li>El paquete dovecot-postfix.</li>
</ul>
<p>¡¡¡ Aquí, esperaremos con ansias a su llegada !!!</p>
<p><span style="text-decoration: underline;"><strong>POST MODIFICADO (23/04/09):</strong></span></p>
<p>¡Ya ha llegado el nuevo Ubuntu Jaunty Jackalope!</p>
<p>Aquí tenéis los enlaces para la descarga (torrent):</p>
<p><a href="http://releases.ubuntu.com/releases/9.04/ubuntu-9.04-desktop-i386.iso.torrent" target="_blank">Ubuntu Desktop 9.04 i386</a></p>
<p><a href="http://releases.ubuntu.com/releases/9.04/ubuntu-9.04-desktop-amd64.iso.torrent" target="_blank">Ubuntu Desktop 9.04 amd64</a></p>
<p>¡Qué lo disfrutéis!</p>
<p>Más información en:</p>
<p><a href="http://www.ubuntu-es.org/" target="_blank">http://www.ubuntu-es.org</a></p>
<p><a href="http://www.ubuntu.com" target="_blank">http://www.ubuntu.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/04/ubuntu-jaunty-jackalope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patrones de diseño, no reinventar la rueda</title>
		<link>http://www.segmentationfault.es/2009/04/patrones-diseno/</link>
		<comments>http://www.segmentationfault.es/2009/04/patrones-diseno/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 09:15:11 +0000</pubDate>
		<dc:creator>Gabi García</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ingeniería de software]]></category>
		<category><![CDATA[patrones de diseño]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://www.segmentationfault.es/?p=116</guid>
		<description><![CDATA[En el proceso de análisis y diseño de software muchas veces nos encontramos con los mismos problemas. Ahí es donde entran en juego los patrones de diseño.]]></description>
			<content:encoded><![CDATA[<p>El desarrollo de software es un proceso iterativo y que consta de multitud de fases. Una de las primeras y de las más importantes es el diseño del programa. ¿Qué es diseñar un programa? Pues, dicho de una forma bastante coloquial, diseñar un programa es <strong>pensar</strong>. Pensar qué y cómo ha de realizar cada una de las funciones antes de ponernos a &#8220;picar código&#8221; de forma obsesiva. De esta forma conseguiremos que nuestros elementos de software sean de una calidad muy superior y evitar así la <a href="http://es.wikipedia.org/wiki/C%C3%B3digo_espagueti" target="_blank">programación <em>spaghetti</em></a>.</p>
<p>La eficiencia en la resolución del problema depende de muchos factores: la propia experiencia haciendo diseños de software, la similitud en las características con otros sistemas existentes ya implementados, la creatividad en la resolución de problemas nuevos, etc. Pero en el proceso de análisis y diseño de software, e incluso en la propia implementación, muchas veces nos encontramos con los mismos problemas a resolver. Ahí es donde entran en juego los <strong>patrones de diseño</strong>.</p>
<p>Los patrones de diseño son soluciones a problemas y dificultades comunes en el desarrollo de software, que obviamente han demostrado ser soluciones correctas y eficientes. Además han de ser poseer un nivel de abstracción suficiente para que sean reutilizables.</p>
<p>Patrones de diseño hay muchos y de muchos tipos, pero a continuación voy a tratar únicamente los <strong>patrones del GoF</strong> (<a href="http://es.wikipedia.org/wiki/Gang_of_Four_(dise%C3%B1o)" target="_blank">Gang Of Four</a>), autores del libro <em>Design Patterns: Elements of Reusable Object-Oriented Software</em>. GoF organizan su catálogo de patrones en tres ámbitos: patrones de <strong>creación</strong>, patrones <strong>estructurales</strong> y patrones de <strong>comportamiento</strong>.</p>
<h3>Patrones de Creación</h3>
<ul>
<li><strong>Factory Method:</strong> Delega la creación de un objeto a las clases derivadas.</li>
<li><strong>Abstract Factory:</strong> Crea un conjunto de objetos polimórficos relacionados entre sí.</li>
<li><strong>Builder:</strong> Construye una estructura compleja a partir de trozos pequeños.</li>
<li><strong>Prototype:</strong> Construye un objeto tomando como referencia otro objeto.</li>
<li><strong>Singleton:</strong> Restringe una clase a tener una única instancia.</li>
</ul>
<h3>Patrones Estructurales</h3>
<ul>
<li><strong>Adapter: </strong>Adapta la interfaz de un servidor al cliente.</li>
<li><strong>Bridge: </strong>Abstracción para referirse a una implementación entre muchas.</li>
<li><strong>Composite: </strong>Estructura para conseguir agregaciones recursivas.</li>
<li><strong>Decorator:</strong> Extiende un objeto de forma transparente.</li>
<li><strong>Facade: </strong>Simplifica la interfaz de un subsistema.</li>
<li><strong>Flyweight:</strong> Permite compartir de forma eficiente entre muchos objetos pequeños.</li>
<li><strong>Proxy:</strong> Un objeto que aproxima otro objeto.</li>
</ul>
<h3>Patrones de Comportamiento</h3>
<ul>
<li><strong>Chain Of Responsability: </strong>Delega cada orden/comando al proveedor de servicio responsable.</li>
<li><strong>Command:</strong> Los comandos son tratados como objetos de primera clase.</li>
<li><strong>Interpreter: </strong>Intérprete de lenguaje para uan gramática reducida.</li>
<li><strong>Iterator:</strong> Permite acceso secuencial a elementos agregados.</li>
<li><strong>Visitor:</strong> Operación a ejecutar sobre el conjunto de elementos de la estructura de un objeto.</li>
<li><strong>Mediator: </strong>Coordina interacciones entre sus asociados.</li>
<li><strong>Memento:</strong> Captura y restaura los estados de los objetos de forma privada.</li>
<li><strong>Observer: </strong>Los objetos dependientes se actualizan de forma automática.</li>
<li><strong>State:</strong> Objeto con comportamiento dependiente del estado.</li>
<li><strong>Strategy:</strong> Abstracción para poder seleccionar entre muchos algoritmos existentes.</li>
<li><strong>Template Method:</strong> Algoritmo con pasos ofrecidos por una clase derivada.</li>
</ul>
<p>Aquí os he dejado una breve descripción de cada uno de ellos para que tengáis un conocimiento general  pero todos están perfectamente documentados e ilustrados mediante diagramas en el libro del GoF [1]. Espero que os sea de utilidad y los tengáis presentes a la hora de diseñar o analizar proyectos de software.</p>
<p><span style="text-decoration: underline;">Fuentes:</span></p>
<p>Wikipedia &#8211; http://es.wikipedia.org/wiki/Patr%C3%B3n_de_dise%C3%B1o</p>
<p><span style="text-decoration: underline;">Más información</span>:</p>
<p>McDonaldLand &#8211; <a href="http://www.mcdonaldland.info/files/designpatterns/designpatternscard.pdf" target="_blank">CheatSheet</a> &#8211; http://www.mcdonaldland.info/2007/11/28/40/</p>
<p><span style="text-decoration: underline;">Bibliografía:</span></p>
<p>[1] Erich Gamma<span class="new">, Richard Helm</span><span class="new">, Ralph Johnson</span><span class="new">, John Vlissides</span><em>. Design Patterns: Elements of Reusable Object-Oriented Software. 1994. Ed. </em>Addison-Wesley. ISBN:<span class="tit_ficha2">9780201633610</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.segmentationfault.es/2009/04/patrones-diseno/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
