Starting Oracle 9i on Unix

Oracle 9i has an entirely new way of starting the database from that of Oracle 8i and other previous releases. To start a configured Oracle9i database, perform the following:

$ su - oracle$ lsnrctl start
$ sqlplus /nolog

SQL*Plus: Release - Production on Fri Mar 10 09:01:30 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect / as sysdba
SQL> startup

You should see the following message if the database starts successfully:

ORACLE instance started.
Total System Global Area 1192318212 bytes
Fixed Size 455940 bytes
Variable Size 452984832 bytes
Database Buffers 738197504 bytes
Redo Buffers 679936 bytes
Database mounted.Database opened.

To stop the database, issue the following command:

SQL> shutdown immediate 

To put this command into a script you could do something like the following:


# name: /etc/init.d/oracle9i
# description: starts and stops oracle 9i database, TNS listener
# http server, and fixes kernel parameters for oracle
#oracle environment

export ORACLE_HOME=/u01/oracle/
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_SID=ora9
export DISPLAY=:0

# see how were called
case $1 in 
      su - oracle<<EOO 
      lsnrctl start 
      apachectl start 
      sqlplus /nolog<<EOS 
      connect / as sysdba 
      # stop listener, apache and database 
      su - oracle<<EOO 
      lsnrctl stop 
      apachectl stop 
      sqlplus /nolog<<EOS 
      connect / as sysdba 
      shutdown immediate

      echo "Usage: ora9 [start|stop]" 

Removing old session data form MySQL database

PHP Web applications that use sessions can save data to session files and/or to a database. Session data typically has an expiration timestamp. When session data is saved to a database, the session data is not automatically removed from the database when the expriation time is exceeded. What are some ways to remove this stale information?

Here are a few suggestions for the removal of this stale data:

  • use a cron (unix) or scheduler (windows) to execute SQL to remove the rows
  • use a function that can be accessed manually which executes the SQL to remove the rows
  • when the sessions are initiated, have SQL code be automatically executed to delete the code
DELETE FROM session 
WHERE expiry < unix_timestamp();

Useful other functions for session expiry timestamp(s):


converts the expiry to MySQL datetime timestamp 


MySQL UNIX timestamp in number of epoch seconds


MySQL functions that show current datetime using a UNIX timestamp

Prototype ControlTabs for tabbed web interfaces

This article provides a quick usage example of my preferred method of creating tabbed interfaces using the widely available ControlTabs extension using the Prototype javascript library. First, you should make sure you download a copy of controltabs from the following site:

Setting up tabs is easy in ControlTabs. The first thing you do is ensure that you call the javascripts in the right order in the head of your html and/or PHP pages.

     <title>This is my sample web page</title>
     <script type="text/javascript" src="/js/prototype.js"></script>
     <script type="text/javascript" src="/js/scriptaculous.js"></script>
     <script type="text/javascript" src="/js/controltabs.js"></script>

Scriptaculous and controltabs both rely on Prototype, so that's why it must be called first in that order. 

Next, you can create a tab container usign a div. Inside that div, we are going to create an un-ordered list which will contain our tab labels. Create tab container as a DIV as follows:

<div id="tabcontainer">
    <!-- unordered list of tabs will go here -->

The tab list should be created using an un-ordered list HTML entity:

<ul id="tab_group_1" class="subsection_tabs">
    <li><a href="#tab1">Football</a></li>
    <li><a href="#tab2">Soccer</a></li>
    <li><a href="#tab3">Hockey</a></li>
    <li><a href="#tab4">Basketball</a></li>

Ok, we're starting to make progress. Next we need DIVS that will hold ea. tab's content. This too will be wholely contained by the tab container w/ the ID "tabcontainer" shown in step 2. Don't worry, we'll show what the entire tab container looks like fully populated. Next, we'll create the tab div for the tab content.

<div id="tab1" class="tabdata">
    <!-- no content other than indicator, b/c it is loaded with AJAX -->
    <img src="/images/spinner2.gif" alt="running...">

Remember, we have to make four of these, one for each tab so that it can hold its tab's content. In our case, we need to make a separate div for "tab1", "tab2", "tab3", and "tab4". The last part is that we need to instantiate the Control.Tabs object on our tab_group_1. Here's how:

new Control.Tabs('tab_group_one', {
    afterChange:function(new_el) {
        new Ajax.Updater(new_el, 'ajax_sports.php', {
            method: 'post',
            parameters: { tab: }

NOTE: this also goes inside our tab container. This is what it all looks like when all assembled:

<div id="tabcontainer">
<ul id="tab_group_one" class="subsection_tabs">
    <li><a href="#tab1">Football</a></li>
    <li><a href="#tab2">Soccer</a></li>
    <li><a href="#tab3">Hockey</a></li>
    <li><a href="#tab4">Basketball</a></li>
<div id="tab1" class="tabdata">
    <!-- no content other than indicator, b/c it is loaded with AJAX -->
    <img src="/images/spinner.gif" alt="running...">
<div id="tab2" class="tabdata">
    <!-- no content other than indicator, b/c it is loaded with AJAX -->
    <img src="/images/spinner.gif" alt="running...">
<div id="tab3" class="tabdata">
    <!-- no content other than indicator, b/c it is loaded with AJAX -->
    <img src="/images/spinner.gif" alt="running...">
<div id="tab4" class="tabdata">
    <!-- no content other than indicator, b/c it is loaded with AJAX -->
    <img src="/images/spinner.gif" alt="running...">
new Control.Tabs('tab_group_one', {
    afterChange:function(new_el) {
        new Ajax.Updater(new_el, 'ajax_sports.php', {
            method: 'post',
           parameters: { tab: }

This article will be continued, as the next part is to talk about how to incorporate the CSS for the proper format and output.

Locking down Lucent SNMP Module 2.0

The focus of this short article is to document the steps in locking down the Lucent SNMP Module from its default security settings. It is important to note, Lucent says that you should not remove the public community string from the snmpd.cnf file. Doing so, will break the integration of the Lucent DNS/DHCP server subagents and the SNMP Emanate Master agent. It appears that the sub-agents have been hard-coded somehow with the 'public' readonly community string.

The Lucent SNMP configuration files are located in the $QIPHOME/snmp/conf directory. For the purposes of this short article, we'll only delve into the snmpd.cnf file in that directory.

Change the current snmpCommunityEntry for 'public' to read:

snmpCommunityEntry t0000000 public public localSnmpID - LocalHost nonVolatile

Add a new entry to the snmpCommunityEntry table that reads:

snmpCommunityEntry t0000001 d1ffstr1ng d1ffstr1ng localSnmpID - NMSServer \nonVolatile

Where the index is unique (t0000001) and the community string is different and more complex.

Add two (2) additional entries to the vacmAccessEntry table:

vacmAccessEntry group1 - snmpv1 noAuthNoPriv exact All All All nonVolatile
vacmAccessEntry group1 - snmpv2c noAuthNoPriv exact All All All nonVolatile

Add two (2) additional entries to the vacmSecurityToGroupEntry table:

vacmSecurityToGroupEntry snmpv1 d1ffstr1ng group1 nonVolatile
vacmSecurityToGroupEntry snmpv2c d1ffstr1ng group1 nonVolatile

And, finally, the part of the configuration that effectively locks down the communities is the configuration of the entries in the snmpTargetAddrEntry table. The following entries lock 'public' to the LocalHost or IP address. This allows the Lucent sub-agents to continue working. While the other entry locks 'd1ffstr1ng' community string down to the unicast address of the NMSServer:

snmpTargetAddrEntry 31 snmpUDPDomain 100 3 NMSServer \
v1ExampleParams nonVolatile 2048
snmpTargetAddrEntry 32 snmpUDPDomain 100 3 LocalHost \
v1ExampleParams nonVolatile 2048

Installing Eclipse 3.2 (callisto)

The purpose of this article documents the steps taken to install the latest version of Eclipse and associated web, perl, and utility modules.  This tutorial details the installation on a Windows XP development workstation. 

The following plugins will be installed as part of this tutorial:

  • E-P-I-C Perl Plug-in - a Perl IDE and debugger
  • ViPlugin - a Vi editor plug-in
  • PHPEclipse - a full-featured PHP IDE and debugger
  • Shelled - a Shell script IDE plugin
  • Graysky's LogWatcher - a log tailing plug-in
  • Eclipse Colorer - a secondary syntax colorer IDE for miscellaneous files
  • PyDev - A python development IDE and debugger plug-in
  • Subclipse - a Subversion Team plugin

The first step in this process is to get Eclipse 3.2, called Callisto, installed and configured with the WTP or (WST) Web Standard Tools version 1.5 and the Database Development Tools. 

  • Start by getting the latest drop of Eclipse 3.2 at
  • unzip the Eclispe file to the root of your local drive say C:\ or D:\
  • start Eclipse 3.2 by running [drive]:\eclipse\eclipse.exe
  • configure WTP and Database Development tools - do this by performing a "Help->Software Updates->Find and Install->Search for New Features to Install".  Select the "Callisto Discovery Site" when the dialog appears.  Choose all options under "Database Development" and choose the "Web Standard Tools (WST) Project 1.5.0" under "Web and J2EE Development"
    NOTE: you will see errors at the top of this dialog that describes missing plug-ins.  Simply choose the button entitled "Select Required" and it will properly select the required dependent plug-ins.  Follow the dialogs to install all the plug-ins.

At this point, you should stop/restart Eclipse.  You should have a basic Eclipse system with Java and Web (HTML) development capabilities.  As mentioned at the beginning of this article, we will be installing other support plug-ins that will make the Eclipse Framework a more full-featured scripting environment.

E-P-I-P Perl Plug-in

Next, we'll install the E-P-I-C Perl Plug-in.  It is assumed that you have correctly installed and configured Perl from Activestate and have applied the PadWalker fix.  You can view directions and/or get the Patch from  Normally you can use the following URLS as Eclipse Remote Update Sites:

Due to a bug, however, you must download the following CVS drop of E-P-I-C Perl:

You must install this CVS drop cleanly, if you are upgrading a previous release of Eclipse, then you should make sure you remove all instances of org.epic.* from the plug-ins directory.  And you should start Eclipse with the -clean option.  To install the development plug-in, unzip each sub-zip file into the [drive]:\eclipse\plugins directory. 

VIPlugin from Satokar

As a Vi/Vim user, this was a must have for programming and speeding up the IDE for common tasks.  I went ahead and purchased a copy of Satokar's ViPlugin and have used it successfully on Eclipse 3.2.  First, you will need to get a licensed copy if you wish to use this plug-in.  You can get a copy of the ViPlugin at  download this file and unzip the contents to [drive]:\eclipse.  You will see a "Vi" button appear the next time you start Eclipse.


The PHPEclipse development IDE and debugging environment is a fantastic open-source utility for doing all your PHP and web-related development in.  For details on the project go to .   They have an update site that allows you to automatically download and install the latest plug-in.  I use the development URL which is at

Install this URL into Eclipse as a remote Update Site by "Help->Software Updates->Find and Install->Search for Features to Install".  Choose the Remote Site and type the information into the dialog.  Follow the prompts for installing the module.  It is fairly self-explanatory at that point.


A UNIX shell scripting editor called Shelled is another nice to have.  You never know when you are going to have to perform shell scripting and want syntax highlighting etc..  This is the perfect plug-in for that.  Get information on the project at

Download the latest version for manual installation at

Download and save locally.  Install by unzipping the contents of the zip file into the [drive]:\eclipse directory.


If you are a Python developer as well, don't despair.  There's a great Eclipse plug-in for you as well!  PyDev is a full-featured IDE and debugger.  Go to for details.


Subclipse is an Eclipse-based Subversion plug-in.  This plug-in is for those that have gone from CVS to Subversion.  This plug-in is part of the Eclipse Team series of plug-ins so you will see the configuration properties of Subversion and CVS under the same perspective tab.  For more information on this project, go to:

Building Apache 2.0.55 w/ SSL (win32) from source

A new release of Apache web server is available for download. This article covers the compiling the new release on the win32 platform with SSL. Most Apache2 packages don't come with mod_ssl compiled, and that is the main reason why we are making the effort to make it available. And in case you are inclined to build it yourself, we have provided you some build notes and instructions on making Apache 2.0.55 w/ mod_ssl and mod_deflate support.


My Configuration

  • Install to : C:\www\apache2
  • System:Port : localhost:80
  • Module Type : dynamically loaded modules, *.so
  • Additional modules : mod_ssl, mod_deflate
  • Perl.exe path : C:\perl\bin\perl.exe
  • Other tools path : c:\cygwin\bin path to other tools (awk, bison, flex, and sed)

Setting the Environment

Since I used the Visual C++ from the command line to build the tools, the environment has to be set properly. In the build DOS command shell window, locate and execute the vcvars32.bat file. On my system this file is located: C:\Program Files\Microsoft Visual Studio\VC98\Bin. The build process for mod_ssl needs to be able to find the ml.exe that is part of the MASM package. Make sure you include C:\masm32\bin to the global environment PATH variable.


Download all the source packages. Unpack the package to C:\src. Unpack openssl-0.9.8a.tar.gz to C:\src\httpd-2.0.55\srclib\openssl. Unpack the to C:\src\httpd-2.0.55\srclib\zlib.

NOTE: you should delete the symlink 'awk.exe' and rename 'gawk.exe' to 'awk.exe' in the C:\cygwin\bin directory.

Setup for mod_deflate

The apache build process will automatically buid the mod_deflate module if it detects the zlib source code in the srclib directory. The zlib source code must be placed in the httpd-2.0.55\srclib dir as (httpd-2.0.55\srclib\zlib).

NOTE: you must build with zlib-1.1.4 and not zlib-1.2.3, otherwise, mod_deflate will fail during the build.

Setup for mod_ssl

To build mod_ssl, the OpenSSL source code directory needs to be placed under httpd-2.0.55\srclib as (httpd-2.0.55\srclib\openssl). The OpenSSL source is then manually compiled, to prepare for the main Apache 2.0 build process.

..\httpd-2.0.55\srclib\openssl > perl Configure --openssldir=C:/www/apache2/bin VC-WIN32
..\httpd-2.0.55\srclib\openssl > ms\do_masm
..\httpd-2.0.55\srclib\openssl > nmake -f ms\ntdll.make

[Optional] To test the built OpenSSL package:

..\httpd-2.0.55\srclib\openssl > cd out32dll
..\httpd-2.0.55\srclib\openssl\out32dll > ..\ms\test

Build/Install Apache

This next section covers the building of the apache 2.0.55 source. Build the source using the following command:

nmake /f SERVERNAM="localhost" PORT=80 INSTDIR="C:\www\apache2" installr

The following is a list of make or build targets that have been configured in the

# Makefile for Windows NT and Windows 95/98/2000

# Targets are:
# _apacher - build Apache in Release mode
# _apached - build Apache in Debug mode
# installr - build and install a Release build
# installd - build and install a Debug build
# clean - remove (most) generated files
# _cleanr - remove (most) files generated by a Release build
# _cleand - remove (most) files generated by a Debug build
# _browse - build the browse info file
# The following install defaults may be customized;
# Option Default
# INSTDIR \Apache2
# PORT 80
# SERVERNAME localhost
# For example;
# nmake /f PORT=80 INSTDIR="d:\Program Files\Apache" installr

Additional Steps

During the Apache 2.0 build process, the needed OpenSSL files (libeay32.dll, ssleay32.dll, and openssl.exe) are placed into ..\apache2\bin, except openssl.cnf. The openssl.cnf is the OpenSSL configuration file and needs to be copied manually.

..\httpd-2.0.55\srclib\openssl> copy apps\openssl.cnf C:\www\apache2\bin

SSL Private/Public Key Setup

mkdir C:\www\apache2\conf\ssl.cnf
mkdir C:\www\apache2\conf\ssl.key
cd \www\apache2\conf

next, create a certificate signing request (server.csr) and private key (privkey.pem)

openssl req -new -out server.csr

The following command then removes the pass-phrase from the private key (privkey.pem), creating server.key

openssl rsa -in privkey.pem -out server.key

Lastly, create a self-signed certificate, server.crt(public key) and copy it into place

openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 365
move server.crt ssl.crt
move server.key ssl.key
del .rnd
del privkey.pem
del server.csr

Update httpd.conf Configuration

Configure the httpd.conf file in the ..\apache2\conf directory with the following:

  • Add LoadModule deflate_module modules/ at the end of the modules list
  • Uncomment LoadModule headers_module modules/ (required for mod_deflate to support requests that come from behind proxies)
  • Add AddOutputFilterByType DEFLATE text/html text/plain text/css in to the <Directory /> block to compress txt, html and css
  • Add Header append Vary User-Agent into the <Directory /> block (required for mod_deflate to properly handle requests coming from proxies)
  • Add BrowserMatch ^Mozilla/4 gzip-only-text/html
  • Add BrowserMatch ^Mozilla/4\.0[678] no-gzip
  • Add BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  • Uncomment LoadModule ssl_module modules/

Startup and Operation

Install the 'Apache2' web server as a service with the following command:

C:\www\apache2\bin> apache -D SSL -k install

Start the 'Apache2' web server service

C:\www\apache2\bin> apache -k start


net start apache2

Additional commands:

To stop the apache web server service:

c:\www\apache2\bin> apache -k stop


net stop apache2

To gracefully restart the web:

c:\www\apache2\bin> apache -k restart

To uninstall the 'Apache2' web service from the WIN32 SCM:

c:\www\apache2\bin> apache -k uninstall


To test the regular (port 80) server enter the url: http://localhost
To test the SSL (port 443) server enter the url: https://localhost
Download the precompiled version of Apache 2.0.55 w/ SSL (coming)