Method calls in switch and for statements

I have 2 questions concerning method calls in switch and for statements. Consider these two chunks of code:
1)
     switch (foo.getIntegerValue()){
          case 1:
          case 2:
     }My question is, is getIntegerValue() being called for every case statement (since it has to compare with each case) or is the method called only once?
2)
for (Foo bla : xyz.compileFoos()) {
}Is compileFoos called once or on every iteration?
I assume it gets called only once but I would like to be sure. The reason I ask is of course to avoid multiple method calls.
any help is appreciated

sdb2 wrote:
I have 2 questions concerning method calls in switch and for statements. Consider these two chunks of code:
1)
     switch (foo.getIntegerValue()){
          case 1:
          case 2:
     }My question is, is getIntegerValue() being called for every case statement (since it has to compare with each case) or is the method called only once?
     Once, and the value returned compared to each "case" in turn.
2)
for (Foo bla : xyz.compileFoos()) {
}Is compileFoos called once or on every iteration?
I assume it gets called only once but I would like to be sure. The reason I ask is of course to avoid multiple method calls.
any help is appreciatedAlso once, and the returned list/set/array is iterated over.

Similar Messages

  • SWITCH and CASE STATEMENT

    i am trying to use switch statement for drawing different shapes by clicking shapes buttons (eg line ,rectangle oval etc) . i have got a method called setDrawMode and i am passing shape value as parameter to this method but nothing happen .all it is doing is drawing with default value.
    my code for clicking button:
    String s = event.getActionCommand();
    if (s.equalsIgnoreCase("LINE"))
    {   mycanvas.setDrawMode(0);}
    else if (s.equalsIgnoreCase("RECTANGLE"))
    {  mycanvas.setDrawMode(1);}
    else if (s.equalsIgnoreCase("OVAL"))
    {  mycanvas.setDrawMode(2);}my setDrawMode method:
    public void setDrawMode(int mode)
    switch (mode)
    case LINE :
    case RECTANGLE:
    case OVAL:
    this.mode = mode;
    break; default:
    throw new IllegalArgumentException();
    }my code for paint method:
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    if (numPoints>0)
    for (int i=0; i<numPoints-1; i+=2)
    switch (mode)
    case LINE:
    g.drawLine(p.x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawLine(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    case RECTANGLE:
    g.drawRect(p[i].x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawRect(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    case OVAL:g.drawOval(p[i].x,p[i].y,p[i+1].x,p[i+1].y);
    g.drawOval(p[numPoints-1].x,p[numPoints-1].y,cx,cy);
    break;
    values for shapes
    int LINE = 0
    int RECTANGLE = 1
    int OVAL = 2
    please help
    khurram

    what is the point of this switch here?
    public void setDrawMode(int mode)
         switch (mode)
             case LINE :
             case RECTANGLE:
             case OVAL:
             this.mode = mode;
             break;
             default: throw new IllegalArgumentException();
    } This dosn't do anything but asign mode to the global mode, which is why you get the same value every time. You need to do something in the switch and you don't have a break between them so they would all execute anyway. You can try this.
    public void setDrawMode(int mode)
         switch (mode)
             case LINE : this.mode = 0;
             break;               
             case RECTANGLE: this.mode = 1;
             break;
             case OVAL: this.mode = 2;
             break;
             default: throw new IllegalArgumentException();
    }But if your just trying to set a global mode you could just ommit the switch because its redundant
    public void setDrawMode(int mode)
           this.mode = mode;
           // then you could call paint however you call it
           paintComponent(this.getGraphics);
    }

  • How do I use switch and case statements to fill more than one other field?

    Hi all,
    I'm new to the community.
    I'm trying to make an existing form more user friendly for my coworkers. I want to use a switch and case approach in a drop-down list field so that the selection fills two seperate other fields with different info related to the selection.
    I can already do this with one field, but if I add a second target field under an existing case the text doesn't appear there when I make the selection from the dropdown.
    Basically, I'm asking if I can do this:
    switch 
    (sNewSel){
       case "1": // Selection 1    Row2.Field1
    = "text for field 1";
        Row1.Field2 = "text for field 2"; 
        break;
    etc.
    It works if the "row1.field2" option isn't there, but not when it is present.
    Any takers?

    I'm not sure if I will be able to send you the form. There may be too much to redact.
    Would this last bit of code in the cell affect anything?
    if 
    (bEnableTextField)
    {Row2.Field1.access
    = "open"; // enable field
    Row2.Field1.caption.font.fill.color.value= "0,0,0"; // set caption to black
    That is, do I also need to repeat the same thing for the second target cell (Row1.Field2)?
    What would be possible hang ups that would prevent it from working correctly?
    Dave
    By the way, I'm not sure if my other attachment posted. I am trying again.

  • Help with calling stored procedure and preparing statement

    hi guys help please..I want to call a procedure set the ResultSet to TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATABLE in order for me to scroll thru the resultset from 1st row to end row and vice-versa..but currently, my code has an error becuase im hot sure on how to do this..Can you please help me guys to solve this? Thanks in advance!
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();
                con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}");
                *cStmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);*
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
    ERROR:
    Incompatible Types
    Found : java.sql.Statement
    Required: java.sql.CallableStatement

    Nevermind guys..i got it..
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();           
                cStmt = con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
                }     Edited by: daimous on Jan 31, 2008 6:04 PM

  • Reliability of the exported method calls in AM

    I am wondering if the exported methods in app module are reliable. That is, when the method calls to the exported methods in AM fails for any reason, it will keep retrying until the method call succeeds. Also the marshalled method invocation packet is guaranteed to be received by the callee.

    sdb2 wrote:
    I have 2 questions concerning method calls in switch and for statements. Consider these two chunks of code:
    1)
         switch (foo.getIntegerValue()){
              case 1:
              case 2:
         }My question is, is getIntegerValue() being called for every case statement (since it has to compare with each case) or is the method called only once?
         Once, and the value returned compared to each "case" in turn.
    2)
    for (Foo bla : xyz.compileFoos()) {
    }Is compileFoos called once or on every iteration?
    I assume it gets called only once but I would like to be sure. The reason I ask is of course to avoid multiple method calls.
    any help is appreciatedAlso once, and the returned list/set/array is iterated over.

  • Conflict using simultaneously IVI Switch and Switch Executive ?

    Hi,
    I use IVI Switch and Switch Executive libraries in an Labwindows CVI project, and I meet some problems :
    I call SE lib for InitSession/CloseSession/FindRoute and Connect/Disconnect (apply to any switch devices in the SE configuration).
    I call IVI Switch lib for SelfTest and Reset (apply to a single device).
    But when I do an IVI Switch Reset then a Switch Executive Connect or Disconnect, an error occurs : Switch Executive seems to ignore what IVI Switch operations do to the device ?
    Also, can you tell me if :
    niSE_OpenSession performs a self test for the devices in the config ? A reset ?
    niSE_CloseSession performs a reset for the devices in the config ?
    Thanks.

    Hello,
    the niSE session talks to underlying IVI drivers using the IVI Switch session underneath, so any additional opening of IVI Switch session to the same device will cause the two driver sessions (that keep the information about the state of the hardware connections) to be either one or both out of synch with the actual hardware state). Because of the architecture of the underlying IVI drivers, niSE session cannot know if and what someone did to the instrument using IVI Switch session.
    Therefore, it is not adviseable to use IVI Switch session while having another session open to the same device. If you need to use the invasive operations - which is anything that changes the state of the device, such as Reset and possibly self-test (self-test may be implemented as an operation that cycles relays and it may not but you can't be sure), you must make sure that one session is open and closed before another type of session is open.
    The ni Switch Executive Open Session calls IviSwtch_init (with ID Query and Reset set to true) and CloseSession closes the IVI Switch sessions with the call to Close. The niSE session does not make calls to either reset or self-test explicitly.
    Always attempt to perform all the operations on the same piece of hardware using the same API. If you need to reset switches, use the niSE_DisconnectAll function. If you need to perform the self-test operation, open a session to IVI Switch and perform the self-test, and then close it before opening the session to niSE virtual device.
    There is also a back-door possibility that you can obtain the IVI Switch session that has been open for the constituent devices by niSE, but you must make sure that whatever you do with that session leaves the state of the switch intact when you get back to making calls to the niSE session. If unsure, you can always call niSE_DisconnectAll() as the first thing coming back to the niSE session to ensure that the state stored in niSE session matches the state on the actual hardware.
    Again, it is best not to use both sessions, but rather pick one and try to perform all operations with it before switching to another type of session.
    Srdan Zirojevic

  • Sequence of Methods Calls

    Hi
    I still need more clarity on sequence of method calls. I have 2 views within an Application which uses a component controller. I have mapped the I/O plugs to navigate from View 1 to View 2. User clicks on a button on view 1 and navigates to View 2. User again clicks on a button in  view  2 to navigate to View 1.
    Now I need to know thge sequence of method calls starting from init() for component controller, init() of view 1 , user clicking a button, firing of plug methods, calling of init() methods of views, doModify() and so on.. I hope I made myself clear.
    Regards,
    Murali.

    Hi Murli
          When you first call the view 2 by clicking on a button  the init method will be called and then modifyView will be called and then you navigate to view 1 again and if again you click to navigate to view 2 at that time only modifyView will be called.
          In the particular session with a client init method is called only once in that particular session. for that view for that client.
          If you have any confusion tell me.
    Ninad

  • Calling Oracle Functions and Procedures in Java

    I've looked online for a blurb on using Oracle SQL functions and
    procedures in Java, but I haven't found anything. Can someone
    either give me a quick crash course on this, or point me to the
    best source of information for this?

    From the SQLJ FAQ.
    http://otn.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html#sqljplsql
    Within your SQLJ statements, you can use PL/SQL anonymous blocks
    and call PL/SQL stored procedures and stored functions, as in the
    following examples: Anonymous
    block:
    #sql {
    DECLARE
    n NUMBER;
    BEGIN
    n := 1;
    WHILE n <= 100 LOOP
    INSERT INTO emp (empno) VALUES(2000 +
    n);
    n := n + 1;
    END LOOP;
    END
    Stored procedure call (returns the maximum
    deadline as an output parameter into an output host expression):
    #sql { CALL MAX_DEADLINE(:out maxDeadline) };
    Stored function call (returns the maximum
    deadline as a function return into a result expression):
    #sql maxDeadline = { VALUES(GET_MAX_DEADLINE)
    Of course, you can also use JDBC code to achieve the same - the
    standard JDBC escape sequences for stored function and procedure
    calls are supported, using for example:
    "{? = CALL GET_MAX_DEADLINE}"
    or:
    "{call MAX_DEADLINE(?)}"
    and for the rest of the details, get that JDBC crash course...

  • Passing input parameters to the method call in ADF task flow.

    Hi,
    I have the following use case:
    There is a task flow with 2 jspx pages. In the first page I have 2 input search parameters and search button. the search button calls the webservice data control execute (GET_ACCOUNTOperation) method .
    Displaying the search results in the same page is not a problem , but my requirement is that the search results are to be displayed in the second page in tabular form.
    To achieve this, I dragged the execute method as the method call in the task flow and specified the input parameters for the method call (right click and add parameters) . I am getting the following exception :
    javax.el.MethodNotFoundException: Method not found: GET_ACCOUNTOperation.execute(java.lang.String, java.lang.String)
         at com.sun.el.util.ReflectionUtil.getMethod(Unknown Source)
         at com.sun.el.parser.AstValue.getMethodInfo(Unknown Source)
         at com.sun.el.MethodExpressionImpl.getMethodInfo(Unknown Source)
         at oracle.adf.controller.internal.util.ELInterfaceImpl.getReturnType(ELInterfaceImpl.java:214)
         at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:135)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1035)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:921)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:820)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:552)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:148)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:109)
         at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:78)
         at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:43)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:889)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:379)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    even though the execute method is there and the service is up and running. I am not sure whether its the correct way of doing it. Please shed some light on how to solve this use case
    Some additional info:
    Under the data controls pallete, the GET_ACCOUNTOperation method has a parameters section , which has "part" (java.lang.Object) as
    the input parameter.
    Regards,
    Rampal

    Hi,
    thanks for the quick turn-around. Jdev version that i am using is Studio Edition Version 11.1.1.6.0. And i am using SOAP. Isnt there a way without using a backing bean? I am planning to use it as a portlet. Would'nt creating a backing bean cause a problem in that case?? Also i am confused here . The method that i am dragging is GET_ACCOUNTOperation(Object). I tried passing the hashmap . It gave the following exception :
    javax.el.MethodNotFoundException: Method not found: GET_ACCOUNTOperation.execute(java.util.HashMap)
    Rampal

  • Difference between invoking a method using reflect.proxy and reflect.Method

    Could any one tell me the difference between invoking a method using reflection java.lang.reflect.Method and java.lang.reflect.Proxy
    using both the class, we can invoke a method at runtime
    1)
    Method mthd=cl.getMethod("methodName",parameterName);
    Integer output=(Integer)mthd.invoke(new RunMthdRef(),input);
    2)
    Proxy.newProxyInstance(super.getClass().getClassLoader(), new Class[] { adapter }, new SomeClass(this));
    Does anybody have any idea?

    The two idioms are fundamentally different. Using java.lang.reflect.Method is how we call a method on a class, using Proxy is how we intercept that method call. An exercise for you, to illustrate that they do not do the same thing: write a simple class with one method, then use java.lang.reflect.Method to invoke that method, and then use a Proxy to invoke that method

  • Error ocurring when Event Listener methode in "for statement" is called

    Hy guys,
    I would be gratefull if somebody could answer me how can I
    call a method from flex in "for statement", that is actually in my
    remote service implemented. I call the method loadAssetsResult()
    (event listener method in my action script) and get a collection of
    objects back. In the same method I want to iterate throught this
    collection and call another method from remote service, that is
    specified for this object. Problem is when I call this remote
    method inside of this loop statement. I get the error when I write
    my code like following one:
    public function loadAssetsResult(event:ResultEvent):void {
    for (i=0; i<event.result.length; i++) {
    a = new Asset();
    a.longName = event.result
    .longName;
    a.shortName = event.result.shortName;
    a.isin = event.result
    .isin;
    a.nsin = event.result.nsin;
    a.currentDayClose = event.result[0].currentQuote.dayClose;
    //Schluskurs
    assets.addItemAt(a, i);
    RO.getIndicatorCollection(i);
    DataBinding();
    When I comment the row: RO.getIndicatorCollection() it works,
    of course without these additional data that I get from that
    method. I need to call this method inside loop statement (for each
    object), but I don't know how, without getting this error?
    please somebody help me with some ideas
    br
    Sheila

    Kris,
    First of all you should increase the value of logging-config/character-limit element in tangosol-coherence.xml to see the message entirely. The default setting is 4096 which is not enough to see your exception text.
    When you do that I believe you will see that the actual exception is java.lang.ClassNotFoundException indicating that the node that has the listener installed doesn't know about the class that is being put into the cache and could be easily fixed as shown here: http://www.tangosol.com/faq-coherence.jsp#classnotfound
    Please let me know if that doesn't help.
    Gene

  • Call method http_client- response- get_header_fields for PDF and for TIFF

    Hi,
    I am using a Function Module..
    APAR_EBPP_GET_INVOICE_DETAIL to display the TIFF images on the Biller Direct side.
    The above function module is used to retrieve the PDF documents from the document repository.
    In Similar way I am trying to do the TIFF Images too.
    But in this method
    call method http_client->response->get_header_fields
        changing fields.
    For PDF the table fields is as follows
                NAME                                       VALUE                                  
        1     ~response_line----
    |HTTP/1.1 200 (OK)                         |
        2     ~server_protocol----
    |HTTP/1.1                                  |
        3     ~status_code----
    |200                                       |
        4     ~status_reason----
    |(OK)                                      |
        5     content-length----
    |7136                                      |
        6     content-type----
    |application/pdf                           |
        7     server                                |Microsoft-IIS/6.0                         |
        8     x-powered-by                    |ASP.NET                                   |
        9     date                                 |Tue, 24 Feb 2009 18:09:35 GMT             |
       10     connection                       |close                                     |
    For TIFF the table fields are as follows:
        1     ~response_line----
                   |HTTP/1.1 500 (internal server error)        |
        2     ~server_protocol----
                 |HTTP/1.1                                    |
        3     ~status_code----
                     |500                                         |
        4     ~status_reason----
                   |(internal server error)                     |
        5     content-length----
                   |105                                         |
        6     content-type----
                     |text/plain                                  |
        7     server----
                              |Microsoft-IIS/6.0                           |
        8     x-powered-by                 |ASP.NET                                     |
        9     date                         |Tue, 24 Feb 2009 18:26:39 GMT               |
       10     connection                   |close                                       |
    The error message is Internal Server error..
    This is in HTTP2_Get Function Module.
    What would be the reason for HTTP/1.1 500 Internal Server error.
    Any suggestions are welcome..
    Thanks,
    Chaitanya

    Hi Niranjan,
    can you please check if you have imported the whole chain of certificates. Certificates usually diplayed in 3 levels in the Explorer. like
    Verisign - L1
    >>> Versign--  L2
    >>>>>>>>>>>>XYZ.com -- L3
    Extract all the 3 certificates and Put in Strust and do exit soft and hard in SMICM and restart the service.
    Its better to create a RFC destination of Type H and Do the Connection test for HTTPS configuration. If the connection test comes OK then u can be sure of the configuration.

  • My daughter is going to Canada for a week and i would like to know if it will cost extra for her to text and/or call someone in the United States?

    My daughter is going to Canada for a week and i would like to know if it will cost extra for her to text and/or call someone in the United States?

    http://businessportals.verizonwireless.com/international/traveling_to/North_America/Canada.html
    69 cents a minute for calls, texts covered under an existing texting plan or the standard pay per text rate if you don't have one.
    If you're traveling in Canada, contact Customer Service at 800-922-0204 from any landline phone.
    Global Picture and Video Messages are billed at the same per-message rate as though they were sent from the U.S. Accordingly, you can send/receive Picture and Video Messages with customers of:
    Verizon Wireless (domestic rates/bundles apply)
    Other domestic carriers (domestic rates/bundles apply)
    Canadian, Mexican and Puerto Rican carriers (domestic rates/bundles apply)
    Select International carriers (global rates apply) 
    When sending or receiving there's an additional data transport charge billed at the destination's Data Pay per Use Rate multiplied by the size of the Picture or Video, which can vary greatly.
    A data network is required to send picture or video outside the U.S. See the Data Roaming List for eligible destinations.
    Attempts to send Pictures or Videos are charged, even if the delivery fails.
    Text Messages sent or received while in Canada, Puerto Rico and the U.S. Virgin Islands are billed as though you were in the U.S.
    Check out our Nationwide plus Canada plans if you frequently call or travel to Canada.

  • Method called more than once - and dies with EXC_BAD_ACCESS error

    Hi,
    In my app, I have 4 views with their respective viewControllers. In the appDelegate.m, I provide methods that allows to switch to any of these views. Following is code for switching to the editView:
    -(void) flipToEditView {
    [self populateTheList]; // populate an array
    EditViewController *anEditVC = [[EditViewController alloc] initWithNibName:@"EditView" bundle:nil];
    [self setEditVC:anEditVC];
    [viewController.view removeFromSuperview];
    [self.window addSubview:[editVC view]];
    [anEditVC release]; }
    The view is not switched - and moreover, this method is called more than once; and the app dies with EXCBADACCESS!
    2009-08-23 14:54:40.648 iNotate[2128:20b] Album (before): x= 0 y=20 width=320 height=460
    2009-08-23 14:54:40.653 iNotate[2128:20b] Album (after): x= 0 y= 0 width=320 height=480
    warning: Couldn't find minimal bounds for "_sigtramp" - backtraces may be unreliable
    (gdb) bt
    #0 -[iNotateAppDelegate flipToEditView] (self=0x523690, _cmd=0x9563) at /Users/sam/MY_FILES/iPhone Apps/app/Classes/iNotateAppDelegate.m:116
    #1 0x00008661 in -[FirstView editAction] (self=0x546a30, _cmd=0xac94) at /Users/sam/MY_FILES/iPhone Apps/app/FirstView.m:25
    #2 0x30a4eee6 in -[UIApplication sendAction:to:from:forEvent:] ()
    #3 0x30ab0d36 in -[UIControl sendAction:to:forEvent:] ()
    #4 0x30ab11fe in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
    #5 0x30ab0544 in -[UIControl touchesEnded:withEvent:] ()
    #6 0x30a67917 in -[UIWindow sendEvent:] ()
    #7 0x30a56fff in -[UIApplication sendEvent:] ()
    #8 0x30a561e0 in _UIApplicationHandleEvent ()
    #9 0x31565dea in SendEvent ()
    #10 0x3156840c in PurpleEventTimerCallBack ()
    #11 0x94a713c5 in CFRunLoopRunSpecific ()
    #12 0x94a71aa8 in CFRunLoopRunInMode ()
    #13 0x31566600 in GSEventRunModal ()
    #14 0x315666c5 in GSEventRun ()
    #15 0x30a4eca0 in -[UIApplication _run] ()
    #16 0x30a5a09c in UIApplicationMain ()
    #17 0x000027e8 in main (argc=1, argv=0xbffff068) at /Users/sam/MY_FILES/iPhone Apps/app/main.m:14
    Current language: auto; currently objective-c
    (gdb) continue
    2009-08-23 14:54:55.885 iNotate[2128:20b] >>>>>>>>>>>>>>>>>> populateTheList
    (gdb) bt
    #0 -[iNotateAppDelegate flipToEditView] (self=0x523690, _cmd=0x9563) at /Users/sam/MY_FILES/iPhone Apps/app/Classes/iNotateAppDelegate.m:116
    #1 0x00008661 in -[FirstView editAction] (self=0x5457b0, _cmd=0xac94) at /Users/sam/MY_FILES/iPhone Apps/app/FirstView.m:25
    #2 0x30a4eee6 in -[UIApplication sendAction:to:from:forEvent:] ()
    #3 0x30ab0d36 in -[UIControl sendAction:to:forEvent:] ()
    #4 0x30ab11fe in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
    #5 0x30ab0544 in -[UIControl touchesEnded:withEvent:] ()
    #6 0x30a67917 in -[UIWindow sendEvent:] ()
    #7 0x30a56fff in -[UIApplication sendEvent:] ()
    #8 0x30a561e0 in _UIApplicationHandleEvent ()
    #9 0x31565dea in SendEvent ()
    #10 0x3156840c in PurpleEventTimerCallBack ()
    #11 0x94a713c5 in CFRunLoopRunSpecific ()
    #12 0x94a71aa8 in CFRunLoopRunInMode ()
    #13 0x31566600 in GSEventRunModal ()
    #14 0x315666c5 in GSEventRun ()
    #15 0x30a4eca0 in -[UIApplication _run] ()
    #16 0x30a5a09c in UIApplicationMain ()
    #17 0x000027e8 in main (argc=1, argv=0xbffff068) at /Users/sam/MY_FILES/iPhone Apps/app/main.m:14
    (gdb) continue
    2009-08-23 14:55:22.493 iNotate[2128:20b] >>>>>>>>>>>>>>>>>> populateTheList
    Program received signal: “EXCBADACCESS”.
    (gdb) continue
    What's happening here?
    Sam!

    -(void) flipToEditView {
    [self populateTheList]; // populate an array
    EditViewController *anEditVC = [[EditViewController alloc] initWithNibName:@"EditView" bundle:nil];
    [self setEditVC:anEditVC];
    [viewController.view removeFromSuperview];
    [self.window addSubview:[editVC view]];
    [anEditVC release]; }
    }<---- is this } matched elsewhere?

  • Method called reverse that switches complex number coordinates.

    I have written a class called "Complex" and there are no errors in the program.
    What I am confused about is how to answer an assigned question. The question
    is this: "Write a method called reverse which will return a new complex number
    with the coordinates reversed. That is, if the complex number which invokes
    the method has coordinates (a,b), then the method should return a new complex
    value with coordinates (b, a)."
    I will include my code for the class here (I'm using the NetBeans IDE):
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package tutorial8;
    * @author Aleks
    public class Complex
        private int I; // Real Part
        private int J; // Imaginary Part
        public Complex(int I, int J)
        setComplex(I, J);
    public int getI()
        return I;
    public int getJ()
        return J;
    public void setComplex(int I, int J)
    this.I=I;
    this.J=J;
    if (I==J)
    System.out.println("true");
    else
    System.out.println("false");
    }thanks.

    Your right it compiles without errors but it says it's missing a main method.
    This main method thing is driving me insane. Some of my classes work such as the following
    one:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package tutorial7;
    * @author Aleks
    import java.util.Scanner;
    public class Shortcalculation
        public static void main(String[] args)
            Scanner keyboard = new Scanner(System.in);
            System.out.println("Enter a positive integer");
            int positiveInteger = keyboard.nextInt();
           if (positiveInteger < 2)
            System.out.println("First positive integer output");
            positiveInteger = 4;
            while ((positiveInteger/3 >=1) && (positiveInteger/3 < 2))
                System.out.println("4");
            else if (positiveInteger < 3)
            System.out.println("Second positive integer output");
            positiveInteger = 21;
            while ((positiveInteger/5 >=2) && (positiveInteger/5 < 3))
                System.out.println("21");
            else if (positiveInteger < 4)
            System.out.println("Third positive integer output");
            positiveInteger = 43;
            while (positiveInteger/7 <=3)
                System.out.println("43");
            else
            System.out.println("Not a valid integer");
    }But I don't see why THIS one shouldn't. I try to include a "public static void main(string[] args)"
    in the class complex but it says it's an illegal start of the expression. Maybe it depends on
    where in the class I put it. I'm only practicing writing classes for 3-4 weeks now because I've read
    a lot of the book. Too bad my memory is kind of bad. Ok, I have changed the class for this
    question, I have added a reverse method. I did it without a return statement.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package tutorial8;
    * @author Aleks
    public class Complex {
        private int I; // Real Part
        private int J; // Imaginary Part
        public Complex(int I, int J)
        setComplex(I, J);
        public int getI()
        return I;
    public int getJ()
        return J;
    public void setComplex(int I, int J)
    this.I=I;
    this.J=J;
    if (I==J)
    System.out.println("true");
    else
    System.out.println("false");
    public void reverse()
    this.I=J;
    this.J=I;
    }sorry for the long post.

