Dynpro - recursive routine

hello all,
I have created dynpro to update data in ztable.
on selection screen i have to enter parameter for customer no. (kna1-kunnr).
Now everything is working fine. but after saving data , on selection screen when
i enter customer no and press F8 immediately programme is throwing out.
so at a time i can enter data for single customer only.
can anyone suggest me what should i write for recursive routine.
thanks & regards,
viraj

santhosh,
this is my coding.
selection-screen begin of block b1.
PARAMETERS: p_kunnr  TYPE kna1-kunnr obligatory.
selection screen end of block b1.
START-OF-SELECTION.
   CALL SCREEN 100.
END-OF-SELECTION.
(NONE)
regards
raj.

Similar Messages

  • Moving a layer group should not incure a performance hit (init a set of layers vs recursive)

    I have finally taken the time to understand the behavior of the slughish performance of moving layer groups.
    On my computer in CS6:
    1. If I have just 2 layers in a layer group. Selecting both of them and ctrl-dragging them around is smooth and responsive.
    2. If you have however select the layer group which contains just these 2 layers, the performance is obviously and terribly impacted. The drag is slow and choppy. With just 2 it is unbearable with regards to workflow but with a large layer group the performance it is utterly unusable. I am now looking to test what occurs in older versions.
    I am a programmer. Not only that, I am a programmer who regularly targets 16 milliseconds on the scene and model graph. Learn to code and learn to program with hitting a 16ms user experience. That means abstraction culling to perform a minimum number of operations for a feature vs inertia, not the logically beautiful and sound abstractions we all would love to have on infinite computation. That's the reality of performance optimization. Performance optimization should be refered to as abstraction culling because that's what it is.
    It should not make any logical difference how a set of layers is initilized for a transform. Please initialize the arrayed set of layers from the hierarchy of groups instead of executing your obviously flawed and unoptimized recursive routine.

    I'm just not seeing a difference in performance between dragging a single layer around, multiple individually selected layers together, or a whole group of layers (where the group is what's selected in the Layers panel).
    I tested on both Photoshop CS6 and CC.  I'm on Windows 8.1.  And I can honestly say I've never seen the layers panel scroll slowly.
    That's not to say I'm seeing instantaneous, smooth moves of layer data - with a sufficiently large image, the update rate goes down to where the frame rate of moving things is quite visible - e.g., 4 or 5 frames per second - but that's still interactive, and it has always been like this with Photoshop as far back as I can remember.  If anything, moving data around has gotten a bit snappier in Photoshop CC.
    You may well have something specific going wrong on your system, or with your particular document.
    Why not post a copy of a specific test image on which you can reproduce the issue, and that you'd like others to test with.  I'll be happy to drag layers and groups around in it and report back.
    That reminds me, I need to get software installed to capture my desktop as a video, as I need to make a training video soon.
    -Noel

  • Dynpro call during processing -- Without PBO, Dynpro remains visible

    Hello!
    My problem is as follows:
    During the build of a tree hierarchy, i check how long the work is going on since starting the process. If work lasts longer than an amount of time, i interrupt processing and call a function that calls a Dynpro. After leaving to screen 0, I continue processing but as no pbo is called, the before called Dynpro remains visible on screen until procession finished and a pbo is executed by system.
    Is there any possibility to tell the Dynpro to disappear before PBO?
    Many Thanks in advance,
    Thomas

    Hi Arnab!
    Thanks for the fast reply!
    But that's not the problem.
    I'll try to show you what I've got:
    In ABAP-Objects I've got a manager class that runs a method M.
    In this Method M I'm extending a CL_GUI_ALV_TREE-Object by adding nodes recursively. In the recursive method I check if some conditions are false, and if so, call an ABAP-Function that calls a Dynpro. After leaving this Dynpro (by using leave to screen 0), the PBO of the parent Dynpro is not processed because process is still inside the recursive method. The update is done not before Method M and the recursive Method have been fully processed.
    Method M.
    loop at nodes.
    call method build_nodes_recursively.
    endloop.
    endmethod M.
    Method build_nodes_recursively.
    if condition is false.
    call function D. //Function call that calls Dynpro
    if function_call_d is true.
       return.
    endif.
    endif.
    call method build_nodes_recursively. //recursive call.
    endmethod build_nodes_recursively.
    Maybe you understand my problem now?
    Because there's no PBO of  the parent Dynpro, recursive progress goes on after closing the child Dynpro but the child Dynpro is still visible until Method M is finished and PBO of the parent Dynpro is processed.
    Thank you for helping,
    Thomas
    Edited by: Thomas Hostnik on Jul 15, 2009 2:14 PM

  • Can someone tell me if there's a problem with my recursive file search?

    I've been trying to get a recursive file search working. I wanted to go through each directory and add every file to a database so I can use extremely fast, advanced file searches through my program. I wrote up this code
    <CODE>
    package myrecursive;
    import java.io.*;
    public class MyRecursive {
    public static void main(String[] args) {
    recursiveSearch("D:/");
    private static void recursiveSearch(String x) {
    String tempFile="";
    File dir = new File(x);
    File[] curDir = dir.listFiles();
    for (int a=0;a<curDir.length;a++) {
    if (curDir[a].isDirectory()==false) System.out.println(curDir[a]);
    else {
    tempFile=curDir[a].toString();
    recursiveSearch(tempFile);
    </CODE>
    The code was simple but I didn't think I could write it like this without killing my resources or getting a buffer overload. I ran it and it worked. However, I am running a high end box with 512MB of RAM and a 2.4 GHz processor so I don't know if what worked for me will work on a lower end machine. I was told you should avoid calling a method from itself is this true? How would I avoid it? Should I keep it this way? Any recommendations?
    NOTE: I ran the code through JBuilder. JBuilder has a console built into the IDE and will return a noise and the error code whenever it hits an error. Although my app kept shooting out files it found out I heard a noise a few times. Does this mean anything?

    First the formatting tags should be "[ ]" not "< >".
    I was told you should avoid calling a method from itself is this true?Recursion is a valid programming technique and in fact makes many algorithms much easier to code.
    so I don't know if what worked for me will work on a lower end machineIt may be a little slower but it will still work. Recursion only causes a problem with resources when you have many levels of recursion. On my system I have:
    C:\WINDOWS\TEMP\Temporary Internet Files\Content.IE5\
    In this case there is only 4 levels of recursion. This is not going to cause a problem. You would generally only have problems if your recusion routine is not working correctly and you get in an infinite loop which will lead to resource problems and an abend.
    In your particular case you aren't even using many resources at all since all you are doing is printing the file name.
    This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=435487&start=3&range=1]post shows a recursive routine that list all files for a directory and displays them in a table. In this cause you might have a problem with resources depending on the number of files in the directory. But the resource problem is because of the memory to hold the filenames in the table, not because a recursive routine was used to get the filename.

  • Please help with Boggle game

    The Input
    The input file is exactly as in WordSearch.java and in fact, you can reuse almost the entire program, especially the routines to read the word and puzzle files. In order to limit the amount of output words that are less than nine characters are not to be considered matches.
    Strategy
    First, provide a Position class to store a row and column as a pair, and provide a constructor, toString, and equals (hashCode would also be good to have, but is not needed). Make sure Position is an immutable type.
    Next, change solvePuzzle to solveBoggle as follows:
         * Routine to solve the Boggle game.
         * @return a Map containing the strings as keys, and the positions used
         *     to form the string (as a List) as values
        public Map solveBoggle( )
            Map results = new HashMap( );
            List path = new ArrayList( );
            for( int r = 0; r < rows; r++ )
                for( int c = 0; c < columns; c++ )
                    solve( new Position( r, c ), "", paths, results );
            return results;
        }Observe that solveBoggle calls the routine solve for each position in the grid. solve is recursive, and implementing it is virtually the entire assignment. After you implement solve you should have a routine that can print out, in a nice form, the Map returned by solveBoggle.
    The specification for the recursive solve routine is:
         * Hidden recursive routine.
         * @param thisPos the current position
         * @param charSequence the characters in the potential matching string thusfar
         * @param path the List of positions used to form the potential matching string thusfar
         * @param results the Map that contains the strings that have been found as keys
         *       and the positions used to form the string (as a List) as values.
        private void solve( Position thisPos, String charSequence, List path, Map results )
            /* Less than one page of code will do it. */
        }In implementing solve you will want to do the following:
    Attach the character at thisPos to charSequence.
    If the resulting current string is not a prefix of any word in the dictionary, you can return.
    Otherwise, you will want to update the path variable, and look for some matches.
    If the current string is a word in the dictionary you want to update the map.
    In any event, you want to recursively call solve with appropriate parameters, on all adjacent positions, skipping those that have already been used in the current string, and being careful not to wander off the end of the board.
    Don't forget to update the path variable when you return from solve.
    Copying and Cloning
    As much as possible, you should avoid making copies of variables. In particular, the last two parameters to solve (the List and Map are to be the same object for each unique invocation of solveBoggole. YOU MAY NOT MOVE THEM TO BE CLASS VARIABLES. However, what this means is that when you put a String as a key and a List as a value into the Map, you will need at that point to make a copy of the List, since otherwise the Map would simply be storing lots of references to the same single list (which would be empty at the end of the program). You can use any of the List (subclasses) constructors to create a List from another List.
    This is the puzzle file:
    fozepdkdnqlhfejdzksccfykdxnlorwvfwavbmyqclxjrgntqhvuowgrtufhnbdt
    zfqatqryeqhxxuqpdmmsksjdooncssvrznssflsjbahawxsalesvwdblsqpkimdj
    zxdeiwqmwxouwgukkmfjqiwkynwizztyxxehtuvrtklqsgaduhomsmyszwbywwyv
    teeozafumtmebojvwxkqliimhlmfikabpgsqizkuszztnirlibbtlkgsvuzdfbhw
    iboqaaltzkmnsdycgawukeohyonfpwdxxrqxubqtnfghkhkrhintobcorpwhlzgi
    tyinbyiofryqykjhswcizgwrwsajuiuphceicmzifxyfjhodfqlexhxvcxgyganp
    erxhfyrnxpsgyhjdzuhyefviecgkcvbhozqvzhixyddwkpzllikrpfzuhhgmeivu
    jlqiuafsdlopapbnxlfnsehaopmsxjpgufpofwglhwajlbxkmcxfighwwvrtegca
    nroupwfxugifhfpwjpdsxmqthjpnrrngkdbzbgyvojcwqtuakzuilmbuyshplwwv
    bzxcfxzugdszwozhnvryhushnbxyxvwyuvcbsbxbgpccfblsyeshzmpmnommjimf
    fogarebxvdcbgpvguonvachqsvebgrglhplbvoaqtetzuphqdvlfzuxsrcvxvele
    twfolgggmaigppyumlbmhzgzdbwyfhcagiqtqxzcxhlmxlilxjxeiddlhclolopr
    yfmqemubvhputxgsjdwtjchsgsirixlifxyljvnhccbxchplnogysnsygapqaazh
    azsluhszmwwofobuchuuxmsdpjtpmuyouqzoaupmqmavcdqemkajzuoqfkftefhy
    xhpxbejrslouogadtcmsydienpxrwfstojrppaiioyecfhhylwskzcomtnfpuzii
    izzycjiqiounxcnjaftzjjncyurtuzdebfedomvybrnavajvhewqnjsogljclmgo
    tltizoicfwdbwmygrvwggrumcdopsxdliwvjmemuapxydvewsddzwznyfcozztmj
    siseogaqvxozvvxnaamwcawjemkfgwqaekesrfioeznzwnnwpburdqchdmoljelp
    priiyswdtmepztnovhiaakkfzyqifdxwuhetcayvmcnlwcctkkvmufrtejdlmdhi
    klbonbmagzncbpxnbszwasrgbxrpayymlbbydnyjoonpfmfhgedgzwmatdsvdqio
    rjnuwnfkdsbjegqlnvrmrgonlgiryqfqbumzkslnknwrvmckjvwddnqpvagutnkw
    kwwuqhjbwguuuyegtdjzsbqnbyhwnttxsrtiadlxlfthdxnzcwauxqiborzbnubf
    lupmzblkieumdhnigncdfmgtgiwtcxaoupctqngbtanyhcinrntwzbphjnconceh
    ugckvinqiaqsezhvmcrneivpyxdlcjswpuimfwcpythfuragtutzeqrcqupsgjqv
    gyilwmavhkabbchuwdudtlhlhxdngtlmuvxqhanrkpslscfqfbtaodmyarlinyvh
    tuzdupugeorwqzpvakyrnkpnbcwobtxwnzbkoxqsmkrcjgalqyceittlwrczkzxa
    yzmmwehioynzenlwlpatjwghnigaidcieoxdueljeakknvgyljtwhaduklwuqydv
    ocylglummewbceapnvnuxqridpctqhoejorrcldqsbrwgtnvraqoqjytydookdvw
    tmnxatnuuhsacfwtfokvzkqxpeoajlyfxlczgstbbnddszzxpluoxkmnrcpcnnhm
    ammhehifvlknnjlcwfrusfhljwnwjxiljwspeaubogobqbfojyiddpqondkycvkn
    recxfyyvfpyxqdlbcwehnuwbaibcdlqxquuxttuyisxyxicbggludjvfrwjxkbuc
    wobrhvprposmyuqfcbzhkumdswaezwivljmugdmxrekqycxadwipswsmsvrsrzpc
    lexrhlpbpbtpfqpimzxgwrsqmjkelciyghrpsiqhjlwqboyppxxnrqgdbsjousmc
    besumkdywaozqprfmovfgbjituwqolsqpmkbxnzvpquffnnteizklkueetutepjv
    bvwykytaqqhvfwojgnurxqyejuxpjiklfjlpjhrzzbuexkqeamvzctdoocdzmqmr
    bajkjajibfozpefrqcrvywjobonngafhcorlqcvshjtzqaqicjdagmohdewjgbti
    rkvknqewbxvrzoabxdefsuoxalggmzqgmlsbbwxfvvwulyxicbqwyetypbhedxmp
    jeqmaprvmqrxooissyoqchqslxyovkdgovuomolzecyssglmgbejjvduubiplnxb
    kspwicxmgyeyernltrwembahckypxyqhshfalfmrdsrhmeuhwslkvltzxuouugdm
    pkoapcrsulcipypntcaoptompcijlnxaylbnnuikfksxkkmdmmseigqzkbjvogym
    sbchvkrdwkcgwokkdconkhmuixswgqlarphobztxlvdjmptptiedrsazquxykkyd
    zhtainzvkfewuynqirvzkvacpzcbkagljcmsrnpbsuypulfefafpyhtpgvtqxbcg
    dqaudswyownkjsoouvfscykkvdbsefbkxdgcveajantkhjacegwiggtclwusdxcc
    bkeyphirwddepegvkeeslzuyxrqcouerfkquranofruuvaqhgwzrxuquniwbdcti
    mjeglrwqiqlfsdoyzoswkksxsoyvqtfeejkpdiinyvtsyhtxxlvhvngpdhlvaqbh
    coyhwguxbppbzkawvvgskmipvtmylofpcfwymtxpiprhzrgvpopbaxrysdwgrdvv
    iuwwntmviffiwlfnzwpbugbolxwfaualoyhdsvycafmzsrmtqbxkjyavyxcarclh
    btkvokxrskqkdcgtgdfpbimbfocytnhwitrzdqqvagigkobqthiwrwywlawgnfcy
    yvxdlnbmvjufzvyseiovemtrorxewbcwwzaiobwjmsolnoduwtpdglwucuybxcxu
    bzepaaamspxhfcdewthegdaizblxdlthkzwlbxzvoxcvbgzxbgdhmerlhfkkqfra
    eqnfpnadmfynlynogqxswqgdvsqlyhocxbkmokrapsqcsdsyvptugzzdtpprxfww
    gglxsezkwpoouhpqyikgjjkebbwyguwoajluolekcvbxeqpcabllmxpnynnghkuj
    tgejtkwvfxujpjmrkzexwtkujycqkwafcgpxqlvwkpfzztsjswgqrtmatotdltkp
    bznrminyxvxyopijnqzfjmfcayhntsdutsoicdgzygapxiylazqknxooyybrsgol
    yevahecgkcvjmvumwmykkpyinbbfkrsivqlfupletinffktbwslijlswpwdzpxjn
    nwshlfnepdlupfxlzjwiwognkloaianywhhkmvobaaxphucgfyqcnwrzhgbrgqpe
    xxolufmuhjjoelwlmmnbiharneivwyzuvqfrvulcfwsjjovvakwktzbidjdbjfvg
    vdxszkwegoqqenlexkqtjrbocfpmmnujssbrezvlnlbryoxyanrjguzibrwnetyy
    nbprakcpyfgywfwwupiakjllajbgczerbtjbgnrgtzerhdnbuxeehrshatqfuuwv
    qhzwvqeorihanueiuimbzgkbbagwxfrnmqjhinxcxeclbgtvqhyrqitrlbnigfvv
    xgeivcmuiohlxagpkgharcrcdhmmojhlrlvophiyyqjvssmeatervyvbfhntswgj
    jcxzlizjykgsetxfmbykbulibyduwkffodgzlhjlupdakahxeghfasqdstzodfvt
    kctxleifvnggonfutobvgrzalyoqfjkrnfozlyegmmocctwvhztprspesfuargrg
    lgfwemfsatucpsywurollfrflnfeuxkhfsgleleegahvvhupakanptsagaeaxrke
    the dictionary file is too big to post but it is something like this:
    a
    aah
    aardvark
    aardvarks
    aardwolf
    aardwolves
    aba
    abaca
    abaci
    aback
    abacterial
    abacus
    abacuses
    abaft
    abalone
    abalones
    abandon
    abandoned
    abandoning
    abandonment
    abandons
    abase
    abased
    abasement
    abasements
    abases
    abash
    abashed
    abashes
    abashing
    abashment
    abashments
    abasing
    abatable
    abate
    abated
    abatement
    abater
    abaters
    abates
    abating
    abatis
    abatises
    abattoir
    abattoirs
    abaxial
    abbacies
    abbacy
    abbe
    abbess
    abbey
    abbot
    abbots
    abbreviate
    abbreviated
    abbreviates
    abbreviating
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    // WordSearch class interface: solve word search puzzle
    // CONSTRUCTION: with no initializer
    // ******************PUBLIC OPERATIONS******************
    // int solvePuzzle( )   --> Print all words found in the
    //                          puzzle; return number of matches
    public class WordSearch
         * Constructor for WordSearch class.
         * Prompts for and reads puzzle and dictionary files.
        public WordSearch( ) throws IOException
            puzzleStream = openFile( "Enter puzzle file" );
            wordStream   = openFile( "Enter dictionary name" );
            System.out.println( "Reading files..." );
            readPuzzle( );
            readWords( );
         * Routine to solve the word search puzzle.
         * Performs checks in all eight directions.
         * @return number of matches
        public int solvePuzzle( )
            int matches = 0;
            for( int r = 0; r < rows; r++ )
                for( int c = 0; c < columns; c++ )
                    for( int rd = -1; rd <= 1; rd++ )
                        for( int cd = -1; cd <= 1; cd++ )
                            if( rd != 0 || cd != 0 )
                                matches += solveDirection( r, c, rd, cd );
            return matches;
         * Search the grid from a starting point and direction.
         * @return number of matches
        private int solveDirection( int baseRow, int baseCol, int rowDelta, int colDelta )
            String charSequence = "";
            int numMatches = 0;
            int searchResult;
            charSequence += theBoard[ baseRow ][ baseCol ];
            for( int i = baseRow + rowDelta, j = baseCol + colDelta;
                     i >= 0 && j >= 0 && i < rows && j < columns;
                     i += rowDelta, j += colDelta )
                charSequence += theBoard[ i ][ j ];
                searchResult = prefixSearch( theWords, charSequence );
                if( searchResult == theWords.length )
                    break;
                if( !((String)theWords[ searchResult ]).startsWith( charSequence ) )
                    break;
                if( theWords[ searchResult ].equals( charSequence ) )
                    numMatches++;
                    System.out.println( "Found " + charSequence + " at " +
                                        baseRow + " " + baseCol + " to " +
                                        i + " " + j );
            return numMatches;
         * Performs the binary search for word search.
         * @param a the sorted array of strings.
         * @param x the string to search for.
         * @return last position examined;
         *     this position either matches x, or x is
         *     a prefix of the mismatch, or there is no
         *     word for which x is a prefix.
        private static int prefixSearch( Object [ ] a, String x )
            int idx = Arrays.binarySearch( a, x );
            if( idx < 0 )
                return -idx - 1;
            else
                return idx;
         * Print a prompt and open a file.
         * Retry until open is successful.
         * Program exits if end of file is hit.
        private BufferedReader openFile( String message )
            String fileName = "";
            FileReader theFile;
            BufferedReader fileIn = null;
            do
                System.out.println( message + ": " );
                try
                    fileName = in.readLine( );
                    if( fileName == null )
                         System.exit( 0 );
                    theFile = new FileReader( fileName );
                    fileIn  = new BufferedReader( theFile );
                catch( IOException e )
                  { System.err.println( "Cannot open " + fileName ); }
            } while( fileIn == null );
            System.out.println( "Opened " + fileName );
            return fileIn;
         * Routine to read the grid.
         * Checks to ensure that the grid is rectangular.
         * Checks to make sure that capacity is not exceeded is omitted.
        private void readPuzzle( ) throws IOException
            String oneLine;
            List puzzleLines = new ArrayList( );
            if( ( oneLine = puzzleStream.readLine( ) ) == null )
                throw new IOException( "No lines in puzzle file" );
            columns = oneLine.length( );
            puzzleLines.add( oneLine );
            while( ( oneLine = puzzleStream.readLine( ) ) != null )
                if( oneLine.length( ) != columns )
                    System.err.println( "Puzzle is not rectangular; skipping row" );
                else
                    puzzleLines.add( oneLine );
            rows = puzzleLines.size( );
            theBoard = new char[ rows ][ columns ];
            Iterator itr = puzzleLines.iterator( );
            for( int r = 0; r < rows; r++ )
                String theLine = (String) itr.next( );
                theBoard[ r ] = theLine.toCharArray( );
         * Routine to read the dictionary.
         * Error message is printed if dictionary is not sorted.
        private void readWords( ) throws IOException
            List words = new ArrayList( );
            String lastWord = null;
            String thisWord;
            while( ( thisWord = wordStream.readLine( ) ) != null )
                if( lastWord != null && thisWord.compareTo( lastWord ) < 0 )
                    System.err.println( "Dictionary is not sorted... skipping" );
                    continue;
                words.add( thisWord );
                lastWord = thisWord;
            theWords = words.toArray( );
          // Cheap main
        public static void main( String [ ] args )
            WordSearch p = null;
            try
                p = new WordSearch( );
            catch( IOException e )
                System.out.println( "IO Error: " );
                e.printStackTrace( );
                return;
            System.out.println( "Solving..." );
            p.solvePuzzle( );
        private int rows;
        private int columns;
        private char [ ][ ] theBoard;
        private Object [ ] theWords;
        private BufferedReader puzzleStream;
        private BufferedReader wordStream;
        private BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
    }Thank you in advance

    Ok, I'm stuck. Please somebody. It seems like I'm not moving inside the board. This is what I have done so far:
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
    import java.util.HashMap;
    public class WordSearch
         * Constructor for WordSearch class.
         * Prompts for and reads puzzle and dictionary files.
        public WordSearch( ) throws IOException
            puzzleStream = openFile( "Enter puzzle file" );
            wordStream   = openFile( "Enter dictionary name" );
            System.out.println( "Reading files..." );
            readPuzzle( );
            readWords( );
           * Private class Position is a class to store a row and a column
           * as a pair.
        private class Position
             int row;
             int column;
                * A constructor from two integers
                * @param r is the row of the position
                * @param c is the column of the position
             Position( int r, int c )
                  row = r;
                  column = c;
                * First accessor
                * @return the row as an int
              public int getRow( )
                   return row;
                * Second accessor
                * @return the column as an int
              public int getColumn( )
                   return column;
                * Position objects are equal if both rows and columns are equal
                 * @return true if both rows and columns are equal; false otherwise
              public boolean equals( Object aPosition )
                   int x = ( (Position) aPosition ).getRow( );
                   int y = ( (Position) aPosition ).getColumn( ); 
                 return ( ( row == x ) && ( column == y ) );
                * Returns a String representation of Position
                   * @return a String with Position as ( x, x )
              public String toString( )
                 return ( "( " + row + ", " + column + " )" );
        } // end of Position
         * Routine to solve the Boggle game.
         * @return a Map containing the strings as keys, and the positions
         * used to form the string (as a List) as values
        public Map solveBoggle( )
            Map results = new HashMap( );
            List path = new ArrayList( );
            boolean[][] marked = new boolean[rows][columns];
            for( int r = 0; r < rows; r++ )
                 for( int c = 0; c < columns; c++ )
                    solve( new Position( r, c ), "", path, results, marked);
            return results;
         * Hidden recursive routine.
         * @param thisPos the current position
         * @param charSequence the characters in the potential matching string thusfar
         * @param path the List of positions used to form the potential matching string thusfar
         * @param results the Map that contains the strings that have been found as keys
         * and the positions used to form the string (as a List) as values.
        private void solve( Position thisPos, String charSequence, List path, Map results,
                  boolean[ ][ ] marked )
             int row = thisPos.getRow( );
             int col = thisPos.getColumn( );
             charSequence += theBoard[ row ][ col ];
            int searchResult = prefixSearch( theWords, charSequence );
            if( searchResult == theWords.length )
                   return;
              if( theWords[ searchResult ].equals( charSequence ) )
                 path.add( thisPos );
                 results.put( charSequence, path );
                 path.clear( );
                 charSequence.replaceAll( charSequence, "" );
                 return;
            if( !( (String)theWords[ searchResult ] ).startsWith( charSequence ) )
                 return;
            else
                 path.add( thisPos );
                 marked[ thisPos.getRow( ) ][ thisPos.getColumn( ) ] = true;     
                   if( ((row-1) >= 0) && ((col-1) >= 0) && !marked[row-1][col-1] )
                        marked[row-1][col-1] = true;
                        solve( new Position(row-1, col-1), charSequence, path, results, marked);
                   if( ((row-1) >= 0) && !marked[row-1][col] )
                        marked[row-1][col] = true;
                        solve( new Position(row-1, col), charSequence, path, results, marked);
                   if( ((row-1) >= 0) && ((col+1) < columns) && !marked[row-1][col+1]  )
                        marked[row-1][col+1] = true;
                        solve( new Position(row-1, col+1), charSequence, path, results, marked);
                   if( ((col-1) >= 0) && !marked[row][col-1]  )
                        marked[row][col-1] = true;
                        solve( new Position(row, col-1), charSequence, path, results, marked);
                   if( ((col+1) < columns) && !marked[row][col+1] )
                        marked[row][col+1] = true;
                        solve( new Position(row, col+1), charSequence, path, results, marked);
                   if( ((row+1) < rows) && ((col-1) >= 0) && !marked[row+1][col-1] )
                        marked[row+1][col-1] = true;
                        solve( new Position(row+1, col-1), charSequence, path, results, marked);
                   if( ((row+1) < rows) && !marked[row+1][col] )
                        marked[row+1][col] = true;
                        solve( new Position(row+1, col), charSequence, path, results, marked);
                   if( ((row+1) < rows) && ((col+1) < columns) && !marked[row+1][col+1] )
                        marked[row+1][col+1] = true;
                        solve( new Position(row+1, col+1), charSequence, path, results, marked);
         * Performs the binary search for word search.
         * @param a the sorted array of strings.
         * @param x the string to search for.
         * @return last position examined;
         *     this position either matches x, or x is
         *     a prefix of the mismatch, or there is no
         *     word for which x is a prefix.
        private static int prefixSearch( Object [ ] a, String x )
            int idx = Arrays.binarySearch( a, x );
            if( idx < 0 )
                return -idx - 1;
            else
                return idx;
         * Print a prompt and open a file.
         * Retry until open is successful.
         * Program exits if end of file is hit.
        private BufferedReader openFile( String message )
            String fileName = "";
            FileReader theFile;
            BufferedReader fileIn = null;
            do
                System.out.println( message + ": " );
                try
                    fileName = in.readLine( );
                    if( fileName == null )
                         System.exit( 0 );
                    theFile = new FileReader( fileName );
                    fileIn  = new BufferedReader( theFile );
                catch( IOException e )
                  { System.err.println( "Cannot open " + fileName ); }
            } while( fileIn == null );
            System.out.println( "Opened " + fileName );
            return fileIn;
         * Routine to read the grid.
         * Checks to ensure that the grid is rectangular.
         * Checks to make sure that capacity is not exceeded is omitted.
        private void readPuzzle( ) throws IOException
            String oneLine;
            List puzzleLines = new ArrayList( );
            if( ( oneLine = puzzleStream.readLine( ) ) == null )
                throw new IOException( "No lines in puzzle file" );
            columns = oneLine.length( );
            puzzleLines.add( oneLine );
            while( ( oneLine = puzzleStream.readLine( ) ) != null )
                if( oneLine.length( ) != columns )
                    System.err.println( "Puzzle is not rectangular; skipping row" );
                else
                    puzzleLines.add( oneLine );
            rows = puzzleLines.size( );
            theBoard = new char[ rows ][ columns ];
            Iterator itr = puzzleLines.iterator( );
            for( int r = 0; r < rows; r++ )
                String theLine = (String) itr.next( );
                theBoard[ r ] = theLine.toCharArray( );
         * Routine to read the dictionary.
         * Error message is printed if dictionary is not sorted.
        private void readWords( ) throws IOException
            List words = new ArrayList( );
            String thisWord;
            while( ( thisWord = wordStream.readLine( ) ) != null )
                words.add( thisWord );          
            theWords = words.toArray( );
            Arrays.sort( theWords );
           * Prints a String representation of the words found and their List of positions.  
           * @Prints a String with the words found and their List of positions.
        public static void printMap( Map wordMap )
             Iterator itr1 = wordMap.entrySet( ).iterator( );
             String str = "";        
            while( itr1.hasNext( ) )
                 String aWord = (String)( (Map.Entry)itr1.next( ) ).getKey( );  
                 str += "Found " + aWord + " at ";
                 Iterator itr2 = ( (List)( ( (Map.Entry)itr1.next( ) ).
                           getValue( ) ) ).iterator( );
                 while( itr2.hasNext( ) )
                      str += (Position)itr2.next( );
                      if( itr2.hasNext( ) )
                           str += ", ";
                      else
                           str += "\n";
             System.out.println( str );
         } // end of printMap
          // Cheap main
        public static void main( String [ ] args )
            WordSearch p = null;
            try
                p = new WordSearch( );
            catch( IOException e )
                System.out.println( "IO Error: " );
                e.printStackTrace( );
                return;
            System.out.println( "Solving..." );
            Map wordMap = p.solveBoggle( );
            p.printMap( wordMap );
        private int rows;
        private int columns;
        private char [ ][ ] theBoard;
        private Object [ ] theWords;
        private BufferedReader puzzleStream;
        private BufferedReader wordStream;
        private BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
    }Thanks

  • I'm trying to void bits of my data

    I'm working with the Dijkstra algorithm looking at the connection of nodes, well I need to know how to void a line segment, or segments, that are formed by two nodes, however leave the nodes them self intact. How can I do that? My data is given in the form, From(node)  To(node)  Cost(some value). And here is the code it self:
    import java.io.FileReader;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.util.Collection;
    import java.util.HashMap;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.NoSuchElementException;
    import java.util.PriorityQueue;
    import java.util.Queue;
    import java.util.StringTokenizer;
    import weiss.nonstandard.PairingHeap;
    // Used to signal violations of preconditions for
    // various shortest path algorithms.
    class GraphException extends RuntimeException
        public GraphException( String name )
            super( name );
    // Represents an edge in the graph.
    class Edge
        public Vertex     dest;   // Second vertex in Edge
        public double     cost;   // Edge cost
        public Edge( Vertex d, double c )
            dest = d;
            cost = c;
    // Represents an entry in the priority queue for Dijkstra's algorithm.
    class Path implements Comparable<Path>
        public Vertex     dest;   // w
        public double     cost;   // d(w)
        public Path( Vertex d, double c )
            dest = d;
            cost = c;
        public int compareTo( Path rhs )
            double otherCost = rhs.cost;
            return cost < otherCost ? -1 : cost > otherCost ? 1 : 0;
    // Represents a vertex in the graph.
    class Vertex
        public String     name;   // Vertex name
        public List<Edge> adj;    // Adjacent vertices
        public double     dist;   // Cost
        public Vertex     prev;   // Previous vertex on shortest path
        public int        scratch;// Extra variable used in algorithm
        public Vertex( String nm )
          { name = nm; adj = new LinkedList<Edge>( ); reset( ); }
        public void reset( )
          { dist = Graph.INFINITY; prev = null; pos = null; scratch = 0; }   
        public PairingHeap.Position<Path> pos;  // Used for dijkstra2 (Chapter 23)
    // Graph class: evaluate shortest paths.
    // CONSTRUCTION: with no parameters.
    // ******************PUBLIC OPERATIONS**********************
    // void addEdge( String v, String w, double cvw )
    //                              --> Add additional edge
    // void printPath( String w )   --> Print path after alg is run
    // void unweighted( String s )  --> Single-source unweighted
    // void dijkstra( String s )    --> Single-source weighted
    // void negative( String s )    --> Single-source negative weighted
    // void acyclic( String s )     --> Single-source acyclic
    // ******************ERRORS*********************************
    // Some error checking is performed to make sure graph is ok,
    // and to make sure graph satisfies properties needed by each
    // algorithm.  Exceptions are thrown if errors are detected.
    public class Graph
        public static final double INFINITY = Double.MAX_VALUE;
        private Map<String,Vertex> vertexMap = new HashMap<String,Vertex>( );
         * Add a new edge to the graph.
        public void addEdge( String sourceName, String destName, double cost )
            Vertex v = getVertex( sourceName );
            Vertex w = getVertex( destName );
            v.adj.add( new Edge( w, cost ) );
         * Driver routine to handle unreachables and print total cost.
         * It calls recursive routine to print shortest path to
         * destNode after a shortest path algorithm has run.
        public void printPath( String destName )
            Vertex w = vertexMap.get( destName );
            if( w == null )
                throw new NoSuchElementException( "Destination vertex not found" );
            else if( w.dist == INFINITY )
                System.out.println( destName + " is unreachable" );
            else
                System.out.print( "(Cost is: " + w.dist + ") " );
                printPath( w );
                System.out.println( );
         * If vertexName is not present, add it to vertexMap.
         * In either case, return the Vertex.
        private Vertex getVertex( String vertexName )
            Vertex v = vertexMap.get( vertexName );
            if( v == null )
                v = new Vertex( vertexName );
                vertexMap.put( vertexName, v );
            return v;
         * Recursive routine to print shortest path to dest
         * after running shortest path algorithm. The path
         * is known to exist.
        private void printPath( Vertex dest )
            if( dest.prev != null )
                printPath( dest.prev );
                System.out.print( " to " );
            System.out.print( dest.name );
         * Initializes the vertex output info prior to running
         * any shortest path algorithm.
        private void clearAll( )
            for( Vertex v : vertexMap.values( ) )
                v.reset( );
         * Single-source unweighted shortest-path algorithm.
        public void unweighted( String startName )
            clearAll( );
            Vertex start = vertexMap.get( startName );
            if( start == null )
                throw new NoSuchElementException( "Start vertex not found" );
            Queue<Vertex> q = new LinkedList<Vertex>( );
            q.add( start ); start.dist = 0;
            while( !q.isEmpty( ) )
                Vertex v = q.remove( );
                for( Edge e : v.adj )
                    Vertex w = e.dest;
                    if( w.dist == INFINITY )
                        w.dist = v.dist + 1;
                        w.prev = v;
                        q.add( w );
         * Single-source weighted shortest-path algorithm.
        public void dijkstra( String startName )
            PriorityQueue<Path> pq = new PriorityQueue<Path>( );
            Vertex start = vertexMap.get( startName );
            if( start == null )
                throw new NoSuchElementException( "Start vertex not found" );
            clearAll( );
            pq.add( new Path( start, 0 ) ); start.dist = 0;
            int nodesSeen = 0;
            while( !pq.isEmpty( ) && nodesSeen < vertexMap.size( ) )
                Path vrec = pq.remove( );
                Vertex v = vrec.dest;
                if( v.scratch != 0 )  // already processed v
                    continue;
                v.scratch = 1;
                nodesSeen++;
                for( Edge e : v.adj )
                    Vertex w = e.dest;
                    double cvw = e.cost;
                    if( cvw < 0 )
                        throw new GraphException( "Graph has negative edges" );
                    if( w.dist > v.dist + cvw )
                        w.dist = v.dist +cvw;
                        w.prev = v;
                        pq.add( new Path( w, w.dist ) );
         * Single-source weighted shortest-path algorithm using pairing heaps.
        public void dijkstra2( String startName )
            PairingHeap<Path> pq = new PairingHeap<Path>( );
            Vertex start = vertexMap.get( startName );
            if( start == null )
                throw new NoSuchElementException( "Start vertex not found" );
            clearAll( );
            start.pos = pq.insert( new Path( start, 0 ) ); start.dist = 0;
            while ( !pq.isEmpty( ) )
                Path vrec = pq.deleteMin( );
                Vertex v = vrec.dest;
                for( Edge e : v.adj )
                    Vertex w = e.dest;
                    double cvw = e.cost;
                    if( cvw < 0 )
                        throw new GraphException( "Graph has negative edges" );
                    if( w.dist > v.dist + cvw )
                        w.dist = v.dist + cvw;
                        w.prev = v;
                        Path newVal = new Path( w, w.dist );                   
                        if( w.pos == null )
                            w.pos = pq.insert( newVal );
                        else
                            pq.decreaseKey( w.pos, newVal );
         * Single-source negative-weighted shortest-path algorithm.
        public void negative( String startName )
            clearAll( );
            Vertex start = vertexMap.get( startName );
            if( start == null )
                throw new NoSuchElementException( "Start vertex not found" );
            Queue<Vertex> q = new LinkedList<Vertex>( );
            q.add( start ); start.dist = 0; start.scratch++;
            while( !q.isEmpty( ) )
                Vertex v = q.remove( );
                if( v.scratch++ > 2 * vertexMap.size( ) )
                    throw new GraphException( "Negative cycle detected" );
                for( Edge e : v.adj )
                    Vertex w = e.dest;
                    double cvw = e.cost;
                    if( w.dist > v.dist + cvw )
                        w.dist = v.dist + cvw;
                        w.prev = v;
                          // Enqueue only if not already on the queue
                        if( w.scratch++ % 2 == 0 )
                            q.add( w );
                        else
                            w.scratch--;  // undo the enqueue increment   
         * Single-source negative-weighted acyclic-graph shortest-path algorithm.
        public void acyclic( String startName )
            Vertex start = vertexMap.get( startName );
            if( start == null )
                throw new NoSuchElementException( "Start vertex not found" );
            clearAll( );
            Queue<Vertex> q = new LinkedList<Vertex>( );
            start.dist = 0;
              // Compute the indegrees
              Collection<Vertex> vertexSet = vertexMap.values( );
            for( Vertex v : vertexSet )
                for( Edge e : v.adj )
                    e.dest.scratch++;
              // Enqueue vertices of indegree zero
            for( Vertex v : vertexSet )
                if( v.scratch == 0 )
                    q.add( v );
            int iterations;
            for( iterations = 0; !q.isEmpty( ); iterations++ )
                Vertex v = q.remove( );
                for( Edge e : v.adj )
                    Vertex w = e.dest;
                    double cvw = e.cost;
                    if( --w.scratch == 0 )
                        q.add( w );
                    if( v.dist == INFINITY )
                        continue;   
                    if( w.dist > v.dist + cvw )
                        w.dist = v.dist + cvw;
                        w.prev = v;
            if( iterations != vertexMap.size( ) )
                throw new GraphException( "Graph has a cycle!" );
         * Process a request; return false if end of file.
        public static boolean processRequest( BufferedReader in, Graph g )
            String startName = null;
            String destName = null;
            String alg = null;
            try
                System.out.print( "Enter start node:" );
                if( ( startName = in.readLine( ) ) == null )
                    return false;
                System.out.print( "Enter destination node:" );
                if( ( destName = in.readLine( ) ) == null )
                    return false;
                System.out.print( " Enter algorithm (u, d, n, a ): " );  
                if( ( alg = in.readLine( ) ) == null )
                    return false;
                if( alg.equals( "u" ) )
                    g.unweighted( startName );
                else if( alg.equals( "d" ) )   
                    g.dijkstra( startName );
                    g.printPath( destName );
                    g.dijkstra2( startName );
                else if( alg.equals( "n" ) )
                    g.negative( startName );
                else if( alg.equals( "a" ) )
                    g.acyclic( startName );
                g.printPath( destName );
            catch( IOException e )
              { System.err.println( e ); }
            catch( NoSuchElementException e )
              { System.err.println( e ); }         
            catch( GraphException e )
              { System.err.println( e ); }
            return true;
         * A main routine that:
         * 1. Reads a file containing edges (supplied as a command-line parameter);
         * 2. Forms the graph;
         * 3. Repeatedly prompts for two vertices and
         *    runs the shortest path algorithm.
         * The data file is a sequence of lines of the format
         *    source destination.
        public static void main( String [ ] args )
            Graph g = new Graph( );
            try
                FileReader fin = new FileReader( args[0] );
                BufferedReader graphFile = new BufferedReader( fin );
                // Read the edges and insert
                String line;
                while( ( line = graphFile.readLine( ) ) != null )
                    StringTokenizer st = new StringTokenizer( line );
                    try
                        if( st.countTokens( ) != 3 )
                            System.err.println( "Skipping ill-formatted line " + line );
                            continue;
                        String source  = st.nextToken( );
                        String dest    = st.nextToken( );
                        double    cost    = Double.parseDouble( st.nextToken( ) );
                        g.addEdge( source, dest, cost );
                    catch( NumberFormatException e )
                      { System.err.println( "Skipping ill-formatted line " + line + " because countTokens = " + st.countTokens()); }      
             catch( IOException e )
               { System.err.println( e ); }
             System.out.println( "File read..." );
             System.out.println( g.vertexMap.size( ) + " vertices" );
             BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
             while( processRequest( in, g ) )
    }Edited by: whatzzupboy on Mar 17, 2008 3:34 PM

    Settings > Mail, Contacts, Calendars > tap email account name > Mail Days to Sync > Increase the time
    If there are no settings similar to this in the Settings app, then you won't be able to change it.

  • How not to use Cold Fusion and Java

    Overview
    This write up is intended to give java developers that are
    developing ColdFusion applications some beneficial information:
    things that are not documented.
    Scenario
    The company builds enterprise class web application software
    for fortune 500 companies. It had purchased a CF 7 based product,
    had and existing proprietary J2EE based product, and needed to
    integrate the two while meeting a host of new requirements. These
    requirements were based on delivering a better user experience,
    faster / cheaper integration, increased flexibility /
    configuration, useablily, decreasing maintenance costs, the ability
    to deploy in either install or ASP models. An initiative was
    started to create a new framework that integrated the best of each
    technologies. Tactically, this meant that we were to build a hybrid
    CF and java application: one that used building blocks (decoupled /
    cohesive components) that would allow applications to be rapidly
    assembled, configured and deployed. This made sense on several
    levels, the team was composed of Java and CF developers, the CF
    rapid application development was very productive, there is great
    functionality delivered in the CF platform and initial performance
    tests showed no cause for alarm
    The agreed upon design, based on requirements, and analysis
    by both the CF and Java staff has us using CF in the presentation
    layer, using a CF based MVC, use of CF based web services. The MVC
    was deployed using CFC inheritance for model objects and views made
    use of CF custom tags. The internals of the application, used a
    rules engine, some proprietary java, ORM, and other J2EE
    technology. The initial performance of the system was reasonable.
    We pushed on with product implementation.
    Then it was time to load test the application, and tune it.
    Under load the response times were orders of magnitude slower,
    sometimes the pages even timed out.
    Armed with our profiler, oracle execution plans and we
    charged ahead addressing issue after issue. Note that we took
    meticulous care in tweaking the active thread pool and ensuring
    that our CF setup was tuned for our application. None of the
    observations here are a condemnation of the language; rather they
    are aspects that, when considered together, not conducive for
    building integrated java and CF frameworks that use a structured /
    OO programming practices. Further detail can be provided on
    request.
    CFC inheritance should be avoided - resolution of variable
    scope is expensive even if properly declared.
    Since CF creates a class per method under the covers call
    stacks become very large, especially if used in a loop. This is
    nominally exacerbated by CF calls necessary to set up for the
    method call (String.toUpper()).
    Nesting of loops and if statements should be kept to a
    minimum - the conditional for each lookup of logical operator like
    LT, GT are synchronized. Under load this results in thread waits.
    Jrun has as single thread pool - both http and web service
    requests use the same pool. Under load this leads to thread
    deadlock. There are work arounds, but they are painful.
    Recursion should be avoided - we had a few recursive routines
    and these had to be rewritten.
    Custom Tags - should be used sparingly - each custom tag
    makes a synchronized call to the license server - (This may be
    fixed in CF 8)
    Summary
    In the end we got the performance to reasonable numbers, but
    we ended up moving some code to java (Custom Tags) and getting rid
    of 'good programming' practices (Inheritance, loops, etc), mandated
    proper variable scoping for those things left over. We prototyped a
    sans cold fusion implementation and had an order of magnitude
    improvement in performance and number of requests served per
    second.
    The lesson? Use Coldfusion in its sweet spot: make a query,
    iterate over the results and format for display. Extensive use of
    structure programming techniques or OO CFCs should be avoided: they
    will work but under load - but are better as a prototype. Building
    frameworks in CF? Think twice, no three times, and, if you must, be
    minimalist.
    Text

    interesting aslbert123,
    Not that I doubt you, but could you answer some questions
    about your implementation that was so slow:
    1.) Did you put your CFCs in the application or server scope?
    2.) Were you initializing your CFCs, via CreateObject or
    <cfinvoke>, on every request?
    3.) Are you sure that you were properly Var'ing every
    variable in your methods? (people typically forget about query
    names and loop iterator variables)
    4.) Could you give examples of how your inheritence was set
    up?
    5.) For CustomTags, did you call them the old <cf_tag>
    way or the newer, better-performing <cfimport> way?
    6.) How did you connect CF to Java exactly?
    Thanks,
    Aaron

  • After updating my ipad to 6.0.1, it will no longer connect to personal hotspots on any make of phone. Can someone tell me if it is a problem with the software?

    Is anybody have the same problem as mentioned above?

    First the formatting tags should be "[ ]" not "< >".
    I was told you should avoid calling a method from itself is this true?Recursion is a valid programming technique and in fact makes many algorithms much easier to code.
    so I don't know if what worked for me will work on a lower end machineIt may be a little slower but it will still work. Recursion only causes a problem with resources when you have many levels of recursion. On my system I have:
    C:\WINDOWS\TEMP\Temporary Internet Files\Content.IE5\
    In this case there is only 4 levels of recursion. This is not going to cause a problem. You would generally only have problems if your recusion routine is not working correctly and you get in an infinite loop which will lead to resource problems and an abend.
    In your particular case you aren't even using many resources at all since all you are doing is printing the file name.
    This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=435487&start=3&range=1]post shows a recursive routine that list all files for a directory and displays them in a table. In this cause you might have a problem with resources depending on the number of files in the directory. But the resource problem is because of the memory to hold the filenames in the table, not because a recursive routine was used to get the filename.

  • Using 'getClasses'  for reflection / introspection  - not found in Jdev

    Hi people,
    I am using Jdeveloper 10.1.3.0.4 and I am trying to use some of java's reflection / introspection features.
    - I am trying to use the getClasses method, part of the 'Class' class.
    However, Jdeveloper is telling me 'method not found.' The getClass method
    is found OK, but not getClasses, which looks like a standard method in 'Class' in the java doc. Anyone know how to pull this one in ? I am coding import java.lang.Class; explicitly as well.
    Specifically, my need is to determine, at runtime, a list of the lowest-level 'leaf node' subclasses in a specific class inheritance tree. I reckon I should be able to do this with a recursive routine that uses getClasses on each class; when this returns an empty array I know I am at a lowest-level subclass. However it's failing on the first hurdle -
    static House myHouse = new House(); // House is the simple class I want to test
    static Class[] array_of_classes ;
    array_of_classes = myHouse.getClasses();
    -> method getClasses not found in <current package.class>
    on a similar vein, I tried adding
    import java.lang.reflect;
    - this gives java.lang.reflect not found.
    My only alternative is to code my program in a totally non-OO way! :-(
    please help!
    thanks!!!

    Hi,
    I resolved the other errors by changing all references from com.bea.jcom.Variant
    etc to com.linar.jintegra.class name..all were present under the com.linar.jintegra
    package.
    Thank you all anyways,
    Regards,
    rahul
    "Rahul Srivastava" <[email protected]> wrote:
    >
    Hi,
    We are generating java classes for the COM dll using JCOM com2java compiler.
    We are getting a compilation error for import class not found when compiling
    the
    generated Proxy java source code. It can't find the com.bea.jcom.Dispatch
    class that
    the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
    or com.bea.jcom.Param. These are interfaces or data types or classes used
    by COM
    library.
    I added weblogic.jar to my class path and the only Dispatch class i found
    inside
    the weblogic.jar is com.linar.jintegra.Dispatch;
    We have com objects for which we want to develop an EJB client to interface
    with
    the COM object using JCOM with Native Mode disabled.
    Any help on the compilation error..I tried changing the extends for Dispatch
    to com.linar.jintegra.Dispatch
    but the other errors are still there.
    To begin with, I think the generated code should not refer to any of the
    COM data
    types.
    Any help please.
    Thank you in advance,
    Regards,
    Rahul Srivastava
    [email protected]

  • Help with java.lang.StackOverflowError

    my program crashed with java.lang.StackOverflowError... what does it mean? what should i do to fix it?
    thanks.

    Just to add on what paulcw said,
    Check for recursive routines. These are normally the culprits. In particular, recursive methods that have a loop condition that keeps executing.
    Check for circular references. Method A calls method B which calls method C which calls back to method A. These are harder to spot, but stepping through your program execution should quickly reveal the pattern.
    For your last resort, create some debugging code (System.out, etc.). You should eventually get to a point where you see the last line that executed properly. Erase the remaining debugging code and then place more after the last successful execution point.
    Now that I think about it, that's just generic debugging technique when all else fails. But with out of memory or stack overflows, it's sometimes your last option.
    - Saish
    "My karma ran over your dogma." - Anon

  • Write method in C++ xml Parser ??

    I am using the c++ XML and DOM apis to create a new document. Now i need a wite or toString method to turn the document into the XML format. I find .write in JAXP but nada so far in XML Parser!!?
    Missing something fundamental here. Would not like to write node traversal, recursive routines to try to accurately build the <></> stuff.

    Use the print() method in the Node class.

  • FM to Get the Hierachy (subordinated WBS) for a WBS ?

    Hi everybody
    Does somebody knows a FM to get all the subordinated WBSs for a WBS ?
    Tha is, i´m doing a recursive routine for get all the WBSs derived from a specified WBS, but i guess it must to exist an standard FM to do this.
    Thanks in advacced.
    Frank

    Checkout ...
    BAPI_BUS2054_GETDATA           Detail Data for WBS Elements
    CJEX_PRPS_INFO_READ            Read WBS Element Information 
    HRGPBS_DRILL_GET_WBS_LIST      List of WBS elements         
    HRGPBS_DRILL_GET_WBS_LIST_2    select WBS elements from PRPS
    There`re a lot of FM`s and BAPi`s .Just go to SE37-> search word WBS.
    Plz award the points .
    Thanks

  • Kalman implementation in C

    i want to implement a kalman filter to my project but i'm not sure how to do it..
     i have the code in c but i wasn't able to use it..
    can anybody help..? 
    Thanks.. 
    this is the code:
     typedef struct {
    double q; //process noise covariance
    double r; //measurement noise covariance
    double x; //value
    double p; //estimation error covariance
    double k; //kalman gain
    } kalman_state;
     initialization routine:
     kalman_state kalman_init(double q, double r, double p, double intial_value)
    kalman_state result;
    result.q = q;
    result.r = r;
    result.p = p;
    result.x = intial_value;
    return result;
     the main recursive routine:
     void kalman_update(kalman_state* state, double measurement)
    //prediction update
    //omit x = x
    state->p = state->p + state->q;
    //measurement update
    state->k = state->p / (state->p + state->r);
    state->x = state->x + state->k * (measurement - state->x);
    state->p = (1 - state->k) * state->p;

    karpa wrote:
    yes thats correct!
    i tried to use the Code Interface Node but  no luck..
    although i found a solution by using the code with dll i have two issues..
    the first is how to use the Code Interface Node (if i need it again.. ) 
    the second is that if i use two vi's with the kalman filter(called from dll) the values are mixing together..
    e.g the input from the first vi is affecting the output of the second vi, although they have no connection between them..
    does the two vi's using the same memory?
    how to make them behave as expected,i.e independent between them?
    Nihil wrote:
    hello karpa, i dint fully understand, so the question is how to implement C code in labview? 
    You are using a different state for each function?? The C code has no globals or statics inside so there is no influence between the two and LabVIEW definitely does not share data between VIs unless you use some specific means to share that data. So you must be doing something.
    As to using code Interface Nodes: don't! They are legacy technology not anymore supported on all platforms that LabVIEW supports (namely 64 bit versions for now). The cross platform way of doing external code business nowadays is shared libraries/DLLs using the Call Library Node.
    The code in question looks very simple to implement and there is really no reason to use an exernal code for it. To get a fairly good idea of what you might be wanting to do for this, take a look at vi.lib\Utility\MD5Checksum.llb\MD5Checksum string.vi. It's not the same but it should give some idea how to handle that. You can also combine all the state information into one cluster instead of wiring its elements around independantly.
    Message Edited by rolfk on 03-09-2010 08:05 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Java path finding help

    Hello,
    I'm at present working on a route finding system for the london underground as a MIDP application in Java.
    I have a vector of vectors data structure to store the stations as nodes and lines as edges respectively but need a shorest path algorithm to search from one station to the next taking into account line changes.
    Dijkstra's algorithm seems to be the best solution but hard for me to implement.
    Any help on this would be most appreciated.
    Thaxs.
    ash

    I found Dijkstra's algorithm extremely easy to implement by a recursive routine. I found it easiest to work backwards (it simplifies setting the route direction).
    Each node holds a field from distance from the destination, set them all to infinity initially. The node also has a field for next node on the route.
    Then you have a method of the node which offers a route to a node. The arguments are the next node in the route and the resulting distance. The method does nothing if the route offered is longer than one it already has. Otherwise it sets the new length and route to the one on offer and offers itself to all neigbouring nodes.
    Then you just call it on the destination node with a distance of zero and a null route.
    Something like this;
    class Link {
          Station start;
           float length;
    class Station {
         Float distance;
         Link nextStep;
          ArrayList  incomingLinks;
        public void djikstra(float newDistance, Link route) {
              if(distance == null || distance.floatValue() > newDistance) {
                    distance = new Float(newDistance);
                    nextStep = route;
                    for(Iterator it = incomingLinks.iterator(); it.hasNext();) {
                        Link incoming = (Link)it.next();
                        incoming.start.djikstra(newDistance + incoming.length, incoming);
          }(This assumes that if a link is two-way two Links must be created).

  • Need help writing a toString

    I have no idea how to go about writing the toString method for this code. I have to print the array that provides the longest sequence. I would appreciate your help.
    Here is the code: import java.io.FileReader;
    import java.io.IOException;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Scanner;
    import java.util.StringTokenizer;
    class Grid
        private int [ ][ ] mainGrid;
        public Grid( String file ) throws IOException
            FileReader fr = new FileReader( file );
            Scanner scan = new Scanner( fr );
            ArrayList<ArrayList<Integer>> numR = new ArrayList<ArrayList<Integer>>( );
            while( scan.hasNextLine( ) )
                String line = scan.nextLine( );
                StringTokenizer st = new StringTokenizer ( line );
                String number;
                ArrayList<Integer> numC = new ArrayList<Integer>( );
                while( st.hasMoreTokens( ) )
                    number = st.nextToken( );
                    int num = Integer.parseInt(number);
                    numC.add(num);      
                numR.add( numC );
            int height = numR.size();
            int width = numR.get( 0 ).size();
            mainGrid = new int [height][width];
            for(int i = 0; i < height; i++)
                for( int j = 0; j < width; i++)
                    mainGrid [ i ][ j ] = numR.get( i ).get( j );
        private class Position
            private int row;
            private int col;
            public Position( int r, int c )
                r = row;
                c = col;
            public List<Position> getAdjacents( )
                int lowRow = row != 0 ? row - 1 : 0;
                int lowCol = col != 0 ? col - 1 : 0;
                int highRow = row != mainGrid.length - 1 ? row + 1 : mainGrid.length - 1;
                int highCol = col != mainGrid[ 0 ].length - 1 ? col + 1 : mainGrid[ 0 ].length - 1;
                List<Position> result = new ArrayList<Position>( );
                for( int r = lowRow; r <= highRow; r++ )
                    for( int c = lowCol; c <= highCol; c++ )
                        if( r != row || c != col )
                            result.add( new Position( r, c ) );
                return result;
            public boolean equals( Object other )
                if( ! ( other instanceof Position ) )
                    return false;
                Position rhs = (Position) other;
                return row == rhs.row && col == rhs.col;
            public int getValue( )
                return mainGrid [ row ][ col ];
            public String toString( )
                return "(" + row + "," + col + ")";
        public Position newPosition( int r , int c )
            return new Position( r, c );
        // Public driver
        public List<Position> getSequence( )
             List<Position> sequence = new ArrayList<Position>( );
             for( int r = 0; r < mainGrid.length - 1; r++)
                  for( int c = 0; c < mainGrid[ 0 ].length - 1; c++)
                       sequence = getSequence( new Position( r, c ));          
             return sequence;
        // Recursive routine
        private List<Position> getSequence( Position pos )
          List<Position> adj = pos.getAdjacents( );
          if( adj.size( ) == 0)
               List<Position> seq = new ArrayList<Position>( );
               seq.add( pos );
               return seq;
          List<Position> maxSeq = null;
          for( Position p: adj)
               List<Position> currentSeq = getSequence( p );
               if( currentSeq.size( ) < maxSeq.size( ))
                    maxSeq = currentSeq;
          maxSeq.add( pos );
          return maxSeq;
        public String toString( )
             StringBuffer sb = new StringBuffer( );
              return new String( sb );
    class MaxSubsequence
        public static void main( String [ ] args )
            try
                 System.out.println( new Grid( "numbergrid1.txt" ));
            catch( IOException e)
                 System.err.println( "Error opening file");
    }

    Call your getSequence method from the toString
    method. This gives you a List. Take a look at the
    methods of List to see how you can iterate
    over the list. Then look at the StringBuffer/Builder
    class and see how you can add those elements (plus
    any other formatting and words) to the final string.ok, i think i may be getting it a bit more. I don't need to use a loop at all?
    I can just call the getSequence method, use a toArray to return the sequence and append the sequence to the new string?

Maybe you are looking for