Brian Nettles
It's my blog and I share.


 

Archive for the ‘Information Technology’ Category

./java_ee_sdk-5_05-linux.bin: error while loading shared libraries: libstdc++.so.5

Tuesday, September 23rd, 2008

This one stumped me for some time.  I was trying to simply install the Sun version of the JDK onto a VMWare instance of Red Hat ES4 and I kept coming upon this error.  I initially figured it must be a dependency issue and I tried all sorts of things to get it to work.  Later in the day, I tried downloading the JDK without the Enterprise Edition version of Java.  This time when I ran the executable to install the JDK it worked perfectly.  Evidently, the JDK with the EE attached does not want to install on Red Hat ES4.  Hopefully, you won’t need it and the JDK without the EE serves you fine.  What a nasty hidden bug.

Div Tags in Front of Javascript Pull Down Menus

Friday, September 19th, 2008

I was working on a wiki for one of the Quest Communities called http://wiki.activeroles.quest.com.  This wiki is using Media Wiki which is an Open Source wiki built on PHP.  In customizing the look and feel to this wiki to make it look like its parent community site, I ran into an issue with the pull down menus created by the Quest web development team.  The pull down menus worked great.  However, when the menus dropped down, certain of the MediaWiki components insisted on being in front of the pull down menus. 

In resolving the issue, I looked at both the CSS and the HTML layout of the media wiki components which were nothing more than div tags.  I tried to solve the problems by modifying absolute vs relative positioning, modifying the z-index on the various components, and I was really tested on finding the solution.  Then I found it.

The CSS attribute of the dominant div tags included overflow:visible; as attributes.  For some reason, this attribute was forcing the div tag to be on the top layer.

/* overflow:visible; */

Problem solved.

How to Upload Zip Files in Wordpress MU

Friday, September 19th, 2008

One of our Wordpress MU authors complained that he could not upload zip files into his blog post.  I looked into it and discovered that he was absolutely correct.  You try and upload a zip file and you get the following error:

File type does not meet security guidelines. Try another.

So after digging through various discussion forums, blogs, and code, I discover the fix.  It is in the database.

To add uploadable file type extensions, go into the database in the wp_sitemeta table.  The table looks like this:

 meta_id    | bigint(20)   | NO   | PRI | NULL    | auto_increment |
 site_id    | bigint(20)   | NO   | MUL | 0       |                |
 meta_key   | varchar(255) | YES  | MUL | NULL    |                |
 meta_value | longtext     | YES  |     | NULL    |                |

In there you will find a meta_key of “upload_filetypes”.  Add the extension of zip or whatever file extension it is that you wish to upload into the meta_value field. 

Now you should be able to upload that file type without receiving the security error.

By the way, my current version of regular Wordpress has no issue with uploading zip files.  I am not certain why Wordpress MU does not allow it by default whereas regular Wordpress does allow it by default.

Enter pass phrase:Apache:mod_ssl:Error: Private key not found.

Thursday, August 14th, 2008

Okay, so I was installing an SSL certificate using Godaddy.com as the certificate provider. I followed their instructions for generating the key, creating the CSR and downloading and installing the certificate. Then I go to restart apache and apache will not restart with the following error:

Enter pass phrase:Apache:mod_ssl:Error: Private key not found.

On my Redhat machine, I am not even prompted to put in the password. It simply fails on me.

While it would be preferred to find a way to configure the passphrase into the startup files, I am not able to figure out how to do it. However, I do learn that you can eliminate the passphrase from the key file and this is what many on the internet recommend doing. This is the command to eliminate the passphrase.

# openssl rsa -in www.key -out new.key

Thanks MNX Solutions…it took me an over an hour to find you.

http://www.mnxsolutions.com/blog/apache/removing-a-passphrase-from-an-ssl-key.html

OpenBSD 4.3 Gateway - Cannot Ping Outside of Subnet

Friday, August 8th, 2008

So I decided it is time to learn OpenBSD. I have had my head stuck under Windows and Red Hat Linux for some time. I knew eventually it would come to this. I have a need for a new firewall because I don’t want to pay Astaro for support and maintenance. So I have now installed OpenBSD on two machines and both times I ran into the same issue. I cannot ping outside of the Cox Communications subnet. I can ping items within the subnet such as the Gateway and my other firewall, but I cannot ping anything else including the external DNS server.

Setup
I am hooking my OpenBSD directly to the internet as it is intended to become a firewall. During the installation process, I configured one ethernet card for the external network, gave it an IP Address, and a subnet mask. But I could not see where to place the Gateway value.

