So much for Mobile broadband

In which Steve mutters about the O2 broadband dongle and its broken DNS handling.

Was trying to check a problem with Canalplan AC today and as its sitting on the server in the living room I thought I should try it “remotely” rather than access off the local network.

So I got the O2 broadband dongle and powered it up and connected, and couldn’t reproduce the error… Oh well, thats how things go, especially when you are talking about IE8.

So whilst I was connected I thought I’d just hop onto this blog site and check a couple of things.

Sorry – No Can Do! Not Possible. Kept telling me the site was not available.

But it sits on the same server as Canalplan AC. It sits on blogs.canalplan.org.uk when Canalplan is on www.canalplan.org.uk.

So if one responds, then the other other should. Right?

Well you are wrong:

Here is the output of a ping command:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:Userssteve>ping www.canalplan.org.uk

Pinging www.canalplan.org.uk [212.159.61.36] with 32 bytes of data:

So that’s good – its getting the IP address. It wont ever respond to pings because the router dumps them.

So lets try for the blogs:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:Userssteve>ping blogs.canalplan.org.uk
Ping request could not find host blogs.canalplan.org.uk. Please check the name and try again.

Nope – its not there.

The DNS servers for O2 don’t recognise it as a valid host name.

Tosspots.

OR rather its their Windows software that is screwy. If I power up under Linux then it works fine!

The Cast List of White Christmas

Emma Dreaming
Arthur White
Chris Muss
Jess Likedy
Juan Swee
Hugh Sterno

Wendy Treetops-Glissen
Ann Chilled-Wren
Liz Anne
“Two Ears” Laybelle
Cindy Snow

Emma Dreaming
Arthur White
Chris Musswit
Avery Criss
Miss Carr
Dai Wright

Mayor Dazeby
Mary-Ann Bright
Anna-May Hall-York-Rhys
Mrs B White

Totally NOT my work, all credit goes to Graham Garden, Bill Oddie and Tim Brooke-Taylor for writing this and putting it in “The Making of The Goodies Disaster Movie“.

A Thanksgiving Wedding

So what did you do on the Saturday following Thanksgiving on Thursday and the madness of “Black Friday”? Did you take it easy and watch some TV, or did you venture out to do some shopping hoping that things would be a little quieter.

Or did you go to a wedding?

Rick and Jill’s wedding was one of the reasons we’d flown back to Maine and with it being on the Thanksgiving weekend it all worked out quite well.

Having recovered from too much turkey on Thursday we all gathered at the church on Friday evening to have a rehearsal which went quite smoothly which I suppose is a good thing, and then we all went over to the Ground Round for the rehearsal supper where I think we almost ate too much food again.

Saturday morning seemed to roll round really quickly and Kathy headed out to get her hair done, having got her nails done on Friday afternoon in the middle of the Black Friday madness. Then the Groom’s party descended on the house to get ready which was slightly less chaotic than when Jen got married the other year, but not by much.

There had been an earlier wedding at the church but by the time we got there there was no sign of them and it wasn’t long before wedding guests started turning up and the ceremony started right on time.

It was a pretty good ceremony with some good readings and the deacon talked well and made everyone feel welcome and relaxed, and even made a joke or two.

There was one very funny moment during the service when Rick and Jill went up to light the unity candle from the two side candles and they’d lit it and were walking back and it went out, so the deacon called them back and they tried to re-light it but it just didn’t want to know. After a little bit of work, and two tapers which were really starting to flare up, they got it lit and made their way back to their places and the ceremony continued.

13742 1291940983817 1389037839 836473 2130235 n

I got caught out by the Roman Catholic version of The Lords Prayer which is several lines shorter at the end, and it seems that it caught everyone else who wasn’t RC out as well.

After the service was over and photos were taken we all piled into various cars and headed across town to the Augusta Civic Center where the reception was being held. They’d even put a message on the electric notice board at the Civic Center so anyone driving past it would know.

13742 1291932823613 1389037839 836464 5532964 n

The reception was being held in a function room in the North wing of the Center and there was a craft fayre being held in the main auditorium which some of us joked about crashing but I think the arrival of a lot of people in matching tuxedos and waistcoats might have thrown them off a bit.

It was a great reception and everyone seemed to have a good time. So to finish off this blog here is a picture of the happy couple

13742 1291977184722 1389037839 836631 633757 n

American Customs

