Educating the world

Our blog has over 10,000 readers a month

Sendmail takes ages to start

November 12th, 2014

I had a development server that was taking ages to start. I checked the /var/log/messages file which didn't reveal anything so I checked the /var/log/maillog which showed the following lines:

Nov 11 16:16:11 myhost sendmail[1334]: My unqualified host name (myhost) unknown; sleeping for retry
Nov 11 16:17:11 myhost sendmail[1334]: unable to qualify my own domain name (myhost) -- using short name
Nov 11 16:17:11 myhost sendmail[1336]: starting daemon (8.14.4): SMTP+queueing@01:00:00
Nov 11 16:17:11 myhost sm-msp-queue[1344]: My unqualified host name (myhost) unknown; sleeping for retry
Nov 11 16:18:11 myhost sm-msp-queue[1344]: unable to qualify my own domain name (myhost) -- using short name
Nov 11 16:18:11 myhost sm-msp-queue[1363]: starting daemon (8.14.4): queueing@01:00:00

The salient line for the delay is:

My unqualified host name (myhost) unknown; sleeping for retry

myhost was in the /etc/hosts file and it resolved just fine. I typed domainname and got (none). It's a development machine so I didn't want to set up a domain for it.

The solution was to alter my /etc/hosts file to include the localdomain suffix thus: myhost myhost.localdomain

Now sendmail starts quickly as expected.

Sean Lock's view of Russell Brand

November 10th, 2014

8 Out of 10 Cats: Series 18 episode 6. Aired 10 November. I always wondered why so many people were agreeing with Russell Brands view of politics. Finally the wonderful Sean Lock says what I've been thinking for ages.

Sean Lock: If his [Russell Brand] book is called Revolution he shouldn't be out there trying to sell it, he should be try to encourage people to steal it. Shouldn't he? He has back peddled so much now, he started out saying "Don't vote, it's stupid pointless to vote, don't vote". But he's now come out, Russell Brand and said, "no, what I'm saying is actually is 'who am I supposed to vote for?'". So if you reduce that to what he is actually saying; it's what everyone says at every bus stop or newsagent "Huu, politician, what are they like hay?" "How did that lot get in, I don't know, bloody hell".

Melanie Chisholm: In his defence, we all bitch and moan about the government because they are shit, they have been for years and it's getting worse. How are we ever going to change it unless we come together and all stop moaning at bus stops.

Sean Lock: The main problem is now that people get the politicians that they deserve because they don't take any interest in politics. And him saying stuff to people who are disaffected already and aren't engaged with the political process "Don't vote" is the most moronic self serving pathetic bit of attention seeking wank that he has ever spewed out of his mouth in history.

Debugging PHP in Eclipse

October 21st, 2014

Debugging PHP in Eclipse requires 2 parts. Firstly change the php.ini to include the xdebug sections. All the relevant information can be found in the article Setting up XDebug under XAMPP. Second create an Eclipse run configuration to connect to the remote server which is what this article is for!

You don't have to do this next step but it makes administering your project code easier because you're not forcing all your code to live under the Apache document root. I have different workspaces for different clients so I add an Apache alias to join all the projects together under the same document root. Basically all my code lives in my client folders (along with their accounts etc) and the document root just has virtual directory pointers to those locations.

  1. From the XAMPP Control Panel, click Apache Config httpd.conf
  2. Add the following lines after the last <Directory> section. This tells Apache about the folder you would like to include.

    <directory "D:/BigSoftLimited/Clients/Oscorp/workspace/goblin/src/web/">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted

  3. In the alias_module section add the following line to slot the afore mention directory under the document root:

    Alias /goblin "D:/BigSoftLimited/Clients/Oscorp/workspace/goblin/src/web"

  4. The restart Apache.

I'm using Yii for this PHP project but the options should be the same.

  1. Ensure you have PDT (Eclipse for PHP developers) installed.
  2. From the menu select: Run->Debug Configurations...
  3. Highlight the PHP Web Page icon on the left and click the New launch configuration button above.
  4. Give it a sensible name: Yii Goblin.
  5. In the Server tab change the Server Debugger to XDebug.
  6. In the File section Browse and navigate down to the index.php file that starts the application. In my case /goblin/src/web/index.php where web corresponds to the /goblin/ on my web server.
  7. Uncheck Break at First Line.
  8. If like me you are developing all your projects under the same document root then you will have to uncheck URL -> Auto Generate and enter the entry path to the applications. My Yii project is located at /goblin/index.php. You could set it up as /goblin/index.php?r=controller/action but you will find that you are constantly changing the configuration to test new controllers.
  9. You can leave the rest of the options as is and click Apply followed by Close.

To run

Yii commands I keep forgetting

October 15th, 2014

Been using Yii for a while now and there are several functions that I need to use from time to time that don't seem to want to stay in my brain. Most of them seem kind of obvious now that they are in front of me which is why this is so annoying!
It's usually quite difficult to Google them because they are related to doing ordinary Yii type things and so I can't make the search specific enough to narrow it down.

Here is a pretty good guide to creating URLs in Yii2 which contains the things I want (amongst others) but these are the few I use when I need them.

Creating a URL without the wrapping anchor tag

This is handy when you need to generate a URL in order to place inside some Javascript.



echo Yii::app()->createUrl("recording/scheduler_data");




Creating Javascript names using compatible with Yii models


echo Chtml::activeId($model'model_field_name');

Produces: RepeatRecordForm_repeat_from


echo Chtml::activeName($model'model_field_name');

Produces: RepeatRecordForm[repeat_from]

More to come but I haven't got time to dig them out at the moment.

Historical Pubs in London UK

September 24th, 2014

I have taken all the historical pubs listed in The CAMRA Regional Inventory for London - Pub Interiors of Special Historic Interest and plotted them on Google Maps.

If you are planning a pub crawl around London and would like a selection of pubs with really nice olde worlde interiors then this is the map for you.

If you think I've missed any pubs them leave a comment and I'll update the map.