How to: install mod_geoip2 for Apache2 on CentOS server.

mod_geoip2 is an Apache 2.x module for finding the country and city that a web request originated from. It uses the GeoIP library and database to perform the lookup. Steps: [*] Login via SSH as root to your server [*] Get the GeoIP C Library from MaxMind wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz Wait until finished –09:43:23– http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz Resolving geolite.maxmind.com… 64.246.48.99 Connecting to geolite.maxmind.com|64.246.48.99|:80……

Read More »

How to: Convert MySQL Hierarchical Data Flat List Result to Multi-Dimensional PHP Array

Recently, for a fun stuff, I came across a need of an infinite level of categories. I stumbled uponGijs Van Tulder‘s article of “Storing Hierarchical Data in a Database” at SitePoint. Based of Van Tulder article I’m experimenting on my localhost. Below is the contents of my ‘categories’ table:+—–+——-+——–+———-+——+——+ | id | title | parent | parentid | lft |…

Read More »

How to: remove vertical green line in Geany code window

By the way, the green vertical line act as an aid, but many users find its distracting. Follow the steps below to remove the vertical green line in Geany version 0.18 (Ubuntu) window: Run Geany, go to: Edit >> Preferences >> Editor >> Display Select “Disabled” radio options below “Long line marker”. Hit “Apply” and “OK” button.

Read More »

How to fix: Squid cache_dir (13) Permission denied

I was configuring a newly installed Squid cache on newly installed CentOS 5.2 to use a new partition for it’s cache dir. Squid version: [root@localhost ~]# squid -v Squid Cache: Version 2.6.STABLE6 configure options: ‘–build=i686-redhat-linux-gnu’ ‘–host=i686-redhat-linux-gnu’ ‘–target=i386-redhat-linux-gnu’ ‘–program-prefix=’ ‘–prefix=/usr’ ‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–sysconfdir=/etc’ ‘–includedir=/usr/include’ ‘–libdir=/usr/lib’ ‘–libexecdir=/usr/libexec’ ‘–sharedstatedir=/usr/com’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–exec_prefix=/usr’ ‘–bindir=/usr/sbin’ ‘–libexecdir=/usr/lib/squid’ ‘–localstatedir=/var’ ‘–datadir=/usr/share’ ‘–sysconfdir=/etc/squid’ ‘–enable-epoll’ ‘–enable-snmp’ ‘–enable-removal-policies=heap,lru’ ‘–enable-storeio=aufs,coss,diskd,null,ufs’ ‘–enable-ssl’…

Read More »

How to fix: Drupal “user warning: Unknown column…” error

Exact error message: … user warning: Unknown column ‘page’ in ‘where clause’ query: [function_name] /* [username] : [function_name] */ SELECT n.nid FROM node n WHERE n.type = page AND n.status = 1 ORDER BY n.created DESC LIMIT 0, 5 in /home/user/public_html/path/to.module on line 294. … Th query in question: $result = db_query(‘SELECT n.nid FROM {node} n WHERE n.type = %s…

Read More »