On Monday after returning from our weekend away in Kennebunkport I went to my first basketball game. It was a game between the Maine Redclaws and the Springfield Armor at the Augusta Civic Center.

I had no real idea of what to expect. I’d seen some games on TV, including a couple over at Sue and Jeff’s but watching top flight pro teams on TV is very different to seing a pretty new team in the D league. Probably like watching Arsenal v Chelsea on TV and then going to watch Cheltenham v Burton Albion.

I think what struck me most was how disjointed the whole thing felt. There were mad bursts of action with players running back and forth along the full length of the court and then there were whole periods of nothing going on with timeouts and penalty shots, and sometimes those penalty shots seemed to take forever to be taken. Of course with all the timeouts and everything else it’s surprising how long 48 minutes of play can be stretched out to, and having a ref who seeemed to love the sound of his own whistle and his own voice probably didn’t help, and the crowd of just over 3000 people didn’t think he was doing a very good job.

Today was of course, Thanksgiving, so that meant a lot of good food and family time with Kathy’s family, and everyone ate too much, and that was before we started on the various pies for dessert.

Now everyone is just sitting round relaxing and trying not to fall asleep, and talking about plans for Black Friday, and working on wedding programs for this weekend.

What’s in a name?

There’s just something about the names of places in Maine: Perkin’s Cove, Nubble Rock, Cape Neddick, Cape Porpoise, Goat Island..

They sound like places out of a pirate story, but they’re all very real and we didn’t see a single pirate at all which was a great pity.

We had a very enjoyable and relaxing weekend down at Kennebunkport staying at the Nonantum Resort . Although it was a bit odd when we came back on Sunday and found that the main part of the building was in complete darkness and that there were only 4 cars in the Portside Lodge parking lot. I can’t remember when I was last in a pretty much empty hotel, and we were torn between running round the place causing havoc or holding a ghost hunt – but I suspect the main hotel building is the place to do that…. even if its a bit a long hike for Parasoc!

Some of the other big hotels were also locked up tight, “The Colony” was all in darkness apart from some outside lights, and there was no indication of any caretaker there for the winter, so at least there wasn’t going to be a Shining style incident, even if the hotel did look similar to The Overlook in some aspects. But we all agreed that being the over-winter caretaker in a hotel would actually be quite interesting and fun. So if you own a Maine Coastal Hotel and want some winter housekeepers……..

We ate a couple of times at The Maine Diner which does really good food in a very uncomplicated way, in very simple but comfortable surroundings. So if you’re ever on Route One near Wells then I really recommend pulling in and eating there.

I nearly called this post “Goodbye Marginal way” but decided not to (which I’m sure is something you’re really grateful about). We’d been for a walk along Marginal Way after going down to Cape Neddick. The last time we’d been down to Cape Neddick the weather had been rather bad and getting out of the car was not something you really wanted to do, but this time the weather was a lot better and there were quite a few people there. There were quite a few people on Marginal Way too, taking advantage of the good weather to enjoy an afternoon walk along the coast and we took our time and took in the scenery and the sounds and Jeff and I didn’t even get splashed once in all our rock scrambling.

The Rain in Maine…

…was mainly on the Interstate.

The weather was pretty lousy when we drove down to Heathrow on Friday night and we took it steady on the M4 but several lunatics in BMW’s steamed past us at speeds that must have been in excess of 90 mph. We stopped at Reading services for a coffee and loo break before heading back out and getting to the hotel at a not unreasonable hour.

Saturday morning the weather wasn’t much better and the hotel hoppa took us to Terminal 5 through some pretty lousy weather and flooded roads. The bus drive nearly drove into the back of a broken down car, and I think he was the only person who hadn’t seen it.

We left Heathrow about 30 minutes late in very heavy wind and rain and the take-off was pretty shaky and the pilot didn’t waste any time in getting above the storm and most of the flight was quite smooth, apart from the annoying kid in the seat behind me who kept kicking and hitting the seat and whose parents didn’t seem to give a toss. I’d like it if when you book airline seats and they ask if you have special dietary requirements if you could also specify that you don’t want to sit next to, directly in front of, or behind, snotty little brats.

The captain told us that the weather in Boston was pretty much the same as in London and he was right, it was muggy and raining and despite us leaving Heathrow late we actually landed a little early. As we were walking away from the plane I noticed that a lot of the stands were empty and that there hardly seemed to be any planes around. The immigration hall was pretty much deserted and we were only standing in line for a couple of minutes. The immigration officer told us that it was “just a lull” but when we got down into baggage claim the place was pretty much deserted with no other carousels running and our luggage came out pretty quickly.

