Sun Application Server Startup Command: /opt/SUNWappserver/bin/asadmin start-domain --domaindir /opt/SUNWappserver/domains --user admin

Tuesday, September 02, 2008

Oracle: ORA-12519, TNS:no appropriate service handler found on application processing

When running application on SUN application server, it suddenly gets "ORA-12519, TNS:no appropriate service handler found" error message when view a page. Sometime page will show up but sometime it gets error.

SOLUTION: under command window. RUN:
lsnrctl services

Wednesday, July 23, 2008

Javascript: Overwrite layer

<style>

.select-free
{
position:absolute;
z-index:10;
cursor:move;

overflow:hidden;/*must have*/
width:33em;/*must have for any value*/;

}
.select-free iframe
{
display:none;/*sorry for IE5*/
display/**/:block;/*sorry for IE5*/
position:absolute;/*must have*/
top:0;/*must have*/
left:0;/*must have*/
z-index:-1;/*must have*/
filter:mask();/*must have*/
width:3000px;/*must have for any big value*/
height:3000px/*must have for any big value*/;
}

.select-free .bd{
border:solid 0px #000000;padding:0px;

}
#dd1{
BORDER-RIGHT: #000000 2px solid;
BORDER-TOP: #000000 2px solid;
MIN-HEIGHT: 90px;
BORDER-LEFT: #000000 2px solid;
WIDTH: 300px;
BORDER-BOTTOM: #000000 2px solid;
background-color: #F4F1D9

}

.closeBtn {
BORDER-RIGHT: #000000 2px solid;
PADDING-RIGHT: 3px;
BORDER-TOP: #000000 2px solid;
DISPLAY: block;
PADDING-LEFT: 3px;
MARGIN-BOTTOM: 10px;
PADDING-BOTTOM: 3px;
FONT: 0.7em verdana,arial;
MARGIN-LEFT: 112px;
TEXT-TRANSFORM: uppercase;
BORDER-LEFT: #000000 2px solid;
WIDTH: 70px;
COLOR: #ffffff;
PADDING-TOP: 3px;
BORDER-BOTTOM: #000000 2px solid;
POSITION: relative;
BACKGROUND-COLOR: #8b070f;
TEXT-ALIGN: center;
TEXT-DECORATION: none
}


#dd2{left:0px;top:0px;color:white;border:none;}
#dd2 .bd{padding:0;border:none;}
#dd2 .bd * {;color:#FFFFFF;border:solid 0px #000000;padding:1px;margin:0}

#dd2{
*zoom:1;
*background:none;
*filter:progid:DXImageTransform.Micro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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACzMPSIAAABAHRSTlNNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhTh5BAAAAA1JREFUeAEBAgD9/wAAAAIAAX4FDdIAAAAASUVORK5CYII=);
}

</style>

<script>


function alertbox(txt) {

var alertDivObj = null;
if (document.getElementById('alertDiv')==null) {
alertDivObj = document.getElementsByTagName("body")[0].appendChild(document.createElement("div"));
alertDivObj.id='alertDiv';
}

if (document.getElementById('alertDiv')!=null) {
alertDivObj = document.getElementById('alertDiv');
alertDivObj.innerHTML=alertBackground() + alertContent(alertTitle(txt), txt);

var alertObj = document.getElementById('dd2');
alertObj.style.width = document.body.offsetWidth;
alertObj.style.height = document.body.offsetHeight;

// display alert box
var point = getCenterPosition();
var alertObj = document.getElementById('dd1');
alertObj.style.left = point.x;
alertObj.style.top = point.y;

}
return false;
}

function alertTitle(txt) {
if (txt=="Please indicate RAP or SUP" || txt=="Please indicate EIN or SSN")
{
return ALERT_TITLE2;
} else {
return ALERT_TITLE;
}
}


