• Aviso Legal
  • About

Bienvenidos al Blog de David Rodriguez

Category Archives: Programacion

Descomprimir tar.bz2 y descomprimir tar.gzip

abril 1, 2011 8:32 am / Leave a Comment / David Rodriguez

Como descomprimir archivos tar.bz2 y archivos tar.gzip en sistemas linux, y como nuestra memoria RAM del cerebro no es amplia .. y tenemos SAN Google, aqui os lo dejo para recordarlo rapidamente.

Descomprimir archivo .tar.bz2

> tar -xvjf archivo.tar.bz2

Descomprimir archivo tar.gzip

> tar -xzvf archivo.tar.gzip

Posted in: Internet, Programacion, servidores / Tagged: linux, Programacion

saber el numero de conexiones http al puerto 80 en linux

marzo 11, 2011 3:52 pm / Leave a Comment / David Rodriguez

Con este comando:
netstat -nt | grep :80 | wc -l
Podemos conocer el numero de peticiones http que está recibiendo el puerto 80, que es el puerto web por defecto

Posted in: Internet, Programacion, servidores / Tagged: apache, linux, servidores

httpd.conf con plesk: modificar configuracion apache

marzo 9, 2011 3:45 pm / Leave a Comment / David Rodriguez

Para modificar algunos parametros de apache con plesk, hay que introducirlas en el fichero
/etc/httpd/conf.d/swtune.conf
que sobreescribe al fichero /etc/httpd/conf/httpd.conf

Posted in: Internet, Programacion, servidores / Tagged: apache, linux, plesk

error nvidia-kernel-common, el subproceso script post-installation instalado devolvió el código de salida de error 1

enero 10, 2011 9:55 am / Leave a Comment / David Rodriguez

Si has actualizado la versión de ubuntu a 10.04, puede que al intentar instalar algunos paquetes, te de siempre este error

nvidia-kernel-common: el subproceso script post-installation instalado devolvió el código de salida de error 1

Para solucionarlo se deben seguir los siguientes pasos:

>  sudo -i

> rm -rf /var/lib/dpkg/info/nvidia-kernel-common.*

> apt-get remove nvidia-kernel-common

> apt-get install nvidia-kernel-common

se cierra la ventana de terminal, y en otra nueva se escribe lo siguiente:

> sudo apt-get update

Posted in: Internet, Programacion, servidores / Tagged: linux, ubuntu

Buscar una palabra dentro de un fichero en linux

diciembre 10, 2010 6:11 pm / Leave a Comment / David Rodriguez

Para buscar una palabra dentro de un fichero, en una maquina linux, lo podemos hacer facilmente de la siguiente forma.

Nos posicionamos en el directorio a buscar.

> cd /directorio_a_buscar

y busco la palabra

find . -exec grep -l palabra_a_buscar {} \;

Nos podemos ahorrar mucho tiempo para encontrar intrusiones en algún fichero en linux.

Posted in: Internet, Programacion, Seguridad, servidores / Tagged: Internet, linux, Programacion, spam

Como saber el numero de procesos httpd

junio 23, 2010 8:56 am / Leave a Comment / David Rodriguez

Si deseas saber el numero de peticiones httpd, es decir, usuarios qeu están conectados a tu maquina viendo tus paginas puedes utilizar el siguiente comando:

ps ax | grep httpd | wc -l

De esta forma, te salen todos los procesos que hay + 1 (que sería el proceso grep httpd).

Puede ser muy util para conocer si tu servidor esta colapsandose por el numero de servidores.

Posted in: Internet, Programacion / Tagged: desarrollo web, linux, servidores

ver los iconos de los PSDs en el explorador de windows

mayo 6, 2010 4:24 pm / Leave a Comment / David Rodriguez

Muchas veces tenemos el problema de no poder ver que tiene un psd sin abrirlo … con la consiguiente perdida de tiempo en esperar a que carguen los ficheros psds que suelen ser bastante pesado.

iconos psd

De esta forma, podemos visualizar el psd sin necesidad de abrirlo en el explorador de windows, tal y como si fuera una imagen jpg o gif.

  1. Descargad este archivo
  2. Extrae los archivos.
  3. En esta ruta C:\Archivos de programa\Archivos comunes\Adobe\Shell(en caso de que no exista crearla) copia los archivos.
  4. Haz doble clic sobre los archivos de registros para ejecutarlos: psicon.dll.reg y aiicon.dll.reg

Con este simple hackeo del registro ya va a funcionar, el problema es que Illustrator borra la clave cada vez que se inicia el registro. Así que si eres usuario de Illustrator necesitas hacer una cosa más:

  1. Ve a Inicio > Ejecutar > regedit
  2. Localiza y haz clic con el menú derecho en:HKEY_CLASSES_ROOT\CLSID\{0C5B0CED-206B-4c39-B615-0EB23C824612}\InProcServer32
  3. Haz clic en permisos.
  4. Selecciona un usuario en el cuadro de diálogo y pulsa en Opciones Avanzadas.
  5. Haz clic en “Modificar” en el nuevo cuadro de diálogo.
  6. En “Eliminar” haz clic en la casilla de verificación de la columna “Denegar” ( véase en la imagen inferior).
  7. Aceptar.

