New Technologies

  • Java
  • Javascript
  • DTML
  • Dot Net
  • ASP .Net
  • C# .Net
  • PHP
Your Ad Here

Tuesday, May 20, 2008

var varNotes = varNotes.replace(
// Replace out the new line character.
new RegExp( “\\n“, “g” ),

// Put in … so we can see a visual representation of where
// the new line characters were replaced out.
“<br>”
);

Saturday, May 10, 2008

SSL in WEBLOGIC7.0

SSL Generation PROCESS

WEBLOGIC SSL Generation PROCESS

STEP 1:

The CertGen is only used for weblogic and works only on the system installed weblogic.

Set the class path in system environments variables to \bea\weblogic700\server\lib\weblogic.jar

Generate a Private key and a certificate (public key) using CertGen

Syntax:

Java utils.CertGen [EXPORT] [hostname]

Password : This is the password given to the private key.

Certfilename : This is the file name for the certificate. This is also called Public keyfilename : This is the name of the private key file.

Export : use this option, so that weblogic accepts the key.

Hostname : By default the hostname is the system name.

E.g.:

Java utils.CertGen satish123 weblogiccert weblogickey export www.credense.com

The files generated by the above example are:

Public keys (certificates)

Weblogiccert.pem (this is in pem format)

Weblogiccert.der (this is in der format)

Private keys:

Weblogickey.pem (this key is in pem format)

Weblogickey.der (this key is in der format)

STEP 2:

Then generate a jks file using the above-generated private and public keys.

If we give an already existing file for a jks then the importprivatekey will override the contents and generate a new file so careful when giving the jks file name.

Syntax:

Java utils.ImportPrivateKey keystore keystorepass alias keypass certfile keyfile

E.g.: java utils.ImportPrivateKey satish.jks satish123 weblogickey satish123 weblogiccert.der weblogickey.der

Keystore : Name of the keystore (jks file name)

Keystorepass : Password for keystore.

Alias : this is the name we have to give in Server Private Key Alias in weblogic console (see below fig).

Keypass :Password of the private key given when generating the key

Certfile :name of the certificate filename.

Keyfile :name of the private key filename.

STEP 3:

The below step is not necessary if we give the path in the startWebLogic.cmd

The trustedCAKeyStore is the path and name of the java key store (jks)

And the pkpassword is the password for the keystore.

If we have not given this weblogic will take the default keystore as j2sdk1.4.2_10\jre\lib\security\cacerts and the default password is “changeit” if we have not given the string . -Dweblogic.management.pkpassword in startweblogic.cmd.

set JAVA_OPTIONS=-Dweblogic.management.pkpassword=satish123

set JAVA_OPTIONS=-Dweblogic.security.SSL.trustedCAKeyStore=D:\Satish\ssl\keys\satish.jks

Then import the above generated public key or certificate to

j2sdk1.4.2_10\jre\lib\security\cacerts

STEP 4:

Configuration in weblogic7.0 server

Go to https://localhost:7002/console

Now go to servers select myserver à connections à SSL


Set the default key store

Private Key Store Location:

To the jks that is generated for weblogic

Private Key Store Pass Phrase: Give the password

Declare the Server Private Key Alias: the alias name give for generation of weblogic keys.

Server Certificate File Name the path and name of the certificate file

Server Key File Name: give the name of private key

Server Private Key Pass phrase: Give the required password

STEP 5:

Now restart the weblogic server to get the ssl try this on the default port no 7002

Tuesday, April 15, 2008

How to Save and read Files from javascript?

<html><head>
<SCRIPT LANGUAGE='JavaScript'>
var password='theirpassword';
var name='username';

function WriteToFile() {
var filename = 'c://temp.txt';
var fso = new ActiveXObject('Scripting.FileSystemObject');
if (fso.FileExists(filename)) {
var a, ForAppending, file;
ForAppending = 8;
file = fso.OpenTextFile(filename, ForAppending, false);
file.WriteLine(name);
file.WriteLine(password);
}
else {
var file = fso.CreateTextFile(filename, true);
file.WriteLine(password);
file.WriteLine(name);
}
file.Close();
}

function ReadIt() {
var filename = 'c://temp.txt';
if (confirm('Do you want to see what we put on your computer?')) {
var fso, a, ForReading;
ForReading = 1;
fso = new ActiveXObject('Scripting.FileSystemObject');
file = fso.OpenTextFile(filename, ForReading, false);
var name = file.readline();
var password = file.readline();
file.Close();
document.write(name + '<br>');
document.write(password);
}
}
</SCRIPT>
</head>
<body onload='WriteToFile();ReadIt()'>
</body>
</html>

