Archive | PHP

PHP: Hypertext Preprocessor? Hardly. A server-side languages for producing web pages, simply. Build it up into complex object-oriented frameworks. The workhorse for dozens of content management systems, blogging systems and web sites. Can build rich client apps, too.

Keeping up: theme changes

Astute readers (and I know who you two are!) will notice a change to a newer theme. I’ve switched over to the WordPress Twenty-Eleven base theme, with a few of my own tucks, nips and tweaks. I wanted to check out the new theme and test out the new functionality and keep up with the latest stuff.

Child themes are a piece of cake to create, and a child theme lets me override the original without messing with the original source, so updates will not erase the changes. While they are not so difficult to do manually if you are familiar with the command-line, they are even easier with the plugin One-Click Child Theme.

With the child theme in place, I was able to shorten the gap between the site description (the motto) and the header picture, just by adding CSS to the style.css in the child theme (that’s the cascading part of CSS). I added a paper-curl edge effect based on the work of Craig Buckler, published on Sitepoint.

I was disappointed that my site was not valid HTML5, according to the W3C’s validator site. Category tags used in REL links aren’t standard, so I deleted those. The Creative Commons plugins want to use Dublin Core XML namespaces, and there are issues there I’ve got to clean up. And the “generator” REL tag on the bottom of the page isn’t too standard, either. Overall, though, the pages are relatively clean of excessive markup or poorly-formed structures. Stay tuned as I tweak the last few elements into line.

Seacoast WordPress Developers Group, April Notes

On April 6th, the Seacoast WordPress Developer’s Group met at the New Hampshire Innovation Commercialization Center to talk WordPress. Networking and casual conversation started around 6:30, with the meeting formally starting at 7 PM with a round of introductions:

Dave – former Cold Fusion, ETL, new to WordPress,
Carl Eric Johnson – web developer, WordPress instructor and eveloper, fan of Thesis framework.
Amanda – BIL doing Joomla, Drupal, and WordPress
Sharon, Rye Public Library, Technology Coordinator, just launched a freshened site on April 1st using WordPress and Atahualpa theme/framework.
Will, a graphic designer in a print shop who’d been encouraged to learn web design and now WordPress.

Book recommendations:
Amanda praised the Wrox Professional WordPress book.
Carl Eric has enjoyed WordPress: Visual QuickStart Guide [Updated link — ed.] to get up and running, and WordPress Bible(Aaron Barzell) from Wiley as a reference.

Main Presentation: Carl Eric Johnson: talk about themes and frameworks
Sitepoint.com Wicked WordPress Themes book has free sample download chapter. Table of contents points out the choices of custom themes, child themes, building a framework.
Child themes: load with parent’s theme files, in your child file, you import the parent, then override what’s different.
In WordPress 3.0, theme TwentyTen has a lot of options built in. Thesis and Atahualpa have a number of pages of options: sizing, features, colors, styles, etc.

Amanda talked about file structures and “the loop” – directories of wp-admin and wp-install are pretty much off-limits, containing the installed WordPress files and overwritten up updates; wp-content contains most everything else, including the stuff you customize. Add your own functions.php and copy the functions you want to override. A theme consists of index.php and style.css as a minimum; you can add as much as you want from there. See the Codex for the hierarchy of theme files WordPress looks for in order to render your content. Consider starting with a “blank” theme if you’re building your own, such as Starkers or Boilerplate themes – essentially stripped-down skeletal themes with all of the style removed.

See http://codex.wordpress.org/Template_Hierarchy for a description of how WordPress selects the correct template(s).

See http://codex.wordpress.org/The_Loop_in_Action for an overview of the loop.

TwentyTen Header Rotator Follow-up

Ah, the power of the web. I posted the problem I was having both here and on the WordPress.org web site, and within a week, another developer pointed out the simple one word addition to the plugin code to make it work in WordPress 3.1. Problem solved!

Now that I’ve spent some time poking at the code, and inspired by the “How to Build a Plugin” presentation at last Seacoast WordPress Developer’s meeting, I’m thinking of a fancier plugin that will let you load up as many images as you want and shuffle them. Inspiration is one thing, perspiration is another; I’ve got enough on my plate right now that this is a pretty low-priority issue. And there’s the challenge of feature creep: it would be nice if I could link each header to page that described the significance of the picture, had its licenses, etc. And that you could load up multiple pictures and enable/disable them individually for seasonal themes or special events. And… oh, dear.