Esta información la ha sacado nuestro Director de Arte de Activolution, Eduardo Maqueda,  del blog de Cristian Eslava

Posted in: Otros, Programacion / Tagged: desarrollo web, photoshop, productividad, Programacion, psd

Encuestas online gratis con PHP

abril 30, 2010 11:33 am / Leave a Comment / David Rodriguez

Muchas veces necesitamos realizar algún tipo de encuesta en la web y no sabemos que programas gratuitos utilizar o cual es el mejor para estas cosas.

Se puede ir a una empresa de encuestas online, que tienen alguna versión gratuita, pero cuyo fin, siempre va a ser que pruebes el servicio y finalmente pagues por él. Podeis probar con e-encuesta.com y encuestafacil.com

Si lo que se desea es poner una pequeña encuesta en la web que una simple pregunta … lo mas sencillo es utilizar el script Simple PHP Poll.

Y si finalmente, lo que queremos es una herramienta completa de gestión de encuestas, con todas configuraciones posibles, idiomas, tipos de pregunta, estadisticas, etc, la mejor opción es Lime Survey, que es una herramienta gratis en PHP y MySql. Facilmente instalable y con un interface muy intuitivo y usable(no hace falta hacer ningún curso para utilizarlo)

No perdais tiempo buscando otras opciones, ya que esta, de momento, es la mejor.

Posted in: Internet, Programacion / Tagged: php, php gratis, Programacion

Actualizacion modulo envio de correos en de PHPMimeMail a RMail

abril 8, 2010 9:21 am / Leave a Comment / David Rodriguez

Hemos venido utilizando desde hace muchos años el modulo PHPMimeMail para el envio de correos en PHP, es una clase que funciona muy bien y estaba muy implementado.

El problema es que se está quedando obsoleta. El mismo creador, ha creado RMail, otro modulo de envio que funciona para PHP5 y que hemos comprobado con nuestros desarrollos web, que mejora en un 70% los tiempos de envio.

El proceso de actualización es muy sencillo ya que los metodos utilizados en ambos módulos son similares.

Method Description
Constructor Doesn’t take any arguments. Not much to say I guess.
setCRLF(string $crlf) Sets the CRLF line ending type to use. You should not use this unless you’re sure you know what you’re doing, as the code will correctly (most of the time) determine which type to use by itself.
setSMTPParams(string $host,
int $port,
string $helo,
bool $auth,
string $user,
string $pass)
Set SMTP parameters when using SMTP to send the email. All optional, though not specifying any would be pointless… Pretty self explanatory really – hostname to connect to, port to connect to, text to send as part of the HELO command, whether to use SMTP authentication, and if so the username and password to use.
setSendmailPath(string $path) Sets the path to use when using sendmail method of sending the email. This should be the full path to the sendmail binary on your system, along with any command line parameters. Defaults to «/usr/lib/sendmail -ti».
setTextEncoding(object $encoding) Sets the encoding to use (if any) on the plain text part of the email. The argument should be one of the encoding objects, ie Base64Encoding, QPrintEncoding, SevenBitEncoding or EightBitEncoding. Bit pants about the 7bit/8bit names, but identifiers in PHP can’t start with a number. Tits.
setHTMLEncoding(object $encoding) Sets the encoding to use (if any) on the HTML part of the email. The argument should be one of the encoding objects, ie Base64Encoding, QPrintEncoding, SevenBitEncoding or EightBitEncoding.
setTextCharset(string $charset) Sets the characterset to use on the plain text portion of the email. Defaults to «ISO-8859-1».
setHTMLCharset(string $charset) Sets the characterset to use on the plain text portion of the email. Defaults to «ISO-8859-1».
setHeadCharset(string $charset) Sets the characterset to use on the headers of the email. Defaults to «ISO-8859-1».
setTextWrap(int $count) Set the point at which text is wrapped in the email. Defaults to 998, which is a limit imposed by the SMTP standard.
setHeader(string $name, string $value) Sets a header of the email. First argument if the name of the email, second is the value.
setSubject(string $subject) Sets the subject of the email.
setFrom(string $from) Sets the From: header of the email.
setPriority(mixed $priority) Sets the priority of the email. Defaults to «normal». Argument can be either «high», «normal» or «low», or 1, 3 or 5 respectively.
setReturnPath(string $return_path) Sets the Return-Path: of the email. This is the address to which bounces will be sent if the email fails to be delivered.
setCc(string $cc) Sets the Cc: header of the email. The email will be delivered to these addresses as well as those specified in the send() method.
setBcc(string $bcc) Sets the Bcc: header of the email. The email will be delivered to these addresses as well as those specified in the send() method. However, the Bcc: header will be removed from email before it is sent, so those addresses in the To: and Cc: headers will not know it has also been sent to these addresses. Hence, «Blind» Carbon Copy.
setText(string $text) Sets the text part of the email.
setHTML(string $html[, string $images_dir]) Sets the HTML part of the email. The optional second argument specifies a directory where the code should look for images referenced by the HTML. If found, these images will automatically be embedded into the email.
addEmbeddedImage(object $embeddedImage) Adds an embeddded image to the email. The argument should be on of the fileEmbeddedImage or stringEmbeddedImage objects, depending on the source of the image.
addAttachment(object $attachment) Adds an attachment to the email. The argument should be one of the fileAttachment or stringAttachment objects, depending on the source of the attachment.
send(array $recipients[, string $type]) Sends the email. The first argument is an array of recipients to whom the email will be sent to. The second is how to send the email. This can be one of «mail», «sendmail» or «smtp», and defaults to «mail».
getRFC822(array $recipients[, string $type]) This function first of all builds the email, and then returns it in text format. This is useful if you need to attach the email to another email. This could be done like so: $mail_2->addAttachment(new stringAttachment($mail_1->getRFC822(array(‘[email protected]’)), ‘message/rfc822’)) The first argument is an array of recipients to place in the To: header, whilst the second, optional, $type argument should be the same as that you intend to use eventually for the send() method. This is to ensure the correct line endings are used.
Posted in: Internet, Programacion / Tagged: optimización, php, Programacion, rmail

