Linux Installing and Uninstalling RPM Packages

| Posted by watashii | Filed under Unix

Installing a package on Linux:  (Eg, MQSeriesRuntime-7.0.1-3.x86_64.rpm)

$ rpm -ivh MQSeriesRuntime-7.0.1-3.x86_64.rpm

Verify the package installed:  (The architecture x86_64 name is not required)

$ rpm -qa MQSeriesRuntime-7.0.1-3

Uninstall the package:

$ rpm -e MQSeriesRuntime-7.0.1-3

Note: Sudo maybe required for install, in this case, run sudo rpm …

Tags: , ,

Oracle SQLPlus Query Output to a File

| Posted by watashii | Filed under Database, Programming, Unix

Here is a simple way to output SQL query output into a file, via command line based SQLPlus.

Step 1: Nominate the output file location. In this case this is a Unix location.

SQL> spool /tmp/output.txt

Step 2: Perform your SQL query.

SQL> select * from tab;

Step 3: Close the file.

SQL> spool off

Tip: Use set lines statement to adjust output display

Read the rest of this entry »

Tags: , , , ,

Install & Uninstall Probes/Gateways on Netcool Omnibus

| Posted by watashii | Filed under Software, Unix

Installing probes & gateway for Netcool/Omnibus 7.2 and below (ie prior to 7.3) is done by using the nco_patch patch tool over an existing Netcool Omnibus installation, with the un-tarred path of the patch (Unix):

$ $NCHOME/omnibus/install/nco_patch -install /tmp/probe-nco-p-mttrapd-9_0/patch/probe-nco-p-mttrapd-9_0/

To list all the patch (ids) that has been already applied to the installation, run the following command:

$ $NCHOME/omnibus/install/nco_patch -print=id
gateway-nco-g-oracle-4_0
gateway-nco-g-remedy-8_0
probe-nco-p-mttrapd-9_0

To remove/uninstall the probe, we use the same nco_patch tool with the patch id :

$ $NCHOME/omnibus/install/nco_patch -remove probe-nco-p-mttrapd-9_0

Tags: , , ,

XHTML 1.0 Validation Error for JSF ViewState

| Posted by watashii | Filed under Java, Programming, Web

When the <h:form> tag is used in JSF, the ViewState hidden input tag is generated in the XHTML page.  However this generates an autocomplete attribute which is an invalid XHTML 1.0 (Strict/Transitional) markup.

Read the rest of this entry »

Tags: , , ,

Starting / Shutdown Oracle Database in Unix

| Posted by watashii | Filed under Database, Unix

This simple guide to shows how to start /stop your Oracle database from Unix.  You must have logon access to do this.

Step 1

Unix login as oracle (usually the user that installed the database)

Step 2

Make sure your environment variables are set, eg:

ORACLE_SID=MYDBSID
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1
LD_LIBRARY_PATH=/opt/oracle/product/11.2.0/dbhome_1/lib
PATH=/usr/bin:/usr/sbin:/usr/ucb:/usr/local:/usr/local/bin:/usr/local/sbin:/opt/oracle/product/11.2.0/dbhome_1/bin

Step 3 – Start DB Instance

On the Unix command line, run sqlplus with sysdba, and simply type startup in the prompt to start it up.

oracle@db-srv-01 % sqlplus '/ as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Tue Nov 30 12:06:47 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 3207790592 bytes
Fixed Size                  2152368 bytes
Variable Size            2449475664 bytes
Database Buffers          738197504 bytes
Redo Buffers               17965056 bytes
Database mounted.
Database opened.

Step 4 – Start Listener

To start the oracle listener (assuming listener.ora is setup), run lsnrctl start

oracle@db-srv-01 % lsnrctl start

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 30-NOV-2010 12:00:34

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/db-srv-01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db-srv-01)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db-srv-01)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                30-NOV-2010 12:00:35
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/db-srv-01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db-srv-01)(PORT=1521)))
The listener supports no services
The command completed successfully

Step 4 – Shutdown

Similarly, to shutdown the instance, type shudown normal within sqlplus.

Stop the listener, by running lsnrctl stop

Tags: , , , ,

Setup Hibernate Log4j on Eclipse (Basic Tutorial)

| Posted by watashii | Filed under Java, Programming

Download the Libraries

Hibernate

