Need help with nested loop (c:forEach) tags. Can I break from inner loop?

Hi all, I have this annoying problem and I am looking for any suggestions.
I have 2 select boxes. One is for all available users, and second - for selected users (designated as admins). The list of all users is available in a collection (2 properties userId and userName displayed in the code below). The list of admins contains only userId (as strings).
I have no problem with populating selected users (admins) list, reusing pretty much the same logic below, but I cannot find a way to break out from the nested loop once the match is found, to avoid repetitions leading to incorrect display of results.
<select name=available>
<c:forEach items="${users}" var="user" varStatus="outer">
    <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
        <c:if test="${user.userId!=adminId">
             <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
        </c:if>
    </c:forEach>
</c:forEach>
</select>
<select name=selected>
<c:forEach items="${users}" var="user" varStatus="outer">
    <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
        <c:if test="${user.userId==adminId">
             <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
        </c:if>
    </c:forEach>
</c:forEach>
</select>Can anyone help, please? I am also restricted to JSP 1.2

Double post: http://forum.java.sun.com/thread.jspa?threadID=707950&tstart=0

Similar Messages

  • I need help with my wifi text. I can't use them

    I need help with my iPhone 4. I can't text since. I get wifi in my house ?

    What is the make & model of the wireless router that you are trying to extend with the WN3000RP? Can any other wireless clients connect to the extended network, just not your iMac?

  • HT4528 I need help with my I phone and I can get verizon to let me on there to talk and I will have to have my phone so that I can do what you tell me to do

    I need help with my phone it is not ringing and I cant figure where in here to make it so it will something has been pushed so I cant hear any calls or texts

    Not when you insist on being so impatient.
    These are user to user support forums.  No one here is paid to read or respond to messages.
    Try explaining the issue instead of the jumbled, rambling mess of a title and we will be happy to assist.

  • URGENTLY NEED HELP WITH NESTED REPEAT REGION

    Im using dreamweaver to deevelop a page that displays questions in ann assessment to the user. First of all the page shows the assessment name to the user and then it gets some information about the questions in the assessment from the table called Item. It gets the Question_ID and then there is a repeat region which uses the Question_ID to display the questions in the assessment. There is a nested repeat region inside this which displays the possible answers the user can respond to the question with It gets this information from a table called outcome. The page should display each question and then all the possible answers but i am having problems and im not sure wether i am doing this in the correct way. What is wrong with my code? PLEASE HELP! can someone tell me what is going wrong and how i can fix this problem thamks.
    here is my code.
    Driver DriverassessmentRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
    Connection ConnassessmentRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
    PreparedStatement StatementassessmentRecordset = ConnassessmentRecordset.prepareStatement("SELECT Assessment_ID, Assessment_Name, Time_Limit, Display_Random, Record_Answers FROM Assessment.assessment WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
    ResultSet assessmentRecordset = StatementassessmentRecordset.executeQuery();
    boolean assessmentRecordset_isEmpty = !assessmentRecordset.next();
    boolean assessmentRecordset_hasData = !assessmentRecordset_isEmpty;
    Object assessmentRecordset_data;
    int assessmentRecordset_numRows = 0;
    %>
    <%
    Driver DriveritemRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
    Connection ConnitemRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
    PreparedStatement StatementitemRecordset = ConnitemRecordset.prepareStatement("SELECT Question_ID, Assessment_ID FROM Assessment.item WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
    ResultSet itemRecordset = StatementitemRecordset.executeQuery();
    boolean itemRecordset_isEmpty = !itemRecordset.next();
    boolean itemRecordset_hasData = !itemRecordset_isEmpty;
    Object itemRecordset_data;
    int itemRecordset_numRows = 0;
    %>
    <%
    Driver DriverquestionRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConnquestionRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
    //PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" + (((itemRecordset_data = itemRecordset.getObject("Question_ID"))==null || itemRecordset.wasNull())?"":itemRecordset_data) +"' ");
    //ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
    %>
    <%
    Driver DriveroutcomeRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConnoutcomeRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
    PreparedStatement StatementoutcomeRecordset = ConnoutcomeRecordset.prepareStatement("SELECT Outcome_Number, Outcome_Text, Score, Feedback FROM Answer.outcome WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+ "' ");
                     ResultSet outcomeRecordset = StatementoutcomeRecordset.executeQuery();
                     boolean outcomeRecordset_isEmpty = !outcomeRecordset.next();
                    boolean outcomeRecordset_hasData = !outcomeRecordset_isEmpty;Object outcomeRecordset_data;
                  int outcomeRecordset_numRows = 0;
    %>
    <%
    int Repeat1__numRows = -1;
    int Repeat1__index = 0;
    itemRecordset_numRows += Repeat1__numRows;
    %>
    <%
    int Repeat2__numRows = -1;
    int Repeat2__index = 0;
    assessmentRecordset_numRows += Repeat2__numRows;
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/assessment.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Assessment</title>
    <!-- InstanceEndEditable -->
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- InstanceBeginEditable name="head" -->
    <!-- InstanceEndEditable -->
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <table width="1000" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="190"><img src="../img/assessment_login.png" alt="" name="navigation" width="1000" height="190" border="0" id="navigation" /></td>
      </tr>
      <tr>
        <td height="19"><!--DWLayoutEmptyCell--> </td>
      </tr>
      <tr>
        <td height="19"><!-- InstanceBeginEditable name="main" -->
        <table>
          <tr>
            <td width="990">Assessment Name:<%=(((assessmentRecordset_data = assessmentRecordset.getObject("Assessment_Name"))==null || assessmentRecordset.wasNull())?"":assessmentRecordset_data)%> </td>
            </tr>
          <tr>
            <td><% int count = 1; %> </td>
          </tr>
          <tr>
            <td valign="top"><table>
                <% while ((itemRecordset_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <tr>
                  <td width="21"> 
                     </td>
                  <td width="86">Question:<%= count %></td>
                </tr>
                <tr>
                  <td></td>
                  <td>
                     <% 
                     PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+"' ");
                     ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
                  boolean questionRecordset_isEmpty = !questionRecordset.next();
                  boolean questionRecordset_hasData = !questionRecordset_isEmpty;
                  Object questionRecordset_data;
                  int questionRecordset_numRows = 0;
                     %> <%= questionRecordset.getObject("Question_Wording") %></td>
                </tr>
                <tr>
                  <td></td>
                  <td>
                     </td>
                </tr>
                <tr>
                  <td></td>
                  <td> 
                    <table>
                      <% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
                      <tr>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                      </tr>
                      <%
      Repeat2__index++;
      outcomeRecordset_hasData = outcomeRecordset.next();
    %>
                    </table>
                    <table>
                      <tr> </tr>
                      <tr> </tr>
                    </table></td>
                </tr>
                <%
      Repeat1__index++;
      itemRecordset_hasData = itemRecordset.next();
      count++;
    //questionRecordset.close();
    //StatementquestionRecordset.close();
    //ConnquestionRecordset.close();
    %>
    Here is the exception i am gettingorg.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 115 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:220: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 116 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:223: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 117 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:226: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 118 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:229: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:232: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses or overrides a deprecated API.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:deprecation for details.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses unchecked or unsafe operations.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:unchecked for details.
    5 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)     org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    Hi,
    Dont have much time to go through your code, but apparently i can see the error is becoz of the following reason.
    In the following code, you have used "outcomeRecordset_data ", but its not declared. You need to declare the variable first before you can use it.
    <% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
                      <tr>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                      </tr>
                      <%
      Repeat2__index++;
      outcomeRecordset_hasData = outcomeRecordset.next();
    %>Try declaring the "outcomeRecordset_data " on top as an object
    Hope it helps

  • I need help with a loop within an hour

    I need to make a loop that gives 100, 10, 1000, 100, 10000, 1000...
    I can use a for loop, if loop, while loop, and do while loop.
    Thanks

    warnerja wrote:
    sharkura wrote:
    warnerja wrote:
    sharkura wrote:
    Sorry warnerja. I know I should have done the same. I just couldn't help myself. I need to keep telling rubbish.
    :D
    ¦ {ÞIt's not too late to edit your spoon-fed solution, though the OP may have seen and copied it by now.And you know this isn't going to make the OP a programmer, unless he/she/it changes his/her/its stripes.
    ¦ {ÞYes, but its laziness will continue to be encouraged more than it should.Nah. It'll crash and burn on the next assignment.
    ¦ {Þ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Need help with while loop format

    I'm building a form - everything works but I would like to change the way the data is output into the table.
    In other scripting languages, like PHP, you had 2 different ways of dealing with a loop:
    <?
    do while xyz
    do something here
    ?>
    - OR -
    <? do while xyz:?>
    do something here
    <?end while ?>
    I would like to do something similar to the 2nd example in .jsp but I'm not sure of the format or how to stop the loop. From the tutorial, I'm using
    <%
    while(SQLResult.next())
    UId = SQLResult.getString("uid");
    FName = SQLResult.getString("fname");
    LName = SQLResult.getString("lname");
    out.println("<tr><td>" + UId + "</td><td>" + FName + "</td><td>" + LName
    + "</td></tr>");
    %>
    Could anyone point me in the right direction? I'd prefer it if I didn't have to build the table like this if I don't have to but haven't found anything anywhere telling me otherwise.
    Thanks so much.
    Bob

    Sorry - the answer was in JSP:Java Server Pages by Barry Burd. I had just gotten the output format wrong.

  • Need help with simple loops

    Hi I am having a very very difficult time. for thos that have it I'm using the Intro to Java Programming 6th Edition by Y.Daniel Liang Book. I am on page 124 Ch 4 Problem 4.18
    what it wants you to do is make and use nested loops that print
    Pattern 1
    1
    12
    123
    1234
    12345
    123456
    Pattern 2
    123456
    12345
    1234
    123
    12
    1
    Patern 3
    1
    21
    321
    4321
    54321
    654321 ( I know this is crooked but you get the idea )
    Pattern 4
    123456
    12345
    1234
    123
    12
    1 (once again crooked but you get the idea )
    Ok so here is my code thus for and it includes pattern 1 and pattern 2...Keep in mind I'm just simply printing them out one right after the other..it doesnt have to look all pretty or nothing like that ok...thanks
    public class Patterns
    // Print Pattern I */
    public static void main(String[] args)
    for (int i = 1; i <= 6; i++)
    for (int j = 1; j <= i; j++) ( NESTED FOR STATMENT)
              System.out.print(j + " ");
         System.out.println();
    // Print Patter II
         for ( int i = 6 ; i >=1; i--)
              for ( int j = 1; j <= i; j++) (NESTED FOR STATMENT )
                   System.out.print ( j + " ") ;
              System.out.println();
    If yall could somehow give me hints as to how to get number 3 and number 4 thanks
    -tim-

    package src;
    public class Escada {
        public Escada(){
            System.out.println("Pattern1");
            for (Integer i = 1; i <= 6; i++){
                for (Integer j = 1; j <= i; j++){
                    System.out.print(j);
                System.out.println("");
            System.out.println("--------\nPattern2");
            for (Integer i = 6; i >= 1; i--){
                for (Integer j = 1; j <= i; j++){
                    System.out.print(j);
                System.out.println("");
            System.out.println("--------\nPattern3");
            for (Integer i = 1; i <= 6; i++){
                for (Integer j = i; j >=1; j--){
                    System.out.print(j);
                System.out.println("");
            System.out.println("--------\nPattern4");
            for (Integer i = 6; i >= 1; i--){
                for(Integer j = 1; j <= i; j++){
                    System.out.print(j);
                System.out.println("");
        public static void main(String[] args) {
            new Escada();

  • Need help with selecting an LCD TV that can wirelessly connect to my laptop

    I specifically need to have the ability to view my laptop's display wirelessly on the tv.  My office is going to use it as a presentation display so when I'm in a power point presentation on my laptop it is actually displayed on the tv.  Please let me know what tv's allow this or if there is an accessory I can purchase to make the connection.  I'm hoping there is a blue tooth type option or a USB receiver that can be used.

    I have an LG 55" TV that allows me to stream from my router to the TV via cat5.  It isDLNA compatible, so it can receive signals from any compatible device.
    If you find my post useful or informative, please click the icon below with the plus sign and star to give kudos. Thank you!

  • Need help with final stage of getting my iPhone 4 unlocked from 3 mobile uk. Please help me leave three and be able to use my new iPhone 5

    I have requested to have my iphone 4 unlocked from three uk. When I receive instructions from them, do I need to connect to my own iTunes or can I connect to someone else's and/or does my contract with three still need to be active for me to unlock or can I cancel before I unlock, I have already paid the £15:32 by debit card. I am currently running iOS 5.1.1
    As more background, the reason I want to find out is because I'm away from home and because I expected my phone to be unlocked well before now (three are seriously useless) I requested my PAC code before Christmas and it expires on Sunday so I would love to transfer my number tomorrow before I have wait another 30 days to cancel my contract with three.
    I'm not sure if they will unlock my phone in time or if I will be able to do it whilst not having my Mac. Can I transfer my number and then unlock my phone afterwards? I will be reunited with my Mac on Monday.
    Thanks in advance  
    K
    iPhone 4, iOS 5.1.1

    Install iTunes on your Acer and you can back up the iPhone. Or back it up to iCloud. If you do not back it up you can get it unlocked, but you will lose all of your content.
    You can get iTunes from http://www.apple.com/itunes.
    Even after unlocking I'm not sure it will work on Straight Talk, because last time I checked ST used Verizon as its carrier, and an AT&T iPhone 4 is not compatible with Verizon's network. You can probably use it on Net 10 or T-Mobile once it is unlocked.

  • Need help with the loop

    I'm a beginner. I'm trying to get this output
    Initial number of stars:
    7
    Here's my program. What's wrong with it? Please help
    import java.io.*;
    class starWedge
    public static void main (String[] args ) throws IOException
    int numStars; // the number of stars
    int row ; // current row number
    int star; // the number of stars in this row so far
    BufferedReader userin = new BufferedReader (new InputStreamReader(System.in));
    String inputData;
    // collect input data from user
    System.out.println( "Initial number of stars:" );
    inputData = userin.readLine();
    numStars = Integer.parseInt( inputData );
    row = 1;
    while ( row <= numStars )
    star = 1;
    star = numStars - star;
    System.out.print("*");
    star = star + 1;
    System.out.println(); // end each line
    row = row + 1;

    Okay the one thing that I see immediately is that your while loop never actully exits. Not once. Why? Well simple your exit condition is the row <= numStars, yet nither numStars nor row actually change their values within the loop. In short row always equals 1 and thus never is equal to greater than numStars and the while loop does not terminate.
    Second thing is that your star drawing logic is not correct. Meaning you have not told to draw the specific number of stars in one given line. For starters the System.out.println() command should be in the loop not outside it. For your purposes a for-loop nested within a while-loop is much better.
    If you think you know what's wrong your program than read no further and go try it on your own. But if you still have no clue below is my modification of your code that actually produces the pattern you want, it might provide you with more hints.
    import java.io.*;
    class starWedge{
    public static void main (String[] args ) throws IOException{
         int numStars; // the number of stars
         int row ; // current row number
         int star; // the number of stars in this row so far
         BufferedReader userin = new BufferedReader (new InputStreamReader(System.in));
         String inputData;
         // collect input data from user
         System.out.println( "Initial number of stars:" );
         inputData = userin.readLine();
         numStars = Integer.parseInt( inputData );
         row = 1;
         while (numStars > 0){
         for(star = 1; star<=numStars; star++){
              System.out.print("*");
         numStars = numStars - 1;
         System.out.println(); // end each line
    }

  • Need help with while loop and shift registers

    I have a large data set and need to read in the data at maybe 200 samples at a time, process these samples through my VI, and have it append and concatenate a separate lvm file.  The part where I am confused is the shift registers. How do I limit the number of samples read in an iteration? How do I get the while loop to stop when all the data are read in?
    I've attached my diagram, maybe there is something wrong with my technique?
    Solved!
    Go to Solution.
    Attachments:
    shiftreg.JPG ‏56 KB

    This will give you an idea.  There are plenty of other (probably more efficient) methods.  This is a basic, quick and dirty solution to help you grasp the overall concept.
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    ShiftRegLoop.JPG ‏54 KB

  • Need help with infinite loop in recovery mode in Creative Zen 20

    hi,
    I'm having this problem with my Creative Zen 20 GB:
    When I turned it on, it goes immediately to the rescue/recovery mode. Not sure why. Will do that even when I reset the device.
    So, I selected cleanup. After cleanup, it remained showing the menu of the recovery mode. I selected reboot. After reboot, it went back to the rescue/recovery mode. And it goes on and on like an infinite loop.
    Finally, I decided to do a formatAll. Again, it remained in the recovery mode menu after the formatAll action. After reboot, it again went back to the rescue/recovery mode.
    I have never updated the firmware. So, I thought maybe that will help. However, when I connected the device to my PC, the device went to rescue/recovery mode and the PC could not detect the device connected via USB. In short, I am currently not able to do anything at all with the device except charging it.
    Would appreciate help/advise.
    Tks in advance.

    huggiebear wrote:
    I connected the device to the PC and after the PC tried to load the library, it said "Player is not connected".
    What library are you loading? After you have run that reload os option, you need to connect the player to the computer and run the firmware update software. If you haven't download that, you can go to the download section and download it. If all else fail, the player is probably faulty and you would need to get in contact with Customer Support then.
    Jason

  • Need help with while loops

    Hello let me first explain what im trying to achive:
    I want a moving square that you control with the arrow keys on the keyboard. It has to be smooth ie able to move fast without looking like its jumping and it has to be able to move diagonaly aswell. Think of that arcade game Raiden ...you know the birds-eye view plane flying game...another thing! I'd prefer if it didnt use timers - i made one already using 4 timers and it works great but 4 timers is a little extreme - SO NO TIMERS !
    I was thinking while loops, but i cant seem to get it working. I dont want to put in all the code so ill just say that I have 4 booleans: up, down, left right and the following code:
    public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_UP) {
    up = true;
    if (e.getKeyCode() == KeyEvent.VK_DOWN) {
    down = true;
    if (e.getKeyCode() == KeyEvent.VK_LEFT) {
    left = true;
    if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
    right = true;
    repaint();
    For the KeyReleased part i have the same as above exept it sets the booleans to false.
    Soooo in theory if i set up a while loop like this (using the up direction as an example) :
    while (up == true) {
    [move square up]
    So therefore when i press and hold the up arrow the loop will keep going untill i realease it right? WRONG ! it just keeps repeating indefinatly and it doesnt even do the " [move square up] " bit. I put a System.out.print in the loop to test and it kept printing out the message but it still didnt do the actual " [move square up] " bit.
    Im not sure if im putting the while loop in the right place either....If anyone has any idea on how to use while loops in this way please heeeelp ! Its so annoying because it just doesnt work ive tried so many ways...
    any help would be greatly apreciated !!!!

    Maybe you want something like this? You have to pause during the loop to allow for other events to happen, like if y ou release a key or whatever.
    while( true )
       if( up ) moveUp();
       else if( down ) moveDown();
       if( left ) moveLeft();
       else if( right ) moveRight();
       try
          Thread.currentThread().sleep(10);
       catch( InterruptedException e )
          System.out.println( "Thread interrupted!");
    }

  • Need help with nested table

    Hi,
    I am using the following code which is failing with no data found error.
    While if i hardcode the same value the code works.
    create table test(input varchar2(10),result varchar2(10));
    insert into test values('4093163','SUCCESS')
    declare
    TYPE acctid_tab IS table  OF varchar2(40);
        acctid       acctid_tab := acctid_tab ();
    V_RESULT varchar2(20);
    v_input varchar2(40);
    i pls_integer;
    begin
    acctid := acctid_tab('4080402 4093163 64472');
    i := acctid.FIRST;
    WHILE i IS NOT NULL
    LOOP
    v_input :=   trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
    SElect result into v_result from test
    where input = v_input;
          i := acctid.NEXT (i);
       END LOOP;
    END;
    ORA-01403: no data found
    ORA-06512: at line 14
    declare
    TYPE acctid_tab IS table  OF  varchar2(40);
        acctid       acctid_tab := acctid_tab ();
    V_RESULT varchar2(20);
    v_input varchar2(40);
    i pls_integer;
    begin
    acctid := acctid_tab('4080402 4093163 64472');
    i := acctid.FIRST;
    WHILE i IS NOT NULL
    LOOP
    v_input :=   trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
    SElect result into v_result from test
    where input = '4093163';
          i := acctid.NEXT (i);
       END LOOP;
    END;
    PL/SQL procedure successfully completed.Please advise.
    Thanks in advance.

    I guess you can just do
    declare
       v_input varchar2(1000);
    begin
       v_input := '4080402 4093163 64472';
       for i in (select input, result
                   from test
                  where input in (select regexp_substr(v_input, '[^ ]*', 1, level)
                                    from dual
                                  connect by level <= length(v_input) - length(replace(v_input, ' ')) + 1))
       loop
          dbms_output.put_line(i.input || ' ' || i.result);
       end loop;
    end;
    /Or even better
    declare
       v_input varchar2(1000);
    begin
       v_input := '4080402 4093163 64472';
       for i in (select input, result
                   from test
                  where ' ' || v_input || ' ' like '% ' || input || ' %')
       loop
          dbms_output.put_line(i.input || ' ' || i.result);
       end loop;
    end;

  • Need help with while loop

    Hi,
    I'm running a while loop to run through some results of a search. Anyway I know how to list the strings but my last item is a JComboBox (drop down box.) How do I go about changing that so its right for a drop down box. Its the one with questions marks in the code below.
            while (srs.next())
            //Get the values for each field in this row
            String projectName = srs.getString("PROJECT_NAME");
            System.out.println("Project Name = " + projectName );
            String projectOfficier = srs.getString("PROJECT_OFFICER");
            System.out.println("Project Officer = " + projectOfficier );
            String projectDescription = srs.getString("PROJECT_OFFICER");
            System.out.println("Project Description = " + projectDescription );
            String paymentSchedule = srs.getString("PAYMENT_SCHEDULE");
            System.out.println("Payment Schedule = " + paymentSchedule );
            String banksInvestment = srs.getString("BANKS_INVESTMENT");
            System.out.println("Banks Investment = " + banksInvestment );
        ?   String paymentsMade = srs.getString("PAYMENTS_MADE");
        ?   System.out.println("Payments Made = " + paymentsMade );Thanks.

    Yeah the Payments Made part is a JComboBox with 3 so called strings inside it. I wanna know instead of srs.getString what should I put in to replace String to get the results from a JComboBox?

Maybe you are looking for

  • Deskjet 3050 changed pswd

    I've changed my network password on my computer and trying to change it on the printer so I can reconnect wirelessly, I don't see an option anywhere to change the password.  Any suggestions without having to reinstall the printer?

  • Closing browser window from an Applet?

    I've written a series of applets that perform different functions. I placed a button on each applet with the purpose to close the window in which that applet is running. However I don't even know where to start looking to find out how to make my appl

  • Best practice for mouseless ADF applications

    I am developing an ADF application where the users do not want to use the mouse. So I would like to know if there are a best practice for this? I am already using the accessKey functionality and subforms defaultCommand But I have had problems setting

  • Excessive heat on 1.67Ghz G4 Powerbook

    I have always noticed the bottom of the Powerbook to be extremely hot, particularly when plugged in to the AC adapter.  I've been told by various Apple technicians that this is a characteristic of the higher processor speed of the Powerbook G4.  Has

  • Migration problem from Struts 1.2.7 to 1.3.8:java.lang.ClassNotFoundExcepti

    Hi, my current configuration is tomcat 6.0.18 and jdk 1.5. Here are the steps I followed for the migration. 1. Replaced struts.jar with struts-core-1.3.8.jar 2. Updated taglib .tld files which were under /WEB-INF and also kept the corresponding strut