Seacoast WordPress Developers meeting, 2-March-2011

Five people attended the March meeting of the Seacoast WordPress Developer‘s meetup, held at the New Hampshire innovation Commercialization Center near Pease in Portsmouth. We did a round of introductions and welcomed two new members and discussed what the group could focus on. We discussed the boundaries of CMS and Blogging and Wikis and how they overlap (A professional in education provided us with some great insights on how we think about some of these items), the challenge in finding consultants and clients, and how we can build up a network. We talked about potential agenda items: what should we schedule, what should we have in free-form.
I think an FAQ we ought to be prepared to answer is “What is it that WordPress is?” It’s less than obvious. “A blog” is the wrong answer, as that is a form of document, and not an application. “A CMS” is such a vaguely defined answer that it’s not much more useful than “an application.”

Other questions we started to explore, and possible future topics:

  • What is it that others are looking for on the web?
  • Good resources for learning WordPress: Codex, FAQ, books, etc.
  • WordPress SEO
  • WordPress Security
  • Loop/structure of databases tables, templates
  • Popular plugins
  • WordPress Backup tips: data and files
  • WordPress Community

Finally, Amanda presented her talk on building a plugin. She’d done some excellent research and used clear examples and explained them well. Here are the notes and slides posted to the new Seacoast WordPress Developer’s website, running WordPress, of course, and BuddyPress.

So, it was a great second meeting of the Seacoast WordPress Developer’s group. Stay tuned for more news. Thanks to Amanda for organizing the event, and to the New Hampshire Innovation Commercialization Center for providing the great facilities!

Seacoast WordPress Developers Group announce March meeting

Organizer Amanda Giles announced a second meeting of the Seacoast WordPress Developers Group:

When: Wednesday, March 2, 2011 7:00 PM
Where: NH-Innovation Commercialization Center, 75 Rochester Avenue, Portsmouth, NH 03801
Why: Let’s get together for another meetup. More details coming soon. Please send me your suggestions or ideas for things you would like to share or see shared.

CMS Learning Curves, artist unknown

CMS Learning Curves

Notes from CentraLUG, 6-Dec-2010: David Berube, MySQL Operations

Six people attended the December 2010 meeting of the Central New Hampshire Linux Group, held at the NHTI‘s Library from 7 to 9 PM. David Berube was the featured speaker, talking about his experience with large scale high-performance MySQL applications.

David is an independent software developer and consultant. One of his larger projects over the past couple of years has been an application for scheduling actors for auditions. This involves agents and projects, auditions, roles, videos and a number of other entities in a complex and fast-moving application. He’s used Ruby on Rails, PHP, MySQL, a NOSQL database, Amazon S3, A rack of Mac Minis, BSD, Linux, and a number of other elements. He had some insightful things to say about the development process, managing a client project, handling difficult requirements, scaling up million-row databases for subsecond response times and more. It was a meeting well worth attending.

There were a lot of useful tools and reference sites mentioned, and I was only able to take note of a few: Useful Ruby add-ons: New Relic, Query Reviewer, Percona Operations Day, Cacti for data aggregation. An In-depth discussion of NoSQL (“Not Only SQL”) Databases: what are they, what are they good for, what are the liabilities? A good discussion of the trade-offs of using NoSQL, reference to the NHRuby presentation on Redis a few months ago, and more.

Thanks to David for an informative presentation, to the attendees for a dynamic interactive session, and to the NHTI Library for the facilities. Future meetings at the Concord location have been suspended, we encourage our regulars to attend the Manchester ManchLUG meetings. If you haven’t already, consider subscribing to the announcement list so you’ll know when there’s an upcoming meeting. (Subscribers to the discussion list will automatically receive the announcements, too.)

HowTo notes: installing REE, Passenger, Ruby on Rails on CentOS5

