WordPress 3.0 implode() error

After installing WordPress 3.0 on a client’s web-host (running on PHP 5.2.5 with the wonderful PDO (SQLite) For WordPress plugin) I had a number of minor errors that required custom attention. Here’s the run-down:

Custom file-permissions (777 for install, be careful) needed for ‘wp-admin’, ‘wp-content’, ‘wp-includes’ and the pdo-for-wordpress ‘database’ directories to have install run smoothly.

“Warning: implode() [function.implode]: Invalid arguments passed in /wp-includes/post.php  on line 2552” was what I was seeing every time I tried editing a Page in the Dashboard. Solution was found at WordPress-Hacks (Spanish page): comment out line 2552 and insert replacement like so:

// hack start
// $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
$hierarchical_post_types_string = implode("', '", $hierarchical_post_types);
$hierarchical_post_types_string = addslashes($hierarchical_post_types_string);
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . $hierarchical_post_types_string . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
// hack end
Advertisements

Searching single table column with jQuery

In Codeigniter 1.7.2 there is no way to change the style of an individual cell with the Table class, this is not good and everyone is much looking forward to 2.0 where this sort of magic is apparently going to be included (go to this page and search for “individual cells”). So, say you have a table that contains specific values in some cells that need extra attention – if the table contains no colspan or rowspan then you’re emphatically in luck and can do the following trick with jQuery without custom id tagging of your content:


$('td:nth-child(10)').each(function () { // search 'Deposit'
content = $(this).text();
if (content.indexOf("No") != -1) {
$(this).css('background-color','#ff0000');
} else if (content.indexOf("Waiting") != -1) {
$(this).css('background-color','#fef612');
} else if (content.indexOf("Yes") != -1) {
$(this).css('background-color','#0abd09');
}
});

That will select the 10th column and search it for specific value and change the container cells depending thereupon, result can be seen in screenshot. Ah yes. Side-note: of course you would need to wrap your jQuery code in the pre-requisite $(document).ready(function() and so forth (Google is our mutual friend).

Resources used in connection to above snippet:
http://www.javascripttoolbox.com/temp/table_cellindex.html
http://tylermuth.wordpress.com/2008/12/17/jquery-selectors-will-change-your-life/

Chrome Desktop Notifications and why they are useless

Responding mainly to the optimistic vibe in the article and comment section on 0xfe’s brilliant article on webkit notifications I have the following brief’ish commentary:  first of all the chrome dev’s need to get the window-on-top-feature under their belt, otherwise these messages/notifications are simply going to disappear in mass numbers into the land of behind-the-app. [edit: thnx to NoFancyNick for pointing out that my browser is broken]

Secondarily I’m in 2 minds about the permission asking (same with localstorage i html5) – as in: is there any web-developers that will make use of features that demands their non-super-geek-userbase to press novel and scary invented-for-the-occasion buttons in their browsers before their site/app will work as intended? I seriously wonder: if I am to construct a notification (which is actually the case in regards to the db admin shell I’m currently working on) it is obviously better for me to use a jQuery attention grabber (like Tim Benniks’ “growl-like”). It would in essence never work for my no-tech users that they had to take into consideration whether a yellow bar is asking them some obscure message about accessing their desktop during their admin session.. it would spell out consistent and reoccurring user problems!

Lastly, while these app-like features are definitely needed we do need to find another option than the permission asking game – it works for users that are installing Firefox add-ons as second-nature thing but the rest of humanity have just come around to NOT clicking every single thing asking them for permission because it caused their computer to die of virus overload (which you and I had to fix for them). Not good.

‘color.get’ Micro Application

Screenshot of freeware get.color micro app

Grabbing color from video using freeware get.color

This little free application, get.color, allows you to get the html color code of the current pixel the mouse-cursor is hovering above by holding a selected hotkey pressed – simply double click the left mouse button to copy the html RGB color code into the clipboard (in the format of, for example, “#247ca4” without the quotation marks). Perfect for use when designing webpages, copying stubborn colors between different Photoshop clones or the likes of it. See screenshots for examples of how it can grab color from webpage or indeed anything you have on your screen (video..etc. perhaps with the exception of DirectX games, I don’t game currently so can’t tell you, update: user-comment from Ekkoreverb suggests that it does not work and may indeed bring DirectX games down so guess its a no luck thing)

Another get.color screenshot

Taking color from webpage with get.color

The freeware app has no installer and can be manually placed in the Window’s “Startup” folder if you like. It starts a little color-pipette icon in the traymenu which you can rightclick to edit the config file or to shut it down. Also, the default hotkey is F2, simply hold it pressed to see get.color in action

You can download the archive from here:
get.color.zip (version:2009-08-29) (thanks to Citif.dk for hosting!)

Contents of archive must all be unzipped in same folder for the freeware utility to work. The software is provided as freeware if anyone should be seriously interested in improving upon it then I’ll be happy to Open Source it. Leave a comment on this posting if you’re interested in getting in contact about get.color