jump to navigation

NOTE: The spam filter is being unusually aggressive. If you comment does not immediately appear, it has simply been placed in moderation and I will approve it as quickly as possible. Thank you for your patience.

"Murphy was an optimist!"

WordPress 3.4 limited to 90 menu items June 19, 2012 9:26 am

Posted by Doug McCaughan in : MySQL, PHP, Programming, Software, Technology, WordPress
, 11comments

I’m working on a WordPress site. The site is to have roughly 106 pages all accessible via the WordPress menu system so that the enduser can add and remove pages from the menu as they like. Unfortunately, WordPress currently only allows 90 nodes (ie. 90 menu items) per menu. I have not figured out if this is a memory limitation, a hard coded limitation, or a setting yet. This must be overcome!


Possible solutions:


WordPress Hooks, Actions and Filters – Modifying the Publish function January 4, 2012 10:38 am

Posted by Doug McCaughan in : Blog, Communications, PHP, Programming, Publishing, Software, Technology, WordPress
, add a comment

I’m writing a child theme to twentyeleven and want to modify the administrative post "Publish" function to do some additional processing during the saving of a new post. Does anyone know if there is a hook, action or filter that will allow me to extend the Publish function?

add a comment

Call to action: WordPress Developers Please Comment February 17, 2011 9:33 am

Posted by Doug McCaughan in : PHP, Programming, Software, Technology, WordPress
, add a comment

Hello WordPress developers! (me included). When you make a theme, I implore you, please use a simple html comment at the top of each page to identify the template. For example: <!- – TEMPLATE: single.php – -> would allow someone unfamiliar with your theme to look in the generated source and see which template(s) are influencing the output. Yes, experienced WordPress developers should already know which files are being used but we don’t write themes only for experienced developers. And even experienced developers get stuck, tired, or would like things to be sped along and a simple comment, <!- – TEMPLATE: page.php – ->, would help tremendously. Thank you!

add a comment

PHP is exactly the same on Linux and Windows… July 30, 2009 9:33 am

Posted by Doug McCaughan in : PHP, Programming, Technology
, add a comment

PHP is exactly the same on Linux and Windows as long as you are using good coding practices, are not using deprecated variables and functions, are not suppressing error messages, are not porting code from an older version of PHP. See, I maintain code on a project that was originally contracted to someone in the United States who failed to tell his client that all he was doing was outsourcing the project to a foreign company. He lost the contract to me when that foreign company became unresponsive to change requests. Many of the comments and variable names are in a foreign language that I do not recognize. The code looks like the foreign company had once written a CMS and just resell it shoehorning new features with hacks. There are many weaknesses to their code but this is not about judging other developers. This post is to warn that although PHP should conceptually move seamlessly from a Linux environment to a Windows Server environment, in reality it doesn’t.

add a comment

Your thoughts on embedded WMVs with progress bars May 18, 2009 10:50 pm

Posted by Doug McCaughan in : AJAX, JavaScript, jQuery, PHP, Programming, Technology
, 1 comment so far

Let me reach out to the community for a moment. I’m trying to deliver a movie to be played in a web browser. The movie must play in Internet Explorer 6, 7 and 8, Firefox and Safari. The movie sits on a LAMP box. The movie is roughly 35MB windows media (WMV). jQuery is available. The challenge: Deliver the movie to the client without the client impatiently clicking the play button repeatedly (elevator syndrome), reloading the page, or giving up and leaving. This implies some sort of progress bar or loading spinner. I can’t seem to get a loader to work to save my life.

I’ve tried:

The goal is simple: Take a large wmv movie and present a loading indicator until the movie is cached in the user’s browser. This one is giving me a real hard way to go.

1 comment so far

Links of Interest April 7, 2009 1:12 pm

Posted by Doug McCaughan in : AJAX, JavaScript, jQuery, JSON, PHP, Programming, Technology
, add a comment

The stuff that I’ve been working with today:

add a comment

What do I do? April 2, 2009 10:00 am

Posted by Doug McCaughan in : JavaScript, jQuery, PHP, Programming, Technology
, add a comment

I often get the feeling that most people have no idea what I do down in this dungeon. Here’s a sample:

In the next hour, I will write, test and prove some php and JavaScript+jQuery to present a table of data, allow a user to click a delete icon, use a modal to prompt for delete confirmation, then remove the data from the database and the row from the table without a page refresh. Will work in IE6, 7, Chrome, Safari and Firefox.

