Monday, October 18, 2010

WSADMIN


wsadmin.bat -lang jython -user -password

for app in AdminApp.list().split('\r\n'):
AdminApp.export(app, 'c:\\extras\\backup\\' + app + '.ear')

Tuesday, August 10, 2010

DB2 SQL COPY TABLE PROCEDURE

CREATE TABLE <ibrary>.<table> LIKE <library>.<table>

INSERT INTO <library>.<table> (SELECT * FROM <library>.<table>)

Wednesday, July 7, 2010

Cygwin SSH keygen (1024 bit, DSA)


$ ssh-keygen -t dsa -b 1024

Enter twice (empty for no passphrase)

Setting up Password-less Authentication

Client Machine
Default private key file : /home/<client-user>/.ssh/id_dsa
Default public key file : /home/<client-user>/.ssh/id_dsa.pub

Server Machine
Append the public key to the "/home/<server-user>/.ssh/authorized_keys" file (ubuntu server in this case)

Java SSH Client Code

//Set file system options
FileSystemOptions fsOptions = new FileSystemOptions();
SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(fsOptions, "yes");
SftpFileSystemConfigBuilder.getInstance().setIdentities(fsOptions, new File[]{new File("C:\\cygwin\\home\\<client-user>\\.ssh\\id_dsa")});

FileSystemManager fsManager = VFS.getManager();
FileObject textFile = fsManager.resolveFile( "sftp://<server-user>@<server-name>/", fsOptions );
for(FileObject fObject : textFile.getChildren()) {
System.out.println( fObject.getName());
}

Friday, May 21, 2010

Java Code to Create a Buffered Image of TYPE_BYTE_BINARY


byte[] cMap = new byte[] {(byte)(255),(byte)(0)};
IndexColorModel colorModel = new IndexColorModel(1, 2, cMap, cMap, cMap);

BufferedImage combined = new BufferedImage(
buf1.getWidth(),
buf1.getHeight() + buf2.getHeight() ,
BufferedImage.TYPE_BYTE_BINARY );

byte[] data = ((DataBufferByte) src.getRaster().getDataBuffer()).getData();
for(int i = 0; i < data.length; i++) {
data[i] =(byte) (~data[i] & 0xff);
}

Friday, April 23, 2010

Create ISO images from CD, DVD & Folder

For Drives

dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi


For Folders

sudo apt-get install genisoimage
mkisofs -allow-lowercase -o cd.iso image/

Thursday, March 18, 2010

Monitoring Ubuntu Server Using Htop

Htop is an advanced, interactive system monitor process viewer written for Linux. It is designed to replace the Unix program top. It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage. Unlike 'top', Htop provides a full list of processes running, instead of the top resource consuming processes. Htop also uses color and gives visual information about processor, swap and memory status. - Wikipedia

Hiding Userland Threads
By default htop displays userland threads of processes like console-kit-daemon. To disable this feature;

Run htop
Press F2
Select "Display options"
Mark "Hide userland threads"

Ubuntu - RAM Cleanup

sync; echo 3 > /proc/sys/vm/drop_caches

Wednesday, March 10, 2010

Websphere EJB Development


Developing Stateless Session Beans with Rational Application Developer

Prepare the development environment by following the steps below.
-> Create a new EAR Project
-> Add EJB Project, Web Project and EJBClient Project

Creating New Session Bean



Expand Deployment Descriptor of the EJB Project and select Session Beans
Right click and create new Session Bean


-> Select "Session Bean"
-> Provide a Bean name
-> Check "Generate an annotated bean class"
-> Next


-> Select Session type "Stateless"
-> Select Transation type "Container"
-> Check "Remote Client View"
-> Finish

Implementing And Promoting New Methods



-> Implement methods in the newly created session bean
-> Right click the methods
-> Select Enterprise Beans
-> Click "Promote to Remote Interface"

Preparing for Deployment



-> Right click the deployment descriptor
-> Select "Prepare for Deployment"

Configuring Web Application


Open the deployment descriptor of the Web Application
Select References tab
Click "Add..." to add a new reference

-> Select "EJB reference"
-> Browse the projects and select the ejb to add
-> Select the RefType as Remote


Make sure the name of the Reference is same as the last two portions of the COMP_NAME of the Home Interface ( for eg. if COMP_NAME = "java:comp/env/ejb/TestBean"; then RefName = ejb/TestBean )

Creating and Using the EJB


Example
try {
TestHome testH = TestBeanUtil.getHome();
Test test = testH.create();
}catch(Exception exp) {
exp.printStackTrace();
}

Classloader Settings


Set the classloader as "Application" instead of "Module" for the Enterprise application

Tuesday, March 9, 2010

ASUS USB-N13 UBUNTU (LUCID) DRIVER

Copied From
http://swiss.ubuntuforums.org/showthread.php?t=1419504&page=2
Post# 17

1) Download
http://swiss.ubuntuforums.org/attachment.php?attachmentid=148998&d=1267737748
2) Extract to ~/Desktop/2009
3) cd ~/Desktop/2009
4) sudo su
5) gedit os/linux/config.mk
Find these lines:
-------------------------------------
HAS_WPA_SUPPLICANT=n
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
-------------------------------------
Change them to =y
Save and close gedit.
6) gedit os/linux/usb_main_dev.c
Add a new line:
-------------------------------------
{USB_DEVICE(0x0B05,0x1784)}, /* Asus 3070 */
-------------------------------------
Save and close gedit.
7) make
8) make install
9) cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat
10) gedit /etc/modules
Add lines
-------------------------------------
rt2870sta
rt3070sta
-------------------------------------
to the end of the table
11) reboot