La tradicional ruta de la Cabra desde la base aérea de Armilla, pero esta vez al revés, es decir bajamos la cabra para subir por la carretera general.
Aparentemente es algo mas dura que el sentido original, ya que aunque los porcentajes de subida son menores, si son más largas las subidas. Cuidado con el viento.
sábado, 31 de marzo de 2012
martes, 27 de marzo de 2012
Cambios del Data Model/ How to manage changes in the data model
Usually when you are creating you application you need to make a few
changes to your data model. If you change the data model and try to run your
application you would have a problem with the persistent store, because the
file containing the data does not match
to the actual model data.
One way to solve this problem is to find the file in where the data
are stored, and delete it. The problem is that you are going to loose the data
stored on it.
The other way to solve it is to use model versioning, which is a
feature provided by XCode to maintenance changes in our model data.
Model versioning allows us to made changes to the data model, and
also migrate the data from old version to new version.
There are to types of migration, depending on the types of changes
you made to your data model. These are automatic or lightweight migration and
manual migration.
Here we are going to see how to made a lightweight migration for a
small change in our model. In this case we need to add a new Attribute for an
Entity.
1º Select the actual model data before you make any change on it.
Choose Editor menu, and Add Model Version… then you must give a name for the
new model version, and choose the model version from we are going to derive
the new model.
Then a new model data is created, and take
notice that this new model is exactly to the one we have choose to derive from.
In this new model we could made the changes we need. In this case add a new
attribute.
2º Once we have created the new attribute,
we need to generate the files .h and .m for the Entity changed. Be careful to choose the new data model, click
over the modified Entity, and then choose Editor on the menu, and Create
NSManagedObject SubClass. Then a new version of the .h and .m will be created
but with the same name as the old one, so a warning message about to replace
the files will appear.
3º Now we are going to add new code for the
place in where the persistent store coordinator is created:
NSDictionary
*options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
NSMigratePersistentStoresAutomaticallyOption,
[NSNumber
numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
The file must appear as follows:
This peace of code indicates that the
migration process is going to be automatically.
4º Finally we are going to set our new data model as de active one. In this case
you must click over the root of the data model, and in the File inspector in
the right panel go to Versioned Core Data Model, and choose the appropriate
one.
And that´s all, you can run your
application, but previously I recommend you to Clean and to Build it.
martes, 20 de marzo de 2012
Media Maratón de Málaga / Malaga Half Marathon
Segunda carrera de la temporada. Esta vez tocaba algo mas largo, en concreto una media maratón. Originalmente el plan era ira a correr la Media de Álora, pero el cuerpo todavía no pedía guerra, así que cambio de planes.
El resultado al final 1:27:00 se queda lejos del 1:24:00 previsto, pero teniendo en cuenta el fortísimo viento en contra en la segunda parte del recorrido al final no parece tan mal.
Second race of the year. It´s time for something with more distance, a half marathon. The original plan was to take part in the Alora Half Marathon, but finally I decided to change it for the Malaga´s Half one, then I would have a few weeks more to prepare this race.
My race time was 1:27:00, so far from the 1:24:00 I wanted to made, but thinking of the strong winds we have during the race, specially in the second part, it does´t think to be a bad time.
miércoles, 14 de marzo de 2012
How-to install Nagios
Vamos
a ver hoy un pequeño tutorial de cómo realizar una instalación de Nagios.
Nagios es un software del tipo Open Source que nos permite monitorizar sistemas
informáticos, incluyendo dentro de este tanto equipos informáticos, servidores,
equipos de red, aplicaciones, servicios, etc... Hoy en día está considerado
como el estándar en la monitorización de
infraestructuras informáticas, aunque últimamente Zabbix le está suponiendo
cierta competencia.
Al
ser Open Source es por lo tanto un software libre, aunque tiene versiones de
pago que incluyen mayores funcionalidades.
Nagios se instala sobre Linux. En nuestro ejemplo lo haremos sobre
Ubuntu, y mas concretamente sobre la versión 11.10
Today
we are going to see a breef how-to install Nagios. Nagios is an Open-Source
Software used to monitoring a Computer System. It´s include user computers,
servers, switches, routers, applications, services, and so on. Actually it is
considered as an industry standart for IT Infrastructure Monitoring.
It
is free software, but there are a few comercialized versions which includes
enhance capabilities. In our example we are going to install it over a Ubuntu 11.10.
Una
vez instalado nuestro Ubuntu, y antes de instalar Nagios necesitamos instalar Apache
y PHP. Para ello haremos lo siguiente:
Once
we have instaled Ubuntu and before installing Nagios we are going to install
Apache and PHP.
1º
Instalamos Apache / Installing Apache
sudo apt-get install
build-essential
sudo apt-get install libgd2-xpm-dev
sudo apt-get install apache2
2º
Instalamos PHP para apache2 / Installing PHP for Apache2
sudo apt-get install php5-common
php5 libapache2-mod-php5
Configuramos
apache abriendo el fichero de configuración:
Now
we are going to configure Apache to use PHP editing the apache config file:
sudo gedit
/etc/apache2/apache2.conf
y añadimos
la siguiente línea / and add the following line:
DirectoryIndex index.html
index.php index.cgi
Reiniciamos apache / Restart Apache
sudo
/etc/init.d/apache2 restart
Podemos
probar que Apache funciona conectando a la ip del equipo a través de un
navegador. Debería aparecer una pantalla como esta:
We
could made a try if Apache Works using a web interface heading to the IP of the
Nagios´host. We must obtain the following screen:
Una
vez instalados y configurados Apache2 y PHP comenzamos a instalar Nagios.
Previamente habremos descargado la última versión de core nagios desde la web
de Nagios, http://www.nagios.org/download
, así como del Nagios plugin que también habremos descargado del mismo sitio.
Once
we have instaled and configured Apache2 and PHP we could start to install
Nagios. Previously we must download the last versión of Core Nagios from de
Nagios Website, http://www.nagios.org/download
. Also we must download the Nagios Plugin from the same site.
Una
vez descargados los ficheros los descomprimimos y los ubicamos en el directorio
home de nuestro sistema de ficheros, pero previamente crearemos un usuario para
correr el servicio y un grupo para ejecutar comandos externos:
Once
we have downloaded both files we must decompress and place it in the home
folder of the system files. Previously we
are going to create a user to run the service and a group to run external
commands:
sudo useradd -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd
www-data
Ahora
vamos a realizar la instalación de Nagios a partir de los ficheros que
descaramos anteriormente.
Now
we are going to install the Nagios tarballs downloaded previously.
Vamos
al directorio en el que extraimos el fichero tar.
Then
we move to the folder in we extract the file and install
sudo ./configure
--with-command-group=nagcmd
Compilamos
el programa principal y las CGIs / This would compile the main program and the
CGIs:
sudo make all
Instalamos
el programa principal y la CGIs / Install of the main program and CGIs
sudo make install
Instalamos
los scripts de inicio en /etc/init.d / Install init scripts in /etc/init.d
sudo make install-init
Instalamos
ficheros de ejemplo de configuración en /usr/local/nagios/etc / Install sample files in
/usr/local/nagios/etc
sudo make install-config
Configuramos
los permisos de usuarios / Configuring file and directories permissions
sudo make install-commandmode
Instalamos
los ficheros de configuración de Apache para la interface web de Nagios / Install the Apache config file for the Nagios web interface
sudo make install-webconf
Creamos
la contraseña para el ususario administrator / Let´s create the password for the admin
user:
sudo htpasswd -c
/usr/local/nagios/etc/htpasswd.users nagiosadmin
Ahora
añadiremos en la configuración de apache el directorio de Nagios, para ello
abrimos el fichero apache.conf:
Now we
ar going to add the Nagios directory to apache, opening the apache.conf file :
sudo gedit
/etc/apache2/apache.conf
y
añadimos las siguientes líneas / and add following lines :
ScriptAlias /nagios/cgi-bin
/usr/local/nagios/sbin
Alias /nagios
/usr/local/nagios/share
Por
ultimo grabamos, cerramos el fichero y reiniciamos apache2
Finaly
we save and exit, and then restart apache2
sudo /etc/init.d/apache2
restart
Ahora
vamos a proceder a instalar el Segundo fichero que descargamos de la web de
Nagios, el Nagios Plugin.
Now
we have to install the second file we download from the Nagios site, the Nagios
plugins.
Vamos
a la carpeta donde hemos extraido el fichero.
Now
we move to the folder in wich we have extracted the plugins.
sudo ./configure --with-nagios-user=nagios
--with-nagios-group=nagios
sudo make
sudo make install
Creamos
un enlace para iniciar el servicio / Now
we are going to create a link to start the service:
sudo ln -s /etc/init.d/nagios
/etc/rcS.d/S99nagios
Verificamos
la configuración / Verify the config:
sudo /usr/local/nagios/bin/nagios
–v /usr/local/nagios/etc/nagios.cfg
Iniciamos
Nagios / And now start Nagios:
sudo /etc/init.d/nagios start
Ahora
podemos acceder a Nagios poniendo en el navegador la dirección:
Now
you are ready to use Nagios, open your browser and type :
http://hostname/nagios or
http://ip/nagios
El
usuario que se nos pide al logearnos será nagiosadmin y la contraseña la que
fijásemos en su momento.
The
user to log on to the system would be nagiosadmin, with the password we set during the installation process.
Aquí podemos ver un imagen de Nagios monitorizando dos equipos windows, el próximos posts explicaremos como añadir hosts windows y linux.
Here we can see a Nagios monitoring two windows hosts, y further post we could see how to add new linux and windows host to our Nagios.
jueves, 1 de marzo de 2012
Cerrando una aplicación de manera correcta / The right way to Close an App
Para hacer que una
aplicación cierre correctamente al cerrar la última ventana añadiremos el
siguiente método en el fichero .m del Aplication Delegate
To make an application close when the last
windows were closed you must add the following method in the .m Apllication
Delegate´s file
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
return YES;
}
Suscribirse a:
Entradas (Atom)