css (1) jQuery (7) linux (38) mac (70) php (29) python (1) svn/git (9) trac (4) ubuntu (1) virtualbox (6) vista (2) windows (14)

Saturday, 31 October 2009

Ubuntu 9.10

Anyone thinking of upgrading to ubuntu 9.10 should check this out from the release notes

Possible corruption of large files with ext4 filesystem

There have been some reports of data corruption with fresh (not upgraded) ext4 file systems using the Ubuntu 9.10 kernel when writing to large files (over 512MB). The issue is under investigation, and if confirmed will be resolved in a post-release update. Users who routinely manipulate large files may want to consider using ext3 file systems until this issue is resolved. (453579)

I think I'll stick with jaunty for now, the only reason I'd have to switch to karmic would be the performance boost from ext4 (which is best gained by creating a new ext4 partition not upgrading).

Sunday, 25 October 2009

Connecting to idisk on ubuntu

This is dead easy (note it uses the command line but it's still easy)

Run the following commands in a terminal

apt-get install davfs2

mkdir -p /path/to/where/you/want/your/idisk/to/be/mounted

mount -t davfs<your userid> /path/to/where/you/want/your/idisk/to/be/mounted

It will then ask you for your username and password. Then you can access it from /path/to/where/you/want/your/idisk/to/be/mounted

Finding the total size of a directory on Linux

du -c -h /root | grep 'total'

That's it! (That returns the size of the root directory by the way
change /root to whatever you need i.e /home)


I'm currently designing a site which has an intended audience that uses up to date technology (yay no IE 6), which means I get to freely dabble in CSS3.

A few useful things I'm using are css nth-child selectors, i.e.


This makes alternating table rows switch from grey to white, brilliant!

rgba colours, (rgb with alpha transparency) 


This makes a grey background at 1/4 opacity which doesn't affect child elements unlike


Another useful one is 


which makes the first line of the text small caps!

HTML Tables and Positioning

Interesting thing on css positioning with tables

The effect of 'position:relative' on table-row-group, table-header-
group, table-footer-group, table-row, table-column-group, table-
column, table-cell, and table-caption elements is undefined.

In other words don't use position:relative on table cells, which also
means you can't then align something inside a table cell relative to
the cell.

Spamhaus blacklist

Well today was an eventful day.

I manage a server which is hosted with Rackspace. I get a complaint that addresses aren't receiving email from the server so I go to check it the mail logs we have...

"[]:25, delay=0.16, delays=0.08/0.01/0.06/0.01, dsn=5.0.0, status=bounced (host[] said: 550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated SMTP e-mail to an Internet mail server. maintains lists of dynamic and residential IP addresses. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit for email delivery information and support (in reply to MAIL FROM command))" I checked and it says Ref: PBL290440 is listed on the Policy Block List (PBL) Outbound Email Policy of Rackspace US, Inc. for this IP range: It is the policy of rackspace that unauthenticated email sent from this IP address should be sent out only via the designated outbound mail server allocated to rackspace customers. To find the hostname of the correct mail server to use, customers should consult the original signup documentation or contact rackspace Technical Support.

Big schpeel...which basically means the ip range (30 addresses) which the server I support happens to be in are fluffed.

So I go and bug rackspace tech the fun begins. They check things out, turns out that one or more servers in the range (not the one I manage) has been spamming so they got added to the black list, and it will take up to a week to get the address off the list...oh yay.

So I ask for an extra IP outside the block to send mail via...DENIED! Why? Because they can only supply IPs for SSL certs, oh come on I only need it for a week.

They suggest I clone the server to another box and use that new IP..yeah right that means downtime while the new server is built and while DNS propagates which is around 2 days.

So what do I end up doing? Building a new server and have postfix relay through that...which is quite easy in the /etc/postfix/
file add the following
relayhost = (replacing with the IP of the new server)
Then on the new server set
mynetworks =, yyy.yyy.yyy.yyy (replacing yyy.yyy.yyy.yyy with the IP of the old server)
Restart both postfix services and you're done.

Monday, 19 October 2009

PHP null and MySQL timestamps

Something odd just occurred. I tried inserting a php null value into a
mysql timestamp and it had the same effect as inserting NOW(). Not
sure if this is a general rule or if it's just because of the
framework im using (yii) very odd.

Sunday, 18 October 2009


I've just finished an interesting job, installing and configuring PHP,
MySQL and MySQL Data Manager on Windows Server 2003 x64 with IIS 6.