Download the Hibernate release bundle.  I’m using 3.5.6 Final.  Manually extract the following files from the downloaded zip/tar.gz archive:

  • - hibernate-distribution-3.5.6-Final\lib\required\antlr-2.7.6.jar
  • - hibernate-distribution-3.5.6-Final\lib\required\commons-collections-3.1.jar
  • - hibernate-distribution-3.5.6-Final\lib\required\dom4j-1.6.1.jar
  • - hibernate-distribution-3.5.6-Final\lib\required\javassist-3.9.0.GA.jar
  • - hibernate-distribution-3.5.6-Final\lib\required\jta-1.1.jar
  • - hibernate-distribution-3.5.6-Final\lib\required\slf4j-api-1.5.8.jar

Grabbed the JPA library so I can use annotations with my Hibernate:

  • - hibernate-distribution-3.5.6-Final\lib\jpa\hibernate-jpa-2.0-api-1.0.0.Final.jar

I also grabbed a sample log4j.properties file from the tutorials section:

  • - hibernate-distribution-3.5.6-Final\project\tutorials\web\src\main\resources\log4j.properties

SLF4J

Download SLF4J.  I downloaded slf4j 1.5.8 because Hibernate uses this version for its logging.  In order to use your chosen logging framework, i.e. Log4j,  manually extract the following files from the downloaded zip/tar.gz archive:

  • - slf4j-1.5.8\slf4j-log4j12-1.5.8.jar

Log4J

Download Apache Log4J.  I’m using the latest version, log4j 1.2.16.  Manually extract the following files from the downloaded zip/tar.gz archive:

  • - apache-log4j-1.2.16\log4j-1.2.16.jar

Read the rest of this entry »

Tags: , , , , ,

Unix Bash Coloured Prompts

| Posted by watashii | Filed under Unix

To display coloured prompts upon user login (on Unix Bash shell, PuTTY client), perform the following modifications:

  1. Unix login and open the user’s profile in the home directory, eg /home/username/.profile
  2. In the .profile, add the following entry in a new line to execute the bash shell upon login, eg /usr/bin/bash
  3. The bash shell will refer to a .bashrc file.  If its not there, create it,  eg /home/username/.bashrc
  4. Add following entries in the .bashrc to enable the coloured prompt; showing the username, hostname and working directory:
    # Colored Prompts
    STARTGREEN='\[\e[0;32m\]';
    STARTBLUE='\[\e[1;34m\]';
    ENDCOLOR="\[\e[0m\]";
    PS1="$STARTGREEN\u@\h$ENDCOLOR:$STARTBLUE\w$ENDCOLOR $ ";

Tags: , , , ,

Weblogic Portal – Create Streaming Desktop Page Definition Error

| Posted by watashii | Filed under Java, Programming, Web

Got the following error when (re)creating a streaming desktop from an updated .portal file, using the Create Desktop Wizard on Portal Admin Console.
javax.ejb.EJBException: SQL Error while trying to createPageDefinition: SQL [insert into PF_PAGE_DEFINITION ( PAGE_DEFINITION_ID, MARKUP_DEFINITION_ID, IS_PUBLIC, IS_HIDDEN, INTERSECTION_ID, PAGE_LABEL, WEBAPP_NAME) values (?,?,?,?,?,?,?)] database error code [25,222] SQL state [22028] .; nested exception is: java.sql.SQLException: Data exception -- row already exist in index AX1_PAGE_DEF on table PF_PAGE_DEFINITION.
To temporarily bypass this error this so the streaming desktop can be created with the wizard, remove all the Pages manually from the Library.

The problem is one of the Page definition(s) in the .portal file is corrupted which prevents the library page resource from being refreshed.  You will need to work out which page is causing the problem, then the redo the page in the .portal file via Weblogic Portal Workshop.

Tags: , , ,

Subversion – Allow Author Name Logging

| Posted by watashii | Filed under Java, Programming, Software

To log the author name when trying to check-in files using Subversive/Eclipse over SVN, switch to SVN Repository Exploring perspective > right-click on your repository > edit the Location Properties > Advanced tab > and enable Override author name:


Read the rest of this entry »

Tags: , , , ,

Unix Shell – Check If Directory Is Empty

| Posted by watashii | Filed under Programming, Unix

Here is a simple unix shell command to check if a directory, $dir, is empty.

export $dir=/tmp/myfiles/
if [ "$(ls -A $dir)" ];
then
    echo "$dir NOT Empty";
else
    echo "$dir IS Empty";
fi

Tags: , , ,