Adobe Online ColorShemer

CSS, Flash, General No Comments »

Today, I came accross the adobe online colorshemer website.

http://kuler.adobe.com/

It’s a flash based colorshemer with everything you need at your fingertips.

You can view popular colorshemes, play around with settings, create your own colorshemes,…

It’s definitely worth bookmarking this site.

http://kuler.adobe.com/

Sexy CSS buttons

CSS No Comments »

Another CSS lay-out technic for looking default HTML buttons look really slick

View this nice how-to:

http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html

Checkbox & input CSS lay-out

CSS No Comments »

Found this really cool website on how to lay-out input and checkbox html items

check it out: http://www.chriserwin.com/scripts/crir/index.php

Change system time

Centos, Linux 1 Comment »

I found out that a large part of centos servers were out of sync with the current time.

So I fixed them.

First get the current date and time from a time server:
rdate -s tick.uh.edu

Then type
/sbin/hwclock –systohc

This sets the system time as a ‘permanent’ clock so that the time will be correct next time you reboot.

You can also use NTP (Network Time protocol) but I haven’t looked into (yet).
The NTP uses a network of time server to automatically sync your system time with the time server on a regular base.

Automated PHP API generator

PHP, Software No Comments »

In our new stagging, development environment documentation is essential.

So we want to have all our classes API generated automatically.

This can be done, fairly easy.

For generation of our php API, I choose for phpDocumentor.
Why? Because it’s easy, has a nice web GUI and command line utility and it does it work assupposed.
First lets install phpDocumentor (on a centos system)

sudo pear install phpdocumentor

Next we are going to setup the phpDocumentor.
Our project is located in the following directory.

project: /svn/builds/nameProject/www/

We create a project config file.

config file: /svn/scripts/phpdoc-config.ini

vi /svn/scripts/phpdoc-config.ini

[Parse Data]
title = Documentation nameProject
hidden = false
parseprivate = off
javadocdesc = off
defaultcategoryname = Documentation
defaultpackagename = nameProject
target = /svn/builds/nameProject/doc/
readmeinstallchangelog = README, INSTALL, FAQ, LICENSE, Release-1.3.1
directory = /svn/builds/nameProject/www/
ignore = pear-*,templates/,Documentation/,test*.php
sourcecode = on
output=HTML:Smarty:PHP

Test your configuration
Create the repertory targets

mkdir -p /svn/builds/nameProject/doc/

then launch

phpdoc -c /svn/scripts/phpdoc-config.ini

Check the /svn/builds/nameProject/doc/ directory, if everything is generated.