function alertContent(title, txt) {
var content = '';
//content += '<div id="modalContainer" class="modalContainer">'
content += '<div class="select-free" id="dd1"><div class="bd">'
content += '<TABLE width="300"';
content += 'ALIGN="left" BORDER=0 CELLSPACING=1 CELLPADDING=2>';
content += '<TR ALIGN="left" VALIGN="top" class="alertBoxTr">'
content += '<td colspan=2>'+ALERT_TITLE+'</td>';
content += '</TR>';
content += '<TR ALIGN="left" VALIGN="top">'
content += '<td valign="middle"><img src="images/error2.png" border="0"></td>';
content += '<td><font size=2>' + txt + '</td>';
content += '</TR>';
content += '<TR ALIGN="left" VALIGN="top">'
content += '<td colspan=2 ><input type="button" value="'+ALERT_BUTTON_TEXT+'" class="closeBtn" onclick="removeDiv()" onkeypress="removeDiv()"></td>';
content += '</TR>';
content += '</TABLE>';
content += '</div><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>';
//content += '</div>';
return content;
}

function alertBackground() {
var content='';
content += '<div class="select-free" id="dd2"><div class="bd">';
content += ' ';
content += '</div><!--[if lte IE 6.5]><iframe></iframe><![endif]--></div>';
return content;

}

function getCenterPosition() {
var point = new Object();
point.x = 0;
point.y = 0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
point.x = (window.innerWidth/2) - 100;

point.y = window.innerHeight/2;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
point.x = (document.body.offsetWidth/2) - 100;
point.y = document.body.offsetHeight/2;
}
}
if (point.x<0) {
point.x = 0;
}
return point;

}
</script

Friday, July 18, 2008

JAVA: list system properties

Properties p = System.getProperties();
Enumeration keys = p.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)p.get(key);
System.out.println(key + " ***: " + value);
}

or if we want specific property
String classPath = System.getProperty("java.class.path",".");
System.out.println("classPath = " + classPath);

Monday, July 14, 2008

Javascript: Open in iFrame

In div
style="position:absolute;display:none;background-color:white;border:solid 1px gray;border-style:double; z-index:100;"

in javascript
function showdiv(obj, bState, left, top) {
var oDiv = obj;
/*@cc_on @if (@_jscript_version >= 5)
try {
var oIframe = document.getElementById('HelpFrame');
oIframe.scrolling = 'no';
} catch (e) {
var oIframe = document.createElement('iframe');
var oParent = oDiv.parentNode;
oIframe.id = 'HelpFrame'; oParent.appendChild(oIframe);
}

oIframe.frameborder = 0;
oIframe.style.filter='Alpha(Opacity=80)';
oIframe.style.position = 'absolute';
oIframe.style.top = top;
//oIframe.style.left = left;
oIframe.style.display = 'none'; @end @*/
if (bState) {
oDiv.style.margin = "0px";
oDiv.style.padding = "0px";
oDiv.style.top = top;
//oDiv.style.left = left;
oDiv.style.display = 'block';
/*@cc_on @if (@_jscript_version >= 5)
oIframe.style.top = oDiv.style.top;
oIframe.style.left = oDiv.style.left;
oIframe.style.zIndex = oDiv.style.zIndex - 1;
oIframe.style.width = parseInt(oDiv.offsetWidth);
oIframe.style.height = parseInt(oDiv.offsetHeight);
oIframe.style.visibility = "visible";
oIframe.style.display = 'block'; @end @*/
} else {
/*@cc_on @if (@_jscript_version >= 5)
oIframe.style.display = 'none'; @end @*/
oDiv.style.display = 'none'; }
}

SharePoint: Install Report Service Add-in on SQL Server

* Install SharePointRS.msi from \\hqd1\Software\SharePoint 2007 Installation\ReposerServiceAddIn
*Click Start => Programs => Microsoft SQL Server 2005 => Configuration Tools.
*Click Reporting Services Configuration. The Report Server Installation Instance Selection dialog box appears so that you can select the report server instance you want to configure.
*In Machine Name, specify the name of the computer on which the report server instance is installed. The name of the local computer is specified by default, but you can also type the name of a remote SQL Server instance.
* In Instance Name, choose the SQL Server 2005 Reporting Services instance that you want to configure. Only SQL Server 2005 report server instances appear in the list. You cannot configure earlier versions of Reporting Services.
* Click Connect.
* Click Database Setup to open the Database Setup page.
* Enter the name of the SQL Server Database Engine you want to use.
* Click Connect.
* Click New.
* In the SQL Server Connection dialog box, enter a name for the new database.
* Select the Create the report server database in SharePoint integrated mode check box.
* Click OK.
* On the Database Setup page, specify the credentials that are used to connect to the report server database.
* Choose Service credentials to use the Windows service account and Web service account to connect through integrated security.

