Categories
Linux

Managing CUPS from outside your home network

The ability to manage CUPS from outside your network (Remote Administration) can save your bacon sometimes. I had to do this when the kids were trying to print something that it wasn’t working.

CUPS is great, thank you Michael Sweet and also Apple, you have done a good job here – and that isn’t something I thought that I’d ever say about Apple.

If you want to manage a printer on one of your Linux machines from outside your network, allow port 631 through your firewall and edit the CUPS config, /etc/cups/cupsd.conf as follows:

In the and sections add Allow 257.257.257.257 after the Order statement. This isn’t a valid IP, you should replace this with the remote IP address, i.e. the public IP address that you will be connecting from.

Also add DefaultEncryption Never in the main section, I put it under the LogLevel statement.

You should then be able to point your web browser at your broadband connections IP_address:631 and get CUPS management. The URL in your web browser should look something like this:

http://257.257.257.257:631

Of course, 257 is not valid, I did that on purpose.

If you are in the UK, consider ICUK for broadband, they have a great network and broadband IP addresses, although dynamic, rarely change – I’ve been with them 5 years and my IP address has not changed. This makes connecting to machines in your own network very convenient.

Categories
Linux

Installing Virtualbox Guest Additions on a Centos 5 guest

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.3-1.el5.rf.*.rpm
rpm -i rpmforge-release-0.5.3-1.el5.rf.*.rpm

yum --enablerepo rpmforge install dkms
yum install gcc make
yum install kernel-devel

