Articles about programming

As a programmer by hobby and by job, I stumble across a lot of resources for programming, from websites to gaming competitions.

Recently at work we had been having issues with spiking server load. One of the potential suspects was the Apache configuration as it was allowing 256 MaxClients. Combine that with Drupal eating RAM for breakfast (say a minimum of 12Mb per page) and you have a recipe for disaster - too many visitors cause a RAM shortage, lots of swapping and eventually a server meltdown. After speaking the Rackspace Technical Support Team, one of the guys there (Daniel) wrote a VERY useful script for us to run on the server to monitor Apache usage.

I was browsing around the Devel Module the other day and I noticed a few functions that are not mentioned in any documentation that I've seen but make life even easier, as if Devel doesn't make it easy enough! Almost everyone that's used Devel will be familiar with <strong>dprint</strong>_r (A debug version of the popular print_r function in PHP). Well who has used these ones?

MySQL and Drupal

Following on from my Numbering Rows in MySQL article, today I needed to populate the weight column of the term_data table for about a hundred terms so that they incremented in alphabetical order. This was, on the face of it, a very tedious task; click edit, select weight from drop-down, submit, 'goto 1'.

As I said in my Numbering Rows in MySQL article, I don't like tedious - but I do like over-complicated methods which actually make my life more interesting and less tedious... Enter a nifty MySQL script!

Apache Logo

I recently needed to force a PDF to download using Apache. The default behaviour for most browsers is to try to open the PDF inside the browser itself. This is fine for a small PDF or for powerful machines - but a large PDF on even a modest machine can often lock the browser up. This needed fixing!

After 20 minutes of perusing the Apache documents, I happened across the FilesMatch option which takes Regular Expressions. Regular Expressions are cool things which pattern match; you give it a rather complicated (yet logical) pattern and it matches it for you. Initially I used something like this...

I recently launched a Drupal Codebase site for a programming community and wanted to have the user profiles to be more than just a "signed up on..." and a Tracker Tab. I wanted them to have structured and customisable blocks, dynamic content, a Peer to Peer Message Board (almost finished)... I can have my dreams cant I?!

I recently wrote a book page on how to programmatically create a view. I wanted to do this as it would allow to me control almost an entire website with multiple content types, terms and users (as well as combinations of the three) along with RSS feeds - all powered by the Views Module + a bolt on module consisting mostly of a menu callback and a function to make and configure a view. This worked pretty well for a first try and principle test!

I then realised - hey, if you can do this with Views - why cant you do it with Panels too? Panels are fantastically useful for structuring multiple blocks, views and nodes onto a page. So I tried… And you can!

Today I officially launch a new Codebase for Dark Basic Pro. I'm a big fan of Dark Basic Pro and this Codebase is one of the ways I'd like to help the community back. There is a codebase which The Games Creators provide and it is a good codebase with a LOT of content. This codebase, however, offers more  "Web 2.0" features such as free tagging, comments and rating (and I've only just got started - more to come!).

Codebase Large Banner

With some help from a good friend, I took my first steps into game-making using C++ last night. I used a graphics engine called Ogre3D and tried to mimic a game I started making in Dark Basic Pro a few weeks ago. To my astonishment, within a few hours I'd managed to replicate the basic layout of the game using tools which cost absolutely nothing!

Drupal Grep

I recently needed to find out a list of modules which used hook_cron. I have SSH access to my server. Instead of writing a module (or using devel to execute some PHP) which returned the result of module_implements, I turned to grep. Simply cd into your modules folder (can be the Drupal install, but you end up recursing through unlikely folders) and run this:

grep -R "^function.*_cron" *module

Spam With Cheese

I've recently been receiving some spam from some Russian IP's. As each spam attempt was from a different IP, blocking individual ones was a little futile and time consuming. I did a quick Google and ended up at Deekayen's website as it seems he has had similar issues. His solution was an Apache level "Deny"… My solution uses iptables.

Google announced today that it will be sponsoring 20 - yes twenty - projects for its Google Summer of Code program this year. From what I've seen, Drupal is one of the top "winners" if you use project quantity as a metric, with only Apache and KDE beating us (I couldn't see any others with any more at a glance). We got more than Joomla, PHP & The Mozilla Foundation and I believe this is a real achievement.

I'm also thrilled that Konstantin Käfer and I am mentoring one of the projects this year - the Taxonomy Manager.

Pongis Screenshot

I've just released a new game - its a VERY simple adaptation of the classic, pong, but it has a twist in the form of tennis. You must rally the ball back and forth - the ball gaining speed slightly on every return. Players win points (and serve) by knocking the ball past their opponent, either through a cunning move or by making them lose out in a game of reactions.

Checkout the game here - Pongis - Where Pong Meets Tennis

I just found this plugin (again) on The Games Creators Forum. Basically it adds new features to Dark Basic Pro. I'd used an older version of it but this one seems to have plenty more! Hopefully I'll put the project I'm using it for up soon - a resource management game

Find it at The Games Creators

As many of you may know, I'm a BIG fan of Dark Basic Pro and this christmas the coding challenges are doing something a little different - a challenge that's allowed to use MEDIA an also has a prize other than setting the next challenge… A custom bitmap designed by a professional designer!

The only media that you're allowed to use is this festive smily…

Festive Smily

Drupal 5.0 beta1 has been announced.

It comes with many new features, including a web-based install system, improved administration tools, and a shiny new theme! There are also tons of under-the-hood improvements, such as the inclusion of the jQuery JavaScript library, node access system improvements (ACL), and many improvements to the Form API.


Well its nearly 1am - but I've just submitted by very first Drupal module to the community

Basically, if you have an alias for a node then it will redirect you to the alias if you try to access the node directly… The best example is the site it was designed for. At you could access a news story by:

Subscribe to Articles about programming