This is also a micro-milestone. I often write these down, although I rarely publish them, when the number of tasks I have is overwhelming, or I have coder’s block, or I need motivation. Giving yourself small, achievable milestones can lead to great productivity.

Update: Had a digression. To get the new code to work I had to upgrade jQuery’s UI from 1.5.3 to 1.7.1. This was well worth the effort. They’ve done a great job with 1.7.1!

add a comment

Seeking Next Project March 19, 2009 8:26 am

Posted by Doug McCaughan in : Announcements, ColdFusion, CSS, HTML, JavaScript, jQuery, MS SQL, MySQL, Of Interest, PHP, Programming, Technology
, add a comment

I am coming to the end of a project and have an opening in my schedule. My strengths are programming in PHP, ColdFusion, JavaScript and jQuery, CSS, and HTML. I most frequently work with MySQL or MS SQL but can work on most database platforms. Code I write validates and is W3C compliant. I can also write Section 508 compliant code. I carry a project from concept to production as project manager, independent developer, and/or project team member. In addition to custom original code, I work well with open source projects and APIs. I usually telecommute but am not adverse to working onsite or traveling. I am not an artist and typically hire a graphic artist to provide the design for each project. I enjoy WordPress customizations (but have not done custom work to either Reality Me or Domestic Psychology). Please send referrals or inquiries to jugger@gmail.com or call +1-865-898-7189. Thank you!

add a comment

Yesterday’s Coding Horror January 31, 2009 9:47 am

Posted by Doug McCaughan in : JavaScript, PHP, Programming, Technology
, add a comment

Yesterday my web application quit working. I simply cleared the domain cookies and the session cookies. It should have been no big deal but an important piece of JavaScript quit working. I have a script that adds some HTML to the DOM and looks similar to:

snafu("<tr><td class=\"fooclass\"><a class=\"expander special\" href=\"index.php\">go somewhere</a></td></tr>");

So this worked fine until I cleared cookies and now the generated source in the browser (confirmed in Firefox and Chrome) looks like:

snafu("<tr><td class=\"fooclass\"><a class="\""expander special\" href=\"index.php\">go somewhere</a></td></tr>");

Note that the anchor has inexplicably changed from <a class=\"expander special\" href= to <a class="\""expander special\" href=. The obvious thought is that a session variable is being expected in building the javascript code which in turn changes the DOM but that session variable is now returning NULL. That is still likely to be the problem but yesterday’s line by line inspection of the code showed no flaws. Today I am going to eliminate the server as an issue. The most recent code changes have not been migrated to the production server and it does not reproduce the problem so I’m setting up a staging server today to see if it shows the same problem as the development server. What a pain!

add a comment

Always more to learn January 5, 2009 2:15 pm

Posted by Doug McCaughan in : ColdFusion, HTML, JavaScript, PHP, Programming, Technology
, 2comments

No matter how long you do something, there is always more to learn. You’d think that since I’ve been doing HTML coding since around 1993, I’d pretty much know every in and out and every little tag and peculiarity regarding HTML. Not so. See, we form habits. We get into patterns. Specs change but we retain earlier hacks and assumptions. Today I learned an absurdly simple thing. Maybe I knew this and forgot. I rarely use tab orders on my forms. Most of the forms I create are very top down so the natural tab order is sufficient. In computing, counting starts at zero. But in HTML tab order, zero means exclude that form element from the tab order.

To exclude an element from the tab order, set the value of tabindex to 0. [Source, Webcheatsheet.com, How to Control Tab Order in HTML]

Because of my computer science studies, programming in PHP, JavaScript, C and so on, my inclination is to always begin with zero. Of course, my favorite web application language is ColdFusion and it always starts at one. I can only assume the Allaire brothers were originally targeting non-programmers.

HTML is about to become HTML 5. Funny enough I just traded my HTML 3.2 book at McCay’s a few weeks ago. Maybe I should have kept it and re-read it.

Update Jan 12, 2009: Ian Tempest noted in the comments that zero does not exclude an element but rather moves it to the end of the tab order. From the W3C HTML 4.01 specification:

Those elements that do not support the tabindex attribute or support it and assign it a value of “0? are navigated next. These elements are navigated in the order they appear in the character stream. [Source, W3C, 17.11.1 Tabbing navigation]


