Archives for Shortcuts and Abstraction

Convert number to binary in Javascript

Why did it take me so long to find this? Probably because I didn’t use radix in my Google search. Of course. Thanks to “Philip M” for the clue and thanks to W3Schools.com for the reference (see here for more on the unary “+” operator to convert a string to number). var str = ’37′; [...]

Adding CSS support to HTML5 in IE6, IE7 & IE8

This is another diamond in the rough I found today. We’re all moving to HTML5, but IE 6-8 has to make it difficult (what’s different, right?). Well, you can get IE to cooperate on a basic level with this little trick. See John Resig’s examples for simple instructions on how to use it. Basically, IE [...]

JSON content type in classic ASP

I spent a considerable portion of my morning yesterday trying to get my classic ASP to serve up JSON to an application I’m working on. Finally, I found a subtle difference in the “Response.ContentType” property and “Response.AddHeader()” method (I code in JavaScript, btw). I set “Response.ContentType = ‘application/json’” and it always returned a nicely-formatted JSON [...]

Detecting whether a query string parameter is set in classic ASP

In PHP, there’s a fancy little function called “isset()” that allows you to test whether a variable has been set (as opposed to being instantiated or declared).  Classic ASP doesn’t, and I have to relearn how to do it every time.  I code ASP JavaScript, so here’s what I found: var q = Request.QueryString(‘query’) + [...]

CSS !important supersedes DHTML changes

Finally, with the help of Firebug and lots of patience, I discovered why my jQuery animation wasn’t working (on a personal project of mine, more on that later…)  Essentially I intended to animate a div from 100px to a calculated height ($(window).document.height()-$(this).height()) but for the life of me, I could not get it to work.  [...]

echo function in ASP

Javascript (actually JScript, whatever): echo = function(x) {return Response.Write(x);} Why didn’t I think of this earlier? Just added this line to my connection file and saved myself 10 keystrokes every time I want to print to screen. The wonders of coding in Notepad.