Next we are going to let our phpDocumentor do it’s work every night.
So I have written a little plain export script and an extend our nightly build subversion script (see http://thim.trinix.be/2007/06/06/nightly-build-script/)

Plain export

vi /svn/scripts/phpdoc-generate.sh

phpdoc -c /svn/scripts/phpdoc-config.ini

Extend Nightly build script

vi /svn/scripts/svn-phpdoc-generate.sh

phpdoc -c /svn/scripts/phpdoc-config.ini

and edit svn-nightly-build.sh

vi /svn/scripts/svn-nightly-build.sh

and add the following just before the # Create archive section

# Remove old documentation
rm -Rf /svn/builds/nameProject/doc/

# Generate documentation
/svn/scripts/svn-phpdoc-generate.sh

The final step is to setup a cron (crontab -e) or add your script to right /etc/cron.* directory (example /etc/cron.daily)

Nightly Build script

Linux, Software, subversion 1 Comment »

We are setting up an complete new development, stagging environment.
And we decided to go with Subversion for Version Control.

And we needed a nightly build export script so I wrote a simple one.

#!/bin/sh
#########################################################################
#
# Implementation of subversion nightly build
#
# Author: Tim Haselaars
# Contact: tim.haselaars@trinix.be
# Date: 6/6/2007
# Version: 1.0
#
#########################################################################

#//////////////////////////////////////////////////////////////////#
# CONFIG SECTION
#//////////////////////////////////////////////////////////////////#

REPO_PATH=”/svn/repos/name”
TEMP_PATH=”/svn/tmp/name”
BUILD_PATH=”/svn/builds/name”

#//////////////////////////////////////////////////////////////////#
# CODE SECTION (do not change)
#//////////////////////////////////////////////////////////////////#
# Show me the current date
date=`date +%Y-%m-%d`

# Create essential directories
if [ ! -d $BUILD_PATH ] # be sure the directory /mnt exists
then
mkdir -pv $BUILD_PATH/{www,tar,zip,log}
fi

if [ ! -d $TEMP_PATH ] # be sure the directory /mnt exists
then
cp -r $REPO_PATH $TEMP_PATH
fi

# Get local snapshot copies revision number
OLD=`svn info file:///$TEMP_PATH | grep -r Revision | cut -f 2 -d ” “`

# Get current development revision number
NEW=`svn info file:///$REPO_PATH | grep -r Revision | cut -f 2 -d ” “`

# Compare for OLD and NEW revision
if [ $NEW -gt $OLD ] ; then

# update local copies
svn update file:///$TEMP_PATH

#Clean old build
rm -Rf $BUILD_PATH/www/

# create another local copies
cp -r file:///$TEMP_PATH $BUILD_PATH/www/

# Recursively remove all .svn directories from folder builds
find $BUILD_PATH/ -name .svn -print0 | xargs -0 rm -rf

# Create archive
tar czf $BUILD_PATH/tar/HIL5-revision-$NEW-$date.tar.gz $BUILD_PATH/www/
zip -r $BUILD_PATH/zip/HIL5-revision-$NEW-$date.zip $BUILD_PATH/www/

# Dumping svn commit log
svn log -v local > $BUILD_PATH/log/CHANGELOG

# Delete folder
#rm -rf

echo “New revision available on $date. Current is Revision $NEW” >> $BUILD_PATH/log/BUILDLOG
else
# If there’s no commit been made
echo “No new revision available on $date. Current is Revision $OLD” >> $BUILD_PATH/log/BUILDLOG
fi

Centos 5 : Install PHP-MSSQL Module / Extension

Centos, Linux, PHP 24 Comments »

As you might have noticed since Centos 5.0, the PHP-MSSQL module / extension isn’t default available in the yum repository. So if you want to use it you can alter the PHP binairy or you can compile an mssql module / extension. In this howto I will explain how to compile the mssql module / extension.You need to activate the RPMForge custom repository (formely known as Dag Wieers)http://dag.wieers.com/rpm/packages/rpmforge-release/Grab your specific RPM and install it.

wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-*.rpmrpm –install rpmforge-release-*.rpm

Next step is to install freetds,freetds-devel, php-devel and the Development tools.

yum groupinstall ‘Development Tools’

yum install freetds freetds-devel –enablerepo=rpmforge
yum install php-devel

next we alter the php.spec file, containing the php configuration for compiling.

vi /usr/src/redhat/SPECS/php.spec

if you can’t find the php.spec file.

You can download the php src rpm.

wget centos.mirrors.skynet.be/pub/centos/5/os/SRPMS/php-5.1.6-5.el5.src.rpmand next

rpm –install php-5.1.6-5.el5.src.rpm

And then do an updatedb and locate php.spec.

edit the CFLAGS= line (~line 310) of the php.spec file – remove ” -Wno-pointer-sign”

add the following piece of code to it.

Group: Development/Languages
Requires: php = %{version}-%{release}, php-pdo
Summary: A module for PHP applications that use the MSSQL database.
provides: php_database
BuildRequires: freetds-devel

%description mssql
The MSSQL package contains a dynamic shared object that will add
support for accessing MSSQL databases to php

Start building your php rpm.

rpmbuild -bb ./php.spec

If has is asking for some dependancies just yum install them

cd /usr/src/redhat/BUILD/php-5.1.6/ext/mssql/

Now we are going to make the mssql module without having to rewrite the php binairy.

phpize
./configure –with-mssql
make
make install

Next look for the mssql.so and make sure it is in the module directory specified in your php.ini.
and copy it to the specified location if needed.

final step

vi /etc/php.ini

add this line to php.ini

extension=mssql.so

save php.ini and restart apache

/etc/init.d/httpd restart

éh voila you have just made your mssql module / extension without having to change anything to the base Centos 5 HTTPD / PHP setup.

PS: I have also posted this howto on http://www.howtoforge.com

Centos 5 : Local yum repository

Centos, Linux 10 Comments »

Sometimes it can be handy to setup your own repository to prevent from downloading the remote repository over and over again.

Create the Directories:

mkdir -pv /var/www/html/centos/{base,updates}

Copy the RPMs from the CDs/DVD to /var/www/html/centos/base

Create the base repository headers:

createrepo /var/www/html/centos/base

Select a rsync mirror for updates:
check out this list of aviable mirrors: Centos OS Mirror list and these are identified with “rsync.” For example: “rsync://ftp.belnet.be/packages/centos/”. The mirrors share a common structure for updates. Simply append /updates/<d version>/<base arch>.

Rsync to create the updates-released repository:

rsync -avrt rsync://ftp.belnet.be/packages/centos/5.0/updates/i386 \ –exclude=debug/ /var/www/html/centos/updates

This will create a complete update repository at /var/www/html/centos/updates/i386. The repodata directory will be created with all of the headers. Next I would advise to setup a cron job to run the rsync (above). In this manner your repository keep updated and only new updates and headers will be downloaded to your repository.

Edit yum.conf:

vi /etc/yum.repos.d/CentOS-Base.repo

[base] name=CentOS-$releasever – Base baseurl=http://192.168.*.*/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever – Updates baseurl=http://192.168.*.*/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

That’s it. Special thanks to http://www.tqmcube.com for the info

Visual Subst – Directories as Virtual drives

Software No Comments »

I needed a handy tool that made certain directories acted like a separate drive.

After a bit googling i found this neat, free tool.

http://www.ntwind.com/software/utilities/visual-subst.html

The tool explains itself. It works like Daemon tools, I allows you to set a Directory as a Virtual Drive.
You can save your dictories to these Virtual drives and  let  the drives be loaded during startup.

More info you ‘ll find on the website self. And of course this is TOTALLY FREE!!!

Professional Web Development: coding & structure

PHP, Web 2.0 No Comments »

With this topic I’m going to write down some useful tips when you want to start professional development and/or start working in a development team.

When going pro there are a few issues you always have to keep in my mind.

Your project should be:

  • easy to manage
  • comprehensible by out-side developers
  • build logical
  • structured
  • well documented & commented
  • set-up naming & coding standards

Structure
When building web applications you get a lot of files of all kinds (CSS, PHP, Classes, JS,…)
It’s important to keep a clean structure. There could also be a difference between a public and a secured interface. So I advice to setup your directory structure in the following manner.

WEB_APP
===|——— gui
===|=======|——- js
===|=======|——- css
===|=======|——- icons /images
===|=======|——- rss
===|=======|——- config
===|=======|——- tpl
===|=======|——- class
===|=======|——- modules
===|=======|——- export
===|=======|——- service
===|——— system
===|=======|——- js
===|=======|——- icons /images
===|=======|——- css
===|=======|——- config
===|=======|——- tpl
===|=======|——- class
===|=======|——- modules

We work in a multi-tier manner. This means that we try to separate the visual,coding and database. Our web application consist out of 2 big parts, gui and system. The gui stands for the public part and system consists out the secured admin section. Of course there can be more parts needed, this is just an example case structure, which I consider a good start for a basic web app.

Explanation of directories:

  • js:contains all javascript libraries
  • icons / images: contains all necessary images and icons needed by the gui
  • css: contains all style sheets
  • rss: is the public rss feeds directory
  • config: here are all configuration files placed, like your DB login data, general application settings, … files that need to be included in every page
  • tpl: we work in a multi-tier environment, the tpl directory keeps the HTML templates (the pure visual part)
  • class: contains all general classes, like the DB class, the HTML email class, …
  • modules: consist out of all the specific application written modules, divided in directory per module.
  • export: contains all the possible export files of the application
  • service: is the web service part, here you place all the code for your web services.

This is just a simple case, but I find the structure clear and easy to expand.

Coding & Naming Conventions
When building applications or work in a team. You should definitely need to have this. The coding and naming conventions are the rules to follow while programming, more specific for the usage of file and directory naming and the manner variables,functions and classes our declared. This prevents each programmer of using his own specific manner of writing code and so afterwards really difficult for other developers to understand his code. And let’s say one year later the programmer still understand his own code :-) and still works in the same way.

1. Directories

  • Short names
  • All in lowercase, no studly caps
  • Prevent usage of points (.) and spaces
  • More then 1 word use underscore (_)
  • For related content use a prefix with an underscore. (ext_dir1, ext_dir2,…)

2. Files

  • Logical names
  • All in lowercase, no studly caps
  • Prevent usage of points (.) and spaces
  • Function specific files (class,func,…), use prefix followed by an point (.) (class.name.php, func.name.php)
  • More then 1 word use underscore (_)
  • For related content use a prefix with an underscore (adm_file1, adm_file2,…)

3. Coding Standards
Here for I would like to refer to the PEAR Coding Standards (http://pear.php.net/manual/en/standards.php)

Documentation
Another important step in becoming a pro developer is to learn to document EVERYTHING.
Write down your Application sturcture and explain what and why.
Also write down your Coding & Naming Conventions.
Everything you do or use, explain in documentation how, what, why.
This seems a waste of time but if you have a lot of projects and you need to expand an older project you can simply read your documentation and you know the structure of your application without having to figure everything out again.
Another plus is to pass your project on to another developer, you wont feel like an help desk if he don’t email you every 5 min for info over the project. Because you can just give him all the docs and he can start reading reducing the number of question greatly.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in