Synchronising two different objects

Hi everyone,
I am asking for your help while i am writing an example code. I want to learn how to synchronise two differents objects.
The first class is actually a MIDlet, which has to increase a counter and display it until the second class send a message to the midlet. At this moment, the midlet has to display the message. I am actualy thinking about adding another thread, but lets speak only about the midlet and the calculator :)
I think there is a problem in my way of thinking, that's why i am asking for your help :
Here is an extract of my midlet code :
public class Main extends MIDlet implements CommandListener {
    private static boolean isFromCalculator    = false;
    private static boolean displayUsed = false;
    Command exitCmd = new Command("Exit", Command.EXIT, 1);
    Command pauseCmd = new Command("Pause", Command.OK, 1);
    TextBox tb = new TextBox("Principal", "", 200, 1);
    int cpt = 0;
    Calculator calc = new Calculator();
    public Main()
        calc.start();
        tb.addCommand(exitCmd);
        tb.addCommand(pauseCmd);
        tb.setCommandListener(this);
    public void startApp() {
        process();
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    public void process()
        // Tant que l'on a pas d'infos des deux autres threads, on compte !
        while ( !isFromCalculator )
            if ( displayUsed )
                synchronized(this){
                    try{
                        wait();
                    catch (Exception e)
                        e.printStackTrace();
            display("Principal : " + cpt + "\n", 1);
            cpt++;
        deroute();
    public void display(String message, int time)
        displayUsed = true;
        tb.delete(0, tb.size());
        tb.insert(message, tb.size());
        Display.getDisplay(this).setCurrent(tb);
        synchronized(this)
            try{
                wait(time);
            catch (Exception e )
            {e.printStackTrace();}
        displayUsed = false;
        notifyAll();
    public void deroute()
        if ( isFromCalculator == true )
            // Manage Calculator message
            display(calc.Message(), 1000);
            isFromCalculator = false;
        process();
    public static void setBoolFromCalculator(boolean b)
        isFromCalculator = b;
    public static boolean isDisplayUsed()
        return displayUsed;
}And here is my calculator code :
public class Calculator extends Thread{
    private int iterator;
    private boolean quit;
    public Calculator()
        iterator = 0;
        quit = false;
    public void run()
        while ( !quit )
            iterator++;
            // 100 Boucles maxi
            if ( iterator > 100)
                quit = true;
            try{
                sleep(1000);
            catch (InterruptedException e )
                System.out.println("Calculator sleep error : ");
                e.printStackTrace();
            if (iterator % 10 == 0)
                if ( !Main.isDisplayUsed() )
                    synchronized(this)
                        try{
                            wait();
                        catch(Exception e)
                            e.printStackTrace();
                Main.setBoolFromCalculator(true);
    public String Message()
        return " Calculator - Iterator = " + iterator +"\n" ;
}May i ask your any advice ?
Regards,

t00f wrote:
Hi everyone,
I am asking for your help while i am writing an example code. I want to learn how to synchronise two differents objects.Note that you don't "synchronize objects." You synchronize methods or blocks of code on objects (or, more properly I suppose, on their locks). This may seem like a petty distinction, but when you say "synchronize objects," it sounds like you think that you're controlling access to an object. That is not the case. If you need further explanation, let me know.

Similar Messages

  • How do I make 2 points in two different objects to stick to eachother?

    As the topic says, I need to make 2 points in two different objects to stick to eachother, so for example when I rotate a line which is "connected" to a square object in one end, the line will rotate around that point.
    Also, if I have lets say two square objects and I "connect" one of the corners of one square object to another corner of another square object, where the points are located exactly on the same location, I need to be able to rotate any of the square objects around the point which is connected to the other square.
    Is this possible?
    Some will probably ask why I need to do this, but I can only say I do, it's a long story

    Its quite complicated guys , I'm quite sure Illy doesn't do what I'm looking for.
    It's basically a line which is "anchored" at one point and connected to a square at the other point. So when I move the square the line is being dragged with it without altering its length. And of course the "anchored" point of the line stays where it was from the beginning, while the other end is attached to the square moving with it.
    This way the squares point, the one which is connected to the line, can neither end up closer or farther from the lines "anchored" point. The square can only move around that point in an exact circle, with constant radius.
    I'm using this for measuring/map creation. It doesn't have to be 100% exact down to the millimetre, but I'd be happy if I could get it centimetres exact if you know what I mean. Of course this is on a scale of like 100x100 metres or more.
    I can do it without this "feature" too, but it takes more time and is not totally exact either.
    I can't use CAD for this, so it'll have to be Illy.

  • How to Display two different objects in a single table header in Cross Tab?

    i All,
    I've a reqiurement for a Cross Tab Report like I need two different objects that should be displayed side-by-side, one object's values after another in a single header. In the picture below I've shown the objects separately in two rows, top header having BSNLNL,MTNLNL,RCOMNL and Header-2 having AIRTIL,RCOMIL. But requirements needs to be showing like this,
    BSNLNL
    MTNLNL
    RCOMNL
    AIRTIL
    RCOMIL
    Actually, the data for the header comes from a single object called Operator. I've show the Operators name ending with NL and after that names ending with IL. So, i've separated the data into two variables using the below formulae.
    IL:
    =[Billing Operator]
    Where
    Match([Billing Operator];"*IL")=1
    NL:
    =[Billing Operator]
    Where
    Match([Billing Operator];"*NL")=1
    Also, the NL data should start first and after the NL data's last value ends, the IL data should begin.
    One more thing is that I've to show '0' for null values. So i've used the below formulae on the column data. You can see below that except the "Outgoing ILD Mins in the month from Mobile Network" everything else showing fine. I don't understand why.
    =If
      Substr([Franchise];3;1)="M"
      Then
       [Mobile Outgoing Charged Usage Minutes]
       Else
       0
    I tried different approaches but couldn't find a solution. Could you please help me?     
    I'm using BO WebI 4.1 SP1
    Regards,
    Naren Vema.

    Hi Naren,
    No need to split Billing Operator object. Create a variable-
    V_IL_NL= If  Match([Billing Operator];"*IL")=1 Then "IL" ElseIf Match([Billing Operator];"*NL")=1 Then "NL"
    1) Put V_IL_NL variable below Billing Operator object header.
    2) Sort and create break on this variable.
    3) Delete Footer column. it will automatically create when you apply break.
    4) Hide V_IL_NL variable from this header.
    ~Anuj

  • Can findText find two different objects at once?

    I have written a script that finds all italicized words, then compares them to a character style that italicizes characters. If there are any italicized words that do not use the character style, the user is alerted.
    Of course, not all fonts use a fontStyle that equals "Italic." Some use a fontStyle called "Oblique."
    I was trying to figure out how the findText function could find two fontStyles at the same time. My solution was to realize that each find is an array. So I made two finds and the concatenated the arrays. The resultant array (here called myFoundItems) elements can be searched through to find any that do not have the correct character style applied.
    My question is if the findText function can find more than two different objects at once or are we stuck with concatenating arrays?
    Below is part of the script:
    var myDoc = app.activeDocument;
    initFindReplace(); [This function zeros out anything left in the find/change preferences]
    app.findTextPreferences.fontStyle = "Italic";
    var myFoundItems1 = myDoc.findText();
    initFindReplace();
    app.findTextPreferences.fontStyle = "Oblique";
    var myFoundItems2 = myDoc.findText();
    initFindReplace();
    var myFoundItems = myFoundItems1.concat(myFoundItems2);
    Thanks,
    Tom

    Tom,
    The reason why you end up with an array of arrays is this: you define an array allMyFoundItems, then you iteratively collect other arrays using findText and insert ("push") these arrays into allMyFoundItems. Instead, you should use concatenate:
    var allMyFoundItems = new Array;
    for (. . .
       var myFoundItems = myDoc.findText();
       allMyFoundItems = allMyFoundItems.concat (myFoundItems)
    If you'll allow me a further comment, you could formulate your test to check whether a fontstyle name contains oblique or italic in one line:
    >if (arrFontStyles[k].search (/(italic|oblique)/i) > -1)
    And as the script searches but doesn't change anything, there's no need to set the ChangeTextPreferences. Your script could then be stated as follows:
    var myDoc = app.activeDocument;
    var arrFontStyles = myDoc.fonts.everyItem().fontStyleName;
    aa = findFontStyle (arrFontStyles);
    function findFontStyle (arrFontStyles)
       var allMyFoundItems = new Array;
       var myFoundItems2 = new Array;
       app.findTextPreferences = NothingEnum.NOTHING;
       for(var k = 0; k < arrFontStyles.length; k++)
          if (arrFontStyles[k].search (/(italic|oblique)/i) > -1)
             app.findTextPreferences.fontStyle = arrFontStyles[k];
             var myFoundItems = myDoc.findText();
             allMyFoundItems = allMyFoundItems.concat (myFoundItems);
             }//end if
          }//end for k
       return allMyFoundItems;
       }//end findFontStyle function
    As to formatting scripts in the forum, you can do this by wrapping your code in <pre> and </pre>. Also replace < with &lt; (< causes all lines of code to be displayed on one line). You should also replace curly quotes with straight codes, and tabs with (non-breaking) spaces. I use the following script for that:
    tf = app.documents.add().textFrames.add ({geometricBounds: [0,0,'700pt','500pt']})
    tf.insertionPoints[0].select();
    app.activeDocument.textPreferences.typographersQuotes = false;
    app.paste();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    sara (tf, '&', '&amp;');
    sara (tf, '<', '&lt;');
    sara (tf, '\\t', '   ');
    sara (tf, "'", "'");
    sara (tf, '"', '"');
    tf.parentStory.insertionPoints[0].contents = '<pre>';
    tf.parentStory.insertionPoints[-1].contents = '</pre>';
    function sara (tf, f, r)
       app.findGrepPreferences.findWhat = f;
       app.changeGrepPreferences.changeTo = r;
       tf.parentStory.changeGrep ()
    Copy the text of the script you want to prepare for posting, then run this above script. It creates a new InDesign document, pastes your script into it, and makes all the necessary changes. Then copy that and paste it into the forum.
    Peter

  • Synchronise TWO different Outlook calendars

    Hello,
    I'm about to buy a N70 or N73 but I woud like to know somethnig before :
    I created a second calendar on Outlook 2003 for my personal meetings. Is it possible to synchronise the 2 calendars (the main and my personal) at once, and have all the meetings (from my 2 Outlook calendars) in the same calendar of the mobile ? (murge of the 2 outlook calendars).
    I've found a post below (from jagardiner
    - 06-Mar-2006), which said that it used to work with an older version of PC Suite. Is it working again now ?
    Thanks for your help !
    "Trying to synchronize two different calendars
    Reply 1 of 5
    Viewed 217 times
    With my 9210i and an old version of pc suite I could synchronize two 'accounts' at once: my personal Outlook calendar and contacts AND my work calendar and contacts. Now I have a 9300i and PC Suite 6.70.22 it will only let me synchronize one 'account'. I've looked everywhere for help on this - sorry if I've missed something easy.
    06-Mar-2006
    01:44 PM "

    Hi,
    I think that you can sync two different outlook calendars to phone. But you need to change that (source) outlook calendar manually (->very easy to change).
    And use option "Update Microsoft Outlook data to the mobile phone" (then your outlook calendars are ok)

  • Two authorizations objects with OR function instead of AND

    Hi,
    We have created two authorization (RSECADMIN) objects for a CRM InfoProvider:
    Organizational responsible
    Delivery unit.
    Both the two authorized relevant InfoObjects are used in the query.
    In the query we have used a two authorization variables.
    Now only values in the authorizations are checked where Organizational responsible are true AND Delivery unit are true.
    Is it possible to check the authorization where:
    Organizational responsible is true OR Delivery unit is true??
    Please help!
    Regards,
    Jos.

    Hi,
    hmmm Andreas, I must comment on that:
    what is required is to show any record having Object1 = True OR Object2 = TRUE.
    Logically it is the same than asking:
    Don't show records having (Object1 NOT True) AND (Object2 NOT True), correct me if I am wrong there (this is pure Boolean math...)
    Because BW doesn't support this it doesn't mean that ANY system cannot do it.
    Simply put with SQL
    SELECT * FROM TABLE
    WHERE OBJ1 = TRUE OR OBJ2 = TRUE works perfectly in ANY RDBMS.
    also
    SELECT * FROM TABLE
    WHERE NOT OBJ1 <> TRUE AND OBJ2 <> TRUE would work as well.
    It is just that BW always perform an AND when you filter two different objects.
    Jos could achieve what he wants by setting up some restricted key figures and work it out with conditions but definitively not with standard authorizations.
    Alternatively, as I already mentioned, compounding objects would work but not without modeling effort. Finally I believe that with user exits it would also be possible... I don't have time but I would as well investigate bringing both objects along with the provider in a multi and verify if that couldn't be done by semi/standard means finally...
    hope this shed some lights on the issue....
    regards,
    Olivier.

  • Why do 2 different objects relink at the same time?

    I am sure this is answered somewhere, but I cannot find it and would like to get this file done.  I have two images (two different objects, two different frames, two different links) but somewhere along the way when I relinked the one file to a modified image it relinked the other file, which is supposed to have a separate image in it. When I first created this document, I had used same image twice, but I don't understand why INDD treats as grouped or whatever. They are not grouped objects this seems so simple but I can't get it. Please help, and many thanks in advance.

    You don't say waht version, but I'll presume CS4. I'll also presume that you have two instances of the same file linked in different locations of the document.
    In the links panel click the little triangle next to the link name to reveal the sub listing of the individual instances and select just the one you want to relink. If you select the group listing, all will be updated.

  • Save different Objects in one file by two different streams

    Hi all,
    I have a issue to read two Objects from one file if I write those in two different streams.
    I open the ObjectOutputStream and save an Object to the file. Then I close this stream and file. Then I open the new ObjectOutputStream and save the second Object in the same file. It works Ok. Then I open the ObjectInputStream and try to read those two objects and get java.io.StreamCorruptedException.
    This exception happes only when app tryes to read the second Object.
    this is the code example:
    //Write part
    for (int i=0;i<2;i++)
    File file = new File("test.swp");
    FileOutputStream fileOut = new FileOutputStream(file,true);
    ObjectOutputStream objOut = new ObjectOutputStream(fileOut);
    JobObject jobObj = new JobObject();
    jobObj.setID(i);
    objOut.writeObject(jobObj);
    objOut.flush();
    objOut.close();
    fileOut.close();
    //Read part
    FileInputStream fileOut = new FileInputStream("test.swp");
    ObjectInputStream objOut = new ObjectInputStream(fileOut);
    for (int i=0;i<2;i++)
    JobObject jobObj = (JobObject)objOut.readObject();
    objOut.close();
    fileOut.close();
    Thank for any help.

    Maybe try closing the ObjectInputStream (and re-creating it as needed) within your for loop?
    - Saish
    "My karma ran over your dogma." - Anon

  • Not able to compare PL/SQL body from two different offline database object

    It is not possible to compare two package bodies from two different off line database object in two different off line database and schema.
    JDeveloper display a compare not available message in the middle of the window.
    It is possible to compare the package specification.

    Not able to compare scripts generated from offline database objects too

  • How to do mosaic for different two georaster object?

    I have done mosaic for single georaster object, But I can't do it for different two georaster object. Oracle returned the error: ORA-13419.
    My PL/SQL code is:
    DECLARE
    gr sdo_georaster;
    BEGIN
    INSERT INTO georaster_table (georid, georaster) VALUES (1, sdo_geor.init('rdt_1')) RETURNING georaster INTO gr;
    sdo_geor.mosaic('city_images', 'image', gr, null);
    UPDATE georaster_table SET georaster=gr WHERE georid=1;
    END;
    There are two rows in city_images.I want to know how to set these data?

    Will,
    in general, all the images should be georeferenced. otherwise it would not make too much sense to do mosaic. so, you might want to load real image data from either georeferenced GeoTIFF files or TIFF plus TFW files.
    but GeoRaster doesn't require the images must be georeferenced. In GeoRaster, any image can have a different ULT coordinate, which doesn't have to be (0,0). This is a special feature of GeoRaster, in considering most formats always treat the upper-left corner pixel of an image as the origin (0,0) only. So in the cell space, non-georeferenced images can be co-located in different areas and so they can be mosaicked as well. specifically, you loaded two GIF files. their current ULT coordinates in georaster must be (0,0). If you setup the UTL coordinates of them differently and properly, then you shall be able to do the mosaicking. the functions you can use are getULTCoordinate and setULTCoordinate.
    hope this helps
    Jeffrey

  • Why two different explain plan for same objects?

    Believe or not there are two different databases, one for processing and one for reporting, plan is show different for same query. Table structure and indexes are same. It's 11G
    Thanks
    Good explain plan .. works fine..
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 12,775  Bytes: 184  Cardinality: 1                                                                        
         27 SORT UNIQUE  Cost: 12,775  Bytes: 184  Cardinality: 1                                                                   
              26 NESTED LOOPS                                                              
                   24 NESTED LOOPS  Cost: 12,774  Bytes: 184  Cardinality: 1                                                         
                        22 HASH JOIN  Cost: 12,772  Bytes: 178  Cardinality: 1                                                    
                             20 NESTED LOOPS SEMI  Cost: 30  Bytes: 166  Cardinality: 1                                               
                                  17 NESTED LOOPS  Cost: 19  Bytes: 140  Cardinality: 1                                          
                                       14 NESTED LOOPS OUTER  Cost: 16  Bytes: 84  Cardinality: 1                                     
                                            11 VIEW DSSADM. Cost: 14  Bytes: 37  Cardinality: 1                                
                                                 10 NESTED LOOPS                           
                                                      8 NESTED LOOPS  Cost: 14  Bytes: 103  Cardinality: 1                      
                                                           6 NESTED LOOPS  Cost: 13  Bytes: 87  Cardinality: 1                 
                                                                3 INLIST ITERATOR            
                                                                     2 TABLE ACCESS BY INDEX ROWID TABLE DSSODS.DRV_PS_JOB_FAMILY_TBL Cost: 10  Bytes: 51  Cardinality: 1       
                                                                          1 INDEX RANGE SCAN INDEX DSSODS.DRV_PS_JOB_FAMILY_TBL_CL_SETID Cost: 9  Cardinality: 1 
                                                                5 TABLE ACCESS BY INDEX ROWID TABLE DSSADM.DIM_JOBCODE Cost: 3  Bytes: 36  Cardinality: 1            
                                                                     4 INDEX RANGE SCAN INDEX DSSADM.STAN_JB_FN_IDX Cost: 2  Cardinality: 1       
                                                           7 INDEX UNIQUE SCAN INDEX (UNIQUE) DSSODS.DRV_PS_JOBCODE_TBL_SEQ_KEY_RPT Cost: 0  Cardinality: 1                 
                                                      9 TABLE ACCESS BY INDEX ROWID TABLE DSSODS.DRV_PS_JOBCODE_TBL_RPT Cost: 1  Bytes: 16  Cardinality: 1                      
                                            13 TABLE ACCESS BY INDEX ROWID TABLE DSSODS.DRV_PSXLATITEM_RPT Cost: 2  Bytes: 47  Cardinality: 1                                
                                                 12 INDEX RANGE SCAN INDEX DSSODS.PK_DRV_RIXLATITEM_RPT Cost: 1  Cardinality: 1                           
                                       16 TABLE ACCESS BY INDEX ROWID TABLE DSSADM.DIM_JOBCODE Cost: 3  Bytes: 56  Cardinality: 1                                     
                                            15 INDEX RANGE SCAN INDEX DSSADM.DIM_JOBCODE_EXPDT1 Cost: 2  Cardinality: 1                                
                                  19 TABLE ACCESS BY INDEX ROWID TABLE DSSODS.DRV_PS_JOB_RPT Cost: 11  Bytes: 438,906  Cardinality: 16,881                                          
                                       18 INDEX RANGE SCAN INDEX DSSODS.DRV_PS_JOB_JOBCODE_RPT Cost: 2  Cardinality: 8                                     
                             21 INDEX FAST FULL SCAN INDEX (UNIQUE) DSSADM.Z_PK_JOBCODE_PROMPT_TBL Cost: 12,699  Bytes: 66,790,236  Cardinality: 5,565,853                                               
                        23 INDEX RANGE SCAN INDEX DSSADM.DIM_PERSON_EMPL_RCD_SEQ_KEY Cost: 1  Cardinality: 1                                                    
                   25 TABLE ACCESS BY INDEX ROWID TABLE DSSADM.DIM_PERSON_EMPL_RCD Cost: 2  Bytes: 6  Cardinality: 1                                                         This bad plan ... show merge join cartesian and full table ..
    Plan
    SELECT STATEMENT  ALL_ROWSCost: 3,585  Bytes: 237  Cardinality: 1                                                              
         26 SORT UNIQUE  Cost: 3,585  Bytes: 237  Cardinality: 1                                                         
              25 NESTED LOOPS SEMI  Cost: 3,584  Bytes: 237  Cardinality: 1                                                    
                   22 NESTED LOOPS  Cost: 3,573  Bytes: 211  Cardinality: 1                                               
                        20 MERGE JOIN CARTESIAN  Cost: 2,864  Bytes: 70,446  Cardinality: 354                                          
                             17 NESTED LOOPS                                     
                                  15 NESTED LOOPS  Cost: 51  Bytes: 191  Cardinality: 1                                
                                       13 NESTED LOOPS OUTER  Cost: 50  Bytes: 180  Cardinality: 1                           
                                            10 HASH JOIN  Cost: 48  Bytes: 133  Cardinality: 1                      
                                                 6 NESTED LOOPS                 
                                                      4 NESTED LOOPS  Cost: 38  Bytes: 656  Cardinality: 8            
                                                           2 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DIM_JOBCODE Cost: 14  Bytes: 448  Cardinality: 8       
                                                                1 INDEX RANGE SCAN INDEX REPORT2.STAN_PROM_JB_IDX Cost: 6  Cardinality: 95 
                                                           3 INDEX RANGE SCAN INDEX REPORT2.SETID_JC_IDX Cost: 2  Cardinality: 1       
                                                      5 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DIM_JOBCODE Cost: 3  Bytes: 26  Cardinality: 1            
                                                 9 INLIST ITERATOR                 
                                                      8 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DRV_PS_JOB_FAMILY_TBL Cost: 10  Bytes: 51  Cardinality: 1            
                                                           7 INDEX RANGE SCAN INDEX REPORT2.DRV_PS_JOB_FAMILY_TBL_CL_SETID Cost: 9  Cardinality: 1       
                                            12 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DRV_PSXLATITEM_RPT Cost: 2  Bytes: 47  Cardinality: 1                      
                                                 11 INDEX RANGE SCAN INDEX REPORT2.PK_DRV_RIXLATITEM_RPT Cost: 1  Cardinality: 1                 
                                       14 INDEX UNIQUE SCAN INDEX (UNIQUE) REPORT2.DRV_PS_JOBCODE_TBL_SEQ_KEY_RPT Cost: 0  Cardinality: 1                           
                                  16 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DRV_PS_JOBCODE_TBL_RPT Cost: 1  Bytes: 11  Cardinality: 1                                
                             19 BUFFER SORT  Cost: 2,863  Bytes: 4,295,552  Cardinality: 536,944                                     
                                  18 TABLE ACCESS FULL TABLE REPORT2.DIM_PERSON_EMPL_RCD Cost: 2,813  Bytes: 4,295,552  Cardinality: 536,944                                
                        21 INDEX RANGE SCAN INDEX (UNIQUE) REPORT2.Z_PK_JOBCODE_PROMPT_TBL Cost: 2  Bytes: 12  Cardinality: 1                                          
                   24 TABLE ACCESS BY INDEX ROWID TABLE REPORT2.DRV_PS_JOB_RPT Cost: 11  Bytes: 1,349,920  Cardinality: 51,920                                               
                        23 INDEX RANGE SCAN INDEX REPORT2.DRV_PS_JOB_JOBCODE_RPT Cost: 2  Cardinality: 8                                          

    user550024 wrote:
    I am really surprise that the stat for good sql are little old. I just computed the states of bad sql so they are uptodate..
    There is something terribly wrong..Not necessarily. Just using the default stats collection I've seen a few cases of things suddenly going wrong. As the data increases, it gets closer to an edge case where the inadequacy of the statistics convinces the optimizer to do a wrong plan. To fix, I could just go into dbconsole, set the stats back to a time when they worked, and locked them. In most cases it's definitely better to figure out what is really going on, though, to give the optimizer better information to work with. Aside from the value of learning how to do it, for some cases it's not so simple. Also, many think the default settings of the database statistic collection may be wrong in general (in 10.2.x, at least). So much depends on your application and data that you can't make too many generalizations. You have to look at the evidence and figure it out. There is still a steep learning curve for the tools to look at the evidence. People are here to help with that.
    Most of the time it works better than a dumb rule based optimizer, but at the cost of a few situations where people are smarter than computers. It's taken a lot of years to get to this point.

  • Plz Help me: how to find two different Expressions (Objects Strig)are equal

    Actaully I m having a problem i have the situation
    Suppose i have two String objects s1="Hotel in Paris" and s2="Paris in Hotel"
    means if we have to String then by considering the permutations on first String we have serch out that whether it is foud in second string or not: e.g
    String s1= "computer notebook sony";
    String s2=" sony computer notebook ";
    How to find that these two Objects or your can say "expressions" are equal in java ..................................................................................................Please Tell , if any one have any idea abt it
    many many Thanks in Advance

    This won't work with duplicate words, will it? well, maybe, since you are putting both strings in sets. But then, how would this handle capitalization? This is my ugly solution:
         public static void main(String[] args) throws Exception {
              String s1= "computer notebook sony";
              String s2=" sony Computer notebook ";
              s1 = s1.toLowerCase();
              s2 = s2.toLowerCase();
              String [] words1 = s1.split("\\b");
              for(String w : words1)
                   s2 = s2.replace(w,"");
              if(s2.trim().length() == 0)
                   System.out.println("The strings are equal");
              else
                   System.out.println("They are not equal.");
         }~Tim

  • Two resultset objects

    IS it possible to define two resultset objects with two different queries inside the same DB class?java.sql.SQLException: Invalid state, the ResultSet object is closed.
         at net.sourceforge.jtds.jdbc.JtdsResultSet.checkOpen(JtdsResultSet.java:299)
         at net.sourceforge.jtds.jdbc.MSCursorResultSet.next(MSCursorResultSet.java:1123)
         at DB5.getDetails(Daily_Quote_Response_report.java:238)
         at Daily_Quote_Response_report.main(Daily_Quote_Response_report.java:74)
    java.util.List items = null;
            String query;
            String query2;
            try {
                query =
                       "select * from oqrep_except_resp_summary";
                query2 = "select * from oqrep_except_resp_detail";
                Statement state = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_READ_ONLY);
                ResultSet rs = state.executeQuery(query);
                ResultSet rs2 = state.executeQuery(query2);
              //cannot create two rs objects // ResultSet rs2 = state.executeQuery(query);
                items = new ArrayList();Edited by: bobz on 03-Dec-2009 11:16
    Edited by: bobz on 03-Dec-2009 11:16

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.

  • Two different plans in TEST & Prod

    hi,
    we have a problem in production database where we find some sql statements running very slow.
    but if you run same SQL statement in TEST it runs < 2 secs.
    Production DB Prod.SchemaA  is exported into TEST DB as Test.SchemaA
    When study the explain plan, we find Prod explain plan is different than test. if you create sql profile, by copying TEST explain plan, it would run faster in Production.
    Now our question is why optimizer goes through two different plans when the schema structure same and data almost same in two databases?
    Note that, we have two almost identical schema's in Production. Prod.SchemaA and Prod.SchemaB has same object names but some Prod.SchemaB may have small difference in indexes/constraints.
    Users would run same SQL statement both in Prod.SchemaA & Prod.SchemaB time to time.
    thanks
    neal

    You can have a clear picture about the accuracy of your statistics by getting the execution plan from memory into the TEST and PROD environment. You can proceed as follows
    PROD> alter session set statistics_level=ALL;
    PROD> execute your query;
    PROD> select * from table (dbms_xplan.display_cursor(null,null, 'ALLSTATS LAST'));
    TEST> alter session set statistics_level=ALL;
    TEST> execute your query
    TEST> select * from table (dbms_xplan.display_cursor(null,null, 'ALLSTATS LAST'));
    This will give an execution plan showing the estimations(E-Rows) done by the CBO and the Actual (A-Rows) rows generated allowing you to judge the accuracy of your statistics.
    The predicate part of the execution plan can also show inportant information.
    Best regards
    Mohamed Houri
    www.hourim.wordpress.com

  • Transfer structure have two different tech names?

    Hi BW experts,
    we got issue in transfer structure which have two different technical names:
    ZCUSTOMER_DC and
    ZCUSTOMER_PS
    where zcustomer is the info source name.
    The impact: PSA data can't be accessed ...
    Any help and feedback is highly appreciated!
    Regards,
    Lilly

    Hi Dinesh,
    Thanks for your feedback.
    Unfortunately, this issue is thru our system landscape incl. production. If I try to delete the DS assignment I will lose data in the PSA, right?
    However, I did try to delete the DS assignment and delete the info source (the one which is available on dev only), failed, the message I get is info object xyz still being used in communication structure (I believe it must the TS with old prefix), deletion not possible.
    The problem is I am not able to delete the TS with old prefix , because it is not visible in system (AWB).
    Any further feedback appreciated

