30 Nov

Canvas Development Part 2

By: Magdalena Roeseler

In this second part of our HTML5 Canvas Development Tutorials, we’ll be looking at working with shadows and patterns  within a canvas.

If you’re completely new to the Canvas element, I highly suggest you check out the first part of this series: Canvas Development Part 1 which provides an introduction to the element as well as some basic operations.

Creating Shadows with Canvas

When defining shadows, we have the following 4 properties within the canvas context to work with:

shadowColor – defines the colour of the shadow, can be a named colour, hex value, rgb() value or rgba() value
shadowBlur – blur amount, 0 is no blur
shadowOffsetX – horizontal spacing in pixels between object and shadow
shadowOffsetY – vertical spacing in pixels between object and shadow

Read article

23 Oct

PHP Tutorial: Using Arrays

By: Walt Stoneburner

Arrays are variables that are capable of holding multiple values, a group of data. These are heavily used in development, so in this beginner’s guide I’ll show how to declare, access and manipulate arrays in PHP.

PHP supports indexed, associative, and multidimensional array types.

Declaring Arrays in PHP

Arrays can be defined using the array() function, or from PHP 5.4 you can also just use [ ]. When declaring an indexed array,  indexes are numeric and the first item will start at index 0 and increment with each subsequent element.

Read article

24 Sep

Installing a Web Server with PHP and MySQL

Whether you’re a budding web developer or a jack-of-all-trades administrator, sooner or later you’ll need to know how to get a web server up and running.

Most web servers these days run either Windows or Linux. Windows may be your choice if you’re making use of a server in an existing domain or perhaps integrating with NTFS, Active Directory or other Windows API’s – but for a dedicated, light-weight, secure and free platform; you can’t go past Linux.

Of course, there’s not just the operating system. You need to consider the HTTP Server itself, that is; Apache or Internet Information Server (IIS). Apache is the tried and tested platform and most open source PHP applications (like WordPress, Joomla etc.) are built to run natively on Apache, as they use per-folder .htaccess directives for URL re-writing.

Suffice to say (and without getting too far off-topic), If you strictly (simply?) want to run Apache/PHP/MySQL on Windows we would recommend the XAMPP bundle. The installer is easy to step through, there’s lots of support on the Apache Friends website and it’s likely the fastest path to getting these kinds of applications up and running on Windows. Conversely, if you need to implement .htaccess directives in IIS – you can do that too! These files can be converted using IIS Manager and Microsoft has a complete write up on converting these directives to web.config files for IIS.

This article will cover both CentOS 6.5 Linux with Apache and Microsoft Windows Server 2012R2 with IIS,  so you can experiment with both platforms and see which one is right for you.

Lets get started!

Read article

14 Sep

Canvas Development Part 1: The Basics


The Canvas element is a HTML5 element which can be used to draw and display visual graphics on the fly using Javascript. It is becoming increasingly used in games and apps, as well as webpages and web applications.

In Part 1 of this Canvas Element Tutorial Series, we’ll explore the basics of canvas development – getting a canvas onto the page and simple drawing and manipulation of the canvas.

Getting Started: A Blank Canvas

The HTML5 Canvas element tag should be defined with an id (for targetting via our JS), and optionally with width and height attributes and classes.. such as:

Read article

10 Sep

Useful WordPress Code Snippets vol.1

Wordpress functions.php code

Here’s our first collection of WordPress Code Snippets which deserve a place in every WP developer’s toolbox. These are snippets of code that I myself find useful and use frequently.

Alot of the functionality from these code snippets can be done via plugins, but in the interest in keeping it simple and your installed plugin count down, it’s often better to simply paste these into your theme.  Unless stated otherwise, these snippets belong in your theme’s functions.php file.

1. Limit Max Width of Youtube Embeds

When faced with the issue of seeing Youtube videos I had embedded into a WP site were displaying with a width wider than that of the content area, I was surprised to see the maximum width for videos wasn’t in the core settings.

Drop the below snippet into your theme to overcome this problem, and define your desired maximum video width on the 2nd line ($maxw).
Read article

06 Sep

WP Plugin Exploits: Many Themes At Risk!

By: Nick Carter

Recently disclosed WordPress Plugin vulnerabilities/exploits have left over 1,000 Wordpress Themes vulnerable, and in turn many thousands of sites at risk. This is because the vulnerable plugins have been included with/integrated into many commercial WordPress themes.

These plugins are Revolution Slider and Showbiz Pro, both sold as standalone plugins on CodeCanyon.net, but also integrated into hundreds of WP themes sold on Themeforest.net.

Read article

09 Aug

Free Fonts List for 2014 – Part 1

By: hom26

We’re always on the lookout for quality free fonts to use, and will regularly post lists of new free fonts we’ve found around the net to save you from wasting many hours trawling for a good one!

So here’s our first free fonts list for 2014.. enjoy!

Some font licenses for the below listings may vary for commercial use, so please check the license on the font’s page before using in a commercial project.
Read article

06 Aug

WordPress Database Interaction with $wpdb.


There are a number of ways to interact with the database when developing for WordPress. Wherever possible, you should use the many core WP functions for working with database data, for example: get_pages can return an array of pages that meet criteria you specify.

However sometimes you may need to deal with the db a little more directly to craft queries that go beyond the scope of the standard core WP functions. Unfortunately we still see WP plugin or theme developers doing this in ways that are vulnerable to SQL injections, and it only takes one security hole to put your entire site at risk.

PHP MySQL Options

The old mysql_* functions should never be used – not only is there no prepared statement support meaning you are relied upon to carry out all sanitizations (or risk SQL injection), but these functions are deprecated in newer versions of PHP.

PHP’s newer mysqli_* functions are a vast improvement, with support for prepared statements, multiple statements, transactions, debugging capabilities, and it’s OO (object orientated).

There’s also PDO (PHP Data Objects) – a database abstraction layer, which provides a consistent interface which can be used with a variety of DB drivers (MySQL, MS SQL, Firebird, PostgreSQL and others). This means your PHP application can be run on a wider variety of server configurations in a consistent manner.

Using any of the above options for database interactions in WordPress would see alot of work from the WordPress core developers gone to waste. Here is a little reference guide to get you on the right track to deal with db calls the recommended, safest way – using $wpdb.
Read article

30 Jul

External Link Favicons in WordPress

Many favicons from random websites

Favicons (aka “favourites icons”) are small icons, typically 16 x 16 pixels, that represent your website in browser tabs, bookmarks, desktop shortcuts and more. They’ve been around since 1999, are in use by most sites, we’ve all seen them.

We are soon adding a links and resources page to CodePeach for web development, coding and design sites that we find useful. A page full of text links never looks appealing, so I thought one way of spicing up a links page visually would be to place each link’s small favicon image next to the link itself. It’s also a great way for users to visually relate to the linked websites.

So let’s look at how to create a shortcode to display the favicon for a remote website in our WP content.
Read article

20 Jul

Colour Schemes and Colour Palette Tools

By: laffy4k

Colour choice is a critical part of any visual design.

Too many times we’ve seen creatively designed website layouts only for it to be ruined by badly chosen cringe-worthy colour combinations.

Below we’ve listed what we believe are essential tools and resources for choosing and dealing with colour palette schemes for webdesign.
Read article