Add Scroogle to your search area in Firefox 2.0 Install the 'Scroogle Scraper' search plugin.

announcements


Google just released their new browser, Chrome. You can read all about it, comic-style, on Google Books.

I just downloaded it. I’ll let you know how it goes

mcbride-lies.jpgWe all know that SCO sucks. By extension, the people who work for that deplorable company also suck and because now SCO isn’t doing so well financially, SCO is laying off a bunch of employees. These people took the bet that SCO would win and now that SCO is losing, they’ll expect to pretend that nothing ever happened and jump to another job. Of course, they stood to gain a lot if SCO’s attempt to extort money out of the Linux world would have worked. Fortunately SCO’s plan has failed miserably. Sorry SCO employees, You can’t eat your cake and have it too (as the saying originally went) — no jobs for you!

You all remember Josh Coates, CEO of Berkeley Data Systems/Mozy, right? Mozy is the company with the Windows program which allows you to backup your harddrive to their petabyte array all safe and securely. Truth be told, I could never get their app to work on my system, but that’s hardly significant. What is important is that EMC, the king of storage, just bought Mozy for a cozy 76 million dollars.

Mozy had raised only 1.9 million in capital, which makes their VC people (Wasatch Ventures) very, very happy.

You’ll also remember that Josh’s Mozy held the popular $20,000 dollar computer programming “death matches.”

Strong work, Josh!

* yes, I know that “mozying” is not a word; it’s “moseying”

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);

Send to a friend * Print this page * Join the club * Talk with my robot * Advertise here * Search this Site * Donate * Link to me


Web hosting by Utah Hub *  Powered by CreativeTap *  In association with Segomo
Unless otherwise noted, Copyright 2004-2006, Ryan Byrd. All Rights Reserved.
Ryan Byrd dot net -- probably the coolest site in Utah