Then the fun began. We’d brought two bottles of alcohol into the country and the immigration officer asked us if we’d got foodstuffs etc. We said no and he scribbled things on our customs form. After we’d collected our luggage and we headed towards custom we were intercepted and the form looked at and the same questions asked and our form marked again. We were told to go over to one side where they asked us the same questions about foodstuffs etc. and then we had to put all our bags through a scanner.

But even with that we were still outside in a record time. It felt odd to be in Boston in daylight as we usually seem to arrive there late in the afternoon. The bus turned up and we got on and soon we were heading North.

The rain, which had been consistent but light turned heavier and heavier and it wasn’t long before the bus was the fastest thing on the road. I’m not sure how the driver could see where we were going but we got to the bus station in Portland about 15 minutes ahead of schedule. Our cases were dragged off the bus and one of them was a little damp, which given the weather was hardly surprising.

The rain backed off a little bit but then came on a lot harder just in time for Rick and Jill to turn up to collect us.

The rain got heavier and heavier and the drive north wasn’t much fun and there was a lot of standing water on the road. We’d got wet getting the suitcases into the back of the truck and we’d not actually dried out much by the time we had to get out and unload the cases again. They said that it did just over 2.5 inches of rain but I guess we must have been travelling with the heaviest part of the storm because it felt like a lot more.

Everything was a little wet when we unpacked it but we soon got everything dried off and the weather has been pretty good since then.

Look out Maine…. here we come!

Well not until some time on Saturday but we’re on the taxi-way.

The house is pretty much cleaned up and de-fluffed and the parents will be here later this afternoon to house and cat sit whilst we’re away.

Cameras are just about packed, and I’m sort of half done on my packing, which I suppose I should finish off so that I’ll be ready to drive us down to Heathrow on Friday night. We’ve got a good deal on a hotel room with parking, and its a lot less stressful driving down the night before than getting up at something like 4 am to get down to get the coach from the bus station over to Heathrow when you always end up clock watching and every single slow down turns into a minor panic about getting there on time.

We’re flying with BA from Terminal 5, so it will be interesting to see if its really as impressive as they claimed and as it looks on TV. We’re actually arriving in Boston at a sensible time and we’ll see if my electronic visa paperwork has actually made it through the system: they say you don’t need to keep a copy of the confirmation that its valid or take it with you, but we’re not risking it. Then its just a matter of hopping on the Concord bus service to Portland where we’ll be picked up and taken up to Kathy’s mums.

We’ve not got a lot planned: A weekend in Kennebunkport with friends, Thanksgiving with Kathy’s family, and hopefully just a lot of time relaxing, well relaxing for Kathy, I’m hoping that I just wont be sitting round the house all day, I do enough of that at home.

Of course, I nearly forgot : there’s a wedding to go to as well  😆 Rick and Jill are tying the knot the Thanksgiving weekend. Its been a far from easy year for both of them but things seem to be getting better and I’m sure everyone is looking forward to it and all Jill’s planning will all come together.

Weatherwise : well its Maine so everything from bright sunshine, through rain to frost and snow, so we’ve packed hats and gloves and a mixture of clothes, but I don’t think I’ll bother packing the sunscreen or my shorts… but now I’ve said that 😆

Right, that’s enough for now, I think I probably need to go and finish off the vacuuming!

Posting to WordPress MU by Email Part 2

THIS POST IS OBSOLETE

Warning: This post contains material of a technical nature, if you start reading and feel dizzy or nauseous then stop reading immediately and go and lie down.

This is a follow up to my previous post where I outlined a prototype of an extension for WPMU which allowed posting to multiple blogs from one centralised POP3 account which collected all posts from all users of all blogs. This is very different from the usual way of doing it where you either go out to get the emails from external email addresses or you have multiple local accounts.

Well the prototype has, like Frankenstein’s Monster, come alive and it’s now got configuration screens and lots of rich techy goodness to it.

I’m not going to go over the instructions on how to configure the MTA again, those are documented on my last post, and in the notes in the downloadable archive :

Post by Email-v1.zip – file removed

The Archive also contains instructions on where the TWO files need to be placed for the system to work.

