Any comments anyone...

I have a text file like:
ABC DEF XYZ
STU 11.0 3.0 4.2
YUY 4.6 3.9 2.1
I want to calculate the total for STU and YUY etc, and
display it (STU is ... YUY is ...) in my program.
How can I do that?
Thanks!!

Probably referring text books on java would be a nice idea.

Similar Messages

  • I created an album and have been showing it presentation style, ken burns effects etc. Now every time I try to re-run it it starts from the end, last picture first! Can't seem to be able to reverse it. Any clue anyone?

    I created an album and have been showing it presentation style, ken burns effects etc. Now every time I try to re-run it it starts from the end, last picture first! Can't seem to be able to reverse it. Any clue anyone?

    First try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
    User/Home/Library/Caches/com.apple.iPhoto folder (Snow Leopard and Earlier).
    or with Lion, Mt. Lion or Mavericks delete the contents the User/Library/Containers/com.apple.iPhoto/
    Data/Library/Caches/com.apple.iPhoto folder.
    3 - reboot, launch iPhoto, reset iPhoto's preferences and try again.
    NOTE: In Lion and Mountain Lion the Home/Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and press the Return key - 10.7: Un-hide the User Library folder.
    If you're running Mavericks, 10.9,  go to your Home folder and use the View ➙ Show View Options menu to bring the this window:
    where you can check the Show Library Folder checkbox.
    Next, if necessary, continue with the two fixes below in order as needed:
    Fix #1
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - run Option #4 to rebuild the database.
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.
    2 - click on the Add Library button and select the library you want to add in the selection window..
    3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option.
    4 - In the next  window name the new library and select the location you want it to be placed.
    5 - Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • My sudoku program, any comments, improvements appreciated

    Hi all,
    So I've been refining my amateur-ish programming skills for around a month, and have been writing a C++ program that solves sudoku. (My background is in physics.) I realize there are a lot of mathematical sides in sudoku, but I'm concentrating on the programming side and not too much on the math/brain side. Now the program is basically finished (I hope!) and I just thought the hackers here can have a look and see if there are any things I can improve.
    The link is here: http://ifile.it/jkr56v8/Sudoku.tar
    Basically, a sudoku is an instance of Board, an abstract base class with the pure abstract function Go(). Any concrete class derived from it is essentially a strategy. I think this design pattern is called strategy?
    I've implemented two basic strategies, BruteForce and Priority. BruteForce does the good old sudoku brute force algorithm, which use trial-and-error from the top left box to the bottom right box all possibilitiies until the correct one is found. Priority does basically the same as BruteForce, except instead of trying from top left to bottom right, it plugs numbers in the box that has the most filled "associated" boxes.
    To accommodate "composite strategies," I implemented the prototype pattern, so for example, I can write
    void HyperBF::Go(void)
    BruteForce::Go();
    When a solution is found, I throw an exception to notify the main program, am I correct in that this is a clear and elegant use? Or is it a misuse and an alternative should be considered?
    To actually choose a strategy, I created an abstract factory, a singleton. I'm aware there are all the advice out there that says don't use a singleton unless absolutely necessary? So, should I use a singleton in this case? Also, I think my implementation of the singleton leads to a bug, which is the only known bug: when I put a completed sudoku as input, it gives the output as usual, but gives a segmentation fault afterwards:
    ./Sudoku Puzzle/test_1_Basic.psv BruteForce | tail -n 12 | head -n9 | tee completed
    |5|1|8|2|9|6|7|3|4|
    |3|9|7|8|4|1|2|6|5|
    |6|4|2|5|7|3|1|9|8|
    |1|5|6|4|2|7|3|8|9|
    |4|7|9|3|6|8|5|1|2|
    |8|2|3|9|1|5|6|4|7|
    |7|8|4|1|3|2|9|5|6|
    |2|3|5|6|8|9|4|7|1|
    |9|6|1|7|5|4|8|2|3|
    ./Sudoku completed BruteForce
    Starting configuration:
    |5|1|8|2|9|6|7|3|4|
    |3|9|7|8|4|1|2|6|5|
    |6|4|2|5|7|3|1|9|8|
    |1|5|6|4|2|7|3|8|9|
    |4|7|9|3|6|8|5|1|2|
    |8|2|3|9|1|5|6|4|7|
    |7|8|4|1|3|2|9|5|6|
    |2|3|5|6|8|9|4|7|1|
    |9|6|1|7|5|4|8|2|3|
    Final configuration:
    |5|1|8|2|9|6|7|3|4|
    |3|9|7|8|4|1|2|6|5|
    |6|4|2|5|7|3|1|9|8|
    |1|5|6|4|2|7|3|8|9|
    |4|7|9|3|6|8|5|1|2|
    |8|2|3|9|1|5|6|4|7|
    |7|8|4|1|3|2|9|5|6|
    |2|3|5|6|8|9|4|7|1|
    |9|6|1|7|5|4|8|2|3|
    Number of attempts: 0.
    Time elapsed: 0.00 s.
    Segmentation fault
    So what's wrong here?
    Having implemented the basic functionalities, I tried to play around and gain some simple experience in some optimization. I looked at the Go() function and saw probably the expensive operation is IsConsistent(), so I optimized it by only checking the consistency of changed boxes. By doing so, I reduced the computational time to around 1/3 the original time. Is this the right move, or bad move, or are there better moves?
    As a last question, I defined the number of attempts as a global variable. My reason is that, although it is possible to put it in class Board, I just think it doesn't "naturally belong" there, and putting it in a restricted scope would mean a lot of passing of parameters, slowing the program down unnecessarily. So, is this global variable fine?
    Lastly, please have a look at my Makefile. This is the first Makefile I wrote, and it took me 3 solid days to get all the .o files in Release/ ! Are there things I've left out?
    I realize the Generator is a joke, but at this moment I don't care too much about that, unless anyone has some good ideas.
    Any comments would be greatly appreciated! Thanks in advance!

    Grazz256 wrote:
    Just looking over your code a little I have a couple of comments about your coding style. Please keep in mind that these are just comments...
    I think you need to comment your code more. I know its a pain and I'm horrible about it as well but it really does help when/if you go back to read your code in a couple of years.
    I try to avoid lines like these:
      fprintf( stdout, "Starting configuration:\n" ); a->Write(stdout);
      start = clock(); a->Go();
    by putting two commands on one line it makes the code harder to read. with one command on each line I can quickly scan through and know
    generally what each line does, with two I have to actually read each line fully so that I don't miss anything.
    Descriptive variable names can also help with readability, I've always been taught the convention of using the first character to indicate type then
    using a short descriptive name. For instance you have a function that returns a long value, the value would be decalred like this:
    long lRetVal;
    so looking through the code I would know thats a long value that represents a return value.
    This is an area I'm all over the place with, I always try to stick to one convention but never seem manage it...
    As far as your problem goes, where are the boards normally deleted? ie if an incomplete sudoku is inputed?
    One possible solution is to run an IsComplete check before you start processing the board. so you would have...
    if (a->IsConsistent()) {
    if (a->IsComplete()) {
    a->Go()
    I'll be honest in that I don't really understand the flow of your code, but instead of having the board deleted within strategy or within win why not just delete it on the next line... eg:
    start = clock(); a->Go();
    delete a;
    the downside to this approach is that you would have to delete it within each exception as well but this is relatively minor.
    Cheers
    Thanks for your comments. At my present level of programming skills, any comments will help.
    I thought all my code was basically concise and self-explanatory, and each function is small enough that a quick skim through the definition and declaration would be enough to understand. As the project grew, however, things got slightly more complicated. I have added more comments in my source files, trying to comment why rather than how. I thought the flow of the code was fairly obvious though, by inspecting the main loop. It takes care of the input, bark if anything's wrong, trigger a.Go(), and try to catch a Win. Do you mean the flow within Go()? Anyway, it is very true I need clearer coding style.
    Yeah I now solved the segfault problem. The reason a completed sudoku was deleted twice is because the original sudoku is meant to be deleted by the abstract factory, while the solved sudoku is meant to be deleted by Win. When a solved sudoku is inputted it would be deleted twice. Due to lack of programming experience, I failed to see the obvious way is to, as Grazz256 said, check in the beginning whether the inputted sudoku is already solved. If it is, then I duplicate the inputted sudoku and throw the win exception.
    By the way, I think I'm beginning to understand why some people are obsessed wtih optimization. I did 3 optimization techniques in my program. First, I thought the most expensive procedure is the IsConsistent() method. By evaluating it lazily I reduced the time to 1/3 the original time. Then following http://www.acm.org/crossroads/xrds1-4/ovp.html, I used initialized the 2D vector within each sudoku via constructor rather than as statements. Doing so gave a 20% time boost. Using a friend procedure while copying sudokus boost another 5%. Doing a right move and getting positive feedback through better performance can be so satisfying.
    EDIT:
    I found out there was memory leak after all, which I finally solved.
    What happens is with all my brute force algorithms I keep creating new Board's and call the Board's Go() recursively. To delete all Board's in the heap I need to have, within each Board::Go(), instead of
    Board* a = Clone(); // return new derived Board(*this);
    a->Put(x,y,'0'+k);
    a->Go();
    delete a; // if an exception is thrown this line never gets executed
    this
    Board* a = Clone();
    a->Put(x,y,'0'+k);
    try {a->Go(); }
    catch( const Win& e) {
    delete a;
    throw(e);
    delete a;
    But this deletes the winning sudoku too. This means I have to keep the result in Win, either by duplicating the winning sudoku or storing the string. In the end I overloaded Board::Write(File* f) to also have Board::Write(std::string& p) to sprintf on the reference of a string, so Win just stores the solution in string format. Finally, no memory leak, no need to do a first check to see if the inputted sudoku is already solved, and no pointer deleted twice.
    So in the end, to manage pointers I recursively threw exceptions. That made me ask, is using exceptions worth it, or should I stick to the more conventional methods, such as have Go() return a boolean value, then deleting pointers which would give an implementation that is essentially the same as recursive exceptions?
    I still think exceptions is the way to go, the reasons being:
    1) Exception mechanism provide a natural place to hold the result. Throwing exceptions recursively and the traditional way is essentially the same, but where should the result be stored in the latter case?
    2) Arguing over the dictionary, an exception is not necessarily an "error." Winning is an exception in this algorithm, because failure is the norm (as in life).
    3) Exception arguably gives better presentation in the main loop, to my "unbiased" eyes at least. Board* a->Go() is triggered in the try block in the main(), with all (foreseeable) possible results caught as exceptions. It is true that this might be a bit unconventional, but given proper comments I still think it is at least as good as the conventional way, in terms of presentation.
    So what do you think?
    Last edited by dumas (2009-12-21 12:37:47)

  • Any comments about the Moshi AG screen protector?

    Ordered my laptop with a glossy screen. Then found a anti-glare screen protector by the same company that makes one for the keyboard. Has anyone any comments regarding either the keyboard or screen units.

    There have been many posts here praising the Moshi keyboard protector, several of them from me. It's thinner, less obstructive, better fitting, holds its shape better, and is less sticky to the touch than any of the silicone protectors, and it doesn't accumulate nearly as much dirt as they do. I switched to it after a month with a silicone protector and would never consider any other kind again. My keyboard looks exactly like it did the day I bought it after fourteen months of heavy use.
    The glass covering your screen doesn't need any protection.

  • Any comments for N81 8GB?

    Hi,
    May I know if anyone have used N81 8GB? How is it? I managed to have a look at the phone, the lower part of the front panel seemed rubber and sponge like...look fragile. The keypad also got 1 layer of rubber stuff...not those solid stuff...
    The functions seem attractive. Any comments?

    i have it, and tbh i dont find owt wrong with it, keep trying 2 open the 2nd slide (as i had the n95 8gb) then i remember it cant lol, but it all seems ok really,think the music buttons can get annoyin cause u dnt ave 2 add a lot of pressure to activate it so unless its locked music player can turn on

  • I bought an iPhone5 in the US Apple Store using "guest checkout".  Now I must CHANGE Ships TO adress, because I forgot apartment number in adress.  if I login with my Apple ID, it says that I don't have permission to open that Order.   Any ideias anyone?

    I bought an iPhone5 in the US Apple Store using "guest checkout".
    Now I must CHANGE Ships TO adress, because I forgot apartment number in adress.
    if I login with my Apple ID, it says that I don't have permission to open that Order.
    Any ideias anyone?
    Tnx

    At official Apple page's I found this:
    With our Guest Checkout feature, you can check out on the Apple Online Store without an Apple ID or password. Simply add the items you would like to purchase to your shopping basket, enter your shipping and payment information, and click the "Place Order Now" button.
    You will be able to visit online Order Status to check your order status and track shipments.
    To cancel items, add items, or make changes to your order, please call 1800 88 20 45.
    What number I must dial?
    1-800-My-Apple or 1800 88 20 45
    Thx.

  • PL/SQL-Error: ORA-00604 - ORA-01422 makes no sense. Any Idea anyone ?

    Problem:
    No matter if creating new or recompiling old procedures
    (that had been compiled successfully lon ago),
    I always receive the very same error message:
    ORA-00604: ...recursive SQL level 1
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-at line 5 (mouse cursor blinks at teh first line of code...)
    It is the same with PLEdit, HORA and SQL*PLUS:
    even the most simple procedures are not compiled
    Hints: I encounter this problem since I installed Forms 6i.
    I am using database 8.1.7 on Redhat Linux (as a server),
    and working on a W2K client.
    Any idea anyone ?
    ThanX in advance !

    Sorry, I found my error : Trigger on Database
    Maybe others are interested too:
    Be careful when using triggers "on schema" or "on database",
    because, as I have found, the error message doesn4t say that.
    I had a few such triggers for logging purposes.
    After I disabled my database triggers, I could continue compiling.
    Bye, Jan.

  • All Java Processes crash on RH Linux 7.3 / 6.3 without any comment

    We have the following Problem on two Machines. We installed j2sdk1.4.0 first, then jdk-1.3.1_04 (Because of other Problems with 1.4.0).
    Now all running java Processes crash after up to two hours without any comment, any error file. Looks like they were killed by the 'kill' Command. The running java Processes are different Programs, that do very different things.
    The OS on the two machines are RH Linux 7.3 and 6.3 - normal installation without any essential changes.
    I would be very happy, if someone have an idea, how to solve this Problem. If you need additional Information, ask for.
    Holger

    ... if someone have an idea, how to solve this Problem.Seems like I remember seeing a problem like that.
    It turned out that indeed it was the 'kill' command. Another process was running, looking for the app, and killing it when it found it.
    We spend quite a bit of time trying to figure out why our app was 'crashing' before deciding to look elsewhere (when we discovered the other process.)

  • Loading youtube videos crashes my browser - both mozilla firefox and safari. Now I can't get firefox to load any page, although safari still works. It started when I clicked on a youtube link on FB 2 weeks ago. Any ideas, anyone?

    youtube is crashing my browser - both firefox mozilla and safari. Now I cannot load firefox browser at all, but safari still works - except for youtube, which immediately crashes it....any ideas, anyone?

    I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
    When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
    At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
    I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6.

  • As a new Macbook Pro user I was saddened to find that the feature of using keywords in iPhoto '11 does not allow showing same under each photo.  I understand this was available in earlier versions.  Any comments?

    As a new Macbook Pro user I was saddened to find that the feature of using keywords in iPhoto '11 does not allow showing same under each photo.  I understand this was available in earlier versions.  Any comments?

    Against TOU which you "agreed" to in order to post in these user to user forums.  If you want to "suggest" something to Apple, do so in the Product Feedback area.

  • Since installing iCloud, my iPhone 3GS no longer syncs with my Outlook Calendar and Outlook Contacts.  I don't know what else to try, short of resetting the iPhone and completely reloading as a new device.  Any ideas, anyone?

    Since installing iCloud, my iPhone 3GS no longer syncs with my Outlook2010 Calendar and Outlook2010 Contacts.  I don't know what else to try, short of resetting the iPhone and completely reloading as a new device.  Any ideas, anyone?

    It's good to know.  The Apple instructions for loading iCloud on a PC just seem to have either overlooked or hidden this limit.  The larger problem is that it partially works:  partially and erratically.  So clean-up is great fun.

  • HT4367 My Apple TV needs restoring following a failed update and iTunes won't pick it up?? Any ideas anyone - never had to link it to comp before

    Hi - my Apple TV had a failed up date and now I need to restore it. I have hard wired to my comp but iTunes's does not see to be picking it up? Just have the apple device blinking its light and comp timer is just going round? Any ideas anyone? Thanks

    Welcome to the Apple Community Mvt1976.
    If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
    Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
    Connect the micro USB cable to the Apple TV and to your computer.
    Reconnect the power cable (only for Apple TV 3)
    Open iTunes.
    Select your Apple TV in the Devices list, and then click Restore.
    (You may already have a micro USB cable if you have a camera or other digital device)
    Check that you have correctly followed the instructions for your model of Apple TV.
    If not already, try using a powered USB port.
    Repeat the process but this time try connecting the cable while iTunes is closed.
    Repeat the process with another cable.
    Try restoring the Apple TV on another computer in another location.

  • My video call icon on facebook chat has disappeared since upgrading to mavericks, any ideas anyone?

    Since upgrading to Mavericks about a month ago, my video chat icon has disappeared from Facebook chat - I can't think of any other reason for this problem other than the upgrade to Mavericks. Any ideas anyone?

    I'm also dealing with some slowness since moving to Mavericks — but mainly with regard to long lag times with the Finder when I go to rename files, move files, or delete files.
    Could it be any of the following? (which came up red)
    Startup Items:
              CiscoVPN: Path: /System/Library/StartupItems/CiscoVPN
              AltirisAgent: Path: /Library/StartupItems/AltirisAgent
              Jaksta: Path: /Library/StartupItems/Jaksta
              NortonMissedTasks: Path: /Library/StartupItems/NortonMissedTasks
              SymAutoProtect: Path: /Library/StartupItems/SymAutoProtect
              SymProtector: Path: /Library/StartupItems/SymProtector
    Kernel Extensions:
              com.Cycling74.driver.Soundflower          (1.6.6)
              com.splashtop.driver.SRXDisplayCard          (1.6 - OS X 10.7.6)
              net.telestream.driver.TelestreamAudio          (1.0.5 - OS X 10.6.10)
              com.splashtop.driver.SRXFrameBufferConnector          (1.6 - OS X 10.7.6)
    Problem System Launch Daemons:
              [failed] com.apple.wdhelper.plist

  • I'm trying to delete some recently downloaded apps that don't work. They are faded grey and although they shake with the other apps, no cross appears in the top corner. Any ideas anyone? Thanks, Sean

    I'm trying to delete some recently downloaded apps that don't work. They are faded grey and although they shake with the other apps, no cross appears in the top corner. Any ideas anyone? Thanks, Sean

    I have the same issue witha  slight variation.  The app icons that are grayed out and cannot be deleted are DUPLICATES of other apps that I already have.  For instance I now have 2 Redbox apps - one works normally, the other cannot be opened or deleted. 

  • Why can't I enlarge safari bar and bookmarks bar so the print is larger.  I can only do this if I change resolution on display.  I do not want to make my 27" smaller.  Any comments?

    After just installing Mountain Lion on mid 2011 iMac 27" I find it does not allow increasing size of font for Safari bar and Bookmarks bar.  The print is so small it is difficult to see.  I can change resolution of screen but the the size of the screen becomes smaller.  Not what I had in mind when I bought this iMac.  Is there any fix out there and is Apple working on this problem?  Any comments would be appreciated.  Thanks.

    Safari – Enlarge browsers toolbar text
    Firefox

Maybe you are looking for