Wednesday, July 25, 2012

Search files within a ZIP archive using zipgrep tool

Bash script that search files within a ZIP archive for lines matching given string or pattern using zipgrep tool.

#!/bin/sh
# zipgrep Util 0.1
# Result ziprep by directory file
# @Jorge Iglesias

# Note: root users
if [ "$(whoami)" != 'root' ]; then
    echo "You have no permission to run $0 as non-root user"
        exit 1;
fi

clear
echo "zipgrep Util 0.1"
echo "Jorge Iglesias"
echo "----------------"

echo "Input pattern"
printf "> "
read pattern

echo "Input directory grep"
printf "> "
read directory

echo "Input directory output results"
printf "> "
read directoryOut

# Control will enter here if $DIRECTORY doesn't exist.
if [ ! -d "$directoryOut" ]; then
    mkdir $directoryOut
fi

cd $directory


index=0

for file in `dir -d *` ; do
    index=$((index+1))
    zipgrep $pattern $file > $directoryOut/$file.out
    # Control file size and delete files with size 0
    fileSize=$(stat -c "%s" $directoryOut/$file.out)
    if [ $fileSize = 0 ]; then {
        index=$((index-1))
        rm $directoryOut/$file.out
    }
    fi
done

echo "Pattern found in $index files."

Monday, July 23, 2012

How to convert .ico files to .png - Linux

# convert start_server.ico start_server.png
bash: convert: command not found...
Install package 'ImageMagick' to provide command 'convert'? [N/y]
 * Running..
 * Resolving dependencies..
 * Waiting for authentication..
 * Waiting in queue..
 * Resolving dependencies..
 * Downloading packages..
 * Testing changes..
 * Installing packages..
 * Scanning applications..

# convert start_server.ico start_server.png

Wednesday, July 11, 2012

Setting up a WebSphere Application Server 8.0 for Collaborative Lifecycle Management 4.0

Environment:
- Windows 7 Enterprise sp1 64 bit
- IBM WebSphere Application Server 8.0.0.3
- IBM Rational Team Concert 4.0

Using the Integrated Solutions Console for the server Ensure you have completed the following tasks:

- The Java 2 Security option must be turned off. If this option is turned on in WAS, the web application will not start.
  1. Click Security > Global security.
  2. Under Java 2 security, clear the check box for Use Java 2 security to restrict application access to local resources.
  3. Ensure that the Enable administrative security and Enable application security check boxes are selected.

  

- Ensure that the Use available authentication data when an unprotected URI is accessed application server security setting is selected.
  1. Click Security > Global security > Web and SIP security > General settings.
  2. Click the Use available authentication data when an unprotected URI is accessed check box.
  3. Click OK and Save directly to the master configuration.



Note: This document does not provide details for configuring WebSphere authentication or SSL, which is a complex topic. Detailed information about the various authentication and encryption options is covered in the WebSphere Application Server InformationCenter.

Procedure
  1. Jazz Team Server requires several specific settings on the Java Virtual Machine in which it runs. To set these properties click Servers > Server Types > WebSphere application servers > Server1
  2. Under Server Infrastructure, click Java and Process Management > Process definition.
  3. Under Additional Properties, click Java Virtual Machine.
  4. Add the value 4096 to Initial Heap.
  5. Add the value 4096 to Maximum Heap Size. (The figure here is only a suggestion; set the value according to your environment. A typical medium-size team can use a value of 4096 MB, providing 4 GB of heap memory for the Jazz Team Server process on a 64-bit computer. It is important to use the same amount for Initial and Maximum heap sizes)
  6. In the Generic JVM arguments field, type the following line (for Windows):
    
    
    -Xmx4g -Xms4g -Xmn512m
    -Xgcpolicy:gencon -Xcompressedrefs
    -Xgc:preferredHeapBase=0x100000000
     
  7. Click Apply, and then click Save directly to the master configuration.
  8. Add these custom properties:  
- Name: JAZZ_HOME, Value: file:///JazzInstallDir/server/conf
- Name: java.awt.headless, Value: true- Name: org.eclipse.emf.ecore.plugin.EcorePlugin.doNotLoadResourcesPlugin, Value: true
- Name: log4j.configuration, Value: file:///JazzInstallDir/server/conf/startup_log4j.properties



Note: If you are connecting to an Oracle database or SQL Server database, you have to add:
- Name: ORACLE_JDBC_DRIVER_FILE, Value: Absolute path to the JDBC driver/ojdbc6.jar
- Name: SQLSERVER_JDBC_DRIVER_FILE, Value: Absolute path to the JDBC driver/sqljdbc4.jar

Click Save directly to the master configuration and restart the application server.

Information source:
-  IBM Rational Help - Setting up a WebSphere Application Server