Archive

Archive for the ‘geek’ Category

How to use a testing server with wordpress

March 1st, 2009

I like to mirror and build my wordpress site on a testing server and get it all ‘just right’ then push the changes to production when I’m somewhat ready to release. This a standard practice in the IT industry and gives us the advantages of

  • the site is never in a half-baked or broken state
  • development is super responsive since the server is on our local network
  • the site statistics don’t get polluted by the traffic of development
  • we can try new things without worrying that we’ve broken the website
  • we have a backup which is active and recent

But, because wordpress is not built with any anticipation of this concept, some problems arise

  • How to pull fresh comments and posts from production to testing?
  • How to push new and updated posts from testing to production?
  • How to handle images and media attached to posts?
  • How to handle site configuration options?
  • How to handle Theme changes?

Today we’ll tackle the easiest of these problems…

How to pull wordpress comments and posts from production to testing?

Svn global-ignore

February 27th, 2009

I want subversion to always ignore compiled files. There is lots on the internet about using property svn:ignore but nothing about setting a global-ignore.

Where the heck is this danged config file?

On FreeBSD I found it at “~/.subversion/config”.

Yes, in my home directory… so “global” means just global for one user which seems kinda pointless. I guess that’s why no-one uses it. I gave it a bit of this action which works.


[miscellany]
global-ignores = *.pyc

How to add a new user to SVN on Apache

February 19th, 2009

Problem:

I’ve started working on an existing project and needed to add myself as a user to the repository. It proved kinda tricky. First I couldn’t get Tortoise to authenticate, then I couldn’t add myself as a user, and then I couldn’t work out how to put a password on my svn user.

(“Here’s how I fixed all that…”)

johnmee.com gets a facelift

February 17th, 2009

Well here it is, the new look johnmee.com

I’m not happy with it yet but if I kept on working on it till I was happy, then it would never be released. It’s one of those idealist versus pragmatist tensions that every software project must endure.

Things I am happy about are:

  • isolated development environment – I’ve worked out how to run wordpress on a development server and tweak away to my hearts content without having to do any of it live and in production. This makes my idealist very happy and is worth a post of its own very soon.
  • slicker look? – well the jury is out on this but i’ve switched to this inove theme which is darker and looks a lot more web2.0 – whatever that is. It has some very nice CSS which the idealist in me likes. More on this later.
  • no ‘pages’, all ‘posts’ – getting to know wordpress I’ve been torn to know whether I should create “pages” on subjects which will stand (or move with) the test of time; or “posts” which record the moment in time. I’ve made the executive decision that pretty much everything I write will be a moment in time. Thus I have ditched the few “pages”, and moved everything into posts. It’s my blog so if I want to go back and edit recent posts so that they make more sense, then I blooming well can :-)
  • tags and categories consolidation – I’ve gone through every post and tried to consolidate the tags and categories into some sort of uniformity
  • Travel letters imported – all my travel letters from years ago were sitting separate from the blog and in their original web format. I’ve let go of the past and moved them all into the blog post format for easier and more uniform access.
  • custom category page – I’m learning heaps about wordpress. So much that I’ve probably got enough material on wordpress tips I’ll hopefully be bringing you a series on that. Important to me was to present the Travel posts in a custom way, which meant creating a special category template. You can click on the travel page and see what i’m talking about – it’s not the usual archive of posts.

There’s still lots and lots of stuff to do. Such as:

  • images – no one was finding the photo gallery before. I need to move all my photos into the blog and attach them to the travel posts
  • front page is too busy – as Mick noted, the new look is far too “busy” compared to the old one. He liked the simplicity and I’m inclined to appreciate the criticism. So very high on the agenda is to tone down the home page. Perhaps just show the last two posts in full.
  • context sensitive sidebars – since I’ve worked out how to ‘program’ wordpress I know I can do something with the sidebars. I want the sidebars to be different between the archive pages, the single pages, and perhaps different again by category. I’m wondering if images down the sidebar would work in the travel pages.
  • work on jamabelle – i know there are a lot more letters from james which are even more deep and valuable as they chart his global soul seaching following the break-up of james and isabelle. I must find the one where he hangs around with an Indian swami for a time. I think i should move these into the blog so they present better, but am not comfortable with it since they’re not my works
  • trim the database – the wordpress database likes to keep an archive of all the previous edits and dead categories and links and other trash. Only a geek would care as it has zero impact on the presentation, but I want to clear some of this cruft. Just makes me feel like I’ve mopped and vacuumed or something.

These are the new and old themes side by side…

Do you prefer the old or new? Why?

500 Error from IIS 5.1 on Windows XP

January 28th, 2009

Problem

Getting a 500 error from IIS 5.1 on Windows XP whilst trying to run from various document roots.

