Jay Drummond's - Blog http://drummondsoftware.com/blog WordPress weblog Sat, 11 Sep 2010 13:09:56 +0000 http://wordpress.org/?v=2.8.4 en hourly 1 Don’t have programs open in Ubuntu during system update… http://drummondsoftware.com/blog/2010/09/11/dont-have-programs-open-in-ubuntu-during-system-update/ http://drummondsoftware.com/blog/2010/09/11/dont-have-programs-open-in-ubuntu-during-system-update/#comments Sat, 11 Sep 2010 13:09:56 +0000 Administrator http://drummondsoftware.com/blog/?p=195 Ran into an issue because I wanted to work on my computer while a system update was going on. I had the browser open and was making database changes in my LAMP environment.

I was using phpMyAdmin to create a new table. I did that and closed the browser (without logging off) and rebooted after the kernel update.

Then logged back into phpMyAdmin to make more changes. The signin page came up fine. I entered my credentials and I was greeted by the following error:

phpMyAdmin – Error

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

phpMyAdmin - Error

phpMyAdmin - Error

A quick search and I found an article that gave me the clue I needed:

As Root:

root@jdrummond-laptop:~# cd /var/lib/php5
root@jdrummond-laptop:/var/lib/php5# ls -l
total 40
-rw------- 1 www-data www-data 37673 2010-09-11 08:25 sess_f3pq4jcastnul23laj48ot92684u414p
root@jdrummond-laptop:/var/lib/php5# rm sess_f3pq4jcastnul23laj48ot92684u414p

Looks like a session got stranded in the folder and had some bogus data in it.

To fix this I removed the old session file and then phpMyAdmin was able to make new session files with no problem.

Here’s what the directory looked like after I got rid of the session that was blocking my login, and was in fact logged in.

root@jdrummond-laptop:/var/lib/php5# ls -l
total 76
-rw------- 1 www-data www-data 17305 2010-09-11 08:31 sess_5jc4klqbfsp5r53s7410n61o64dchjot
-rw------- 1 www-data www-data 34934 2010-09-11 08:31 sess_f3pq4jcastnul23laj48ot92684u414p
-rw------- 1 www-data www-data 17305 2010-09-11 08:31 sess_tgfla0dqoj33m2mrqvm08r7t3npvhhsh

If I hadn’t had files open during the update, I could have saved some headaches. Moral of the story is. Close all programs before updating your Ubuntu system.

References:
http://www.electrictoolbox.com/phpmyadmin-cannot-start-session-without-errors/

]]>
http://drummondsoftware.com/blog/2010/09/11/dont-have-programs-open-in-ubuntu-during-system-update/feed/ 0
World Community Grid Statisics http://drummondsoftware.com/blog/2009/09/28/world-community-grid-statisics/ http://drummondsoftware.com/blog/2009/09/28/world-community-grid-statisics/#comments Mon, 28 Sep 2009 13:27:06 +0000 Administrator http://drummondsoftware.com/blog/?p=185 mygridprogress20090928

mygridprogress20090928

]]>
http://drummondsoftware.com/blog/2009/09/28/world-community-grid-statisics/feed/ 0
Java Training Course Development Platform http://drummondsoftware.com/blog/2009/07/19/java-training-course-development-platform/ http://drummondsoftware.com/blog/2009/07/19/java-training-course-development-platform/#comments Mon, 20 Jul 2009 01:36:33 +0000 Administrator http://drummondsoftware.com/blog/?p=135 This post hold information about a VMware image that I created for a report that I am working on in my Technical Communications course at Capella University. The report is on Java training for beginners. This image contains software that is pre-installed on a student’s classroom PC. For those who don’t have access to the physical classroom, this image can be used to follow along with the course.

System Requirements
– 2 gigs of RAM
– 10 gigs of hard drive space

Windows or Linux – the VMware Player. Free.
Mac OSx – VMware Fusion. Free 30day trial.

