You are herephp

php


Neat hack: forcing browsers to refresh script source javascript in your CMS

By dgtlmoon - Posted on 27 November 2008

A handy hack, force browsers of visitors to your website to refresh their javascript cache, handy when you are doing extensive upgrades to your site and you really must ensure everyone is running the latest javascript from your site.

this code works in drupal, but could be easily tweaked for other CMS's or PHP frameworks.

it just appends a "/foo.js?$file_mod_time" to any script sources that are parsed to it, so as soon as you change the file, this ensures any browsers will try to grab the latest version.

function append_js_time($matches) {
  if($matches[1]{0} == '/') {

Speeding up Drupal 5.x on Dreamhost, slow no more!

By dgtlmoon - Posted on 05 November 2008

I'm sure you all love Drupal however there are a couple of design decisions that are less than ideal in all circumstances.

One of them is the path alias handling, you know - the stuff that lets you have a page accessible via mysite.com/fruit/bananas instead of mysite.com/node/1234

drupal 5.11 to drupal 5.12 update patch

By dgtlmoon - Posted on 02 November 2008

See attached, might save you a minute or two Apply with


dgtlmoon@nine:~/drupal-5$ lynx -source http://dgtlmoon.com/files/drupal-5.11-to-5.12.patch|patch -p1
patching file CHANGELOG.txt
patching file includes/bootstrap.inc
patching file modules/aggregator/aggregator.info
patching file modules/block/block.info
patching file modules/blog/blog.info
patching file modules/blogapi/blogapi.info
patching file modules/book/book.info
patching file modules/color/color.info
patching file modules/comment/comment.info
patching file modules/contact/contact.info
patching file modules/

MemcacheQ - cool find of the day

By dgtlmoon - Posted on 01 October 2008

Was reading up on memcacheDB and came across MemcacheQ (also on the same page)

MemcacheQ is a distributed message queueing mechanism that lives onto of - you guessed it - memcache.

So you get all the benefits of memcache's speed, portability and distribute-"ability" but for managing message queue's.

For example, you could run memcached on your server farm, post a new queue into the "cloud" and any of of your nodes can grab the best suited message for them and process it.

it's as easy as..


<?php

Drupal python background server

By dgtlmoon - Posted on 17 July 2008

Heres some code attached I wrote last year but havent published it on drupal.org just yet, it's my python background server for drupal actions, or put simply "Asynchronous python daemon for Drupal interaction"

Just perfect for managing actions that require long, cpu or filesystem intensive operations such as encrypting, building a file, or even interfacing with other hardware/usb/bluetooth etc etc

This is born out of the need to have a

Which PHP devel environment to use on AMD64 ?

By dgtlmoon - Posted on 23 April 2008

That's it, I quit, I'm throwing Zend IDE in the bin, I almost considered paying for it after trialing it, until I moved to AMD64 platform, I'm sure the IDE itself is not to blame, but rather Java's stupid problems adopting 64bit architecture (can someone remind me what the point of java was in the first place?)

Yes, I've tried Zend IDE 5.5.1 for x64 and it still crashed or got other errors - no I dont care about playing with the JRE libraries, I'm payed to develop PHP web-apps not mess around with Java.

minor glitch installing mysql 5 on lenny

By dgtlmoon - Posted on 14 April 2008

Looks like the mysql system tables were missing on my fresh install of Debian Lenny on my Acer Aspire 5520 laptop.

just run mysql_install_db , after this you'll need to get your mysql debian credentials back in line, these are usually stored under /etc/mysql/ (this is so mysqladmin etc will work again)


/usr/bin/mysql_install_db
WARNING: The host 'nine' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work

Cheap and easy Drupal MySQL query log analyses and profiling

By dgtlmoon - Posted on 06 February 2008

One thing that will definately improve in Drupal 6.x and onwards is the performance relating to database queries, It is not uncommon for a site which has the usual formula of a few views generated blocks, translation module and a couple of other miscellaneous views entries to suddenly push your site into the 200 to 600 database queries just to generate *one page*.

Fortunately Drupal is continously improving with its caching methods and data abastraction models so it doesnt always have to hit the DB for something simple, or get it to return multiple items in one hit, but i digress.

An Upgrade to the Moveable Type (MT) / Typepad drupal import module

By dgtlmoon - Posted on 26 October 2007

Just finished a fair upgrade of Drupal's import typepad (MT etc) module, you will need my patch from this page and apply it to existing module when you download it.

    Fixes
  • Basic CCK integration
  • Correct comment ordering
  • Correct node ordering
  • Correct node threading, updated to proper drupal setup
  • Update comment statistics

Drupal calendar views module - overriding the calendar link path (undocumented!)

By dgtlmoon - Posted on 19 April 2007

Heres a nice piece of undocumented functionality, took a few minutes of running thru the drupal Calendar views module source to figure it out. If you have a views calendar, maybe as a block, your view has the "block" type enabled and all is working great, except the dates in the calendar link to "/calendar".