Thursday, December 29, 2011

Installing Microsoft SQL Server Management Studio Express in Windows Vista or Seven: Error 29506

Installing Microsoft SQL Server Management Studio Express in Windows Vista or Seven: Error 29506

This is a problem about privileges. Probably the installer performs the latests tasks without using elevation.

Solution is very simple: run the installer from an elevated command prompt.

Click Start.
Type cmd end press CTRL+SHIFT+ENTER and accept the elevation.
Execute the installer from there (just type path and filename).
This works on Windows Vista and, of course, on Windows 7.

If using a 64 bit version, please note you will have to use the 64 bit version of cmd.exe, which is located in c:\Windows\SysWoW64 instead on c:\Windows\System32, so just write c:\Windows\SysWoW64\cmd instead of just cmd (thanks to Pierre Boucher for this)


http://www.sugata.eu/2008/04/16/installing-microsoft-sql-server-management-studio-express-in-windows-vista-error-29506/

Friday, June 3, 2011

Tomcat Loadbalancing


#Install JDK
#Set Environment Variables
JAVA_HOME C:\Program Files\Java\jdk1.6.0_25

#Copy extracted Tomcat folder to
c:\Tomcat\

#Set Environment Variables
CATALINA_HOME C:\Tomcat\apache-tomcat-6.0.32

#Add following text to tomcat-users.xml
<role rolename="manager-gui"/>
<user username="admin" password="******" roles="manager-gui"/>

