Posted by Brad | Posted in Recommendations | Posted on 25-07-2011
The part of the guathon presentation I went to a couple of months ago in Leicester square that went right over my head was one by Steve Sanderson on a JavaScript framework called Knockout, it’s obviously a presentation he has delivered many times as I have seen from one of the mix recorded presentations you can check it out and see how much you can absorb at the initial speed.
I emailed Steve to get the presentation slides afterwards which he kindly sent over, however he just took time out one weekend to publish a really nice tutorial section at learn.knockoutjs.com if you want to get your head around a framework that can observably bind text and form elements to update in real time on the client without AJAX then have a look at the tutorials which make far more sense than the super fast presentation!.
I need to update my AutoHotKey library now to get some of these useful snippets in there (text expanders are a bit lazy but so much more efficient than remembering everything and repetitive typing)
See how the JQuery Datepicker looks below, the example uses code from the google CDN so is quick to load for your visitors no matter where they are in the world.
Posted by Brad | Posted in Coding | Posted on 10-06-2011
First create your page on the server that can take a parameter to get some form of data and return matches found, in this case I just want to get a body of text from a database. Note that you want to prevent caching of the response in the browser above the include that supplies the connection string in this classic ASP server side script.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><%
pStr ="private, no-cache, must-revalidate"Response.ExpiresAbsolute= #2000-01-01#
Response.AddHeader"pragma", "no-cache"Response.AddHeader"cache-control", pStr
%>
<!--#include file="../Connections/yourConnection.asp" -->
<%Dim ID
ID =Request("ID")Set cmd =Server.CreateObject("ADODB.Command")
cmd.ActiveConnection= ConnString
cmd.CommandText="SELECT TOP 1 Message FROM dbo.Table WHERE ID = "& ID
Set rs = cmd.ExecuteIf rs.eof=falseThenResponse.Write(rs("Message"))EndIfSet rs =nothing%>
Below you find the client webpage containing the code required to change the innertext of a textarea to the response returned by the page above. You don’t need to worry about uploading the JQuery API to your server as it’s hosted on Google’s CDN to make it load nice and snappy geographically.