Maybe you are looking for

  • IPod Device Internal assert error

    This is the 2nd iPod I can't get to work. I am using an XP machine. I am getting an error during the install. In the dialogue box that say "Your iPod has been connected. Please wait while the system recognizes the device." The progress bar just keeps

  • Starting Ink Tool in Word 2010

    I have a laptop computer but no tablet or pen with it.  I was wondering if I can use the Starting Ink tool with my mouse to edit/grade documents.  (I am a teacher at a high school.)  I cannot figure out how to make the ink write on my Word document. 

  • Distinct clause ignores special characters

    Hi all, Assume I have following 2 addresses from Address Field. BAHNSTRASSE BAHNSTRAßE when I query to DB on this fields to get distinct addresses, the DISTINCT clause considers it as a same address only.  same thing is happened with UNION also. Is i

  • Dbghelp.dll Error in Skype

    I get this error "Failed to load library" dbghelp.dll. This happend when I DD click on the Skype icon to display skype's open box for use I have check for the file error is still in windows, and it is. What is the solution for this, is this an unique

  • Adding hyperlinks to iweb

    i have a basic iweb site with multiple photo pages. now i'm adding a blog and a movie page. so, the nav bar has each photo page listed (lots) and i'd rather have one link that says "photos" that goes to a separate photo site, then people could naviga