Shweta Gulati

Greenhorn
+ Follow
since Apr 26, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shweta Gulati

Hi,
I have written the code which uses a password to encrypt and decrypt the text that I have passed. This is just the sample code that has been written. I was trying figure out how to make this work because I have to use the password for encrypting the text at one end and the same password at the other end to decrypt the encrypted text. The algorithm that I have used is PBEWithMD5AndDES. There is no compilation error but at runtime error it gives
Exception java.security.NoAlgorithmException: Algorithm not found. [SecretKeyFactory.PBEWithMD5AndDES]
This exception occurs when I try to instantaite the SecretKeyFactory object ( keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES"); )
I am unable to figure out why. Can someone please help me out.
publi void encrytDecrypt
{
PBEKeySpec pbeKeySpec;
PBEParameterSpec pbeParamSpec;
SecretKeyFactory keyFac;
// Salt
byte[] salt = {
(byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c,
(byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99
};
// Iteration count
int count = 20;
try
{
// Create PBE parameter set
pbeParamSpec = new PBEParameterSpec(salt, count);
// Prompt user for encryption password.
// Collect user password as char array (using the
// "readPasswd" method from above), and convert
// it into a SecretKey object, using a PBE key
// factory.
String pass = "shweta";
System.out.print("Enter encryption password: ");
System.out.flush();
pbeKeySpec = new PBEKeySpec(pass.toCharArray());
keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
// Create PBE Cipher
Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
// Initialize PBE Cipher with key and parameters
pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
// Our cleartext
byte[] cleartext = "This is another example".getBytes();
// Encrypt the cleartext
byte[] ciphertext = pbeCipher.doFinal(cleartext);
System.out.println("before encrypted text "+cleartext);
System.out.println("the encrypted text "+ciphertext);
pbeCipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec);
// Decrypt the ciphertext
byte[] cleartext1 = pbeCipher.doFinal(ciphertext);
System.out.println("the decrypted text "+cleartext1);
}
Thanks and Regards,
Shweta
17 years ago
Hi,
I am using jxl api to read data from excel spreadsheet in java. I am facing the problem when I start reading date from the spreadsheet. If I enter the date as mm/dd/yyyy format and then I get the data in Cell object using the getContents method it returns me date in mm/dd/yy format.
I want to know how to get the value that is entered in the cell as it is if the data is in date format.
Thanks and Regards,
Shweta
17 years ago
Hi everyone,
I am totally lost. I want to access the value for registry entry(installpath) where my application is installed through Java script. How do I do it?
Thanks a lot,
Shweta
Hi everyone,
I want to access the registry entry through Java Script. Actually I want to know where certain custom application is installed so that I can modify it in the HTML page.
I know how to do it using Java Applet but I want it to be done at client end using Java Script.
I am lost. Please help me.
Thanks,
Shweta
17 years ago
Hi,
I am trying to read the XML file using the DOM Parser and one of the lines in that XML file has value with new line characters i.e \n. Now when i try to write the data retrieved i.e. the line with the new line character in the text area then the new line character is appearing as it is. i.e. instead of printing the text appearing after \n in a new line it is printing \n followed by the text in the same line.
For eg.
If the text read from XML file is
"Please write this to a \n new line."
The result expected in the text area would be
Please write this to a
new line.
But the result that I am getting is
Please write this to a \n new line.
The same thing if I hard code in a String variable and setText of the textarea with this hard coded value it is giving expected result i.e.
Please write this to a
new line.
Thanks a lot.
Shweta
18 years ago
Thanks Sreepad. I am sorry but I forgot to mention that the username and password that I have supplied is invalid so either the mail server should not send mails or should prompt me to enter valid username and password.
Is there any way in which I can check if the mail server that I am using has the authentication turned on?
18 years ago
Hi,
I was working on Java Mail and was trying to write code for performing server authentication before the mail is sent. I have written the code in two ways but neither of the ways is working. I would like to know where have I gone wrong and how do I rectify it.
I have written a class which extends Authenticator ---

import javax.mail.*;
class SmtpAuthenticator extends Authenticator
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("username", "yourpassword");
}
}
The code for extract using Authenticator ---
Properties props = new Properties();
props.put("mail.smtp.host", server);
code added for authentication
props.put("mail.smtp.auth","true");
Session session = Session.getDefaultInstance(props, new SmtpAuthenticator());
I have also tried the same creating the transport object. The code extract for the same is
Properties props = new Properties();
props.put("mail.smtp.host", server);
code added for authentication
props.put("mail.smtp.auth","true");
Session session = Session.getDefaultInstance(props, null);

transport.connect(server, "yourusername", "yourpassword");
msg.saveChanges();
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();
Java mail is working fine. It is sending the mail but does not prompt me for the password and does not ask for any authentication. Please help me with this as soon as possible.
Thanks.
Shweta
18 years ago
Hi,
I have installed Oracle 9iAs succesfully on Windows 2000. Oracle Portal is also installed and everything is working fine till I try to run the portal.
On the browser as soon as I type in the url to run the portal it shows me the error page cannot be displayed and in the error.log file I get the message ---
[Wed Mar 13 11:18:57 2002] [crit] (10038)An operation was attempted on something that is not a socket: Parent: WSADuplicateSocket failed for socket 548.
[Wed Mar 13 11:18:57 2002] [error] (2)No such file or directory: master_main: create child process failed. Exiting.
There was Macintosh File Services running on the port so I stopped the service and tried to run the portal it again gave me an error message ---
[Wed Mar 13 11:18:57 2002] [crit] (10038)An operation was attempted on something that is not a socket: Parent: WSADuplicateSocket failed for socket 544.
[Wed Mar 13 11:18:57 2002] [error] (2)No such file or directory: master_main: create child process failed. Exiting.
On 544 port there is system service kermenos kshell running.
In the netstat -a command which displays all the ports that are in use this port is not getting displayed.
I am confused how do I come to know if port 544 is in use or not and how do I test the portal.
Thanks a lot,
Shweta
18 years ago
Dear Sean and Mahindrakar,
I guess if you set the transaction attribute to REQUIRES NEW then it would work but I have yet to try it out.
Thanks a lot.
Regards,
Shweta
Dear All,
I have written a finder method in the Container Managed Bean. the finder method works fine if the number of matching records in the database are less but if the number of records in the database exceeds 1000 then it gives an exception --
java.rmi.NoSuchObjectException : CORBA.INV_OBJREF 0:No; Nested Exception is org.omg.CORBA.INV_OBJREF minor code :0 completed: No
Is there a restriction in the number of rows that can be returned in the enumeration? If so, then what is its alternative?
Regards,
Shweta.
Dear All,
I am developing the CMP using IBM Visual Age 3.5. the table to which this bean maps to uses composite primary key.the bean has been developed properly but i wish to get the values in one of the fields of the primary key for which i have specifically written the getter method both in the bean and the remote interface. but i am unable to access the method through the remote object.
when trying to access the same method by running the test client in Visual Age it gives me exception Transaction Rolled Back Exception.
The method that I have written in remote is -
java.math.BigDecimal getCzk_document_no() throws java.rmi.RemoteException;
and the corresponding method written in bean is -
public java.math.BigDecimal getCzk_document_no()
{
return czk_document_no;
}
czk_document_no is the part of the primary key.
Kindly let me know how to access primary key fields through the remote object .
Shweta
Dear All,
I am developing the CMP using IBM Visual Age 3.5. the table to which this bean maps to uses composite primary key.the bean has been developed properly but i wish to get the values in one of the fields of the primary key for which i have specifically written the getter method both in the bean and the remote interface. but i am unable to access the method through the remote object.
Kindly let me know how to access primary key fields through the remote object .
Shweta
Thanks for the reply.I will try that out with websphere 3.5
Shweta
I have installed IBM Websphere Application Server 3.02 on Oracle 8i and using Visual Age for Java 3.5 I have created Container managed entity beans. I have deployed the same in a new application created in Webshpere Application Server. The beans have been deployed perfectly and there was no error while doing the same. the findByPrimaryKey which gives me no error but it throws an exception saying preFind()V method is not found when i try executing any other finder methods. preFind() is the method of the class EJSJDBCPersister class. The container Managed Enterprise Beans along with their finder methods run perfectly fine when tested in the Websphere Test Environment of Visual Age.
Thanks a lot.
Shweta
I have installed IBM Websphere Application Server 3.02 on Oracle 8i and using Visual Age for Java 3.5 I have created Container managed entity beans. I have deployed the same in a new application created in Webshpere Application Server. The beans have been deployed perfectly and there was no error while doing the same. the findByPrimaryKey which gives me no error but it throws an exception saying preFind()V method is not found when i try executing any other finder methods. preFind() is the method of the class EJSJDBCPersister class. The container Managed Enterprise Beans along with their finder methods run perfectly fine when tested in the Websphere Test Environment of Visual Age.
Thanks a lot.
Shweta
19 years ago