Simple JSP question (newbie)

Hi all,
firstly I hope this is the right place to post this question, if not, please accept my apologies,
I am putting together my first set of JSP pages with Tomcat, and so far everything is going very well, but I am having one small problem.
I have 1 JSP page at the moment, and that in turn uses 1 JavaBean thing bit of code to do something.
The problem I am having is passing an integer variable from my JSP page to my JavaBean page, I can't seem to find the right syntax for it. The following code (from the JSP page) will make this ten times clearer...
<%! int score; %>
<%! String scoreAsString; %>
<%
scoreAsString = request.getParameter("score");
score = Integer.valueOf(scoreAsString).intValue();
out.println("Your score of " +score +"was received, thanks very much!");
%>
<jsp:useBean id="converter" class="scoreApp.SaveScoreBean"/>
<jsp:setProperty name="converter" property="scoreToSave" value="${score}" /> As you might see, the problem comes in that last line of code - I want to pass the "score" integer I've received off to the bean, but I don't know the syntax for this. I've tried "value=score", "value="score"", "value="$score"", "value="${score}"" etc. but to no avail.
You can see this is a super-simple problem :)
... but my if it isn't becoming frustrating :)
Any help at all will be most welcome, and gratefully received.
Many thanks,
Peter

technologyMan wrote:
I am learning jsp now. You´re actually at the JSF forum here.
Now, i am a textfield control on jsp as textField1. You are? Really?
I have created this control from Palette. in java code i am writing "textbox1." but there is no action, no intellisense while pressing ctrl + space.
How the control is accessing from java code? Maybe my logic with visual studio .net. but i want to learn jsp logic.Uh, just write code accordingly? You can use h:commandButton/h:commandLink for that.
Anyway, if you want to start with JSF, I can recommend you the following sources:
Java EE tutorial part II, JSF starts at chapter 10: [http://java.sun.com/javaee/5/docs/tutorial/doc/]
Good kickoff tutorial: [http://balusc.blogspot.com/2008/01/jsf-tutorial-with-eclipse-and-tomcat.html]
The JSF taglib documentation: [http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/]
The JSF API documentation: [http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/overview-summary.html]

Similar Messages

  • Simple JSP question

    Help!
    I have a jsp file which retrieves some form input and processes that.
    This is my code:
    String area = request.getParameter("areaname");
    if(area == "Statewide")
    sqlst = "SELECT distinct primarysic, sictitle from utempdb, siccode " +
    " where siccode.siccode = utempdb.primarysic " +
                        " and siccode.sicdiv= '" + indDiv + "'";
    else
    sqlst = "select distinct primarysic, sictitle from utempdb, siccode " +
    " where siccode.siccode=utempdb.primarysic " +
                        " and siccode.sicdiv= '" + indDiv + "'" + " and utempdb.county= '" + area + "'";
    Even if the area is not equal to "Statewide" it processes the second statement and it completely ignores the first statement.
    What is wrong with my code?
    Thanks for any help
    Sue     

    "==" compares references, not contents and so will always be false.
    Try
    if ( "Statewide".equals(area))

  • Probably a simple networking question (newbie here)

    Hi everyone,
    When I installed Solaris 10 inside of a VMWare Workstation vm, I got to the portion of the network configuration where it asked about LDAP or DNS or NFS, and I chose "None" because my setup is not a member of a domain. Now, when I go online, I have no Internet connection.
    I have the interface listed in ifconfig -a and it has an IP address of 192.168.0.4 issued by DHCP. Everything is right, except there is no Default Gateway listed, nor does it have my DNS servers listed.
    How would I go about setting these in Solaris? I'm not entirely familiar with vi or edit, so a step-by-step will be nice.
    I should note, that I'm able to access my Windows Workgroup computer (the physical host) and copy files from it. I just don't have any Internet access. Also, the IP for my physical computer (the Windows share) is my DNS IP, although that shouldn't matter.
    Thank you for any help you can provide.
    Patrick.

    First of all, in /etc/hosts file ;
    the first line indicates loopback address(IP) & the second line indicates the IP of the your machine followed by the hostname ( which is "unknown in your case as you have not assigned any hostname). The commented line in second line tells that , the IP is assigned by a dhcp-server.
    you can assign router IP in a file called "/etc/defaultrouter".you only have to give the IP address of the router in this file.To make this as default router address for you system , you have reboot the system.
    You can change your hostname from "unknown" by issuing this command :
    #setuname -n XYZ
    (where XYZ is the new hostname)
    you can also check the changed hostname by doing this ;
    #uname -n

  • A simple jsp question

    while (c.hasNext()){
    Test t=(Test)c.next();
    out.write("<li>");
    String name=t.getName();
    %>
    <html:radio property='test' value=" <% out.write(name); %>" />
    <%
    out.write(t.getName()+"</li>");
    the value of test becomes: <% out.write(name); %>
    instead of the real name.
    Can someone help me with this?

    The only safe substitution for extension tag attributes is a <%= %> element, without any extra text outside the brackets.
    And this only works if the tag descriptor allows "run time substitution" for the attribute.
    try
    <html:radio property="test" value="<%= name %>"/>

  • Simple jsp deployment - does it need weblogic.xml ?

              Hi,
              I am a newbie and trying out a very simple jsp application which connects to Oracle
              for a simple db lookup. This app used to work with Tomcat/ Apache.
              I am trying to deploy it on WLS7.0 . It does not use servlets - only JSPs.
              Could someone tell me what is the minimum level of configuration I need to deploy
              these JSPs to WLS7.0 ?
              Do I need both web.xml and weblogic.xml ?
              Do I need all the parameters in both these files ?
              Thanks a lot !
              

    WLS7.0 Does use servlet you have to register the servlet inside the
              web.xml file for a web application. It looks like this:
              <servlet>
                   <servlet-name>testservlet</servlet-name>
                   <servlet-class>
                        com.mypackage.MyTestServlet
                   </servlet-class>
              <init-param>
              <param-name>EnvironmentFile</param-name>
              <param-value>/WEB-INF/config/webstore.properties</param-value>
              </init-param>
              </servlet>
              <servlet-mapping>
              <servlet-name>testservlet</servlet-name>
              <url-pattern>/mytestservlet</url-pattern> <!-- this is the
              name on the url-->
              </servlet-mapping>
              Abraham wrote:
              > Hi,
              >
              > I am a newbie and trying out a very simple jsp application which connects to Oracle
              > for a simple db lookup. This app used to work with Tomcat/ Apache.
              >
              > I am trying to deploy it on WLS7.0 . It does not use servlets - only JSPs.
              >
              > Could someone tell me what is the minimum level of configuration I need to deploy
              > these JSPs to WLS7.0 ?
              > Do I need both web.xml and weblogic.xml ?
              >
              > Do I need all the parameters in both these files ?
              >
              > Thanks a lot !
              

  • Simple JSP application on Ora9ias rel2

    Hi!
    I have installed Oracle9ias rel2 on Windows2000, and I want to run simple .jsp application. My first idea was to copy .jsp file into <ias home>/Apache/Apache/htdocs/test/test.jsp , and run it with http://<ias url>/test/test.jsp. But this was bad idea, since file is shown as .html file, and .jsp is not run on server. This aproach was working in previous release of Oracle9IAS.
    So, my question is : How to run simple .jsp application (not J2EE) on Oracle9IAS rel2? Do i have to manualy change .conf files of apache? Which files? (I know how to do this by hand, but I would like to know Oracle recomended procedure)
    BTW. new IAS is killing my server (PIII 800 MHz, 512 MB RAM) and this is Application server only (Infrastructure is on other machine). Don't try it on anything less then 1Gb of RAM.

    By default, JServ is disabled in Oracle9iAS Release 2. For more information you should check on the J2EE forum.
    Ashesh Parekh
    Oracle9iAS Product Management

  • Problems with compilation of a Simple JSP

    Hello!
    This is a typical newbie problem with starting off on JDeveloper 3.0 (JDK 1.1.8) and Oracle 8i (8.1.1). When I create a simple JSP (The "Hello World" Jsp given in the File | New | Web Objects option) and try to run it - it gives me the following error :
    java.io.IOException CreateProcess : cmd.exe /C start "" "C:\PROGRAM FILES\ORACLE\JDEVELOPER 3.0\myprojects\WebAppRunner.html" error = 0
    Obviously the JSP does not run.
    Any pointers about what might be wrong?
    Regards
    Mona

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mona Marathe ([email protected]):
    Hello!
    This is a typical newbie problem with starting off on JDeveloper 3.0 (JDK 1.1.8) and Oracle 8i (8.1.1). When I create a simple JSP (The "Hello World" Jsp given in the File | New | Web Objects option) and try to run it - it gives me the following error :
    java.io.IOException CreateProcess : cmd.exe /C start "" "C:\PROGRAM FILES\ORACLE\JDEVELOPER 3.0\myprojects\WebAppRunner.html" error = 0
    Obviously the JSP does not run.
    Any pointers about what might be wrong?
    Regards
    Mona<HR></BLOCKQUOTE>
    The above error message is likely due
    to JDeveloper looking for the NT command
    interpreter named CMD.EXE .
    I was able to run servlets with JDeveloper
    and Windows 98 by copying COMMAND.COM to
    C:\CMD.EXE, which was much easier to do
    than putting a new OS on my machine.
    Cheers,
    David

  • How do you invoke a simple jsp

    hi,
    i have a very simple jsp that displays the current time. it works on my tomcat server (installed on my computer). i purchased a domain from yahoo, say, www.beginer.com and uploaded the jsp file to the yahoo server. but when i referenced it with the url www.beginer.com/MyJSP.jsp, a download dialog popped up.
    so, how do you get the browser to display the dynamic contents of the jsp file?
    thanks.

    Did you ask Yahoo whether their server supports servlets and JSPs? Or did you just assume that? I would expect that it doesn't.

  • Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Simple/silly question: how do I set/change default font/color for outgoing mail messages?

    Just a suggestion..........
    Download Thunderbird.  Easier to use when it comes to what you want to do w/your emails. 

  • Simple jsp to show if session state is being correctly replicated ?

              Hello,
              I am making a simple jsp to show if session state is being correctly replicated.
              I just remembered seeing one somewhere before.
              It showed the server-name, and the number of request so far in the session. And
              maybe a nice bea logo.
              Does anyone know where such a thing might be available ?
              thanks!
              JM
              

              Hi ,
              checkout bea samples there is such jsp in cluster/sessionrep or something like
              this /bea_home/samples/sever...
              "Marmelstein" <[email protected]> wrote:
              >
              >Hello,
              >I am making a simple jsp to show if session state is being correctly
              >replicated.
              >I just remembered seeing one somewhere before.
              >It showed the server-name, and the number of request so far in the session.
              >And
              >maybe a nice bea logo.
              >Does anyone know where such a thing might be available ?
              >thanks!
              >JM
              

  • How do I expand my simple JSP page to implement Connection Pooling?

    Hi everyone,
    I have a small SQL database which contains information about Students and a StudenBean which contains their attributes and appropriate get/set methods (which I haven't needed to use yet).
    I want to write a simple JSP page which displays all the students details in one big table. I can do this using the basic prototyping method of adding the dataSource and driver details to the deployment descriptor (web.xml - I'm using the latest version of Tomcat by the way) and then accessing the database using JSP standard SQL actions.
    Here's a snipet of what I've done (just an example, the final code works):
    <sql:query var="temp"
    sql="SELECT * FROM Employee ORDER BY UserName"
    />
    <c:forEach items="${temp.rows}" var="row">
    <td><c:out value ="${row.UserName}"/></td>
    <td><c:out value ="${row.FirstName}"/></td>
    <td><c:out value ="${row.LastName}"/></td>
    Now I want to upgrade! I want to access the dataSource using Connection Pooling and it's causing me a lot of trouble. I already have the required working classes/data such as ConnectionPool.java, ResourceManagerListener.java, the MySQL driver etc.
    However, I don't know what the best way to setup the connection for my purposes would be and where I should do it.
    Do I need to write a servlet or tag handler/custom action to establish the connection and access my bean through it? I would like to keep a similar sort of business logic as I already have developed i.e. be able to use actions in my JSP page to cycle through the database and print out each detail from the row.
    Rather confused and muddled. Thanks for any input!

    Good idea.
    Set up a JNDI data source for your app, according to these docs:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    You'll have to put the right information into your web.xml and a context.xml. Once you've done that, your JSTL JSPs will simply use the connection resource automagically.
    MOD

  • 4 Simple Flash Questions that Are Stumping Me!

    What is the Frame Rate for Web Animations
    Q1. I am making an animation which will be played on the web. What is the default frame rate (fps) of Flash CS5? And what is the frame rate of for web?
    Q2. My animation needs to be 30 seconds long. So at 15 fps that would mean I need to use 600 frames in Flash?
    How Do I Mask everything so all I see is the Content on the Stage?
    I have a wide image that extends past my movies stage size so when I preview my movie the image is visible. How do I mask out anything that extends past my movies window size? I believe I can create a layer named "mask" and place it above all other layers, but I forget how to make the mask. Any help is appreciated.
    How to Fade a Graphic
    I have a graphic element (some type) and I want it to fade from 0% to 100%. In older versions of Flash I could just select the symbol and then set it's alpha value to 0%, move a few keyframes and then set the alpha to 100%. Voila! but now it doesn't seem to work that way. How can I do this in CS5?

    Ned, it says 24 fps which means there is 24 frames per second so each 24 frames is 1 second.
    Date: Fri, 4 Nov 2011 05:35:16 -0600
    From: [email protected]
    To: [email protected]
    Subject: 4 Simple Flash Questions that Are Stumping Me!
        Re: 4 Simple Flash Questions that Are Stumping Me!
        created by Ned Murphy in Flash Pro - General - View the full discussion
    1 You can create your character as a movieclip and copy/paste that movieclip from one file to another. 2. One way to create a movieclip is to copy all the frame of the animation's timeline (select them all, right click the selection, choose Copy Frames), then create a new movieclip symbol (Insert -> New Symbol...etc) right click on its only keyframe and chhose Paste Frames.  THat will put all the layers and frames you copied into the movieclip The only way to come close to being certain about the timing of you animation is to use code to keep track of the time, something like getTimer()..  The frame rate that a file plays at is not a reliable means of dictating the time it takes due to a variety of factors which include the amount of content you are trying to process and performance limits of the user's machine.
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4007420#4007420
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4007420#4007420. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Flash Pro - General by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • My simple jsp doesn't work: hhhelp

    hello i'm new to java.
    I'm testing a simple jsp with a javabean: Fruit.class
    When i test it , it seems there is a problem of package (but i really need help on this)...
    Here's the error i get:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:44: cannot resolve symbol
    symbol : class Fruit
    location: class org.apache.jsp.confirm_jsp
    Fruit commandeFruit = null;
    ^
    here's the full error report
    Etat HTTP 500 -
    type Rapport d'exception
    message
    description Le serveur a rencontr� une erreur interne () qui l'a emp�ch� de satisfaire la requ�te.
    exception
    org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP
    Une erreur s'est produite � la ligne: 2 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
        [javac] Compiling 1 source file
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:44: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
          Fruit commandeFruit = null;
          ^
    Une erreur s'est produite � la ligne: 2 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:46: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
            commandeFruit = (Fruit) _jspx_page_context.getAttribute("commandeFruit", PageContext.PAGE_SCOPE);
                             ^
    Une erreur s'est produite � la ligne: 2 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:48: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
              commandeFruit = new Fruit();
                                  ^
    Une erreur s'est produite � la ligne: 16 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:71: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
          out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Fruit)_jspx_page_context.findAttribute("commandeFruit")).getNomFruit())));
                                                                            ^
    Une erreur s'est produite � la ligne: 17 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:74: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
          out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Fruit)_jspx_page_context.findAttribute("commandeFruit")).getCouleur())));
                                                                            ^
    Une erreur s'est produite � la ligne: 18 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:77: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
          out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Fruit)_jspx_page_context.findAttribute("commandeFruit")).getPrix())));
                                                                            ^
    Une erreur s'est produite � la ligne: 19 dans le fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\apache\jsp\confirm_jsp.java:80: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
          out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Fruit)_jspx_page_context.findAttribute("commandeFruit")).getPoids())));
                                                                            ^
    7 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    note La trace compl�te de la cause m�re de cette erreur est disponible dans les fichiers journaux de Tomcat.
    --------------------------------------------------------------------------------

    hello i tried what you told me but it steel seems i've
    got 2 errors
    here's the error
    exception
    org.apache.jasper.JasperException: Impossible de
    compiler la classe pour la JSP
    Une erreur s'est produite � la ligne: 5 dans le
    fichier jsp: /confirm.jsp
    Erreur de servlet g�n�r�e:
    [javac] Compiling 1 source file
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\
    pache\jsp\confirm_jsp.java:6: <identifier> expected
    import full.package.name.Fruit;
    ^
    C:\jakarta-tomcat-5.0.19\work\Catalina\localhost\_\org\
    pache\jsp\confirm_jsp.java:47: cannot resolve symbol
    symbol  : class Fruit 
    location: class org.apache.jsp.confirm_jsp
    Fruit commandeFruit = null;
    ^--------------------------------------
    here's my jsp:
    <%-- confirm.jsp --%>
    <%@ page import="full.package.name.Fruit" %>
    <jsp:useBean id="commandeFruit" class="Fruit" />
    <jsp:setProperty name="commandeFruit"
    property="nomFruit" value="Mangue" />
    <jsp:setProperty name="commandeFruit"
    property="couleur" value="Orange" />
    <jsp:setProperty name="commandeFruit" property="prix"
    value="5.95" />
    <jsp:setProperty name="commandeFruit" property="poids"
    param="saisie_poids" />
    <HTML>
    <body>
    <h1>Votre commande de fruit (confirm.jsp)</h1>
    <br>
    Fruit : <jsp:getProperty name="commandeFruit"
    property="nomFruit"/><br>
    Couleur : <jsp:getProperty name="commandeFruit"
    property="couleur" /><br>
    Prix au kg : <jsp:getProperty name="commandeFruit"
    property="prix" /> Euros<br>
    Quantit� : <jsp:getProperty name="commandeFruit"
    property="poids" /><br>
    Total
    :�<%=commandeFruit.getPrix()*commandeFruit.getPoid
    () %> Euros<p></p>
    Revenir � la commande pour
    la modifier
    </body>
    </html>
    First error is becoz you are using word package which is a standard identifier. So you have to change ur folder name to smething else other than package.
    Second error is becoz of the first error. If the forst error is fixed second error will not occur.
    Thanks
    KM

  • Help regarding a simple JSP file and servlet file

    Hi all,
    I am trying to develop a web based application using Tomca 5.0.16.I wanted to get to know how a simple jsp page could access a servlet.It would be really very beneficial if if any one can give me a sample code that does the interactions,I could run it and understand it,would help me for further development.
    Any help would be appreciated
    Thanks
    AS

    I think it depends on how you want to access the servlet.
    You can forward or redirect from the JSP page to the servlet, thus making it like you went to the servlet directly from the browser (except of course, before the forward or redirect, some stuff can be done).
    You can use URLConnection objects to call the servlet, much like the browser does.
    It depends on what you are trying to do.

  • Simple performance question

    Simple performance question. the simplest way possible, assume
    I have a int[][][][][] matrix, and a boolean add. The array is several dimensions long.
    When add is true, I must add a constant value to each element in the array.
    When add is false, I must subtract a constant value to each element in the array.
    Assume this is very hot code, i.e. it is called very often. How expensive is the condition checking? I present the two scenarios.
    private void process(){
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             if (add)
             matrix[i][ii][iii][...]  += constant;
             else
             matrix[i][ii][iii][...]  -= constant;
    private void process(){
      if (add)
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             matrix[i][ii][iii][...]  += constant;
    else
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
           matrix[i][ii][iii][...]  -= constant;
    }Is the second scenario worth a significant performance boost? Without understanding how the compilers generates executable code, it seems that in the first case, n^d conditions are checked, whereas in the second, only 1. It is however, less elegant, but I am willing to do it for a significant improvement.

    erjoalgo wrote:
    I guess my real question is, will the compiler optimize the condition check out when it realizes the boolean value will not change through these iterations, and if it does not, is it worth doing that micro optimization?Almost certainly not; the main reason being that
    matrix[i][ii][iii][...]  +/-= constantis liable to take many times longer than the condition check, and you can't avoid it. That said, Mel's suggestion is probably the best.
    but I will follow amickr advice and not worry about it.Good idea. Saves you getting flamed with all the quotes about premature optimization.
    Winston

Maybe you are looking for

  • Screen flickering when window is open on Cinnamon

    Hi, I have a fresh Arch install with Cinnamon DE(version 2.4.0). When I loggs in(always) or open some window(often) my screen flicker(what is shown in this video: http://www.dailymotion.com/video/x29jkt … 60313_tech ). I'm using open source xf86-vide

  • Error while showing data in sub tab region

    Hi, I have created a custom OAF page with three Tabs Device Details User Privileges Chart Templates Under "User Privileges" There is a summary page which shows all User details records. When user click on "Update" icon control is delegated to "Update

  • Not working sensor

    perfomance is very slow and sensor not working properly

  • Replacing special characters while importing account master data (BPC75NW)

    Hi All, I am importing GL Account members with hierarchy. I was able to pull all the members, but the nodes has '/', and am unable to replace them with '_'. I am using the below formula in my conversion file. I am able to replace the spaces but not t

  • Merge multiple tables into one for export to excel

    I've got a few tables in Numbers, and I've spent ages making them all look the same, then when I exported to an excel file, they split up into seperate tables. How can i merge all these into one table so they can all be viewed in Excel, without losin