What was I thinking?

At my day job I am working on an API into an E911 interface and while writing my DSL to ingest and perform certain actions against their SOAP interface I quickly noticed an opportunity to refactor.  The end result is much cleaner and in my opinion easier to decipher what is happening.

To bring you up to speed this particular function is for searching against their database for a location, there are several “optional” fields you can send over to narrow and scope your search.  Obviously to properly expose the feature my DSL needs to be able to account for all the possible options.  Here is what the code was before refactoring

(WARNING: it is ugly)

Continue reading

WordPress Plugin Cleanup SUCKS!

Being a software developer I can sometimes get irate with how some software operates. For example, when you uninstall a plugin from WordPress there is no proper cleanup; meaning there are crumbs from the plugin left all over your database. Sometimes it’ll be in your wp_options table and other times little nuggets will be left in the wp_usermeta table. Seriously? I don’t know if it’s the developers of these Plugins or if it’s an inherent flaw with WordPress; either way it completely sucks and can mislead people into thinking they have “completely” removed a specific plugin.

I’ve encountered this problem several times before, but currently I am facing it with the Membership Plugin (http://premium.wpmudev.org/project/wordpress-membership-lite). My user data had become corrupted so I was unable to add any new levels, subscriptions or members to my customers site. Recognizing that something went wrong I utilized their “database” repair functionality to try and fix the issue. It didn’t work, no problem! I’ll just deactivate the plugin, remove it and then reinstall it. Off I go to do just that; but amazingly it remembered every setting that was there before, including the issue that was plaguing me from the beginning. Gah! Darn crumbs. I scrambled through the database to delete all the “leftovers” and sure enough when I removed the plugin and re-installed this time everything worked like a champ!

Please, WordPress or Plugin Developers, consider properly cleaning up after yourselves. My children do a better job after they goto the bathroom!

[JQuery] Remove one select option based on a different select option

JQuery is simply amazing. I am really impressed with this javascript framework. My previous framework of choice was Scriptaculous and I was happy with it, but it always seemed limiting. Since switching to JQuery over about 6 months ago I have been pleasantly surprised. For example, I had to create a function on a select to remove a specific option from a different select based on the first selects selected option.
Continue reading

[WordPress] Fatal Error in file.php

When trying to use automatic installation and updating of plugins you get a blank screen and your logs show an error such as this:

1
PHP Fatal error:  Cannot use assign-op operators with overloaded objects nor string offsets in /somedirectory/wp-admin/includes/file.php on line 688, referer: http://somedomain.com/wp-admin/plugins.php

, then most likely your or your host moved your site without updating wordpress.

Never fear as there is an easy fix. Open up your database GUI, such as PHPMyadmin and goto the wp_options table. Then find the row that has “ftp_credentials” as the option_name, click to edit the value.
Continue reading