Archive for the ‘Tips’ Category
Tip: How to detect with PHP if iPhone visits your site
Saturday, January 30, 2010 2:17 1 CommentCurrently I’m developing some websites which “can be visited from iPhone” [the customer say that], the big thing is: there are some javascripts functions to detect it but when you use it with jQuery this “lock” the effects.
The solution is so easy, you just need to use this PHP script:
PHP<5.3.0
if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT']))
{
header("Location:/iphone.html");
}
PHP>=5.3.0
if (preg_match("/iPhone/",$_SERVER['HTTP_USER_AGENT']))
{
header("Location:iPhone.php");
}
Take Care: Is Important [...]
MySQL – Error: You can’t specify target table xxx for update in FROM clause
Thursday, December 17, 2009 0:27 1 CommentHace unos mins estuve jugando con una consulta en MySQL para poder insertar el orden de la búsqueda :
INSERT INTO Tabla (nombre,fecha,texto,orden) values ('".$nombre."','".$fecha."','".$texto."',(select max(orden)+1 from Tabla))
pero me dió el error:
You can’t specify target table ‘Tabla’ for update in FROM clause
El error se da tanto en count, min, max
La solución simple es hacer un select [...]
TIP: Evitar ordenamiento de columnas en DataGridView
Sunday, October 11, 2009 18:52 4 CommentsPara evitar que puedan ordenarte una columna en una Grilla de Windows Form [DataGridView], simplemente debes agregar este código luego de InitializeComponents();
en C#
GrillaCampos.Columns["NombreDeLaColumna"].SortMode = DataGridViewColumnSortMode.NotSortable;
en VB.Net
GrillaCampos.Columns("NombreDeLaColumna").SortMode = DataGridViewColumnSortMode.NotSortable
Saludos!
CÓMO: Ver el dígito verificador de un Rut
Wednesday, June 10, 2009 16:22 No CommentsHace un tiempo en clases nos pidieron cómo validar un rut, y todos fueron a la página de juque a ver cómo se hacía. Ahroa “le traémos lo contrario” cómo obtener el dígito verificador de un Rut [para usar en sitios como averigualo.cl]. Aclaro que el código está modificado en base a lo programado por [...]
