» 2003 » February

Archive for February, 2003

Textile

Thursday, February 27th, 2003

Today, I got an email from Dean Allen saying that I can use Textile in Finetto (the CMS I’ve been working on for quite some time).

This is great news since it lets me focus on other areas of Finetto, without having to worry about processing text. Besides, the Textile system is fantastic at what it does. I couldn’t come up with better (you should see the cludges that hold the site together at the moment). Thanks, Dean!

When I Argue…

Wednesday, February 26th, 2003

This site is, perhaps, the internets finest moment; bursting with comedy, insight and bizarreness. Those are the cornerstones of the web. Well, maybe porn is the cornerstone, but in the absence of that then it’s those 3 things.

Back to the site: Imagine the world’s most argumentative couple. And then imagine the male of the pair documenting everything. You get such classic quotes as:

I eat two-fingered Kit-Kats like I’d eat any other chocolate bars of that size, i.e., without feeling the need to snap them into two individual fingers first. Margret accused me of doing this, ‘deliberately to annoy her’.

Read the whole page. It’s full of the most contrived logic. You know, the sort of stuff we all like to use in arguments with people we love.

The link? Things My Girlfriend And I Have Argued About

PHP Challenge #2

Wednesday, February 26th, 2003

It’s time for the second PHP challenge. This time I want an Integer to Roman Numeral converter. So the script should accept a single parameter (an integer), and return the roman numeral which corresponds to the integer. If anyone has any difficulty trying to work out how to do this, search google for information on roman numerals.

Here are the rules:

  • The winner is the person who writes the shortest script that works on sample integers that I will run on it
  • All functions must return a value,
  • All functions must be called RNC,
  • All functions submitted are considered public domain and hence can be reproduced and used with or without credit to anyone by anyone (so no bitching if someone rips off your script after the challenge finishes),
  • The winning script will be archived here for prosperity and to help others,
  • New rules may be added here at any time,
  • New Rule: The script should be able to handle integers in the range 1 to 4999. If no-one manages this, the upper-limit will be lowered to 3999. Handling integers outside this range is unnecessary,
  • My decision is final, but the shortest (file size) script will be the winner,
  • All functions should be submitted to Solitude@vkps.co.uk,
  • The deadline for entries is 12pm GMT on March 5th 2003

That should be fairly simple to follow. Any questions should be sent to the same email address. Good luck!

PHP Challenge #1 Results

Monday, February 24th, 2003

Thanks to everyone who submitted scripts for this little challenge. The scripts have been tested and there is a clear winner. But let’s start at 3rd place, which goes to Bane with a 94 byte entry:
function GCD($A,$B){
for($i=1,$MAX=1;$i<=$A;$i++){
if(!($A%$i)&&!($B%$i)){
$MAX=$i;
}
}
return$MAX;
}
This entry used a similar method to most other entries to work out the GCD, but was quite a bit smaller than most entries.

Unfortunately, it was 1 byte larger than Jante’s 93 byte entry:
function GCD($num1,$num2){
while($num2!=0){
$t=$num1%$num2;$num1=$num2;$num2=$t;
}
return $num1;}
Now this entry could have been made much smaller by replacing $num1 with $n and $num2 with $m (or any other 1 letter variable name), but not much can be done about that now.

The clear leader, however, was ZeroByte’s 58 byte entry:
function gcd($n,$m){
if(!$m)return$n;return gcd($m,$n%$m);
}
That is some fantastic use of recursion to get the size right down. Congratulations, ZeroByte!

It should be noted that the winning entry will be archived soo. Also, the code sizes shown were for all formatting and comments removed.

Customer Dogma

Sunday, February 23rd, 2003

In the film Dogma, the universe is based on the fact that “God is infallible”. Breach of this idea would cause the universe to cease existing; to be uncreated.

Something I realised today: we should all be eternally grateful that the same consequences do not apply to a breach of the old saying “the customer is never wrong”. Uncreated a billion times over. At least.

Failures

Sunday, February 23rd, 2003

Some of you might have noticed that certain parts of the site (namely, the archives) have been inaccessible for the last few days, and others haven’t been updated (namely, the whole thing). Why, you ask? I’ve been talking about updating the back-end of the site a lot recently. On Friday I finally got the changes finished on the offline version of the site. One merge later with the online version and disaster. Here’s what went wrong:

  1. My devbox (being Windows based) has no real understanding of file permissions. My online box (which runs on Linux) does. By scripting for the former, I failed to anticipate the “File Permission Denied” messages that my online site (rightly) gave me,
  2. The archives. I completely forget to change the code for them, so it choked the minute the update went live. Doh,
  3. The RSS feed died, inexplicably. It should be working again (I’ll know when this update goes online).

I had planned to fix all of this over the weekend, but a cold virus had other ideas. Until I get time to really thing about the problems facing the updated back-end, I thought it would be best to just switch to a back-up I made minutes before I made the change. (ALWAYS back-up before a big change, stuff like this is bound to happen).

Funny Geometry

Wednesday, February 19th, 2003

One of the best Flash animations I’ve seen in a while: Triangle and Square. Short, funny and to the point.

Via Yeah, But Is It Art?.

Magnetic Challenges

Wednesday, February 19th, 2003

It seems that I’m not the only one challenging people this week. Mark Pilgrim is playing with fridge magnets. My entry?

The greatest person returns the shortest challenge

Seemed astute at the time.

Incidentally, this is the first time I’ve used an image on this site (in the content). Don’t know how it’ll look.

PHP Challenge #1

Monday, February 17th, 2003

If you don’t know what PHP is, ignore this post and all others like it. If you do know, welcome to the VKPS PHP Scripting Challenge. Each week I’ll be asking people to create a script that solves a particular problem using the PHP scripting language. Quite simple really. It should help people think about efficient coding and improving their skills generally.

The first challenge is: Create a function that takes in two positive integers (whole numbers)and returns the greatest common divisor (GCD) of both. For those who don’t know, the GCD is the largest whole number which will divide another two integers exactly.

For example, 2 and 4 have GCD 2 (since 2 is the highest integer that divides them both exactly). 3 and 10 have GCD 1 and so forth.

So, any 2 positive integers will be passed in as parameters and your function should return an integer that is the GCD of them both. Send your functions to me at Solitude@vkps.co.uk. Easy!

Here are the rules:

  • The winner is the person who writes the shortest script that works on sample integers that I will run on it,
  • All functions must return a value,
  • All functions submitted are considered public domain and hence can be reproduced and used with or without credit to anyone by anyone (so no bitching if someone rips off your script after the challenge finishes),
  • The winning script will be archived here for prosperity and to help others,
  • New rules may be added here at any time,
  • GCD(0,0) is technically odd to define (some argue it should be 0), and hence ANY returned value for this case will be accepted (including no returned value),
  • My decision is final, but the shortest (file size) script will be the winner

Closing date is: Monday, 24th February 2003. But if a better script is submitted over time it will be archived too (just not acknowledged as winning). Have fun.

One Day Change

Friday, February 14th, 2003

So, if you’re looking at my site on the day this was posted, you’ll notice a slightly different style from usual. Why? Because it’s Valentine’s Day!

The important things about this (one-day) change is the time it took to implement. If you’ve got a site covered in tables, style throughout the mark-up and/or poorly conceived class names, an overhaul can realistically take a few days. I did this change in under 5 minutes.

How? If you look at my mark-up (View->Page Source, or the equivalent in your browser), you won’t see a single reference to colours or important images. All you will see is the basic information that makes up the page. That’s a good thing!

It means I only have to go into my stylesheets and change a few numbers to get a brand new design. Expect something more extreme for Easter.