Archive for the ‘Wordpress’ Category

PHP-on-Tomcat (Part II)

Sunday, December 13th, 2009

The original goal of being able to run PHP on top of Tomcat was to allow simple development of PHP based applications like WordPress and/or bbPress. To get these working I needed a database.

The wildly popular mySQL database has a nice installer for OS X. Mine installed to /usr/local. I did the install ages ago and forgot what the “root” database user password was. Ooops! No matter, there are some great resources online talking about how to go about resetting permissions. I opted for the incredibly easy, but utterly insecure method (from inside the terminal) :

  1. Stop the existing server
  2. Restart telling it to turn off permissions: mysqld_safe --skip-grant-tables --user=_mysql &
  3. Jump into the mysql shell application: mysql -u root mysql
  4. Change the “root” password: UPDATE mysql.user SET Password=PASSWORD('#########') where user='root';
  5. Persist privilages: FLUSH PRIVILEGES;

Next on the list was exposing my mySQL database to the Tomcat hosted PHP code. Step 1 was making sure I have mySQL JDBC drivers installed, Step 2 was creating a JNDI datasource in the context, and step 3 was getting the PHP to use it.

The officially supported mySQL Connector/J was a quick download. The JAR file for it was dropped into the $CATALINA_HOME/lib directly. Good to go. The context file was more of a challenge, under the $CATALINA_HOME/conf/Catalina/localhost I created an XML config file that matched the name of my webappphp.xml – where I declared the JNDI datasource. It took some tweaking and reading around but finally ended up coming together:

<Context reloadable="true">

The documentation for Quercus states

Scripts can use the jndi name directly:


  // standard PHP
  //mysql_connect($host, $username, $password, $dbname);

  // using JNDI lookup


But that doesnt help me to run WordPress as I’m not about to go modifying their code. Never fear, there’s another option. The documentation for Quercus also says that you can put an entry into the WEB-INF/web.xml file that forces all database connections to go through the same underlying JNDI datasource:

      Tells Quercus to use the following JDBC database and to ignore the
      arguments of mysql_connect().

So, a quick update to point at my own datasource and wall was ready to go. I downloaded and unzipped wordpress into the PHP webapp directory, pointed a browser at http://localhost:8080/php/wordpress and found myself stepping through the famous 5 minute install. Less than 5 minutes later I was looking at the main page of a fully-functioning WordPress install.


Wednesday, July 29th, 2009

Once again “that time” is upon me – the time when I look at my site and say “No more!” and tear down the theme thats been here in favour of a redesign. In the interim I’ll be trying a few different themes by other people as I look at features of them, so dont be surprised if things up and change around here at the drop of a hat.

Out with the old (version 9.0) and in with the new, the King is dead, long live the King!

Talk like a pirate day … Arrg!

Friday, September 19th, 2008

What can I say? And swab the deck! It’s awesome when ye have th' right WordPress plugin enabled.

Theme thoughts for version 9

Tuesday, August 12th, 2008

As I scroll back through the various incarnations of my theme (and look at what I liked about interim themes such as “Vista”) I have to conclude that there are design decisions that remain constant:

  • Rounded corners
  • Purple shaded “brushed metal” texture and white content area
  • Right-hand sidebar
  • Fixed-width and floating
  • Dark grey background
  • Content-area fully enclosed, containing posts and sidebar

Version 8 added a few more details:

  • Stronger emphasis on pages with “page navigation” at the head of the sidebar
  • Stronger emphasis on pages with tabs at top of the template
  • “Search” properly integrated into the template
  • Categories finally in a decent place
  • More emphasis on syndication – allowing for a “podcast” audio blog link in the future

Version 8 was far from perfect though. “Vista” is far more concise – combining navigation, syndication and search into a single menu bar – where version 8 of my own theme separated the tabs into their own space. I like the real-estate gains by combining things.

I am running 4 plugins:

  • Akismet
    The standard anti-spam plugin. Never be seen without it!
  • Celtx CSS
    I participated in Script Frenzy a while ago. The goal was to write an entire movie screenplay in a month. The formatting of a screenplay is really specific and the free Celtx tool handled everything. I created the Celtx CSS to maintain the formatting of the screenplay when it’s posted to a WordPress blog.
  • Dimly Archive Table
    Three columns, broken down by year and month. It’s a layout I’ve not seen anywhere else, and one I have used for years now. This plugin exposes a standard WordPress widget that plays nice with modern WordPress sidebars.
  • WP-dTree
    I’ve played with about a dozen different page navigation widgets and WP-dTree is by far the best of them. The continued emphasis on pages on my site means that this will need to be a standard feature in themes to come.

The downfall of the current (interim) “Vista” theme is the dual right-hand sidebars. They don’t leave enough space for the blog content. I got rid of dual sidebars in version 3 of the site! Going to a single sidebar will give WP-dTree more space to expand the tree nodes too.

Version 8 didn’t give enough definition of where posts start and stop and while Vista is better, it suffers the same problem. Version 6 (on the other hand) was a little heavy-handed in that regard. What has remained constant is the title and timestamp of posts remains at the top of the post, with version 8’s emphasis on the title being a good design decision. The purple “smudge” doesn’t give enough definition to the top of a post.

I like the idea of conditional sidebars too. There’s no reason to have Archives and categories when you’re reading the various pieces of writing. A single “home” link on the navigation bar is enough to break back to the timed blog entries again.

I am…

Wednesday, August 6th, 2008

I feel somehow dirty. See, I really dislike Alanis Morissette and will leave the room if her music is playing. It was “hate at first sight” – she appeared on the Jools Holland show back in 1995 performing “You oughta know” – I remarked at the time that she sounded like an angst-ridden little harpy. I’ve not really changed my mind since. You can imagine the reaction, then, when I was writing the “about” tagline for the blog and I thought “Im a geek and believer …” and some song lyrics came to mind:

I’m a bitch I’m a lover
I’m a child I’m a mother
I’m a sinner I’m a saint
I do not feel ashamed
I’m your hell I’m your dream
I’m nothin’ in between
You know, you wouldn’t want it any other way

The song appeared, fully formed with full backing, and her voice attached. The words rearranged themselves

I’m a geek and believer
I’m a ‘limey’ I’m a husband
I’m a sinner, I’m a saint
I do not feel ashamed
I’m a writer and I’ll dream
I’m nothin’ in between
You know, you wouldn’t want it any other way

I filked an Alanis song? Ewww.

Blog Reboot

Tuesday, July 22nd, 2008

I am fed up to the back teeth of the way my theme here wont “stick”.  Something isn’t right.  In fact I will go so far as to say that something here is seriously messed up.  I just have no clue what.  If you were browsing my site around 1:30pm today you will have probably seen the effects of my drastic maintenance.  I killed it.  The entire thing.  Stone dead, drop the database tables, never even existed … dead.  Got the latest WordPress and installed it, and then re-imported the posts, comments and what-have-you.  Let’s see if that cures things!


Thursday, June 19th, 2008

All of my fiction writing projects now have a “book cover” or “movie poster” and the fiction page on the site has had a make-over. In the process I reijigged some of the URLs. Apologies if that means some bookmarks are now broken.

I used the fabulous Celtx screenwriting software to participate in “Script Frenzy” last year. I also used it to write an original screenplay for a writing group that I’m part of. It takes a little work but it is actually possible to post the output from the application directly on a website like this. I’ll post step-by-step instructions later but suffice it to say, it means editing your site’s CSS to add screenplay related details, installing a WordPress plugin and then some copy + paste effort for each screenplay you want to self-publish. Easy really.


Tuesday, June 17th, 2008
Deep Blue Sea II - Harsh Mistress
Nanowrimo 2008
Looks like version 8 of the Mirror Dimly theme is dead in the water. Back to the drawing-board and see what I can come up with. *sigh*

On other fronts, looks like I have a working idea for this year’s National Novel Writing Month challenge, and it’s back to fan fiction. I’ve had an idea floating around in my head for a while: to write a sequel to the 1999 action/horror movie “Deep Blue Sea”. Tentatively, this year’s Nano is titled “Deeper blue sea”. It’s a working title, trust me!

Acts of theme-age

Sunday, June 8th, 2008

For some strange reason the theme on In a mirror, dimly keeps reverting back to the “Default” one. One fix I saw was to put a copy of the correct (“mirror-dimly”) theme into the “Default” directory, but that’s missing the point. The question that should be asked is “why is my theme reverting in the first place?”

Seems that if WordPress runs into errors in the theme, it will revert. Helpful but not so helpful as to pinpoint where the problem is. It’s like one of the testers in work who pokes the software and sends us bug reports saying “it’s broken”.

Yeah. About that.

[edit – June 10th]

Having worked through the plugins, and scanned the Apache error logs, I still find the theme misbehaving. Grrr. The only up-side to this is that the nifty plugins I had in my sidebar probably can return as I go looking for a large spade and begin digging deeply into the theme code. *sigh*

Utter Neglect

Tuesday, June 3rd, 2008

I started another blog, and podcast last November and you can certainly tell! It’s now JUNE and I am finally getting around to finishing the blog redesign. Its wholly updated compared to the previous version but carries through several key design elements:

  • Rounded corners
  • Purple shaded “brushed metal” texture
  • Right-hand sidebar
  • Fixed-width and floating
  • Dark grey background
  • Content-area fully enclosed, containing posts and sidebar

The new theme adds some elements too:

  • Stronger emphasis on pages with “page navigation” at the head of the sidebar
  • Stronger emphasis on pages with tabs at top of the template
  • “Search” properly integrated into the template
  • Categories finally in a decent place
  • More emphasis on syndication – allowing for a “podcast” audio blog link

In the process of creating the theme, I also created several widgets to give me features I was looking for:

  • Detailed “recent posts” box in sidebar.
  • Modified and “widget-ized” the collapsing-page-menu plugin.
  • Compact year/month archive listing.

All of which will be released in due course. Note: I’ve attempted to contact the original “collapsing page menu” author but there’s been no response. If nothing comes of the request I might see about aquiring ownership of the plugin as it’s jolly useful!