Archive for the ‘PHP’ Category

New Admin Sortable Mod for LJScript Exchanges

Tuesday, May 27th, 2008

I have a new mod available that will clean up some of the tables in LJScript’s admin control panel for users, user sites, site reports, contact requests, banner rotator, and text rotator and allow you to sort these lists by their fields. This mod is only available for LJScript exchanges.

Before After
admin sortable before admin sortable before

This mod is available for sale for $50. Check out the mods page for details.

Captcha Mod Released

Friday, September 7th, 2007

I have just finished developement of a captcha mod for traffic exchanges. This mod is an anti-cheat feature which will ask the user to input a 6 digit code every so many pages surfed. In the case of the LJ Script it will replace the surf verification feature that is default in that script, but may be turned off in the admin area (which will return your site to using the questions as before).

Captcha is a common turing test feature among many of the latest open-source scripts and e-commerce websites and is very efficient at preventing bots from using a particular service. If you’re worried about bot activity and would like to purchase this mod now please visit my Mods page. It costs $45 and can be running in as little as 15 minutes.

Demo: Captcha Mod Demonstration
Demo: Sign up and surf to see it in action

Testing the GD Library

Friday, September 7th, 2007

The GD library allows a server to render simple graphics. It’s not photoshop, but it is highly useful. Especially for CAPTCHA pages, a typical feature which I am in the middle of developing for traffic exchanges.

CAPTCHA stands for ‘Completely Automated Public Turing test to tell Computers and Humans Apart‘, and typically uses the GD library to create a graphic with a random string or word, sometimes distorted, that a human can decipher and input back to the server but bots can not.

There are many other uses for the GD library, but this is an extremely common one these days.

When developing a script which uses image rendering through the GD library sometimes (usually) you get to a point where you have to check if the library is installed on the server. It’s a big plus to a developer if the code he’s writing can actually work.

So I was really pleased when I found a simple script by Dagon Design that tells you straight out that GD is installed. You can look at phpinfo() to find this info, but I find this nicer and more to the point.

Perhaps this will be as useful to you as it will be to me:
Script: Checking for GD support on your server

FizzBuzz

Thursday, August 23rd, 2007

I came across an interesting article today on weeding out weak programmers. Simply ask them to program FizzBuzz.

Using FizzBuzz to Find Developers who Grok Coding

FizzBuzz is a game children play in the UK where they each sit is a circle and begin to count. The catch is that if the number is a multiple of 3 you have to say ‘Fizz‘, if it’s a multiple of 5 you say ‘Buzz‘, and for multiples of both 3 and 5 you have to say ‘FizzBuzz‘.

Supposedly many computer science majors and other applicants for programming jobs can’t do this simple task.

On occasion you meet a developer who seems like a solid programmer. They know their theory, they know their language. They can have a reasonable conversation about programming. But once it comes down to actually producing code they just don’t seem to be able to do it well.

You would probably think they’re a good developer if you’ld never seen them code. This is why you have to ask people to write code for you if you really want to see how good they are. It doesn’t matter if their CV looks great or they talk a great talk. If they can’t write code well you probably don’t want them on your team.

After a fair bit of trial and error I’ve come to discover that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

FizzBuzz sets out such a simple task that anyone who can program should be able to write up a code that can do this in a couple of minutes. It’s amazing to hear that many of the applicants who apply for a programming job aren’t able to do this.

Perhaps the question is too easy. At first I thought there had to be some sort of catch to it. A trick question. But no, it is that easy. Simply write a program that will count from 1 to 100 replacing multiples of 3 with ‘Fizz‘, multiples of 5 with ‘Buzz‘, and multiples of both with ‘FizzBuzz‘. No tricks. No hidden catches.

So naturally as a programmer myself I immediately had to set out to prove my competence by writing FizzBuzz in PHP. While my design is far from elegant, I assure you that it works, which puts me in that club of programmers who can program.

// SET TWO VARIABLES
$multiplesofthree = 1;
$multiplesoffive = 1;

for ($i=1;$i<=100;$i++) {
if ($multiplesofthree==3 AND $multiplesoffive==5) {
$tehprintout=”FizzBuzz”;
$multiplesofthree=0;
$multiplesoffive=0;

} elseif ($multiplesofthree==3) {
$tehprintout=”Fizz”;
$multiplesofthree=0;

} elseif ($multiplesoffive==5) {
$tehprintout=”Buzz”;
$multiplesoffive=0;

} else {
$tehprintout = $i;
}
$multiplesofthree++;
$multiplesoffive++;

echo “$tehprintout
“;
}

Article: Why can’t programmers.. Program?

Whitespace Graphic
Quick Buttons Navigation
Tabbed Buttons Navigation
Subscribe to Four Points Cardinal's RSS Feeds Foponet Services F.A.Q. Traffic Exchange Mods Open Source Contact Me About Me FopoNet Blog