The other day I had someone ask if there's a nice solution to the following problem:
Multiple web development virtual machines but only one external IP address.
The quick solution is to port forward on different ports to each virtual machine. For example 81 goes to VM1, 82 goes to VM2, 83 goes to VM3 etc. Which granted, would work, but isn't a "neat" solution.
Using mod_proxy under Apache is a much better solution to this problem.
Deploy a "front-end" server running Apache and mod_proxy. Create a virtual host for each virtual server and then using mod_proxy, reverse proxy to the virtual server. Port forward from the WAN to your front-end Apache server running mod_proxy.
Here's what an example config would look like on the front-end Apache server:
<VirtualHost 213.131.192.201:80>
ServerName cust1.dev.domain.com
ServerAdmin webmaster@cust1.dev.domain.com
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://192.168.0.100/
ProxyPassReverse / http://192.168.0.100/
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ErrorLog /var/log/apache2/cust1.dev.domain.com.log
CustomLog /var/log/apache2/cust1.dev.domain.com.err.log combined
</VirtualHost>
<VirtualHost 213.131.192.201:80>
ServerName cust2.dev.domain.com
ServerAdmin webmaster@cust2.dev.domain.com
ProxyRequests off
ProxyPreserveHost on
ProxyPass / http://192.168.0.101/
ProxyPassReverse / http://192.168.0.101/
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ErrorLog /var/log/apache2/cust2.dev.domain.com.log
CustomLog /var/log/apache2/cust2.dev.domain.com.err.log combined
</VirtualHost>
Requests for cust1.dev.domain.com would be reverse proxied to 192.168.0.100 and requests for cust2.dev.domain.com would be reverse proxied to 192.168.0.101. All with one external IP address and one port forward rule.
Just one of the many uses of mod_proxy. You can also use it for SSL bridging and SSL offloading. Neat!
This was for a client who only needs the basics — email, typing, web browsing — and doesn't have time to adapt to a trendy new GUI.
So I installed Xubuntu 11.10 (I like XFCE).
And it all just worked out of the box — wifi, webcam, sound etc.
Except for sleep and hibernation. I tried all sorts of fixes and troubleshooting, but nothing worked. The screen goes blank, but it doesn't turn off. After being forced off, it resumes as though sleep or hibernation had worked. Couldn't solve it, so I just changed the settings to never try to sleep or hibernate.
I was working on a client's laptop, on which I'd installed Ubuntu 9.04 a few years ago and it hadn't been updated since then.
I wanted to bring it up to date, and knew that the client wouldn't want the look-and-feel of it to change radically, so to avoid Unity and Gnome 3, I decided to install Xubuntu 11.10.
I backed everything up, expecting to do a clean install of the new system. But the Xubuntu installer offered to upgrade directly from 9.04, so I tried it, and it worked!
The only minor glitch was that Thunderbird didn't find the old profile. I had to rename ~/.mozilla-thunderbird to ~/.thunderbird, and then that worked too.
I've been playing with the Perl AppConfig module (http://search.cpan.org/~abw/AppConfig-1.66/lib/AppConfig.pm)
It seems that the getopt() method messes up the global @ARGV array even if I pass it a copy.
For example:
#!/usr/bin/perl
use strict;
use warnings;
use AppConfig;
my $opts = AppConfig->new( { CASE => 0, } );
$opts->define('config=s', {DEFAULT => ''});
print "ARGV: @ARGV\n";
my $argvCopy = [@ARGV];
print "argvCopy: @$argvCopy\n";
$opts->args($argvCopy);
print "after args() ARGV: @ARGV\n";
$opts->getopt(qw(auto_abbrev), $argvCopy);
print "after getopt() ARGV: @ARGV\n";
produces this output
# appconfig-error.pl --config xyz 123 abc
ARGV: --config xyz 123 abc
argvCopy: --config xyz 123 abc
after args() ARGV: --config xyz 123 abc # @ARGV is still complete
after getopt() ARGV: 123 abc # @ARGV has bits missing
This is a problem because I need to call getopt() twice — once to get at the –config option, then I read the configuration file with the file() method, then I re-read the command line options so that they override the ones in the configuration file.
Using args() is OK — @ARGV is preserved — but I need the extra feature of getopt().
I've emailed the author, so I'll wait to see what his reply is.
Last year I bought a Canon DSLR camera. As part of the deal, I agreed to use it and not let it gather dust in a corner. One of the things I've been doing is trying to take regular pictures and upload them to a daily photo blog.
For most of last year I was managing to load one or two pictures per week at best. Since Christmas I've been able to maintain a daily stream - while only a third are actually DSLR images - I think it has been useful forcing me to think creatively and my DSLR has been used more than it would have been otherwise.
If you take pictures and have them available digitally it's an interesting idea to have a photo blog. While it may seem a chore, it's not, like all things it does help to practice and you don't have to take a picture every day...
Here is my photo blog in case you are interested www.blipfoto.com/ajt.
Tags: blogging, photography
Just when things are going well they start to not go well. Last weekend the power supply suddenly died in my seven year old desktop PC. Well actually at first I didn't know what had died but I borrowed a PSU from a friend and confirmed the rest of the PC was okay.
I've ordered a replacement model from a local supplier, and even though I plan to replace the PC within the next 2 years anyway I've bought a silent high efficiency model to see if they make a real difference to the noise the PC makes.
As things go it's not going to break the bank but I don't like it when things break.
Tags: hardware
I met Emma from Emma Lappin Flowers last summer, when I was asked to photograph a wedding to help with the launch of their new blog, Postcards from the Potting Shed. The good news is that the site is now well and truly up and running. Emma included lots of my photographs in her recent twelve days of Christmas series of posts, which was amazing to see. I’ve carried on working with Emma, producing behind the scenes photographs and video of two more weddings. Emma has been incredibly supportive, giving me these opportunities to photograph her and her team at work, and I’m very grateful. This weekend Emma e-mailed me with some very exciting news that I can’t wait to share.
Anyway, back to last summer. I met up with Emma and Amy at Lainston House Hotel near Winchester, a superbly impressive venue and a beautiful English country hotel. I could have shot there all day, there were so many little gardens, lawns, walls and even a crumbling old chapel just perfect for beautiful wedding photos. The wedding itself was stunningly decorated and we even got to see the bridal party before they left for the church. You can read more about this wedding on my wedding photography site.

