Tokens - it should work, shouldnt it !?

Can anyone explain why the following code does NOT read my text file properly? I print the results in dos to test and i get 0.0 for each.
My text file looks like this:
27.5 45.3 8.7
thanks!
p.s. tried previewing, but code seems messed up a little in terms of alignment!
public void weatherReader() throws IOException
     File inFile = new File("theweather.txt");
     BufferedReader in = new BufferedReader(new FileReader(inFile));
     String tokens = in.readLine();
     while (in.readLine() != null)
                            StringTokenizer st = new StringTokenizer(tokens, " ");
                             while (st.hasMoreTokens())
                     temperature = Double.parseDouble(st.nextToken());
                     windDirection = Double.parseDouble(st.nextToken());
                     windSpeed = Double.parseDouble(st.nextToken());
     System.out.println(temperature);
     System.out.println(windDirection);
     System.out.println(windSpeed);

i do use them. here's my full method.
i call it in my app class. before, i had them inputting from dos. e.g. you get prompted for a temperature and you enter one, etc.
now ive changed it to file reading and my transformation doesnt work anymore. why would this be !?!
public void weatherReader() throws IOException
          File inFile = new File("theweather.txt");
          BufferedReader in = new BufferedReader(new FileReader(inFile));
          String tokens;
          while ((tokens = in.readLine()) != null)
               StringTokenizer st = new StringTokenizer(tokens, " ");
               while (st.hasMoreTokens()) {
               temperature = Double.parseDouble(st.nextToken());
               windDirection = Double.parseDouble(st.nextToken());
               windSpeed = Double.parseDouble(st.nextToken());
          System.out.println(temperature);
          System.out.println(windDirection);
          System.out.println(windSpeed);
          double angleR = Math.toRadians(windDirection);
          System.out.println(windDirection); //weather direction is correct here
                    double trueAngle = 0-(angleR);
                         if(angleR > 0 && angleR < (2*(Math.PI)))
                              Transformation2d myTrans1 = new Transformation2d();
                              Transformation2d myTrans2 = new Transformation2d();
                              Transformation2d spin = new Transformation2d();
                              myTrans1.translate(-120,-150);
                              spin.rotate((float)trueAngle);
                              myTrans2.translate(120,150);
                              transform(myTrans1);
                              transform(spin);
                              transform(myTrans2);
     }

