Optimize with MySQL Procedure Analyse

December 10, 2009 By Hel :: Posted in MySQL :: No comments

How to Use “Procedure Analyse” to Optimize MySQL Table Size

MySQL provides a useful tool called “procedure analyse” that can help you optimize your tables for storage. “Procedure analyse” examines the contents of a table’s columns and suggests a field type for each column selected that reduces the total table size.

So, why bother to reduce table size when storage is cheaply available? Big tables not only use up memory, but queries on them eat up CPU usage as well. If you have a web site with large custom MySQL tables and your site is on a shared server, you could end up getting penalized monetarily or even have your site shutdown by your ISP, if queries on your MySQL tables consume more CPU than allocated. To keep this from happening you should optimize both your queries and your table size. “Procedure analyse” provides a quick and easy way to do the latter.

Read the rest of this entry »

Sleeping with Javascript

June 07, 2009 By Hel :: Posted in javascript :: No comments

When I went looking for a built-in “sleep()” function in Javascript, I quickly learned that it does not exist. This is surprising considering that “sleep()” is in all other languages that I have used. To get around this javascript shortcoming, I decided to create my own sleep function. The result is a function that loops internally until the number of seconds passed is greater than the argument value, “naptime”.

Initial tests of “sleep()” were successful, however, I soon discovered that most browsers will interrupt “sleep()” and show a “Slow/Busy script” dialog message whenever the “naptime” argument is greater than 10 seconds (7 seconds in IE). Trying to work around this problem was too much effort, so I left the script as is. If you use this function, I recommend a “naptime” of less than 10 seconds so your site visitors won’t encounter this “slow script” dialog message.

Below are some examples of the javascript “sleep()” function. Just click on a link below to start sleeping for the preset amount of seconds shown.

Read the rest of this entry »

Horizontal Submenus for WordPress Admin Plugins

March 25, 2009 By Hel :: Posted in Plugins :: 9 comments

How to Add Horizontal Submenus to Your Administration Plugin in Wordpress 2.7+

With the launch of version 2.7 in December 2008, Wordpress added several new features and changed its user interface (UI). I especially like the new automatic update feature and the new vertical sidebar is sleeker and more modern looking. However, I find navigating the menus on that new sidebar to be very inefficient when administration plugins add more selections to it. [Wordpress screen shot]
Image #1: Plugin with sidebar menu

As an admin plugin author, I want my users to have easy access to my plugin menu and submenus. In Wordpress 2.2 to 2.6, the built-in menu functions accomplished this with horizontal menus at the top of the page. In 2.7, however, the same menu functions now place the plugin menu (and submenus) near the bottom of the page, in the sidebar. This makes navigation more cumbersome because plugin menus are positioned outside the initial viewing area of the screen in a typical 1280×800 browser window. The user has to scroll down to select the plugin and, after the plugin is selected, scroll down again to navigate the plugin’s submenus. Worse, it not always obvious that there are submenus available for a plugin. You can see an example of this in image #1 where the green line indicates the end of the window area of a 1280×800 resolution browser window.

To workaround this problem in my own admin plugin, I inserted a new horizontal menu containing the submenu links at the top of each submenu page. plugin menu screen shot
image #2: Plugin with horizontal menu
To keep the look consistent with WordPress' new style, I positioned the menu inline with the “contextual help” button and also adopted it’s “look and feel”. This was a relatively simple task to do, once I located and copied the appropriate styles from WordPress' admin stylesheets. You can see an example of this new horizontal menu in the second image to the right.

Read the rest of this entry »

A Simple Fix for “Simple Tags”

August 09, 2008 By Hel :: Posted in Plugins :: No comments

I am not an official Wordpress tester, but to keep up with the latest changes and to make sure my own plugins are always compatible with upcoming versions of Wordpress, I run Wordpress development version on this site.

There are several plugins installed on this site that end up also getting tested for compatibility with upcoming versions of Wordpress, although that is not my intention. Wassup, cFormsII, Bad Behavior, and Akismet all run successfully on Wordpress 2.7 development version . One plugin that failed was Simple Tags version 1.5.7 by Amaury Balmer. This plugin produced an error because of a test in the code that rejects unrecognized versions of Wordpress.