The network settings given by the ISP were as follows (values changed to protect the innocent):

IPAddress: 81.147.68.133
Subnet: 255.255.255.128
Gateway: 81.147.68.129

To look at my settings, I went to /etc/myhostname.fxp0 which was the name of the file for configuring the network card on this particular machine. This is what it should have looked like.

INET 81.147.68.133 255.255.255.128 NONE

Since I did not know where to put the Gateway, I originally tried variations such as replacing NONE with the gateway address. However, whenever I tested the network, I was still not able to access or ping the DNS or anything outside of the subnet.

Solution
The gateway needed to be added. The file for the gateway did not exist by default. To add the gateway, I had to create the following file:

/etc/mygate

Inside that file, I added the IP address of the Gateway.

After saving the file, I rebooted the machine and now my access to the external network works properly. I can fully access the internet.

What I finally figured out later is that the Gateway address is one of the parameters that you set during the installation. I must have left it blank while I was going through the installation process. However, they did not call it a gateway. They called it something else.

Gallery2 for Web Based Photo Sharing Software

Wednesday, July 30th, 2008

So I have been looking for a solution so that all of the family photos I have taken over the years could be backed up on a server and viewed when desired. I also thought it would be good to make the photos available to all family members who want them. I also thought it would be good to have a place for all extended family members to share their photos if they choose to do so. So I did some research on the internet and found this software package called Gallery2.

Gallery 2 is a php based software package which is perfect for my Linux / Apache webserver configuration. Installation was simple. Adding albums and photos was simple. Changing my header to make it look like the rest of my blog was simple as well.

The software appears to have a lot of functionality that I will never use. But that is okay. All I care about is the basics which it does very well.

In less than one week, I was able to install the software and upload and organize all of my family photos taken over the past 5 years. Go ahead and check it out. Just click on the link in the left navigation called Family Photos.

Confluence Recently Updated not Updating

Tuesday, July 1st, 2008

Ran into this issue where the section on the main page called Recently Updated was not updating. 

The solution was  to go into Administration -> Content Indexing and Rebuild the Index.

The official instructions for Confluence is that if that does not work, then remove the <confluence-home>/index directory, restart the application server and then rebuild the index.

http://confluence.atlassian.com/display/CONF27/Rebuild+index+from+scratch

Using .htaccess to Redirect a Single Webpage

Tuesday, July 1st, 2008

This will be a very simple entry.  If you need to redirect one web page to another web page and desire to get a 301 redirect, you simply add one line to the .htaccess file.

Redirect 301 /old.php http://domainname.com/new.php

If you do not have an .htaccess file, simply create the file in the directory that holds the html page and add that line.

This solution only works for Linux / Unix based servers.  I use it on the Red Hat flavor of Linux machines.

A Quick Wiki Software Review

Monday, June 30th, 2008

My intent in this blog is to help jumpstart someone who is new to wikis and has been tasked to learn or prepare to deploy a wiki. 

1. What is a Wiki?
A wiki is a collaborative tool used to allow a group of people to jointly contribute to a document. Typically, how it works is that say a person wants documentation on a software program. The company will task several individuals to write the documentation. But instead of using Microsoft Word, the IS group puts up a wiki and each of the writers write their content to a wiki page. Now eventually, the jobs of the writers will cross. They may wish to contribute to the pages that the other writers have written because perhaps they know something the original author did not know. The wiki allows all writers to do just that. They can put in thier own two cents wherever they want to in the document.

Now suppose the manager of the document does not like the content of one of the contributors, and he or she feels that the latest changes to the document where really messed up. No problem. The manager of the document will have the ability to roll back the document to any previous version. It is very difficult to break a document in a wiki because the managers always have the ability to take out the trash.

2. Which Software Package is Best
There are some really good potential packages you can use.  This is the list of wikis I have now used.

  • Sharepoint
  • JSPWiki
  • PHPWiki
  • MediaWiki
  • Confluence

Sharepoint - Now Sharepoint is not just a wiki.  Sharepoint is the collaboration tool that Microsoft wants everyone to use.  It is an application that is quite customizable with a lot of out of the box web widgets that can create a really good project managment and organization tool for you.  A Wiki is just one of its available web parts.

Personally, I am quite fond of Sharepoint.  The last opportunity I had to project manage, I used Sharepoint as the team collaboration tool.  All of the writeups for future reference where done with the Sharepoint wiki.  For example, one person was tasked to make this integrate image support into the forums.  After he built the functionality, he had to write up his specifications on a wiki page.  Now, 6 months later, I still have his write up ready for reference.  If things have changed, anyone with access can modify the contents.

