Loop issue

Ok, i've been trying since like 2 days ago to solve this problem, but i havent been able to do so.
this is the error i get:
what is your name: neo
Hello neo Do you want to go first? (1)Yes, (2)No
1
the number of marbles is: 42
How many marbles you want to remove? 60
the number of marbles left is -18
It is now the computer's turn
Exception in thread "main" java.lang.IllegalArgumentException: n must be positiv
e
        at java.util.Random.nextInt(Random.java:248)
        at GameTester.main(GameTester.java:61)
Press any key to continue...As you can see the game ends when i enter a number higher than the number of marbles. however, i dont want the game to end, i want it ask the question again, until the user enters a number thats is not greater than the number of marbles, and that is not greater than the number of marbles divided by 2.
this is the code i have so far, i've tried making a boolean method but it always escape the program, i want it to repeat the question:
System.out.print("How many marbles you want to remove? ");this is the code i have so far:
import java.util.Random;
public class Game
     private String name;
     private String answer;
     private int numMarbles;
     private int marblesTaken;
     private int pcMarblesTaken;
     int goodData;
     public Game(String name)
          this.name = name;
     public String getName()
          return name;
     public boolean getGoodData()
          //if(marblesTaken >= numMarbles || marblesTaken < 1 || marblesTaken > (numMarbles/2))
          //return true;
          if((marblesTaken > 1) && (marblesTaken <= (numMarbles/2)))
               return true;
               return false;     
     public int getNum()
          return marblesTaken;
}thanks for the support

This is the code i have so far:
import java.util.Random;
public class Game
     private String name;
     private String answer;
     private int numMarbles;
     private int marblesTaken;
     private int pcMarblesTaken;
     int goodData;
     public Game(String name)
          this.name = name;
     public String getName()
          return name;
     public void takeMarbles(int marbles)
         marblesTaken = marbles;
     public void updateMarbleCount()
         numMarbles = numMarbles - marblesTaken;
     public boolean getGoodData()
          //if(marblesTaken >= numMarbles || marblesTaken < 1 || marblesTaken > (numMarbles/2))
          //return true;
          if((marblesTaken > 1) && (marblesTaken <= (numMarbles/2)))
          return true;
          return false;     
     public int getNum()
          return marblesTaken;
     public int getMarbles()
          return numMarbles;
import java.util.Random;
import java.util.Scanner;
public class GameTester
     public static void main (String [] args)
          Scanner input = new Scanner(System.in);
          String exit = "1";
          do
               System.out.print("what is your name: ");
               String name = input.next();
               Game howdy = new Game(name);          
               String aString = "1";
               do
                    System.out.println("Hello " + howdy.getName() + " Do you want to go first? (1)Yes, (2)No");
                    aString = input.next();
               while(!aString.equals("1") && !aString.equals("2"));
                    if(aString.equalsIgnoreCase("1"))
                         Random random = new Random();
                         int min = 10;
                         int max = 100;
                         int diff = max - min + 1;
                         int numMarbles = random.nextInt(diff) + min;
                         System.out.println("the number of marbles is: " + numMarbles);
                         while(numMarbles > 1)
                         do
                             System.out.print("How many marbles you want to remove? ");
                             howdy.takeMarbles(input.nextInt());
                              while(!howdy.getGoodData());
                              howdy.updateMarbleCount();
                              System.out.println("the number of marbles left is " + numMarbles);
                              System.out.println("It is now the computer's turn");
                              int pcMarblesTaken = random.nextInt(numMarbles/2)+1;
                              System.out.println("the computer has taken " + pcMarblesTaken + " marbles");
                              numMarbles = numMarbles - pcMarblesTaken;
                              System.out.println("the number of marbles left is: " + numMarbles);
                              if (numMarbles==1)
                                   System.out.println(howdy.getName()+ " You lose");
                                   break;
                              System.out.println("It is now your turn");               
                    else
                         Random random = new Random();
                         int min = 10;
                         int max = 100;
                         int diff = max - min + 1;
                         int numMarbles = random.nextInt(diff) + min;
                         System.out.println("the number of marbles is: " + numMarbles);
                         while(numMarbles > 1)
                              int pcMarblesTaken = random.nextInt(numMarbles/2)+1;
                              System.out.println("the computer has taken " + pcMarblesTaken + " marbles");
                              numMarbles = numMarbles - pcMarblesTaken;
                              System.out.println("the number of marbles left is: " + numMarbles);
                              System.out.println("It is now your turn");
                              do
                                  System.out.print("How many marbles you want to remove? ");
                                  howdy.takeMarbles(input.nextInt());
                              while(howdy.getGoodData());
                              howdy.updateMarbleCount();
                              System.out.println("the number of marbles left is " + numMarbles);
                              if (numMarbles==1)
                                   System.out.println(howdy.getName()+" You Win!!");
                                   break;
                              System.out.println("It is now the computer's turn");
          do
          System.out.print("Do you want to play again? (1)Yes, (2)No ");
          exit = input.next();          
          while(!exit.equals("1") && !exit.equals("2"));
          if(exit.equals("2"))
               System.out.println("Thanks for playing with us!");
               break;
          while(exit.equals("1"));
}     whats the third method?? what does it do?? why is the program ignoring my input??
Thanks for the help!

Similar Messages

  • Login "Loop" issue after upgrading to Leopard from Tiger-iBook G4

    Hi Guys,
    I've the same login "loop" issue as described in *Apple KB article #306965* only on an iBook G4, unfortunately the solution offered in the KB article does not help.
    There is one slight variant being that the user desktop appears for a second or two after the blue screen following login before it returns (loops) to the login window. It happens on all (2) user accounts.
    The interesting thing is it doesn't occur on either account when booting in 'safe mode'.
    Apart from deleting these accounts and saving/transferring the data are there any other ideas, suggestions or solutions?
    Regards,
    BB

    Did a clean install, cloned the HD with SuperDuper and then used Mig. Asst. to restore data back to the original HD. All now OK.
    A & I was done in the initial upgrade from Tiger.
    Cheers,
    BB

  • Mac Mini late 2012 upgrade to Maverick loop issue

    Hi there,
    I'm a Mac Mini noob.
    Last night I downloaded Maverick and this morning I clicked install.
    The Mac rebooted and then loaded then showed some error messages and then goes to password screen. I enter it and it says there was a problem and the MAC will be restarted.
    It now just loads, shows the error message and automatically goes to password enter screen and then says theres an error and will be rebooted after I enter the correct password.
    Can some one tell me whats wrong and how to fix or even to cancel this upgrade? I just want my Mac Mini to work again.
    Thanks
    L

    Thanks BDAqua, I didn't try your method but...
    Hmm I attempted the following and it was resolved and I managed to get back to my desktop and out of the restart loop (phew). I then pulled up my guts and double clicked the Maverick install again and this time it was successful. I followed this article which I found shortly after I posted the problem on here:
    http://www.gottabemobile.com/2013/11/04/os-x-mavericks-upgrade-boot-loop-fix/
    OS X Mavericks Upgrade BootLoop Fix
    If you are upgrading to OS X Mavericks and get stuck in a boot loop that will not complete the installation, you may need to hit a special key combo to force the computer to complete the installation and upgrade process.
    Gotta Be Mobile reader Steve Small reached out to let us know about the OS X Mavericks Upgrade bootloop problem, which forced his MacBook Pro to get stuck showing the odd text on a screen below, which looks like a OS X crash and an error message that says, “Your computer restarted because of a problem. Press a key or wait a few seconds to continue startup.”
    Read: How to Upgrade to OS X Mavericks
    Ultimately this error prevented Small from upgrading to OS X Mavericks, as it did many other users. Thankfully if you get stuck in this OS X Mavericks boot loop you can press four keys at startup to reset the NVRAM and get past the boot loop.
    OS X Mavericks upgrade boot loop and kernel panic can prevent an easy upgrade.
    When you restart the Mac, press Option-Command-P-R until you hear the startup sound a second time. This will reset the NVRAM, which is where your Mac stores the following information.
    Speaker volume
    Screen resolution
    Startup disk selection
    Recent kernel panic information, if any.
    In this case, resetting the NVRAM should clear up the boot loop issue which was possibly related to the startup disk selection stored here or to a kernel panic. The error screen shown at the top of this guide looks very similar to a kernel panic.
    With this out of the way you should be able to continue the upgrade to OS X Mavericks. If the computer does not pickup where it left off you may need to go to LaunchPad and select Install OS X Mavericksagain. If you need to install it from scratch, here is our guide to a clean OS X Mavericks install.
    Read: OS X Mavericks Best Features
    http://www.gottabemobile.com/2013/10/24/20-best-os-x-mavericks-features/Apple released OS X Mavericks as a free upgrade to all Mac users with a compatible Mac in October. The software update is available for many Macs as old as mid-2007 are compatible with the free update. Users can download the 5GB installation file from the Mac App Store on any of these compatible devices.

  • Aperture 3.1 loop issues possible bug with CMYK/RGB numbers in loop?

    I'm looking to find out if I'm not the only one with this problem:
    After upgrading to 3.1, I've noticed that when I do my color correction of skin, by the numbers using CMYK in the loop, that on a number of images, I can no longer get the loop to read the numbers in the top third of the image. No differences in the camera used, import process, asset management, nothing about my process has changed.
    Thoughts?
    Thanks in advance!

    Kevin Wick wrote:
    I'm curious too if anyone else is having an issue with the loupe in Aperture 3.1.
    I noticed I was getting false reading when checking color as well. The numbers were way off as you have expressed or did not read at all in a vertical images. Where as the number under the histogram seem to be correct when checking numbers. From what I've seen here it must be a issue with other or they must be using their loupe.
    K-
    Hey there Kevin, I'm sure we will talk on the phone again before you read this!
    I'm using this as a work around for now but, what a bummer! I've tried to see if the issue is present on my other machines and using other cameras and - it still is. Since no one else has chimed in here to share if they are experiencing these loop issues, I'm wondering if it is just you and me. Maybe no one really uses the loop with color values to color correct their images.

  • For loop issue and error exception

    I am finishing up a program and having a few issues....I can send my instructions so it may seem easier to what I want...the first issue deals with the for loop for the 2nd for loop in the actionperformed when i click on go it does not change any of the boxes to yellow
    Also when I check for errors it does not check with the code I have...I know it says on the instructions to use try\catch but I am just going to use if statements because I am not very familar with the try\catch and will accept some points takin off...any help with this by tonight id really appreciate it as long as noone is too busy...Thanks
    instructions:
    This will incorporate arrays, for loops, and Frames all in one.
    Create a panel containing an array of 16 TextArea components that change color to correspond with the start, stop, and step values entered by the user. Perform the following tasks to create the Checkerboard Array application shown below. When the user enters the start, stop, and step fields and then clicks the Go button, the results are also shown below.
    1.     Call your application Checkerboard.java
    2.     You will need the following variables� declare them as private:
    a.     16 component TextArea array
    b.     a Panel to hold the array
    c.     3 TextField components with length of 10
    d.     3 int variables to receive the start, stop, and step values
    e.     3 Labels to display the words Start, Stop, and Step
    f.     a Go button
    g.     a Clear button
    h.     a Panel to hold the 3 TextFields, 3 Labels, and the 2 Buttons
    3.     Create a constructor method to:
    a.     construct each of the components declared above and initializes the start, stop, and step variables to zero (when constructing the TextArea components, use the following parameters: null, 3, 5, 3)
    b.     set the Frame layout to BorderLayout
    c.     write a for loop to loop the array and set each of the 16 TextArea components in that array so they cannot be edited. In the same loop, set each of the TextArea components text to be 1 more than the index number. Also in this same loop, set the background of each of the TextArea components to white.
    d.     set the Panel for the TextArea components to GridLayout with 4 rows, 4 columns, and both gaps set to 10
    e.     set the Panel for the TextFields, Labels, and button to GridLayout with 3 rows, 3 columns, and both gaps set to 5
    f.     add the components to their respective Panels
    g.     make the buttons clickable
    h.     place the Panels in the Frame� put one in the NORTH and one in the CENTER
    i.     Enter the addWindowListener() method described in the chapter� this is the method that overrides the click of the X so it terminates the application
    4.     In your actionPerformed() method:
    a.     convert the data in your TextFields to int and store them in the variables declared above
    b.     write a loop that goes through the array setting every background color to blue
    c.     write another loop that�s based on the user inputs. Each time the loop is executed, change the background color to yellow (so� start your loop at the user�s specified starting condition. You�ll stop at the user�s specified stopping value. You�ll change the fields to yellow every time you increment your loop based on the step value. REMEMBER: Your displayed values are 1 off from your index numbers!!)
    5.     Write a main() method that creates an instance of the Checkerboard Frame.
    a.     set the bounds for the frame to 50, 100, 300, 400
    b.     set the title bar caption to Checkerboard Array
    c.     use the setVisible() method to display the application Frame during execution
    6.     After you get all of this complete, include error handling to make sure:
    a.     the values entered in the TextFields are valid integers
    b.     the start value is greater than or equal to 1 and less than or equal to 16
    c.     the stop value is greater than or equal to 1 and less than or equal to 16
    d.     the step value is greater than or equal to 1 and less than or equal to 16
    e.     the start condition is less than the stop condition
    f.     when an error occurs, give an error message in a dialog box that is specific to their error, remove the text from the invalid field, and put the cursor in that field so the user has a chance to re-enter� this can be accomplished by using multiple try/catch statements
    g.     only change the colors if the numbers are valid
    7.     Create a clear button as seen in the example below. This button should:
    a.     clear out all 3 TextFields
    b.     change the background color of all TextArea array elements to white
    c.     put the cursor in the start field
    8.     Document!!
    my code is:
    //packages to import
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    public class Checkerboard extends Frame implements ActionListener
         private Panel topPanel;
         private TextArea topDisplay[];
         private Panel bottomPanel;
         private TextField startField = new TextField(10);
         private TextField stopField = new TextField(10);
         private TextField stepField = new TextField(10);
         private Label startLabel = new Label ("Start");
         private Label stopLabel = new Label ("Stop");
         private Label stepLabel = new Label ("Step");
         private Button goButton;
         private Button clearButton;
         private boolean clearText;
         private boolean first;
         private int start;
         private int stop;
         private int step;
         //constructor methods
         public Checkerboard()
              //construct components and initialize beginning values
              topPanel = new Panel();
              topDisplay = new TextArea[16];
              goButton = new Button("Go");
              clearButton = new Button("Clear");
              first = true;
              bottomPanel = new Panel();
              int start = 0;
              int stop = 0;
              int step = 0;
              bottomPanel.add(startField);
              bottomPanel.add(stopField);
              bottomPanel.add(stepField);
              bottomPanel.add(startLabel);
              bottomPanel.add(stopLabel);
              bottomPanel.add(stepLabel);
              bottomPanel.add(goButton);
              goButton.addActionListener(this);
              bottomPanel.add(clearButton);
              clearButton.addActionListener(this);
              clearText = true;
              //set layouts for the Frame and Panels
              setLayout(new BorderLayout());
              topPanel.setLayout(new GridLayout(4, 4, 10, 10));
              bottomPanel.setLayout(new GridLayout(3, 3, 5, 5));
              //construct the Display
              for(int i = 0; i <= 15; i++)
                        topDisplay[i] = new TextArea(null, 3, 5, 3);
                        topDisplay.setText(String.valueOf(i+1));
                        topDisplay[i].setEditable(false);
                        topPanel.add(topDisplay[i]);
              //add components to frame
              add(topPanel, BorderLayout.NORTH);
              add(bottomPanel, BorderLayout.CENTER);
              //allow the x to close the application
              addWindowListener(new WindowAdapter()
                        public void windowClosing(WindowEvent e)
                                  System.exit(0);
                   } //end window adapter
         public static void main(String args[])
              Checkerboard f = new Checkerboard();
              f.setTitle("Checkerboard Array");
              f.setBounds(50, 100, 300, 400);
              f.setLocationRelativeTo(null);
              f.setVisible(true);
         } //end main
         public void actionPerformed(ActionEvent e)
              //test go
              String arg = e.getActionCommand();
              //go button was clicked
              if(arg.equals("Go"))
                   //convert data in TextField to int
                   int start = Integer.parseInt(startField.getText());
                   int stop = Integer.parseInt(stopField.getText());
                   int step = Integer.parseInt(stepField.getText());
                   if((start <= 1) && (start > 16))
                        JOptionPane.showMessageDialog(null, "You must enter start between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                        startField.setText(" ");
                        startField.requestFocus();
                   if ((stop < 1) && (stop > 16))
                        JOptionPane.showMessageDialog(null, "You must enter stop between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                        stopField.setText(" ");
                        stopField.requestFocus();
                   if ((step < 1) && (step > 16))
                        JOptionPane.showMessageDialog(null, "You must enter step between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                        stepField.setText(" ");
                        stepField.requestFocus();
                   if (start < stop)
                        JOptionPane.showMessageDialog(null, "Stop cannot be larger than start", "Error", JOptionPane.ERROR_MESSAGE);
                        startField.setText(" ");
                        stopField.setText(" ");
                        stepField.setText(" ");
                        startField.requestFocus();
                   for(int i = 0; i <=16; i++)
                   topDisplay[i].setBackground(Color.blue);
                   for(int i = start; i <= stop; step++)
                   topDisplay[i].setBackground(Color.yellow);
              } //end the if go
              //clear button was clicked
              if(arg.equals("Clear"))
                   clearText = true;
                   startField.setText("");
                   stopField.setText("");
                   stepField.setText("");
                   first = true;
                   setBackground(Color.white);
                   startField.requestFocus();
              } //end the if clear
         }//end action listener
    }//end class

    got the yellow boxes to come up but just one box.....so is there something wrong with my yellow set background because I am not seeing any more errors
    //packages to import
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    public class Checkerboard extends Frame implements ActionListener
         private Panel topPanel;
         private TextArea topDisplay[];
         private Panel bottomPanel;
         private TextField startField = new TextField(10);
         private TextField stopField = new TextField(10);
         private TextField stepField = new TextField(10);
         private Label startLabel = new Label ("Start");
         private Label stopLabel = new Label ("Stop");
         private Label stepLabel = new Label ("Step");
         private Button goButton;
         private Button clearButton;
         private boolean clearText;
         private boolean first;
         private int start;
         private int stop;
         private int step;
         //constructor methods
         public Checkerboard()
              //construct components and initialize beginning values
              topPanel = new Panel();
              topDisplay = new TextArea[16];
              goButton = new Button("Go");
              clearButton = new Button("Clear");
              first = true;
              bottomPanel = new Panel();
              int start = 0;
              int stop = 0;
              int step = 0;
              bottomPanel.add(startField);
              bottomPanel.add(stopField);
              bottomPanel.add(stepField);
              bottomPanel.add(startLabel);
              bottomPanel.add(stopLabel);
              bottomPanel.add(stepLabel);
              bottomPanel.add(goButton);
              goButton.addActionListener(this);
              bottomPanel.add(clearButton);
              clearButton.addActionListener(this);
              clearText = true;
              //set layouts for the Frame and Panels
              setLayout(new BorderLayout());
              topPanel.setLayout(new GridLayout(4, 4, 10, 10));
              bottomPanel.setLayout(new GridLayout(3, 3, 5, 5));
              //construct the Display
              for(int i = 0; i <= 15; i++)
                        topDisplay[i] = new TextArea(null, 3, 5, 3);
                        topDisplay.setText(String.valueOf(i+1));
                        topDisplay[i].setEditable(false);
                        topPanel.add(topDisplay[i]);
              //add components to frame
              add(topPanel, BorderLayout.NORTH);
              add(bottomPanel, BorderLayout.CENTER);
              //allow the x to close the application
              addWindowListener(new WindowAdapter()
                        public void windowClosing(WindowEvent e)
                                  System.exit(0);
                   } //end window adapter
              public static void main(String args[])
                        Checkerboard f = new Checkerboard();
                        f.setTitle("Checkerboard Array");
                        f.setBounds(50, 100, 300, 400);
                        f.setLocationRelativeTo(null);
                        f.setVisible(true);
                   } //end main
                   public void actionPerformed(ActionEvent e)
                        boolean done = false;
                        //test go
                        String arg = e.getActionCommand();
                        //go button was clicked
                        if(arg.equals("Go"))
                   //convert data in TextField to int
                   int start = Integer.parseInt(startField.getText());
                   int stop = Integer.parseInt(stopField.getText());
                   int step = Integer.parseInt(stepField.getText());
                   while(!done)
                        try
                             if((start <= 1) && (start > 16)) throw new NumberFormatException();
                             else done = true;
                        } //end try
                        catch (NumberFormatException f)
                             JOptionPane.showMessageDialog(null, "You must enter start between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                             startField.setText(" ");
                             startField.requestFocus();
                        } //end catch
                        try
                             if ((stop < 1) && (stop > 16)) throw new NumberFormatException();
                             else done = true;
                        } //end try
                        catch (NumberFormatException f)
                             JOptionPane.showMessageDialog(null, "You must enter stop between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                             stopField.setText(" ");
                             stopField.requestFocus();
                        } //end catch
                        try
                             if ((step < 1) && (step > 16)) throw new NumberFormatException();
                             else done = true;
                        } //end try
                        catch (NumberFormatException f)
                             JOptionPane.showMessageDialog(null, "You must enter step between 1 and 16", "Error", JOptionPane.ERROR_MESSAGE);
                             stepField.setText(" ");
                             stepField.requestFocus();
                        } //end catch
                        try
                             if (start > stop) throw new NumberFormatException();
                             else done = true;
                        } //end try
                        catch (NumberFormatException f)
                             JOptionPane.showMessageDialog(null, "Stop cannot be larger than start", "Error", JOptionPane.ERROR_MESSAGE);
                             startField.setText(" ");
                             stopField.setText(" ");
                             stepField.setText(" ");
                             startField.requestFocus();
                        } //end catch
              } //end while
                        for(int i = 0; i <=15; i++)
                        topDisplay[i].setBackground(Color.blue);
                        for(int i = start; i <= stop; step++)
                        topDisplay[i].setBackground(Color.yellow);
                   } //end the if go
                   //clear button was clicked
                   if(arg.equals("Clear"))
                        clearText = true;
                        startField.setText("");
                        stopField.setText("");
                        stepField.setText("");
                        first = true;
                        setBackground(Color.white);
                        startField.requestFocus();
                   } //end the if clear
         }//end action listener
    }//end class

  • Anyone else having reset loop issues with ipad or ipad mini after IOS 7.02 update ? Based on my research it looks like this release is a total disaster for a lot of users. Locking up phones and ipads. Hopefully 7.03 will fix this mess.

    My Ipad mini is in a constant reset loop since 7.02 upgrade. Did a full recover twice to Factory setting thru Itunes. That did not work. Any thoughts on this release and it's implications. Looks like many people are having the same issues.

    Hi gruhland,
    Thanks for your reply.  It sounds like your device is actually in a restart loop, which is different from the process of a soft reset.  Specifically, what I wanted you to try is this:
    Resetting your device
    If your device stops responding, you can reset it by pressing and holding both the Sleep/Wake and Home buttons for at least ten seconds, until the Apple logo appears.
    If resetting does not break the restart loop, it sounds like a different direction may be warranted here. Due to the nature of your issue you may find more assistance by using another one of Apple's support resources:
    http://www.apple.com/support/contact/
    Take care,
    - Ari

  • For Each Loop Issue In SSIS

    Hi All,
    I have a SSIS Package which unzips the folder and then imports the files and then moves *.zip folders into processed location. If this task is executed as a part of total package its not moving the *.zip folders into processed location, but when we execute
    for each loop alone this *.zip folders are moved into processed location. I am unable to figure out the issue here.
    ZippedFile variable holds fully qualified file name..
    Rohan
    Rohan

    Can you put a OnPreExec breakpoint on the file system task (Right click on the file system task > Edit Breakpoint... > Select the first (OnPreExec breakpoint) and when the pkg pauses @ the breakpoint, chk the value of the ZippedFle and FilePathDestination
    variable values in your Local window (should be available at the bottom of the SSIS window as one of the tabs and you will need to expand the variable tree and find these two variables and their values). Are you seeing the appropriate values here?

  • Smartform - Loop issue not printing correctly

    Hi,
    In smartforms -Main Window - I created like this
    1.Loop Statement   - This will loop - ITAB1
    TEXT statement - ITAB1-ADRNR - (prints the address)
    within the loop
      ITEM_DATA (item data) table.  - This will Loop ITAB2 - where ADRNR = ITAB1-ADRNR
    This supposed to put line items which are having ADRNR from ITAB1
    But my program is printing in wrong way..
    it is printing
    ADDRESS1 - ITAB1-ADRNR - correct
    ITEM DATA -  from ITAB2- related to ADRNR  (if it has only 1 record) - correct
    ADDRESS2-ITAB1-ADRNR - correct
    ITEM DATA - from ITAB2 - where ADRNR = ITAB1ADRNR - if this condition satisfies more than 1 record
    supposed to print all the records - but instead it is printing  always the first record   - wrong
    Ex- if 3 records has the same ADRNR of ITAB1 in ITAB2 - it is actually printing 3 times the first satisfying record - Wrong
    Can anyone please tell me what is the issue?
    Thanks for your time.
    Kevin

    Hi,
    I created like this..
    ITAB1 - complete data
    ITAB2 - unique records based on ADRNR
    1. LOOP ITAB2
    Print Address - ITAB2-ADRNR
    ITEM DATA(header and line items)
    I have given table name in DATA loop section
    - loop ITAB1 - where ADRNR = ITAB2-ADRNR
    But in item data it is printing the same line item repetedly .
    Any comments?
    Thanks for ur time.

  • Looping issue in stored procedure

    Hi Experts,
    currently i am using below version :
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    Here i am describibng DDL and DML queries.
    CREATE TABLE test_1 (c1 NUMBER,c2 VARCHAR2(30),c3 VARCHAR2(20));
    INSERT INTO test_1 VALUES(10,'abcdefg','abcdefg');
    INSERT INTO test_1 VALUES(20,'Hi jklm','hij klmn');
    i want the ouput like below : (count of spaces,count of lower characters,count of upper characters for every column)
    Number of spaces : 0 column_name :c2
    Number of uppercase char : 0 column_name :c2
    Number of lowercase char :7 column_name :c2
    Number of spaces : 0 column_name :c3
    Number of uppercase char : 0 column_name :c3
    Number of lowercase char :7 column_name :c3
    Number of spaces : 1 column_name :c2
    Number of uppercase char : 1 column_name :c2
    Number of lowercase char :5 column_name :c2
    Number of spaces : 1 column_name :c3
    Number of uppercase char : 0 column_name :c2
    Number of lowercase char :7 column_name :c2
    For the above requirement i had written the below procedure. but i am getting error, Please help me on this issue. or else tell me other logic for this requirement.
    create or replace procedure string_count(intab IN VARCHAR2)
    AS
    v_str VARCHAR2(200);
    v_query VARCHAR2(200);
    l NUMBER;
    i NUMBER := 1;
    ss VARCHAR2(20);
    ascii NUMBER;
    upper_count NUMBER := 0;
    lower_count NUMBER := 0;
    space_count NUMBER := 0;
    BEGIN
    FOR i IN (SELECT COLUMN_NME FROM USER_TAB_COLUMNS WHERE TABLE_NAME=UPPER(intab) AND DATA_TYPE IN ('VARCHAR2'))
    LOOP
    BEGIN
    v_query := 'CURSOR c2 IS select '||i.column_name||' from '||intab;
    EXECUTE IMMEDIATE v_query INTO v_str;
    l := LENGTH(v_str);
    WHILE i <= l
    LOOP
    ss := substring(v_str,i,1);
    IF (ASCII(ss)) = ASCII(' ') THEN
    space_count := space_count+ 1;
    ELSE
    IF (ASCII(ss)) = ASCII(UPPER(ss)) THEN
    upper_count := upper_count + 1;
    ELSE
    lower_count := lower_count + 1;
    i := i + 1;
    END IF;
    END LOOP;
    END;
    CLOSE c2;
    DBMS_OUTPUT.PUT_LINE(space_count|| 'Number of spaces :'||v_str );
    DBMS_OUTPUT.PUT_LINE(upper_coun|| 'Number of uppercase char :'||v_str );
    DBMS_OUTPUT.PUT_LINE(lower_count||'Number of lowercase char :'||v_str);
    END LOOP;
    CLOSE c1;
    END string_count;
    ERROR is : Error(33,8): PLS-00103: Encountered the symbol "LOOP" when expecting one of the following: if
    Thanks in Advance.

    Hi Purvesh,
    Now your logic is fine.defiantly will be useful for my requirement. but i had written the procedure for this requirement with other logic it is not working.
    Here is the procedure : (at compile time no issue but at run time got error)
    create or replace procedure string_count (intab IN VARCHAR2)
    AS
        v_str VARCHAR2(200);
        v_query VARCHAR2(200);
        a NUMBER;
        i NUMBER := 1;
        ss VARCHAR2(200);
        upper_count NUMBER := 0;
        lower_count NUMBER := 0;
        space_count NUMBER := 0;
    BEGIN
        FOR k IN (SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME=UPPER(intab) AND DATA_TYPE IN ('VARCHAR2'))
        LOOP
    BEGIN
          v_query := 'CURSOR c2 IS select '||k.column_name||' from '||intab ;
          EXECUTE IMMEDIATE v_query INTO v_str;
          a := LENGTH(v_str);
            WHILE i <= a
            LOOP
               ss := substr(v_str,i,1);
             IF ASCII(ss) = ASCII(' ') THEN
               space_count := space_count + 1;
             ELSIF ASCII(ss) = ASCII(UPPER(ss)) THEN
               upper_count := upper_count + 1;
             ELSE
               lower_count := lower_count + 1;
               i := i + 1;
             END IF;
            END LOOP;
    END;
       DBMS_OUTPUT.PUT_LINE('No.of spaces:'||space_count||' ' ||v_str );
       DBMS_OUTPUT.PUT_LINE('No.of upper case char:'||upper_count||' '||v_str );
       DBMS_OUTPUT.PUT_LINE('No.of lower case char:'||lower_count||' '||v_str);
        END LOOP;
    END string_count;Here is the Error Message :
    ERROR : Error starting at line 1 in command:
    EXECUTE string_count('BB');
    Error report:
    ORA-00900: invalid SQL statement
    ORA-06512: at "TESTUSER.STRING_COUNT", line 17
    ORA-06512: at line 1
    00900. 00000 - "invalid SQL statement"Please suggest me on this error and even i had tried to create a procedure with your logic. but i am blank to put your logic in the procedure.
    Here is the proceduere of ur logic(incomplete) :
    create or replace procedure string_count1 (intab IN VARCHAR2)
    AS
    lowercase_count NUMBER;
    uppercase_count NUMBER;
    space_count NUMBER;
    v_str VARCHAR2(200);
    v_query VARCHAR2(200);
    CURSOR c1 IS SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME=UPPER(intab) AND DATA_TYPE IN ('VARCHAR2');
    BEGIN
    OPEN c1 ;
    LOOP
    FETCH c1 INTO v_str;
    EXIT WHEN c1%NOTFOUND;
    v_query := 'SELECT regexp_count('||v_str||','|| '''[a-z]'''||',' ||'1'||','|| '''c'''||') FROM '||intab;
    EXECUTE IMMEDIATE v_query INTO lowercase_count;
    DBMS_OUTPUT.PUT_LINE(lowercase_count);
    --DBMS_OUTPUT.PUT_LINE(v_query);
    END LOOP;
    CLOSE c1;
    END string_count1;My ouput should be like :
    DBMS_OUTPUT.PUT_LINE('No.of spaces:'||space_count||' ' ||v_str );
    DBMS_OUTPUT.PUT_LINE('No.of upper case char:'||upper_count||' '||v_str );
    DBMS_OUTPUT.PUT_LINE('No.of lower case char:'||lower_count||' '||v_str);Thanks,

  • Cisco Prime Intrastructure 2.0 boot loop issue?

    Hi!!! I have a question.
    I have a server Cisco UCSC-C220-M3L: 2x Intel Xeon E5-2665; 32Gb RAM; 1x LFF HDD 1 TB: LSI embedded sw MegaRaid controller. HDD is configured in RAID 0.
    I have installed CPI 2.0 Express OVA on my ESXi host version 5.5 and went through the install process 100%, but upon reboot after install it is stuck at the loop booting Cisco ADE-OS 2.0 and so the cycle with a reboot of the virtual machine CPI. Has anyone had this issue ? I have attached a screenshot:

    Here's a link for boot loop recovery.
    Since it's a new install you probably don't have anything to recover though:::
    https://supportforums.cisco.com/docs/DOC-26689#comment-14559
    Reading the system requirements for the Express version, one would think any version of ESXi is supported.
    Looking at the system requirements for the Standard and Pro versions though it appears 5.1 is the latest version.
    VMWare Version
    Express - ESXi 4.1 or later
    Standard - ESXi 5 or ESXi 5.1
    Pro - ESXi 5 or ESXi 5.1
    Try with ESXi 5.1 and I'll bet it works!

  • BPEL While Loop Issues

    I have a BPEL process that polls a DB table for records. The DB Adapter has the both Database rows per transaction and Database Rows per XML set to 10. A While loop in the BPEL process loops over all the 10 records, applies suitable transformation and continues with processing. For testing purpose, I inserted 15 records into the table. As expected, 2 instances of the BPEL process were created. The first instance received 10 records and the second one 5. The second instance processed all 5 records but the first instance executes the loop just once, then the condition is evaluated to false and the rest of the records are not processed. Since the second instance is able to loop through all the records, the configuration is correct. I am not sure why the first instance is exiting the loop after just one iteration. I have a simple bpel process to reproduce this issue and I can share it. Following are the versions used:
    Jdev: 11.1.1.7
    BPEL: 1.1
    All help appreciated.
    Thanks,
    Divya

    I have uploaded the BPEL project as well as the sample DB:
    https://community.oracle.com/docs/DOC-893469?sr=stream
    https://community.oracle.com/docs/DOC-893468?sr=stream
    The input XML is below:
    <BpelTest><key>110</key><value>Lyndon Johnson</value><status>S</status></BpelTest>-<BpelTest><key>120</key><value>George Washington</value><status>S</status></BpelTest>-<BpelTest><key>130</key><value>Benjamin Franklin</value><status>S</status></BpelTest>-<BpelTest><key>140</key><value>Abraham Lincoln</value><status>S</status></BpelTest>-<BpelTest><key>150</key><value>Richard Nixon</value><status>S</status></BpelTest></BpelTestCollection>
    Thanks,
    Divya

  • How to fix A6000 plus reboot loop issue? - Please help

    Hi Lenovo Team, Now after couple of days with sudden reboot issue. Not my phone totally useless with roboot loop. Not able to reset to factory settings. Please help me. 

    Hi GeeD, thanks for helping me here.
    Now that I can use the "LaCie Firmware Updater" I can see my devices in the updater and that they needed some updates (I don't know how I worked all this time without those updates).
    But when I tried to update my "LaCie d2 Quadra v3" and "LaCie d2 Quadra" conected them separately, or both conected at the same time, I can't update any hard disk because an error.
    Here are some pics of the sequence of the windows:
    And when I do it connecting both disks, but updating just the "LaCie d2 Quadra":
    I already write to LaCie, hoping to get an answer. But of course I would be thanksfull for any comment by you.
    Thanks again.

  • Infinite Loop issue in Encore CS5.1

    I have never been as angry at a piece of software as I am with Adobe Encore. I have been crashing it for almost a week now and I still am no closer to figureing out the problem...
    I have a 90 minute feature in Pr that I exported as an SD 16:9 (progressive frames) set of m2vs.  I also exported a single AC3 audio file using Surcode.  The moment I import any of the video the software becomes unstable.  My current methodology involves setting up the entire menu system (one SD main menu and 3 chapter sub menus), then import the AC3 as a timeline, then finally importing the M2Vs, one at a time saving after every successful import.  No dynamic links or anything unusual.
    Even though it is a 4GB SD feature the Encore process is using almost 2GB of memory when it seems to be working right.  Whenever I try to perform any task I get the (Not Responding) notice and I have to look at the process list.  If the CPU is fluctuating I have a good chance that control will return, if it locks in at 8% then it is stuck in some kind of infinite loop and will never come back.  At that point I kill off the program and try to see if the last saved session will load.  While in the infinite loop the memory will count up to about 3GB thae get knocked down to about 1GB, then start counting back up again.
    I have successfully completed the CD creation process once or twice, but it can take mnore than a day to complete what should take 20 minutes.
    I have deleted the Media Cache DB, moved the Media Cache DB, re-installed the software, and searched the net for a solution.  Nada...
    I am doing this work on my editor:
    OS Name Microsoft Windows 7 Ultimate
    Version 6.1.7601 Service Pack 1 Build 7601
    Other OS Description  Not Available
    OS Manufacturer Microsoft Corporation
    System Name EDITORPC
    System Manufacturer System manufacturer
    System Model System Product Name
    System Type x64-based PC
    Processor Intel(R) Core(TM) i7 CPU         980  @ 3.33GHz, 3750 Mhz, 6 Core(s), 12 Logical Processor(s)
    BIOS Version/Date American Megatrends Inc. 1001, 12/24/2010
    SMBIOS Version 2.5
    Windows Directory C:\Windows
    System Directory C:\Windows\system32
    Boot Device \Device\HarddiskVolume5
    Locale United States
    Hardware Abstraction Layer Version = "6.1.7601.17514"
    User Name EditorPC\bgruen
    Time Zone Eastern Daylight Time
    Installed Physical Memory (RAM) 24.0 GB
    Total Physical Memory 24.0 GB
    Available Physical Memory 20.1 GB
    Total Virtual Memory 48.0 GB
    Available Virtual Memory 44.0 GB
    Page File Space 24.0 GB
    Page File C:\pagefile.sys
    Any suggestions?
           Bob

    I'm don't think that is the "same problem," unless you are mixing one ac3 with multiple m2vs on the same timeline. (If the following doesn't solve your issue, start a new thread.)
    In any event, the following may not be directly applicable to your OS or situation, but includes global issues and specifics. Look in particular at numbers 1 and 4.
    Troubleshoot system errors and freezes | Adobe software on Mac OS 10.x
    http://kb2.adobe.com/cps/824/cpsid_82414.html
    Edit: Reading my mind? I'll add this to your new thread!

  • Font looping issue in Illustrator CS5

    My Ilustrator either loops fonts (1 - 10 approx.) or it stop at one font and can't move forward. Photoshop doesnt have this problem. My friend has all the same fonts as me, but his works fine. Once i opened a the original document i created on my coputer, his computer he was subject to this problem. I have no idea what i should do.

    Hi, I'm getting the same issue, but cleaning the font caches hasn't seemed to work.
    It's only illustrator which has this problem, when scrolling font's if it comes to a font it doesn't like (even if these fonts load fine in other programs) it skips down to the bottom of the list and just cycles through them instead.
    (using CS5, on a Windows 7, 64bit HP Laptop)
    thanks,

  • IPod Nano 5G Restore Loop Issue

    I've seen the infinite issues with different iPods (classics and nanos) stuck in the restore loops and how possible fixes might happen. Everything checks out fine from diags mode. Disk mode can sync just fine to files, etc. What else can be done to fix the issue?
    The Hardware (and SW):
    MBP 3,1 OSX 10.6.6
    WinXPPro SP3
    iPod Nano 5G 16gb
    iTunes 10.1.2
    The issue:
    the infinite loop of restore
    What has been tried:
    Restore basic mode from iTunes
    Restore in disk mode from iTunes
    Restore in DFU mode from iTunes
    Drive letter changing on a Windows XP Pro SP3 box using iTunes

    Hello mvfx,
    What other USB devices do you have attached to your computer? If there are any at all, try temporarily disconnecting them to see if that makes a difference as they sometimes cause driver and drive letter conflicts.
    Another option might be to simply reformat the iPod using the tools provided by Windows. For instructions on how to reformat your iPod, see this article.
    http://www.methodshop.com/gadgets/ipodsupport/erase/
    B-rock

  • Encore CS4 Button & Loop Issues

    I am building a DVD in Encore CS4 and have two issues. The DVD consists of a main menu with one button linked to the main timeline (3 min 45 sec) and a video(1 min 2 sec 21 frames) linked for the menu to have motion along with an audio clip with the same run time. The video and audio were exported from Encore CS4 as MPEG2-DVD.The loop point is set to 9 sec 11 frames and is set to forever.
    Issue 1- When I try to preview the project in Encore before burning it starts as it should but stops at the loop point (9 sec 11 frames into it) and plays from the beginning. When I burn the DVD the loop works properly but I can not see it in the preview prior to burning. I wasted a couple of discs lining up the loop point due to no preview. I should also note that
    Issue 2- When the DVD is burned and played it loads the menu which plays as it should. At the 9 second mark a button appears signifying the loop point which when selected begins the actual video, as it should. After the video finishes and it loops back to the 9 second mark the button vanishes. The only way to navigate at this point is to hit the top menu button which starts it from scratch.
    I went back to a test burn I made and the button remained continuously after looping. What could I have hit that is now making the button vanish? And what can I do to get a full preview before going to build?
    Thanks for any thoughts.
    Cole

    1 is a problem.  Encore's preview capabilities have never been flawless.  Use rewritable disks to avoid coasters.
    2 is new, but I can't think of anythjing off hand to explain it.

Maybe you are looking for