Setting up PHPUnit to run the samples

In my last post I thought I had set up PHPUnit correctly. As I worked through the samples I found out that there were a few more problems.

  1. The first problem was finding the Framework folder used in the samples. This folder exists under the test tree. To make things easy I copied the Framework, Extensions, Runner, and Util folders over to my working directory. As I said in previous post my working directory, phpunit, is located under the htdocs folder.
  2. The ObserverTest sample did not work for me as shown in the documentation. It complained about the Subject object. I got the Observer object to run but I think section of the documentation should be re-written. Mock objects are important.
  3. The second problem I found was when I was trying to run the BankAccountTest. It threw a BankAccountException and it expected to find the BankAccountException class somewhere. Sebastian has a slide online with an updated BankAccount.php that referenced a BankAccountException.php. I looked all around for the file but I could not find it. So I created my own file. It does nothing except create the BankAccountException class by extending Exception. Now the BankAccountTest sample will run.
  4. Getting the code coverage feature to work was a bit trickier. If you have not enabled xdebug you will get a confusing error message. When you run PHPUnit with the code coverage parameter, “–report”, it will say that there is no report parameter. Huh!? When you run “phpunit –help” you will not see the report parameter. Hmm… I thought I had fixed this.
    1. Go back and make sure that you have enabled the extension in the php.ini file. Oops, I had enabled the extensions in the wrong file.
    2. After enabling the xdebug extension I got an error message when I ran PHPUnit.bat that complained about the version of xdebug.dll and PHP. I am running the latest version of PHP and the xdebug.dll version it is loading looks like it is pretty old. After a couple of iterations I got the configuration correct. You need to enable the xdebug extension as a ZEND extension with the full path to the most recent version of the DLL. The most recent version exists in my ext folder but it had a different name. For my version of XAMPP I added the following line, zend_extension_ts="C:\Program Files\xampp\php\ext\php_xdebug-2.0.0-5.2.2.dll". Now I get the pretty code coverage report.

So there you have it. I have gone through the examples and gotten all of them except one to work as expected.

Updating PHPUnit on XAMPP

I have decided to do some playing around with unit tests for PHP. I saw a video on Getting Involved in WordPress and it reminded me of my interest in unit testing. Now I almost want to create some unit tests for verifying WordPress plugins or phpWebSite code. Fortunately, common sense will prevail and I will restrict my activities to playing. The instructions at Chapter 3. Installing PHPUnit looked pretty easy but since I wanted to do my testing under XAMPP I knew there would be problems. Hopefully the problems would be minor.

Confirm the PEAR configuration

The first thing I did was to open a command window in the PHP directory under xampp and ran the following command.

pear show-config

This command prompting elicited an error about improperly set environment variables. So I edited the file and inserted the full path to the XAMPP directory. I tried the command again and it showed the PEAR configuration. I checked the installed packages and it showed PHPUnit to be version 1.3.2. I would like to use the latest version so I am going to follow the instructions from the documentation.

Update the channel and install the PHPUnit

The next commands I tried were to update the channel and install PHPUnit.

pear channel-discover pear.phpunit.de

pear install phpunit/PHPUnit

The channel command worked. The install command did not work since it wanted the a dependency updated, GraphViz. After updating the dependency I ran the install command again. It installed 3.1.7 and it said I could also install pdo_sqlite and xdebug. I tried to install these extensions but they ended with a DSP error.

Test the PHPUnit

To test the installation I created a new folder under htdocs called phpunit so that I would have all of the unit test files in one spot. I quickly found out that I needed a copy of the phpunit.bat file in that directory, too. This file is in the PHP folder and it has the correct path to the php.exe file. I copied the example ArrayTest from the documentation into a file called ArrayTest.php and ran the command, “phpunit ArrayTest“. It worked. Now I can move on to more sophisticated unit tests.

Final Fixups

After a little searching I found that the xdebug and pdo_sqlite extenstions already exist in the extensions folder. XAMPP installs all of the extensions but only enables a couple of them in the default installation. All I had to do was to edit the php.ini file, remove the semi-colon in front of these extensions, and restart the web server.

Communication Styles and the Future of phpWebSite

I have been pondering for some time whether to convert existing web sites from phpWebSite to WordPress. It is difficult for me to think about these things since I quickly jump to the implementation details. So I decided to back off and look at the problem from the viewpoint of communication styles. For this quick analysis I am going to compare the diary, magazine, and product brochure formats to their Internet counterparts. These communication styles have existed for a long time in printed form. I think a little pondering on where these formats came from and where the web site versions of these formats are going will give me a better strategic view.

Diary Format

  • History – The diary format is the model that blogs originally copied.
  • Frequent Updates – One of its characteristics is that it generally involves short posts on a daily basis. This feature of blogs was quickly adopted by news organizations for syndicating news over the Internet.
  • Conversational tone – A key characteristic of both diaries and blogs is that they have a conversational tone.

Magazine Format

  • History – The magazine format came about as printed magazines established a presence on the Internet.
  • Monthly Updates – Originally the web sites mimicked the printed version and were updated on a monthly basis. As magazine publishers adapted to the positive and negative impacts of the Internet on their business, they eventually adopted RSS syndication for more frequent news updates(daily) and email newsletters for less frequent updates(weekly).
  • Both formal and conversational tones – The magazine format has traditionally had a mixture of both a formal tone and a conversational tone. The articles had a professional/formal tone while the editorials has a more personal tone.

Product Brochure Format

  • History – The product brochure format came about as businesses wanted a web presence to support their sales operation. Originally these sites were fairly static web sites that reproduced the sales information that already existed in brochure form.
  • Infrequent Updating – Most of these sites were static sites. It was commonly understood that if you wanted current information you need to call them on the phone. Many business site have since migrated to dynamic content. FAQs became an easy and quick way to support customers after the sale.
  • Primarily a formal tone – For the most part the tone used by these sites can be described as professional.

So how does WordPress and phpWebSite stack up in these areas?

  1. WordPress
    • The origin of WordPress is as a blog and it is one of the best blogs out there. It has a great development community out there.
    • WordPress has shown a lot of versatility and has expanded into the magazine format. Here is an example of the magazine format, Darren Hoyt Dot Com » Blog Archive » Mimbo v1.1 Released.
    • Although you can use WordPress as a simple product brochure or Internet sales site, it does not scale up as well as other packages. A few months ago I wrote a post in which I said that a nonprofit with a “product brochure” styled site might be better served by going to a more conversational format.
  2. phpWebSite
    • The blog portion of phpWebSite was originally called Announcements. phpWebSite can function as a blog but WordPress is free and a better blog.
    • The magazine format is probably the best use for phpWebSite. The “What’s Related” feature is a great feature. Similar features can be added in WordPress via plugins. I think that articles and calendars are the areas of with the greatest potential over WordPress but the phpWebSite development community is more limited.
    • Like WordPress you can use phpWebSite as a simple product brochure site but it does not scale up as well as other packages. Using the template system for product brochures is tempting because it may integrate the key data while allowing it a bit more scalability.

So there you have it. Both WordPress and phpWebSite are pursuing the magazine formats but phpWebSite is a more natural fit for the magazine format at this time. WordPress has a much larger development community but it has many diverse interests. The primary interests for WordPress is the blog format so it is hard to tell who has the better development community in the magazine format area.

Creating a new theme for phpWebSite 1.3.0

I finally bit the bullet and decided to create a new theme for the new version of phpWebSite. Part of my problem with starting this project is that I think that WordPress might be a better solution for these web sites. One of the big advantages that WordPress is an abundance of good looking, standards compliant themes. It probably would not be that hard to migrate one of the old phpWebSite sites into WordPress. The other site has a couple of features that would require a lot more research so I opted to proceed with the theme redesign project.

In a previous post I talked about the “Blueprint: A CSS framework”. I would like the new theme to most like Misty Look. In a previous post I mentioned that I have used this for a charity blog in the past. For kicks I want try out the Copyblogger theme, too. I also want to add jQuery support so that I can use ThickBox. So here is my plan.

Phase 1

  1. Create a new theme which merges Blueprint into the default phpWebSite theme.
  2. Fix phpWebSite annoyances.
    1. I will create new module templates to replace the <h1> element with the more search engine friendly <h2>.
    2. See if I can create a list menu template of <li> links.
    3. Create a tabbed menu for the new site. I want to keep the tabbed menu design from the old site.
    4. Change the calendar colors and layout.
  3. Add zebra tables, drop shadow, and ThickBox support.
  4. Redesign comment template to be more like copyblogger.
  5. Evaluate Article 4.0 module.

Status

At this point I have a workable replacement for the original site. Most of the stuff works but I am still checking it out. I have not made the changes to the comment template, the list menu template, or checked the new version of Article. I will probably be updating to the latest version(1.3.0) of phpWebSite on the demo site in the next couple of days. To view the results go to my demo site at http://demo1.wehuberconsultingllc.com/.

Phase 2

Now it is time for me to separate the specific theme data from the common theme data. I expect to create four theme variations and a theme to display a design grid.

  1. Default Blueprint
  2. Misty Look
  3. Copyblogger
  4. Copyblogger organic.
  5. Display grid

Phase 3

Convert the old data into the new phpWebSite format.

Installing/Updating WordPress with Subversion « WordPress Codex

Installing/Updating WordPress with Subversion « WordPress Codex

This is a neat way to keep my local copy of WordPress updated. I use the local version primarily to check theme changes and plugins.

  1. First I backed up my blog folder.
  2. Then I used TortoiseSVN to checkout a copy from http://svn.automattic.com/wordpress/tags/2.2.1/ to setup the blog folder with a clean version of WordPress.
  3. Then I copied the backup copy of my config data, plugins folder, and themes folder into this directory.
  4. Then I used the “Switch” command to update this version to the http://svn.automattic.com/wordpress/tags/2.2.2/ version.
  5. Finally I ran the upgrade.php file to make sure the database was updated.

This is a relatively painless way to make minor upgrades. Technically this should work for pretty major upgrades, too!

NotePad++ – Load config.xml failed

Recently I noticed an error when starting NotePad++, “Load config.xml failed”. NotePad++ proceeded to work with a slightly different skin but this error was annoying. The problem started well after my latest version upgrade so I am not sure what triggered the problem. I have been successful running the latest version of Notepad++ so I was pretty sure this problem would go away when they issued the next version. Today I finally got annoyed enough to fix the problem. The config.xml file in the Application Data folder for my profile had a zero length. I copied over a config.xml from the NotePad++ directory under Programs Files. This post in the sourceforge forum says about the same thing, http://sourceforge.net/projects/notepad-plus/forums/forum/331754/topic/1465204?message=4294797.

Blueprint: A CSS Framework

Blueprint is a CSS framework, which aims to cut down on your CSS development time. It gives you a solid CSS foundation to build your project on top of, with an easy-to-use grid, sensible typography, and even a stylesheet for printing.

Blueprint: A CSS Framework

I saw this a couple of days ago and decided this may be just the trigger to get me to redesign an old phpWebsite theme. The old theme works but it is kind of quirky since it started out as a table based layout theme. It could benefit from a redesign from the ground up. I have been yearning to redesign and clean up the theme for some time. Most of my theme ideas come from WordPress Themes so I was looking at porting one or more WordPress themes I like over to phpWebsite. It is debatable whether it makes sense to port over the themes since I could recreate the site in WordPress in about the same amount of time. I will mull over this a little while longer.

Adding RSS content to Outlook Today using jQuery

Customized Outlook Today
I decided to customize my Outlook Today page with jQuery. The change was pretty simple. My plan was to add the current weather forecast available from Yahoo via a RSS feed. The source for my inspiration was this post by Jean-François Hovine.

The only annoyance is that I get a popup window because I am accessing content in another domain. After a little bit of work this is what I ended up with.

Featured Windows Download: Bowl over corrupt installations with Windows Installer CleanUp Utility

Windows only: Freeware utility Windows Installer CleanUp Utility can remove Windows Installer configuration information from applications that refuse to install. Microsoft created the Windows…

Featured Windows Download: Bowl over corrupt installations with Windows Installer CleanUp Utility

I heard of this utility awhile back but quickly forgot about it since I did not have a use for it at the time. Today I have a use for this utility.

Featured Windows Download: Automate free software installations with Win-Get

Windows only: Freeware command line utility Win-Get is a Windows version of the popular Linux command line tool, apt-get. Win-Get can automate the installation of freeware applications with a simple…

Featured Windows Download: Automate free software installations with Win-Get

It may be useful. I am not sure right now.

Report to California Sec. of State Details Security Flaws in eVoting Systems (July 27, 28, & 30 2007)

A review of electronic voting systems commissioned by California Secretary of State Debra Bowen has been released, and the results are “not encouraging…….

Report to California Sec. of State Details Security Flaws in eVoting Systems (July 27, 28, & 30 2007)

This link will take you to the article on SANS site. If you want to read the actual report, click on the link below.

http://www.sos.ca.gov/elections/elections_vsr.htm

FileZilla Forums :: View topic – always get "empty directory listing"

From
http://filezilla.sourceforge.net/forum/viewtopic.php?t=3841
(I haven’t registered on the forums, I use FileZilla Server very rarely. 😉
I had similar trouble. Comodo firewall, and no files showing in the directory listing.
This is while connecting to the server running on my computer, from an FTP client running on my computer (I tried Filezilla, and Firefox).
What fixed it for me is this: I went into Comodo Firewall. In the Application Monitor entry for Filezilla Server.exe, right click, choose “Edit…”, Miscellaneous tab, and check “Skip advanced security checks”.
After that, I’ve been able to see the files in the directory.
Could you post this there for me, please?
– AshyRaccoon

FileZilla Forums :: View topic – always get “empty directory listing”

I do not know what happened exactly but my FTP server was not working. A FTP client connected but showed a blank directory listing. I was kind of hoping for an error message but no luck. So I checked my Comodo firewall. It looked like my Comodo firewall had updated itself but everything looked pretty normal in Comodo. I could see the FTP connections. So I checked the XAMPP installation. I recently updated it but the Filezilla portion was unchanged except for the configuration file. Everything should work but it didn’t. Finally after some fruitless troubleshooting I found this article. I changed the inbound rule to “Skip advanced security checks” and everything is back to normal.

Just when you thought it was safe to go out alone in the Linux world …

NIC Broadcom AC 131 not properly detected – Ubuntu Forums

we are also having problems with the Shuttle SS31T, we can boot from a live CD and install the OS to a IDE hard drive but the NIC and SATA are not recognised?
Do you have any tips on how to get the NIC and SATA devices working?

NIC Broadcom AC 131 not properly detected – Ubuntu Forums

I bought a Shuttle SS31T this week for a non-profit. I am turning it into a cheapo M$ terminal server. The nonprofit has lots of dumb PCs(aka Win98) but not a real PC(i.e. something made in the last 3 years) to be found.

The SS31T is a cute box and the price with a 940 D, disk drive, and a gig of memory is attractive. To make sure that everything was connected properly I booted Ubuntu’s LiveCD. Everything looked fine except for the minor details that it was not talking to the LAN and it did not see the SATA drive. The Ethernet link light was on at the back of the PC but no traffic made it through. Next I booted FreeDos. At least it could see the SATA drive. In a panic I installed a trial version of XP since my 2K3 is in transit. Whew it worked! All of the problems in the Device Manger cleared up when I installed the Shuttle drivers.

Bill’s Grand Adventure

I finally got motivated to resuscitate my Ghettobox2006. It took me a little debugging but I finally got it to recognize my SATA drive. My plan was to use this box as a general purpose Linux box running several VMware guests. The problem was that I could not get the box to boot. This was a strange problem. I had the motherboard working in another case with an IDE drive and a SATA. I moved the motherboard and the SATA drive to a new case and it would not boot. The SATA drive was not recognized by the BIOS and the drive acted like it was not getting power. I wasted a fair amount of time trying to figure out the source of the problem but eventually had to go work on higher priority tasks.

Last weekend I got an idea on how to fix the problem and went back to working on the box. My idea did not work but I did find the problem. The BIOS had the SATA controller turned off. How did that happen? Well, it boots now!

So I was off to the races. Awhile back I decided to use Centos for the host and I had already downloaded a version 5 DVD. I did not have a big reason for selecting Centos besides that I am slightly more familiar with Centos/Fedora/Redhat than I am with Ubuntu and Suse. My installation was a little unusual since I had three partitions on the disk I wanted to keep, a W2K partition, a partition with several existing virtual machines, and an empty partition for a future operating system. I had about 60 GB of free disk space left for Centos. I chose to install the standard Centos Desktop.The installation went smoothly. I was pleased to find out that I could still boot to the W2K partition from GRUB if I wanted to. Dual booting Linux and Microsoft used to be so funky.

Along the way I found a solution for an interesting Java problem. After I finished installing the operation system, I cranked up the web browser and Firefox told me that I needed the Java plugin. Reluctantly I downloaded the plugin and installed it. The Java plugin installation is about as dorky as it comes. Been there…done that…you mean I have to do this again. This is one area that Windows really shines over Linux. Surprise…surprise the Java plugin did not work. To complicate the matter there was no error message either. I was a little annoyed so I tried to open the Java control panel. It did give me an error message. It could not find libstdc++.so.5. A quick search of the Internet found two potential solutions. I could either install a symbolic link to libstdc++.so.6 or install compat-libstdc++-33. I installed the compat library since it may fix other problems I do not know about yet. I just want the standard stuff to work without a lot of fiddling. Sometimes that can quite a challenge. Now when I validate the plugin at the Java site, it worked as expected.

I will talk about my adventures with VMware in another post. I still have some kinks with the networking to work out. I was pleased to find out that all of my virtual machines worked. Even the W2K virtual machine I created using VMconverter worked.

MSKDetct.exe – Application Error – Software – Virus/Spyware – Dell Community Forum

Please follow the instructions below to run the SpamKiller removal tool. This will completely remove SpamKiller from your computer.
Download and save the MSKCleanupTool.exe to your desktop.
Locate MSKCleanupTool.exe on your desktop and double-click to launch.
to download MSKCleanupTool.exe, type the link in your URl address bar:
http://download.mcafee.com/products/licensed/cust_support_patches/MSKCleanupTool.exe

MSKDetct.exe – Application Error – Software – Virus/Spyware – Dell Community Forum

The Comodo firewall reminded me that the standard uninstall of McAfee does not completely remove everything. MSKDetct tried to call home. I dread uninstalling virus checking programs because sometimes they don’t work. You can create a real mess with a “bad” uninstall. I downloaded the cleanup program to remove the leftovers. The log file confirmed that most of the product was already gone. There were only a few leftover programs. So far so good!

Template Menu for Word

Today I was reading the SBS Diva’s blog about a custom toolbar menu she has been using in Office 2003 for ten years. It sounded like a great idea for the Word 2003 templates I use to create business letters. My basic template prompts me to select a name from my Contacts in Outlook 2003 and then a small macro fills in the name and address fields in the letter and envelope. The template is a real time saver for me so I have created three versions of the same basic template with different letterheads and footers. I suspect this menu will be helpful if you have three or more templates you need to use on a semi-regular basis.

Recently I have been writing more letters so I am naturally interested in saving a few steps in bringing up the template. My natural work flow is to start Word, click on File-New, and then click on one of the recently used templates. This is not too bad but a custom toolbar menu is a little more intuitive and quicker. Here is how I created my toolbar menu.

  1. The first step is to create a macro that loads the template. I recorded a macro since my VBA memory is fuzzy. The macro has only one command in it so you may want to create the module from scratch and save it in the normal.dot.

    Documents.Add Template:= "\\srv1\Users\whuber\My Documents\Templates\WEHC Ltr.dot",_
            NewTemplate:=False, DocumentType:=0

  2. To create the custom toolbar, click on View-Toolbars-Customize menu item. A Customize popup window will appear. Click on the New button to create the custom toolbar. I called my toolbar, My Templates.
  3. Now we are going to place a menu in the toolbar. With the Customize popup still open click on the Commands tab. Go to the bottom of the Categories list and click on New Menu. In the Commands area drag and drop the New Menu command on to your newly created toolbar.
  4. Now we are going to fill in the menu items. The first thing we have to do is to go over to the toolbar and click on the New Menu icon to open the menu up. Go back to the Customize popup and click on the Macros item in the categories lists. You should see the macros you have created in step 1. You can now drag and drop the macros on to the open menu in your custom toolbar. When you have all of the menu items created you can now right click on the menu items and change the menu labels to something more descriptive.

I think I spent more time writing about how to create the menu than actually creating the menu. Oh well! Enjoy!

Sortable and Selectable Zebra Table Widgets

I decided to add zebra tables to a phpwebsite recently and used the version from the link below.

Sortable and Selectable Zebra Table Widgets

It took me a little while to accomplish since I needed to convince phpwebsite to not strip out the <thead>, <tbody>, and <tfoot> tags. Not many people use these tags so phpwebsite removes them unless you modify the configuration. To get the table to work I used both the ID and CLASS elements on the table tag. I used both the<thead> and <tbody> tags in the table although I think only the <tbody> tag is required.

  Pos Artist Trackname
 


1 Lost In The Plot The Dears
2 Poison The Constantines
3 Plea From A Cat Named Virtute The Weakerthans
4 Can’t pick me! No sir!
5 Living Room Tegan And Sara
6 Can’t pick me either Nope
7 Fast Money Blessing King Cobb Steelie
8 Sore Buck 65
9 Love Travel Danko Jones
10 You Never Let Me Down Furnaceface

WordPress 2.2.1

WordPress 2.2.1 is now available

WordPress 2.2.1

You can read the rest of the post for the details. I ran Winmerge against the new version and the old version. It showed that 40 files are changed and two files were added. It looks like an upgrade that lends itself to upgrading just the changed files. I have an interest in the changed files since I keep my websites in a Subversion repository.

In the past Mark on WordPress posted a zipped version of just the changed files but he appears to be busy with some personal issues like a new job and a wife. I actually used Winmerge to create a zipped file of just the changed files to see if it would work. It did. Mark had a different procedure. I may modify my upgrade procedure to use a zipped file after I do a little testing.