The Sharepoint Wiki functionality is good for small groups.  However, it is not near as robust as some of the other available wikis.  What you get is a list of pages and the ability for anybody on the team to edit the page.  There is no further organization of your wiki pages.  If Sharepoint is your existing collaborative tool, I do recommend using it.  However, if you are looking for collaborative wiki for wide scale use with a lot more really useful functionality, I would say that this is not the right tool.

JSPWiki - At first, I was rather impressed with this free open source package built on the Java Platform.  I initially put it up for the Powergui team as a beta to see if it would serve their purposes for a wiki.  We ran into some pitfalls with it.

  • It did not run well on all platforms. It did best in a Linux / Apache / Tomcat environment.  I could not get it to work on Resin.  Lastly, it seemed to cause instability when I combined it on the same tomcat application server with Jive Integrated running on a Windows 2003 server sitting behind IIS. 
  • It was functionality deficient.  You could roll back pages, but it did not have a good diff utility.  Also, you could not set up email notifications for page changes.  The users also complained about the inability to escape certain characters.
  • On the positive side, the support team including Janne Jalkanin ware very helpful even though they were working for free.  My hats off to them.

 Unfortuneatly, we had to scrap using JSPWiki and turn to a different platform.

PHPWiki - After scraping the JSPWiki project, I downloaded PHPWiki and installed it on a Red Hat Linux ES 5.0 server.  This did not go well at all.  PHPWiki required some PHP_DBA functions in order to work.  Those PHP_DBA functions are not in the out of the box RPM installation of PHP on Red Hat.  I searched and searched for the proper RPM packages but could not find it.  In order to get those functions up, I would have needed to uninstall PHP via the RPMs and reinstall php by compiling the source code with all of the required flags to make it work.  That was just too much work for my feeble mind so I said “Screw It”!!!  I have time on my hands, but not that much time. 

MediaWiki - After failing now on two Wikis for the Powergui community, I dug up one called Media Wiki.  Media Wiki claims to be the wiki software used by Wikipedia.  After my frustrations with PHPWiki, this one was a breath of fresh air.  Installation was probably the simplest I have ever seen for any out of the box web application installation.  This wiki is functionality rich having all the items that JSPWiki did not have.  Administration is user freindly.  It has good internationization support as well.  The Powergui Team thus far has been rather pleased with this choice.  I give this application two thumbs up for a wide scale collaborative tool - especially in terms of being an external wiki for documenting a software package.  Also, this software package is a free opensource application.  Nice job!!!

http://mediawiki.org

Confluence - There are certain groups in Quest Software that make use of this Wiki made by Atlassian and I have recently been assigned to take over the administration of this application.  It is a very good platform built on Java and is probably the most functionality rich of all Wikis.  It includes watch support, tree structure organization, rich permission functionality, and even the ability to integrate with your active directory.  It has the best user interface making it simple for anyone to use.  It is very expandable and organizable and works well for large organizations with many teams.  It also supports a rich scripting which for those who have taken the time to learn gives then far greater power at organizing content.   This platform from my perspective is the darling of all wikis.  The only weakness is that it does cost.  Last time I checked it was about $7,500 for an unlimited use external collaboration license.  If that is not a factor to you, you will not go wrong with this one.  http://www.atlassian.com/

In the end, I give two thumbs up for both Media Wiki and Confluence. 

Setup Hibernate in a Swing Application

Saturday, June 28th, 2008

Hibernate works very well in Swing Applications. This page is intended to help you get started in implementing Hibernate with Swing. This particular example is set up in a database environment using Oracle 10g. However, this setup will work perfectly in other database enviroments by simply modifying the database connection information.

 1. Download the latest Version
Hibernate can be found http://www.hibernate.org/6.html. After you download it, make certain you not only place hibernate.jar in you classpath, you may want to include all of the jar files that are found in the lib directory of the extracted files. While many may not be used in your application, some of them are likely to result in runtime errors if not included in the classpath.

 2. Create the hibernate.cfg.xml file.
This is the primary configuration file that should be placed at the root of your source code.

 <?xml version=“1.0″ encoding=“UTF-8″?>
<!DOCTYPE hibernate-configuration PUBLIC
“-//Hibernate/Hibernate Configuration DTD//EN”
“http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”>

 <hibernate-configuration>
<session-factory>
     
<property name=“hibernate.connection.driver_class”>oracle.jdbc.driver.OracleDriver</property>
     
