Error using contains method of vector

Hi
I am trying to find if a value in one vector in present in another vector.I try to do the following.But I get an error
Vector2 is the outer vector which holds all the values
and vector 3 holds the current value that I am trying to search in the larger vector
for (int i = 0;i <= myVector2.size();i++)
     if (myVector2.contains(myVector3(i)))
          {out.println("sucess"); }
          else {out.println("failure");}
Thanks
Arn

Well, You cannot use vector(i) to access the element. You should use vector.elementAt(i), and it will work.

Similar Messages

  • How to use Contains method in Linq

    Hi,
    I am using the below LINQ and I am getting an exception. Please help me to work around it. I want to use Contains()
     string [] values = new string[]{"U","O","D" };
     var exist = (from seq in  connection.BUSINESS_LINE_TEAM 
     where seq.FK_BL_ID == techSpecification.LOBId
    where seq.HUM_ID == techSpecification.Created_By
    where values.Contains(seq.BL_ROLE_TYPE)
     select seq).Count();
     int result = Convert.ToInt16(exist);
     if (result <= 0)
    transconfig.LOB_USER_STATUS_CD ="Y";
    else
    transconfig.LOB_USER_STATUS_CD ="N";
    connection.SaveChanges();
    The exception is :
    LINQ to Entities does not recognize the method 'Boolean Contains[String](System.Collections.Generic.IEnumerable`1[System.String], System.String)' method, and this method cannot be translated into a store expression.
    I will be waiting for replies. It's kinda urgent.

    In order to see what query the data provider sent to the server you can do the following.
    Just after creating the data context place this line in the code.
    db.Database.Log = Console.Write;
    Then place a breakpoint after the next line of code, shown next.
    var
    a =
    db.product.Where(p
    =>
    p.Name.Contains(asKeyword)).ToList();
    Then run the application and when it hits the breakpoint open the Visual Studio Output window and the SQL sent to the server should be displayed.
    Fernando (MCSD)
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects
    and unknown namespaces.

  • Finding duplicates in arraylist by using contains method

    How can I find the duplicates in an arraylist by using the contains method? then I need to store every duplicate in another arraylist so lets say my arraylist is
    <1,2,2,3,3,2,1,3,4,5>
    so I need to find the duplicates which are 1,2 and 3 and store those duplicates in another arraylist so this arraylist will be something like this <1,2,3>
    and I have to do these by using the contains method for arraylists. I know I need to override the equals method. Any help.

    this doesnt seem like it is working. what am I missing? thanks
    import java.io.IOException;
    import java.util.ArrayList;
    public class StoresX {
         private String x;
         public StoresX(String x){
              this.x = x;
         public boolean equals(Object other){
              return this.x == ((StoresX)other).x;
         public String getX() {
              return x;
         public void setX(String x) {
              this.x = x;
         public static void main(String[] args) throws IOException {
              StoresX a=new StoresX("a");
              StoresX b=new StoresX("a");
              StoresX d=new StoresX("b");
              StoresX f=new StoresX("a");
              StoresX g=new StoresX("c");
              StoresX h=new StoresX("c");
              ArrayList<StoresX> c=new ArrayList<StoresX>();
              c.add(a);
              c.add(b);
              c.add(d);
              c.add(f);
              c.add(g);
              c.add(h);
              System.out.println(c.get(0).equals(c.get(1)));
              ArrayList<String> dup=new ArrayList<String>();
              ArrayList<StoresX> other=new ArrayList<StoresX>();
              for(int i = 0; i < c.size(); i++){
                   if(other.contains(c.get(i)))
                        StoresX e= c.get(i);
                        if (!dup.contains(e))
                             dup.add(c.get(i).getX());
                        }} else {
                             other.add(c.get(i));     
              System.out.print(dup);
    }

  • Error using a method call in the starting conditions of a Workflow

    Hi,
    In SRM 4, I have a doubt about a start condition with WFWS14000109 I need to trigger the WF depending on organizational unit of the requester (not purchase group or purchase organization).
    I have seen in the editor, in SWB_COND in the part of requisitionerUser the Method ReadOrgUnit.
    I change to traditional mode of the editor and when I select the method I get in Express1. field
    &_EVT_OBJECT.REQUISITIONERUSER.READORGUNIT(_RESULT='OBEG';ACTORGUNIT= )&
    If I use = and the organizational unit in express2 field I get error
    Partial expression expected (expression '&_EVT_OBJECT_REQUISITIONERUSER.READORGUNIT(_RESULT',position       76)
    Can anybody say me where is the error? how I should express the condition.
    Thanks
    Best Regards

    I don't think you can use a BOR method in a condition. At least not as far as I know. I think it would be better to create a virtual attribute in your delegated subtype of BUS2121 and use that in the condition.
    Regards,
    Martin

  • Pop Up Error using MVC method after Validation in  DO_HANDLE_EVENT Method

    Hi Experts,.
    I am rather new to BSP applications and I am working using MVC at the moment. I have a requirement which apparently is simple, but am yet to get that done successfully.
    I have a couple of buttons on my BSP View screen, on click of these buttons, the User Name would be verified with entries in a Custom table and if the User Name is not found, an error message would pop up stating, "You are not Authorized to use this option".
    On click of the button, the event which is triggered is handled in the DO_HANDLE_EVENT Method of the Controller for the view.
    The check is performed in that method. Thereafter the method DO_REQUEST follows automatically which loads the view yet again. I want to throw a pop up error message at this instance if the User Name was not the authorized one.
    I have used Java Script to throw pop up message but only in case of field content validation where I did not need to navigate away from the view for the validations. But how do I bo about for this example.
    Any help would be highly appreciated.
    Regards,
    Subhrangsu

    Hi
    1. You can call the view in pop-up because you will be calling the controller using open.window.
    Here is the sample code:
    method DO_REQUEST .
      data:
            li_vw           type ref to   if_bsp_page,
            lv_form_field   type          string,
            li_md           type ref to   zcl_model01.
      dispatch_input( ).
      li_md ?= get_model( 'm01' ).
      lv_form_field = request->get_form_field( 'invoice_create' ).
      if lv_form_field is initial.
    *------ Request to display main page
        li_vw = create_view( view_name = 'main.htm' ).
        li_vw->set_attribute( name = 'model' value = li_md ).
        call_view( li_vw ).
      elseif lv_form_field eq 'true'.
    *------ Request to display Invoice page in pop-up
        li_vw = create_view( view_name = 'invoice.htm' ).
        li_vw->set_attribute( name = 'model' value = li_md ).
        call_view( li_vw ).
      endif.
    endmethod.
    Layout :
       function do_Invoice()
          { var s=0; r=1; w=300; h=300; x=screen.width/2;
            x=x-w/2;
            var y=screen.height/4;
            y=y-h/2;
            popUp=window.open('main.do?invoice_create=true','win','width='+ w
            +',height='+ h +', left=' + x +',top='+ y +');
    Regards,
    G. Nikhil Kumar

  • Type incompatibility error using remove method of ArrayList class

    This method:
    public int removeFromQueue ( int iIndex )
    return queueFeed.remove( new Integer(iIndex) ) ;
    returns a type error after remove saying its found a boolean but is looking for an int. I want to remove the int value in the ArrayList and use it elsewhere.
    Confused.

    if you are trying to remove an element at the particular index say 5
    i.e., is int value = 5 then you get the return as Object that has been removed. Since ArrayList hols all obejcts and not any primitive data types.
    if you are trying to remove the Object say Integer(5) then you get the return as boolean specifying whether it has been sucessfull or not.
    so you can use either of the following as....
    // To remove Integer Object from Queue
    public boolean removeFromQueue ( int iIndex )
    return queueFeed.remove( new Integer(iIndex) ) ;
    // To remove Object from Queue at specific position
    public Integer removeFromQueue ( int iIndex )
    return (Integer)queueFeed.remove( iIndex ) ;
    }

  • Type incompatibility error using'remove' method in ArrayList class.

    This method:
    public int removeFromQueue ( int iIndex )
    return queueFeed.remove( new Integer(iIndex) ) ;
    returns a type error after remove saying its found a boolean but is looking for an int. I want to remove the int value in the ArrayList and use it elsewhere.
    Confused.

    A - Yeah I get it now mate.
    But the API states that the the object is returned:
    "Returns:
    the element that was removed from the list. " i.e my
    integer value that I know is there
    so why does it return a boolean to me. Am I deploying
    incorrectly.no, the method you are calling takes an Object as a parameter
    look in the docs here for the method remove(Object)
    you will see it returns a boolean
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractCollection.html#remove(java.lang.Object)it is a method inherited from AbstractCollection and is different than
    the method shown in the javadoc for ArrayList that takes an int
    as a parameter.
    A
    hope this helps

  • Smtp error using traditional methods for relaying emails from oracle

    Can anybody please resolve these errors...
    One of the methods told thru otn threads gives this error...
    code given below-
    CREATE OR REPLACE PROCEDURE "SEND_MAIL" (
    p_sender IN VARCHAR2,
    p_recipient IN VARCHAR2,
    p_message IN VARCHAR2
    AS
    l_mailhost VARCHAR2 (255) := 'my host name';
    l_mail_conn UTL_SMTP.connection;
    BEGIN
    l_mail_conn := UTL_SMTP.open_connection (l_mailhost, 25);
    utl_smtp.command( l_mail_conn, 'prabhat');
    utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'my mail address'))) );
    utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'receivers mail address' ))) );
    UTL_SMTP.helo (l_mail_conn, l_mailhost);
    UTL_SMTP.mail (l_mail_conn, p_sender);
    UTL_SMTP.rcpt (l_mail_conn, p_recipient);
    UTL_SMTP.open_data (l_mail_conn);
    utl_smtp.write_data(l_mail_conn, 'Subject: Your Subject Line Here');
    UTL_SMTP.write_data (l_mail_conn, p_message);
    UTL_SMTP.close_data (l_mail_conn);
    UTL_SMTP.quit (l_mail_conn);
    END;
    Error-
    ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 159
    Thanks & Regards
    Swati

    Other threads on PLSQL forum where folk have hit this kind of problem....
    Re: ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
    Cheers
    David

  • L675D-S7016 (PSK3JU) gets FreeDOS errors using CD method to install BIOS version 1.50

    I downloaded sk3jv150.exe from Toshiba's support site and followed the instructions to create a bootable CD to flash the BIOS.  In fact, I have created the boot CD several times using different programs on this laptop and even on two other PCs but have had no success.
    Whenever I boot from the CD, FreeDOS starts and the following error messages appear:
    -InitDiskWARNING: using suspect partition Pri:1 FS 01 with calculated values 1-0-1 instead of 0-1-1
    WARNING: using suspect partition Pri:1 FS 01: with calculated values 255-0-63 instead of 1-0-63
    C:HD1, Pri[1],CHS= 1-0-1, start= 0MB size=7M
    This laptop came with Windows 7 Home Premium 64-bit and I purchased it new in the Fall of 2010.
    Any ideas?

    After you receive the error you should be at a C: prompt.  Enter BIOS.BAT and hit enter.  This should lauch the BIOS flash application.

  • Compile error when using Collections.sort for Vector, why?

    The compiler is giving an error when trying to do this (I'm using JDK 1.5.0_09):
    Vector <String> test = new Vector <String>();
    test.add("test1");
    test.add("test2");
    test.add("test3");
    Collections.sort(test);The error being:
    The method sort(Vector<String>) is undefined for the type Collections
    Collections.sort takes List, but Vector is of type List, so this should work, correct?

    ChuckBing wrote:
    No. Vector is not a subclass of List. Use List.um.. Vector implements List

  • Getting "Method 'sign_in' does not exist" Error (using Charles)

    This may be a bit off the FLEX field, and have to do with Zend Framework's ZEND_AMF class. Unfortunately I haven't been able to dig anything up, and comments posted on Wade Arnolds site have not received any responses, so I thought I'd give it a go here.
    My ServiceController Class:
    public function loginAction()
         $this->_helper->viewRenderer->setNoRender();
         $server = new Zend_Amf_Server();
         $server->setClass('LoginAmfService', 'LoginService');
         $server->setClassMap('CurrentUserVO', 'CurrentUserVO');
         $server->setProduction(false);
         print($server->handle());
    My LoginAmfService class:
    class LoginAmfService
          * Main login function.
          * @param  string        $name
          * @param  string        $password
          * @return CurrentUserVO
         public function sign_in($name, $password)
              $authAdapter     = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('db'), 'users', 'user_name', 'password', 'PASSWORD(?) AND active = 1');
              $returnValue     = new CurrentUserVO();
              $authAdapter->setIdentity(htmlspecialchars($name))
                   ->setCredential(htmlspecialchars($password));
              $authResult = $authAdapter->authenticate();
              if ($authResult->isValid())
                   $userArray                          = $authAdapter->getResultRowObject(array('id', 'first_name', 'last_name', 'title', 'photo'));
                   $returnValue->first_name     = $userArray->first_name;
                   $returnValue->last_name          = $userArray->last_name;
                   $returnValue->title               = $userArray->title;
                   $returnValue->photo               = $userArray->photo;
                   $returnValue->token               = $userArray->id;
              return $returnValue;
          * Function used to log people off.
         public function sign_out()
              $authAdapter = Zend_Auth::getInstance();
              $authAdapter->clearIdentity();
    My SignIn FLEX module (the relevant portions):
         <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              source="SignIn"
              showBusyCursor="true"
              fault="parentDocument.handleFault(event)"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.rpc.events.FaultEvent;
                   import mx.utils.ArrayUtil;
                   import mx.rpc.events.ResultEvent;
                   import mx.controls.Alert;
                   import com.brassworks.ValueObjects.CurrentUserVO;
                   import mx.events.VideoEvent;
                   [Bindable]
                   private var this_user:CurrentUserVO = new CurrentUserVO();
                   private function mdl_init():void
                        focusManager.setFocus(txt_username);
                   private function signin_handle(event:ResultEvent):void
                             this_user = event.result as CurrentUserVO;
                             if (this_user.token == null) {Alert.show("Supplied login credentials are not valid. Please try again.");}
                             else
                                  this.parentApplication.setUser(this.this_user);
                   private function signout_handle(event:ResultEvent):void
                   private function sign_in(event:Event):void
                        try
                             //Alert.show(txt_name.text + "|" + txt_password.text);
                             LoginRemote.sign_in(txt_username.text, txt_password.text);
                        catch (error:Error)
                             this.parentDocument.handleFault(error);
                   private function sign_out(event:Event):void
                   private function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
                   private function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
              ]]>
         </mx:Script>
    Now, all this is great and good, as it works with Zend Framework 1.7.6. However, when I try to upgrade to 1.7.8 (to take advantage of session management and other bug-fixes), I get the following error (using Charles):
    #1 /var/web/htdocs/core/library/Zend/Amf/Server.php(390): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 /var/web/htdocs/core/application/default/controllers/ServicesController.php(73): Zend_Amf_Server->handle()
    #3 /var/web/htdocs/core/library/Zend/Controller/Action.php(503): ServicesController->loginAction()
    #4 /var/web/htdocs/core/library/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('loginAction')
    #5 /var/web/htdocs/core/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
    #6 /var/web/htdocs/core/application/bootstrap.php(39): Zend_Controller_Front->dispatch()
    #7 /var/web/htdocs/core/public/index.php(5): Bootstrap->runApp()
    #8 {main} ?Method "sign_in" does not exist
    I have no idea why this would not work anymore. My assumption is that I am not correctly setting up Zend_Amf (but then again, my counter-argument is that it worked before, so ..... ????)
    Thanks for any help!
    -Mike

    For those that are also fighting this issue:
    The problem appears to be that the RemoteObject needs to specify the class containing the methods as a source parameter. According to this bug report (http://framework.zend.com/issues/browse/ZF-5168) it is supposed to have been addressed, but apparently has re-emerged in Zend_Amf since version 1.7.7.
    Using my example above, I would have to specify the RO as:
    <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              source="LoginAmfService"
              showBusyCursor="true"
              fault="parentDocument.handleFault(event)"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObjecct>

  • Error: "Function or method not supported." when using RF List Mode on NI 5673E

    Hi,
    I am trying to use the RF List Mode in NI RFSG 5673E. I tried running the sample code "RFSG Configuration List Frequency and Power Sweep.vi" but an error would show up:
    "Error: niRFSGCreateConfigurationList.VI <ERR> The LO reported the following error: Function or method not supported." with the error code: BFFA4239. 
    I also tried running other sample codes that contain the Configuration List VI's but the same error appeared. I am using NI RFSG 1.8.5.
    I would really appreciate any help on this. Thanks!

    Hello jdlabrador,
    I setup a 5673E here and tried to run the same example.  I did not encounter an error.
    Other reports I've found pertaining to this error usually involved a large number of steps - there was not enough space on the hardware to accommodate them.  The error text you're seeing is a little different in that it states that the Create Configuration List method isn't supported for the LO.
    Do each of the modules in your 5673E (5450, 5611, 5652) pass a self-test in MAX?  
    Have you associated the 5450 and 5652 with the 5611?
    Could you post a screenshot of the fully-expanded Devices and Interfaces tree from MAX?
    Since RFSG 1.9.5 is available, it may be a good first-step to upgrade to it.  
    Best regards,
    Matthew H.
    Applications Engineer
    National Instruments

  • Getting an error while copying pdf file into RMS enabled document library using copyTo() method

    In SharePoint 2010, I am trying to copy pdf file programmatically from a non-RMS protected document library into RMS protected library using copyTo() method.
    But I am getting an error while doing so. it gives error as mentioned below -
    This library does not accept files of the given type. You must either upload a
    new, unprotected file that supports rights management or re-upload a document
    that was previously downloaded from this library.
    Please suggest some solution.
    Thanks,

    Are You sure that you have give 'PDF' in caps in your program? and check whether you are getting all the datas before calling the method.
    in my program, i have used like this and it is working fine for me,
    I am getting PDF content from the form...
    DATA  ls_formoutput     TYPE fpformoutput.
      DATA  pdf_content        TYPE solix_tab.
      DATA  lp_pdf_size        TYPE so_obj_len.
    DATA  lv_mail_title      TYPE so_obj_des.
    *Attach the PDF .
          lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).
          pdf_content = cl_document_bcs=>xstring_to_solix(
              ip_xstring = ls_formoutput-pdf ).
          document->add_attachment(
            i_attachment_type     = 'PDF'
            i_att_content_hex     = pdf_content
            i_attachment_size     = lp_pdf_size
            i_attachment_subject  = lv_mail_title ) .

  • Error (Error when starting a SWITCH branch) while using container operation

    HI Experts,
    I am using container operation step for moving internal table (ref to sflight) to workarea.The error I found in the log is ' Error when starting a SWITCH branch'.Kindly help me in finding the solution.Below are the steps and code.
    Result Element = lw_sflight             (Element ref to sflight with export and Import)
    Assignment     =    =                     (Assign (contents of table are deleted first)
    Expression      = &FLIGHT&             (Multi line container ref to sflight)
    Operator          = Assignment
    Expression      =                                 (Blank)
    Thanks and Regards,
    Srini

    Hello,
    Maybe you should show more information about the condition step instead of the container operation step.
    A previous poster in SDN said they solved their problem by changing the order of the conditions.
    regards
    Paultje Bakker
    Hanabi Technology

  • How to resolve error while importing data using IDoc method in LSMW ?

    Hi
    I am trying to import my data using IDoc method in LSMW.
    But after completing the whole LSMW process, when I look into the IDOC generated, the error description is as this.
    It talks about the process code and other stuff.
    Function module not allowed : APPL_IDOC_INPUTI
    Message No. B1252
    Diagnosis :
    The function module APPL_IDOC_INPUTI and the application object type which were determined are not valid for this IDoc.
    I am not able to resolve the problem.
    Please help.
    Regards,
    Rachesh Nambiar

    check the below link.
    /people/stephen.johannes/blog/2005/08/18/external-data-loads-for-crm-40-using-xif-adapter

Maybe you are looking for

  • Multiple game center accounts

    Prior to installing iOS7, I could sign into Game Center.  I had set up a game center account for my 9 year old daughter on my iPhone5 and I had a separate account sign in on my iPad mini.  Now, it seems to automatically sign me in on both, and I have

  • Creative Cloud member wants to publish multi-folios for a client...

    Hello everyone, I did send this question as a"private message" first and did receive some answers that I would like to share here. Big thank you to both Himanshu and Bob!!!  If someone feels like adding more info regarding the subject please do. "I’m

  • Premiere CC 2014 Crashes on Splash Screen

    Hi there, Running Premiere CC 2014 on Win7x64. A few days ago it began crashing on the startup screen right after attempting to launch the program. I have updated/rolled/back/changed my nvidia drivers (geforce 770) so many times at this point I canno

  • What is the quickest way to get a new iPhone swapped for my current iPhone?

    Hello all, I'm in search of a solution for my parents. The conundrum is this: Parents have a pair of iPhone 4 8GB picked up for free on contract back in 2010 from Verizon Wireless. They're interested in the new iPhone (6) and would like to get replac

  • Help finding missing person in Blue Mountains Sydney

    You may have sen this on the news but a person is missing in the blue mountains who we are desperately trying to find. I am hoping somebody can help us understand the capabilities better of the iphone in regards to this situation. He left his hotel a