viernes, 13 de noviembre de 2009

Generar XML sin TYPES | Win+Linux Ruby on Rails

En el controller:
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @MiCollection.to_xml(:skip_types => true) }

Convertir Lista de Palabras a Mayusculas o Minuscula | Linux Bash

Palabras es un txt con palabras separas por espacio.

ToLower:
for i in $(cat palabras); do
lc=`echo $i | tr '[A-Z]' '[a-z]'`
print $i
print $lc
done
ToUpper:
for i in $(cat palabras); do
lc=`echo $i | tr '[a-z]' '[A-Z]'`
print $i
print $lc
done

Instalando Templates de SiteBuilder desde Fedora a Debian | Linux Fedora Debian

Despues de migrar un servidor Fedora a uno nuevo en Debian para poder instalar los templates anteriores hay que hacer lo siguiente:
apt-get install alien
Luego generamos un archivo install.sh e incorporamos este script donde se encuentran los templates .rpm:
#!/bin/bash
#correrlo sh rpm-to-deb.sh > rpm-to-deb.log 2>&1
for i in $( ls|grep "\.rpm" ); do
alien -d $i
done
for i in $(ls|grep "\.deb"); do
dpkg -i $i
done
##dpkg -i *.deb opcion a la instalacion anterior
cp -rf /usr/local/sitebuilder/htdocs/templates/* /opt/sitebuilder/htdocs/templates/
chown www-data /opt/sitebuilder/htdocs/templates/ -R
sb_config --update_templates
Despues solo queda ejecutar dicho script dentro del folder de donde estan los .rpm:
sh install.sh

Extraer bloque de texto | Linux AWK

Este script permite extraer bloques de texto encerrados entre patrones de inicio (start) y fin (end) a partir del archivo "inputfile" generando el de salida "outputfil"
cat inputfile | awk '/start/,/end/ { print }' > outputfile

viernes, 9 de octubre de 2009

Error Access phpMyAdmin from Plesk | Plesk + phpMyAdmin

ERROR:

"#1045 - Access denied for user 'pma_xxxxxxx'@'localhost' (using password: YES)"

SOLUCION:


/usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.inc.php
Dentro de este archivo se encuentra los siguientes datos:
$cfg['Servers'][$i]['controluser'] = 'yourUSER';
$cfg['Servers'][$i]['controlpass'] = 'yourPASSWORD';
$cfg['Servers'][$i]['pmadb'] = 'yourDATABASE';

Para solucionar esto hacemos lo siguiente:
  1. mysql -uadmin -p`cat /etc/psa/.psa.shadow`
  2. use mysql;
  3. insert into user values
    ('localhost','yourUSER',password('yourPASSWORD'),
    'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',
    '','','','',0,0,0,0);
  4. INSERT INTO `db` VALUES
    ('localhost','yourDATABASE','yourPASSWORD',
    'Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N');
  5. FLUSH PRIVILEGES;
  6. EXIT



viernes, 4 de septiembre de 2009

Error Installing Plesk 8.6 | PSA 8.6 Debian 5 (lenny)

ERROR:
s2:/var/log# /etc/init.d/psa start
Starting openbsd-inetd service... done
Starting bind9 service... done
Starting mysql service... done
Starting qmail service... done
Starting courier-imap service... done
Starting postgresql service... not installed
Starting psa-spamassassin service... not installed
Starting Plesk... failed
Starting drwebd service... not installed


s2:/opt/psa/admin# /opt/psa/admin/bin/httpsdctl start
/opt/psa/admin/bin/httpsdctl: line 104: 20916 Segmentation fault $HTTPD

s2:/opt/psa/admin# tail /var/log/messages
Sep 4 06:25:01 s2 kernel: [264132.460680] php[20274]: segfault at c54745 ip 7f77fb3a4039 sp 7fff05c68e20 error 7 in libxmlrpc.so.3.6.15[7f77fb39f000+d000]

INFORMACION:
s2:/opt/psa/admin# dpkg -l |grep libxmlrpc
ii libxmlrpc-c3 1.06.27-1 A lightweight RPC library based on XML and H



SOLUCION:
El problema estaba en dicha librería, por lo tanto la solución fue pasar eso a ETCH y hacer un HOLD para que no se sobreescriba con futuras actualizaciones...

s2:~# wget http://ftp.us.debian.org/debian/pool/main/x/xmlrpc-c/libxmlrpc-c3_0.9.10-4_amd64.deb

s2:~# wget http://ftp.us.debian.org/debian/pool/main/w/w3c-libwww/libwww-ssl0_5.4.0-11_amd64.deb

s2:~# dpkg -i libwww-ssl0_5.4.0-11_amd64.deb
Selecting previously deselected package libwww-ssl0.
(Reading database ... 54936 files and directories currently installed.)
Unpacking libwww-ssl0 (from libwww-ssl0_5.4.0-11_amd64.deb) ...
Setting up libwww-ssl0 (5.4.0-11) ...
Processing triggers for man-db ...

s2:~# dpkg -i libxmlrpc-c3_0.9.10-4_amd64.deb
(Reading database ... 55051 files and directories currently installed.)
Preparing to replace libxmlrpc-c3 0.9.10-4 (using libxmlrpc-c3_0.9.10-4_amd64.deb) ...
Unpacking replacement libxmlrpc-c3 ...
Setting up libxmlrpc-c3 (0.9.10-4) ...

s2:~# /opt/psa/admin/bin/httpsd start
Processing config directory: /opt/psa/admin/conf/httpsd.*.include

s2:~# /etc/init.d/psa start
Starting openbsd-inetd service... done
Starting bind9 service... done
Starting mysql service... done
Starting qmail service... done
Starting courier-imap service... done
Starting postgresql service... not installed
Starting psa-spamassassin service... not installed
Starting Plesk... done
Starting drwebd service... not installed

s2:~# dpkg -l|grep libxmlrpc
ii libxmlrpc-c3 0.9.10-4 A lightweight RPC library based on XML and H
ii libxmlrpc-c3-dev 1.06.27-1 A lightweight RPC library based on XML and H

s2:~# dpkg -l|grep libwww
ii libwww-ssl0 5.4.0-11 The W3C-WWW library (SSL support)

s2:~# echo "libxmlrpc-c3 hold"|dpkg --set-selections

s2:~# echo "libwww-ssl0 hold"|dpkg --set-selections

s2:~# dpkg --get-selections | grep hold
libwww-ssl0 hold
libxmlrpc-c3 hold