#Modify catalina.properties to add shared libraries
shared.loader=${catalina.home}/shared/lib,${catalina.home}/shared/lib/*.jar

#Copy C:\Tomcat\apache-tomcat-6.0.32
C:\Tomcat\node01-6.0.32

#Delete contents from the following subfolders
logs
temp
webapps
work

#Add startNode.bat on both nodes
set CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.32
set CATALINA_BASE=C:\Tomcat\node01-6.0.32
C:\Tomcat\node01-6.0.32\bin\startup.bat

#stopNode.bat
set CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.32
set CATALINA_BASE=C:\Tomcat\node01-6.0.32
C:\Tomcat\node01-6.0.32\bin\shutdown.bat

#installService.bat to install windows service
set CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.32
set CATALINA_BASE=C:\Tomcat\node01-6.0.32
C:\Tomcat\node01-6.0.32\bin\service.bat install NODE01

#uninstallService.bat to uninstall windows service
set CATALINA_HOME=C:\Tomcat\apache-tomcat-6.0.32
set CATALINA_BASE=C:\Tomcat\node01-6.0.32
C:\Tomcat\node01-6.0.32\bin\service.bat remove NODE01

#Modify server.xml to add jvmRoute
<Engine name="Catalina" defaultHost="localhost" jvmRoute="node01">

#Modify server.xml to change ports
<Server port="8006" shutdown="SHUTDOWN">
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />

#Install httpd-2.2.xx
#Uncomment following LoadModules from httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

#Add the following settings to httpd.conf
<VirtualHost *>
<Proxy balancer://ajpCluster>
BalancerMember ajp://localhost:8010 route=node01 retry=60
#BalancerMember ajp://localhost:8011 route=node02 retry=60
</Proxy>

<Location />
Allow From All
ProxyPass balancer://ajpCluster/ stickysession=JSESSIONID nofailover=off
</Location>
</VirtualHost>

#To configure the instance
C:\Tomcat\apache-tomcat-6.0.32\bin>tomcat6w //ES//node01

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

Friday, December 11, 2009

Thursday, December 10, 2009

Websphere Cluster Installation

#############To create a new cell##############################
manageprofiles
-create
-templatePath C:\IBM\WebSphere\AppServer\profileTemplates\cell\dmgr
-nodeProfilePath C:\IBM\WebSphere\AppServer\profiles\TSTDMGR
-profileName TSTDMGR
-cellName TSTCELL
-nodeName TSTDMGR
-appServerNodeName TSTPROXY
#############To start deployment manager#######################
startManager
#############To enable security################################
Login to admin console
Enable security
stopManager
startManager
#############To add windows service for DMGR###################
WASService.exe
-add "DMGR"
-serverName "dmgr"
-profilePath "C:\IBM\WebSphere\AppServer\profiles\TSTDMGR"
-wasHome "C:\IBM\WebSphere\AppServer"
-logfile "C:\IBM\WebSphere\AppServer\profiles\TSTDMGR\logs\dmgr\startServer.log"
-logRoot "C:\IBM\WebSphere\AppServer\profiles\TSTDMGR\logs\dmgr"
-stopArgs "-username admin -password password"
-startArgs "-username admin -password password"
#############To create node01###################################
manageprofiles.bat
-create
-profileName "TSTAPP01"
-templatePath "C:\IBM\WebSphere\AppServer\profileTemplates\managed"
-profilePath "C:\IBM\WebSphere\AppServer\profiles\TSTAPP01"
-nodeName "TSTAPP01"
#############To federate node01#################################
addNode tstproxy.example.ca
#############To add windows service for the node################
WASService.exe
-add "NODEAGENT"
-serverName "nodeagent"
-profilePath "C:\IBM\WebSphere\AppServer\profiles\TSTAPP01"
-wasHome "C:\IBM\WebSphere\AppServer"
-logfile "C:\IBM\WebSphere\AppServer\profiles\TSTAPP01\logs\nodeagent\startServer.log"
-logRoot "C:\IBM\WebSphere\AppServer\profiles\TSTAPP01\logs\nodeagent"
-stopArgs "-username admin -password password"
-startArgs "-username admin -password password"
#############To create node02####################################
manageprofiles.bat
-create
-profileName "TSTAPP02"
-templatePath "C:\IBM\WebSphere\AppServer\profileTemplates\managed"
-profilePath "C:\IBM\WebSphere\AppServer\profiles\TSTAPP02"
-nodeName "TSTAPP02"
#############To federate Node02##################################
addNode tstproxy.example.ca
#############To add windows service for the node#################
WASService.exe
-add "NODEAGENT"
-serverName "nodeagent"
-profilePath "C:\IBM\WebSphere\AppServer\profiles\TSTAPP02"
-wasHome "C:\IBM\WebSphere\AppServer"
-logfile "C:\IBM\WebSphere\AppServer\profiles\TSTAPP02\logs\nodeagent\startServer.log"
-logRoot "C:\IBM\WebSphere\AppServer\profiles\TSTAPP02\logs\nodeagent"
-stopArgs "-username admin -password password"
-startArgs "-username admin -password password"
#############To install HTTP Server##############################
Install IBM HTTP Server from the CD
Install Port 80
Admin Port 8008
#############To add the webserver to the admin console###########
System Administration > Nodes > Add Node > Unmanaged >
Servers > Web Servers > New >
Plugin Location = C:\IBM\HTTPServer\Plugins\

Tuesday, December 8, 2009

KVM Setup


KVM Virtualization On Ubuntu Host

################install KVM and vm builder utils#######################
sudo apt-get install kvm kvm-pxe libvirt-bin ubuntu-vm-builder bridge-utils

################install uml utilities##################################
sudo apt-get install uml-utilities

################Test kvm installation##################################
virsh -c qemu:///system list

################/etc/network/interfaces################################
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet manual

#virtual interface
auto br0
iface br0 inet static
address 172.16.2.230
network 172.16.2.0
netmask 255.255.255.0
broadcast 172.16.2.255
gateway 172.16.2.252
bridge_ports eth0
bridge_stp off
bridge_fd 9
bridge_hello 2
bridge_maxwait 12

##############To create virbr0 DHCP####################################
sudo vim /etc/libvirt/qemu/networks/default.xml

#change this to
<network>
<name>default</name>
<bridge name="virbr%d" />
<forward/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
</dhcp>
</ip>
</network>

#this
<network>
<name>default</name>
<bridge name="virbr%d" />
<forward/>
<ip address="10.0.1.1" netmask="255.0.0.0">
<dhcp>
<range start="10.0.1.10" end="10.0.1.100" />
</dhcp>
</ip>
</network>

##############Restart virtual network##################################
sudo virsh net-list
sudo virsh net-destroy default
sudo virsh net-stop default

##############Command to create a new image file#######################
sudo qemu-img create -f qcow win2k3-64.img 10G

##############Command to boot from the disk############################
sudo qemu-system-x86_64 -m 512 -hda win2k3-64.img -cdrom /dev/dvd -boot d -vnc :1

##############Script to generate random MAC address####################
#! /usr/bin/python
# macgen.py script generates a MAC address for Xen guests
#
import random
mac = [ 0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
print ':'.join(map(lambda x: "%02x" % x, mac))

##############Command to launch the image##############################
sudo qemu-system-x86_64 -hda vms/tstproxy/win2003-64.qcow -m 1024 -net nic,macaddr=00:16:3e:03:d9:5f -net tap -nographic -localtime &
sudo qemu-system-x86_64 -hda vms/tstapp01/win2003-64.qcow -m 2048 -net nic,macaddr=00:16:3e:33:0e:8a -net tap -nographic -localtime &
sudo qemu-system-x86_64 -hda vms/tstapp02/win2003-64.qcow -m 2048 -net nic,macaddr=00:16:3e:3e:7e:14 -net tap -nographic -localtime &

##############Command to check the available memory####################
free -m
free -m -l -s 2

##############Command to list running KVM/QEMU processes###############
ps -A | grep qemu

Friday, October 2, 2009

Google Gandhi

Wednesday, September 9, 2009

My Ubuntu Desktop


Development version of Chromium browser in Karmic Alpha 5

Wednesday, August 19, 2009

Vala

Programming Language
Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
http://live.gnome.org/Vala


Val(a)IDE
Val(a)IDE is an Integrated Development Environment (IDE) for the Vala programming language.
http://www.valaide.org/


Example Code
class Sample : Object 
{
void run()
{
stdout.printf ("Hello World\n");
}

static void main (string[] args)
{
var sample = new Sample();
sample.run ();
}
}

Code Compilation Example

valac --pkg gtk+-2.0 main.vala


`C` Code Generation Example

valac --pkg gtk+-2.0 -C main.vala


Generated Source

#include <glib.h>
#include <glib-object.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define TYPE_SAMPLE (sample_get_type ())
#define SAMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SAMPLE, Sample))
#define SAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SAMPLE, SampleClass))
#define IS_SAMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SAMPLE))
#define IS_SAMPLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SAMPLE))
#define SAMPLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SAMPLE, SampleClass))

typedef struct _Sample Sample;
typedef struct _SampleClass SampleClass;
typedef struct _SamplePrivate SamplePrivate;

struct _Sample {
GObject parent_instance;
SamplePrivate * priv;
};

struct _SampleClass {
GObjectClass parent_class;
};


static gpointer sample_parent_class = NULL;

GType sample_get_type (void);
enum {
SAMPLE_DUMMY_PROPERTY
};
static void sample_run (Sample* self);
Sample* sample_new (void);
Sample* sample_construct (GType object_type);
static void sample_main (char** args, int args_length1);
Sample* sample_new (void);



static void sample_run (Sample* self) {
g_return_if_fail (self != NULL);
fprintf (stdout, "Hello World\n");
}


static void sample_main (char** args, int args_length1) {
Sample* sample;
sample = sample_new ();
sample_run (sample);
(sample == NULL) ? NULL : (sample = (g_object_unref (sample), NULL));
}


int main (int argc, char ** argv) {
g_type_init ();
sample_main (argv, argc);
return 0;
}


Sample* sample_construct (GType object_type) {
Sample * self;
self = g_object_newv (object_type, 0, NULL);
return self;
}


Sample* sample_new (void) {
return sample_construct (TYPE_SAMPLE);
}


static void sample_class_init (SampleClass * klass) {
sample_parent_class = g_type_class_peek_parent (klass);
}


static void sample_instance_init (Sample * self) {
}


GType sample_get_type (void) {
static GType sample_type_id = 0;
if (sample_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (SampleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sample_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Sample), 0, (GInstanceInitFunc) sample_instance_init, NULL };
sample_type_id = g_type_register_static (G_TYPE_OBJECT, "Sample", &g_define_type_info, 0);
}
return sample_type_id;
}

Wednesday, August 12, 2009

Ubuntu - Restricted Extras

The following command installs flash, java and codecs for different multimedia formats on Ubuntu.

sudo apt-get install ubuntu-restricted-extras


Details: https://help.ubuntu.com/community/RestrictedFormats

DB2-AS/400 SQL - Selecting Column Details

SELECT COLUMN_NAME, COLUMN_TEXT FROM QSYS2.SYSCOLUMNS WHERE TABLE_SCHEMA = '<LIBRARY>' AND TABLE_NAME = '<TABLE>'

Tuesday, June 2, 2009

DB2-AS/400 SQL - Restarting Identity Counter

SQL statement for resetting the identity counter, after clearing the table.
Database Server: IBM AS/400 DB2

ALTER TABLE <TABLE NAME> ALTER COLUMN <IDENTITY COLUMN> RESTART WITH 1