What I’m going to cover here is the new features that I’ve added since the last post. Yes I have way too much time on my hands, but this is keeping my brain sharp so its all good at the end of the day.

These can be broken down into to distinct groups which are reflected in the two new options that will appear on the Settings menu:

Blog Level Options

These are options which are set by the blog administrator or blog owner:

Default Category for posts : This is a drop down of all categories and you select one to be the default category for posts without a category override

Optional Categories: This is a tick box list of all other categories in your blog, Toggle the ones you want users to be able to use in their category override.

Allow Posting By:  This is a tick box list of all the user who are members of your blog. Toggle the ones you want to be able to use the post by email. This will include YOUR address and by default no-one of them are checked (which basically deactivates the system for your specific blog).

User Level Options

These are options which are set on a user by user basis.

Personal Identifier : This is a optional text string which allows users to “secure” their posts. If this has been set then posts from them will be rejected outright. So set this to something good but memorable as you’ll have to provide it for each post.

Alternative Email: This allows you to nominate a secondary email address which the system will accept emails from. If you do not set this then posts will only be accepted from the email address registered to your account.

Additional Posting options

To support the “new” features there are now some additional posting options which you set at the top of your email.

wppbm-categories: A comma separated list of category names for this post. NOTE: This is names not numbers which makes it easier to remember (or are you so sad that you know the underlying IDs of your categories). You’ll find a list of the available categories on your user settings page. So assuming that the Administrator has enabled them you could do something like: wppbm-categories : computing,witterings which would post your post with those categories. If you do not specify this line then the default category set by the Administrator will be applied.

wppbm-pid: Your PID. If you’ve set your PID then you have to provide it here. If you’ve set it and don’t include it (or get it wrong) then your post is toast!

 

Posting to WordPress MU by email

Warning: This post contains material of a technical nature, if you start reading and feel dizzy or nauseous then stop reading immediately and go and lie down.

NOTE: The code and some of the details in this article have been superseded by a later post

There are a lot of clients for the PC/Mac/Linux which allow you to post to your WordPress blog without having to log into the back end, and some might question the need to be able to send posts into your blog via email but there are several situations where you can’t use a fat client or you don’t want to use the web back end for various reasons

WordPress MU (the multi-user/multi-blog version of WordPress) supports a basic post by email feature but it involves each user setting up their account to go out to an external email address and picking up the email. This seems rather “backwards” as it means your WPMU server is having to go out to find your new posts, and if you’ve got a lot of blogs then that’s potentially a lot of outgoing POP3 requests and it means that your have got the email account and passwords for your users, which some might see as not being a very good idea. WPMU suggest using a specific account to support posting by email and keeping the account “secret”.

Surely it makes sense for the posts to be delivered to the WPMU server and processed there. This has several advantages when you think about it.

So I’ve written a new version which uses a local virtual domain and a single pop3 box.

So the user emails theirwpmuloginid@some.domain.here which ends up in a pop3 mail box on a server somewhere (preferably the same server as WPMU). Every email sent to some.domain.here arrives into one single pop3 mail box rather than being in different ones. This “catch all” account means that you don’t have to do anything clever like creating email accounts for each user as they sign up.

My process then opens that pop3 account and reads each email in turn.

It will only post if the sender email ID matches the username it is associated with (from the user table). So you have to send email from the email address you signed up with, or the email address you’ve set it to in your account settings and you have to send it to the username you use to login to the site as. This is only very basic security and I will be adding more but for the first pass of the code I felt that this was good enough to prove the principle.

So apart from allowing me to post to my blog via email what else does this “extension” provide? Well users can specify some “options” in the email which affect how their post is handled:

There are currently 4 options that they can provide:

wppbm-tags: comma separated list of tags for this post
wppbm-status: publish [default] | draft | pending
wppbm-type: post [default] | page
wppbm-comments: open [default] | closed

All of these options are optional, you do not have to provide them and if you don’t provide them then the defaults indicated will apply. WPMU developers who have played with the wp_insert_post function will probably recognise them.

Posts accepted by email will be assigned to the default category for new posts.

It currently accepts basic html marked up (bold, italic, underline) messages (either manually coded or from the rich text editor in Google mail). Yahoo marks its html messages up differently so its not working if you try to use their Rich Text Editor, and “advanced” html mark up (like font sizes etc.) don’t work from Googlemail either. Again this will be addressed in a future release.