The server was unable to logon the Windows NT account ‘STSSERVERAdministrator’ due to the following error: Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy restriction has been enforced. The data is the error code.
For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp.

Read more…

A “testing” email server which doesn’t send out any emails

December 27th, 2008

Problem

I need an email server for testing. It accepts email just like a real one, but does not actually send any email out to the real world. I need to be able to see the emails that it is not sending.
Read more…

Zend Framework Quickstart Tutorial: Deploy to a subdirectory instead of web root

November 18th, 2008

When you’re just evaluating something new you do not want to rearrange your whole world just to try something out.

I wanted to try out the Zend Framework and the “QuickStart” tutorial looked very official and the ideal place to start.

However they assume installation is in the webroot. Sorry, but I have other, more important, stuff running on this server and I’m not shoving it aside just for a quick tutorial.

Try as I might, I had great difficulty getting this tutorial to run in a subdirectory. As I’m learning the thing I’ve no idea how to tweak it yet!

Anyway my web root is “/var/www” and I want to put the quickstart tutorial at “/var/www/QuickStart”, which in turn means the public directory is at “/var/www/QuickStart/public”. To make the whole thing work required three changes:

1. Redirect everything to the index in the subdirectory

When I use the cited .htaccess from the tutorial page titled “Create a Rewrite Rule” and call the index it works! Great, except that’s not the test for ‘working’.

Zend needs to feed all requests through the index page so it can farm them out to controllers. The controllers are identified by the ‘filename’ of the request: so the redirection is supposed to catch all the 404′s and feed them into the index. It’s not working until you can call non-existent URL’s without the webserver giving you a 404. eg: “http://servername/QuickStart/public/asdf” should show the “Hello, Zend Framework!” message.

Stay on this step until you get the “Hello” message for made up url under your public directory. E.g. “http://servername/QuickStart/public/asdf”.

My /QuickStart/public/.htaccess became (NB: this is Case Sensitive)


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /QuickStart/public/index.php [NC,L]

This might be done more cleanly with a “RewriteBase” but this worked so I moved on.

2. Set the “BaseURL” of the front controller

Now there is something not right in the Tutorial because the next checkpoint screenshots a message which doesn’t appear in the code so far displayed. That in itself is very frustrating and entire problem of its own so lets not get distracted. I tried to run through the tutorial again from scratch so I could make this post straight from a fresh run through. But not to be.

If you manage to overcome and reach the next checkpoint you’ll need this:

Add a line to “Step 3″ of the the /application/bootstrap.php to set the base url:


// Step 3: CONTROLLER DIRECTORY SETUP - Point the front controller to your action
// controller directory.
$frontController->setControllerDirectory(APPLICATION_PATH . '/controllers');
$frontController->setBaseUrl('/QuickStart/public');

This tells the front controller to prepend Url’s with the subdirectory, and this got me most of the way through the QuickStart tutorial with one exception.

3. Fix the “Action” in guestbook form

When you post to the guestbook you’ll get an error looking for a file “/guestbook/sign” which doesn’t exist. The form is created with that action and you need to fix it in the GuestbookController.php:

Change the setAction in function _getGuestbookForm() to


$form->setAction($this->_request->getBaseUrl() . $this->_helper->url('sign'));

And with that it should generate a form action “/QuickStart/public/guestbook/sign”.

I’m told this last issue has been lodged has a defect and not necessary from releases “1.7″ and beyond. The helper->url will henceforth prepend the baseUrl to its result.

Zend Framework QuickStart Tutorial: What are the filenames?

November 13th, 2008

I’ve just worked my way through the Tutorial for the PHP Zend Framework. I overlooked downloading the code at the start and launched straight into it creating each piece myself from the tutorial.

After the first couple of pages they (currently) neglect to mention where each piece of code is supposed to go. Maybe I learnt a lot more, but it did not make for a very ‘quick’ start trying to work out where things go from the error messages.

Here’s the final structure of the QuickStart Tutorial…


application/
|-- app.ini
|-- bootstrap.php
|-- controllers
|   |-- ErrorController.php
|   |-- GuestbookController.php
|   `-- IndexController.php
|-- forms
|   `-- GuestBook.php
|-- layouts
|   `-- scripts
|       `-- layout.phtml
|-- models
|   |-- DbTable
|   |   `-- GuestBook.php
|   `-- GuestBook.php
`-- views
    `-- scripts
        |-- error
        |   `-- error.phtml
        |-- guestbook
        |   |-- index.phtml
        |   `-- sign.phtml
        `-- index
            `-- index.phtml

A 30-second Geek chair review: Aeron, Mirra, or Leap?

October 30th, 2008