The software list follows:
This starts with a LAMP setup. LAMP is an acronym for Linux, Apache, MySQL, and PHP. This combination of software is a common configuration for running PHP web applications. This has little to do with running Java, but does allow phpmyadmmin to be run. This is a web based MySQL database administration application. It’s easy to use and popular for administering a database from a remote site.

Ubuntu 8.10 – updated July 18th with all patches and fixes.

Apache 2.0 – web server

MySQL – version 5.0 – Version 5.0.67-0ubuntu

PHP version 5 – a web application programming language.

phpmyadmin – A PHP based web application for administrating MySQL

Eclipse Europa. – This is the base version of eclipse with few plugins.

JBoss Developer Studio Community Edition – If you like this version the release is available for a mere $99 from here.


jre 1.6.0 update 14

Installed to /usr/java/jre1.6.0_14

Java EE 5 SDK with jdk 1.6.0 update 14
Installed to /usr/java/SDK

Subversion version 1.5 – a source code control system.

subclipse version 1.4 – integration of subversion into eclipse.


To gain access to the VMware image, send me an email and ask me for the username and password.
Download the VMware Appliance here: Download
File size: 2,271,743,211
The md5sum sum: eb36f88c6bcdd06c8b46d204c580cf3e


Once the file has downloaded, extract the files contained in the Ubuntu.tar.gz archive. To do this, on windows use winzip. On Linux and MAC use tar like this: tar -xvf Ubuntu.tar.gz

Inside the archive are two files.

  1. Ubuntu-disk1.vmdk
  2. Ubuntu.vmx

Next run the VMware player. Once the program loads, click “Open Existing Virtual Machine”, and browse to the directory where you extracted the files from the archive. Select UBuntu.vmx and click Open.


]]>
http://drummondsoftware.com/blog/2009/07/19/java-training-course-development-platform/feed/ 0
World Community Grid – tracking http://drummondsoftware.com/blog/2009/05/20/world-community-grid-tracking/ http://drummondsoftware.com/blog/2009/05/20/world-community-grid-tracking/#comments Wed, 20 May 2009 17:41:15 +0000 Administrator http://drummondsoftware.com/blog/?p=120 Just a quick note to record the amount of computing time donated to the World Community Grid. Donated time now exceeds two years.

My Stats:
Total Run Time (y:d:h:m:s) (Rank) 2:007:14:13:45 (#20,079)

My Stats to World Community Grid

My Stats to World Community Grid


Team ranking NCC-1701 is:
Total Run Time (y:d:h:m:s) (Rank) 2:043:15:47:53 (#5,035)

NCC_1701 Team Stats - World Community Grid

NCC_1701 Team Stats - World Community Grid

]]>
http://drummondsoftware.com/blog/2009/05/20/world-community-grid-tracking/feed/ 0
My Favorite Linux Distro – Ubuntu http://drummondsoftware.com/blog/2009/03/29/my-favorite-linux-distro-ubuntu/ http://drummondsoftware.com/blog/2009/03/29/my-favorite-linux-distro-ubuntu/#comments Sun, 29 Mar 2009 15:45:33 +0000 Administrator http://drummondsoftware.com/blog/?p=98 One of the people I worked with a National City Bank (now a part of PNC) turned me on to Ubuntu. Thanks Kirk!

While I wasn’t a big fan right from the start, I’m a big fan now. The first version I saw was Version 6.10 (Released October 2006). I was very much into CentOS at the time and so there was some resistance to the adoption of another OS when I was happy with what I had. Even today, I still use CentOS for firewall machines and machines that are used for DHCP, DNS caches, and the like. Ubuntu has become an operating system that I use for desktop systems.

I’m not an operating system zealot. I don’t have a problem with people using Windows. I still run windows too. It really makes sense for companies, who have a diverse work force with many different levels of user expertise. Companies have adopted Windows and they have invested in it. It’s typically behind the corporate firewall and everyone is used to it. For people with broader computing horizons, I encourage you to try kicking the tires on Linux.

I’ve setup desktops, laptops, and servers with Ubuntu. I find the documentation and software support forums to be an outstanding reason that the platform has succeeded.

Here are some of my favorite Linux Resources:


Ubuntu Announcements:



]]>
http://drummondsoftware.com/blog/2009/03/29/my-favorite-linux-distro-ubuntu/feed/ 0
SEAM In Action – MySql DDL http://drummondsoftware.com/blog/2009/03/06/seam-in-action-mysql-ddl/ http://drummondsoftware.com/blog/2009/03/06/seam-in-action-mysql-ddl/#comments Fri, 06 Mar 2009 11:29:22 +0000 Administrator http://drummondsoftware.com/blog/?p=22 I have been going through the book “SEAM in Action” by Dan Allen.

I typically use MySQL databases and so I created the example database that is used in the book. Download it here: open18-mysql.tar.gz

While going through the book, I also chose to use JBoss Developer Studio (Version 2.0 CR2 beta). Some of the SEAM Gen, generated code is a bit different than what the Author shows in the book. For example, some of the fancier editing of referentially defined data doesn’t seem to be present. I don’t know if this is because of my DDL or the SEAM generating that’s available in JBoss Developer Studio.



]]>
http://drummondsoftware.com/blog/2009/03/06/seam-in-action-mysql-ddl/feed/ 0
ANT Tasks for RetroGuard http://drummondsoftware.com/blog/2009/03/05/ant-tasks-for-retroguard/ http://drummondsoftware.com/blog/2009/03/05/ant-tasks-for-retroguard/#comments Thu, 05 Mar 2009 11:00:33 +0000 Administrator http://drummondsoftware.com/blog/?p=31 I found this really cool thing known as RetroGuard java byte code obfuscation. Except that, I wanted to be able to call it from an ANT task. So I wrote some ANT tasks to allow RetroGuard to be invoked. Now I can make obfuscated code from any part of my build process.

I had these available for download, but noticed that the RetroGuard folks integrated my code into their deliverables, pretty much line for line. So if you need this, you can just download from the RetroGuard site: RetroGuard java byte code obfuscation.

I had asked them to acknowledge my contribution, but so far they haven’t.



]]>
http://drummondsoftware.com/blog/2009/03/05/ant-tasks-for-retroguard/feed/ 0
World Community Grid http://drummondsoftware.com/blog/2009/03/04/world-community-grid/ http://drummondsoftware.com/blog/2009/03/04/world-community-grid/#comments Wed, 04 Mar 2009 21:42:50 +0000 Administrator http://drummondsoftware.com/blog/?p=67 Have you ever heard of the World Community Grid? No? Well check it out. This is a non-profit organization, whose mission is to create the largest public computing grid benefiting humanity. This grid computer has processing power that rivals the largest super computer. This allows scientists to solve problems that will aide humanity.

The best part is, that anyone can help. You simply, install a screen saver and donate your idle computer time.

Here is a short list of projects that are active as of this writing.

  • The Clean Energy Project
  • Nutritious Rice for the World
  • Help Conquer Cancer
  • Discovering Dengue Drugs – Together
  • Human Proteome Folding – Phase 2 Project
  • FightAIDS@Home Project

I am a proud donator of computing power to the World Community Grid. Here are a few of my stats.

Help Conquer Cancer

Do you know someone who has been effected by cancer? I recently lost my father-in-law to lung cancer. If you have been effected directly or indirectly by cancer, then Join The Grid Now!

Please join the grid and change the world. If you start donating computing power as a result of this article, then please join my team. NCC-1701



]]>
http://drummondsoftware.com/blog/2009/03/04/world-community-grid/feed/ 0
HOW TO – merge Spring Framework and COMMONS Chain ( “Chain of Responsibility” ) http://drummondsoftware.com/blog/2009/03/03/how-to-merge-spring-framework-and-commons-chain-chain-of-responsibility/ http://drummondsoftware.com/blog/2009/03/03/how-to-merge-spring-framework-and-commons-chain-chain-of-responsibility/#comments Tue, 03 Mar 2009 22:20:00 +0000 Administrator http://drummondsoftware.com/blog/?p=10 Jakarta Commons Chain project is a gang of four design pattern for “Chain of Responsibility”.