<property name=“hibernate.connection.url”>jdbc:oracle:thin:@servername.domainname.com:1521:dbname</property>
     
<property name=“hibernate.connection.username”>username</property>
     
<property name=“hibernate.connection.password”>password</property>
     
<property name=“hibernate.connection.pool_size”>10</property>
     
<property name=“show_sql”>true</property>
     
<property name=“dialect”>org.hibernate.dialect.Oracle10gDialect</property>
     
<property name=“connection.autocommit”>true</property>
     
<!– Mapping files –>
     
<mapping resource=“Entry.hbm.xml”/>
</session-factory>
</hibernate-configuration>

You may need to modify the dialect to match your current version of Oracle. Other available dialects for the Oracle database include OracleDialect (deprecated), Oracle8iDialect, and Oracle9iDialect. It is also important that you set the autocommit property to true if you are not using exlicit transactions in your application. Otherwise, you may get frustrated as you try to look at the database and see that your changes have not been commited to the database. 

3. Create a class to match a given database table.
This example called Entry.java matches a database table called Entry.

package com.utilities.data;

public class Entry
{
   
private int entryID;
   
private int userID;
   
private String title = “”;
   
private long creationDate;

    public Entry(){  }

    public void setEntryID(int entryID)  { this.entryID=entryID;  }        
   
public void setUserID(int userID) { this.userID=userID; }
   
public void setTitle(String title) { this.title=title; }
   
public void setCreationDate(long creationDate) { this.creationDate = creationDate; }

    public int getEntryID()  { return this.entryID;  }        
   
public int getUserID() { return this.userID; }
   
public String getTitle() { return this.title; }
   
public long getCreationDate() { return this.creationDate; }
}

 The corresponding table creation and sequence creation commands are given here as well.

CREATE SEQUENCE Entry_seq MINVALUE 1 START WITH 1 INCREMENT BY 1;
   
CREATE TABLE ENTRY
(
   
EntryID Number Primary Key,
   
UserID  Number Not Null,
   
Title   Varchar2(255),
   
CreationDate Number
);

With this example you can will are shown using int, String, and long datatypes in Hibernate. In this particular application, the architects choose to use the Date.getTime() functionality to store date values.

4. Create the Mapping Resource File.

This particular file is called Entry.hbm.xml. It is stored in the root directory right next to the hibernate.cfg.xml file and is used to bridge the java object values to the database. In many applications, it is prefered to place this file right next to Entry.java. However, it appears that in Swing applications, Hibernate has difficulty finding it unless it is in the root directory.

<?xml version=“1.0″ encoding=“UTF-8″?>
<!DOCTYPE hibernate-mapping PUBLIC
“-//Hibernate/Hibernate Mapping DTD 3.0//EN”
“http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd”>

<hibernate-mapping package=“com.utilities.data”>
   
<class name=“Entry” table=“Entry”>
       
<id name=“entryID” column=“EntryID” type=“int”>
           
<generator class=“sequence”>
               
<param name=“sequence”>Entry_seq</param>
           
</generator>
       
</id>
       
<property name=“userID” type=“int” />
       
<property name=“title” type=“string” length=“255″ />
       
<property name=“creationDate” type=“long” />
   
</class>    
</hibernate-mapping>

5. Populate the class called Entry as you would any other java class.

6. Save the data to the database
From within your DAO class make the following calls. Please pay attention to the following line:

configuration = new Configuration().configure(”/hibernate.cfg.xml”);

In some applications, it is enough to simply call configuration = new Configuration()

Unfortuneately, my swing application required the additional configure method to be called in order to find the configuration file.

 package com.utilities.data;

import org.hibernate.cfg.Configuration;
import org.hibernate.SessionFactory;
import org.hibernate.Session;

public class ImportToolDAO
{

    private Configuration configuration;
   
private SessionFactory factory;
   
private static ImportToolDAO importToolDAO;
   
   
private ImportToolDAO()
   
{
        configuration
= new Configuration().configure(“/hibernate.cfg.xml”);
        factory
= configuration.buildSessionFactory();  
   
}
   
   
public static ImportToolDAO getInstance()
   
{
         
if(importToolDAO==null)
         
{
              importToolDAO
= new ImportToolDAO();
         
}
         
return importToolDAO;
   
}
   
   
public void saveEntry(Entry entry)
   
{
       
Session session = factory.openSession();
        session
.save(entry);
        session
.flush();
        session
.close();
   
}
}

   7. Run the Application.  If you followed everything step by step, it just might work for you the first time. Go check your database and be prepared for a smile.


Blog Information Profile for Supertramp678