redireccionar a un idioma segun el pais del usuario

abril 5, 2010 1:14 pm / 5 Comments / David Rodriguez

Para redireccionar a un usuario según sea su pais de procedencia (bueno .. ya sabemos que los servidores desde donde se conectan los usuarios no son 100% fiables .. pero es la unica forma que tenemos de saberlo), utilizamos el api de hostip.info y cargamos el xml que nos dan.

Actualización (2017-06-14): El url api.hostip.info no está devolviendo nada. Buscaré otro api para actualizar el post.

Para ello hemos definido la siguiente función:

function getPaisProcedencia(){
$salida = »;

$IPADDRESS = $_SERVER[«REMOTE_ADDR»];

$archivo_xml = «http://api.hostip.info/get_xml.php?ip=».$IPADDRESS .»»;
$procedencia_xml = get_url_contents ($archivo_xml);

if (empty($procedencia_xml)){
$salida = »;
}else{
preg_match_all(«|<Hostip>(.*)</Hostip>|sU», $procedencia_xml, $items);
$lista_nodos = array();
foreach ($items[1] as $key => $item)
{
//preg_match(«|<gml:name>(.*)</gml:name>|s», $item, $mi_lugar);
//preg_match(«|<countryName>(.*)</countryName>|s», $item, $mi_pais);
preg_match(«|<countryAbbrev>(.*)</countryAbbrev>|s», $item, $mi_sigla);
$salida = $mi_sigla[1];
}
$procedencia_xml = «»;
}

return  $salida;
}

En esta función hemos utilizado la función get_url_contents descrita en un post anterior sobre optimizacion de file_get_contents en php.

Podemos sacar mucha información del xml de este API http://api.hostip.info/get_xml.php?ip=200.147.3.156

<HostipLookupResultSet version=»1.0.1″ xsi:noNamespaceSchemaLocation=»http://www.hostip.info/api/hostip-1.0.1.xsd»>
<gml:description>This is the Hostip Lookup Service</gml:description>
<gml:name>hostip</gml:name>
−
<gml:boundedBy>
<gml:Null>inapplicable</gml:Null>
</gml:boundedBy>
−
<gml:featureMember>
−
<Hostip>
<ip>200.147.3.156</ip>
<gml:name>(Unknown city)</gml:name>
<countryName>BRAZIL</countryName>
<countryAbbrev>BR</countryAbbrev>
<!– Co-ordinates are unavailable –>
</Hostip>
</gml:featureMember>
</HostipLookupResultSet>

El nodo sobre el que hemos realizado las comprobaciones es countryAbbrev aunque se podría utilizar countryName, aunque siempre vamos a usar menos recursos si comparamos abreviaturas que cadenas de nombres más largas.

Ojo, esta función no es recomendable utilizarla cada vez que tenemos una hit .. ya que ralentizaría nuestra maquina de manera injustificada. Asi que lo que recomiendo es utilizarla unicamente en la primera visita a nuestra web. Esto lo podemos controlar con sesiones, cookies, referer, etc … nosotros hemos utilizado el referer del usurio aunque otras opciones serían igualmente válidas.

Posted in: Internet, Programacion / Tagged: geoip, php, Programacion

Post Navigation

« Anterior 1 2 3 4 5 6 Siguiente »

Categorias

  • Base de datos
  • Empresas
  • Internet
  • Mac
  • marketing
  • Otros
  • Prensa
  • Programacion
  • Redes Sociales
  • Retos deportivos
  • Seguridad
  • SEO
  • servidores
  • SPAM
  • Uncategorized
© Copyright 2025 - Blog de David Rodriguez