Spring Framework is an open source project that is hosted on Source Forge. It can be summed up as a framework that implements the factory pattern who’s objects are configured with XML documents.

This white paper shows how these two frameworks can be used together. So if you already use Spring and want to add Commons Chain, or if you use Commons Chain and are not quite happy with the supplied catalogue for creating a chain. Then read on.


Goal:

Build some simple examples, step by step, that will allow an understanding of how you can combine Jakarta Commons Chain objects and the Spring Framework. At the completion of these examples you should be able to create Commands and Chains along with your other Spring managed objects.

Prerequisites:

  • This paper assumes a basic knowledge of Java and Eclipse.
  • You should have Eclipse and an Java SDK installed and working.
  • Download the binary distributions of the Spring Framework (the one with dependencies) and Jakarta Commons Chain and unzip them into a directory. This white paper uses the Spring Framework version 1.2.3 and Commons Chain version 1.0.
  • Other jars needed: log4j, Commons Collections, Commons Pool, Commons Dbcp, Commons Lang, and MySql JDBC driver.

Create a project to build examples:

Start your Eclipse IDE and open a workspace where we can create a project to start playing with Spring and Chain frameworks.

Call the project SpringChain as shown in figure 1. Then click next and click "add Folder" to associate a source directory called src with the project. When prompted for the "New Source Folder" type src as the folder name and click OK. Answer yes to the dialog about using a SpringChain/bin directory as the output directory. Your project should look like this now: figure 2. Click Finished.

Add external jar file references to the project. Right click on the
SpringChain
project in the Java perspective. Click properties. In the dialog for the "Properties for SpringChain ", click the "Java Build Path" item and then the libraries tab. Your screen should look like figure 3. Click the "Add External JARS..: button. Add the following jar from the Commons Chain distribution " commons-chain-1.0.jar" Add the following jar from the Spring Framework distribution, spring.jar. Also add the other jar files mentioned in the prerequisites. Your project properties should look something like figure 4. Click OK.

Install the sample code:

Download the samples and unzip into the SpringChain project that you created. Click here to download. Right mouse click on the project and select refresh.

Each sample is contained in it’s own package. In each package you’ll see a class called, RunSample. This class has a main entry point to run the the sample.

Hopefully, you now have a project that looks like the one below:

Project Look

Sample 1 – A simple command:

This sample will show how to create a simple command and execute it after creating it through spring.

First let’s setup Eclipse to debug our Sample.

Open sample1 package by clicking the plus to the left of the package name. Right mouse click on the RunSample source file. From the context menu that pops up, select "Debug As …" then select "Debug". With the "Java Application" item selected in the configurations window, click New. See below:

In the dialog that appears next, check the stop in main option.

Setup log4j logging. Click the Arguments tab. Add the following line to the VM Arguments.

-Dlog4j.configuration=file:///${project_loc}/log4j.xml

See below.

Click debug to step through the sample.

Now back to the sample code. The following files are found in this sample:

HelloWorld – a class that implements a Command interface. This will be created with the spring framework.

RunSample – a class that loads the Spring configuration file.

beans.xml – the Spring configuration file that defines the beans that are going to be created in the sample.

 

Beans.xml defines the Command as follows:

<?xml version="1.0" encoding="UTF-8"?>
       <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

       <beans>
 <bean id="testBean" class="com.drummondsoftware.sample1.HelloWorld" singleton="true">
 </bean>
</beans>

As you can see there’s nothing complex about creating HelloWorld. Just define the bead id and the class.

The HelloWorld class is simply going to print the message "Hello World" when the command executes.

public class HelloWorld implements Command {
 String message = "Hello World"; 
 /* (non-Javadoc)
   * @see org.apache.commons.chain.Command#execute(org.apache.commons.chain.Context)
   */
   public boolean execute(Context arg0) throws Exception {
   System.out.println(message);
   return true;
   }
 }

