Archive for August, 2007

Search current site with JavaScript

Thursday, August 30th, 2007

You’re on some website, and you’re sure that the text you’re looking for is somewhere in the mess of pages. Problem: the site doesn’t have a search feature.

Bookmark the following link (right click, “Add to Favorites”) and you can search any page by going to that page, and then clicking the bookmark you make of the link below. The script will pop up a small window into which you can type your search term, and then see Google’s results for that page.

Search Current Site

Crying of Lot 49 lives at Adobe

Wednesday, August 29th, 2007

Mark Snesrud and Bob Mayo took on the public art challenge, leading them to W.A.S.T.E. cash on some fancy radios, find hidden XML files, use computer programs to generate a 4,142 page equation that explained the signals but signified nothing, and finally crack the code to find the building is continually broadcasting the text of Thomas Pynchon’s “The Crying of Lot 49.” (Are they paying royalties on this or just betting that Pynchon is too cool to sue?) The whole explanation of how they broke the code is in this 18-page document (in PDF form, of course) ^

Lest you forget, there’s this old page… San Narciso Community College Thomas Pynchon Page. Circa 1994, updated 1997.

Thomas Pynchon captured the imagination of many of us, but probably no work was more influential than The Crying of Lot 49 because in this short book, he stopped the goofy metaphor-play and tackled industrial society with a biting critique of the loneliness and randomness of survival in this time. It always made me think of a postmodern analysis of The Great Gatsby without the delicious layers of irony. It’s the clearest-sighted of his books and one of the most loved as a result.

Convert UNIX linefeeds to Windows end of line characters

Friday, August 10th, 2007

I needed a file to do this, so cooked up a twenty minute hack. I’m not expert in the ways of any programming language, but write code that’s designed to be easily read and modified. Here’s a good basic template as well as a useful utility for converting UNIX text files to Windows, including removal of linefeeds (CRLF in Windows, LF in UNIX, CR on a Mac) so that you can easily translate UNIX files to Windows and old-school (pre-OS X) Macintoshes. There are people selling utilities to do this, but why would you need one, if you’ve got Perl installed?


#!/usr/bin/perl --

### use command line argument or default
$targetdir = "./";
$targetdir = $ARGV[0];

### setup variables
my @contents = "";
my $contentscounter = 0;

### main execution

chdir $targetdir;
&browseDir;
exit(0);

### functions

sub browseDir {

opendir (TARGETDIR, "./");
foreach my $file (sort readdir TARGETDIR) {
unless($file =~ m/^\./) {
if (-d $file) {
chdir $file;
browseDir($file);
chdir "../";
} # if directory file
else {
changeLF($file);
} # end else
} # end unless
} # foreach my file
close (TARGETDIR);
} # end browseDir

sub changeLF {

$targetfile = @_[0];

### load file into variable
open (TARGETFILE,"$targetfile") || die "Couldn't open targetfile: $!\n";
@contents = ;
close (TARGETFILE);

### transform variable
foreach $fileline (@contents) {
chomp($fileline);
}

### write file
open(TARGETFILE, ">$targetfile") || die "Cannot open targetfile: $!\n";
foreach $fileline (@contents) {
print TARGETFILE $fileline . "\r\n";
}
close (TARGETFILE);

} # end ChangeLF

A study of genius

Tuesday, August 7th, 2007

I’ve found that people who are great at something are not so much convinced of their own greatness as mystified at why everyone else seems so incompetent. ^

Nothing’s that hard once you put a clear, calm mind to it and some effort.