Drupal, Silex, Symfony2, Ubuntu, Website Development

What is a Drupal developer? Part One

As this Drupaler has found the question What is a Drupal Developer? is not an easy one to answer. During the last few months what became more and more apparent to me is if you are new to Drupal this is a question that is asked a lot and because Drupal is a complex system it is not the easiest thing to explain. So here goes

Read more

How do I access or get object properties from a class in PHP?

After getting an StdClass() from a PDO database call you need to sort the data in some way, at times however you only need to access one property of the object. You could place the object into a foreach loop and search the object but if you know the property that you want to access there is an easier way.

Creating a StdClass()

First we need our StdClass() for our example this is relatively painless. Create the lass and then by using -> you can add the property and the value of that property. Most of the time I find you will get a StdClass PDO call that has taken data out of your database.

Read more

Using Ternary Operators in PHP

The use of ternary operators in PHP is fantastic and even though I always forget to add the : when writing a ternary operator it is great to have in the arsenal when writing some PHP. As a complement to an if else statement when used in the appropriate way can really assist in PHP development and should not be over looked. I always like to use it when an if else or if statement will fit on one line. If you want to know more about the ternary operator go to php.net. There are real advantages of using a ternary operator when coding,


Read more

Installing Xdebug on Ubuntu

Need to install xdebug on Ubuntu so you can test that really cool PHP web app that will wow users for a decade? The first thing you need to achieve that goal is have Ubuntu installed and the lamp stack ready to go. Next open the terminal and install xdebug by using the following command.

~$ sudo apt-get install php5-xdebug

Next open the php ini file on Ubuntu so that we can ensure that xdebug is being seen by the PHP engine, again from the terminal ensure you have vim installed or you can use gedit and open php.ini file

Read more

Drupal module URL shortening service

I wanted to shorten a url for social media reasons but all the providers of url shorteners have one issue, they don't allow you to keep your brand. But that does not affect the Drupal community there is a module called shurly it allows the user with the right permissions to create a shortened URL


How to use Drupal module Shurly

To use this module after it has been enabled is really easy, just log into your Drupal installation and then navigate to http://<your url>/shurly

it will then give you the form below, add your url on your local website and then press Shrink it!

Read more

Failed to open a window7 in a the virtual machine on ubuntu

I had an issue today trying to load a windows virtual machine image into Virtualbox on my Ubuntu desktop computer every time I started the machine I would get the error below.

VT-x features locked or unavailable in MSR.(VERR_VMX_MSR_LOCKED_OR_DISABLED)

To fix the issue I went to Virtualbox software then Settings–>System–>Processor(s)–> change the CPUs Number to  1

Read more

Adding .gitignore to a Git project

Having files that you don't need to commit but are important to your workflow on a project are always an issue. An example that keeps cropping up is the SCSS caches when you theme a website or your IDE leaves files in the root directory of a project and one that I always have is a temp directory where I can store information or data that is not necessary to the Git master or a remote repositories.

The way to get around Git complaining about these files is use .gitignore what it does it allows the developer to state what directories or files that are not to be seen by Git to add or commit to the repository. The code below allows you to add the .gitignore to an existing repository or one that you have created from scratch.

Read more

Creating a css style print sheet

How do you create a Print Style Sheet so that the users printer ink is not being run dry because of unnecessary images being printed? There are three things a developer needs to remember when building this for a client. The first one is What are the client needs?, yes that means a conversation, ok be brave you can do it. The next is setting up the style sheet css html link at the bottom of your html css links in the html document header tags, like the example below.

Read more

Install and test php_codesniffer on ubuntu

The PHP code sniffer is used to test the php code inside a php file to see if it meets the PRS-0 coding standard by default. It will test the following code types PHP, JavaScript and CSS. You can test any file from the command line.  Here is an example on installing and testing a file in Ubuntu.

Install PHP sniffer

Install the the PHP sniffer library using PRS-0 installation tool from the command line. Make sure that you have the root privileges (sudo) to install the new package

Read more

Add theme colors to Skype on Ubuntu

qtconfig configuration panelIf you want to change your Skype colors on Ubuntu you need to install qt4-qtconfig to do this open your terminal

~$ sudo apt-get install qt4-qtconfig

# Then you open the the qt4 manager
~$ qtconfig

Then you should get an image similar to what is below. Choose the appearance tap and select GUI style and I chose GTK so it would mimic my desktop.

Read more