A chair is an underrated essential item for a programmer; consider how much time is spent in it. Things came to a head when I moved recently. Whilst lugging around all those boxes and furniture my back insisted on telling me it is in poor health. Most probably I arrived at this situation by sitting a large, very impressive, leather executive chair which my cousin lent me whilst he is overseas. It really looks and feels great to other people who saw me in it; but was terrible for me to actually sit in over time – being quite a short fella perhaps didn’t help. I was adopting such a curved slouch that I was even putting a cushion in behind me to fill some of the gap.

Anyway I decided it was time to get a proper “task” chair to alleviate the situation.

Now everybody (in the internet world) is well aware of the famous Herman-Miller “Aeron”. Needs no introduction really. The price tag does need some recovery time… say AU$1300 as a guide. But in researching reviews from the USA I saw quite a few favourable mentions of the Steelcase “Leap”. They’re an unknown in Australia.

Steelcase Leap

The Steelcase Leap task chair
It seems Steelcase aren’t using the usual retail channel to flog individual chairs. None of the retail stores stock them. I’m not spending a thousand dollars on a chair without sitting in it, but rather fortunately they have a showroom/office in Sydney so I went to check them out. “How many would you like?”, “Well just one.”, “oh”. The sales rep took me to her own desk and invited me to sit in her own chair – which was a little unexpected.

It felt really good. She ran through the controls and I was rather impressed with the variety and particularly the ease adjustments could be made. I wasn’t sitting particularly long, maybe 20 minutes, but my back was saying ‘yes’ and was already envisaging my spine lining up again and long abused muscles getting their wake up call. They don’t stock these things and suggested an order and 12 week wait. I can’t wait that long!

The Aeron and Mirra

The Herman-Miller Aeron task chair
I found an Herman-Miller retailer around the corner, so ran to check out the Aeron and Mirra. Yeah, nice chair, but didn’t immediately impress me as being all that worthy of the price tag. Generally the age of the design was quite evident. To raise/lower the arms I had to get off the chair, walk around the back and wrestle them in to place. To adjust the tension of spring in the backrest required a lot of turning the knob with very little feedback – am I turning it the right way? Is anything happening? To stop the backrest I don’t recall being difficult, but to release the backrest once on the backstop required taking all your weight off the back of the chair – enough to release the pin – before being able to lean back further. This last inconvenience paled the Aeron in comparison to the Leap.

The Mirra came across as a crippled version of the Aeron.

Leap wins

There was no real comparison in my mind. They both might be comfortable chairs but the Leap was equal or more comfortable, vastly easier to use, and 30% cheaper.

The armrests float a surprising distance: 2 inches forward/back and an inch in/out without having to touch any knobs – something the Aeron was entirely void of. The up/down action (2-3 inches) is a simple push button on the armrest. You might rationalize that once you’ve set these things up the ease which they move is no longer relevant. But you’d be wrong. I’m finding myself moving the armrests around all day as various positions become tired and I resettle into a new one. The ease of movement is fantastic.

The backrest is excellent. For one, the tension can be adjusted in quarter turn measures, as opposed to 10 turn measures for the Aeron. But truthfully I don’t change the tension routinely; once I’ve set the tension such that once I settle on an angle it will stay there without having to apply force to keep it there I leave it alone. The major difference here is that if I push further it will go and stay there as I stop pushing. Hard to convey in words but basically it is easy to get both the right amount of back support and a comfortable back angle without touching any knobs. My concern with the Aeron was the requirement to lean forward and release every time I wanted to change the angle of the backrest. The Leap also has four backstop positions which I’m surprised to be using increasingly; when I’m “thinking”, reading, browsing, talking then I let it lean right back. But when concentrating I get upright and set it to the first or second position – right hand click-click-done.

Acquisition

Getting my Leap chair was not all that conventional. As I mentioned Steelcase appear to be neglecting retail sales, no doubt chasing the big deals. I chatted to the sales rep (gosh that was easy, an unsurpassed beauty) at their showroom/office and expressed the urgency of my need and my disinterest in specific options (eg color and quality of the fabric etc). Surely there was one just lying around ready for sale. She said she’d see if she could find a spare one. A few days later I was directed to go to an area near the airport (Mascot) and collect my chair.

It was quite difficult to find the dirt road as it lay through the gates of an unrelated warehouse. I arrived in a brown dusty dirt paddock town made up of shipping containers. The office was, of course, a shipping container. Out in the dust, standing in front of a big red two story shipping container was a large cardboard box in which I found my chair (fully assembled inside the box). I chatted to the lady in the ‘office’ and discovered that the gorgeous sales rep had indeed had to dig around to find me a chair. Seems this particular chair was originally shipped in for a very large Westpac order. I guess they didn’t want it yet/anymore. Lucky me.

Four weeks later and I’m still very pleased with both the decision to spend some real money on a chair, and to get the Leap.

Getting started with Drupal

October 17th, 2008

Is Drupal