Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘guide’

PHP Development Part 4 – Arrays

Wednesday, February 15th, 2012 by Servage
This part of the course is about Arrays. Arrays are a datatype in PHP that you can use to store data. You can look at an array like a chain. It can contain multiple elements, each element can contain multiple sub-elements. Imagine, the chain can divide in every link, becoming a new chain, with endless possibiliteis of where it can lead. Let's start with a simple example: $my_array = array(); $my_array[] = 'Element 0'; $my_array[] = 'Element 1'; $my_other_array('Element 0', 'Element 1'); The code above creates an array called $my_array, whereafter it appends to values to the array. You can also do the same thing in one-line, by adding the elemenets like done in the ...

PHP Development Part 2 – Functions

Wednesday, January 18th, 2012 by Servage
Hi again, please enjoy the second part of our PHP Development guide for beginners. This part is dedicated to functions. Functions are small pieces of code, that perform a calculation, check or anything you want. The reason why these pieces of code are made available as functions, is so you can re-use the same functionality again and again, without reprogramming the same thing over and over. Consider a simple example: You want to display the following text for each user logged in to your website: "You are from England", where England is a variable depending on the individual user. In that case, you could consider a function like this: function write_country($country_name) { return ...

Optimize your MySQL database usage

Friday, December 9th, 2011 by Servage
It's important for your website performance that you use the database carefully. Inefficient queries can place extreme load on the server, and make your website seem unresponsive or slow. In fact most database server related problems are caused by poorly created queries, that do things more complicated than necessary. Therefore I suggest you take a look at these tips for improvements: Carefully consider how to design your database. When using an MVC programming pattern, object models are usually a good starting point for the table structure of your database. Remember to use proper keys and indexing for performance. Have a look at this article for further tips. Only select what ...

Create your own WordPress plugin

Wednesday, December 7th, 2011 by Servage
You probably know Wordpress as a very popular blog or content management system. It has tons of features, and can even be extended with plugins - adding custom functionality. There are very many plugins available already, by individual developers and other web services, to integrate with and extend Wordpress. You can find a directory of most existing plugins here: Wordpress Plugin Directory Creating your own plugin Sometimes it's hard to find a plugin that exactly fits your needs. Maybe because you want to integrate with a very specific service, or because existing plugins just don't cut it the way you want. In that case custom plugin development is a really good ...

Using SSL for your local development

Thursday, May 19th, 2011 by Servage
In this previous article I showed how you can use local domains (like aproject.local and beeproject.local) for development on your local host. Today I am going to show how you can use SSL for your local development as well. I.e. using https:// instead of http:// for encrypted connections to your local development projects. Every serious and trustworthy website uses SSL encryption to secure sensitive data from third parties. This might just as well be a part of the development process. First, you need to make sure that your webserver us ready to run with SSL. I have previously discussed two good options to get a local development ...

Setting up local domains for development

Tuesday, May 10th, 2011 by Servage
In this previous article I discussed some easy solutions to get started with local development for PHP and MYSQL applications. However, following the default installation instructions for the available server software, often just gives you a standard setup without local domains. For example a default Apache webserver shows the global webroot when accessing http://your-ip or http://localhost (or any domain pointing to your computer). This article will show you the basics of setting up your system to work with local domains, so you can work on multiple projects on your system in parallel. For this purpose, let's say you have two projects, called "Aproject" and "Beeproject". We want to access these ...

Getting started with Sencha Touch

Friday, April 29th, 2011 by Servage
Recently I described Sencha Touch, a mobile development framework which allows you to create rich web applications. It gives an almost-native experience on various mobile platforms like iOS and Android, while using open web standards such as HTML5, Css3 and JavaScript behind the scenes. Read the previous posts about Sencha Touch and converting into native apps for more information. Some users are having difficulties getting started developing, because basing most of the (or the entire) code on JavaScript is new to them. Most have some experience, for example with jQuery, integrating plugins or other JavaScript functionality into websites, but creating an entire MVC app in JavaScript seems ...

Speed up your website – Part 6: Cookies & Mobile

Monday, April 4th, 2011 by Servage
This is the sixth and last part of a simplified explanation of the “Yahoo best practices for speeding up your web site“. Read the fifth part here. The fourth part is about image related optimization. Reduce cookie size Basically cookies consume resources in terms of data in requests. The article "When the cookie crumbles" by Tenni Theurer and Patty Chi provide the following conclusions: Don't use unnecessary cookies. Think before storing useless data. Reduce cookie size to the minimum required. It helps response times. Restrict cookies to domains appropriately, so they are not affecting other subdomains unnecessarily. Set appropriate expire dates, to remove cookies as early as possible with regards to their relevance. Do ...

PHP encryption/decryption without 3rd party software

Wednesday, March 16th, 2011 by Servage
It's possible to encrypt and decrypt data with PHP using third party software, such as MCrypt. There are also some interesting PEAR packages for encryption. However, for many cases there's an even easier solution, which encrypts your data reasonably well and relies only on PHP: "A reversible password encryption routine for PHP" by Tony Marston. It's a simple PHP class that utilizes native PHP functions to achieve a fairly high level of encryption, which is secure enough for most PHP based applications. Despite the name, the class can be used for any kind of data, not only passwords. Recommended practice is to store all ...

Speed up your website – Part 5: Images

Wednesday, March 9th, 2011 by Servage
This is the fifth part of a simplified explanation of the "Yahoo best practices for speeding up your web site". Read the fourth part here. The fourth part is about image related optimization. Minimize image file size Avoid using GIF files. If you have GIFs, try to convert them to PNG, in order to evaluate if you might save some size. PNG files are more efficient in terms of quality and size. Most browser-issues with PNG are resolved, so there are not many things in favor of the GIF anymore. If you must use it, make sure to include the amount of colors in the color palette, which are necessary. ...