Archive for the 'computery stuff' Category

One reason why books matter

Sunday, January 18th, 2009

Occasionally, I encounter someone who proclaims the death of books. The digital realm has deprecated the print realm, so the argument goes, and books are unwieldy/unsearchable/bad for the environment/etc. The same argument is more often applied (I think) to magazines and newspapers, which (so the argument goes) should be present these days only in museums [...]

area code lookup tool

Friday, February 29th, 2008

For those of you who might be interested, I’ve slapped together a little command-line area code lookup tool. It’s a really simple couple of scripts using grep to locate what you’re searching for. It works on Unix-like systems with bash installed (Linux, OS X, etc).
You can download it here. Follow the enclosed instructions to [...]

geek stuff – handling Microsoft Word text in web development

Tuesday, November 13th, 2007

Note: Please contribute to this code in comments, if you find mistakes or know of improvements.
It’s surprising to most people – especially computer programmers, it seems – that the English language actually has more than one kind of single quote and one kind of double quote. In fact, if you go back to single-quote characters [...]

geek stuff: IE6 “Page cannot be displayed” fix in PHP

Thursday, September 20th, 2007

If you’re working with forms in PHP, and especially if you’re working with forms that have multiple steps, you’ve probably run across the “back button” problem in IE6. Here’s what it looks like:
1) you fill out a form and click the “submit” button – this takes you to another page.
2) you click the “back” [...]

geek stuff: passing parameters to onreadystatechange in AJAX

Thursday, September 6th, 2007

Maybe everyone knows this, but I’ve seen very little about it online. The vast majority of AJAX-oriented functions looks something like this:

var xmlHttp
function showHint(str)
{
if (str.length==0)
  { 
  document.getElementById(“txtHint”).innerHTML=”"
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert (“Browser does not support HTTP Request”)
  return
  } 
var url=”gethint.php”
url=url+”?q=”+str
url=url+”&sid=”+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open(“GET”,url,true)
xmlHttp.send(null)

This function (taken from a w3schools tutorial) calls a function named stateChanged() when it receives data. stateChanged handles the display of response data, and looks like this:

function stateChanged() 

if (xmlHttp.readyState==4 || xmlHttp.readyState==”complete”)
 { 
 document.getElementById(“txtHint”).innerHTML=xmlHttp.responseText 
 } 
}

Note that this function accepts no [...]

@ somniloquy.org