Problems with adding something to an array

I am trying to find out what I am doing wrong, I think I am way off...I am trying to take two different strings, compare the one to the other and see where the source is equal to the target at any place in the the source. Then I am to add that index to an array list, this is where I am having issues, after the AddArrayList() and putting the index of the match into the array. Please, I have been at this for a while...
this is what eclipse tells me...
Multiple markers at this line
- Syntax error on tokens, Expression expected instead
- Syntax error, insert "AssignmentOperator Expression" to complete Assignment
- Syntax error, insert ";" to complete Statement
- Syntax error on token "(", Expression expected after this token
- The type of the expression must be an array type but it resolved to
ArrayList<Integer>
*Find all indices in <tt>source</tt> that are the start of a complete*
match of <tt>target</tt>.
*@param  source  != null, source.length() > 0*
@param  target  != null, target.length() > 0
*@return  an ArrayList that contains the indices in source that are the*
start of a complete match of target. The indices are stored in
*ascending order in the ArrayList.*
public static ArrayList<Integer> matches(String source, String target) {
// check preconditions
assert (source != null) && (source.length() > 0)
&& (target != null) && (target.length() > 0): "matches: violation of precondition";
ArrayList<Integer> result = new ArrayList<Integer>();
int sLength=source.length();
int tLength=target.length();
int count=0;
for(int x=0; x<sLength; x++ )
if ((tLength+x)<(sLength))
for (int y=0; y<tLength; y++)
if(target.charAt(x+y)==source.charAt(x+y))
if(y==tLength)
AddArrayList();
[ArrayList]<int>.add([x]);
count++;
return result;
private static void AddArrayList() {
ArrayList<Integer> result = new ArrayList<Integer>();
int index = 0;
result.add(index);Edited by: camdiggy on Sep 16, 2009 12:55 AM

the problem i encounter is on if(y==tLength)
    public static ArrayList<Integer> matches(String source, String target) {
        // check preconditions
        assert (source != null) && (source.length() > 0)
             && (target != null) && (target.length() > 0): "matches: violation of precondition";
        ArrayList<Integer> result = new ArrayList<Integer>();
        int sLength=source.length();
        int tLength=target.length();
        int count=0;
        for(int x=0; x<sLength; x++ )
             if ((tLength+x)<(sLength))
                  for (int y=0; y<tLength; y++)
                       if(target.charAt(x+y)==source.charAt(x+y))
                            if(y==tLength)
                                 AddArrayList();
                                 [ArrayList]<int>.add([x]);
                                 count++;
        return result;
    private static void AddArrayList() {
         ArrayList<Integer> result = new ArrayList<Integer>();
         int index = 0;
         result.add(index);
Edited by: camdiggy on Sep 16, 2009 1:12 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Problem with adding Sun JSF RI v1.2 as a new library in JDeveloper 10.1.3.1

    Hi,
    I have a problem with adding a latest JSF 1.2 RI from Sun (https://javaserverfaces.dev.java.net/files/documents/1866/44998/jsf-1_2_03.zip) to JDeveloper as a new library.
    I created a new User library and added into it jsf-impl.jar and jsf-api.jar from JSF 1.2 RI.
    Then I try to create two new JSP Tag libraries based from .tld files.
    When a .tld file is placed in "TLD File:" field there is no information below about Library Version and Required JSP Version. If I check "Execute Tags in JSP Visual Editor" and click "Customize" button - list of tags in "Customize Tag Library" window is empty.
    I have errors when I try to use JSF Tags from this new library in JSP page like :
    "Can't create tag instance: f:view (class: null). Make sure, that the tag class or a library contained this class is available in this application"
    (free translation to English)
    Is this possible to add JSF RI v1.2 as another library in Jdeveloper 10.1.3.1 ?
    thanks for help
    koli

    Hi,
    This solution is not exactly for Jdeveloper 10.1.3.x I think.
    - "Create a JSF system library." section, point 2. - there is not possible to add library in folder other than User I see, so I added it in User folder.
    - "Register the JSF JSP tag libraries." section, point 5. - in JD 10.1.3 there is no dialog box, I checked checkbox "Show Tag Library in Palette". A new library was added to User folder but there is no new libraries in component Palette.
    Even as I use "Edit tag libraries .." from Component Palette context menu and add manually new tag libraries to selected, there is no libraries in Component Palette after it.
    I feel so problem is with different .tld files format, not with adding libraries method.
    Sun RI tld file (from version 1.2_03) fragment:
    <taglib xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
    version="2.1">
    <!-- ========== Tag Library Description Elements ========================= -->
    <description>
    The core JavaServer Faces custom actions that are independent of
    any particular RenderKit.
    </description>
    <tlib-version>1.2</tlib-version>
    <short-name>f</short-name>
    <uri>http://java.sun.com/jsf/core</uri>
    tld included in JD:
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <!-- ========== Tag Library Description Elements ========================= -->
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>f</short-name>
    <uri>http://java.sun.com/jsf/core</uri>
    <description>
    The core JavaServer Faces custom actions that are independent of
    any particular RenderKit.
    </description>
    Did JDeveloper 10.1.3.x maintain with taglib version 1.2 ?
    Regards
    koli

  • [SOLVED] Problem with adding a SSH connection to startup

    Hi guys. I have a problem with adding ssh connection to startup. i want this command to run before kde login screen  and keep running all time.
    ssh -D 9292 remoteuser@remotehost
    but it doesnt connect. Thanks for help!
    Last edited by alperenel (2011-03-11 00:10:27)

    cactus wrote:
    ssh -fN -D 9292 remoteuser@remotehost
    you need -f, which sends ssh to the background, and -N which does not execute a remote command.
    If you need it to run as a user other than root, then you probably need to utilize su as well.
    it didnt work either. i am putting it in rc.local but doesnt work.

  • Problem with adding new field to the mass change screen in FBL5N

    Hi,
    We have a problem with adding the field XREF3 to the mass change screen. We followed steps described in the SAP Note 640908, but the result is that when we try to mass change some documents in FBL5N and enter some values in the mass change screen, a message appears: "Please enter at least one new value" and nothing is changed.
    If you have faced with such a problem, we would be grateful if you give us some tips.
    Regards,
    Miłosz Włodarczyk

    The problem has been resolved: we didn't activate a code in SE80.

  • Problems with adding Library for a MySQL JDBC driver

    Good day,
    I am new with the JDeveloper package, so the following could be a user fault.
    I found the following:
    - I downloaded and installed Oracle JDeveloper 10.1.2.1.10 (latest version).
    - I downloaded the latest JDBC drivers for MySQL. ( mysql-connector-java-3.1.10 )
    Now, I did the following steps extracted from the link http://www.oracle.com/technology/products/jdev/tips/duff/mysql_and_oc4j3.html it should be quite easy to add the JDBC Drivers to the project.
    I did the steps with the following results:
    When I Edit the Project properties, follow Profiles -> Development -> Libraries
    When I do ' New' , fill in at JS2E the value 'MySQL' and fill in the Class Path (in my case 'C:\javaInstalls\mysql-connector-java-3.1.10\mysql-connector-java-3.1.10-bin.jar').
    In that case the [OK] is disabled. I should expect the [OK] button was enabled!
    My question: Is this a bug? When not, what am I doing wrong!
    Regards,
    Mike

    I tried it on an other system and had no problems with adding the libraries. It still is a problem on that particular system using the Dutch version of XP. The problem is that the Ok button stays disabled !
    Could it bw a version problem with Java? How ever no changes are made to the original configuration, so it should pick up as default the java version of JDeveloper self.

  • Problems with adding funds

    Hey guys , I have a problem with adding funds in my PSN account with my debit card . I have used the same card in the past with no problems at all but now for some reason it keeps on saying that the card number is invalid every single time ! Please help me , is there any solution ? Does it maybe has to do with Capital Control ( I live in Greece ) 

    Thanks I use this
    2.) You can make one of your buttons the default
    button of the frame:
    this.getRootPane().setDefaultButton(confirm);
    well, did you implement the first suggestion of quitte?
    here is an idea that might work!
    JTextField username;
    JPasswordField password;
    JButton confirmButton;
       username.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
             password.requestFocus();                    
       ActionListener l = new ActionListener(){
          public void actionPerformed(ActionEvent ae){
             //optional check for username and password length>0
            //process logon.
       password.addActionListener(l);
       confirmButton.addActionListener(l);

  • Problem with adding artwork manually in itunes

    I'm having trouble manually adding artwork to several albums in itunes 10.7 on macbook pro (the 'get album artwork' facility won't pick these discs up presumably because they're too obscure).
    I go to 'get info', select the relevant check box, then add a  non-read only, apparently normal jpg to the artwork box. This image then displays successfully in the artwork box, I press ok, but when I return to the albums list it won't display at all. This has been consistent problem that I haven't only experienced in this version of itunes and it's very irritating having just a few blank albums that refuse to change.
    Any ideas what might be causing this. Or is there a workaround or an alternative method I can use to add artwork?

    Thanks both for the responses.
    Limnos - I can't find an equivalent 'show artwork' function in the view menu in my version of itunes, and I'd rather not have step back to an older version of itunes if I can avoid it.
    BUT having thought about it I think the root of the problem must be that they are all albums with .flac files that have been imported into itunes using the 'Fluke' software. I suspect this might be what's causing the problem - and I'm wondering whether that means the problems with Fluke itself. It's annoying that there isn't a quality music player on mac that handles .flac and I have to use these crappy converters.
    If anyone has an idea about how to solve this please pitch in, but I suspect this goes beyond the remit of these forums.
    och well.

  • Problems with the output of an array

    Hallo,
    I have got problems with giving out an array.
    I declared two arrays and puted them out, but with the
    resultarray it doesn�t work. Cansomebody help me?
    Here is a runtime output:
    Grad eingeben!
    1
    Koeffizienten eingeben!
    1
    2
    1x^0 + 2x^1 +
    1
    Grad eingeben!
    3
    Koeffizienten eingeben!
    2
    3
    4
    5
    2x^0 + 3x^1 + 4x^2 + 5x^3 +
    3
    p:1
    this:3
    And here is the source code
    // Die Klasse Polynom dient dem Umgang mit dem Polynom
    //Sie enth�llt die Methoden:
    //   > public void readCoeffizients()
    //   > public void show()
    //   > public int getGrad()
    //   > public Polynom add(Polynom p)
    //Und den Konstruktor:
    //   > public Polynom(int  n)
    public class Polynom
      private int grad;
      int [] coeffizient;
      private Polynom q1;
      public Polynom(int  n) //Konstruktor mit Stanard-Initialisierung
        this.grad = -1;
        this.coeffizient = new  int [n+1];
        for(int i=1; i<(n+1); i++)
          this.coeffizient[i] = 0;
      public void readCoeffizients() // Methode zum Einlesen der Koeffizienten
        this.grad = (coeffizient.length)-1;
        System.out.println("Koeffizienten eingeben!");
        for(int i=0; i<(grad+1);i++)
          this.coeffizient[i] = Eingabe.intValue();
      public void show() // Methode zum Ausgeben des Polynoms
        for (int i=0; i<(this.getGrad()+1);i++)
          System.out.print(coeffizient[i] + "x^" + i + " + ");
        System.out.println();
      public int getGrad()
        return this.grad;
      public Polynom add(Polynom p) // Methode zum Addieren zweier Polynome
        System.out.println("\np:" + p.getGrad());
        System.out.println("this:" + this.getGrad());
        if(p.getGrad() >= this.getGrad()) // Vorgehen falls p.getGrad() gr��er als this.getGrad()
          q1 = new Polynom(p.getGrad());
          grad = p.getGrad();
          for(int i=0; i<(this.getGrad()+1);i++)
            q1.coeffizient[i] = this.coeffizient[i] + p.coeffizient;
    for(int i=(this.getGrad()+1);i<(p.getGrad()+1);i++)
    q1.coeffizient[i] = p.coeffizient[i];
    else // Vorgehen falls this.getGrad() gr��er als p.getGrad()
    q1 = new Polynom(this.getGrad());
    grad = this.getGrad();
    for(int i=0; i<(p.getGrad()+1);i++)
    q1.coeffizient[i] = this.coeffizient[i] + p.coeffizient[i];
    for(int i=(p.getGrad()+1);i<(this.getGrad()+1);i++)
    q1.coeffizient[i] = this.coeffizient[i];
    return q1; // R�ckgabe des Ergebnisspolynoms
    // Diese Klasse testet die Klasse Polynom
    public class Test
    public static void main(String[] args)
    System.out.println("Grad eingeben!");
    Polynom p1 = new Polynom(Eingabe.intValue());
    p1.readCoeffizients();
    p1.show();
    System.out.println(p1.getGrad());
    System.out.println("Grad eingeben!");
    Polynom p2 = new Polynom(Eingabe.intValue());
    p2.readCoeffizients();
    p2.show();
    System.out.println(p2.getGrad());
    //Polynom p3 = (p2.add(p1));
    //p3.show();
    (p2.add(p1)).show();
    Thanks for your help!

    Ehm, this should really be obvious: because in the
    first two cases you are using the constructor
    and readCoeffizients(), whereas in the third
    case you are only using the constructor.You?re right, but I initiate grad in the add method.Then look again: you don't! You are calling the constructor, but the constructor is not assigning grad in a proper way. If you are refering to the line grad = p.getGrad();this is in fact equal to this.grad = p.getGrad();But this.grad is not q1.grad (which is private). Assign grad in the constructor only (where it belongs) or better still don't use grad at all and derive the degree of the polynom from the length of the coefficients array.

  • Problem with adding text to photos in PE6 on my iMac

    I can't seem to add text to any photo. I have a new iMac, installed PE6, and all other features seem to be working fine. I even reset all tools to default just to be sure I didn't tweak something. When I click on the Text tool and click on a photo, a small square appears (almost like a dot) and nothing appears when I type...however a new Text layer appears in the layer manager. Doesn't matter how large I make the text...it does not show up. Tried rearranging the layers..every trick I could think of. Anyone else ever have this problem?? Any suggestions greatly appreciated! I really hope I'm just have a serious brain twitch here and that's it's not a PE issue. Never had this problem with any Photoshop programs on my PC...
    Thanks!

    Hi Barbara
    Thanks for your response. I am trying to add text to cropped and edited photos, they are 4x5 and 300dpi. I went ahead and tried increasing font size to 200, still nothing. I've tried all types of images, from my original raw versions to ones edited down to web size, to no avail.
    I'm beginning to feel like I'm banging my head against the wall :)

  • Problems with Adding Fields/Columns to Crosstab in XI

    Post Author: ph03nix
    CA Forum: General
    I am having problems with formatting a crosstab report in CRXI and am hoping that someone has a solution. 
    The crosstab report is a subreport, and requires the following columns, grouped by Firm (also not working optimally, but at least working):
    Evaluator,   Factor1Rate,&#91;Factor2Rate, .., FactorNRate&#93;, Summary, UpdateDate, UpdatedBy
    Where:
    Evaluator is the person that did the evaluation that resulted in each rating (formula field)
    Factor1Rate, etc, may have one, many, or all of these be applicable - there can be up to 15 of these.  Each FactorRate column is to  display the "rating" given by the Evaluator in the corresponding row/column (this much works).  The table heading is a formula, but the corresponding rate is not.
    Summary should display "Complete"  if and only if there is a Comment field (not displayed) filled out for each FactorNRate that has a value of 0, 1 or 5 - otherwise it is blank
    DateEntered is one of 2 fields ("last_updated" , or "creation_date" if  last_updated is null - a formula field)
    UpdatedBy is the last name of the person who last touched the ratings (formula field)
    I have gotten the FactorRates to display in the headers, and gotten the corresponding rates to display underneath them, but I cannot seem to add any other columns to the report - they are either added as headers with the factor_rating columns repeated as subgroups (with incorrect data), or are added under existing headers with duplicates of the ratings.  I just want to add one column for each field as if it were a normal (non-crosstab) table. 
    TIA!

    the 3 last files
    Attachments:
    Z1&Z2.vi ‏19 KB
    tau_inn (SubVI).vi ‏16 KB
    tau_ut (SubVI).vi ‏10 KB

  • Problems with added music sound tracks

    Please Help. My music sound files added to iMovie 09 are stuck on full volume and when I close and re-open my project the sound has slightly shifted and is out of sync with the video. The project is over 1 hour long with many varied added sound effects.
    I would really appreciate any help
    Thanks
    Joe

    If you go to page 8 of this forum, you'll see that over 1,200 of us have experienced basic audio problems with iMovie 09. I guess you should pick and choose your solution from those who responded on that post...(?)

  • Problems with adding iphone 5 to itunes match

    Hello, I am having problems with getting my new iphone 5 to sync up to the itunes match.  I currently have 2 itunes accounts, 1 in the Chilean itunes store and 1 in the USA store.  Accidentally I registered the iphone to the Chilean store, however I have my itunes match in the USA store.  Apparently I need now to wait 90days in order to change the account that the phone is registered.  Is there any way around this rule?  I am missing my music!!
    Many thanks,

    redalong wrote:
    I have a music folder I want to add. The files are WMA so they should work.
    iTunes for Mac does not handle WMA. You need to either convert those in iTunes for PC or get something like EasyWMA.

  • Problems with adding IOS IPS to IPS MC

    Hi,
    We are having problems in adding Cisco IOS IPS (Running on Cisco 1701,12.3(14)T2) into IPS-MC (Version: 2.1.0).
    The IPS MC is able to create the Trust Point on the Router and the Router is also able to download the IPS-MC certificate chain. However after that the process fails with the error
    ++++++++++++++++++++
    Import of sensor x.x.x.x failed.
    Error : Error importing configuration files from the sensor - Unable to import sensor config from IOS IPS: null
    ++++++++++++++++++++
    Any ideas ?
    Thanks \\ Naman

    I am having the same issue and open TAC case for several days..with 1841 and 2811's..same software and IOS
    It works with advipservices but not with advsecurity

  • Nokia n97 problem with adding last widget

    Hi all, 
    After updating my software to v 21.0.045 i found my phone is working better than before with one exception. I can't add the last widget on the main screen. It can only let me change wallpaper?!?
    I tried to reset using phone, using code, restarting a few times etc Nothing helped.
    I even sent a message to Nokia helpline explaining all what has happened and they send me a silly email back with simple ""use "add content" in order to add widget to your mainscreen ""
    Somebody help! If you know how to add the last widget please let me know. 
    Ps 1. I didn't have this problem with my old software
    Ps 2. I attached a photo to prove it
    Attachments:
    nokia.jpg ‏106 KB

    If you do it , do another soft reset , back up Contacts, Calendar and Notes ONLY (your settings can cause conflict between new and old software, which is why this is advisable) Dial *#7370# followed by 12345, then set up your phone again manually, a bit of work, but should get the phone working like new !
    Good Luck
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Problems with adding new Podcast on iTunes

    Hello, I'm Sousuke Sagara,
    I am having a problem with my xml page, i have done all the stuff on the Podcasts Tech page,
    I'm getting this error:
    "This feed has no episodes"
    And i have it all correct according to the Tech page ._.
    This is the Episode infomation:
    <item>
    <title>MGOF Podcast 1</title>
    <itunes:author>Metal Gear Online Forums</itunes:author>
    <itunes:subtitle>Our First Podcast</itunes:subtitle>
    <itunes:summary>MGOForums.com kick off our first Podcast with a test run which includes a brief history of Razzle Dazzle Unit and Fujita 6, a weekly update of the doubles tournament, and Mlopes chats about playing Blood Bath</itunes:summary>
    <enclosure url="http://www.mgofpodcasts.sandasu.net/podcasts/1.mp3." length="47572241" type="audio/x-mpeg" />
    <guid>http://www.mgofpodcasts.sandasu.net/podcasts/1.mp3</guid>
    <pubDate>Wed, 18 Feb 2009 02:52:00 GMT</pubDate>
    <itunes:duration>49:33</itunes:duration>
    <itunes:keywords>Metal, Gear, Solid, Online, Forums</itunes:keywords>
    </item>
    If their is anything incorrect about this then please tell me.

    In the <enclosure> tag, which iTunes uses to locate the media file, you have a period at the end, after the 'mp3' - this invalidates the URL and produces a 'file not found' error, hence the 'no episodes' complaint.

Maybe you are looking for

  • Display Issues with mini (Mid 2010) and LG L246WP

    I recently purchased a new mini (Mid 2010 base model) and planned to use it with my 24" LG L246WP monitor, which is about 3 years old. The monitor has VGA, component, and HDMI inputs. I used an HDMI-to-HDMI cable to connect the mini directly to the m

  • Bar and Pie chart  display with values

    Hi All... I want implement the my swing application Bar and Pie chart functionality with vales, If both are disply same veues. Thanx to Advance Arjun

  • What to do with Time Capsule when not using for Wireless Internet

    I previously connected my Time Capsule to my fiber optic router but in my no home this is no longer needed as the cable TV company now provides 160 MPS Internet in a router that contains a wireless router built in. It works fine.  My computer is now

  • Career in Database kernel development

    How is the career future in Database kernel development, such as index, locking, transaction managements? It seems to me that the DB kernel is quite stable. Are there many opportunities in this area? Thanks.

  • Question about Croppign

    I have a very simple question, but I am a newcomer to using Premiere. I have .mov files that I have imported into premiere elements 9. The files are 640x480 and when I "share", the clips produced have a black line around the edges. When I share, I am