Mount guest additions from the Virtualbox Devices menu (you will need to press right control to free your mouse pointer from the guest.
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
cd /media/cdrom
./VBoxLinuxAdditions.run

Categories
IIS

IIS won’t show CSS, Javascript (JS) and logs say 302?

I uploaded created a new IIS site on a Windows Server 2008 R2 box running IIS 7.5.
I created an Application Pool for this site using an Identity of NetworkService.
I created the site with Connect As “Application user (pass-through) authentication” in the Edit site section and set it to the new application pool.
I set the permissions correctly on the files using Windows Explorer.
I had some other sites on this server which were working properly.

At this point I noticed that none of the CSS or Javascript (JS) content was loading. I checked the server logs and the failing pages were receiving 302 HTTP redirect codes instead of serving the content with a HTTP 200 code.

A quick Google search and I didn’t really find a solution. The problem wasn’t resolved using location path in web.config to set authorisation for all users. The permissions were all correct, they were set exactly the same as a similar site on the same server which was working. Another suggestion that “Static Content” was not installed wasn’t the answer.

The solution was simple. Using Features View in IIS Manager, double clicking on the Authentication Entry under IIS, selecting “Anonymous Authentication”, choosing Edit and changing the setting to “Application pool identity” – Obvious.

Categories
DIY

Building a picnic table – DIY

When we moved into our house it had quite a large proportion of the back garden was taken up by a bouncy rotting deck. Each winter the deck rotted a bit more and each spring I repaired it until I could take no more. So, I ripped the decking up and put down a very nice block paving patio in its place.

So I was left with all this decking which was a bit rotten in places, but I couldn’t just chuck, so I’ve come up with various structures to use this up.

This is the Picnic table
IMG_20150414_075302

These are the tools I used to make it:
Screwdriver (cross head)
Tape measure
Cordless drill
Wood saw
Workbench
Level
Pencil (though I mainly used chalk)

These are the materials:
60 * 60mm all weather screws Check that the screws you order match the decking you will use.
Bunch of old decking cut as follows.

7*1200mm (straight cut)
2*600mm (straight cut)
4*800mm (straight cut)
2*??1300mm?? (35 degree angle at each end)
1*790mm (straight cut)
1*480mm (90 degree angle at each end)

This is how are did it:
Note, I used the ribbed planks which were 34mm x 140mm x different lengths, the depth of the plank will make a difference to the length of screw you use.

I used 5 of the 1200mm lengths for the top giving me 700mm x 1200mm table top.

I used the 2 600mm lengths, 24mm in from each end and screwed 1 or 2 60mm screws from the bottom through the 600mm length into the underside of the tabletop.

I used the 4 lengths of 800mm at an angle of ??degrees for the legs which are screwed (2 * 60mm screws per leg) to the outside of the 600mm lengths under the table top so that the angle of the legs touched each other at the central line of the table.

I used the 2 * ??1300mm lengths with a ?? degree angle for the seat hangers which were fixed so that the top of the seat would be ??mm from the floor. I fixed this to the outside of the table legs with 2 * 60mm screws per leg.

From now on, before screwing anything, ensure that the legs are vertical and that the table is square.

I measured the distance between the outside of the legs (lengthways) at the table top. I then cut a length of wood, in my case 790mm, fixing it horizontally with 3 * 60mm screws at each end, to the centre of the seat hangers.

I put the 480mm diagonal strut into place between the angle where the table top meets the legs, and around 20mm off centre (so there is room for an umbrella hole), making sure that it was a tight fit whilst the table was still square before fixing. This gives the table a lot more lateral strength.

I fixed the 1200mm seats on having ensured they matched up exactly with the table top and the length of each hanger.

Our decking had been varnished and was in a relatively poor state so a lot of hand sanding of the tabletop and seats was then carried out.

The result is a remarkably robust, stable picnic table. If I did another one I’d remove the 790mm strut and 480mm diagonal strut, and use 2 *480mm diagonal between the centre (-20mm for the umbrella hole) of the table top and the middle of the seat hanger for lateral strength with a bit more leg room.

Categories
Wordpress

Link Gallery Widget images to a Post

Something that I feel is sorely missing from WordPress is an easy way to have a bunch of random images from your media library in the sidebar which link to the Post that contains that image.

Solution 1: You can add your posts and attach an image to them, that bit is pretty easy.
The problem with this approach is that you cannot limit the number of images displayed in the sidebar without some fiddling with the theme, and even then I didn’t like how that worked. However, if that is ok with you, do the following:

To get your images to link to the post, install the WP Gallery Custom Links plugin from Four Lights Web Development, you find a few more fields at the bottom of the Edit Image page where you can put the place you really want to the image to link to. You may have thought that this would do the trick, I certainly did, however this doesn’t appear to work from the sidebar and I’ve not found a simple way to fix this with a normal sidebar gallery like Gallery Widget from Oliver Schaal not any other sidebar widget I found, but I will keep looking because this would be perfect.

To set up the sidebar gallery which does work with WP Gallery Custom Links you can install the HTML Javascript Adder plugin from Aakash Chakravarthy, drop this into your sidebar from the Appearance | Widgets section and add something like the following code:

[[gallery link="post" orderby="rand" ids="130,96,95,98,99,97,94,93,92,85,81,82,80,79,87,86,89,90,91,88"]]

Where the ids are the id of the pictures you want included.

The only problem with this approach is that you cannot limit the number of images displayed in the sidebar without some fiddling with the theme, and even then I didn’t like how that worked.

Solution 2: I ended up with this solution which works perfectly for me:

Install NextGen Gallery and also NextGen Custom Fields from Shaun Alberts

Create a new Image Custom Field in the NGG Custom fields called LinkToPost. Create a new gallery and upload your images. Set the LinkToPost field to be the URL of the Post you want to link to.

Add the NextGen Gallery Widget to your sidebar, set it how you want it.

Now edit the NextGen Gallery Widget to use your custom field as the link instead of image itself. Plugins | Editor and Select NextGen Gallery from the Select Plugin to Edit: drop down. Find the nextgen-gallery/widgets/widgets.php file and click on that.
Replace the line that says:

$out = '<a href="' . $image->imageURL . '" title="' . $description . '" ' . $thumbcode .'>';

with:

$out = '<a href="' . nggcf_get_field($image->pid, "LinkToPost") . '" title="' . $description . '" ' . $thumbcode .'>';

The case of your custom field (LinkToPost in this case) is important.

You should be done. Unless anyone knows a better way, that is what I’m using for now.

Take a look at the following sites to see the results of this:
http://tigh-na-acha.co.uk/
http://osvhazair.com

Categories
Holiday property booking calendar

Booking Calendar for holiday property

I put together the web site for my mums cottage called Tigh-na-Acha in Tobermory on the Isle of Mull, Scotland. For some time now we had been looking for a booking calendar which met our requirements which are:

  • Work on a weekly basis, daily calendars just make life too complex for everyone.
  • Show which weeks are available and which are booked.
  • Be really simple for mum to update whether at home or on the go.
  • Allow bookings to be taken online.
  • Take payment online via credit card.
  • Have some ability to customise the calendar.
  • Be hosted on another site, we don’t want to download it and keep having to upgrade.
  • Remember the details of people who have previously booked and those who have shown interest.
  • Preferably be free.

So recently I found what we had been looking for in WeeklyBooking.com.

This simple online, hosted calendar does exactly what we need, and for a couple of £ per month will integrate with PayPal so that we can accept online bookings from anyone. At first I thought that this would only let people with PayPal accounts pay, but it seems that anyone with a valid credit card can use this system.

WeeklyBooking.com works perfectly and I wholeheartedly recommend it to anyone.

You can see this in action by going to the Booking section of Tigh-na-Acha.

Tigh-na-Acha holiday bungalow
Comfortable self catering accommodation in Tobermory, Isle of Mull at a reasonable price
Categories
Excercise

Goodwood Duathlon 2010

I took part in this 10k/40k/5k (run/bike/run) event on the 9th May.

I probably didn’t train enough, hoping that a 25k ride a week and a 7k run twice a week would get me through. The 10k run was ok, it was relatively flat whilst on the racing circuit but when we left the circuit there were a couple of hills, but nothing too bad. I ran with Tyron, we had a slower than normal pace so that we would have something left for the cycle / 5k run at the end and thank goodness.

From the start of the cycle I was getting cramp in both calfs but found that continuing to cycle rather than trying to stretch them out worked better. The first lap of the cycle ride was ok, but my legs went on the hill up to Goodwood horse race course on the second lap. I don’t know how to describe the hill, but coming down the hill you could reach speeds of up to 40 mph so you can imagine what the ascent was like.

Getting off the bike to do that last 5k was murder, I could hardly run and really wanted to stop. The first 1k marker took an age but after that it was just a matter of grinding on. Having to run into the finish area, then go back on yourself for the last 1k before running back to the finish was pretty soul destroying. The zipvit nutritional drink and gel at the 1k marker probably saved me so a big thanks to them.

Also Karen, Beth and Roy and Linda Baker really helped me get through this so thanks to them for that, and for the pictures. Thanks to Graham Davies for his support also, and to all the people that sent me text messages wishing me their support.

My time of 3h 7m 37s was poor compared to others, but frankly, all things considered I was pretty happy to even finish and beat my finger in the air estimated time by 20 mins. I finished 167th out of 215 and the splits were 52:43/1:42:45/28:59.

Here are some photos of me, Steve and Tyron taking part.

[nggallery id=2]