Recently, I installed Redmine, the Rails-based project tracker,  on an existing virtual private server, running CentOS 5 Linux and an assortment of LAMP applications and web sites using Apache, PHP and MySQL. I chose Ruby Enterprise Edition (REE), an optimized and high-performance version of Ruby, and Passenger, an Apache module to connect to Ruby. Here are the steps I followed, as a reference and in hopes it might help others:

  1. Log onto the box via ssh. As a good practice, I run as an unprivileged user, and use sudo only when superuser rights are needed. So, download the files and un-tar them and read the READMEs and run the processes as a regular user, switching to root via sudo only when the rights are needed.
  2. Download and install Ruby Enterprise Edition. Today, that’s:
    wget http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01.tar.gz

    but follow the instructions you’ll find at http://www.rubyenterpriseedition.com/download.html for the latest. Those instructions will have you un-tar the file and then run the installer.

  3. Install the tools needed to build Ruby Enterprise Edition. If you run the installer, it will prompt you for missing tools. In my case, I needed to:
    sudo yum install gcc-c++ make patch zlib-devel openssl-devel readline-devel
  4. If you’ll be using mysql, you’ll need the native code to build the matching gem. REE attempts to build gems for MySQL, SQLite and PostgreSQL, so choose your flavor and issue the appropriate command like:
    sudo yum install mysql-devel
    

    or postgresql-devel or sqlite-devel as appropriate.

  5. Follow the instructions supplied by the REE installer. They did a nice job on that. To install Passenger when I was done, some additional source code files were required:
    sudo yum install httpd-devel apr-devel
    sudo /opt/ruby-enterprise-1.8.7-2010.01/bin/passenger-install-apache2-module
  6. Once again, follow the prompts to add the proper load module and path commands to your web server configuration, add a configuration file for your site, and you’re ready to start installing your site’s code.

NOTE: It wasn’t the case with my particular host, but you may need to adjust your SELinux settings, if you’ve got SELinux enabled. See the post at http://www.catapult-creative.com/2009/02/04/installing-rails-on-centos-5/ and look for “SELinux” for some ideas.

Visibone, a source of great reference guides and online utilities

Visibone's Everything Book
One of my favorite tools for the past couple of years has been a web developer’s reference guide from Visibone. The book has rarely left my desk, within arm’s reach, to help out when I just can’t remember all the options for an HTML tag or a CSS style. While there are some great online references, having it all in a couple sheets of paper makes it easy to find what I’m looking for (especially if I couldn’t remember if it was text-something or font-mumble) and the reference has also let me browse around the dusty corners and learn something I didn’t know.

Recently, I did some web development using XHTML 1.1 and CSS 2.1 and realized my 2004 version of the guide was getting out of date. I was pleased to see many of the pages had been updated to a 2009 version. After reviewing the many options, I chose to go all in and bought the Everything Book, a step up from my earlier version. This one includes cheatsheets for PHP, MySQL, JavaScript, DOM, HTML, CSS, HTML special characters, web colors and a great index. The reference not only includes broad coverage of each topic but many side notes and compatibility guides (for CSS, the IE-Netscape-Opera-FireFox-Safari compatibility color coding is tremendously useful!)

There are a number of bonus references available on the Visibone site at no cost. Check out the color lab, the color swatches for many of the common graphics programs, the online color codes reference, and excerpts from all of the various reference materials. In addition to reference book, Visibone offers posters, charts and mouse pads. The web site is worth a visit; it’s charmingly quirky, retro, opinionated and clearly individualistic.

Adding Fail2Ban to the web site

I swapped out web servers two weekends ago, when the old machine started showing some unacceptable behavior. Part of that swap involved switching from a CentOS-based Linux distribution to an Ubuntu-based distribution. There were some great learning moments involved in that. I also wanted to swap out a few programs that hadn’t worked as well as I had hoped.

One of the new packages I’m trying out is Fail2Ban, an Python-based application to review the logs and temporarily bans IP addresses based on the patterns of abuse. Similar applications like DenyHosts are well-rated, but DenyHosts specializes in ssh, which hadn’t been too much of a problem for me, and didn’t have a straight-forward configuration for ftp, which unfortunately I must offer. I had used a similar Perl-based application before, but it hadn’t supported a couple of a my applications, and appeared to introduce some instability in the system. Fail2Ban came with configurations for Apache 2 and vsftpd. In their wiki, there was a HOWTO for banning PHP-based file upload attacks, something which had begun to fill the logs with nonsense.

So, 48 hours in and things seem to be running well. The log files clearly show some applications being blocked, other applications seems to be running well, and performance and responsiveness of the site seems to be okay.

Listening to… August 2008

Kent Beck spoke at O’Reilly Media’s RailConf on Test Driven Development, Patterns and Extreme Programming and I got to listen while working out last week. A long trip to a client gave me an excuse to listen to last week’s Technometria interview on Sxipper, and catching up with some 2006 archival Twit.tv FLOSS recordings featuring PHP’s originator Rasmus Lerdof and a second one with Jeremy Allison on Samba.

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.