Choose Windows credentials to specify a domain user account. A domain user account must be specified as \.

Choose SQL Server credentials to specify a SQL Server login.

Click Apply.

Restart the Report Server Windows service.

Friday, July 11, 2008

CVS: Install on Linux Enterprice 5

The version I download is cvs-1.11.23.tar.gz
Create new folder for CVS
1. Create folder under /opt called "cvs".
2. Copy the file cvs-1.11.23.tar.gz to /opt/cvs
3. Create folder under root called "cvs".
4. Create folder under /cvs called cvsroot

Create new group and user:
1. Create group cvs: groupadd cvs
2. useradd -g cvs -G cvs -d /cvs/cvsroot cvsuser
3. Add password: passwd cvsuser

Change folder owner and group to cvs and cvsuser
1. chgrp -R cvs /cvs
2. chown -R cvsuser /cvs
3. chmod 775 /cvs/cvsroot

Install CVS:
1. Go back to /opt/cvs (Should have the cvs-1.11.23.tar.gz in there)
2. Enter: gunzip cvs.tar.gz
3. Enter: tar -xf cvs.tar
4. Enter: ./configure
5. Enter: make
6. Enter: make install

Setup initial state in /cvs/cvsroot
Enter: cvs -d /cvs/cvsroot init (This will create a CVSROOT and related file under CVSROOT folder).

Create password for user:
1. Enter: vi /cvs/cvsroot/CVSROOT/passwdgen.pl
Content in file should be:

#!/usr/bin/perl
  srand (time());
  my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
  my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
  my $plaintext = shift;
  my $crypttext = crypt ($plaintext, $salt);
  print "${crypttext}\n";


2. Save it.
3. Create a encrypted password: For exampel if password in plant text is "test"
Enter: ./passwdgen.pl "test"
4. Enter: vi /cvs/cvsroot/CVSROOT/passwd
Content should be:
username1:encrptedpassword1:cvsroot
username2:encrptedpassword2:cvsroot

Create Service for CVS:
1. Enter: vi /etc/services
2. Add following tow line in proper placs and save it.

cvspserver 2401/tcp #pserver cvs service
  cvspserver 2401/udp #pserver cvs service

3. Go to: cd /etc/xinetd.d
4. Enter: vi cvspserver
Content should be like this:

service cvspserver
  {
disable = no
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
#user = cvsuser
group = cvs
passenv = PATH
server = /usr/bin/cvs
#server = /opt/cvs/cvs-1.11.23
#env = HOME=/var/cvs
#server_args = -f --allow-root=/var/cvs pserver
server_args = -f --allow-root=/cvs/cvsroot pserver
# bind = 127.0.0.1
  }

5. Save it.
6. Restart service: /etc/rc.d/init.d/xinetd restart
7. Check if cvs is running: netstat -l |grep cvspserver
8. Result should be like this:
tcp 0 0 *:cvspserver *:* LISTEN
9. Log into CVS
cvs -d :pserver:username1@202.204.114.37:/cvs/cvsroot login

10. Set path
PATH=$PATH:/usr/bin
export PATH
CVSROOT=/home/cvsroot
export CVSROOT

If we want to move old projects to new projects.
1. Copy from old machine /cvs/cvsroot to new machine /cvs/cvsroot
2. Change group and owner:
chgrp -R cvs /cvs
chown -R cvsuser /cvs

Thursday, July 10, 2008

SharePoint: Deploy/Remove new wsp feature

