Tom Yates – Web developer based in Manchester
Specialising in PHP, HTML, JavaScript, CSS, Yii, Flash, AS3
Show MenuHide Menu

Archives

April 2012
M T W T F S S
« Mar   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Installing cPanel/WHM and on a new CentOS Server

April 25, 2012   

Below are instructions on how setup cPanel/WHM and some common add-ons on a fresh install of CentOS. The download and installation of cPanel takes a long time, so in the meantime you should order your cPanel license and any add-ons you want – even after that, you’ll still have plenty of time to make a cup of tea or write a novel.

Connect to your server by SSH


ssh root@123.123.123.123

If you’ve not set a hostname, then this needs doing first:


hostname your.hostname.com

Then run the following commands to download and install cPanel:


cd /home
wget -N http://layer1.cpanel.net/latest
sh latest

While it’s installing, you’ll need to purchase a license for your server.
I generally use BuyCpanel.com as they’re cheap and cheerful.
A license is $38 a month which is about £23, which means you’ll save £84 + VAT per year on most UK data-centre prices (£30 a month). You can also purchase add-ons such as Softaculous and CloudLinux at the same time, but I generally get CloudLinux directly from as you get a discount for multiple servers.

Once cPanel is installed, you’ll need to update the license:


/usr/local/cpanel/cpkeyclt

If you are wanting to install CloudLinux, after setting up your server run the following commands:


wget http://repo.cloudlinux.com/cloudlinux/sources/cln/cpanel2cl 
sh cpanel2cl -k activation_key_here 
reboot
/scripts/easyapache --build

If you are wanting to install Softaculous, run the following commands:


cd /usr/local/cpanel/whostmgr/docroot/cgi 
wget -N http://www.softaculous.com/ins/addon_softaculous.php
chmod 755 addon_softaculous.php

If you are wanting to install CSF, run the following commands:


wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

Calling the Google Maps API from AS3/Flash Without a Proxy

April 18, 2012   

Unfortunately, because Flash doesn’t allow you access external XML/JSON files on a different domain (without permission in a crossdomain.xml file), you can’t directly access the Google Maps API to get data.

Flash will let you get static images such as streetviews and map images, but to get XML data you either have to use a proxy on your server or you can use the solution I detail below.
(Sadly Google Maps API doesn’t support JSONP if you’re wondering).

read more …

Tracing From SWF to the Browser Console

April 16, 2012   

It’s very annoying debugging Flash movies in a browser, and all though there are applications that catch “trace” messages available, I’ve never got them to work.
So, instead of just writing a debug message to a text box, I use the following function to write to the javascript console log of your favourite browser (provided it’s Chrome or FireFox).


function traceToJS(string)
{
   ExternalInterface.call("console.log('From Flash:"+string+"')");
}

Don’t for get to import the External Interface class.


import flash.external.ExternalInterface;

Checking Nameservers Have Been Added to The Global Registry

April 16, 2012   

You can check at Verisign’s whois, make sure to click on “nameserver”.

Mac OSX Server Doesn’t Resolve Aliases

April 13, 2012   

It just doesn’t.
To resolve, you need to use the Terminal and create a symlink using the symlink command.


ln -s original_filename link_name

AS3 – Adding Pointer to Button with TextField

April 4, 2012   

In AS3, to make a MovieClip have a pointer on hover, you need to set buttomMode as true:


myClip.buttonMode=true;

However, if you MovieClip contains a dynamic text field, it’ll not show the pointer. In this case you have to set mouseChildren as false.


myClip.mouseChildren=false;