Tuesday, March 18, 2008

How to over Popup windows

<script language="javascript">

//set object to hold windows

var oWindowsT = new Object();



function openWindowCheck(pageId) {

//open window

openWin(pageId);



//check if the window opened

setTimeout("checkOpen(\"" + pageId+ "\")",1000);

}





function checkOpen(pageId) {

try {

if ( (!oWindowsT[pageId]) || (oWindowsT[pageId].closed) ) {

//handle code how ever you want

var elem = window.document.getElementById("popupmsg");

elem.style.visibility = "visible";

} else {

var elem = window.document.getElementById("popupmsg");

elem.style.visibility = "hidden";

}

}catch(e){

//if unable to read var show message

}

}



function closeIt() {

window.document.getElementById("popupmsg").style.visibility = "hidden";

}

//open a window

function openWin(pageId) {

switch (pageId) {

case "page1":

//set window properties

var sPar = "width=500,height=500";

handle = window.open("http://rachasatish.blogspot.com/",pageId,sPar);

break;

case "page2":

//add code for another id

//handle = window.open(sURL,page,sPar);

break;

default:

}

//add handle to window object holder

oWindowsT[pageId] = handle;

}



</script>


<body onload="openWindowCheck('page1');" style="margin:0">

<style>

#msg{

background-color:#ccffff;

height:200;

width:200;

font-family:verdana

}

</style>

<div id="popupmsg" style="visibility:hidden;text-align:center;">

<div id="msg" style="">

^<br />

^<br />

^<br />

^<br />

It appears you have your popup blocker turned on for this site.

<br />

<a href="javascript:closeIt()">close</a>

</div>


</body>

Saturday, March 8, 2008

Code to Get All the Headers in Java

Enumeration enum1 = request.getHeaderNames();

String name = "user-agent";

String value = request.getHeader(name);

if (value == null) {

// The request header was not present

}

for (; enum1.hasMoreElements(); ) {

// Get the name of the request header

name = (String)enum1.nextElement();

out.println(name);


// Get a value of the request header

value = request.getHeader(name);


// If the request header can appear more than once, get all values

Enumeration valuesEnum = request.getHeaders(name);

for (; valuesEnum.hasMoreElements(); ) {

// Get a value of the request header

value = (String)valuesEnum.nextElement();


out.println(value+"
");

}

}

Sunday, February 24, 2008

XSD validation in Javascript

<SCRIPT LANGUAGE="JavaScript">
var sOutput = validateFile("sc-valid.xml");
alert(sOutput);

function validateFile(strFile)
{
// Create a schema cache and add books.xsd to it.
var xs = new ActiveXObject("MSXML2.XMLSchemaCache.4.0");
xs.add("urn:books", "sc.xsd");

// Create an XML DOMDocument object.
var xd = new ActiveXObject("MSXML2.DOMDocument.4.0");

// Assign the schema cache to the DOMDocument's
// schemas collection.
xd.schemas = xs;

// Load books.xml as the DOM document.
xd.async = false;
xd.validateOnParse = true;
xd.resolveExternals = true;
xd.load(strFile);

// Return validation results in message to the user.
if (xd.parseError.errorCode != 0)
{
return("Validation failed on " + strFile +
"\n=====================" +
"\nReason: " + xd.parseError.reason +
"\nSource: " + xd.parseError.srcText +
"\nLine: " + xd.parseError.line + "\n");
}
else
return("Validation succeeded for " + strFile +
"\n======================\n" +
xd.xml + "\n");
}

</SCRIPT>
=========================

File: sc-valid.xml
-------------------
<?xml version="1.0"?>
<x:catalog xmlns:x="urn:books">
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
</x:catalog>

-----------------------------
File: sc.xsd
-----------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:books"
xmlns:b="urn:books">
<xsd:element name="catalog" type="b:CatalogData"/>
<xsd:complexType name="CatalogData">
<xsd:sequence>
<xsd:element name="book"
type="b:bookdata"
minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="bookdata">
<xsd:sequence>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="genre" type="xsd:string"/>
<xsd:element name="price" type="xsd:float"/>
<xsd:element name="publish_date" type="xsd:date"/>
<xsd:element name="description" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>

Friday, January 4, 2008

New Technologies

Some New technologies in Web Development
1.Javascript
2.Java
3.PHP
4.Dot Net
5.ASP .Net
6.C# .Net
7.DTML
Your Ad Here