Similar Messages

  • Can someone please help me.. Everytime I try to view a website a Security Certificate warning comes up. The MACBook i use is 4 years old but it should work shouldnt it

    I have major drama trying to use the Internet, accessing my yahoo emails is a nightmare. But EVERY website asks pops up with security certificates. Even coming on to this apple website was a task. My Macbook is 4 yrs old but I think this means that there is something wrong with it.
    I would pay for any updates if that is what is required. But I cant even see how to do that

    Hmmm. Have you installed any software on your MacBook lately?
    Which browser are you using?
    What, exactly does the pop up message say?
    ~Lyssa

  • My mail forms created by muse 2014.0.1.30 do not work. PHP 5.4 is enabled by hoster, so they should work. Can anyone help me, for these forms are crucial for my business.

    My mail forms created by muse 2014.0.1.30 do not work. PHP 5.4 is enabled by my hoster, so they should work. Can anyone help me, for these forms are crucial for my business. The forms confirm delivery, but the mails are not recieved. No spam filters enabled.
    Meanwhile, I was able to narrow the problem down: PHP seems not to accept a re-directed mail address as sender of the mail in some cases. So, it has nothing to do with the mail form itself.

    Hi Ingo,
    Please refer to this document, Troubleshooting Muse Form Widgets Used on Third-Party Servers
    Last section, "I've uploaded my new Muse form, and tried submitting it in the browser, but I never receive an email with the form data. What's wrong?"
    - Abhishek Maurya

  • My batterie doesn't work correctly to my Iphone 5. It should work longer, but it's worse. My battery does not hold a full day without much use.

    It should work longer, but it's worse. My battery does not hold a full day without much use.
    When the new version of ISO6 will come ??? A lot of apps don't work correctly too.... :-(
    I'm a little bit disappointed...

    Sounds like your iPhone is locked to your home carrier.
    See if they offer unlocking and if you qualify. Otherwise,
    there is nothing you can do besides rent/but a cheap
    phone for your month in Argentina.

  • How do you fill in a form that was saved as a template? When I try, the "template" shifts, which is not how a template should work!

    How do you fill in a form that was saved as a template? When I try, the "template" shifts, which is not how a template should work!
    Templates, as I understand them, are fixed; you can "fill them in" without shifting them. Yet, I've saved doc as a template AND it shifts. Argh!

    Thanks for your response.
    I've managed to fix it but I wouldn't recommend the following as I'm sure its unsupported and I'll probably have problems down the line
    On the host
    * mv /etc/zones /etc/zones.bak
    * reboot single user
    * apply kernel patch (the one that ultimately I had to get on and which was giving pre-req dependency errors when running zones)
    * create a new zone now that host system is all up to date
    * Copy the operating system directories of the new zone (the one that's all patched) over the troublesome zone (the one that can't take the patch). Take backups first
    * cd /zones/new-zone/root
    * find sbin -print | cpio -pudm /zones/bad-zone/root
    * find usr -print | cpio -pudm /zones/bad-zone/root
    * find lib -print | cpio -pudm /zones/bad-zone/root
    * cd /zones/new-zone/root/var
    * find sadm -print | cpio -pudm /zones/bad-zone/root/sadm (this copies patches and pkgs directories and I'm sure a lot of other stuff that I didn't want)
    * mv /etc/zones.bak /etc/zones
    * reboot host
    * boot the old zone up. It should now have up to date patches
    I'm sure there are real no-no's in taking this approach but it seems to have worked for me. I'll update if I find there are some horrors down the line
    Edited by: paul_xedos on Mar 25, 2010 4:07 AM

  • .install files and how they should work

    hi
    i already looked up the wiki and the forum and found nothing realy related to this.
    i am able to set an .install script in the PKGBUILD, but i would like to know how it should work.
    i got an game that i would like to add to the AUR but the problem is that its not actually creating a hidden folder in home to save the settings and all.
    so i would like to move all the config files and ofcourse the save directory to a hidden home folder and link it to /usr/share/{game}.
    i know that i cant do that while building the package itself, but i would like to know WHEN this install script gets executet.
    in my opinion, this install script should do what i told above, move the files, link it to the destination.
    so, is there actually a site where i can lookup the install= command?

    thank you for that cerebral.
    but actually, you do know that just saying "use chmod and chgrp" would be enough?
    that is the second time you did a essential part of the work for me, if you repeat that to often, i will never learn
    back to topic:
    isnt giving write acces to directorys within /usr or /opt a very very ugly workaround?
    i mean, even if its not that easy to solve it otherwise...
    EDIT
    i played around a little bit with your tip of changing the group, but i came to a point where i am stuck.
    the starterscript itself just cd's into /opt/StarTrade(the game) and runs the, um... 'other' starterscript 'StarTrade'.
    the starter in the game directory contains the following lines:
    #!/bin/bash
    exec_path=`dirname $0`
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$exec_path $exec_path/engine.x86
    this is because the game itself got the fmod lib within the directory, as far as i heard because its to exotic or... um... whatever^^
    so, if you start this script you get the following messege:
    appstub.linux signal handler 11/opt/StarTrade/StarTrade: line 3: 21018 Speicherzugriffsfehler LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$exec_path $exec_path/engine.x86
    starting it from the pkg/ directory where you packet it WILL work, maybe because it is in my $HOMEspace, i dont really know
    EDIT2
    and it whont work if it is startet with the 'games' group, even if it is installed in $HOME
    EDIT3
    finaly it worked, i wrote a sript that backs up all "need write access" files to a backup/ directory and copys them to a .homedirectory, the only question is, "will it work on multi-user systems?"
    i cant test this now, i didnt even testet the pack itself because my "testdummy-of-choice" is currently offline, but thankyou for your help
    Last edited by Wesley (2007-10-15 15:31:24)

  • Cannot select a music into slideshow and book slideshow presentations. In the older Mac this was easy. With new Mac OS X 10.6.8 it should work as I can stop the slideshow with cursor but pop up window for choosing music is dead. I cannot drag music into i

    Cannot select a music into slideshow and book slideshow presentations. In the older Mac this was easy. With new Mac OS X 10.6.8 it should work as I can stop the slideshow with cursor but pop up window for choosing music is dead. I cannot drag music into it. Preselected music just goes on.

    I am talking about iPhoto. In my old Mac even in Books choosing slideshow gives a pop up where you can select a music from I tunes library. In this new one I can stop the slideshow with cursor and it shows music option but it is, as I said dead. Does not response at all to commands.

  • How team should work with maven

    Could somebody to explain how the team should work with maven.
    For example.
    10 developers and 1 team lead are working together.
    Everyones has the own module in development.
    Next, one made the changes in his module and marked it like
    <version>1.3</version>? And say to neighbor whous modul is depend on his: "will be make your modul to point version 1.3 for my
    <artifactId>his-app</artifactId>
    <version>1.3</version> ? Or how?
    If he to point the unexisting version the maven will swear.
    And next. There's something pom.xml for team lead on top level of another modules of developers which team lead to use for assebling?
    Help please to understand how to use this framework

    It sounds like the functionality you are looking for is what maven calls snapshots. This allows developers to build and deploy the latest code base on the fly and maven can grab the latest releases without having to continually update the pom.

  • Downloaded CS 6 onto Mac but not able to open due to OS X? Was there a version for Mac I was not aware of? Description says cs 6 should work on Macs.

    Downloaded CS 6 on Mac OS X computer but not able to open. Is there a version just for Macs that I did not see? Description said it should work on OS X.

    What are you downloading exactly? and where from?
    You can download the Mac installer (.dmg file) from
    Download CS6 products

  • Mac pro 2006 hd 2600 xt should work in bottom slot?

    I was using a 3rd party hd 4870 in the bottom and was working fine. Now I was thinking of selling the machine but when I put the older hd 2600 in the slot there is nothing. All of the other slots work fine, I have yet to see if the 4870 will work if I put it back to test. The old one should work though? I did think though that the 4870 would register as x16 but always has shown x8 in the bottom. Would that indicate that there was a problem in the slot, that it was going out?

    An excellent  question !  Yes, the X2600 should work in slots 1 or 2, but I'm not sure about slot 3
    see this entry at Everymac.com on PCI-E bus lanes
    http://www.everymac.com/systems/apple/mac_pro/faq/mac-pro-pcie-architecture-lane -configurations.html
    as far as I know, graphics cards go in slots 1 and 2, not so sure about 3 and 4.  as you can see by the above entry, slot 1 has double width 16 lanes, slot 2 has 8 lanes, and 3 has 4 lanes.  there may not necessarily be a problem in the slot, but that the 2600 XT likes to be in slot 1 or 2, and the 4870 could be a little less picky.  The only way to tell if it is going out or not is to shut your Mac Pro down, take off the side  panel,  change graphics cards,including hooking up the power cable as needed, putting the side panel back, rebooting and checking under "About this Mac" then  more info, then System report where it should show up as a PCI card in whichever slot you have installed it. Should you have hooked up the power cable and reinstalled the graphics card correctly in the correct slot and it doesn't show up in the system report at all, that could indicate a problem.  just FYI, the 2600 XT isn't considered to be that great of a video card any more  and may get clogged up with dust . You may be able to bake the video card to get a few more months' use out of it but this is a temporary fix only, and is not endorsed by anyone.  if you could find an 8800GT mac version for a reasonable price, that might be a better solution
    John Brine

  • Image should work as hyper link in smartform

    Hi,
    I am able to convert smartform with images in to HTML format and able to send as e-mail using the program similar to SF_XSF_DEMO_MAIL.
    As soon as the user receives e-mail, he should able to click on images and should redirect to other webpage. (Image should work like hyper link).
    Can you please suggest how to work on this issue ?
    Thank you very much.
    Regards
    Badari

    Using smart form we can not send image as hyper link. This functionality is not available using smartform.
    Instead of using smart form written the HTML Code and used the following function module  'SO_NEW_DOCUMENT_ATT_SEND_API1' and works fine for me.
    wa_objtxt-line ='</body>'.
      APPEND wa_objtxt TO t_objtxt.
      wa_objtxt-line = '</html>'.
      APPEND wa_objtxt TO t_objtxt.
      HTML close
      wa_objtxt-line = '</body> </html> '.
      APPEND wa_objtxt TO t_objtxt.
    Document data
      DESCRIBE TABLE t_objtxt      LINES w_tab_lines.
      READ     TABLE t_objtxt      INTO wa_objtxt INDEX w_tab_lines.
      wa_docdata-doc_size =
          ( w_tab_lines - 1 ) * 255 + STRLEN( wa_objtxt ).
    Packing data
      CLEAR wa_objpack-transf_bin.
      wa_objpack-head_start = 1.
      wa_objpack-head_num   = 0.
      wa_objpack-body_start = 1.
      wa_objpack-body_num   = w_tab_lines.
      we will pass the HTML, since we have created the message
      body in the HTML
      wa_objpack-doc_type   = 'HTML'.
      APPEND wa_objpack TO t_objpack.
    *ENDFORM.                    " CREATE_TITLE_DESC_BODY
    *&      Form  fill_receivers
          Filling up the Receivers
    *FORM fill_receivers .
      wa_reclist-receiver = I_email. "p_email.
      wa_reclist-rec_type = 'U'.
      APPEND wa_reclist TO t_reclist.
      CLEAR  wa_reclist.
    *ENDFORM.                    " fill_receivers
    *&      Form  send_message
          Sending Mail
    *FORM send_message .
    Send Message to external Internet ID
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_docdata
          put_in_outbox              = 'X'
          commit_work                = 'X'     "used from rel.6.10
        TABLES
          packing_list               = t_objpack
          object_header              = t_objhead
          contents_txt               = t_objtxt
          receivers                  = t_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
      IF sy-subrc NE 0.
        E_STATUS = 'Sending Failed'.
      ELSE.
        E_STATUS = 'Sending Successful'.
      ENDIF.
    Edited by: Badari Narayana1 on Oct 6, 2009 10:09 PM
    Edited by: Badari Narayana1 on Oct 6, 2009 10:09 PM
    Edited by: Badari Narayana1 on Oct 6, 2009 10:10 PM

  • Program should work for any DB..and give me the space detials..!

    Hi All,
    I have a requirement like, whatever the SAP Report program im going to write that should work for any underlying DB.
    Like I have bunch of tables like LFA1, MARA etcu2026
    I wll check like if sy-dbs = u2018ORACLEu2019
    Here I need some code (Table) / FM (ORA) should be there to give me the used space and free space of that particular table like LFA1.
    Else I wll check like if sy-dbs = u2018DB2u2019
    Some code/FM like above to give me used space and free space.
    Else I wll check like if sy-dbs = u2018Sybaseu2019
    Some code/FM like above to give me used space and free space.
    I wll check like if sy-dbs = u2018Informixu2019
    Some code/FM like above to give me used space and free space.
    I wll check like if sy-dbs = u2018MaxDBu2019
    Some code/FM like above to give me used space and free space.
    I need Some DB Table / FM for each DB, which should give me the space details.
    Please let me know.

    Careful here Pradeep, this is not valid syntax.
    status = case endtime
    when null then "error"
    when not null then "successfull"
    endYou want:
    SQL> select case
      2            when endtime is null then 'error'
      3            when endtime is not null then 'successful'
      4         end
      5  from t;
    CASEWHENEN
    error
    (and you don't really need both conditions since they are mutually exclusive)

  • Can you believe it I still have CS 5.1... not anymore... Is CS 5.1 should work with OS X Yosemite 10.10?

    Is CS 5.1 should work with OS X Yosemite 10.10? ...probably not and it is time to update the creative suite I guess...
    How should I update the creative suite?

    you can't update ps 5.1 to ps cc
    you might be able to update your ps 5.1 (but there won't be an update to allow compatibility with yosemite), http://www.adobe.com/downloads/updates/
    you can also purchase cs6 apps, Creative Suite 6

  • I bought macbook air in feb 2013. if it is fully charged it only works for 3 hours while it should work for 7 hours. i have selected allow application from anywhere. does it affects ?

    i bought macbook air in feb 2013. if it is fully charged it only works for 3 hours while it should work for 7 hours. i have selected allow application from anywhere. does it affects ?

    vishalss180 wrote:
    should i change the battry ??
    No need to change the battery.
    vishalss180 wrote:
    i have selected allow application from anywhere. does it affects ?
    No.
    Maximize Runtime / Tips for maximizing your battery charge
    http://support.apple.com/kb/HT1446
    http://support.apple.com/kb/TS1473
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273

  • Structure inside while should work only one time ?

    Hi Everyone ,
                      I have coded a program that if i click a button ( switch untill released) . inside that structure should work only one times . 
                      and i have coded and its working fine .. but its looks compilcated..
                       i need some simple solution . Plz help me guys 
    Attachments:
    CODE.vi ‏10 KB

    saran1988 wrote:
                      I have coded a program that if i click a button ( switch untill released) . inside that structure should work only one times . 
                      and i have coded and its working fine .. but its looks compilcated..
                       i need some simple solution . Plz help me guys 
    Your code has very little to do with what you are describing.
    There is no button with "switch until released" mechanical action. (OK is switch when released, stop is latch when released)
    A case structure always "works". Are you saying that it should execute e.g. the true case only once whenever the outer case goes from false to true??
    Your inner case goes true more than once per run of the program (whenever the OK goes true). If it should really only work once overall, use the "first call?" primitive. You need to formulate the problem using less ambiguous words.
    There is no obvious starting state for the boolean that you read via local variables. How do you ensure that it start with a known value? Does it matter?
    You seem to entirely deal with integers, so why are you using floating point representation for the numerics?
    What is the purpose of the orange numeric indicator. Is it just a kludge for your logic or does its value mean anything?
    Why does your loop not contain any wait?
    At this point, you should learn about shift registers. It would eliminate all your local variables.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • HCM Processes and Forms - Confirmation Text Formatting

    Hi All, I am attempting to use the Confirmation Txt in the Scenario Steps of a form. When the editor comes up, there are not options for formatting available. According to the help system, the text editor provides you with XML formatting options as b

  • FM: FP_FUNCTION_MODULE_NAME Not working

    Hi all, I am using FM:  'FP_FUNCTION_MODULE_NAME' to get function module name to be generated by smartform. But it is throwing an exception as 'Exception API (REPOSITORY)'. TRY.     CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'       EXPORTING         i_na

  • Any ideas on how to uninstal the setup for PSE 9?

    I wanted to load PSE9 onto my iMac4 Intel Core Duo, however I would need to update to 10.5 to complete the install. I am unable to do this upgrade right now and i want to completely remove all PSE files. It took a LONG time for the set up to load ont

  • User-Exit Variable

    Hi, I created a simple user-exit variable and for some reason the variable seems to get executed around 16 times and then the query gives me the below error messages.   Any ideas why my variable would have I_STEP = 2 many times before it bombs out? 

  • Why do I have to pay an extra $30 everytime I upgrade?

    You guys in Verizon are so full of crap. When I first switched to a smartphone, you told me there was a $30 charge because I was upgrading from a regular phone to a smartphone. SInce then, both of my kids have upgraded from a smart phone to another s