Catch all web script

It can sometimes be useful to have a script that captures all the HTTP requests and that logs these requests to a file. The PHP script below works for me. I use this script in combination with the htaccess file to catch all web page requests and redirect them to one file.

The .htaccess file :

The apache config for the virtual host is straightforward.

Theming WordPress excerpts and archives

I run this blog on WordPress. One of the major advantages of WordPress is its support for customizable web themes. These themes contain the graphical markup (CSS, images) and PHP code to mangle the data that is displayed.

I’ve adapted some of the default functions to have the display of archives and blog excerpts behave differently to the default provided by WordPress.

WordPress archives are accessible via the wp_get_archives function. This function has a numberRead more.

Include an Evernote feed in your WordPress blog

I use Evernote to keep track of my ToDo’s, interesting web pages that I visited, found code snippets or some random thoughts. I have it configured in a browser on my laptop and as a separate app on my smartphone.

“Things” in Evernote are put in notebooks, notebooks can be shared. I’ve been sharing some of my notebooks with friends and colleagues to keep track of joint projects. These shared notebooks have a RSSRead more.

Graph the first 8 bits of the IP of apache logs

Below is a PHP script that will graph the first 8 bits of the visitors source IP in your apache logs. The bigger the circle, the more visitors you had. You’ll need gd support in PHP. The minimal width of the circle is set to 3, the maximum width is 85. You can run the script with

The first parameter is the log file. The second parameter is either 20x, 40x or 50x. This graphsRead more.

New design

I thought it was time for a new design of this website. The old setup was a combination of my own code with a WordPress blog. I now moved everything to WordPress with a custom theme and some template coding.

The old site used to look like this :

This site uses Google Fonts so you might want to turn on Javascript for all visual effects.

Use ONLY_FULL_GROUP_BY with WordPress

Something I came across recently when installing WordPress gave me headaches. Everything seemed to work properly except when selecting posts by category no results were returned.

I debugged the problem by looking at the SQL-queries performed by WordPress. One query returned an error :

Because the MySQL server was configured to honor ONLY_FULL_GROUP_BY it gave the error “‘test.wpposts.post_author’ isn’t in GROUP BY”.

I could not disable ONLY_FULL_GROUP_BY serverwide so I had to insert it inRead more.

WordPress reset

I finally managed to unlock my access to my WordPress blog. Since the last upgrade I always received the “You do not have sufficient permissions to access this page error”

I installed a fresh WordPress (new empty database, new path). Once the setup was done I copied everything from the old database to the new database except for wp_user and wp_usermeta. After logging in as an administrator everything was working as before the error. IRead more.

Twitter or Blog

Dilemma:

Twitter your thoughts and have trouble recording them for later reference. Twitter + custom search don’t play along. Blog your thoughts and having to think of “I can’t have a posting that’s only 100chars long”.

Topic: the metaweblog API is more powerful that the API provided by WordPress. One of my customers asked me to create a function that would create a WordPress blogpost whenever one of their PR-people finishes a customer-visit (funny enough,Read more.

Widgetize your WordPress theme

If you want to use widgets on your WordPress theme, then these are the steps you should take:

1) Create a file functions.php in your theme directory. Add this to the file

2) Open your sidebar.php file and add this somewhere in the ul-list defintion

FOSDEM 2008

FOSDEM, the free and open source developers’european meeting is taking place in Brussels on 23/24 February.

Their schedule is online and shows that there are going to be some interesting talks :

The virtualization track with talks on Xen. Application virtualization with next-generation Klik Unicoding With PHP 6 OWASP WebScarab-NG