The Date Picker widget, when using webforms, defaultly appears in American form (Month, Day, Year). For UK sites this isn't often desirable. Doing a quick google and I stumbled upon James Davidson's blog post on how to re-theme the element from earlier this year. I thought it was certainly one approach, but felt there must have been a neater alternative. So here is my approach:
Need to know how to do something? Take a look through this list - covers topics such as converting video, compiling software in linux and tips for firefox.
I recently needed to be able to run a regular git task on a folder and I didn't want to have to CD into that folder first. Annoyingly, there didn't seem to be an optional "path" parameter to
git remote update, until I looked at the help file for Git.
It's quite simple! All you need to do, to run a git command on an arbitrary path, is this:
This handy script will allow you to get the current Load Average (
loadavg) for a remote server over SSH. It will stream the result set back to you, which you can then pipe into a file if you need to.
This would be handy for monitoring the load of a server while stress testing, for example.
I've had several people ask me recently how I managed to get the nice date effect on my blog headers. It's quite simple really. All you need is:
- An Image - A background image (a CSS Sprite) which contains the days, months and years.
- Some HTML - A VERY basic HTML template.
- Some CSS - To align the image sections.
- A PHP Snippet - A Drupal preprocess function.
So, Drupal 7 is out. Have you heard? It was a bit of a quiet launch really. ;-)
When it came to upgrading by blog, I decided (eventually) that I needed to do a cleanup as the Database had been upgraded from 4.7, to 5 and then to 6 - with many modules added and removed in between. New year, new drupal, new blog (kinda)!
It's also a good excuse to test out that some of the modules I maintain actually work in Drupal 7 (such as Page Title and GlobalRedirect). It's also a kick up the arse to get Relevant Content ported to Drupal 7!
Sometimes, when you're running coder on a module, you'll get a lot of errors complaining about Windows line endings. This is because you should set your editor to use Unix Line endings to be consistent with all developers. See the Drupal Coding Standards for more details.
Below is a handy bash script which will help you batch convert many files from DOS to Unix line endings.
How do you find "all" the Drupal sites that Google knows about?
A post on drupal.org suggests Add New Comment, but that wont be entirely accurate. So far I have come up with a search that lists all sites with a User Account page on user/login:
intitle:"User account" inurl:"user/login"
I run XCache on the server that powers this site. XCache is cool. Out of the box, it allows caching of PHP compile code in memory, after all once a file is compile you shouldn't keep needing to compile it on every page load, should you?
A while ago we started having issues running a website. Bandwidth. Upon investigation, we saw that the majority of bandwidth was being use by image files and of those, lot was from the ImageCache folder. It was also causing a lot of excess server load by consuming Apache processes. Something needed to be done.
I just updated this server to PHP 5.3. As all my sites are Drupal 6 it seems I have a few issues ahead which mean I need to patch Drupal to stop PHP complaining about deprecated stuff…
So I headed over to the post on drupal.org which is discussing 5.3 compatibility in Drupal 6 (which I personally think SHOULD go in) to grab a patch. I applied the patch with no problems. I refreshed a page and got a white screen so I checked the logs only to see…
Ever had that situation where you've enabled
:set paste and pasted in hundred of lines of code into vim only to see it all fully left aligned? I just did… And bugger going over each line and manually indenting it! Want know how to indent a visual block of text?
After Worldpay recently changed to use the RBS system, I was tasked with finding every instance of
select.worldpay.com/wcc/purchase in our forms and replacing it with
select.wp3.rbsworldpay.com/wcc/purchase. There appeared to be thousands of files and I wasn't going to do it manually…
Back in November last year, I wrote a script which handled backing up a drupal database. There were quite a few comments and I've taken some on board and developed the script on a little further to be more "generic".
One of the main complaints/suggestions about my previous snippet was the hard coded nature of it. The follow script offers far more configuration through the command line itself.
This morning I updated a site to the latest release of Drupal 5.16. Nothing special there at all. I've done that many times as has (hopefully) mabye other drupal devs… However, I'm a bit of a newbie when it comes to SVN. Didn't I mention this drupal site was in an SVN repository? ;-)
svn copy'd the trunk to an "
update_to_5.16" branch, checked out this branch and done a
cvs up -dP -r DRUPAL-5-16. Everything is going according to plan so far. Next I run
svn status to get a list of files which I need to mark as added or deleted (or to list anything else which has gone wrong). What happens next is I get a list of hundreds of CVS Template files which have been added to the CVS folders. For example…
The first test is a valid email address test. The second test is if an account exists for that email address. The third is if the username, generated by the "user" part of the email address, exists. If there are any issues, the "error" is logged into and array and printed at the end.
As the function goes along, a user is saves with the user part of the email address as their name, a random 6 character password and the email address as the contact address. In this example, it also give the user role number 3, which was our "subscriber" role.
I just needed to find the largest files in a folder (in an attempt to find out why it was so bloody huge!) and have ended up with the following handy combination of commands…
find /path/to/folder -size +1M -print0 | xargs -0 du -h | sort -nr
After about 4 days of using OpenSUSE 11.0, I'm not overly impressed with it in comparison to RedHat Enterprise 3/4/5, CentOS 5, Fedora 9 and Ubuntu 8.x (other distro's I've used). OpenSUSE has some annoying habits and default/unusual configurations…
I was just dumping a database using
mysqldump and I noticed that tables such as
cache (and its cousins
watchdog can be pretty big and are also not often essential for backing up. I mean, when you restore your web site do you really care about restoring people's logged in sessions from when the backup took place? I can understand maybe keeping watchdog; but then again should you lose your site you would probably lose it several hours after the backup so would miss out on any relevant watchdog notices.
Anywho… I did a
mysqdump for a large database for a website I maintain and the dump came out at 400Mb. I then spent a few minutes cobling together a small script which would do a
mysqldump but had some pre-programmed Regular Expressions to match specific groups of tables which it would only dump the structure for (ie, no data). After running this script, the SQL dump was only 220Mb. Much better! It also runs considerable quicker too and will cause less table locking.
So - the script?
- 1 of 2