Neophyte Just another WordPress site

31Oct/100

Khaos Library goes public!

Visit the website: Khaos Library

If you use PHP 5.3 or are looking to switch to 5.3 and would like to be able to do some of the following things then the Khaos Library might be what you're looking for.

// Edit an image
$this->khaos->image('sample.jpg')->fit(150, 150)->grayscale()->save('thumbnail.jpg');
 
// ACL
if ($this->acl->subject('neophyte')->hasAccess('articles', 'publish'))
    echo 'I have access';
 
// Akismet spam checking
if ($this->khaos->akismet($comment)->isSpam() == false)
    echo 'Good to go...';
 
// Basic CRUD
$user = $this->khaos->table('members')->find(1);
$user->email = 'test@domain.com';
$user->save();
 
// W3C validation
if ($this->khaos->w3html($url)->isValid())
    echo 'Url is valid ...';

The library makes heavy use of lazy loading and dependency injection which is what makes the above syntax style possible whilst keeping each individual component decoupled. This also means you can keep your config options and general preferences outside of your application logic. The library is also extremely light weight with only exactly what you need being included when needed.

As an example in the above call to manipulate an image only when the call is made are the required classes instantiated, typically this would be the Image class and the GdDrawingPackage class (an instance of the GdDrawingPackage is injected into the Image instance)

Note: This code and accompanying website is under heavy development so if you like what you see any bug reports, feedback or any other help people can offer would be greatly appreciated.

Tagged as: , , No Comments
29Oct/100

myWebWatch enters beta

Although still under heavy construction myWebWatch now offers enough basic functionality to hopefully be useful to website developers and owners alike.

If you encounter any bugs whilst using this service I'd be very greatful if you could let me know, general comments, recommendations and requests are also welcome !

That's all for now i'll post more info over the weekend.

15Oct/100

HowTo: Install PHP 5.3 on CentOS 5.5

CentOS as of this post is still on php 5.1, this post is just a rehash of the article on WebTatic hosted here for my own benefit.

Step 1: Setup the WebTatic Repo

rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy
rpm -ivh http://repo.webtatic.com/yum/centos/5/`uname -i`/webtatic-release-5-1.noarch.rpm

Step 2: Install PHP

yum --enablerepo=webtatic install php

Step 3: Optional

Just a few packages I usually install straight away on any install.

yum --enablerepo=webtatic install php-pear
yum --enablerepo=webtatic install php-pecl-apc
yum --enablerepo=webtatic install php-mcrypt

Give it a try

php -v

Also, don't forget to restart your webserver and check the output of

<?php phpinfo(); ?>
Tagged as: , , No Comments
15Oct/104

HowTo: Install Mono 2.8 on CentOS 5.5

CentOS as of this post is still only shipping with a very dated version of mono (1.x), detailed below are some instructions to get mono 2.8 up and running.

Step 1: Prepare System

As we will be compiling mono from source there are a few packages we must install first

yum install gcc gcc-c++ bison pkgconfig \
glib2-devel gettext make freetype-devel fontconfig-devel \
libXft-devel libpng-devel libjpeg-devel libtiff-devel giflib-devel \
ghostscript-devel libexif-devel

Step 2: Download Source Code

In addition to the core mono package we will also be installing libgdiplus

# Go to your home directory
cd ~
 
# Grab Source
wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.8.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.8.tar.bz2

Step 3: Install libgdiplus-2.8

# Extract
tar -jxvf libgdiplus-2.8.tar.bz2
cd libgdiplus-2.8
 
# Compile & Install
./configure --prefix=/opt/mono
make
make install
 
# Setup
echo "/opt/mono/lib" > /etc/ld.so.conf.d/mono.conf
ldconfig

Step 4: Install mono-2.8

# Extract (make sure you're back where you downloaded mono)
cd ~
tar -jxvf mono-2.8.tar.bz2
cd mono-2.8
 
# Compile & Install
./configure --prefix=/opt/mono
make
make install

You should hopefully now have a working mono install, lets try it out

/opt/mono/bin/mono --version

You may also optionally add /opt/mono/bin to your path

Tagged as: , , , 4 Comments