InetAddress Timeout (Duke Dollars Available)

Hi people, am making a program that needs to change IP Addresses to domain names, in most cases this code works fine
InetAddress temp = InetAddress.getByName(ipAddress);
                try {
                    domainName= temp.getHostName();
                catch(UnknownHostException ex)
                { System.out.println("Could not find "+domainName);
            }However, many of the ip addresses will not find a domain name. it will take 5 seconds to discover this where as it will take no time at all to discover a correct domain name if one can be found. is there any way that i can timeout this action if it takes over 20 milliseconds to find a name.
Thank you for your help.
code to correct this will lead to ten duke dollars.

for a java help forum, why does nobody want to be at
all helpful, i am really stuck and would be really
greatful of some helpUm, hardly any time has passed yet. Don't start copping an attitude just yet...
But as alluded to, the duke dollars are utterly worthless. If I wanted 10 more dukes to add to my pile, I could (but wouldn't) just create another login ID, post a fake "question", answer myself with this ID, and award them to "myself".
Do you actually have a question, other than "will someone do my work/thinking for me"?

Similar Messages

  • JTable subclass problem - Duke dollars $$$ available

    I have a JTable which i wish to extend from a basetable i have developed.
    The sub classes do not seem to inherit the superclasses contructor. Am i missing something?
    Here is the super class....
    public class AbstractTable extends JTable{
         protected Statement stmt;
        /** Creates a new instance of AbstractTable */
        public AbstractTable() {
            setVisible(true);
            setBorder(new javax.swing.border.EtchedBorder());
            setToolTipText("Search Results");
            setCellSelectionEnabled(true);
            setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
            setCellSelectionEnabled(true);
            setDoubleBuffered(true);
            setColumnSelectionAllowed(false);
         // optional
            setBackground(new Color(220,220,220));
            setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            setAutoResizeMode(AUTO_RESIZE_OFF);
            // Enable tool tips for the table, without this tool tips will not
            // be picked up.
            ToolTipManager.sharedInstance().registerComponent(this);
               setupConnection ();
        }Here is the cub class
    public class SLATable extends fyp.AbstractTable{
        private MyDBConnection mdbc;
        private java.sql.Statement stmt;
        JTable SLATable = new javax.swing.JTable();
        /** Creates a new instance of SLATable */
        public SLATable()  {
            super();
        public JTable setSLATable(String searchString){...}

    I have a JTable which i wish to extend from a
    basetable i have developed.
    The sub classes do not seem to inherit the
    superclasses contructor. Am i missing something?Constructors are never inherited.
    <snip>
    Here is the cub class
    public class SLATable extends
    fyp.AbstractTable{
    private MyDBConnection mdbc;
    private java.sql.Statement stmt;
    JTable SLATable = new javax.swing.JTable();
    Having an instance variable (if you are aware that this is an instance variable) with the same name as the class could be very confusing to someone reading your code.
    From the short bit of code you've provided, extending JTable seems unnecessary. See:
    http://www.artima.com/lejava/articles/designprinciples4.html

  • 10 duke dollars available for this smple doozy!

    I have just started using Java, and already I need to create a simple game, but I am having problems already.
    The game is designed for 2 player with the one human player and the computer. Players alternatively take sticks from a pile, the player taking the last stick loses.
    The game needs to include:
    1. A random integer between 10-80 to generate the pile of sticks.
    2. Implement a smart mode, which means that if the computer starts the game it cannot lose.
    3. Have the facility to play the game reapeatedly without restarting the game.
    It should look like this:
    The starting size of the pile is xxx sticks
    The 1st player is: yyy
    The 2nd player is: computer
    Playing in the MMM mode
    The ppp starts the game:
    turn:yyy --->> removes QQQ sticks
    turn: computer --->> removes QQQ sticks
    The winner is: computer!
    Another game? (yes/no)
    Any Ideas?
    Many Thanks...
    Dr. K

    I don't understand your game as described but it sounds a lot like nim or one of it's many variants. Do a google search on "nim" for plenty of info. Here is a start:
    http://www.csm.astate.edu/Nim.html
    http://www.chlond.demon.co.uk/Nim.html
    Note that traditionally nim is played with multiple piles.
    The game needs to include:
    1. A random integer between 10-80 to generate the pile
    of sticks.Look at the Random class.
    2. Implement a smart mode, which means that if the
    computer starts the game it cannot lose.Here you have to devise and code a winning strategy. That could be quite challenging depending on the rules of the game.
    3. Have the facility to play the game reapeatedly
    without restarting the game.This is pretty simple. I don't want to sound discouraging but if you can't figure this out then step 2 is out of the question.

  • Classpath probelm--duke dollars available

    Basically I have the following problem
    I have downloaded the comm api. I have installed it and set up the classpaths.
    set CLASSPATH=c:\j2sdk1.4.1_01\lib\comm.jar (This points to the api)
    set CLASSPATH=c:\commapi\samples\Blackbox\BlackBox.jar;%CLASSPATH%
    (This is one of the examples with it)
    And when I run it it is fine.
    I have also made my own simple program called ListPorts.When I compile it is fine but when I try to run it I get errors.
    java c:\ListPorts
    Can anyone help me please

    If you are placing it on the root of C:\, then you should add "C:\" to your classpath.
    As jesper1 stated don't prepend the directory name to the classname. You NEVER do this... NEVER, NEVER, NEVER. The argument is a fully qualified classname. What I mean by fully qualified is the full package & classname.
    For example:
    if you were trying to run a class "i.am.a.java.Newbie"
    o the "i.am.a.java" part is the package
    o and the "Newbie" piece is the classname.
    A fully qualified classname combines both the package and classname.
    Note the syntax defined below. Notice on the first "Usage" line how it says "class". It doesn't say "path to class/class" or anything like that. It just says class.
    C:\>java
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java -jar [-options] jarfile [args...]
               (to execute a jar file)
    where options include:
        -client       to select the "client" VM
        -server       to select the "server" VM
        -hotspot      is a synonym for the "client" VM  [deprecated]
                      The default VM is client.
        -cp -classpath <directories and zip/jar files separated by ;>
                      set search path for application classes and resources
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -showversion  print product version and continue
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions

  • SDN Forum points vs Sun Forum Duke Dollars

    I believe that a points system is a great way to encourage participation by the community in problem solving.
    With the points system in SDN, however, there is room for abuse, for example, by having people you know award points to you on threads.
    I personally like the points reward system (Duke Dollars) on Sun's Developer Forums. In this scheme, you work with credits. Every user is given a certain amount of points (Duke Dollars) when they join. When you post a question, you can assign a number of Duke Dollars up front from your available credit as a reward to entice responses. You can also accumulate more Dollars by answering threads which have Dollars assigned.
    Every month, Sun gives a gift to the user who has accumulated the most points.
    I'm not sure that this solves the problem of users not assigning points for valid help, but, because users are working with limited credit, it does force them to be careful when assigning points, and prevents abuse as that mentioned above.
    I would like to hear what other people think about this scheme. Perhaps there are aspects I have not considered.
    Regards,
    Martin

    Would a moderator make it more positive? 
    Actually Craig went into each of the forums and published a "rules of engagement".  Maybe that kind of a "sticky note" post would be the place to remind people about the inappropriateness of redundant questions (across various forums) and the confusion and poor sporting behavior associated with "copied" answers.  I can ping Craig with that suggestion to add text if you think it makes sense to "remind" people in each of the respective forums.
    Or..to be a little more provocative, we could suggest that community members who have a good track record of participation, collaboration, and exemplary attitude be given the moderator rights in forums where the activity volume might be too overwhelming for an SAP moderator alone to manage and given the rights to move content to a more appropriate thread.
    This is what I meant about "self-policing".  Also, perhaps the moderators (internal as well as SAP) could identify themselves in a sticky post and invite participants in those designated threads to track "abuses" or issues, thus identifying them and hopefully resolving them publically.
    Strange, it reminds me that in old, Puritanical, America, of the 17th century community culprits were subjected to a public dunking or stocks when they broke the law.  The purpose being that public condemnation sent a clear message to other "would be" misbehavers.... and thus deterred further bad conduct.
    While a rather radical and unpleasant method it was an open way of dealing with abuses to the system.
    Perhaps others can offer less extreme and more effective suggestions here
    Marilyn

  • Duke Dollars give away

    Hi
    I have some duke dollars which i have assigned to a post, but no one seems to answer me the question properly, So i am asking people to quickly push some valid answers for this and claim their worthy duke dollars.
    To claim the duke dollars kindly go to this thread and answer it
    9 duke dollars are available
    http://forums.java.sun.com/thread.jsp?forum=45&thread=133596
    Thanks
    Swaraj

    The duke dollars are over.
    Thanks
    Swaraj

  • Hey! Give me Duke Dollars

    I badly need duke dollars. Help me please, Help...Help....!

    10 Dukes on a single question? Must be seriously hard. Some people look to see whether there are Dukes available for a question, but a lot don't. My approach is to add Dukes and assign them only when people give good answers - certainly you look silly assigning 10 Dukes and getting the answer "Check your CLASSPATH", and I suspect most people would feel embarrassed getting 10 Dukes for that.

  • How do you add Duke Dollars to a post???

    How do you get the little Duke Dollars thingy to show up next to your post? There are no buttons to do so on the page where I'm ttyping this, nor on the preview page. Nor does it say anything about it in the Duke Dollars FAQ.

    Oh never mind! I saw the option to add Dukes appear after the message was posted.
    IMHO you should be able to add Dukes either on the form or the preview page.

  • Using WAIT to repeatedly check a file !!Duke dollars!!

    I have created this method, it is supposed to read a text file when a button is pressed after i have allocated an amount of time to check the text file. the text file must be checked every 2mins or so to see if there have been any changes!
    i have some code here but 'wait(10000)' doesnt seem to have any effect!
    can anybody help
    theres 15 duke dollars in it for the best solution
    cheers everyone
    private void polling()
    try {
    wait(10000);
    } catch (Exception e){
    try {
    Stack male = new Stack();
              Stack female = new Stack();
              File esbian = new File("02May2002_Test_Facts.txt");
              FileReader ond = new FileReader(esbian);
              BufferedReader hecker = new BufferedReader(ond);
    int ef;
    String incident = "INCIDENT" ;
              while (true)
                   String lum = new String();
                   String umber = "";
                   String olyfeck = hecker.readLine();
                   if (olyfeck == null)
                        break;
                   StringTokenizer tarman = new StringTokenizer(olyfeck);
                   while (tarman.hasMoreTokens())
    umber = tarman.nextToken();
                        for( ef=0; ef < 1; ef++)
    umber = umber.replace('\u0028' , '\u0020');
    umber = umber.replace('\u0029' , '\u0020');
                        umber = umber.trim().toUpperCase();
    if (umber.equals("INCIDENT" ) || umber.equals("EVENT") ||umber.equals("ALARM") || umber.equals("FAULTRECORD") || umber.equals("INTERPRETEDFAULTRECORD"))
    lum = umber;
                             agentout.append("subscription succeeded: " + umber + "\r\n");
              hecker.close();
    catch(IOException efe)
         System.err.println("ERROR: " + efe) ;
    } // end of method polling

    I have created this method, it is supposed to read a text file when a button is pressed after i have allocated an amount of time to check the text file. the text file must be checked every 2mins or so to see if there have been any changes!
    i have some code here but 'wait(10000)' doesnt seem to have any effect!
    can anybody help
    theres 15 duke dollars in it for the best solution
    cheers everyone
    private void polling()
    try {
    wait(10000);
    } catch (Exception e){
    try {
    Stack male = new Stack();
              Stack female = new Stack();
              File esbian = new File("02May2002_Test_Facts.txt");
              FileReader ond = new FileReader(esbian);
              BufferedReader hecker = new BufferedReader(ond);
    int ef;
    String incident = "INCIDENT" ;
              while (true)
                   String lum = new String();
                   String umber = "";
                   String olyfeck = hecker.readLine();
                   if (olyfeck == null)
                        break;
                   StringTokenizer tarman = new StringTokenizer(olyfeck);
                   while (tarman.hasMoreTokens())
    umber = tarman.nextToken();
                        for( ef=0; ef < 1; ef++)
    umber = umber.replace('\u0028' , '\u0020');
    umber = umber.replace('\u0029' , '\u0020');
                        umber = umber.trim().toUpperCase();
    if (umber.equals("INCIDENT" ) || umber.equals("EVENT") ||umber.equals("ALARM") || umber.equals("FAULTRECORD") || umber.equals("INTERPRETEDFAULTRECORD"))
    lum = umber;
                             agentout.append("subscription succeeded: " + umber + "\r\n");
              hecker.close();
    catch(IOException efe)
         System.err.println("ERROR: " + efe) ;
    } // end of method polling

  • Assigning duke dollars

    How do I award Duke dollars to the best respondent to my question?

    After you post a question, there will be a hyperlink like "assign duke dollar" in the page of your post. Follow it to assign the duke dollar to your question. To reward the duke dollar to the response, you have to log in first, open your post, then you can see a icon in front of every repsponse, you can click the one you want to reward.

  • I wanna assign you ALL my Duke Dollars....

    ...for a new question i have BUT b4 I can do that I need to retrive back the duke dollars from my earlier messages that haven't been answered and have my dollars gathering dust...how on earth do i do that?

    Silkm I have no issues with assigning you all my dukes from all those earlier questions...just go there, type anything and I will assign them to you if u can solve my query...
    It's gotta do with setting the classpath...and yes, i have already been thru google and forums here...
    This is what i do:
    - Start>Control Panel>System>Advanced>Environment Variables
    - Click on Path in the System Variables section
    - Click Edit and add C:\Program Files\Java\j2re1.4.1_01\bin AFTER %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Common Files\Adaptec Shared\System;
    - Next I go to DOS and get my C prompt to C:\Program Files\Java\j2re1.4.1_01\bin
    - I type javac helloworld.java and ENTER
    - I get "javac is not recognised as an internal or external command, operable program or batch file"
    So then I go back to Start>Control Panel>System>Advanced>Environment Variables
    - This time I click on New in the "User Variables for Gaurav" section(that's me) - after all i am logged in as Gaurav on my XP machine!
    - I type Path in Variable Name and C:\Program Files\Java\j2re1.4.1_01\bin in Variable Value
    - Save
    - goto DOS
    - type helloworld.java and get "javac is not recognised as an internal or external command, operable program or batch file"
    BTW i have installed j2re-1_4_1_01-windows-i586 on a XP machine
    HELP!

  • How do you award duke dollars

    How do you award duke dollars

    At the top of your post, ther will be an option to "Assign" duke dollars. Once you assign them to your post, you will see an option to "Award" duke dollars in the header of the replies to the post.
    Why don't you assign a few to this post to witness that! :-)
    Kamran

  • Next/previous links?  Duke dollars...

    I am offering Duke Dollars for help in creating next/previous links here:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=183010
    I was told that I should ask here as there may be more help here...

    Actually I think that respondant was suggesting that you search the JDBC forum - they had already posted some information in here.

  • HI what are duke dollars?

    Hi everyone, just joined the JDC - I am a complete newbie here, what are DUKE DOLLARS? Can you educate me on some things you guys do on the forums? Thanks! :)
    cp_l0g1ck

    That's in the FAQ which you can see here: http://forum.java.sun.com/faq.jsp

  • Duke Dollars, What are they and why are they in this forum?

    Hi,
    Can somebody please tell me what duke dollars are and why they are in this forum? some topics have duke dollars, but don't know what that means.
    Thanks in advance
    Arjen

    hahahahha... the moment i posted this topic, i received the link to assigning dollars to a topic as well as a link to what duke dollars are. :) lol

Maybe you are looking for