July 22, 2008

Guide to CodeIgniter databases

Filed under: Uncategorized — kenjun @ 12:06 pm

Why are there no, in-depth tutorials covering databases in CodeIgniter?

I?m talking the full nine miles, including Models, ActiveQuery, Configuration, Security, seriously, the full nine miles. Yes the CodeIgniter user guide is spectacular, yes, most people know how to do this stuff anyway, but, I did what I could. I would like to introduce you to?

The CodeIgniter Guide To Databases.


Mod_rewrite: RewriteCond

Filed under: Uncategorized — kenjun @ 9:49 am

For a plain English translation, go down to the end…

Syntax: RewriteCond TestString CondPattern

The RewriteCond directive defines a rule condition. Precede a RewriteRule directive with one or more RewriteCond directives. The following rewriting rule is only used if its pattern matches the current state of the URI and if these additional conditions apply too.

TestString is a string which can contains the following expanded constructs in addition to plain text:
– RewriteRule backreferences
– RewriteCond backreferences
– RewriteMap expansions
– Server-Variables

Note that this is a simplified version of what’s at
which goes on for several pages about this in vast detail.

To put it into plain English:
Say you have this (as can be found in a CodeIgniter .htaccess file):
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

What this means is:
IF the incoming Request URI (ie the address requested by the browser) matches “system”
THEN rewrite it so that it uses the index.php file in the root directory.

For explanation of RewriteRule see an earlier post.

July 21, 2008

Mod_rewrite: RewriteBase

Filed under: Uncategorized — kenjun @ 11:38 am

This basically says:
We are in the directory “/abc” but please process all Rewrites as if you were in a root directory (i.e. ignore the directory /abc).

What it does is strip this directory off before processing further rules then add it back on at the end.

From the Apache docs:
The RewriteBase directive explicitly sets the base URL for per-directory rewrites. As you will see below, RewriteRule can be used in per-directory config files (.htaccess). There it will act locally, i.e., the local directory prefix is stripped at this stage of processing and your rewriting rules act only on the remainder. At the end it is automatically added back to the path.

Getting rid of index.php from your CodeIgniter URLs

Filed under: Uncategorized — kenjun @ 10:04 am

Here are the steps you need to follow:
1. Create a .htaccess file to configure the rewrite engine (an example htaccess file follows at the end)

2. Set $config[?index_page?] to an empty string

3. Make sure your apache uses the mod_rewrite module

4. Make sure apache is configured to accept needed .htaccess directives

5. Restart apache and test

RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#’system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

# If we don’t have mod_rewrite installed, all 404’s
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php



Filed under: Uncategorized — kenjun @ 9:59 am

Syntax: RewriteRule Pattern Substitution

Here’s an example you could use in a .htaccess file:
RewriteRule ^(.*)$ /index.php/$1 [L]
which says if you have a URL like this:
then replace it with

where the not very user-friendly [L] flag means “stop processing”:
‘last|L’ (last rule)
Stop the rewriting process here and don’t apply any more rewriting rules. This corresponds to the Perl last command or the break command from the C language. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. For example, use it to rewrite the root-path URL (‘/’) to a real one, e.g., ‘/e/www/’.

See here for more details:

July 18, 2008

Privacy List Error – Spotlight

Filed under: Uncategorized — kenjun @ 6:17 pm

I got this error message when trying to add a folder on an external disk drive to the Spotlight Privacy area in Preferences.

“Privacy List Error

The item couldn’t be added or removed because of an unknown error.”

This forum suggests deleting this file:
and then restarting Finder.

July 17, 2008

Linux and Unix Named Pipes…

Filed under: Uncategorized — kenjun @ 12:46 pm

The simplest way to show how named pipes work is with an example so run this in a terminal:
mkfifo pipe

Suppose we’ve created pipe as shown above. In one virtual console1, type:

ls -l > pipe
and in another type:
cat < pipe

July 15, 2008

Creating Japanese CSV files that Excel can read…

Filed under: Uncategorized — kenjun @ 1:11 pm

Here’s a test script…

These pages are helpful:
(see Smelly’s comment 26-Apr-2007 06:09)

See also:

PHP5 on MacOSX Leopard

Filed under: Uncategorized — kenjun @ 1:06 pm

Install here:

To use it from the command line you need to add it to your .bash_profile and then close your terminal and re-open it.
E.g echo ‘export PATH=/usr/local/php5/bin:$PATH’ >> ~/.bash_profile

Another handy page is the MySQL on Leopard also by Marc Liyanage:

July 11, 2008

Understanding the Cloud Computing/SaaS/PaaS markets: a Map of the Players in the Industry

Filed under: Uncategorized — kenjun @ 6:55 pm

Here’s a visual map of the Software As A Service / Platform As A Service industry showing how the major players fit into the overall space.

Older Posts »

Create a free website or blog at