Jun
09
2010
0

Combining two images with ImageMagick

To combine two images of the same size with ImageMagick, you simply do the following:

The following will overlay overlay.png on top of output.png

mogrify -draw "image SrcOver 0,0 0,0 'overlay.png'" output.png

While this one will overlay overlay.png on top of input.png and save it as output.png

convert input.png -draw "image SrcOver 0,0 0,0 'overlay.png'" output.png

You can download imagemagick from http://www.imagemagick.org/

Written by John Burns in: General Randomness, PC Tips |
Jun
02
2010
0

Deleting folders recursively

I needed recursively delete folders named .svn within a directory structure.

The following will allow you dto do this from a command prompt:

FOR /F "tokens=*" %G IN ('DIR /B /AD /S .svn') DO RMDIR /S /Q %G

Remember, if you’re doing it from a batch file, you’ll need to double up the percent signs, thus:

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S .svn') DO RMDIR /S /Q %%G
Written by John Burns in: PC Tips |
Apr
26
2010
0

IIS 6- Setting up a write only FTP directory

So, you want to set up a write only ftp directory on IIS? One where you can upload files, but not list them?

Easy…
(more…)

Written by John Burns in: PC Tips, Tips |
Apr
25
2010
0

WordPress Super Cache plugin – Performance Benchmarking

I’ve been doing some performance tests on WordPress to see how much of a difference the WordPress Super Cache plugin made.

It turns out that the plugin makes a huge difference. (more…)

Written by John Burns in: General Randomness, Linux Tips, PC Tips, Tips |
Apr
22
2010
0

Wordpress not sending emails on ubuntu – nrcpts=0

So, you’re using sendmail to try and send emails from php/wordpress and it’s not working?

Are your mail logs (/var/log/mail.log) showing nrcpts=0 ??

Make sure the sendmail_path in your php.ini file (/etc/php5/apache2/php.ini) is set up correctly.

It should probably be…

1
sendmail_path = /usr/sbin/sendmail -t -i
Written by John Burns in: Linux Tips, Tips |
Apr
22
2010
0

Wordpress, Permalinks and 404 errors

This page has the permalink http://www.john.geek.nz/2010/04/wordpress-permalinks-and-404-errors But internally its default URL is http://www.john.geek.nz/?p=1495.

Permalinks help people see the topic of a page before it’s visited and generally mean that search engines will rank them higher too.

OK, so you’re getting 404’s as soon as you enable permalinks other than the default?
(more…)

Written by John Burns in: Linux Tips |
Apr
14
2010
0

DateTimeUTC – Version 1.1

I’ve been using DateTimeUTC for quite some time in batch files to get a nicely formatted date.

This is the first major revision of DateTimeUTC where you can now add or subtract from the current date. This is very useful if you want yesterday’s date.

Get the latest version from here: DateTimeUTC

The main usage of the application is:

datetimeutc [-options]

Options:
-fFORMAT Set output format
-z Set output time to Local Time (Not UTC)
-help View full online help

Example formats:
yyyyMMddTHHmmssZ 20081121T100227Z
“yyyy-MM-dd HH:mm:ss UTC” 2008-11-21 10:02:27 UTC
“dd MMMM yyyy” 21 November 2008
ddd Fri
dddd Friday
fff (Milliseconds)

Use double quotes when the format includes a space
Use backslashes to escape reserved character

Now, to add or subtract from the time, the format of the option is:
-[timeunit][value]
[timeunit] is one of YMdHms for Year, Month, Day, hour, Minute or Second
[value] is an integer and can be positive or negative

The following will print the UTC time one day ago:
datetimeutc -fyyyyMMddTHHmmssZ -d-1

Do get the output into a batch file, try this:
for /f “usebackq” %%a in (`datetimeUTC.exe -fyyyyMMddTHHmmssZ`) do (set UTCdts=%%a%)
echo %UTCdts%

Job done

Written by John Burns in: PC Tips, Tips |
Feb
02
2010
0

Enca binary compiled for 32 bit Windows

Enca is a (normally *nix) application which attempts to detect the text encoding of files.

It’s only supplied as source which isn’t too helpful for windows users.

Enca is particularly useful at guessing the encoding of text files where the language is known.

Here is version 1.12 compiled into a native windows binary: enca_1-12.zip
(I’ve compiled this from a downloaded source, so no responsibility is taken for it’s suitability for use, being free from viruses, etc. In other words, use it at your own risk)

Written by John Burns in: PC Tips |
Jan
27
2010
0

Plugging in headphones doesn't mute speakers in Ubuntu

I upgraded to Ubuntu 9.10 in early December, but yesterday was the first time I tried to use headphones since then.

It turns out that plugging headphones into the headphones socket doesn’t automatically mute the speakers anymore.

Here’s a fix.

Open a terminal (Alt+F2 > gnome-terminal)
alsamixer (enter)
Use the arrow keys (left/right) to highlight Headphon
Press ‘m’

This should fix it. You can now hit Esc to exit and exit the terminal.

Written by John Burns in: Linux Tips |
Jan
18
2010
1

Ubuntu Software Centre – Not available in the current data

If you get the error “Not available in the current data” in the Ubuntu Software Centre, try opening a Terminal and running this:

sudo apt-get update

Update: This should also fix the error “Not available for your hardware architecture” as well

Written by John Burns in: Linux Tips |