Page 1 of 3 123 LastLast
Results 1 to 20 of 51
  1. #1
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default Help: strike out in my code

    hey need some help here.
    why there is a stirke out in my code like below
    sorry wun be able to create a link here so here the url below.

    i150.photobucket.com/albums/s90/fiqueudrue/hhh.jpg

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    That's the right margin of the editor. No need to worry about that at coding time. Actually use it for two reason.

    1. To keep away horizontal scroll bar. Easy to read the full page
    2. For Java documenting. That margin define the right-side end of the page. If it's going to exceed, NetBeans wrap them to the define page size. In that case your text can be too small.

  3. #3
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    bro thanks for your reply.
    but wat i meant was the strike out for the code line such as:

    dtStart.setDay(st.getDay());
    dtStart.setMonth(st.getMonth());
    dtStart.setYear(st.getYear());

    the strike out can be seen for st.GetDay(), st.getMonth()) ,st.getYear(),

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Ah that's what you are talking about.

    That's the way NetBeans notified deprecated methods. Those methods are deprecated with the version you are working on. Read on the Java doc, you can find the Suns' suggestion on that.

    Keep the cursor on that method and press Shift + F1 to open the Java doc on the NetBeans.

  5. #5
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    yea alright ... :D
    ok so i did enter the documetation, which mean the above strike out code contains error which the documentation can help suggest the correct input that need to be coded?
    Last edited by fiqueudrue; 12-23-2008 at 02:34 PM.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Those are not wrong, not comes with errors. But the way it's working is not safe. So Suns' have safe implementations for that. They suggest to use something different. Actually you can use the same things in your code. But keep in mind they are not safe to use.

  7. #7
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    yeah i should agree with you that these code could be dangerous.

    because when i trired to run the program,and after sdelecting the approx date, which is specifically set from 17-03-2008 to 20-03-2008, the result will show none, but for the exception result stated,

    javax.xml.ws.soap.SOAPFaultException: Server was unable to process request. ---> SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

  8. #8
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    btw, is there any other method than by invoking this:

    javax.xml.datatype.XMLGregorianCalendar dtStart;
    dtStart = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    javax.xml.datatype.XMLGregorianCalendar dtEnd ;
    dtEnd = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    Date st = cldStart.getSelectedDate();
    Date en = cldEnd.getSelectedDate();

    dtStart.setDay(st.getDay());
    dtStart.setMonth(st.getMonth());
    dtStart.setYear(st.getYear());

    dtEnd.setDay(en.getDay());
    dtEnd.setMonth(en.getMonth());
    dtEnd.setYear(en.getYear());

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  10. #10
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    alright ..
    will keep updating about the possible result here.
    thanks :D

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Simply you want to get the current date/time information, isn't it?

    Anyway have a try and see.

  12. #12
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    yea..
    get the date/time of the data given to that date and show the result.
    not sure if im doing is correct

    Date st = cldEnd.getSelectedDate();
    Date en = cldEnd.getSelectedDate();

    java.util.Calendar stc =java.util.Calendar.getInstance();
    stc.setTime(st);

    dtStart.setDay(stc.setTime());
    dtStart.setMonth(st.getMonth());
    dtStart.setYear(st.getYear());
    dtEnd.setDay(en.getDay());
    dtEnd.setMonth(en.getMonth());
    dtEnd.setYear(en.getYear());

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    oK what happen when you work on with this code in your application? Did you get the correct results?

    I'm not quite clear what you are doing here. Specially because of this,

    Java Code:
    dtStart.setDay(stc.setTime());

  14. #14
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    hey bro sorry for the late reply, festive season ya.
    heee..

    alright, basically, im doind a web service client.

    whereby the code generate itself when i called it like below:

    try {

    // Call Web Service Operation
    org.hogauctionwebservice.AuctionServiceSoap port = service.getAuctionServiceSoap();

    // TODO initialize WS operation arguments here
    javax.xml.datatype.XMLGregorianCalendar dtStart = new javax.xml.datatype.XMLGregorianCalendar();
    javax.xml.datatype.XMLGregorianCalendar dtEnd = new javax.xml.datatype.XMLGregorianCalendar();

    // TODO process result here
    org.hogauctionwebservice.ArrayOfAveragePricePerDay result = port.getHogAuctionPrices(dtStart, dtEnd);
    System.out.println("Result = "+result);

    } catch (Exception ex) {
    // TODO handle custom exceptions here
    }

  15. #15
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    and i edited the current code to be like this:
    however,it not working.
    the code with dtStart.setDay(stc.DAY_OF_WEEK); where by stc show Access Static Field with orange underline


    try {

    org.hogauctionwebservice.AuctionServiceSoap port = service.getAuctionServiceSoap();

    javax.xml.datatype.XMLGregorianCalendar dtStart;
    dtStart = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    javax.xml.datatype.XMLGregorianCalendar dtEnd ;
    dtEnd = javax.xml.datatype.DatatypeFactory.newInstance().n ewXMLGregorianCalendar();

    Date st = cldEnd.getSelectedDate();
    Date en = cldEnd.getSelectedDate();

    java.util.Calendar stc = java.util.Calendar.getInstance();
    stc.setTime(st);

    java.util.Calendar enc = java.util.Calendar.getInstance();
    stc.setTime(en);

    dtStart.setDay(stc.DAY_OF_WEEK);
    dtStart.setMonth(stc.MONTH);
    dtStart.setYear(stc.YEAR);

    dtEnd.setDay(enc.DAY_OF_WEEK);
    dtEnd.setMonth(enc.MONTH);
    dtEnd.setYear(enc.YEAR);

    org.hogauctionwebservice.ArrayOfAveragePricePerDay result = port.getHogAuctionPrices(dtStart, dtEnd);

    List<org.hogauctionwebservice.AveragePricePerDay> d = result.getAveragePricePerDay();

    for(int i = 0; i < d.size(); i++){
    org.hogauctionwebservice.AveragePricePerDay tm = d.get(i);
    lblResult.setText("Transaction ID = " + tm.getTransactionID() + " Date = " + tm.getDate() + " Average Price = " + tm.getAvePrice().toString());
    }

    } catch (Exception ex) {
    lblEx.setText(ex);
    }

  16. #16
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  17. #17
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    the message shows "Accessing static field DAY_OF_MONTH" for the code dtStart.setDay(stc .DAY_OF_MONTH);and so on for the rest of the code...
    Last edited by fiqueudrue; 12-28-2008 at 08:11 AM.

  18. #18
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    or do i need to replace that code with this :

    dtStart.setDay(java.util.Calendar.DAY_OF_MONTH);

  19. #19
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Ok what happen when you try that?

    Actually you can access static members with class name as the reference, rather using an object.

  20. #20
    fiqueudrue's Avatar
    fiqueudrue is offline Member
    Join Date
    Dec 2008
    Location
    Singapore
    Posts
    55
    Rep Power
    0

    Default

    the result shown:

    javax.xml.ws.soap.SOAPFaultException: Server was unable to process request. ---> SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Page 1 of 3 123 LastLast

Similar Threads

  1. Is it possible to code like this?
    By Orange in forum New To Java
    Replies: 8
    Last Post: 08-13-2008, 10:29 AM
  2. Need help with web code
    By nemutah1 in forum New To Java
    Replies: 1
    Last Post: 07-10-2008, 08:33 PM
  3. I need help fixing my code.. or non code?
    By MrHuggykins in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 10:12 PM
  4. tic tac toe code
    By zoe in forum New To Java
    Replies: 1
    Last Post: 07-23-2007, 04:36 PM
  5. Replies: 1
    Last Post: 04-26-2007, 03:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •