Les dejo el código para crear una función en Excel que les permita validar si una celda en particular contiene o no solo texto, pues Excel puede determinar si el contenido de la celda es o no Numérico mediante la función ESNUMERO(), pero no viene nada para texto, de igual forma la adapté para validar nombres en Español...
Public Function TextOnly(ByVal d As Variant) As Boolean
TextOnly = True
Dim src, ptrn, ptrn1, re, re1, Match, Matches1, Matches
ptrn = "\W+"
ptrn1 = "[0-9]"
' Create the regular expression.
Set re = New RegExp
re.Pattern = ptrn
re.IgnoreCase = False
re.Global = False
Set re1 = New RegExp
re1.Pattern = ptrn1
re1.IgnoreCase = False
re1.Global = False
' Perform the search.
Set Matches = re.Execute(d)
Set Matches1 = re1.Execute(d)
' Iterate through the Matches collection.
If Matches.Count > 0 Or Matches1.Count = 0 Then
TextOnly = False
End If
End Function
Public Function Names(ByVal d As String) As Boolean
Dim src, ptrn, ptrn1, re, re1, Match, Matches1, Matches
ptrn = "[^ A-Za-zñáéíóú]"
' Create the regular expression.
Set re = New RegExp
re.Pattern = ptrn
re.IgnoreCase = False
re.Global = False
' Perform the search.
Set Matches = re.Execute(d)
' Iterate through the Matches collection.
If Matches.Count > 0 Then
Names = False
Else
Names = True
End If
End Function
martes, 31 de julio de 2012
lunes, 4 de junio de 2012
GET INDEX AND VALUES FROM ENUM FIELD MYSQL PHP
function enum_select($table,$field) {
$result=mysql_query("SHOW COLUMNS FROM `$table` LIKE '$field'");
if(mysql_num_rows($result)>0){
$row=mysql_fetch_row($result);
$options=explode("','", preg_replace("/(enum|set)\('(.+?)'\)/","\\2", $row[1]));
$i=1;
foreach ($options as $value) {
@$option .= '';
}
} else {
$options=array();
}
return $option;
}
AND HTML
<.select>
<.option>[Seleccione una]<./option>
<./select>
Etiquetas:
PHP MYSQL
miércoles, 28 de diciembre de 2011
Libro de JQuery Gratis OnLine
Que buen aporte de http://desarrolladorsenior.blogspot.com/2011/03/libro-gratuito-de-jquery-en-espanol.html
http://librojquery.com/
CONTENIDOS DEL MATERIAL
Capítulo 1: Bienvenido
Capítulo 2: Conceptos Básicos de JavaScript
Capítulo 3: Conceptos Básicos de jQuery
Capítulo 4: El núcleo de jQuery
Capítulo 5: Eventos
Capítulo 6: Efectos
Capítulo 7: Ajax
Capítulo 8: Extensiones
Capítulo 9: Mejores Prácticas para Aumentar el Rendimiento
Capítulo 10: Organización del Código
Capítulo 11: Eventos Personalizados
CONTENIDOS DEL MATERIAL
Capítulo 1: Bienvenido
Capítulo 2: Conceptos Básicos de JavaScript
Capítulo 3: Conceptos Básicos de jQuery
Capítulo 4: El núcleo de jQuery
Capítulo 5: Eventos
Capítulo 6: Efectos
Capítulo 7: Ajax
Capítulo 8: Extensiones
Capítulo 9: Mejores Prácticas para Aumentar el Rendimiento
Capítulo 10: Organización del Código
Capítulo 11: Eventos Personalizados
Etiquetas:
Jquery,
Libros,
Publicaciones,
Recomendados
jueves, 25 de agosto de 2011
configurar servidor web apache + php con soporte para mysql en servidor independiente
sudo apt-get install apache2 (sudo apt-get install apache2-mpm-worker libapache2-mod-fcgid)
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Note que si apache esta bien instalado usted puede omitir la primera linea. Sus archivos web podrá encontrarlos en /var/www/
donde se debe guardar el archivo info.php con
soporte para mysql
para ver que está disponible para php5
apt-cache search php5
Edit PHP Configuration to Work With MYSQL (Ubuntu Dapper)
In Dapper Drake, "extension=mysql.so" and "extension=mysqli.so" are enabled in the php.ini file out-of-the-box. However, sometimes php is not looking for those files in the right directory. You have then to move your files or modify the php.ini configuration.:
First solution
locate the directory where the extension files are placed:
locate mysql.so
(change mysql.so in mysqli.so if you want to install the mysqli functions)
-then modify the php.ini file to indicate the right place for the extension directory:
$ gksudo "gedit /etc/php4/apache2/php.ini"
or if you are using php5
$ gksudo "gedit /etc/php5/apache2/php.ini"
Look for the 'extension_dir' property, and set it to the directory where you found the mysql(i).so file:
extension_dir= "/usr/lib/php5/20051025/"
Restart apache, and test if your mysql(i) functions are working.
apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
/etc/init.d/apache2 restart
Como parte final, es recomendable editar el archivo /etc/php5/apache2/php.ini y verificar las recomendaciones sobre un servidor de producción y uno de desarrollo ej.
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = off
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Note que si apache esta bien instalado usted puede omitir la primera linea. Sus archivos web podrá encontrarlos en /var/www/
donde se debe guardar el archivo info.php con
soporte para mysql
para ver que está disponible para php5
apt-cache search php5
Edit PHP Configuration to Work With MYSQL (Ubuntu Dapper)
In Dapper Drake, "extension=mysql.so" and "extension=mysqli.so" are enabled in the php.ini file out-of-the-box. However, sometimes php is not looking for those files in the right directory. You have then to move your files or modify the php.ini configuration.:
First solution
locate the directory where the extension files are placed:
locate mysql.so
(change mysql.so in mysqli.so if you want to install the mysqli functions)
-then modify the php.ini file to indicate the right place for the extension directory:
$ gksudo "gedit /etc/php4/apache2/php.ini"
or if you are using php5
$ gksudo "gedit /etc/php5/apache2/php.ini"
Look for the 'extension_dir' property, and set it to the directory where you found the mysql(i).so file:
extension_dir= "/usr/lib/php5/20051025/"
Restart apache, and test if your mysql(i) functions are working.
apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
/etc/init.d/apache2 restart
Como parte final, es recomendable editar el archivo /etc/php5/apache2/php.ini y verificar las recomendaciones sobre un servidor de producción y uno de desarrollo ej.
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = off
Etiquetas:
apache,
linux,
mysql,
servidor de bd,
servidor web
miércoles, 27 de abril de 2011
Error 1312 (0A000): PROCEDURE can't return a result set in the given context.
Cuando se conecte a mysql y pretenda utilizar un procedimiento almacenado, debe pasar un especial Flag para MySQL a través del comando connect, de lo contrario no obtendrá los resultados devueltos, y dará lugar a este error:
Error 1312 (0A000): PROCEDURE x can't return a result set in the given context.
Para corregir esto, cambie su cadena de conexion, adicionando ",false,131072", o ",false,65536" en los últimos 2 campos en:
$this->con = mysql_connect(host,user,password,false,65536);
según la documentación de mysql, se debe activar CLIENT_MULTI_RESULTS, sin embargo, al activar CLIENT_MULTI_STATEMENTS automáticamente se activa el primero.
ver en php.net o php.net y en dev.mysql.com
Error 1312 (0A000): PROCEDURE x can't return a result set in the given context.
Para corregir esto, cambie su cadena de conexion, adicionando ",false,131072", o ",false,65536" en los últimos 2 campos en:
$this->con = mysql_connect(host,user,password,false,65536);
según la documentación de mysql, se debe activar CLIENT_MULTI_RESULTS, sin embargo, al activar CLIENT_MULTI_STATEMENTS automáticamente se activa el primero.
ver en php.net o php.net y en dev.mysql.com
lunes, 25 de abril de 2011
Crear backup automáticos de bases de datos MySQL
Tutorial: Crear backup automáticos de bases de datos MySQL
set FECHA=%date%
set FECHA=%FECHA:/=%
set FECHA=%FECHA: =%
set FECHA=%FECHA::=%
set FECHA=%FECHA:,=%
set FILE=C:\\Backups\\Backup_%FECHA%.sql
C:/mysql/bin/mysqldump.exe -h SERVER -uUSER -pPASSWORD -r %FILE% DBNAME
En la última linea ubicar la ruta a mysqldump.exe, el resto dejarlo tal cual reemplazando SERVER USER PASSWORD y DBNAME.
Funciona perfecto
Traido de techdays
set FECHA=%date%
set FECHA=%FECHA:/=%
set FECHA=%FECHA: =%
set FECHA=%FECHA::=%
set FECHA=%FECHA:,=%
set FILE=C:\\Backups\\Backup_%FECHA%.sql
C:/mysql/bin/mysqldump.exe -h SERVER -uUSER -pPASSWORD -r %FILE% DBNAME
En la última linea ubicar la ruta a mysqldump.exe, el resto dejarlo tal cual reemplazando SERVER USER PASSWORD y DBNAME.
Funciona perfecto
Traido de techdays
Etiquetas:
mysql
miércoles, 13 de abril de 2011
Error: 1045 Mysql Access denied for xxxx@xxxxxx using password: yes, (acceso remoto)
Bueno este error se presenta, bien por que el nombre de usuario esta mal escrito, o el password, pero también puede ser por resctricciones de acceso establecidas en la tabla user en la bd mysql, particularmente en el campo Host, en donde podemos establecer desde cual o cuales direcciones IP o nombres de maquina nos podemos conectar, principalmente este problema se presenta con el acceso a un servidor remoto, se puede consultar la documentación de este suceso, aqui
El script para mysql quedaría asi:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'david'@'192.58.197.5
' IDENTIFIED BY 'esparragos' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
De esta forma solo basta con acceder al servidor directamente y modificar los permisos, o consultar las IP y cambiar la mascara de la IP en nuestra maquina.
sds.
GRANT ALL PRIVILEGES ON db.* TO david@'192.58.197.0/255.255.255.0';
{acceso a david desde cualquier ip en el rango}
GRANT ALL PRIVILEGES ON db.* TO david@'192.58.197.5';
{acceso a david únicamente desde 192.58.197.5}
GRANT ALL PRIVILEGES ON db.* TO ''@%;
{acceso a cualquier persona desde cualquier lugar}
El script para mysql quedaría asi:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'david'@'192.58.197.5
' IDENTIFIED BY 'esparragos' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
De esta forma solo basta con acceder al servidor directamente y modificar los permisos, o consultar las IP y cambiar la mascara de la IP en nuestra maquina.
sds.
Etiquetas:
mysql
Suscribirse a:
Entradas (Atom)