Maybe you are looking for

  • Bluetooth iPhone 4 to MacBook Pro - HELP!!!!

    Hi, (Sorry if this is a repitition of a million other questions / pleas for help) Basically this morning I clicked 'forget this device' on my iPhone by accident, so now my macbook does not appear on the devices list on my iphone. I can see my phone o

  • New Podcast Episodes Not Updating if Not Subscribed

    Hey there, My podcast hasn't updated the latest two weekly podcast episodes if you haven't subscribed. If you have subscribed, the episodes are available for download. XML uploaded yesterday. Here is my xml feed: https://s3.amazonaws.com/GraceHB_Down

  • Migration problem 7.2.3 to 8.0.5

    I keep getting an error in the same place when trying to do an import of a database. Checked tablespace sizes, and we are doing a local import. Did 2 seperate exports, and same problem, both import and export as 'system'.. IMP-00017: following statem

  • How to Prepare Invoice in ADF to be Printed ???

    I am trying to finish my project and I am now Searching for how to prepare an Invoice to be printed. I have items and its prices I want to add total prices for items and its quantities. I want also to calculate the sum of all items bought. Can anybod

  • GoPro HERO4 Black - Editing 4K on Premiere Pro CC 2014.0.1

    Hello, I'm new to the GoPro and we recently purchased a HERO4 Black.  I'm editing with Premiere Pro CC 2014.0.1 on a MacBook Pro, specs below: 2.8 GHz Intel Core i7 16 GB 1600 MHz DDR3 Graphics NVIDIA GeFore GT 750M 2048MB OS X 10.9.4 (13E28) I have