Java.io.IOException: Invalid header signature; read

Hi,

Today I was creating a Java Program to read a Excel files (created by importing text log files)  using  POI HSSF and faced the following errors:

java.io.IOException: Invalid header signature; read 8751655596022002505, expected -2226271756974174256 .

 After a analysis i found that the excel file I am using is not an Excel binary file. It's a text file with a .xls extension s.t. Excel can quietly convert it and display as a spreadsheet. HSSF deals with files written in Excel format only.

 I used the Save As… command to save that file as Excel . And now the problem is Solved :).

document.forms[0].submit is not a function

Firstly check do you have any fields or buttons etc... on the form that have the name or id "submit".
If so these will shadow (hide) the submit function of the form object and thus attempting to call form.submit()
will give you an error as you are now attempting to call an object that is not of the function type (functions injavascript
are objects to and exist as properties of their parent object in the same way as other objects).

Javascript: Member Not found

I was using the following code to open the pdf files using popup. 

User come to a page that has 2 links that open with the below function. both opens a  pdf. If the user clicks the pdf link and then minimizes it and then clicks the other link  the Member not found error generates.

WRONG 

function popUp(strURL, strType, strWidth, strHeight, winName, leftPos, topPos) {
    var strOptions="";
    if (strType=="nocontrols") {
        strOptions="scrollbars,resizable,height="+ strHeight+",width="+strWidth+",left="+leftPos+",top="+topPos;
    }
    if (strType=="controls") {
        strOptions="toolbar,menubar,location,scrollbars,resizable,height="+strHeight+",width="+strWidth+",left="+leftPos+",top="+topPos;
    }
  var   newWin = window.open(strURL, winName, strOptions);   

newWin.focus() 

 The problem was when the window opens it lost is reference & parent window throws the error use the following modified code to resolve this issue.

 RIGHT

var newWin;
function popUp(strURL, strType, strWidth, strHeight, winName, leftPos, topPos) {
    var strOptions="";
    if (strType=="nocontrols") {
        strOptions="scrollbars,resizable,height="+ strHeight+",width="+strWidth+",left="+leftPos+",top="+topPos;
    }
    if (strType=="controls") {
        strOptions="toolbar,menubar,location,scrollbars,resizable,height="+strHeight+",width="+strWidth+",left="+leftPos+",top="+topPos;
    }
    newWin = window.open("", winName, strOptions);
    newWin.close();
    newWin = window.open(strURL, winName, strOptions);
    if (window.focus)
    {
    newWin.focus()
    }
}

 

com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required (#5.7.1)

Errors:

DEBUG SMTP: use8bit false
MAIL FROM:<nitingautam@……com>
530 authentication required (#5.7.1)
com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required (#5.7.1)

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at practical.Mailer.main(Mailer.java:37)
QUIT
com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required (#5.7.1)

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at practical.Mailer.main(Mailer.java:37)
 

 It requires session authentication

Working Code 

package practical;

import java.security.Security;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class GoogleTest {

private static final String SMTP_HOST_NAME = "smtp.gmail.com";
private static final String SMTP_PORT = "465";
private static final String emailMsgTxt = "Test Message Contents";
private static final String emailSubjectTxt = "A test from gmail";
private static final String emailFromAddress = "something@gmail.com";
private static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
private static final String[] sendTo = {"someone@gmail.com"};

public static void main(String args[]) throws Exception {

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

new GoogleTest().sendSSLMessage(sendTo, emailSubjectTxt,
emailMsgTxt, emailFromAddress);
System.out.println("Sucessfully Sent mail to All Users");
}

public void sendSSLMessage(String recipients[], String subject,
String message, String from) throws MessagingException {
boolean debug = true;

Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
props.put("mail.debug", "true");
props.put("mail.smtp.port", SMTP_PORT);
props.put("mail.smtp.socketFactory.port", SMTP_PORT);
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
props.put("mail.smtp.socketFactory.fallback", "false");

Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {

protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("something@gmail.com", "pass");
}
});

session.setDebug(debug);

Message msg = new MimeMessage(session);
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);

InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++) {
addressTo[i] = new InternetAddress(recipients[i]);
}
msg.setRecipients(Message.RecipientType.TO, addressTo);

// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
}
}