Etiquetas

sl (65) Ubuntu (36) Software Libre (35) HowTo (26) GNU/Linux (24) Programacion (19) Java (16) Configuracion (8) favoritos (7) FUDCon 2011 Panamá (6) Fedora (6) Centroamerica (5) C# (4) NetBeans (4) asp.net (4) automatizar (4) jetty (4) Bluetooth (3) Encuentro (3) JPilot (3) Tutorial (3) authentication (3) command (3) presentacion (3) sincronizar (3) .Net (2) Celebración (2) J2ME (2) Juegos (2) Linq (2) Palm (2) archiva (2) awk (2) collision (2) conflict (2) date (2) ecsl (2) framework (2) laptop (2) maven (2) mysql (2) pam (2) pam_usb (2) perl (2) programming (2) sed (2) sesion (2) wiki (2) youtube (2) Brother (1) Code_Templates (1) Comic_Viewer (1) DI (1) Dragones (1) Empathy (1) Evolution (1) Google Sync (1) Icaro (1) IoC (1) LGPL (1) MFC-240C (1) PHP (1) Películas (1) Precise Pangolin (1) Publican (1) SQL (1) Satio (1) Sony_Ericsson (1) Twitter (1) U1 (1) Ubuntu One (1) Ubuntu12.04 (1) Web Service (1) Wireless (1) acer5534 (1) actualizar (1) admin (1) administrar (1) ajaxpro (1) api (1) blogger (1) bug (1) coding-dojo (1) crisis crediticia (1) d4x (1) diseño (1) documental (1) enum (1) extention (1) gettext (1) github (1) i18n (1) impresora (1) ipv6 (1) jquery (1) lsof (1) manga (1) maverick (1) mito (1) musica (1) nautilus (1) nginx (1) numpad (1) pam_face (1) ps (1) python (1) regex (1) robotica (1) rock (1) salesforce (1) server (1) settings (1) shutdown (1) system (1) tomcat (1) ubucon (1) update (1) usb (1) xargs (1) xml (1) xstream (1)

miércoles, 8 de mayo de 2013

problemas con ipv6 y nginx en ubuntu despues de una actualizacion

Hoy estaba trabajando tranquilamente en mi ubuntu, instalando algunos paquetes con aptitude y recibí un mensaje diciéndome que debía actualizar, entre otros, nginx ¿por qué no? me dije a mi mismo ¡total ya estoy instalando otras cosas!
Después de que se descargaran los paquetes necesarios me salió otro mensaje diciendo que que tenía un conflicto en el archivo /etc/nginx/sites-available/default ya que lo había modificado y la actualización venía con algunos cambios hechos por el responsable del paquete, así que hice un respaldo del archivo y deje que la actualización sobre escribiera.
Cuando todo el proceso terminó sin problemas comparé las diferencias (usando meld) y noté una línea interesante, más que nada porque adiciona soporte para ipv6

    listen [::]:80 default_server ipv6_only=on;

Aunque en ese momento no le di mucha importancia cuando traté de reiniciar nginx para seguir trabajando noté un error en el log:

 cat /var/log/nginx/error.log

2013/05/08 15:40:14 [emerg] 29533#0: invalid parameter "ipv6_only=on" in /etc/nginx/sites-enabled/default:22

Por suerte una búsqueda rápida me llevo a la solución que indican en este bug de launchpad, básicamente lo que hay que hacer es usar ipv6only=on en lugar de ipv6_only=on (sin el _ separando ipv6 y only)

    listen 80 default_server;
#    listen [::]:80 default_server ipv6_only=on;
    listen [::]:80 default_server ipv6only=on;

Aunque este no es precisamente un problema reciente tampoco es muy viejo y bueno decidí que sería bueno dejar un registro para el futuro y por si le resulta útil a alguien más.

Saludos.

jueves, 25 de abril de 2013

Eliminar lineas de texto vacias por consola de comandos

Siguiendo un poco con el tema de este post anterior y porque me encontré algo relacionado aquí les dejo este post donde doy algunos consejos para eliminar líneas vacias

Asumamos que tenemos el mismo archivo de ejemplo de mi post anterior llamado dias.txt pero le agregaré unas cuantas líneas en blanco para poder que quede como sigue a continuación:

Lun

Mar

Mie

Jue

Vie

Sab

Dom

Pueden usar cualquiera de los siguientes comandos para borrar todas las líneas vacías del archivo dias.txt: sed, awk o perl
El resultado seria algo como lo siguiente:
Lun
Mar
Mie
Jue
Vie
Sab
Dom

Recuerden que pueden imprimir en pantalla el contenido de dias.txt usando el comando
cat dias.txt
  • Gnu/sed: Usando una regex le indicamos a sed que borre las líneas que no tienen nada entre el principio(^) y el fin($) de dicha linea
    podemos escribir el contenido de dias.txt modificado en otro archivo (dias2.txt):
    sed '/^$/d' dias.txt > dias2.txt
    #cat dias2.txt
    O bien podemos modificar dias.txt directamente
    sed -i '/^$/d' dias.txt
    #cat dias.txt
    
  • awk: Usando awk el comando sería
    awk 'NF > 0' dias.txt > dias2.txt
    #cat dias2.txt
    
  • perl: El siguiente comando usando perl, borra todas las líneas bacias y guarda el archivo original como dias.txt.bakup, muy practico para evitar perder el archivo original si algo sale mal
    perl -i.backup -n -e "print if /\S/" input.txt
    #cat dias.txt
    #cat dias.txt.backup
    
Espero que les sea de ayuda :D
Hasta la próxima.

jueves, 21 de febrero de 2013

howto detect date collisions or conflicts

Today during a test of a client's app I found an interesting problem, how to detect date collisions or conflicts?

Suppose you have to create an agenda app, that allows it's users to create meetings or appointments and it must not allow two events to happen at the same time, for simplicity let's just say "all events created must not be in schedule conflict with other events"

It seems simple to resolve at first glance, but allow me to show you some examples of why it is not: Suppose you have two events A which last 60 minutes and B which last 90 minutes.

There are so many ways that we can create this two events in our agenda so that there will be a schedule conflict (date collision)

  1. Setting A to start and same time as B http://screencloud.net/v/ChX3
  2. Setting A to start a few minutes before B http://screencloud.net/v/73vI
  3. Setting B to start a few minutes before A http://screencloud.net/v/uyaG
  4. Setting A to start a few minutes later of B http://screencloud.net/v/lpLg
  5. ...

If you try to list all possible combinations in which A and B are in conflict your code may become pretty big and very difficult to maintain for something as simple as "detect date collisions", lucky there is another way mores simple: Instead of search all possible conditions in which A and B are in conflict lets search for the possibles situations in which they are not

  1. A starts and ends before B http://screencloud.net/v/hEXt
  2. B starts and ends before A http://screencloud.net/v/tR6X

We can use this conditions and some boolean logic to create for example a mysql query:

I hope this is useful for anyone of you.
Regards

Spanish version