Trying To Understand Pattern in Variable of Type Double

Does any one know what could have caused the following strange pattern? Focus on finding the sequence 1211
-2.9164014687882487
3.1835985312117456
-2.51640146878826
-20.216401468788252
2.5835985312117393
-11.716401468788257
3.483598531211757
1.8835985312117554
11.383598531211748
-1.216401468788253
I would like to understand the reason for the pattern. Here's how each number comes about:
1. From a txt file pull two digit precision numbers i.e., 2.01, 3.65, 4.94 etc.
2. Subtract two of these and divide by another number of the same precision.
3. Assign the result to a double variable called result.
4. printout the result
I suspect that I am just catching some junk after the two digits and somehow that junk is mostly consistent -probably pointing at the same memory location or something like that. Still I would like to understand this a little better.
Also, note that sequence 1211 consistently shows up in positive numbers while the sequence 8788 shows up consistently in negative numbers.
Any feedback appreciated.

It's not leftover junk in memory locations or anything like that. Java isn't that stupid. It's more likely to be something to do with the number you are dividing by.
For example if you always divided by 3 (a simple example), your result would eventually go "...33333" or "...66666". This isn't a fluke or a bug, it's just something about the number 3.

Similar Messages

  • Trying to understand the difference in dvd types

    I just purchased a samsung dvd recorder so I can record from my TV.
    I tried recording something on DVD -R which is what my ibook reads.
    The dvd recorder can play what I recorded but the ibook doesn't even acknowledge the dvd when I put it in the slot & I have to restart in order to get the dvd out.
    Please excuse my lack of knowledge of this but what am I doing wrong?
    Thanks in advance!
    -Jeff in NYC
    PS just bought a 15" MacBookPro, can't wait for it to arrive!

    Jeff let me see if I can shed any light on your delima.
    First not all DVD is the same, Software has a lot to do with your success.
    Nero Software used by PC if not properly confiqured will not play on a Mac.
    Roxio, Toast and Popcorn has 3 different settings PC, only...Mac, only...PC or Mac..
    Many DVD recorders like you bought need to be directly connected to your Mac to copy succesfully, While others can copy .
    There are several different ways to accomplish what you want. You will have to be careful when purchasing different pieces of Hardware.
    Many require you to hook up Video and Audio Cable and play VHS or TV and record direct to your Mac.
    http://www.videohelp.com/dvd
    Here are the factors that can affect the burning process
    http://docs.info.apple.com/article.html?artnum=25402
    Cheers Don

  • Trying to understand the PATH variable

    Greetings,
    I read that the PATH variable specifies a set of directories where executable programs are located. But if I use "echo $PATH" in Terminal to view the directories, it does not list the Applications folder or the Downloads folder or any of the other places I have programs. So how to they run?
    Thanks

    The PATH variable is a list of search paths used by a particular shell. Basically, when you enter a command in a command-line context (such as from within Terminal.app), the unix system will search for executables in all of the folders listed in the PATH variable, running the first it finds.
    Apps that are run from the GUI are launched by the launch services daemon, which takes care of all the details of locating and loading executable. Launch services maintains a database of app locations, so it wouldn't need to search along unix PATHs to find what it needs.

  • Trying to understand Provides Dependency type

    I am trying to understand the Provides dependency type. I have
    reviewed the online documentation, but I'm not quite there yet.
    I have a SQL script, with a create table statement, to create
    the CUST table. When I parse the SQL script, I think I should
    get a Provides dependency with a subtype of Created. However, I
    don't get any Provides dependency types.
    Am I missing a step? Do I need to create something else? Or
    have I completely missed the boat?
    Thanks!
    Vini

    Vandana,
    What you see is the way the Dependency Manager is designed to
    work. When you parse a file or object it looks for things it
    provides and things it uses.
    In the case of a ddl script with a create table statement the
    dependency tables will populated with provides dependencies for
    the table and the columns. If this is all you have parsed, and
    you use the dependency manager to show the dependencies for ddl
    file you will see no dependencies in the right hand side results
    pane. This is correct. In the left hand pane of the Dependency
    manager you expand the ddl file node you will see the table(s)
    created in the file. These are the provide dependencies.
    (As an aside, if you parse an Oracle Form and select the form in
    the Dependency manager left pane, you can expand the node and see
    all the blocks and items etc in the form. This is because the
    form "provides" all these "things" that maybe subclassed into
    other forms)
    If you subsequently parse other objects/files that use the table
    then you will see the dependencies between them in the right hand
    pane.
    The slightly confusing part is if you have modelled the table in
    Designer as well as stored the ddl that creates the table the
    dependency manager doesn't show dependencies between them. The
    product just treats these as two providers of the same table. So
    this means when look at, say a form that uses the table, the
    dependency manager will show that the for uses both file and
    modelled table.
    I hope this makes things clearer
    Regards
    mark

  • Trying to understand variables in Edge Animate

    I am writing ALL my code in the document.compositionReady window and have a few questions.
    1. I am trying to understand the use of sym.setVariable() vs using the var keyword. It seems that if I declare
    var myVar = "test" then the variable myVar is available in all my functions further down the code. So when would I use sym.setVariable("myVar","test")?
    2. Since I am writing all my code on document.compositionReady is it possible to edit the code in Dreamweaver. (I like the find and collapse functions in DW). I tried opening the edgeActions.js file and making some edits but they did not seem to always work.
    3. Back to variables. If I define a variable within a function by using the var keyword, it seems to only be available within that function. Is that true? How do I define a variable in a function that is available globally?
    4. Clearly I am mixing javascript, jquery and edgeAnimate API in my code. Is that ok? I am making my animations work but concerned that I am not doing this efficiently/effectively.
    Thanks for any tips, advice, comments.

    Hi, Marlene-
    #2: You should be able to use any editor to edit the edgeActions.js file.
    #1,3: Variables can be declared for local scope (within the function) and attached to various scopes within the composition.  I tend to use variables attached to various symbols to maintain state within that particular scope.  For instance, in the floral sample file, I attached the game score to the game board symbol so that when it was destroyed and recreated, it would reinitialize to 0.
    http://html.adobe.com/edge/animate/showcase.html
    #4: That should be fine.
    Hope that helps answer some of your questions!
    -Elaine

  • Trying to understand the code???

    Hi,
    I am trying to understand the following bit of code, currently the code puts each catalogue into a different row of the table but i want each catalogue to be put in the next column
    (so the catalogues appear across the page on the actual web page). The following code is for the page in question but im not sure how much is relevant so i will paste it all and highlight the section i think is relevant:
    <html>
    <%-- DECLARATIONS --%>
    <%@ page import="se.ibs.ns.cf.*,  se.ibs.ccf.*, se.ibs.bap.*, se.ibs.bap.util.*, se.ibs.bap.web.*,  java.util.*, se.ibs.ns.icat.*, se.ibs.bap.asw.cf.*, java.lang.*" %>
    <% ItemCatalogueBean bean = (ItemCatalogueBean)SessionHelper.getSessionObject("ItemCatalogueBean",session);
       String resourcePath = bean.getResourcePath(null);
       String title = "Product catalogue";
       String languageCode = bean.getLanguageCode();
    %>
    <%@ include file="FuncHead.jsp" %>
    <BODY class="IBSBody" onLoad="loaded = true;">
    <form method="POST" action=<%= bean.getEncodedServlet("se.ibs.ns.icat.ItemCatalogueSearchServlet", response) %> name="basicForm">
    <%@ include file="FuncSubmitScript.jsp" %>
    <%@ include file="FuncPageBegin.jsp" %>
    <div align="center">
      <table border="0" width="895">
        <tr>
          <td align="left" width="502">
    <div align="left">
      <table border="0" width="500">
        <tr>
          <td class="IBSPageTitleText" align="left" valign="top" width="238">
              <%@ include file="FuncPageTitle.jsp" %>
              <%@ include file="FuncPageTitleImage.jsp" %>
                    <br>
           On this page you can see the product catalogues. Click on one of the
           links to go to the next level. Alternatively you can click the <b>Search
           catalogue</b> button to find the products of interest.</td>
               <td width="248" valign="bottom">
                <div align="left"><%@ include file="FuncShoppingCart.jsp" %></div>
               </td>
        </tr>
      </table>
    </div></td></tr></table></div>
    <input type="submit" value="Search catalogue" name="ACTION_NONE" onClick="submitButtonOnce(this); return false">
    <hr>
    <%-- REPEAT CATALOGUES --%>
    <div align="left">
    <table border="0" width="100%">
    <% Vector catalogues = bean.getItemCatalogues();
            int cataloguesSize = catalogues.size();
               for (int i = 0; i < cataloguesSize; i++){
                      BAPItemCatalogue cat =  (BAPItemCatalogue) catalogues.elementAt(i); %>
              <%-- LINK AND MARK AS NEW --%>
                  <tr>
                         <td width="23%"><a class="IBSMenuLink" href="link" onClick="javascript:invokeLink('<%= bean.getEncodedServlet("se.ibs.ns.icat.ItemCatalogueCategoryServlet", response) %>?CODE=<%= ToolBox.encodeURLParameter(cat.getCode())%>'); return false">
                              <%= cat.getDescription(languageCode) %></a>
                         </td>
                         <td width="40%" align="right">
                              <% if (cat.isNew()) {%>
                                     <img border=0 src="<%= resourcePath %>new.gif">
                              <% } %>
                        </td>
                  </tr>
              <%--  CATALOGUES IMAGE AND INTERNET INFORMATION (text, multimedia objects,downloads, links...) --%>
                  <tr>
                         <td width="23%" valign="top" align="left">
                              <% if (bean.isAdvanced(cat) && bean.hasMultimediaImage(cat)) { %>
                                   <a href="link" onClick="javascript:invokeLink('<%= bean.getEncodedServlet("se.ibs.ns.icat.ItemCatalogueCategoryServlet", response) %>?CODE=<%= ToolBox.encodeURLParameter(cat.getCode())%>'); return false">
                                   <img border="0" src="<%= bean.getMultimediaImage(cat) %>"></a>
                        <% } else {%>     
                                   <img border="0" src="<%= resourcePath %>Catalog.gif">
                              <% } %>
                         </td>
                         <td class="IBSTextNormal" width="40%" valign="top">
                              <%= bean.getWebText(cat) %>
                         </td>
                  </tr>
                  <tr>
                         <td width="23%">
                         </td>
                         <td width="40%">
                         <% Vector mmLinks = bean.getMultimediaLinks(cat);
                      int mmLinksSize = mmLinks.size();     
                              for (int ml=0; ml<mmLinksSize; ml++){
                                   BAPCodeAndDescription mmLink = (BAPCodeAndDescription)mmLinks.elementAt(ml); %>
                                   <a class="IBSLink" href="<%= mmLink.getCode() %>" target="_blank"><%= mmLink.getDescription() %></a><br>
                         <% } %>
                   <% Vector webLinks = bean.getWebLinks(cat);
                        int webLinksSize = webLinks.size();
                        for (int wl=0; wl<webLinksSize; wl++){
                                   BAPCodeAndDescription webLink = (BAPCodeAndDescription)webLinks.elementAt(wl); %>
                                   <a class="IBSLink" href="<%= webLink.getCode() %>" target="_blank"><%= webLink.getDescription() %></a><br>
                        <% } %>
                         </td>
                  </tr>
                <%}%>
    </table>
    </div>
    <%@ include file="FuncPageLinks.jsp" %>
    <%@ include file="FuncPageEnd.jsp" %>
    </form>
    </body>
    </html>i hope someone could help me to understand this,
    thank you for your help

    You've probably already seen these, but here are a couple of links that may help.
    http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/operators.html#array_a ccess
    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/Array.html
    What's basically happening is that the "for" loop goes through each item in the array.  Don't be confused by the fact that two of the items in the array are Strings and one is an Integer - variable i being a String has nothing to do with the data type of the elements in the array.
    The following code:
    private function createLabels():void
         var myArray:Array = ['one', 'two', 3];
         for(var i:String in myArray)
              trace("i = " + i);
              trace(myArray[i]);
    gives the following results:
    i = 0
    one
    i = 1
    two
    i = 2
    3
    From that we can see that the "for" loop is assigning the index number of each array element, not the actual array element ('one', 'two', or 3) to the variable i.  So calling myArray[i] is the same as calling myArray[0] the first time through the loop.  This type of "for" loop is just a shorter way of doing the following, which produces exactly the same results:
    private function createLabels():void
         var myArray:Array = ['one', 'two', 3];
         for(var i:int = 0; n < myArray.length; i++)
              trace("i = " + i);
              trace(myArray[i]);
    Hope that helps.
    Cheers!

  • Trying to understand Distribution Model

    When I view the metadata of a Distribution Model, I see DM overview which contains 2 tabs.  One for Data Objects and Second for Rules.  I am trying to understand the tables in each of these tabs. 
    Association Table - RR00200100G_AT
    DRDS Table - DM00200100G1
    DR Table (Runtime) - RR00200100G1
    What are they used for and when to the entries get updated?
    Thanks
    JB

    Thanks for the quick reply Siva....
    I am trying to investigate a behaviour where we have a normal rule based on a Date Pattern.  The business requirement is to distribute only today's data back to the user's device.  The issue we are seeing is that there are data in the device that were created in the past.
    The rule's criteria is based on CREATED_BY(UserID) and CREATED_ON(date) node attribute from the data object.
    In the rule, the CREATED_BY is mapped to the USER device attribute and the CREATED_ON is a date pattern, where the Operator is 'EQ', Custom Type is 'C' - Constant Offset, and Date Pattern is 'Current Date'.
    With this set-up, there are four events that were created in the Execution Plan - Device Addition, Device Modification, Device Removal and Sliding Window-Date.  There's also a job, Sliding Window-Date,
    that is scheduled to run once a day at midnight.
    My observation is that every day, after the Sliding Window-Date runs.  The DRDS & DR tables, in the second are updated.  But the entries in the Association table, from the first tab, are not updated.
    I am expecting that the Status Flag, in the Association table, of all records that are not relevant for that date, get's updated to 'D' so that when the user syncrhronize they will get deleted from the device.
    What am I missing?  What triggers the update to the Association table?

  • Trying to understand PersistenceContextType.EXTENDED

    Hello,
    I'm trying to understand the PersistenceContextType.EXTENDED setting. It is my understanding that when I put this in my class, it means that the container managed transaction will span multiple method calls.
    I have a stateful bean:
    @Stateful(name = "StatefulContainerSessionEJB")
    public class StatefulContainerSessionEJBBean implements StatefulContainerSessionEJB, StatefulContainerSessionEJBLocal {
    @PersistenceContext(unitName = "Model",
    type = PersistenceContextType.EXTENDED)
    private EntityManager em;
    // implied REQUIRED transaction
    public void createAddress() {
    try {
    // create a new address
    Address addr = new Address();
    //... set addr fields
    System.out.println("Persist addr at: " + addr.getStreet());
    em.persist(addr);
    System.out.println("Persist of addr complete");
    } catch (Exception ex) {
    ex.printStackTrace();
    // transaction should still be alive here
    @Remove // this is what causes the transaction to end
    public void cancelTransaction() {
    System.out.println("Transaction rolledback");
    em.getTransaction().setRollbackOnly();
    And in my main code I have:
    StatefulContainerSessionEJB statefulContainerSessionEJB;
    public String createAddressThruStateful() {
    System.out.println("Create Address Thru Stateful Button hit....");
    try {
    final Context context = getInitialContext();
    statefulContainerSessionEJB = (StatefulContainerSessionEJB)context.lookup("StatefulContainerSessionEJB");
    statefulContainerSessionEJB.createAddress();
    } catch (Exception ex) {
    ex.printStackTrace();
    return null;
    public String cancelPartTimeTransaction() {
    System.out.println("Cancel Address Thru Stateful Button hit....");
    try {
    statefulContainerSessionEJB.cancelTransaction();
    } catch (Exception ex) {
    ex.printStackTrace();
    return null;
    First question is: am I using the Stateful bean correctly in main? i.e. its a class level variable and get instantiated in the createAddressThruStateful call.
    My second question is: when I run this code, my address get commited to the DB at the end of the createAddress() call. I didn't expect this to happen.
    Please straigten me out.
    Thanks,
    Chris

    please tell me what the inout in this coode means:A parameter that supplies input as well as accepts output is an INOUT parameter.

  • UTL_HTTP.end_of_body Exception Error.  Trying to Understand the Reason Why?

    I have the following PLSQL Function that returns a End_of_body Error. This started when we migrated from 10g to 11g. It is simple enough to capture so the error does not stop the Function Flow, but the error causes the OCI driver in OBIEE to error, which prevents the use of OBIEE IBOT to execute. Trying to understand why this error is occurring..not sure if we have a permissions issue on the UTL_HTTP Package or what?
    Anyone seen this problem in 11g? Suggests on resolving would be great. Thanks.
    FUNCTION AA_DEMO_PO_WSDL(IN_MESSAGE IN VARCHAR2)
    RETURN VARCHAR IS
    soap_request varchar2(30000);
    soap_respond varchar2(30000);
    http_req utl_http.req;
    http_resp utl_http.resp;
    launch_url varchar2(240) ;
    o_message varchar2(240) ;
    po_amount number := 2000 ;
    total_calls number := 0;
    cursor c_PO_exists is Cursor Logic..
    begin
    total_calls := 0;
    For po_wsdl in c_PO_exists
    LOOP
    total_calls := total_calls + 1;
    soap_request:='<?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header/>
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/PurchaseOrder_Approval">
    <ns1:ProcessRequest><ns1:input>PO' || po_wsdl.order_no || '</ns1:input></ns1:ProcessRequest>
    </soap:Body>
    </soap:Envelope>';
    Begin
    http_req:= utl_http.begin_request('myURL/PurchaseOrder_Approval/1.0','POST','HTTP/1.1');
    utl_http.set_header(http_req, 'Content-Type', 'text/xml') ;
    utl_http.set_header(http_req, 'Content-Length', length(soap_request)) ;
    utl_http.set_header(http_req, 'SOAPAction', 'initiate');
    utl_http.write_text(http_req, soap_request) ;
    http_resp:= utl_http.get_response(http_req) ;
    utl_http.read_text(http_resp, soap_respond) ;
    utl_http.end_response(http_resp) ;
    Exception
    WHEN UTL_HTTP.end_of_body THEN
    utl_http.end_response(http_resp);
    When utl_http.too_many_requests then
    utl_http.end_response(http_resp);
    o_message := 'End_Reponse' || ' from proc.';
    when OTHERS then
    o_message := SQLERRM || ' from proc.';
    return o_message;
    end;
    END LOOP;
    Return 'Workflow Initiated-' ||to_char(total_calls);
    end AA_DEMO_PO_WSDL;

    Hi, thanks,
    it is oracle10g,
    The Exception is : ORA-29266: end-of-body reached
    ORA-06512: at "SYS.UTL_HTTP", line 1349
    then the line in my function ,
    damorgan wrote:
    But I do note that when I do this I always do a get_header_count and get_header before get_read.what get_read , u mean?
    thanks for the link ,
    appreciated

  • Trying to understand the basic concept of object oriented programming.

    I am trying to understand the basic concept of object oriented programming.
    Object - a region of storage that define is defined by both state/behavior.
    ( An object is the actual thing that behavior affects.)
    State - Represented by a set of variables and the values they contain.
    (Is the location or movement or action that is the goal that the behavior is trying to accomplish.)
    Variables- (What does this mean?)
    Value - (What does this mean?)
    Behavior - Represented by a set of methods and the logic they implement.
    ( A set of methods that is built up to tell's the how object to change it's state. )
    Methods - A procedure that is executed when an object receives a message.
    ( A very basic comand.For example the method tells the object to move up, another method tells the method to go left. Thus making the object move up/left that combination is the behavior.)
    Class - A template from which the objects are created.
    ( I am very confused on what classes are.)
    - The definitions of the words I obtained from the "Osborne Teach Yourself Java". The () statements are how I interperate the Mechanisms (I do not know if Thats what you call them.) interact with each other. I understand my interpretation may be horribly wrong. I will incredibly appreciate all the support I may get from you.
    Thank you

    Object oriented programming is a replacement for the older idea of procedural programming (you can research procedural programming in google). As I understand it, in procedural programming, you have a step by step set of function calls to accomplish some task. Each function receives a data structure, manipulates it, and passes it to the next function. The problem with this is that each function preforms some action for the overall task and can't easily be reused by some other task. Its also harder to read the flow of what is happening with raw data structures flying all over the place.
    In object oriented programming, an object calls a function of another object and receives back, not a data structure, but another object. Objects contain a data structure that can only be accessed by its functions. An object is not so much a sub component of a bigger task, as it is a service that any other task can use for any purpose. Also, when you pass an object to the caller, the caller can ask questions about the data structure via its functions. The developer doesnt have to know what the previous function did to the data by reading up on any documentation, or having to reverse engineer the code.
    I suggest the best way of learning this is to code something like a library object.
    A library object contains a collection of book objects
    A book object contains a collection of chapter objects
    A chapter object contains a collection of paragraph objects
    A paragraph object contains a collection of sentence objects
    A sentence object contains a collection of word objects.
    Add functions to each object to provide a service
    Example: A library object should have a:
    public void addBook(Book book)
    public Book getBook(String title)
    public boolean isBookInLibrary(String title)
    The key is to add functions to provide a service to anyone who uses your object(s)
    For example, what functions (service) should a paragraph object provide?
    It shouldn't provide a function that tells how many words there are in a sentence. That function belongs to a sentence object.
    Lets say you want to add a new chapter to a book. The task is easy to read
    if you write your objects well:
    Sentence sentence1=new Sentence("It was a dark and stormy night");
    Sentence sentence2=new Sentence("Suddenly, a shot ran out");
    Paragraph paragraph=new Paragraph();
    paragraph.addSentence(sentence1);
    paragraph.addSentence(sentence2);
    Paragraphs paragraphs=new Paragraphs();
    paragraphs.addParagraph(paragraph);
    Library library= new Library();
    library.getBook("My Novel").addChapter("Chapter 1",paragraphs).
    Now, lets say you want to have a word count for the entire book.
    The book should ask each chapter how many words it contains.
    Each chapter should ask its paragraphs, each paragraph should ask
    its sentences. The total of words should ripple up and be tallied at each
    stage until it reaches the book. The book can then report the total.
    Only the sentence object actually counts words. The other objects just tallies the counts.
    Now, where would you assign a librarian? What object(s) and functions would you provide?
    If written well, the project is easily extensible.

  • Trying to understand the Serialization interface

    Im trying to understand the Serialization of objects?
    As an example, I create a Library class that implements Serializable, that stores a collection of Book objects
    If I am only looking at saving a Library object to file, does the Book class require Serialization also or just the Library?
    I have read the API on serialization, no answer there, if it is it's not easy to understand or read into the API...

    There are some really important things to know about when doing serialization. For example one important thing to know about that not is mentioned here is that your serializable classes must define its own private static final long serialVersionUID because if you not do that will you not be able to deserialize (read in) the data you have saved later if you change anything in your serializable class. It is a bit tricky to manage files to which you have serialized different versions of your class, that is versions where you have added more serializable members to the class after you have serialized files. Well, it is not a problem if you don´t care if you have to type in all your saved data again every time you change anything instead of deserialize it (read it) from your file of course :)
    Situations like this may be handled if you define your own (private) writeObject(ObjectOutputStream) and your own readObject(ObjectInputStream) methods in your serializable class but there is a better a lot smarter way to handle this. Use of a serialization proxy! how to use that is described in the excellent book Effective Java 2nd ed. With a serialzation proxy for every serializable version of your class (where a version corresponds to a version of your class with differences in its number of serializable members) may your class deserialize data written from elder versions of your class also. Actually is it first since I read the last chapter of Effective Java that I think I have myself begin to understand serialization well enough and I recommend you to do the same to learn how to use serialization in practice.

  • Trying to understand Transferable

    Hello, I'm trying to write a drag-and-drop file uploading applet and am thus trying to understand the Transferable interface. I found some very clear source but no clear explanation of one point. I'm sure this information is commonly available; I apologize for being unable to find it and would appreciate a link.
    Running this code :
    public boolean importData(JComponent src, Transferable transferable) {
    println("Receiving data from " + src);
    println("Transferable object is: " + transferable);
    println("Valid data flavors: ");
    DataFlavor[] flavors = transferable.getTransferDataFlavors();
    DataFlavor listFlavor = null;
    DataFlavor objectFlavor = null;
    DataFlavor readerFlavor = null;
    int lastFlavor = flavors.length - 1;
    // Check the flavors and see if we find one we like.
    // If we do, save it.
    for (int f = 0; f <= lastFlavor; f++) {
    println(" " + flavors[f]);
    if (flavors[f].isFlavorJavaFileListType()) {
    listFlavor = flavors[f];
    if (flavors[f].isFlavorSerializedObjectType()) {
    objectFlavor = flavors[f];
    if (flavors[f].isRepresentationClassReader()) {
    readerFlavor = flavors[f];
    // Ok, now try to display the content of the drop.
    try {
    DataFlavor bestTextFlavor = DataFlavor.selectBestTextFlavor(flavors);
    BufferedReader br = null;
    String line = null;
    if (bestTextFlavor != null) {
    println("Best text flavor: " + bestTextFlavor.getMimeType());
    println("Content:");
    Reader r = bestTextFlavor.getReaderForText(transferable);
    br = new BufferedReader(r);
    line = br.readLine();
    while (line != null) {
    println(line);
    line = br.readLine();
    br.close();
    else if (listFlavor != null) {
    java.util.List list = (java.util.List)transferable.getTransferData(listFlavor);
    println( list + " Size " + list.size());
    else if (objectFlavor != null) {
    println("Data is a java object:\n" + transferable.getTransferData(objectFlavor));
    else if (readerFlavor != null) {
    println("Data is an InputStream:");
    br = new BufferedReader((Reader)transferable.getTransferData(readerFlavor));
    line = br.readLine();
    while (line != null) {
    println(line);
    br.close();
    else {
    // Don't know this flavor type yet...
    println("No text representation to show.");
    println("\n\n");
    catch (Exception e) {
    println("Caught exception decoding transfer:");
    println(e);
    return false;
    return true;
    which you'll agree is very clear, returns me a List of filepaths when I drop files on it. Perhaps naively, I was hoping to get the data itself.
    Obviously I can go the route of messing with security settings to allow the applet to open files (eeew) but I'm hoping the actual data is available from Transferable and I'm simply not understanding how to do it.
    Thanks for any tips.

    And don't forget to check this link:
    http://www.javaworld.com/jw-03-1999/dragndrop/jw-03-dragndrop.zip
    I think with few modifications you can get what you want.

  • Trying to understand a WS-I validation failure

    I'm trying to understand the following WS-I validation failure message. I'm sure I'm making a basic mistake but I can't find an example of the use case where an xsd is imported. Can someone point out my error?
    Thanks,
    Bret
    Validation failure:
    Result failed:
    Failure Message: A QName reference that is referring to a schema component, uses a namespace not defined in the targetNamespace attribute on the xs:schema element, or in the namespace attribute on an xs:import element within the xs:schema element.Failure Detail Message:
    {http://Messages.xsd}SigReplyMessage,
    {http://schemas.xmlsoap.org/wsdl/}string,
    {http://Messages.xsd}SigRequestMessage
    Element Location: lineNumber=8
    My wsdl looks like this:
    <definitions targetNamespace="urn:S3SignatureGenerator"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="urn:S3SignatureGenerator"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:messages="http://Messages.xsd">
    <types>
    <xsd:schema>
    <xsd:import id="Messages.xsd"
    schemaLocation="../../XSDDocument/Messages.xsd"
    namespace="http://Messages.xsd"/>
    </xsd:schema>
    </types>
    <message name="ReturnSignature">
    <part name="SigAndExp" type="messages:SigReplyMessage"/>
    </message>
    <message name="RequestSignature">
    <part name="Keys" type="messages:SigRequestMessage"/>
    </message>
    <portType name="SigGenerator">
    <operation name="GetSignature">
    <input message="tns:RequestSignature"/>
    <output message="tns:ReturnSignature"/>
    <fault name="sigFault" message="tns:SigFault"/>
    </operation>
    </portType>
    <message name="SigFault">
    <part name="faultMessage" element="string"/>
    </message>
    <binding name="SigGenSoapHttp" type="tns:SigGenerator">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetSignature">
    <soap:operation soapAction="urn:S3SignatureGenerator/GetSignature"/>
    <input>
    <soap:body use="literal" parts="SecretKey PublicKey"/>
    </input>
    <output>
    <soap:body use="literal" parts="Signature"/>
    </output>
    <fault name="sigFault">
    <soap:body use="literal" parts="SecretKey PublicKey"/>
    </fault>
    </operation>
    </binding>
    <service name="SignatureGenerationService">
    <port name="SigGenSoapHttpPort" binding="tns:SigGenSoapHttp">
    <soap:address location="tbd"/>
    </port>
    </service>
    </definitions>
    Messages.xsd looks like this:
    <?xml version="1.0" encoding="windows-1252" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.bret.org/S3test/Messages"
    targetNamespace="http://www.bret.org/S3test/Messages"
    elementFormDefault="qualified">
    <xsd:complexType name="sigRequestMessage">
    <xsd:sequence>
    <xsd:element name="publicKey" type="xsd:string"/>
    <xsd:element name="privateKey" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="sigReplyMessage">
    <xsd:sequence>
    <xsd:element name="Signature" type="xsd:string"/>
    <xsd:element name="expiration" type="xsd:dateTime"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

    Hi Bret,
    Sorry it's taken me a bit of time to respond, but please find below a run-down of the WS-I related problems I spotted in your WSDL document. The first few are related to the import error you saw, and there's a few others that I'll also discuss. Apologies in advance if you've already spotted and corrected those.
    I'll use line numbering based on the formatting of the WSDL and XSD that you supplied.
    BP2417 (the one you asked about)
    The line number in the error is a red herring. There are two problems here:
    - WSDL document, line 29: You're using the XSD type string unqualified - it should be xsd:string.
    - WSDL document, lines 8 and 13; schema, lines 3 and 4: The namespaces you're using don't match. Either change the namespaces in the schema to be http://Messages.xsd, or change the namespaces in the WSDL to http://www.bret.org/S3test/Messages.
    BP2202
    You should declare UTF-8 or UTF-16 encoding when creating WSDL or schema documents. The easiest way to do this is to go to Tools|Preferences, and set JDeveloper's default encoding to either UTF-8 or UTF-16.
    BP2032
    WSDL document, line 26 and 43: The name attribute of the fault should read SigFault, not sigFault, as WSDL is case-sensitive.
    WSDL document, line 44: You should use a soap:fault element, not a soap:body element, to bind a fault, thus:
    <soap:fault name="SigFault" use="literal"/>
    BP2012
    WSDL document, lines 17 and 20: Message parts in a document-bound service like this one should reference XSD elements and not complexTypes. What you need to do is define two elements in your messages schema whose types are SigReplyMessage and SigRequestMessage respectively, and then reference those elements from the WSDL.
    WSDL document, line 38: The value of the parts attribute should be Keys to match the name of the part child of the RequestSignature.
    WSDL document, line 41: The value of the parts attribute should be SigAndExp to match the name of the part child of the ReturnSignature.
    WSDL document, line 44: The value of the parts attribute should be faultMessage to match the name of the part child of the SigFault.
    BP2115
    WSDL document, lines 17 and 20: The names of the elements should be sigReplyMessage and sigRequestMessage and not SigReplyMessage and SigRequestMessage, again because WSDL is case-sensitive.
    WSDL document, line 30: The element attribute of the part references xsd:string, which is not an element but a complexType. You'll need to add an element declaration to your schema, which is of type xsd:string.
    I've included corrected versions of your WSDL and schema below, I hope this helps. I also note you've posted a few other messages related to WS-I and WSDL, I hope I've managed to cover those in this message too.
    Regards,
    Alan.
    WSDL:
    <?xml version="1.0" encoding="UTF-8" ?>
    <definitions targetNamespace="urn:S3SignatureGenerator"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="urn:S3SignatureGenerator"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:messages="http://Messages.xsd">
    <types>
    <xsd:schema>
    <xsd:import id="Messages.xsd"
    schemaLocation="Messages.xsd"
    namespace="http://Messages.xsd"/>
    </xsd:schema>
    </types>
    <message name="ReturnSignature">
    <part name="SigAndExp" element="messages:sigReplyMessage"/>
    </message>
    <message name="RequestSignature">
    <part name="Keys" element="messages:sigRequestMessage"/>
    </message>
    <message name="SigFault">
    <part name="faultMessage" element="messages:faultMessage"/>
    </message>
    <portType name="SigGenerator">
    <operation name="GetSignature">
    <input message="tns:RequestSignature"/>
    <output message="tns:ReturnSignature"/>
    <fault name="SigFault" message="tns:SigFault"/>
    </operation>
    </portType>
    <binding name="SigGenSoapHttp" type="tns:SigGenerator">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetSignature">
    <soap:operation soapAction="urn:S3SignatureGenerator/GetSignature"/>
    <input>
    <soap:body use="literal" parts="Keys"/>
    </input>
    <output>
    <soap:body use="literal" parts="SigAndExp"/>
    </output>
    <fault name="SigFault">
    <soap:fault name="SigFault" use="literal"/>
    </fault>
    </operation>
    </binding>
    <service name="SignatureGenerationService">
    <port name="SigGenSoapHttpPort" binding="tns:SigGenSoapHttp">
    <soap:address location="tbd"/>
    </port>
    </service>
    </definitions>
    Schema:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://Messages.xsd"
    targetNamespace="http://Messages.xsd"
    elementFormDefault="qualified">
    <xsd:element name="sigRequestMessage">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="publicKey" type="xsd:string"/>
    <xsd:element name="privateKey" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="sigReplyMessage">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Signature" type="xsd:string"/>
    <xsd:element name="expiration" type="xsd:dateTime"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="faultMessage" type="xsd:string"/>
    </xsd:schema>

  • Trying to understand java

    Trying to understand corba
    please tell me what the inout in this coode means:
    boolean book_search(inout b_item book, inout client olvas) raises (BookNoAvail)
    The type of parameter passing in Java is that it makes a copy of the parameter and themn in method somthing happens??
    So which one is it out of the two: pass by reference and pass by value?

    please tell me what the inout in this coode means:A parameter that supplies input as well as accepts output is an INOUT parameter.

  • Trying to understand methods - calling methods within own class - help

    I'm trying to write a simple program to search for letters in a string. I'm having a ton op problems; java seems so complicated with a lot of rules.
    The main problem I'm having (for now) is calling a method within the same class as main.
    import java.io.*;
    class LookForLetters{
        public static void main(String[] args)
         int i = 0;     
         int j = 0;
         int l = 0;
         int m = 0;
         String question1 = "Enter the line to be searched"; 
         String question2 = "Enter the line to be searched";       
         returnResponse stringtosearch = new returnResponse(question1); // here's where my problem is
            char[] chartosearch = stringtosearch.toCharArray();
         returnResponse letterstofind = new returnResponse(question2);
            char[] chartofind = letterstofind.toCharArray();     
         int findlength = chartosearch.length();
         int searchlength = chartofind.length();
         int[] k = new int[searchlength];
         for(i = 0; i < findlength; i++)
             for(j = 0; j < searchlength; j++)   
              if(chartosearch[i] == chartofind[j])
                  k[l] = i;
                  l++;
                  System.out.print("T");
             System.out.print(i + " " + l);
                if(l == 0)
                    System.out.print(chartofind[i] + " is the not in the sentence.");
                    System.out.println();       
                else
                    System.out.print(chartofind[i] + " is the ");
                 for(m = 0; m < l; m++)
                     System.out.print(k[l] + " ");
                    System.out.print("letter of your sentence");
                    System.out.println();
                    l = 0;
        public String returnResponse(String question){
         String response = " ";
         System.out.print(question);
         try
             InputStreamReader isr = new InputStreamReader(System.in);
                BufferedReaderbr = new BufferedReader(isr);
             response = br.readLine();            
         catch(IOException e)
             System.out.print("error");
         return response;
    }The compiler says that it can't find the returnResponse method. when I try to instantiate the whole class, it says the package is not included. Please help.

    JoachimSauer wrote:
    DaneWKim wrote:
    thank you very much for your response. I'm sure it's obvious that I'm really confused. I'm used to C and assembly programming, so the OO concepts are really foggy.That particular line doesn't even deal with any OO concept. But the fact that you already know C helps me give a (hopefully) more useful answer:
    What is the return type of the method you're trying to call?
    What is the type of the variable you want to assign the return value to?
    Are those compatible? Or even more general: do they both exist?I changed it to:
            String stringtosearch = returnResponse(question1);
            char[] chartosearch = stringtosearch.toCharArray();
         String letterstofind = returnResponse(question2);
            char[] chartofind = letterstofind.toCharArray();I guess I'm getting confused with medthods, class and types. There's a whole host of new vocabulary and rules with OO and java that have me a bit confused. I appreciate your help.

Maybe you are looking for

  • IPhone 5 (iOS 6.1.4) back up issue

    This started of late; every time I try to back up I get the message "iTunes could not back up the iPhone "... iPhone" because the iPhone disconnected" while it's still connected via Lightning. It goes through suncing just fine, but does not back up.

  • Procedure names in lowercase (export/import)

    After an export/import into a new schema all package/procedure/function names are written in uppercase and within ". The rule in our norms and standards defines to write object names in lowercase. Is there a solution to keep object names in lowercase

  • Photoshop CS3 suddenly freezing when Saving

    Can someone help me? I've been running photoshop cs3 successfully up until yesterday when after working on layers and cropping etc, i go to SAVE and suddenly it freezes up. I've got 4 RAM, plenty of space on my harddrive. (i use external drives) I di

  • NT-realm status in WL 5.1 SP4?

    1. Can it run on a non-PDC? 2. Can it work with trusted domains? I'm sure others out there are curious as well... Thanks, Christian

  • Header in balance file

    Hi, Anyone could explain me how header are handled in balance with FDMEE11.1.2.3, until yesterday I though that headers were not supported in balance files (our EPM integrator though the same by te way). I made a test and surprisingly header are igno