Posted on 14 Comments

the import org.junit cannot be resolved in Eclipse

When creating a Java project, or importing an existing Java project, that uses JUnit tests in Eclipse, you may run into the error message:

the import org.junit cannot be resolved

The error results when properly attempting to import JUnit with lines like the following:

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

The error occurs because the JUnit library has not been configured for the project, but can be resolved using the following steps.

1. Right click on the Java project and select Build Path > Configure Build Path.

2. Click Add Library.

3. Select JUnit, then click Next.

4. Now select the latest version of the JUnit library, then click Finish.

The error should now be resolved.

 

Posted on 1 Comment

Replace WordPress Cron Job with Linux Crontab

If WordPress Cron Job isn’t getting triggered on-time, which is common if the blog does not get a lot of traffic, WordPress cron can be setup to use a real Linux crontab to make it trigger on-time. If you don’t have access to the Linux command line for your server, then ask your webhost to setup this up for you.

In wp-config.php disable WP Cron:

Open a Linux terminal command line window and enter:

Now press the i key to insert a new line and paste the following with your domain name:

Now press the Esc key, and then the keys :wq, and enter, to save your changes.

This will fire the cron every 2 minutes.

Posted on Leave a comment

WordPress Plugin Installation

WordPress Plugin Installation

Installing a commercial paid-for plugin from a zip file for the first time can be a little confusing. A WordPress plugin installation from a zip file using the WordPress dashboard is quite simple once you know how. This guide should prove helpful, but it is not for WordPress.com customers, it is only for self hosted installations of WordPress from WordPress.org.

WordPress Plugin Installation Add New Plugin

 First go to Plugins > Add New.

Upload WordPress Plugin

 The search link is to find free plugins on WordPress.org. Click on the Upload link.

Select WordPress Plugin File

Now select the plugin zip file to install.

Safari Preferences

 

If you don’t see a .zip file, but only see a directory you will not be able to complete the installation until you find the zip file. If you are using the Safari web browser, go to Safari > Preferences.

Uncheck Safari Open Files

 Under the General tab of Safari preferences, Uncheck the box for Open “safe” files after downloading… This will prevent Safari from opening the plugin zip file after it is download, so it will remain a zip file that can be uploaded to WordPress, and will not be converted to a directory that cannot be uploaded to WordPress.

Install WordPress Plugin Button

 Once you have selected the plugin zip file click the Install Now button.

WordPress Plugin Installation Activate Plugin

If the installation completed successfully you should see the screen above. All you need to do now is click the Activate Plugin link.

WordPress Plugin Activated

Now you can edit the plugin settings. The plugin settings can be under Settings, have their own top level menu link and icon, or the settings could be under another top level menu item. Consult your plugin’s documentation for more information about the configuration settings for your plugin.

Posted on 4 Comments

Prevent Duplicate Form Submissions with jQuery

Some shopping cart forms will allow buyers to click the buy/submit button more than once, resulting in multiple charges to the same person, and irritation. There is a simple way to prevent duplicate form submissions using jQuery. This script prevents a form from being submitted twice, except when using Firefox 3.x, which will submit the form no more than twice if the visitor is clicking the submit/buy button repeatedly.

Posted on 1 Comment

WordPress Delete All Spam Comments

WordPress comes with the ability to delete all spam comments, but not all the comment types you may want to delete all at once as a batch. This process can be simplified by using phpMyAdmin to execute SQL queries that complete the job quickly, and without the memory overhead WordPress can create when it attempts to process a large number of comments.