Fortunately the fix was simple. It only required that the version test be replaced by one that tests for current or higher version of Wordpress. I modified the code myself and now “Simple Tags 1.5.7a” runs on 2.7-dev. Read the rest of this entry »

Wordpress 2.6 Crashes Safari

July 25, 2008 By Hel :: Posted in Blogging :: No comments

Soon after I upgraded to Wordpress 2.6, I discovered that the Wordpress' dashboard and post/page editor cause the Safari 1.3 browser to crash. Though other Wordpress 2.6 admin functions continue to work fine in Safari 1.3, including the widget functions, without the Dashboard, users can’t login, and without the post/page editor, users can’t update their blog. This makes Wordpress 2.6 completely unusable in Safari 1.3.

A quick search of the forums showed that this problem has cropped up for other Wordpress users and that it may extend to Safari 2 as well. Here what one user had to say on wordpress.com forums.
Read the rest of this entry »

Installing A More Secure Wordpress

June 04, 2008 By Hel :: Posted in Blogging :: No comments

Step-by-Step Instructions to Install and Configure WordPress with Better Security*

When I went looking for a blogging software, I checked user ratings, server requirements, amount of documentation, available CSS templates and plugins, and did a test install of a few blogs. In the end I chose to go with WordPress because it was one of the easiest to install (it worked on the first try), it had built-in CMS (content management) capability, it had the best documentation, the most plugins, and lots of freely available CSS templates.

I installed and configured WordPress as CMS and blog for my existing website. I put WordPress in a subdirectory of my site's root directory because this is more secure and did not overwrite my existing web documents and applications. The install went smoothly and afterwards, I was delighted to find that the URLs for my other web documents** and applications continued to work seamlessly, without interference from WordPress.

Below are instructions to install your own copy of WordPress on a new or existing site, with improved security. These instructions assume that WordPress will manage your host domain/subdomain, not a subdirectory of that domain/subdomain (ie. www.mysite.com or subdomain.mysite.com, NOT www.mysite.com/blog/). It assumes that you are familiar with a FTP software to upload files to your ISP, that you can create a MySQL database on your ISP account, and that you can edit a plain text file using a text editor like Notepad or VIM. These instructions can also be used to “upgrade” an existing copy of Wordpress to make it more secure.

Read the rest of this entry »

YouTube in a Thickbox

May 30, 2008 By Hel :: Posted in Multimedia :: No comments

Embedding Videos: YouTube in a Thickbox

Note: This is a duplicate of an article I originally wrote on April 29, 2008 on the Supernatural Station website.

“Thickbox” is a great way to showcase a youTube video on your web site. Thickbox’s light box effect gives videos a dramatic, theatre-like feel. You only need to add a few extra lines of code to the preset embed code supplied by YouTube.com to show your video inside a “thickbox”. This method works with embed code from youTube.com as well as embed code from other video hosting sites. Click the links below to see some examples.

[youTube Thickbox demo]
[DailyMotion Thickbox demo]
[iMeem Thickbox demo]
[Vimeo Thickbox demo]

Step-by-step Instructions to embed a youTube video inside a Thickbox:

Read the rest of this entry »

Flv Videos in a Thickbox

May 06, 2008 By Hel :: Posted in Multimedia :: 9 comments

Embedding Videos: Flv Videos in a Thickbox

NOTE: This is an updated version of an article I originally wrote on September 6, 2007 that was posted on SupernaturalStation.org.

Step-by-step instructions on how to display a flash video (.flv) inside a thickbox* using JW's Flvplayer

For those of you wondering how to implement JW's Flv player inside a Thickbox, it is actually quite simple. Here's how:

  1. If you don't already have them, download jquery and ThickBox 3 and add them to your page's head section

    jquery.js is available at docs.jquery.com/Downloading_jQuery. ThickBox 3.1 is a group of files and images (thickbox.js, thickbox-compressed.js, thickbox.css, loadingAnimation.gif, and macFFhack.png) located at jquery.com/demos/thickbox. Download all the Thickbox files and install them in a single common directory, “thickbox”, on your web server.

    Read the rest of this entry »