Things that need adding are:

  • A PID field (so that people can’t just “fake” the sender email address).
  • Ability to support posting to different blogs (rather than just primary).
  • Ability to support posting from more than one email account.

So if people want to try it, and leave feedback then this is how you implement it. If you can’t edit your Postfix configuration (or don’t know how to) then I’m sorry but I can’t help you. I don’t know if other MTAs support virtual domains but if they do and you get it working then we can add those instructions.

I’ve only tested this on Linux so you’ve been warned!!!

In these instructions I’m using posts.my-dummy.domain to represent the domain we’ll be using to send emails to.

Step 1 : DNS Records
Configure your DNS records to support posts.my-dummy.domain. You need to be able to send email to this domain.

Step 2 : Create a REAL email account on your server.
However you do it you need a local email account on the server that you’ll be directing email to. In this example I’m going to call this user wpmuposts

Step 3 : Postfix Configuration
Edit your postfix main.cf file and add the following two lines:

virtual_alias_domains = posts.my-dummy.domain
virtual_alias_maps=hash:/etc/postfix/virtual

NOTE: The virtual_alias_domain MUST NOT be listed in the mydestinations configuration parameter.

Create/edit the /etc/postfix/virtual file and add the following line :

@posts.my-dummy.domain wpmuposts

Save the file, and then you need to create a hash for it using the postmap command. I do this by going to the postfix directory (/etc/postfix on my server) and typing:

postmap virtual

You may then wish to check that everything works by waiting for your DNS to propogate and then going to an external email client and sending an email to anything-here@my-dummy.domain.

You should end up with an email sitting in the POP3 email box wpmuposts. If not then you need to review your settings. There is no point in going beyond this point unless you’ve got the “catch all” email working.

OK so email is now working. That really was the hard part. The rest is pretty easy, and if you’re doing this then going in and editing a php file isn’t the sort of thing that scares you right?

Step 4 : Getting and configuring the extension

Grab a copy of post_by_mail.php and save it to your computer.

Open the file in your favourite text editor and look for the following :

// USER NEEDS TO SET THESE.
// Postfix will need configuring to support virtual domains with a wildcard to deliver to the account given below.
define ("POP3HOST","your host here");
define ("POP3PORT","110");
define ("POP3USER","special pop3 user account here");
define ("POP3PASS","special pop3 user password here");
///

and edit them to match the POP3 settings you need to access your special POP3 email account: So for example:

// USER NEEDS TO SET THESE.
// Postfix will need configuring to support virtual domains with a wildcard to deliver to the account given below.
define ("POP3HOST","localhost");
define ("POP3PORT","110");
define ("POP3USER","wpmuposts");
define ("POP3PASS","notarealpassword");
///

Save the file and then upload it to the ROOT of your WPMU installation. DON’T FORGET TO REMOVE the .TXT extension!

That’s basically it, the extension is there. If you want to give it a different name, for security reasons, then feel free to.

To test it, send an email (and I’d suggest setting the wppbm-status to draft) to yourwpmulogon@posts.my-dummy.domain. Then once its arrived call:

http://my-wp.domain.here/posts_by_mail.php

You should see some diagnostic message on the screen and hopefully, fingers crossed, you’ll end up with a new post in your blog.

So all you then need to do is set up a cron job. At the moment you can’t use the PHP CLI to run this code but you can set up a cron job to to a wget on the URL. As this isn’t a silent process I don’t recommend putting a call to it into your themes, its much better to keep it controlled by cron (and that way you can route the output to a log file to keep an eye on it).

Debugging
If you think that there are problems and you want to keep checking the same email as you add debug code to the extension then you’ll want to stop it deleting emails / posting messages.

To stop it posting into your blog look for the following line (line 241):

$post_ID = wp_insert_post($post_data);

and put a # in front of it.

To stop it deleting messages on completion look for the following code (line 256 – 262):

if(!$pop3->delete($i)) {
echo ' <p>' . sprintf(__('Oops: %s'), esc_html($pop3->ERROR)) . ' </p>';
$pop3->reset();
exit;
} else {
echo ' <p>' . sprintf(__('Mission complete. Message <strong>%s</strong> deleted.'), $i) . ' </p >';
}

and comment it out.

So there you go. Please remember that is a work in progress and support for complex HTML isn’t there and you install it at your own risk. If you’ve got any suggestions on improvements, or you’ve found a bug then please let me know.