Nothing too taxing, just something I don't get to play with very
often, most clients I work with use Linux (since the only sane reason
I can think to use a windows server is for ASP and I don't use ASP).

Saturday, 17 October 2009

Pure-FTPD (?@?) [ERROR] Sorry, invalid address given

This is a weird error. After rebooting a server the FTP server was
throwing this.

It turns out Pure FTPD resolves hostnames for client IPs since 99% of
clients won't have anything to resolve to it throws this error.

How to fix? add -H to the command line or if you're using debian/
ubuntu use the following command
echo "yes" > /etc/pure-ftpd/conf/DontResolve

Sunday, 11 October 2009

Vista SP2 winsxs disk space

A few months ago I made a post about Vista SP1 and the winsxs disk space here

Now for SP2 open a administrator command window and type compcln it does the same thing just for both packs.

Logwatch Date::Manip error

If you get this error when running logwatch

ERROR: Date::Manip unable to determine TimeZone.

Execute the following command in a shell prompt:
perldoc Date::Manip
The section titled TIMEZONES describes valid TimeZones
and where they can be defined.

Do the following

export TZ='+0000'

before hand (replacing +0000 with your timezone offset)

Tuesday, 6 October 2009

Importing OPML RSS feeds into

I wanted to move from google reader to, and exported my feeds to OPML format, went to import into mail...shock horror it doesn't accept OPML but here is a good way of getting round it

  1. Export an OPML file from your favorite feed reader (Google Reader for me)
  2. Run the following command in Terminal: perl -lne 'print $1 if /"(http.*?)"/' google-reader-subscriptions.xml | pbcopy
  3. Open Mail
  4. Go to File » Add RSS Feeds...
  5. Choose the Specify a custom feed URL radio button
  6. Click in the entry box and hit Command-V to paste the feed URLs
  7. Click the Add button
It works in os x 10.6 too.

Sunday, 4 October 2009

Adobe Illustrator default unit measurements

To change the default unit of measurements in adobe illustrator from
say px (pixels) to say mm (millimetres) go to preferences> units and
display performance.

Saturday, 3 October 2009

Nginx catch all host

Here is a modified version of the nginx catch all host supplied at the
nginx wiki

#catch all host
server {
listen 80 default;
server_name _;
access_log logs/default.access.log main;
server_name_in_redirect off;
return 444;

This one like the original will respond for any host that isn't
already specified by a server_name i.e. if someone puts the ip of the
server into the browser.

To save you having to actually show them something return 444 which
tells nginx to drop the connection as far as anyone will know nothing
is there, this is also handy if you monitor domains using http and one
of them is missing from nginx's configuration since your monitoring
tool will scream saying the site is down and you can go fix it.

Nginx IP Blocking

If you want to block an IP using Nginx it's dead easy

location /
deny from;
allow from;

Friday, 2 October 2009

JQuery reloading the DOM

Sometimes if you add an element to the DOM using JQuery you will want
to use JQuery on the new element, there is no inbuilt function that
reloads the entire DOM but you can use the live function to simulate
it see

suPHP group writable - finding files

If you run suphp it doesn't like files/folders that a group writable
to find these files use the following command

find <path> /020 -exec ls -lhd '{}' \;

This will list all files/directories that are group writable

Thursday, 1 October 2009

PHP CGI and Apache Module

If you want to have both you need to compile php twice, why? Well
because you can only compile one sapi+cli at a time see

SuPHP conf file

Just a note when compiling suphp with a custom prefix that the
suphp.conf needs to be in $prefix/etc/suphp.conf

Gmail/Google Apps Mail filters, not from

If you use gmail/google apps and want to filter emails NOT from
someone put a - before the email address in the from box

i.e. if you wanted to filter emails not from you
would type

Finding broken symlinks

I've just been moving a wordpress installation from one server to
another and a broken symlink was causing it to not work, to find all
broken symlinks use the following.

find . -type l ! -exec test -e '{}' \; -exec ls -l '{}' \;

This is what it does

find .

finds everything in and below the current directory

-type l

finds symlinks

! -exec test -e '{}' \;

tests if the file (which find passes to '{}') exists if not it
continues with the next step

-exec ls -l '{}' \;

executes ls showing the long information which will look something
like this

lrwxrwxrwx 1 <user> <group> 76 Sep 30 03:54 <symlink path> ->
<original path>

Nginx and Drupal clean urls

Here's a quick rewrite rule to allow nginx to use drupals clean urls

if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?q=$1 last;