Last year I bought a new DSLR camera. As part of the deal, I agreed to use it and not let it gather dust in a corner. One of the things I've been doing is trying to take regular pictures and upload them to a daily photo blog.
For most of last year I was managing to load one or two pictures or "blips" per week at best. Since Christmas I've been able to maintain a daily stream, and while only a third are actually DSLR images - I don't take it to work - I think it has been useful forcing me to think creatively and my DSLR has been used more than it would have been otherwise.
If you have been following this blog you will have noticed a fall off of postings here over the past year. This is partially a result of more tweeting and Google+ use, but increasingly because of my blipfoto efforts. This blog isn't dead it's just resting a bit more of the time than it use to.
You should find at the top right a link to my current blipfoto entry, which should contain a picture, which if you follow the link will reveal some trivial diary entry and a larger image.
On Sunday night my 7 year old DNUK desktop would not turn off but was clearly not actually on. On Monday I took the PSU out, on Wednesday a friend lent me a spare and the rest of the computer is okay.
Today I've ordered a cheap silent PSU to replace the noisy and now dead one that was originally in there.
The printer has a web interface: the user name is 'root' and the default password is '1234'.
Installing it as a printer on Xubuntu 11.10 was straightforward, once I'd done a bit of research.
Panasonic give instructions for Redhat here: http://panasonic.cn/support/download/manual/files/Linux_Install_for_KX-MB2000_series.pdf.
This is what I did on a laptop running Xubuntu 11.10:
The scanner was more tricky — research suggested that it couldn't be done, and SANE had no reference to it. But as the printer is capable of scanning to an FTP account or a Samba share, I set up a 'Scans' folder with write access via Samba, and entered the details on the printer (via the web interface or the buttons on the front). And it works! Pressing the Scan button and choosing SMB in the printer menu puts a PDF file in the Scans folder. There's little or no control over scanning settings, but it's a start.
I tried to add this information to openprinting.org, but every time I try to log in there, I just get an empty page.