mod_rewrite Cheat Sheet
Posted on Diciembre 28, 2009
Filed Under apache | Leave a Comment
Navegando por ahí… encontré este buen resumen de lo que podemos hacer con mod_rewrite… para tener siempre a mano:
http://www.cheat-sheets.org/saved-copy/mod_rewrite_cheat_sheet.pdf
Configurar Sony Ericsson MD300 de EntelPCS en Ubuntu Intrepid Ibex (Conexión 3g)
Posted on Febrero 1, 2009
Filed Under Sin categoría | 14 Comments
La información que aquí publico está tomada básicamente de tres partes (ubuntu-cl.org, laudecioliveira.org y ubuntu-es.org). Ha sido probado con EntelPCS en Chile, y funciona sin problemas ![]()
Lo primero es ayudar a udev a identificar el módem como tal, para eso necesitamos el id del dispositivo y de vendedor. Esta información la obtenemos así:
sudo lsusb -v|grep -i vendor idVendor 0x0fce Sony Ericsson Mobile Communications AB
sudo lsusb -v|grep -i product idProduct 0xd0cf iProduct 2 Sony Ericsson MD300
Ahora creamos el archivo /etc/udev/rules.d/50-md300modem.rules con nuestro editor favorito:
ACTION!="add", GOTO="3G_End" BUS=="usb", SYSFS{idProduct}=="d0cf", SYSFS{idVendor}=="0fce", PROGRAM="/bin/sh -c 'echo 3 > /sys/%p/device/bConfigurationValue'" LABEL="3G_END"
Ahora desconectamos el módem y descargamos los módulos del kernel, lo volvemos a cargar con los parámetros que necesitamos
sudo modprobe -r usbserial sudo rmmod usb_storage sudo modprobe usbserial vendor=0x0fce product=0xd0cf
Creamos el archivo /etc/modprobe.d/md300 con nuestro editor de texto favorito. Este archivo tendrá un alias para que el módulo se cargue correctamente luego de reiniciar el pc.
#Sony Ericsson MD300 alias md300 usbserial options md300 vendor=0x0fce product=0xd0cf
Reiniciamos udev:
sudo /etc/init.d/udev restart
Ahora debemos configurar wvdial, editamos el archivo /etc/wvdial.conf
[Dialer Defaults] Modem = /dev/ttyACM0 ISDN = off Modem Type = USB Modem Baud = 460800 Init = ATZ Init2 = AT+CFUN=1 Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init4 = Init5 = ATZ+cgdcont=1,"IP","imovil.entelpcs.cl" Init6 = Init7 = Init8 = Init9 = Phone = *99# Phone1 = Phone2 = Phone3 = Phone4 = Dial Prefix = Dial Attempts = 1 Dial Command = ATM1L3DT Ask Password = off Password = entelpcs Username = entelpcs Auto Reconnect = off Abort on Busy = off Carrier Check = off Check Def Route = on Abort on No Dialtone = on Stupid Mode = on Idle Seconds = 0 Auto DNS = on
La línea Init2 = AT+CFUN=1 es para activar la función radio del módem. Sin esta línea, pppd se cierra antes de conectar.
Enchufamos nuevamente el módem, y ejecutamos wvdial para conectarnos a internet:
sudo wvdialObtendremos como resultado algo como esto:
--> WvDial: Internet dialer version 1.60 --> Cannot get information for serial port. --> Initializing modem. --> Sending: ATZ ATZ OK --> Sending: AT+CFUN=1 AT+CFUN=1 OK --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 OK --> Sending: ATZ+cgdcont=1,"IP","imovil.entelpcs.cl" ATZ+cgdcont=1,"IP","imovil.entelpcs.cl" OK --> Modem initialized. --> Sending: ATM1L3DT*99# --> Waiting for carrier. ATM1L3DT*99# ~[7f]}#@!}!}!} }9}#}%B#}%}(}"}'}"}"}&} } } } }%}&=;+zZC~ CONNECT --> Carrier detected. Starting PPP immediately. --> Starting pppd at Sun Feb 1 20:21:26 2009 --> Pid of pppd: 8630 --> Using interface ppp0 --> local IP address 186.9.56.27 --> remote IP address 10.64.64.64 --> primary DNS address 164.77.252.249 --> secondary DNS address 164.77.252.215
Actualización: Si tienen distribuciones basadas en RPM, pueden bajar este “driver” de betavine (desarrollado por EntelPCS), que básicamente es lo mismo que hice yo a mano, y con algunas pequeñas modificaciones básicamente en el archivo wvdial.conf. Desde ubuntu pueden pasarlo a .deb con alien.
Si prefieren, también pueden usar gnome-ppp para discar. Eso es todo… disfruten ![]()
Get VOIP
Posted on Octubre 9, 2008
Filed Under Sin categoría | Leave a Comment
Notable !!
No será mucho digo yo ?
Macros
Posted on Agosto 9, 2008
Filed Under Sin categoría | Leave a Comment
Macro tomada con una Fujifilm S1000fd…
Nada de mal el modo “super macro” ![]()
Finalizado el primer semestre
Posted on Julio 25, 2008
Filed Under Sin categoría | Leave a Comment
Por fin ! Hoy recibí la última nota que me faltaba, y doy por finalizado el primer semestre … me fue super bien, espero seguir por la buena senda ![]()
Actualizar el estado de Kopete con Twitter
Posted on Junio 13, 2008
Filed Under Sin categoría | Leave a Comment
Un pequeño demonio en PHP para actualizar nuestro estado de kopete, desde twitter … es simple, pero funciona…
Comentarios y sugerencias son bienvenidas.
// id o username de twitter$usuarioTwitter = "bilsoncl";// tiempo espera en segundos para actualizar$tiempoRefresco = 300;$pid = pcntl_fork();if($pid == -1){ die("Error en el fork");}if($pid) { // Matar el padre exit();}// De aqui en adelante solo se ejecuta si soy el hijo y futuro daemon// Lo siguiente que hacemos es soltarnos de la terminal de controlif (!posix_setsid()) { die ("Error pasando a background");}// De este punto en adelante debemos cambiarnos de directorio y// hacemos las recomendaciones de Wikipedia para un daemonchdir("/");umask(0);// Capturo kill -15pcntl_signal(SIGTERM, "exit_daemon");// Si estamos aqui oficialmente somos un daemon// revisamos la ejecucion por cada linea de codigodeclare(ticks = 1);while(1) { updateTwitter($usuarioTwitter); sleep($tiempoRefresco);}// Esta es mi funcion de salidafunction exit_daemon($signo){ // terminando el demonio exit();}function updateTwitter($usuario){ $twitteruser = "bilsoncl"; $url = "http://twitter.com/statuses/user_timeline/{$twitteruser}.xml"; $twitterupdates = file_get_contents($url); $status = xml2array($twitterupdates); `dcop kopete KopeteIface setAway "Twitteando: {$status['statuses'][0]['status'][0]['text']}" true`;}function xml2array($UPSxml){ $p = xml_parser_create(); xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($p, $UPSxml, $values, $idx); xml_parser_free($p); // tracking used keys $usedKeys = array(); $deepLevel = -1; // start a php array string (evaluated later) $forEvalPrefix = '$xml_array'; // loop throught the value array foreach ($values as $key => $val) { $tagName = $val['tag']; // pass the key tag into a more friendly looking variable $level = $val['level']; // idem if($val['type'] == 'open') { $deepLevel++; // increase deep level $forEvalPrefix .= '[\''. $tagName .'\']'; // begin used keys checks to allow multidimensionatity under the same tag (isset($usedKeys[$level][$tagName])) ? $usedKeys[$level][$tagName]++ : $usedKeys[$level][$tagName] = 0; $forEvalPrefix .= '['. $usedKeys[$level][$tagName] .']'; } if($val['type'] == 'complete') { ($level > $deepLevel) ? $deepLevel++ : ''; // increase $deepLevel only if current level is bigger $tagValue = addslashes($val['value'] ); // format the value for evaluation as a string $forEvalSuffix = '[\''. $tagName .'\'] = \''. $tagValue .'\';'; // create a string to append to the current prefix $forEval = $forEvalPrefix . $forEvalSuffix; // (without "$php_used_prefix"...) eval($forEval); // write the string to the array structure } if($val['type'] == 'close') { unset($usedKeys[$deepLevel]); // Suppress tagname's keys useless $deepLevel--; $forEvalPrefix = substr($forEvalPrefix, 0, strrpos($forEvalPrefix, '[')); // cut off the used keys node $forEvalPrefix = substr($forEvalPrefix, 0, strrpos($forEvalPrefix, '[')); // cut off the end level of the array string prefix } } return $xml_array;}
Quitar acentos y caracteres especiales en PHP
Posted on Mayo 26, 2008
Filed Under Sin categoría | 9 Comments
Por más que busqué no encontré funciones que quitaran los acentos eficientemente. Las que funcionaban medianamente bien, fallaban cuando los caracteres eran UTF-8, por lo que me puse en campaña, y llegué a esto:
function quitarAcentos($text) { $text = htmlentities($text, ENT_QUOTES, 'UTF-8'); $text = strtolower($text); $patron = array ( // Espacios, puntos y comas por guion '/[\., ]+/' => '-', // Vocales '/à/' => 'a', '/è/' => 'e', '/ì/' => 'i', '/ò/' => 'o', '/ù/' => 'u', '/á/' => 'a', '/é/' => 'e', '/í/' => 'i', '/ó/' => 'o', '/ú/' => 'u', '/â/' => 'a', '/ê/' => 'e', '/î/' => 'i', '/ô/' => 'o', '/û/' => 'u', '/ã/' => 'a', '/&etilde;/' => 'e', '/ĩ/' => 'i', '/õ/' => 'o', '/ũ/' => 'u', '/ä/' => 'a', '/ë/' => 'e', '/ï/' => 'i', '/ö/' => 'o', '/ü/' => 'u', '/ä/' => 'a', '/ë/' => 'e', '/ï/' => 'i', '/ö/' => 'o', '/ü/' => 'u', // Otras letras y caracteres especiales '/å/' => 'a', '/ñ/' => 'n', // Agregar aqui mas caracteres si es necesario ); $text = preg_replace(array_keys($patron),array_values($patron),$text); return $text; }
Cualquier comentario es bienvenido.
Homero Simpson en CSS
Posted on Abril 14, 2008
Filed Under Sin categoría | Leave a Comment
Lo ví y no lo podía creer … sencillamente espectacular !!!!
http://www.romancortes.com/blog/homer-css/
Gracias eft0 por enlace.
Todo de nuevo…
Posted on Abril 4, 2008
Filed Under Sin categoría | 4 Comments
Me da flojera recuperar los posts anteriores, vamos a ver si ahora escribo más seguido …
Lo nuevo: pega nueva, responsabilidades nuevas, nuevos proyectos … retomé los estudios … ojalá salga todo bien ![]()


