Problem in vector

How to store the vector value into the string.And the value retrieved from the vector must be checked with the database vale.

Are they definitely Strings being put in?
Object[] o = vector.toArray();
String[] strings = new String[o.length];
System.arraycopy(o,0,strings,0,strings.length);Or..done one at a time:
for (int i=0; i<v.size();i++)
  process((String)v.elementAt(i));
public void process(String s)
//do whatever
}As far as validating against a database...and all the rest..what exactly is it you are doing,. what have you tried so far (code, between appropriate 'code tags' as demonstrated in the 'special tokens' link above), what error messages are you getting?

Similar Messages

  • Problems using Vector in Flex Builder 3

    I've been using Vector with no problems in Flash Builder Beta, but when I try the same thing in Flex Builder 3, the compiler throws a fit when I use it. 
    public function PuzzleEvent(type:String, pieces:Vector.<Sprite>, bubbles:Boolean=false, cancelable:Boolean=false)
         //handle PuzzleEvent
    The other strange thing is, Flex automatically adds this line when I use vector:
    import __AS3__.vec.Vector;
    An import shouldn't be necessary should it?  Vector is in the top level package right?  With or without that import statement, I get compile errors.  Has anyone else had such problems with vector in Flex Builder?
    Dan

    The only way I was ever able to solve this problem was to use Flex builder Beta and now Flash Builder 4.  I did target flash player 10.0.0, but I still never could get it to work.  At least it works in Flash Builder 4.

  • HELP-Problem with Vector type in Applet

    Hi,
    I am writing an Java applet which uses Vector. It won't run in IE browser, simply does not respond.
    However, when I tested the program using Appletviewer it runs prefectly.
    Is there a way to make Vector work in applet ?
    I have investigated the code and I'm pretty sure it's the Vector that causes problem in the applet.
    Pls your idea. Thanks.
    Hadi

    Hi,
    I use Applet, not JApplet. There are 3 deprecated things in this applet (mouseDown, keyDown, action) but I have used them all in my previous applet with no problem at all.
    I suspected the problem is Vector related by inserting several showDialogs as below:
    showDialog("1111");
    t.clear();     // to clear the vector
    showDialog("222222");
    I can see that the applet displays the 1111, but does not display 222222 at all. It seems like it simply ignores all commands after the first showDialog. Therefore, I suspect the t.clear() as the source of problem. But it does not display any error.
    't' is defined at the top as:
    static Vector t = new Vector();
    And t is manipulated by such: t.add(new Task()); and other regular Vector methods in jdk 1.3. I also checked that there is no deprecated methods for Vector from 1.2 to 1.3.
    I use MS Internet Explorer to run my applet.
    Any other things I should check ?
    Thanks.

  • Problems with vectors

    Hi,
    In response to an earlier problem i posted which i thought i had resolved i have to ask some more advice as i am still having problems.
    Basically i have two points (0,0,0) and (1,1,1) where two spheres are located, im trying to connect a cylinder to these spheres. I have tried using Pythagoras theorem and this connects the spheres up perfectly if the z value is assigned to 0 when i use the rotZ() method with the resulting angle. What i would like to know is there any way of connecting the spheres with 3 coordinates for x,y,z using the same method.
    The main formula i was working on was after connecting up the spheres in just 2 dimensions (ie z value equal to 0) as i mentioned earlier, was to calculate the length of the hypoteneus and have the z value divide this (ie using Pytagoras' theorem again tan teeta = z2-z1/c where c is the sqrt(x*x+y*y) ). Once i got this angle i then rotated it around the Y axis (im not sure if i am actually rotating it around the correct axis, i know that i also have to rotate around the X axis a certain degree but i dont know how much) however the spheres still did not connect up.
    Is it possible to do it the above way or do i need to do i need to use all vector calculations (dot, cross products etc) which i would prefer to stay away from?
    Sorry if it is not very clear it is kind of hard to explain!
    Any help would be greatly appreciated because it is really driving me nuts.
    Regards
    Andy

    Hi
    Just putting up the code to show how i am figuring out the angles and what rotations im using
              double tanTeetaXY = (y-0.0f)/(x-0.0f);
                   double teetaXY = Math.atan(tanTeetaXY);
                   double tanTeetaXZ = (z-0.0f)/(x-0.0f);
                   double teetaXZ = Math.atan(tanTeetaXZ);
                   double testang = (y-0.0f)/(z-0.0f);
                   double teetatest = Math.atan(testang);
                   rotate.rotZ((Math.PI/2.0f)-teetaXY);
                   temprotate.rotY(teetaXZ);
                   rotate.mul(temprotate);
                   temprotate.rotX(teetatest);
                   rotate.mulInverse(temprotate);
                   rotate.invert();Am i completely off with this or is there a better way to figure things out does anyone know? I just cant get my head around it!
    Much appreciated
    Andy

  • Problem creating vector mask with Pen Tool

    Using Photoshop CS5, Mac OS 10.6.8
    I'm trying to create a simple vector mask using the pen tool to create a curved line at the top and bottom of a photo. Here's what I'm doing:
    1. Create a new layer and select it.
    2. Select Pen tool.
    3. Choose "work path" by selecting button at top menu.
    4. I draw my shape with the pen tool.
    5. Now comes the problem... I can not select this shape, or assign it a color. When I create a clipping mask, it does not recognize my path. When I throw away the layer, the shape is still there in outline only. What am I missing here? I'm familiar with doing this in Illustrator, but I don't understand how it works in PSD.
    I need some help, please.
    Thanks.

    The main thing i use paths for in photoshop is extracting objects from photos.
    Other uses include stroking paths with the paint tools. For example, if you had
    a powerline to remove, one could trace the line with the pen tool and then stroke
    the path with spot healing brush set to content aware fill.
    more info on photoshop paths:
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-73ada.h tml
    MTSTUNER

  • Problem with Vector

    I have a problem in my socket program(trying to implement sliding window algorithm). Details are given below:
    I have declared a static member variable ServerWindow of type Vector in my socket program. I am adding all the packets receiving from the client
    to this vector. But whenever I am trying to add a new packet, it simply overwrites all the records in the vector. So my vector when displayed
    has the last packet for all elements. I have checked the received
    packet and its contents are OK.
    public void receive(DatagramPacket p) throws IOException {
    boolean KeepRunning = true;
    boolean KeepGoing = true;
    ServerWindow = new Vector();
    while(KeepRunning){
    try{
    while (KeepGoing){ 
    if (ServerWindow.size() <= 7){
    super.receive(p);
    if (isCorrectCRC(p)){
    ServerWindow.add(p);
    if (ServerWindow.size() == 7){
    for (i=0;i<ServerWindow.size();i++){
    System.out.println("In receive(): " + i + " " + new String( (byte[])ServerWindow.get(i)));
    }catch(SocketTimeoutException e){
    } //end of catch
    } // end of while
    } // end of receive method

    I think coz you keep redeclaring serverwindow in your method. Each time it creates a new Vector object.

  • Problem with Vector method addElement

    I am new to Java. I am using JDK 1.3. I am writing a program that will convert a text file to a binary file that stores a Vector object. I have narrowed my problem to the method that reads the text file and creates my vector. Each element in my vector stores an integer and a string variable. The reading of the text file works find and the creation of my record works find. It seems that the storing of the record in the vector is not working. When I print the first 10 elements of the vector, it have the same record(the last record of my text file). What is wrong with the method below? I am also appending the result of running my program.
    private static void readTextFile(File f) {
    try {
    FileReader fileIn = new FileReader(f);
    BufferedReader in = new BufferedReader(fileIn);
    String line;
    int i;
    SsnLocationRecord recordIn = new SsnLocationRecord();
    int ctr = 0;
    while (true) {
    line = in.readLine();
    if (line == null)
    break;
    ctr += 1;
    i = line.indexOf(" ");
    recordIn.putAreaNumber(Integer.parseInt(line.substring(0,i).trim()));
    recordIn.putLocation(line.substring(i+1).trim());
    records.addElement(recordIn);
    if (ctr < 11)
    System.out.println(recordIn);
    in.close();
    } catch (IOException e) {
    System.out.println ("Error reading file");
    System.exit(0);
    for (int i = 0; i < 11; i++)
    System.out.println((SsnLocationRecord) records.elementAt(i));
    RESULTS:
    C:\Training\Java>java ConvertTextFileToObjectFile data\ssn.dat
    0 null
    3 New Hampshire
    7 Maine
    9 Vermont
    34 Massachusetts
    39 Rhode Island
    49 Connecticut
    134 New York
    158 New Jersey
    211 Pennsylvania
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    680 Nevada
    C:\Training\Java>

    First of all it would be better if you did a priming read and then checked line == null in the while statement instead of the way you have it.
    ctr++ will also accomplish what ctr +=1 is doing.
    you need to create a new instance of SsnLocationRecord for each line read. What you are doing is overlaying the objects data each time you execute the .putxxxx methods. The reference to the object is placed in the vector. The actual object is still being updated by the .putxxx methods (NOTE : THIS IS THE ANSWER TO YOUR MAIN QUESTION).
    you close should be in a finally statement.
    To process through all the elements of a Vector create an Enumeration and then use the nextElement() method instead of the elementAt is probably better. (Some will argue with me on this I am sure).
    Also, on a catch do not call System.exit(0). This will end your JVM normally. Instead throw an Exception (Runtime or Error level if you want an abnormal end).

  • ReadObject and problems with Vector field

    hello.
    i'm trying to send an object(data Packet for a chat application) and receive it via sockets.
    every thing is right but there is a Vector field(online users list)that has some problems.
    my clients receive every updated class that contains new user list.but they just see the first received list?
    it's so strange to me because every thing else (such as color,font,size,..) works fine.
    can you help me?

    Every time you resend an object you have already sent, ObjectOutputStream will just send a 'handle', not the actual object. If it's changed value this is a problem. Use ObjectOutputStream.reset() to cause it to forget everything previously sent.

  • Logical problem using vectors

    Hi and Happy New Year,
    I have a vector in my java application which contains a number of elements that is not fix which means each time the number of elements might change.
    I want to retrieve the elements of the vector 3 by 3 its like table records paging in jsp , asp or php
    - lets say this time i've got 10 elements in my vector , I have to JButtons previous_3 and next_3
    - The first time the program runs I want to get the first three elements of the vector (0 to 2)
    - By clicking on the next_3 button I want to get the next 3 ( 3 to 5) and so on... providing that the exist
    - By clicking on the privious_3 button I want to get the previous 3 ( 0 to 2) in this instance and so on... providing that the exist
    Can anyone give me a hint as how to solve this problem at least give me some ideas cause i am lacking of ideas my brain is frozen, I know that is it more a logical problem that a programming one
    I 've done this kind of thing in Asp and PHP but as I am new to Java
    I just can not figure out how to tackle this issue

    You may want to use the modulus function.
    lets look at an example.
    pseudo code
    vector v = new vector()
    v.size = 10; //lets say there are 10 elements in the vector
    int n = 3; // you want to jump maximum 3 elements each time
    // you can jump 3.3 times before running outide the scope
    // of the vector, well after the third time you must check
    // how many elements that is left in the vector, this is
    // done by modulus n%10 = 1, this means that the last time
    // you can not jump more than 1 element.
    I have to go now so I cant give you any code to cope with the problem, Ill be back in 3 hours, maybe I can give a good axample, but this outline is the way to go.
    TheLaw

  • Problems postscript: vector graphics to FlexRip

    Hi guys, I have a very serious problem in my company often happens that generating a postcript with illustrator and passing through the dispatcher FlexRip Vers 12 (Esko), cause problems on the edges of the letters, vector graphics or parts of graphics, as if they were made hacksaw. PDF instead of going through this does not happen the problem is that for our needs we must use the postcript.
    This occurs sometimes in relatively simple work and very important this problem is totally random in different points, I use Illustrator CS6.
    Thanks very much for the answer
    (Very soon I will enclose a picture)

    I tried to save in. eps and generate the postscript but the error is always there, vector graphics ruined ...THE LAST 2 picture show error

  • Webservice Client deserialization problem with Vectors!

    Hello!
    I'm generating a Java Proxy Client with Eclipse WTP.
    The Client works fine with normal datatypes and own Beans. But whe the return type is a Collection with own beans an exception is thrown:
    exception: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
    So whats wrong?
    In teh Webservice Explorer everything seems to be fine, my vector is serialized in item-tags:
    - <getAktionenResponse xmlns="http://commonservice">
    - <getAktionenReturn>
    - <item xmlns="">
    <aktn_nr>a12345</aktn_nr>
    <claim>222</claim>
    <geschaeftsjahr>2005</geschaeftsjahr>
    <son>333</son>
    <special_operation_code>soc12345</special_operation_code>
    <status>ready</status>
    <vin>t123</vin>
    </item>
    - <item xmlns="">
    <aktn_nr>a6789</aktn_nr>
    <claim>567</claim>
    <geschaeftsjahr>2006</geschaeftsjahr>
    <son>555</son>
    <special_operation_code>soc6789</special_operation_code>
    <status>false</status>
    <vin>t123</vin>
    </item>
    </getAktionenReturn>
    </getAktionenResponse>
    how can i solve this problem?
    the background is that I return a vector with Java Objects. I thought apache axis deserielizes automatically the vector and the bean inside??
    I'm pretty new to webservices...
    Pleas help!
    Thanks!

    As per the below link, I assumed its better to avoid collections and go with plain array of objects.
    Please let us know if I am wrong.
    http://www-128.ibm.com/developerworks/webservices/library/ws-tip-coding.html
    Regards,
    Venkat S

  • Problems removing vector values

    Hi All,
    I�m trying to remove a value from a vector that i have previously created. The problem is that for some reason my code does not do anything as an exception or an error message when i try to remove this value. It seems that is not finding the value inside of the vector.
    Below i put a small piece of my code to see:
    // It Works fine for me
    HttpSession session = request.getSession();
    // Its working fine too
    // I can print the value
    Vector itens = (Vector) session.getAttribute("itens");
    // THIS IS THE PROBLEM . IT DOES NOT DO ANYTHING - Always return false or -1
    itens.removeElement(Atributo);
    // I still have the value into the vector
    Can someone help me how to remove a value from vector?
    thanks in advance
    Fabio

    Can someone help me how to remove a value from
    vector?The problem is not with the method (removeElement() or remove() are functionnally equivalent). If the remove method returns false, it only means one thing : the element 'Atributo' is not there.
    Therefore the problem lies where/how you are actually inserting that element.
    Did you debug it by printing out all the values in the vector ?
    If you printed all the elements in the Vector and found that value, it only means that you inserted it as a String (i.e "Atributo" instead of Atributo). In that case, try itens.removeElement("Atributo").

  • Problem with Vector.contains

    Hello,
    I wrote this code but it doens't work; but it should
    public class Word {
         public Word(String v) { _value = new String (v); }
         public Word() { _value ="";  }
         String _value = null;
         public boolean equals(Object obj) {
              if(this == obj)
                   return true;
              if((obj == null) || (obj.getClass() != this.getClass()))
                   return false;
              Word word = (Word)obj;
              return _value != null && _value.equals(word._value);                         
         public int hashCode() {
              int hash = 7;
              //hash = 31 * hash + num;
              hash = 31 * hash + (null == _value ? 0 : _value.hashCode());
              return hash;
    public class MyDictionary {     
         private Vector<Word> _words = new Vector<Word>();     
         Vector<Word> getWord() { return _words; }
    //other class
    MyDictionary dic = new MyDictionary();
                                    List< String > _testDoc = new ArrayList< String > ();
                                    //fill _testDoc
                                    Iterator<String> iter = _testDoc.iterator(); /
                                    for (int i=0; iter.hasNext(); i++ ) {
                               if ( dic.getWord().contains( new Word( iter.next() ) )) {
                                System.out.println("......................................");
                                     }I assure you (because I saw it) that _testDoc has words contained in dic; instes that if is never executed; probably I'm missing something simple....
    thanks
    Edited by: mickey0 on Aug 17, 2009 10:45 AM

    mickey0 wrote:
    Hello,
    I wrote this code but it doens't work; but it shouldIf it "doesn't work", then it's not supposed to work.
    mickey0 wrote:
    I assure you (because I saw it) that _testDoc has words contained in dic; instes that if is never executed; Can you post an SSCCE that shows this?
    mickey0 wrote:
    probably I'm missing something simple....This remark contradicts your earlier claim that it should work.

  • PROBLEM WITH VECTORS

    i NEED SOME HELP HERE. I HAVE TRIED DIFFERENT METHODS, BUT I CAN'T SEEM TO GET IT RIGHT
    int location = -1;///TODO: SET location = INDEX OF ITEM WITH A VALUE X
    list.remove(5);
    print("Item equal to 6 removed", list);
    ///TODO: ADD 9 TO LIST AT POSITION 2 AND ADD 123 TO END OF LIST
    list.add(new Integer (99));
    print("Added 44 at 4 and 99 at end", list);
    add1ToAll(list);
    print("1 added to each", list);
    static void print(String message, Vector v)
    System.out.print(message + ": {");
    for(int i = 0; i < v.size() - 1; i++)
    System.out.print(v.get(i) + ", ");
    System.out.println(v.get(v.size() - 1) + "}");
    static void add1ToAll(Vector v)
    ///TODO: ADD 1 TO EACH NUMBER IN VECTOR v

    1) are you using the (new Integer()); I think that there is a difference between Integer and int;
    2) I found that using a Vector with images is easier if you add it as a String like this (vector.add(""+foo));
    and then convert it back upon usage eg.
    int x = Integer.parseInt((String)vect.get());
    or something like that. I am not around my development
    enviroment at this time.
    --Ian                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem returning Vector in Bean Model

    Hi All,
    I am returning a Vector from my bean.I have a EJB which connects to an RFC.To use this EJB, I have created a java bean(plain java bean) which executes this RFC in the EJB.The result is returned by the RFC in a SAP Table.I extract all returned data in a Vector in my java bean.When i create a Model from this java bean jar file , I am able to get the string variables which i had defined in my bean and am able to map them to my Controller context but am not able to map my Vector which contains the outpout.
    Could you please let me know how i can map the vector from the model to the context.I dont get the option of choosing the vector for mapping when i am creating the Model.
    Thanks a lot.
    Saurav

    Hi,
    Normally, the MApping does not leave out the context attributes in this fashion.
    Anyways, a DTO is simply a class that groups all the parameters of a method together in one class. For Example:
    Original: public void someMethod(String one, int two, Vector three, Employee four){
    //code
    New: Create a class called Something.java with attributes:
    public class Something{
    String one; int two; Vector three; Employee four;
    // blank constructor, parameterized constructor and getters and setters for attributes are all necessary
    Finally re-expose the web service and  reimport the model.
    You will se the parameter.
    Note: The main reason that you are not seeing the Vector class is probably because you may not have a DTO with a blank and parameterized constructor in the EJB.
    Hope that helps.
    Thanks.
    p256960

  • Problem loading vector EPS images

    Hello All-
    I'm having trouble loading vector EPS files (created in Adobe Illustrator CS2) in the data manager (version 5.5.34.46). I have Photoshop CS2 installed and have run the registry compatibility update. When I select the image to add to my data group, Photoshop launches (usually..) to load the preview image but when I say OK, I get one of the following errors:
    1. Illegal value for parameter (within Data Manager)
    2. Unspecified error (within Data Manager)
    3. Microsoft Visual C++ Runtime error (within Data Manager)
    4. Virtual function call failed (within Photoshop)
    I am able to load TIF images although the preview images do not display correctly but I do not want to rasterize my existing vector EPS files.
    After setting the images to RGB color space, I was able to do 2 or 3 EPS imports but it took several attempts and has since not functioned at all. The properties on these files show that they are in fact vector and they work downstream in Publisher and InDesign. This is how I'd like them all to work.
    Any suggestions on how to make this work? Are vector EPS files supported?
    Thanks
    Tim

    Tim-
    Before upgrading to the latest hotfix, I did get a couple vector EPS files to load, and the preview did exist in Data Manager and Publisher. Trouble was, I couldn't consistently load the images without errors. Now I can load the images, but lost the preview. For the time being, this is the lesser of 2 evils.
    I do not have any variants defined at this point so I can verify that linked images do NOT get published to InDesign (unless there is another setting I haven't found to force MDM to use Originals).
    All of the raster graphics I tried (TIF & JPG) work just fine in Publisher and InDesign but as you probably know, vector graphics are the smaller and produce better results for DTP applications so they are preferred, if the choice is available.
    If you're going to load SP05 right away, please post any findings that relate to these issues.
    Thanks for your help.
    Tim

Maybe you are looking for