Today’s Coding Challenge November 9, 2008 3:55 pm

Posted by Doug McCaughan in : jQuery, PHP, Programming, Technology
, 2comments

In one of my applications, I use jQuery’s UI Datepicker as part of the interface for easy date selection in adding and editing some data. I have two screens that show the current date. One screen is a report that says "Today’s date is…" and shows the current date. The other is the form for adding this data. The datepicker calendar is supposed to default to today’s date.

Problem 1: On the development server, the report and the form both default to today’s date. On the staging server, the report and the form both default to today’s date. On the production server, the report defaults to today’s date; the form defaults to December 31, 1998.Solved. In a special case, a null string was being passed when a date type was expected.

Problem 2: When editing, if the date is in the current monthmonths of March and November, the highlights for datepicker don’t work. The day still gets selected appropriately but the date itself is never highlighted making the user think they didn’t click the date. Click to see a working example of the problem. Update: This is partially fixed. In UI version 1.5.2, the highlight does not work in November or March. This is demonstrated at http://sidesigns.com/pub/datepicker/index152.php. I tested with the 1.6rc2 release candidate and November now works but March is still not highlighting correctly (the first week highlights but no others). This is demonstrated at http://sidesigns.com/pub/datepicker/index16rc2.php. I’ll be submitting a bug report to the jQuery UI team.


Today’s Programming Challenge November 7, 2008 12:06 pm

Posted by Doug McCaughan in : PHP, Programming, Technology
, add a comment

I am working on a PHP application that is mysteriously losing the value of a particular session variable. There is only one place in all the code that the variable is set. All comparisons have been confirmed as comparison operators == instead of assignment =. In debugging a vardump shows the variable as:
[“foo”]=> &string(2) “35”
and a second later it becomes
[“foo”]=> ∫(35).

Does the ∫ symbol mean undefined? And if so, why does it still show the value? echo “***”.$_SESSION[‘foo’].”***” shows ****** in the later instance and ***35*** in the previous.

Ah ha! It’s the integral symbol. I just didn’t expect to see that in debugging. Why is my string suddenly an integral?

Update: From the notes on vardump "Now &int; translates into an integral sign, and since the browser may be inclined to overlook the missing semicolon, you may be seeing integrals where you were expecting &int"

Update: Solved. A locally scoped variable of the same name was being set to null. I’m still unclear on why the session variable would assume the value of the locally scoped variable.

add a comment

Code Buzz October 20, 2008 10:36 am

Posted by Doug McCaughan in : AJAX, Daily Life, JavaScript, PHP, Programming, Technology
, add a comment

Runners get a runner’s high. I’ve got a coder’s high. My head is buzzing as I’ve been hitting the keys hard. My current PHP application has dynamic content loaded via AJAX but when the user navigates with the browser’s forward or back buttons the state is lost, that is, all the dynamic content disappears. Also if the natural navigation of the application takes the user away from the dynamically generated content, when they return the content is lost and the user frustratingly has to drill down, dynamically loading more content, to get back to where they were. Using jQuery, some custom JavaScript, and some fandangled PHP, I have overcome this obstacle and created a state engine that remembers which content was loaded and re-presents it on the screen whenever the user navigates with the browser’s forward or back buttons or the applications natural navigation. I’ve just finished the behind the scenes mechanics of this code and now have to fix the presentation level (after a 10 minute break). Whew! This was fun!

add a comment

DailyWTF August 5, 2008 6:33 am

Posted by Doug McCaughan in : PHP, Programming, Technology
, add a comment

I wrote this piece of rocket science last night:

<select id="birthdateyear" name="birthdateyear">
   <?php for($byear = date("Y",time()); $byear >= 1901; $byear--){ ?>
      <option value="<?php echo $byear; ?>" <?php if($birthdateyear == $byear) echo "selected"; ?>><?php echo date("Y",mktime(12,1,1,1,1,$byear)); ?></option>
   <?php } ?>

And that is why you shouldn’t code tired.

add a comment

Why PHP drives me batty! April 15, 2007 2:22 pm

Posted by Doug McCaughan in : PHP, Programming, Technology
, add a comment

Do you use date() or date_format()? Want to have some real fun? Let’s debate the most correct way to read a file!

add a comment