November 2006
Monthly Archive
Tue 21 Nov 2006
Maybe you want to print to PDF. maybe you’ve used programs like: http://www.pdf995.com/
WARNING: THIS DOESN’T YET WORK WITH VISTA!
FYI, a lot of the Windows PDF printers are simply generic PS printers which are connected to ghostscript (which has PS-PDF conversion functionality). http://www.cs.wisc.edu/~ghost/
In fact, you can make your own windows PDF printer by downloading ghostscript and redmon
http://www.cs.wisc.edu/~ghost/redmon/index.htm
“The RedMon port monitor redirects a special printer port to a program. … RedMon can be used with any program that accepts data on standard input.Using RedMon you create redirected printer ports. If you connect a Windows printer driver to the redirected printer port, all data sent to the redirected port will be forwarded by RedMon to the standard input of a program. This program is then responsible for processing the data and producing new output.”
I’ve done this and it’s easy to do.
Here are two step-by-step tutorials to creating a free PDFWriter using Ghostscript:
http://www.stat.tamu.edu/~henrik/GSWriter/GSWriter.html
http://kenchiro.tripod.com/howtoPDF.html
Wed 8 Nov 2006
if you’re into ajax, you’ve no doubt used the Scriptaculous Javascript library and the Prototype Javascript framework
on the scriptaculous demo site, they have a sortable demo
I modified that script ever-so-slightly and wrote a
small php script to go along with it and posted an invention quiz to my ryanbyrd dot net blog
<?
$answer = “42351″;
$guess = implode('’,$_REQUEST[’list’]);
if ($answer==$guess)
{
echo(”correct!”);
?>
<ol>
<li><a href=”http://inventors.about.com/library/inventors/bltelegraph.htm” target=”_blank”>telegraph 1838</a></li>
<li><a href=”http://inventors.about.com/od/bstartinventors/a/fax_machine.htm” target=”_blank”>fax machine 1843</a></li>
<li><a href=”http://inventors.about.com/library/inventors/bltelephone.htm” target=”_blank”>telephone 1876</a></li>
<li><a href=”http://inventors.about.com/od/rstartinventions/a/radio.htm” target=”_blank”>radio 1901</a></li>
<li><a href=”http://inventors.about.com/library/inventors/bltelevision.htm” target=”_blank”>television 1929 (cathode ray tube) </a></li>
</ol>
<?
}
else
{
echo(”Keep trying!”);
}
die();
?>
Wed 1 Nov 2006
In my other blog (the coolest site in Utah), I just wrote about the Mozy Programming Contest. On the Mozy Contest Site, they list a sample problem:
We are looking for sequences of n > 0 integers where the absolute values of the differences of successive elements are included in the set of numbers 1 through n - 1. For instance,
4 1 2 3
is a match, because the absolute differences are 3, 1, and 1, respectively where n is 4.
8 6 2
is not a match, because the absolute differences are 2 and 4 respectively where n is 3.
The definition implies that any sequence of a single integer is a match. Write a program to determine whether each of a number of sequences is a match.
Input
Each line of input contains a sequence of n integers where n < 1024.
Output
For each line of input generate a line of output printing ‘match’ or ‘not a match’.
Here’s my php solution:
$fp = fopen ($argv[1],”r”);
while($line=fgets($fp,4092))
{
$numbersArray = split(” “,$line);
$output=”match”;
$size=count($numbersArray);
for ($i=0;$i<($size-1);$i++)
{
$difference = abs($numbersArray[$i]-$numbersArray[$i+1]);
if ($difference>($size-1)||!$difference)
{
$output = “not a match”;
break;
}
}
echo $output.”\n”;
}
fclose($fp);