May 26 2011

Relentless Devotion…

Ben Hoskins

It really helps develop amazing code.


May 21 2011

Best Minecraft Texture Packs…

Ben Hoskins

Minecraft is simply amazing.

Now im not a gamer and never intend to be, however, Minecraft is just awesome and is soo much fun ^^

Simply put, your a guy, in a world, where you can do anything you wish. The only game objective it to live your life.

You can build buildings, mine for better materials to build with or use them in your every day life, fight monsters at night (Creepers are simply epic), farm, invent, explore, adventure, you name it you can do it in Minecraft!

One of the better things about Minecraft is its ability to use different themes for your worlds called ‘texture packs’ and after much usage and research here are my favourite ones (in no particular order)…

Quandary

 

NatureCraft

 

ShreeyamaCraft

 

Cube Craft

 

SexyCraft

 

Bamt4st1c


Apr 29 2011

Twitter…

Ben Hoskins

Wow, really now. I didn’t think it was possible for an organization/website to be so perfect. Twitters new and updated website is truly a triumph. Beauty and Simplicity @HozzaMedia

New Twitter


Apr 28 2011

The Honey Pot Project…

Ben Hoskins

In tandem with my other post today (http://blog.hozzamedia.com/website-design/javascript/fend-off-the-bad-bots-ip-blocklist/).

The Honey Pot Project is a terrific organisation who build and manage helpful information about suspicious IP’s. There main thing is “The Honey Pot” – a deception trap designed to get bots, harvesters,spammers etc. to spam their software which can collect information on what they are doing and warn the community about them before they cause a problem.

Continue reading


Apr 28 2011

Fend off the bad bots…

Ben Hoskins

I have now discovered a few tips and tricks to fend off those bad bots, crawlers, harvesters, you name it.

First of all you need to create yourself a simple blocklist of IP’s, one IP per line, IP’s you dont want visiting your site. (hopefully HozzaMedia will be publishing our own one for public use soon)

123.567.678.9
657.387.93.2
1.1.1.14
etc

The PHP needs to be something simple like a script that checks if the users IP is in the text file and if it is, display a “No Entry Error”. Originally my script only displayed a HTML page with text along the lines of “Your IP address has been blocked from our network due to suspicious activity, you are being monitored. Continue reading


Apr 23 2011

Google Currency Conversion…

Ben Hoskins

Well, the api is pretty straight forward.  It was found in the Currency Conversion gadget from iGoogle by http://oohhyeah.blogspot.com/2009/01/google-currency-conversion-api.html

Here is the example:
http://www.google.com/ig/calculator?hl=en&q=100EUR%3D%3FGBP

And the resposnse looks like this:
{lhs: “100 Euros”,rhs: “191.745037 British pounds”,display: “DISPLAY_FULL_PAGE”,error: “”,icc: true}

Heres how to do it in PHP


$amount = "100";

$from_Currency = "EUR";

$googleResponce = file_get_contents('http://www.google.com/ig/calculator?hl=en&q=' . $amount . $from_Currency . '%3D%3FGBP');

$googleResponce = explode(',', $googleResponce);

$numberInGBP = number_format(round(trim(str_ireplace(array('rhs: "', ' British pounds"'), '', $googleResponce[1])), 2), 2);

echo $numberInGBP;

Mar 28 2011

N3rd Wallpaper…

Ben Hoskins

Good wallpaper makes a good nerd…


Nov 26 2010

PHP Link all URL’s in a string…

Ben Hoskins

Wanted all the URL’s and email addresses in a string to become actual HTML link when echoed, for our notepad software http://hmnotes.com/.

After a while of searching I came accross this…..

function makeLink($string){
//make sure there is an http:// on all URLs
$string = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2",$string);

//make all URLs links
$string = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<a target=\"_blank\" href=\"$1\">$1</a>",$string);

//make all emails hot links
$string = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i","<a href=\"mailto:$1\">$1</a>",$string);

return $string;
}

Makes all emails, mailto: and all links as links! Happy Days!


Nov 18 2010

PHP Simple Calendar…

Ben Hoskins

For years I have been looking for a proper, simple and well formed PHP calendar. I eventually found a promising looking script on emanueleferonato.com however it was not well formed (PHP or Output HTML)

I have tweaked the script to be correctly formed :D You can output any month of any year (within PHP restrictions) and you can start you week on any day of the week. i.e. Americans start on Saturday where as the English start on Monday.

Continue reading


Nov 15 2010

PHP Browser Detection…

Ben Hoskins

Detecting the user’s browser type and version is helpful in web applications that harness some of the newer bleeding edge concepts. With the browser type and version you can notify users about challenges they may experience and suggest they upgrade before using such application. Not a great idea on a large scale public site; but on a private application this type of check can be helpful.

Searching for a way to do this at the PHP layer and not at the client layer was more of a challenge than I would have guessed; the only script available was written by Gary White and Gary no longer maintains this script because of reliability. I do agree 100% with Gary about the readability; however, there are realistic reasons to desire the user’s browser and browser version and if your visitor is not echoing a false user agent we can take an educated guess.

Check out the script and find out more information on the link below

http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/