miércoles, 30 de junio de 2010

SQL - Comparar Fechas sin Horas

Con esta instrucción CONVERT(date, FechaVisita,103) , saca solo la fecha sin la hora.
Ejm:

select
PK_Visita
,FechaVisita
, convert(date,GETDATE(),103)
from Visita
where CONVERT(date, FechaVisita,103) >= CONVERT(date,getdate(),103)

viernes, 18 de junio de 2010

js script desde server-code

Aqui les dejo dos maneras de invocar a codigo de cliente desde servidor, espero les sea de utilidad

Dim stScript As String = _
"" & vbCrLf & vbCrLf
Page.ClientScript.RegisterStartupScript(GetType(Page), "_RadMsgBox_radalert", stScript)


ScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType(), Guid.NewGuid().ToString(), "returnToParent();", True)

martes, 15 de junio de 2010

SQL Insertar un Select en un Insert

INSERT INTO Tabla1 (Nombre,Nic,Servicios,Email,PaginaWeb,Telefono,Usuario,Contraseña,Direccion )

Select

Pr.Nombre,Pr.Nic,Pr.Servicios,Pr.Email,Pr.PaginaWeb,Pr.Telefono,Pr.Usuario,
Pr.Contraseña,Pr.Direccion
from Tabla2 as Pr

Evento Error de llamada Asincrona $.ajax

Podemos agregar un evento “error”, cuando suceda un error en la llamada asincrona.

Ejemplo para poner el evento “error”

$.ajax({
type: "post",
url: "http://myServer/cgi-bin/broker" ,
dataType: "text",
data: {
'_service' : 'myService',
'_program' : 'myProgram',
'start' : start,
'end' : end
},
beforeSend: function() {
$("#loading").removeClass("hide");
},
timeout: 5000,
error: function(request,error) {
$("#loading").addClass("hide");
if (error == "timeout") {
$("#error").append("The request timed out, please resubmit");
}
else {
$("#error").append("ERROR: " + error);
}
},
success: function(request) {
$("#loading").addClass("hide");
var t = eval( "(" + request + ")" ) ;
} // End success
}); // End ajax method



Y una lista de otros eventos que podemos utilizar en la llamada Asincrona

Referencia: http://docs.jquery.com/Ajax_Events

Events
This is the full list of Ajax events that are broadcast, and in the order in which they are broadcast. The indented events are broadcast for each and every Ajax request (unless a global option has been set). The ajaxStart and ajaxStop events are events that relate to all Ajax requests together.

ajaxStart (Global Event)
This event is broadcast if an Ajax request is started and no other Ajax requests are currently running.
beforeSend (Local Event)
This event, which is triggered before an Ajax request is started, allows you to modify the XMLHttpRequest object (setting additional headers, if need be.)
ajaxSend (Global Event)
This global event is also triggered before the request is run.
success (Local Event)
This event is only called if the request was successful (no errors from the server, no errors with the data).
ajaxSuccess (Global Event)
This event is also only called if the request was successful.
error (Local Event)
This event is only called if an error occurred with the request (you can never have both an error and a success callback with a request).
ajaxError (Global Event)
This global event behaves the same as the local error event.
complete (Local Event)
This event is called regardless of if the request was successful, or not. You will always receive a complete callback, even for synchronous requests.
ajaxComplete (Global Event)
This event behaves the same as the complete event and will be triggered every time an Ajax request finishes.
ajaxStop (Global Event)
This global event is triggered if there are no more Ajax requests being processed.

martes, 8 de junio de 2010

La tecla que se pulso en la pagina en JavaScript

$().ready(function() {
document.onkeypress = manejarTecla;
});

var Tecla_pulsada;
function manejarTecla(elEvento) {
var evento = elEvento || window.event;
Tecla_pulsada = evento.charCode || evento.keyCode;
var srcEl = evento.srcElement ? evento.srcElement : evento.target;
//si Tecla_pulsada == 13 -> Enter
}

sábado, 5 de junio de 2010

postear en twitter

Compartir en Twitter

Leer más: http://devblab.net/como-crear-un-boton-para-enviar-post-a-twitter-en-wordpress/#ixzz0pqeQebse
Under Creative Commons License: Attribution






miércoles, 2 de junio de 2010

shared facebook

señores les dejo una joyita, aunque es parece facil, pues a mi me costo encontrarla:

Es un ejemplo para que puedan postear información hacia el facebook:

function fbs_click()
{
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}