suheel hussain

Greenhorn
+ Follow
since Nov 01, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by suheel hussain

Con,
How do I get started with Xerces? I am having a hard
time looking for XML parser class in Xerces. Which class do I instantiate to get Xerces XML parser?
I would appreciate your help.
Sorry if this is not the right forum...
I am trying to write a simple class to parse my XML
document. I thought I would use org.xml.* but turns
out that I have to implement a parser -- implementation of XMLReader.
To this effect I downloaded Xerces (Apache) XML parser. My questions are:
1. What is XML parser class name?
2. How do I instantiate this parser? Or use it in
java command line?
3. How do I register ContentHandler with this
parser?
I would appreciate any suggestions...
Remote machines are pinged using ICMP packets at
IP layer. Java (atleast 1.3) does not provide
mechanism to construct a raw IP packet -- i.e., application can only construct TCP or UDP packets.
You would have to create a socket to find if a remote machine is active.
Another easy way is to create JFileChooser at the start of application and keep this chooser until end of application.
public class blahblah {
private JFileChooser chooser = new JFileChooser;
// local public and private functions
} // end of application
since chooser has a class scope, it retains last selected directory/file information.
23 years ago
I have written an application complete with Desktop,
split panes, etc. This application runs quite slow. Are there any good Java optimizer out there, preferrably open source?
23 years ago
I have a problem trying to compile my code which use regex package. The compiler always complains about unable to resolve .Matcher class of java.util.regex.* package.
Any suggestions...
23 years ago
just a dumb question: Is javax.mail package part of only j2ee? I could not locate mail
package in standard edition!
23 years ago
I use Sun's FORTE IDE Unix and Windows' version. The basic version of FORTE is free. I am sure Sun would have a LINUX version of FORTE. (This IDE is available on their java site.)
Tom,
Just what I was looking for! Could you give me the URL or
better send me the package @ [email protected]. Would appreciate
it.
-suheel
I also want to change scrollbar width in Metal L&F. Would you
have an actual code fragment which would do so?
Thanks
-suheel
23 years ago
I had a simialr problem where selecting an entry in JList brings
up an internal frame, etc. My solution was to create a hash table
and use JList entry as a key for corresponding string to be
displayed in text field. Thus, selected JList entry is used to
search corresponding text field in hash table.
(I prefer using Hashtable instead of Vector.)
23 years ago
I have an application in which I need to trap CTRL-char
and ALT- keystrokes
Is there a way to this? I use KeyListener but it is very primitive
23 years ago
ersin,
thanks that worked.
BTW, I have a password which contains '@'. How could I force
FTP URL to take '@' as a part of password?
I wrote a small ftp code to connect to a ftp server. The code
is able to construct FTP URL but fails to open the connection.
Any reason(s) for failure? Would appreciate help!
Code:
Code:
import java.lang.*;
import java.net.*;
import java.io.*;
public class ftp_test {
InetAddress address;
URL ftpurl;
InputStream in;
URLConnection ftpconnection;
public ftp_test (String hostname, String userid, String password) {
try {
address = InetAddress.getByName(hostname);
} catch (UnknownHostException e) {
System.out.println("getByName failed: " + e);
System.exit(-1);
}
try {
String urlstring = new String();
urlstring += "ftp://" + userid + "@" + hostname;
System.out.println("FTP url string " + urlstring);
ftpurl = new URL(urlstring);
System.out.println("FTP URL is: " + ftpurl);
} catch (MalformedURLException e) {
System.out.println("ftpurl failed: " + e);
System.exit(-1);
}
/* open connection to url */
try {
ftpconnection = ftpurl.openConnection();
System.out.println("Opened url connecction");
} catch (IOException e) {
System.out.println("Connection open failed: " + e);
System.exit(-1);
}
}
static public void main (String[] args) {
if (args.length < 3 ) {
System.out.println("Usage: ftp_test <host> <userid> <password>");
System.exit(0);
}
new ftp_test(args[0], args[1], args[2]);
}
}
Run test:
java junk@mydom myname mypwd
Output:
FTP url string ftp://[email protected]
ftp url construction successful
FTP URL is: ftp://[email protected]
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1525)
at sun.net.www.protocol.ftp.FtpURLConnection.<init>(FtpURLConnection.java:67)
at sun.net.www.protocol.ftp.Handler.openConnection(Handler.java:52)
at java.net.URL.openConnection(URL.java:781)
at ftp_test.<init>(ftp_test.java:35)
at ftp_test.main(ftp_test.java:68)