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: , , , ,

Change Power Scheme From Windows Command Prompt

| Posted by watashii | Filed under Software

If you have a laptop, Windows provides different power schemes that you can switch (or create your own) for power management.  You can switch your power scheme the same way using the command prompt using the powercfg utility.

To list all the available power schemes, open the Windows command prompt and run powercfg /list

C:\Users\Watashii>powercfg /list

Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e  (Balanced)
Power Scheme GUID: 49ef8fc0-bb7f-488e-b6a0-f1fc77ec649b  (Dell Recommended) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a  (Power saver)

To change your power scheme (to Power Saver for example), run powercfg /setactive

powercfg /setactive a1841308-3541-4fab-bc81-f71556f20b4a

Tip: You can also put the above command inside a batch (.bat) file and run this conveniently like a shortcut.

Tags: , ,

Logitech M905 Anywhere Mouse Unboxing / Review

| Posted by watashii | Filed under Hardware

Features

  • - Darkfield Laser Tracking™
  • - Logitech® Unifying receiver
  • - Compact, ergonomically designed
  • - Hyper-fast scrolling
  • - Logitech® Advanced 2.4 GHz wireless

Package Contents

  • - Logitech® Anywhere Mouse M905
  • - Logitech® Unifying receiver
  • - Logitech® software CD
  • - Carrying pouch
  • - 2 AA batteries
  • - Quick-start guide
  • - Tips guide

Good

  • - Comfortable to use, compact, portable
  • - Fast scrolling
  • - Can use 1 or 2 AA batteries

Bad

  • - Doesn’t have the middle click on scroll wheel, eg when opening links new tabs on Firefox.  It is replaced by a button below the scroll wheel which takes time to get used to for conventional mouse users.
  • - Not acceptable battery life for me.  SetPoint software says it has 90 days remaining on a single full charge battery. After using it for 10hrs within 2 days, software says i’ve got 87 days.

Verdict

  • 2/5 (no good!)

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: , , , ,

Windows Desktop Shortcut to Activate Screensaver

| Posted by watashii | Filed under Software

For all the power saving green freaks out there, heres how to create a handy Windows desktop shortcut to activate the screensaver immediately.

Read the rest of this entry »

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: , , , ,