Create
@SET STSADM=”c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe”
%STSADM% -o addsolution -filename OfficeSpaceFeature.wsp
%STSADM% -o deploysolution -name OfficeSpaceFeature.wsp -immediate - allowGacDeployment
%STSADM% -o execadmsvcjobs

if you get error
This solution contains resources scoped for a Web application and must be deployed to one or more Web applications.

stsadm -o deploysolution -name OfficeSpaceFeature.wsp -immediate -allowgacdeployment -allowcaspolicies -url http://tt.it.com

stsadm -o upgradesolution -name PsiCntLib.wsp -filename PsiCntLib.wsp -immediate -allowGacDeployment

Remove
@SET STSADM=”c:\program files\common files\microsoft shared\ web server extensions\12\bin\stsadm.exe”
%STSADM% -o retractsolution -name OfficeSpaceFeature.wsp -immediate
%STSADM% -o execadmsvcjobs
%STSADM% -o deletesolution -name OfficeSpaceFeature.wsp

By the way deploye EVENT EVENT:
stsadm.exe -o installfeature -name EventHandlerFolderName
stsadm.exe -o activatefeature -name EventHandlerFolderName -url http://xxx/webname/ -force
stsadm -o execadmsvcjobs


stsadm -o deactivatefeature -name EventHandlerFolderName-url http://xxx/webname/
-force
stsadm -o uninstallfeature -name EventHandlerFolderName-force
stsadm -o execadmsvcjobs
--stsadm -o deletesolution -name EventHandlerFolderName-override

Thursday, June 05, 2008

Erorr for Spring configuration file

if getting error
Error creating bean with name 'businessBeanFactory' defined in URL [file:/C:/Sun/AppServer/domains/domain1/applications/j2ee-modules/contracts-ejb/beanRefContext.xml]: Instantiation of bean failed; ...
...to convert value of type [java.lang.String] to required type [org.springframework.context.ApplicationContext]; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type

** Check Database conntection.

Tuesday, May 13, 2008

Disable back button on browser

if(window.history.forward(1) != null) window.history.forward(1);

Wednesday, April 23, 2008

UNIX: Find PID

ps -df | grep gmp

kill -9 [PID]

See memory in kbyte
df -k

Oracle: Error for ORA-16014 and some basic commands

1. Cannot startup instance.
C:/>sqlplus /nolog
SQL> conn username/password as sysdba
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-16014: log 2 sequence# 1383 not archived, no available destinations
ORA-00312: online log 2 thread 1:
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG'

SOLUTION:
SQL> alter database clear unarchived logfile group 2;
SQL> shutdown immediate
Then startup database: (In windows service or do command as follow)
SQL> startup mount

By the way, stop archive use this
SQL> ALTER SYSTEM ARCHIVE LOG STOP;

Thursday, February 14, 2008

Java Mail

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;

Properties property = new Properties();
property.put("smtp server", "test.com");
Session s = Session.getInstance(property,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("from@test.com");
message.setFrom(from);
InternetAddress to = new InternetAddress("to@test.com");
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Test from JavaMail.");
message.setText("Hello from JavaMail!");
Transport.send(message);

Thursday, February 07, 2008

Event ID Errors: 6398, and 6641 on Event Log

If you find out there is still no use for solution on http://support.microsoft.com/?id=946517 and http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1205873&SiteID=1

Try this:
Central Administration > Application Management > Check Services Enabled in this Farm > Check Services Enabled in this Farm
and see if any service has error on the page.

Then open IIS Manager, Go to Application Pools, check every application pool has wrong access user name and password.

Wednesday, February 06, 2008

Interrupt Upgrade SP service by getting "http://go.microsoft.com/fwlink?LinkID=96177"

Open SQL Server and run SQL comment

USE master;
GO
EXEC sp_configure 'show advanced option', '1';

You can review it by using
EXEC sp_configure;

Then run =>Start/Program/Microsoft Office Server/Configures SharePoint Products and Technologies.

Someone also recommend to run command in command window
psconfig -cmd upgrade -force
Then run =>Start/Program/Microsoft Office Server/Configures SharePoint Products and Technologies.