The RunSample class will initialize the spring framework and then pass control the an exec method where the spring factory creates a Commons Command and executes it.

public class RunSample {
 private XmlBeanFactory factory;

 /**
 * here's where the fun starts
 *
 */
 private void exec() {
   Command cmd = (Command) getFactory().getBean("testBean");

   try {
    cmd.execute(null);
   } catch (Exception e) {
    e.printStackTrace();
   }
 }

 public static void main(String[] args) {
   XmlBeanFactory factory = new XmlBeanFactory(new FileSystemResource("src/com/drummondsoftware/sample1/beans.xml"));

   RunSample loadSome = new RunSample();
   loadSome.setFactory(factory);
   loadSome.exec();
 }

 

Sample 2 – Chains:

This sample will show how to put commands together into chains. The chains also get created from Spring.

Start by setting up Eclipse for debugging this sample just like was done in Sample 1.

 

In the Beans.xml we define 4 commands that will be chained together.

Command 1 – 3 are simple commands. They simply log the classname to the logger.

Command 4 is a command that creates another command or chain and runs it. The chainName is set by Spring when the command is created.

Now let’s examine a chain definition. Lines 14 through 21 of Beans.xml define test Chain object. This is shown below.

The class in this definition is a Commons Chain class. It’s the ChainBase class that holds a list of commands to be run. The list is specified in a Spring constructor definition. This simply makes reference to the commands we defined earlier. So when testChain runs it will call command1 followed by command2.

testChain2 – is similar to testChain.

testChain3 – runs a command and then runs testChain and testChain2. This shows that chains can be added to a chain.

testChain4 – runs command4 which is the indirect chain runner.

RunSample shown below simply loads the spring configuration file and run the chains in order:

 

Sample 3 – Contexts and datasource:

This sample will show how to add context class creation to the Spring beans definitions. I also have add a datasource to the mix to show how easy it is to use other Spring objects in your commands.

Start by setting up Eclipse for debugging this sample just like was done in Sample 1.

In the Beans.xml we define the same 4 commands that will be chained together. Command 2 gets a datasource.

Two contexts are defined. Both of these are the Common Chain base class implementations. The spring framework loads the context object up with keyword value pairs contained in a Map.

The Chains defined in the Beans.xml file are unchanged from the last sample.

The RunSample class initializes the Spring factory. It also loads a property file that configures the datasource connection settings.

Control is passed to the exec method where now the context objects are created and passed into the chains when they are run.

Step through this sample and watch the trace output.

Hopefully this helps you get a quick start into use of Commons Chains and and Spring framework together.

 
 
Table of Contents
   
   
]]>
http://drummondsoftware.com/blog/2009/03/03/how-to-merge-spring-framework-and-commons-chain-chain-of-responsibility/feed/ 0
My first blog post http://drummondsoftware.com/blog/2009/02/25/my-first-blog-post/ http://drummondsoftware.com/blog/2009/02/25/my-first-blog-post/#comments Wed, 25 Feb 2009 12:43:20 +0000 Administrator http://drummondsoftware.com/blog/?p=5 I’m leaving the default Hello World blog entry that the install process created for posterity.

The main things that I’m going to blog on about will be technical in nature. Archetypes of things I’ve learned along the way. A few tips and techniques thrown in for good measure. Notes that I make while setting up systems or installing software. I will also move my white papers content over to this blog. I’ve opened the blog up for comments too, so If you see something that could be improved or that you think is incorrect, please feel free to post a comment about it. I ask that you be professional in all comment posts, and I’ll remove anything that would be offensive to readers. If there’s too much junk that gets posted then I may restrict things down the road.

A bit about me. Check out my LinkedIn public profile and of course DrummondSoftware.com

- Check back for more posts -



]]>
http://drummondsoftware.com/blog/2009/02/25/my-first-blog-post/feed/ 0