Thursday 3 December 2015

PHP 5.3, Drupal 6, SMTP Authentication, AWS and 'Could not connect to SMTP host.'

I haven't got to the bottom of exactly why this is happening, but if you're trying to get the following combination working


  • Drupal 6
  • SMTP Authentication 6.x.1.1 with PHPmailer
  • PHP 5.3

and you get the error 'Could not connect to SMTP host', you can fix it as follows:


 // Set other connection settings. // LINE 785
  $mail->Host   = variable_get('smtp_host', '') .';'. variable_get('smtp_hostbackup', '');
  $mail->Port   = variable_get('smtp_port', '25');
  $mail->Mailer = 'smtp'; // COMMENT OUT THIS LINE 

I suspect from the debug with the $mail->Mailer='smtp' flag it is sending smtp commands in clear, not starting tls.

Thursday 29 October 2015

Programming and journalism

I was struck recently by the parallels between journalism and programming. I've written a few articles for different publications over the years and learned a bit from the editors of journals about what they wanted the copy to look like. Certain things stuck out as being either similar, or lessons that developers could learn from journalists:

House Style

Every publication has it's house style. Tabloid newspapers use short, declarative sentences, limited vocabulary, and lots of emotive language. Academic journals all prefer their text to be in the third person. Orthography varies too, the house style always defines layout, fonts etc.

Similarly, a development team/organisation often has a requirement for the following:
  • bracing style
  • naming conventions
  • comments / inline documentation
In environments that lack a house style document, I've sometimes written one up by querying the preferred style with the existing team. It makes code easier to read and more consistent.

Editorial requirements

This is more something that should be, than something that is. Code review often tends to be neglected, mainly because project timescales are often tight. For reasons why that is the case, see Frederick Brooks' "The Mythical Man Month". If you follow Brooks' advice of having one person integrating code, they're effectively doing the job that a publication editor/subeditor does - checking that content is formatted correctly, readable, fits with house style and so on, to make a consistent product.

Specialisms and research

Everyone has their specialities. I specialise in Assistive/Care oriented Technology, identity management, web services and a few other less well defined things. I speak Java, Perl, PHP, Javascript, and to a lesser extent Ruby.

But like a journalist called upon to write outside their speciality with good research disciplines and care a developer can do a decent job outside their immediate speciality, or learn a new one rapidly. The economics correspondent can do a decent job of reporting political stories, and the server developer can make a decent job of web development if needed.


Any others?

I'm sure there must be other parallels. I'll update this post if I think of any.


Thursday 23 July 2015

What makes a maintenance programmer

I love maintenance programming. This makes me a freak among developers. If you look at the job adverts, they're all full of 'greenfield development', 'the chance to define direction' and similar phrases. Original development is interesting and fun, but there's a lot to be said for the Sherlock Holmes experience of bug fixing someone else's code. You have to put yourself in their position, learn from their coding style how they're likely to have approached a problem, keep track of complex code pathways to remember where you are. It's extremely tiring because the concentration demands are high, but it's a fascinating challenge.

It's always useful to be good at, and interested in something most other people hate. Anyone got any really ropey legacy applications they want maintaining?

Thursday 25 June 2015

Eclipse juno, getting rid of mylyn

This morning I've done about 60 minutes work. The other 120 minutes was spent watching the 'busy' pointer, waiting for eclipse to do.....something.

Experience tells me it's something mylyn related. Unfortunately Juno comes with mylyn, and it's not easy to remove.

Or is it?

Preferences->Java->editor->content assist->advanced.

Deselect anything marked 'task oriented', and replace it with the non task-oriented version.

Now go into your eclipse plugins folder and remove anything to do with mylyn.

Hurray! My IDE works again :-)

Sunday 8 February 2015

A simple solution to the plague of automated sales calls

The last few years, the problem of automated sales calls, both those that connect you to a salesperson, and lately the much worse ones that play an automated message, has got out of hand. There is a very simple solution - it does require legislation, and a little technical implementation, but it exists:

Step one:

legislate cold calling as an offence, particularly calls with a recorded message. 1000 GBP per offence strikes me as a nice sized penalty. Place the onus on the caller to prove that the recipient has opted in to their mailing list.

"But", I hear you protest, "we have legislation to prosecute cold callers already and it never gets enforced. The caller just withholds their number or provides a bogus one".

That's where step two comes in:
introduce an offence - routing a call where caller ID isn't presented. Large penalties on the telecoms companies for failing to provide accurate caller ID information on every call. Domestic subscribers don't see this, but multi-line commercial phone connections include the facility to set up the caller ID. The subscriber chooses what caller ID to present to public view. That's why you get calls from "12340 000000" etc.

There are a few possible objections:

"It's important to allow subscribers to withhold their number to protect their privacy" - ok, so if a domestic subscriber requests to withhold their number, present a separate number that won't connect to them, but is nevertheless registered with their phone company to their name.

"Sometimes we don't have the caller ID information" - the telecoms companies always have an origin of the call - otherwise, how would they know who to bill? It's a fairly trivial software problem to present it. If it's a call coming in from outside their network (like an international call), they can present a number for the telecoms company routing the call. We'd soon get to know who the spammers were, and start blocking them. If XYZ telecom is the origin of 90% of my spam phone calls, I'm going to block it whether any of my friends use it or not, then suggest to them that they move providers.

"It's too technically complex" - not true, see above.

"It's too expensive" - really not true, see above.



A year or two of that, and we'd soon see an end to

"You may be entitled to a refund on your PPI payments....."