Posted on

Selenium IDE Script for New WordPress Site Setup

selenium ide

I use Selenium IDE as a testing tool for WordPress plugins.  It provides basic testing of the user interface elements via a record-and-playback browser script.   However, there is another use for tools like Selenium IDE; automation of repetitive web tasks.   On every build I reset my WordPress install and build a new site.   The setup form is short, but it is something I do at least once every week and answer the same half-dozen questions the same way.

The script shown below is my Selenium IDE script that sets up the website and activates a few plugins I know I am going to want on every site setup.   The script prompts for the admin password during execution.  Other than that it is hands off.    As for the plugins, they are already in my wp-content/plugins sub-directory.  You will need to modify the checkbox IDs and email address to implement this effectively on  your WordPress development and testing servers.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/" />
<title>New SLP Install</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New SLP Install</td></tr>
</thead><tbody>
<tr>
	<td>setSpeed[box type="info"]Determines how fast the test script runs.  Delay between commands in ms.  0 (fast) is the default.  Slow is 900.[/box] </td>
	<td>200</td>
	<td></td>
</tr>
<tr>
	<td>open</td>
	<td>/wp-admin/install.php</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=weblog_title</td>
	<td>SLP Dev</td>
</tr>
<tr>
	<td>storeEval</td>
	<td>prompt(&quot;Password&quot;)</td>
	<td>password</td>
</tr>
<tr>
	<td>type</td>
	<td>id=user_login</td>
	<td>admin</td>
</tr>
<tr>
	<td>type</td>
	<td>id=pass1</td>
	<td>${password}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=pass2</td>
	<td>${password}</td>
</tr>
<tr>
	<td>type</td>
	<td>id=admin_email</td>
	<td>your...email...here</td>
</tr>
<tr>
	<td>click</td>
	<td>name=blog_public</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>name=Submit</td>
	<td></td>
</tr>
<tr>
	<td>open</td>
	<td>/wp-login.php</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=user_login</td>
	<td>admin</td>
</tr>
<tr>
	<td>type</td>
	<td>id=user_pass</td>
	<td>${password}</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=wp-submit</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>//li[@id='menu-pages']/a/div[3]</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>link=Edit</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=content</td>
	<td>[slplus]</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=publish</td>
	<td></td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>link=Installed Plugins</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=checkbox_a55f1e83ab4fee1b42772d08e9971a9c</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=checkbox_bac6e3a30c8d87d2221981bfc36c48c6</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=checkbox_b70d95e549c77d1ee381947b403a4ff0</td>
	<td></td>
</tr>
<tr>
	<td>select</td>
	<td>name=action</td>
	<td>label=Activate</td>
</tr>
<tr>
	<td>clickAndWait</td>
	<td>id=doaction</td>
	<td></td>
</tr>
</tbody></table>
</body>
</html>

Yes, Selenium IDE stores the script data in an HTML table.    The first cell is the command, the second is the target the third is the value.  Makes for easy editing of scripts with other tools if you find the need.

Posted on

Forcing Display Resolution on VirtualBox and CentOS 6.5

VirtualBox Display Resolution

Last evening my Oracle VM VirtualBox development system stopped auto-detecting my guest display resolution when I re-connected my laptop to the docking station.   The maximum resolution I could get was 1600 x 1200 instead of the native display resolution of 1920 x 1200.   After literally hours of research this morning with many dead-ends I found the proper solution.  Here is my “cheat sheet” on how I got it working in my dev environment.

For CentOS 6.x systems the system-config-display command is obsolete.  The replacement, for today anyway, is xrandr.

VBoxManage is useless unless you are running the virtual box management service, which is not a typical default setup for VirtualBox on a Windows host.

Updating VirtualBox guest additions does not help if you already have a current version.  You WILL need VirtualBox guest additions for the display driver interface on the guest operating system to function properly.   If you don’t have that installed you can use the GUI interface and finding the “machine / install guest additions” option.   It should drop a CD image on your CentOS 6.5 desktop that you can run with autoprompt.  Run it as a priv’ed user such as root.

Once you have VirtualBox guest additions installed login to your system and get to the command prompt.    Switch to a priv’ed user.  I login as my standard account and execute the command:

# sudo su -

To setup xrandr and add a manual resolution to your list you need to get the configuration setting line.   Use the utility cvt to get the right command line.  Here is the command to find the xrandr mode for a 1920 x 1200 resolution:

# cvt 1920 1200

It returns the line:

Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync

Those are the parameters for my particular monitor configuration.  It is a basic reference label, a configuration tag, and monitor timing, resolution, and sync timings.  This will be specific to your monitor so run the cvt command, don’t just copy the line here.

For xrandr you will need everything AFTER the Modeline portion.

Find out what monitors your system thinks it has.  I have 3 monitors so this is my output:

# xrandr
Screen 0: minimum 64 x 64, current 4800 x 1200, maximum 16384 x 16384
VBOX0 connected 1600x1200+0+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX1 connected 1600x1200+1600+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX2 connected 1600x1200+3200+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
  1920x1200_60.00 (0x10c)  193.2MHz
        h: width  1920 start 2056 end 2256 total 2592 skew    0 clock   74.6KHz
        v: height 1200 start 1203 end 1209 total 1245           clock   59.9Hz

Now to add the manual entry so I can later use the CentOS 6.5 GUI display manager to set the resolution:

# xrandr --addmode VBOX0 "1920x1200_60.00"
# xrandr --addmode VBOX1 "1920x1200_60.00"
# xrandr --addmode VBOX2 "1920x1200_60.00"

Now I can go to System / Preferences / Display on the system admin menu.

CentOS 6.5 Forced Display Resolution
CentOS 6.5 Forced Display Resolution
Posted on

Back Up Google Drive with CrashPlan

Today, as I put another spreadsheet with Store Locator Plus and Enhanced Results features onto Google Drive, I realized something.   If Google Drive crashes, very unlikely but stranger things have happened, I don’t have a backup copy of ANY of my Google Drive documents.  There are a lot of things I have out there that I really don’t want to re-create.   It is even more important now that I am using Google Drive to store spreadsheets that are an integral part of my WordPress plugin documentation.

While I’m thinking of it, let’s go down that road for a moment.

Using Google for WordPress Tables

A few days ago I wanted to start building an “add on pack comparison” to the site.   It helps me organize my thoughts on what features belong in which plugins, reminds me of where I put those features, and also educates the consumer on what plugin they may be interested in.    I decided a wide table with side-by-side columns for each plugin was the best option.   Since it is not a true price comparison I needed a flexible grid display.

I tried a number of table plugins that are out there in the WordPress extensions directory.   Unfortunately a large number of those plugins were defunct, many not updated in years.   The few that were updated were adequate but too hard to man-handle to look  just the way I wanted, requiring extensive CSS updates and HTML man-handling to behave as I desired.  Sure, some of those, like TablePress, had options to make those efforts easier but still not effortless.

Then I stumbled across a post that discussed inserting a Google spreadsheet in the middle of a page.   You create a spreadsheet, format it how you like, and then publish to web.   Select the “embed code” and get the unique iframe tag to put on your site.  While I was leary of the iframe idea, it worked beautifully.   Now I can format the colors, fonts, and column data exactly how I want with the ease of updating the Google spreadsheet.  It is far easier to click a cell and the color box and see the background change than tweak CSS all day.

If you are trying to put tables in WordPress you may want to check that out.     Create the spreadsheet in Google, go to “publish to web”, publish, go to “get embed code”, copy the iframe HTML snippet, and paste into your page or post (in text mode).   Tweak the width and height parameter to fit your site.  Done.

embedded google spreadsheet
embedded google spreadsheet

Check off “auto-republish” and every time you make a change it will reflect on the website within a few hours (or you can force a manual republish if you need if faster).

Nice.

Backing Up Google Drive

So back to the backup issue.   I have a lot of doc, some integral to my public site, on Google Drive.   I NEED to back those up.    How did I do it?  Turns out easier than I thought.

First, I run CrashPlan as my backup service.  MUCH better than Mozy which is over-priced, IMO.   A MILLION TIMES better than Carbonite, which is slow as heck, throttles the computer, has horrible restore times, and worse support response times.   In fact if you are considering backup my only key recommendation is do NOT use Carbonite.  There is a reason you hear about them all the time, they are hiding a poor design and poor service with a huge marketing budget.

Second, getting the Google Drive content to the CrashPlan backup.   Easy.   Install Google PC Drive.   When you log into Google Drive there is a subtle link in the left sidebar for this app.    It is an program that will be installed on your local computer.   It creates a folder on your computer which is the “local sync” for the Google Drive content.  You can select which folder you want to keep in sync.   I just let it do the whole thing since I have plenty of space on the 1TB drive in my notebook computer.

Now I have a local copy (first stage backup) of everything on Google Drive.   Even better, if I create something in that folder OR on Google Drive it will be auto-replicated on both sides.   That makes for a good first stage backup strategy.

Second, since this folder goes under your user directory by default CrashPlan should automatically note the new content and mark it for backup, which it did on my system.  If it does not do this you can manually add the Google sync folder to the backup plan.

crash plan and google drive
crash plan and google drive

Easy.

I like easy.

UPDATE : NO SO EASY….

Henry Houh contact me last week about an issue with this type of backup.     It turns out Crash Plan will not back up ANYTHING by default when using this configuration.  Why?    Crash Plan runs as the user “SYSTEM” not as your normal login user.     Google Drive runs as you.

In my case the Google Drive folder was created with “Full Control” permission for me but NO permissions for the system user “System”.

The fix?

Go to the Google Drive folder, not the shortcut.

Right-click and select properties.

Select the security tab.

Click the Edit button.

google drive properties

Type “System” in the add user box.

Click “Check Names”.

Click OK.

Click on System in the list of users.

Check off “Full Control” under the allow column.

Click OK.

Click OK.

google drive with system properties

Now your Google Drive content will be backed up to Crash Plan.

Posted on

The Difference Between MiB and MB

For those of you who don’t  know, and admittedly until 5 minutes ago I had no clue myself, there is a slight but somewhat important difference between Megabytes (MB) and Mebibytes (MiB).   To make it even more interesting, the same distinction exists between Kilobytes (KB) and Kibibytes (KiB).

The mathematical explanation is simple:

  • MiB = Mebibyte = 1024 KiB
  • KiB = Kibibyte = 1024 Bytes
  • MB = Megabyte = 1,000 KB
  • KB = Kilobyte = 1,000 Bytes

A chart of the standard and the differences between power-of-2 and power-of-10 prefixes is noted on the NIST website.

While that may not seem like a big difference, it starts to add up QUICKLY when you start talking about today’s data storage capacities.   This often makes for interesting comparisons in storage capacities or files sizes, as you’ll find in the Mebibyte Wikipedia Article.

For example, the operating system Windows XP shows a file of 220 bytes as “1.00 MB” in its file properties dialog, while showing a file of 106 (1,000,000) bytes as “976 KB”. Apple‘s Mac OS X 10.6, on the other hand, would report a 106 byte file correctly as “1 MB”.[3]

Thus, if you are talking about a 100 MiB storage device you can store 104,857,600 bytes. A 100MB storage device: 100,000,000 byes.    That is nearly a 5 MILLION byte difference, or about 5% more capacity.   When you start looking at things like file storage, download speeds, transfer times, and other size-related calculations of terabyte-size files a 5% difference can be SUBSTANTIAL.

The Path To MiB

So after all this, you may be asking what got me started down this path.   Then again, you probably aren’t… but I’m going to tell you anyway.   It was git.   As I was cloning a multi-MiB repo today I noticed the counter showed MiB and KiB.  I assumed that git was doing something unconventional and making up a new metric for downloads in 1,000 byte increments.   Well it turns out that they are using the PROPER standards.

Way to go git.  Now if we can just get everyone else in computer science to use proper abbreviations and terminology we might have just a few less computer problems to contend with!

Summary

So today I am a little smarter about computer terminology and will try to implement the RIGHT abbreviations when discussing file sizes or data transfer rates.   My use of MiB and KiB may throw some people off, but when it does I’ll have an opportunity to show them the RIGHT terminology for the measurements on which our trade depends.

Posted on

Website Components

What is Your Website?

When building a website you need to determine what it is you want the website to accomplish. Is your website a simple brochure to introduce your company to a potential client? A tool for existing clients? A store to sell your wares?

There are many different types of websites to choose from, and you don’t have to choose just one. Like any project, the more options you choose the more expensive it will be. Building a one room cottage is going to involve a lot less time and money than building a 12,000 square foot mansion.

Components of a Website

There are various components that make up a typical website. The components range from 100% custom applications to “out of the box” components from various vendors. “Out of the box” components include both free applications that are provided by the Internet Community as well as paid commercial products.

Blog

A blog is a page, or group of pages, on a website that present short articles in chronological order. Most blogs are used for one way communication with the visitors to your website, often in the form of a weekly or daily commentary. Blogs are a great way to connect to the visitors of a website by keeping them informed of current events related to your business.

Various types of blog components are available that make it easy for the typical business owner to keep this part of the website updates. Once the blog component has been installed by your ever-friendly technical staff, you can start publishing your articles fairly easily.

Most blog systems only require that you know how to use your web browser. To publish an entry you simply surf to the “edit my blog” link your tech staff has provided for you, login, and start typing your article into an entry box. The blog software handles the formatting of the page, keeping the articles in order, and doing the general maintenance.

Most blog systems allow for extensive customization and extended features beyond the basic “post a new article” feature. Some features include the ability to put articles into various categories, tagging articles with keywords, or allowing commentary from website visitors.

Typical Implementation:

  • Pre-built blog systems are downloaded and installed on your server.
  • Some clients rent blog software and hosting from a software-as-a-service provider and link to their page at the blogging site.

Related Links:

Content Management System

A content management system manages the main part of your website. It provides an easy way for the business to add pages, update content on pages, delete pages, and move stuff around without the involvement of technical staff.

The benefit of a content management system is that the basic page layout (also known as the page template) is usually designed and installed by a web designer. Once the software and the template are installed on your server you then have control over the pages and paragraphs that appear on the site. Normally you will log in to a special web page on your site where you access a “control panel” for your pages. The control panel is where you add & delete pages and provides the links to edit the page content.

Typical Implementation:

  • Pre-built contents systems are downloaded and installed on your server.
  • Many clients opt for the software-as-a-service model from providers that include web hosting and the content management system in one package ensuring you have the latest updates at all times.

Related Links:

Forum

A forum is a section of a website that allows visitors to the site to communicate with each other via short articles known as posts. A typical forum is setup by the website owner with various sections representing categories of discussion that are pertinent to the website. Visitors to the website can both post a new question or comment or respond to a question or comment posted by another user. The postings and their responses tend to be grouped together in a way that represents a chronological dialog.

Forums are a great way to allow people interested in your business to share ideas, comments, how-to, and general knowledge related to your business. It often serves as a form of extended support for your client base where both your official support staff assists in answering questions alongside other members of the community that may be well versed about the intricacies of your business.

Typical Implementation:

  • Pre-built forum systems are downloaded and installed on your server.

Related Links:

[

Store

A store allows users to buy items directly from your website. The variety of items that can be purchased online vary from downloadable software to physical goods to services. Your website becomes a simple way for people to pay for the items they are interested in. Stores can vary from something as simple as a form that collects credit card or other payment information to full fledged product displays with reviews and related information.

Online stores tend to be the most often customized part of a website and often requires the involvement of an experienced technical team. Business owners often desire a specific type of user experience when their clients are buying something from them. Most web software does not provide the desired features straight “out of the box”. Since a customer can be made or lost based on the store experience, it is often worth spending extra time and investment dollars in making sure this part of the website matches your expectations for the sales process.

Simple stores and shopping carts can be setup via a variety of online software-as-a-service providers. The advantage of these providers is a “hands off” approach to credit card storage, limiting your liability. The disadvantage is your are often unable to customize the presentation to meet the exact needs of your business.
Typical Implementation:

  • Large stores: Pre-built forum systems are downloaded and installed on your server.
  • Small stores: Software as a service, such as Yahoo Stores are often linked to the website.

Related Links:

Video

Video clips are a large part of today’s Internet landscape. Most people surfing the web today expect more than just a static textual presentation from their favorite websites. Almost every type of business can benefit from the addition of short video segments presented on the website. The videos can be anything from a simple “introduction from your host” to instructional videos to pure entertainment.

Proper formatting and production of videos is as important as proper placement and implementation on your website. Selecting compatible formats that work across many different computers is important. One of the more common distribution formats in place today is the use of Flash video formats due the freely available and widely distributed flash viewer application provided by Adobe.

Typical Implementation:

  • Video content is formatted then uploaded to your web server
  • Web pages are tailored to present the video inline (middle of the page) or in a separate popup player window

Related Links:

Wiki

A wiki is a section of a website that is often presented as a series of linked web pages. Unlike the main content of a website, the wiki pages are often kept separate as the content is typically edited by the visitors to the website. Wikis are collaborative documents where the entire user community shares in producing documentation for your product or services. Think of it as a sort of self-help guide written by the users.

The content of a Wiki does not need to be limited to help systems, but that is a common purpose. Wikis can also contain commentary, photos, links to other resources, or any other content that could appear on a standard website. The primary difference is that Wikis usually don’t have a central “controller” of the information. The concept is to allow the community to create content for your site.
Typical Implementation:

  • Most wikis are installed on your server using free downloads of the wiki software.

Related Links: