Window.bounds gives weird results

I run without Application Frame and without Application Bar. I see no point to the former and the latter is just a shocking waste of space. For years, I've been using a handful of scripts to manage my window positions. One of them is now misbehaving. The script is so old that it didn't use functions and all its variables were global -- it probably dates all the way back to when I was beta-testing the original ExtendScript in CS.
So I decided to rewrite it in case I'd done something weird that rewriting would expose. Well, I found the weirdness but it wasn't me. With one document window open, I typed this into the JavaScript Console (I'm running with a monitor that is 1920 x 1200):
app.windows[0].bounds = [22,32,1140,863]
and the console duly responded with:
Result: 22,32,1140,863
and visually, I can see that the window is indeed at that location.
But now when I type:
app.windows[0].bounds
into the JS Console, it responds with:
Result: 60,32,1178,863
The x values are right but the y values are off by 38.
Is this a Mac-only issue? I'm running with Mountain Lion on a Retina MacBook Pro. Oh: of course it's Mac only: you can't switch off the Application Frame on Windows, can you?
Dave

It turned out that moving to 0,0 created problems with the x-coordinate, but since those were the only x-coordinate problems I ever saw, I decided to focus only on the y-coordinate. In this version of the script, I move the window to y = 0 to measure the current value of the y error.
//DESCRIPTION: Resets active layoutWindow size or uses front layoutWindow to set page default size.
          Rewrite of a venerable old favorite
          1. If no layoutWindow open offer to delete settings file
          2. If no settings and layoutWindow offer to make layoutWindow bounds new settings
          3. If settings and layoutWindow move layoutWindow to settings location unless there's a layoutWindow already there
              in which case, move layoutWindow next to that other layoutWindow or move only layoutWindow right by its width
(function() {
          var settingsFile = getSettingsFile();
          if (app.layoutWindows.length == 0) {
                    // no front layoutWindow; offer user chance to delete settings
                    if (confirm("No layoutWindow is open; would you like to delete the settings file?")) {
                              // user said yes; only bother to delete it if it exists
                              if (settingsFile.exists) {
                                        settingsFile.remove();
                    return; // no layoutWindow, so nothing more to do
          // there's at least one layoutWindow
          var yDelta = getDelta(app.layoutWindows[0]);
          if (settingsFile.exists) {
                    applySettings(settingsFile, yDelta);
          } else {
                    if (confirm("Settings file is missing. Use current front layoutWindow to set default?")) {
                              // user said do it
                              var bounds = app.layoutWindows[0].bounds;
                              var bounds = [
                                        bounds[0] - yDelta,
                                        bounds[1],
                                        bounds[2] - yDelta,
                                        bounds[3]
                              new File(settingsFile);
                              settingsFile.open("w");
                              settingsFile.write(bounds);
                              settingsFile.close();
          function getDelta(layoutWindow) {
                    // get current layoutWindow position and dimensions
                    var reportedBounds = layoutWindow.bounds;
                    var wHeight = reportedBounds[2] - reportedBounds[0];
                    // move to 0, 0
                    layoutWindow.bounds = [0, reportedBounds[1], wHeight, reportedBounds[3]];
                    $.sleep(10);
                    var newBounds = layoutWindow.bounds;
                    // calculate errors
                    var yDelta = newBounds[0];
                    // restore layoutWindow to original position
                    layoutWindow.bounds = [
                              reportedBounds[0] - yDelta,
                              reportedBounds[1],
                              reportedBounds[2] - yDelta,
                              reportedBounds[3]
                    $.sleep(10);
                    return yDelta
          function applySettings(settingsFile, yDelta) {
                    // values written out to the settings file must take delta into account
                    settingsFile.open("r");
                    var savedBounds = settingsFile.read();
                    settingsFile.close();
                    var myBounds = savedBounds.split(",");
                    for (var j = myBounds.length - 1; j >= 0; j--) {
                              myBounds[j] = Number(myBounds[j]);
                    // Check to see if an existing layoutWindow is already at these bounds;
                    var layoutWindowsBounds = app.layoutWindows.everyItem().bounds;
                    // all these values are off by delta
                    for (var j = layoutWindowsBounds.length - 1; j >= 0; j--) {
                              if (layoutWindowsBounds[j][0] - yDelta == myBounds[0]
                                                  && layoutWindowsBounds[j][1]  == myBounds[1]
                                                  && layoutWindowsBounds[j][2] - yDelta == myBounds[2]
                                                  && layoutWindowsBounds[j][3] == myBounds[3]) {
                                        // layoutWindow right there, so:
                                        var myWidth = myBounds[3] - myBounds[1];
                                        myBounds[1] += myWidth;
                                        myBounds[3] += myWidth;
                                        break; // only do it once!
                    app.layoutWindows[0].bounds = myBounds;
          function getSettingsFile() {
                    var scriptFile = getScriptFile();
                    return File(scriptFile.parent + "/PageDefault" + parseInt(app.version) + ".txt");
          function getScriptFile() {
                    // This function returns the file of the active script, even when running ESTK
                    try {
                              return app.activeScript;
                    } catch(e) {
                              return File(e.fileName);

Similar Messages

  • Timer problem, GetCtrlAtt​ribute gives weird results

    I have several timers and am having problems with one that I have enabled and set the time interval to 60.0 s. I was trying to change the time interval and couldn't get that to work, so decided to interrogate it for the enabled status and the time interval status. This is the code snippet:
                printf("MFC enCheck: %d\n", GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_ENABLED, &enValue));
                printf("MFC timerCheck: %d\n", GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_INTERVAL, &mfcTimerValue));
                printf("MFC enValue: %d\n", enValue);
                printf("MFC mfcTimerValue: %d\n", mfcTimerValue);
    Although the timer appears to be running, I'm getting zeros for all the printf's except for enValue in
    GetCtrlAttribute (panel, PANEL_TIMER_MFC_DATA_ACQ, ATTR_ENABLED, &enValue)
    which is showing 1,078,853,632 and I can't understand where this strange value is coming from and can't understand why I'm getting zeros for the other values. All the values are int's: enCheck, enValue, timerCheck and mfcTimerValue. Any ideas?
    Thanks,
    John
    Solved!
    Go to Solution.

    John, you are getting 0s as a return vlaue from GetCtrlVal which means the functions have found no error.
    On the other hand, as you can see here, timer interval is a double value and you should get an error while trying to read it into an int, which you aren't. This is strange!
    I suggest you to double check all inputs to the functions, particularly 'panel' variable: this must be the handle of the panel the timer is on. A wrong value in this variable could explain why you seem unable to change timer interval.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Do IMAQ Cast Image or IMAQ Linear averages give different results when using different computers that are running under Windows XP ?

    Hello
    I'm currently developping an image processing algorithm using Labview 7.1 and the associated IMAQ Vision tools. After several tests, I found a weird result. Indeed, I put the labview algorithm - including the IMAQ VI on the library to get sure that I use all the time the same VI - on my memory stick and used it on two different computers. I tested the same picture (still in my memory stick) and had two very different results.
    After several hours trying to understand why, I found that there were a difference between the results given by both computers at the very begining of the algorithm. Indeed, I used a JPEG file.
    To open it, I first create an Image with IMAQ Create (U8). Then, I open it.
    Then in my first sub-VI, I use IMAQ Cast Image to be sure that the picture is a U8 grayscale picture.
    Right after that, I use the IMAQ Linear Averages. The results of this VI are different on the two computers.
    I tried several time on the same picture : one computer always give me the same result but the two computers give me a different result. So there is no random variable on the results.
    So my question is : Do IMAQ Cast Image or IMAQ Linear averages give different results when using different computers that are running under Windows XP ?
    My bet is on IMAQ Cast Image but I'm not quite sure and I do not undestand why. The labview and IMAQ are the same on both computers.
    The difference between the two computer are above :
    Computer 1 :
    Pentium(R) 4 CPU 3.20GHz with a RAM of 1Go. The processor is an Intel(R).
    The OS is windows XP Pro 2002
    Computer 2 :
    Pentium(R) 4 CPU 2.80GHz with a RAM of 512Mo. The processor is an Intel(R).
    The OS is windows XP Pro 2002.
    If anybody can help me on this problem, it would be really helpful.
    Regards
    Florence P.

    Hi,
    Indeed it's a strange behaviour, could you send me your VI and your JPEG file, (or another file that reproduces) so that I could check this inthere ?
    I'll then try to find out what's happening.
    Regards
    Richard Keromen
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Découvrez, en vidéo, les innovations technologiques réalisées en éco-conception

  • Frame extended state and window bounds.

    I'm trying to save the bounds of a window when my program exits, so that I can initialize the next session to the same window bounds. It seems well known that calling getBounds() on a maximized window will basically give you your screen dimensions. So this means that if the user exits the program when the window is maximized, the next time they start it up, the window will be set to fill their screen as though it were maximized, but in the restored state. Not good. It also seems well known that there is no clean way to get the restored bounds on a maxmized window. Also not good. I found this forum on the subject:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=603605
    Someone suggested restoring the window manually before checking the bounds, but I don't want to do this because the action would be visible to the user, and takes time. Instead I opted for the component listener approach. Here's where my problem comes in:
    It seems that move and resize events happen at inconsistent times. In my component listener, I poll window.getExtendedState() and getBounds() in componentMoved() and componentResized(). When I maximize the window, I get MOVE event that shows getExtendedState() to be NORMAL, but getBounds() to be maximized. When I restore the window, I get a RESIZE event that shows getBounds() to be restored.
    Maybe I'm just confused here, but this doesn't make any sense. Those two values should be consistent-- and I should get the event after everything is DONE, including the extended state flag being properly set. It seems to me that this is bug-like behavior. Am I wrong?
    Furthermore, my problem remains, because if the user exits in the maximized state, the last event will have been a reporting of the maximized window bounds-- so my attempts to remember what the window was before it was maximized will have failed. It really steams me that the API seems to be conspiring to prevent me from getting this simple piece of information.
    So has there been any progress on the front of a clean solution to getting the restored bounds without restoring the window? Surely that information exists somewhere in the JVM. I shouldn't have to do backflips to get it. (Perhaps I should post a feature request).
    How should I get around this?
    P.S.
    Here's a test case:
    import java.awt.event.ComponentEvent;
    import java.awt.event.ComponentListener;
    import javax.swing.JFrame;
    * @author Tim Babb
    public class Main {
        static JFrame frame;
        public static void main(String[] args) {
            frame = new JFrame("Test Case");
            frame.addComponentListener(new ComponentListener(){
                public void componentHidden(ComponentEvent evt){
                    //do nothing
                public void componentMoved(ComponentEvent evt){
                    if (frame.getExtendedState() == frame.NORMAL){
                        System.out.println("Moved: " + frame.getBounds());
                public void componentResized(ComponentEvent evt){
                    if (frame.getExtendedState() == frame.NORMAL){
                        System.out.println("Resized: " + frame.getBounds());
                public void componentShown(ComponentEvent evt){
                    //do nothing
            frame.setVisible(true);
    }

    I am seeing the same thing, it seems that in Windows maximize delivers two events a move and then a resize. The change state event comes in the middle, I am sure there is some good reason.
    I have had a go at writing a NormalBoundsListener that compensates for this. Would be interested to find out if this was Windows specific.
    Hope this helps, if you have a better solution please let me know.
    private class NormalBoundsListener implements ComponentListener {
    private final Rectangle previousNormalBounds = new Rectangle();
    private int previousExtendedState = 0;
    public void componentHidden(ComponentEvent e) {
    // do nothing
    public void componentMoved(ComponentEvent e) {
    storeNormalBounds();
    public void componentResized(ComponentEvent e) {
    storeNormalBounds();
    public void componentShown(ComponentEvent e) {
    storeNormalBounds();
    private void storeNormalBounds() {
    int extendedState = getExtendedState();
    if(extendedState == Frame.NORMAL) {
    previousExtendedState = extendedState;
    previousNormalBounds.setBounds(normalBounds);
    getBounds(normalBounds);
    } else if(extendedState == Frame.MAXIMIZED_BOTH && previousExtendedState == Frame.NORMAL) {
    previousExtendedState = extendedState;
    normalBounds.setBounds(previousNormalBounds);
    }

  • Variable Definitions - weird results

    Using Flash8 I am getting some weird results when defining
    variables.
    In my Actionscripts I am trying to define and assign
    variables on the same line and then trace it as below :
    var light_critical_colour:String = "#FF0000";
    trace ("light_critical_colour = " + light_critical_colour);
    If I create an new blank fla file and place this in the first
    frame, scene 1, it works as you would expect and opens a trace
    window and returns "light_critical_colour = #FF0000". Also if I
    remove the first line then the result is "light_critical_colour =
    undefined" again as expected.
    My issue is that I have another fla file which i have created
    from scratch as per the example above. I have 2 scenes, scene 1 is
    the preloader and scene 2 is the main user screen. It does not
    matter where I place the code even in the the first frame of scene
    1, the var definition seems to be ignored and if I remove the var
    definition line and just have "trace ("light_critical_colour = " +
    light_critical_colour);" I get "light_critical_colour =" rather
    than "light_critical_colour = undefined" as expected.
    Does anyone have any idea's ?
    Thanks

    More Information:
    I have managed to get around this by cutting and pasting my
    ActionScript and objects into a new fla and its now working fine.
    If I was not such a ActionScript newbee I would suggest that
    this is a Flash8 bug !
    This sure managed to waste lots of my time.........

  • Custom search using boolean attribute set to True gives no result

    I am setting up an auto-query using the custom search portlet. This is to show all items where a boolean custom attribute is checked, ie = True.
    In step 3 I have tried to set the operator to Equals to and the default value to True. This gives no results even though several items have this attribute set to True.
    The Auto Query check box is checked.

    Found that True = 1 in database. When set to this the search works.

  • P/L A/c for a single day gives different results for different users

    Hi!
         We have SAP B1 8.81 (PL 09) in our office. P/L Account for a particular date gives different value for a single account (Other Income Account) for one user and a consistent value for all other users. The user in question is a super user and does not seem to pick a specific entry posted in the Other Income Account for that day thus giving erroneous result. I have checked the Trial Balance for that day and it gives proper result. Only the P/L account gives erroneous data. Could anyone help with the reason for this.
    Thanks
    Sreekumar

    Hi Jitin,
              Thanks for your reply.
              I tried the way you mentioned. However, the result is the same.
              The entry that I'm talking about is an automatic journal entry posted through the Outgoing Payment option.
              To make it more clear, an outgoing payment to a vendor was posted on 05/19/11 for 1,42,178.32. The check was drawn only for 71,089.16 which was the correct amount and the remaining amount (71,089.16) got posted in the Other Income account. The P/L account for this date is not picking the amount of 71,089.16 in the Other Income Account.
    Thanks & Regards
    Sreekumar
    Edited by: Sreekumar on Jan 31, 2012 5:58 PM

  • Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    First, confirm that ActiveX Filtering is configured to allow Flash content:
    https://forums.adobe.com/thread/867968
    Internet Explorer 11 introduces a number of changes both to how the browser identifies itself to remote web servers, and to how it processes JavaScript intended to target behaviors specific to Internet Explorer. Unfortunately, this means that content on some sites will be broken until the content provider changes their site to conform to the new development approach required by modern versions of IE.
    You can try to work around these issues by using Compatibility View:
    http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
    If that is too inconvenient, using Google Chrome may be a preferable alternative.

  • Enterprise Manager does not give correct results

    I am using version 9.0.2.0.1 core edition(oc4j & web-cache).
    My application consists of business components, java beans and jsp. It is running fine.
    Oracle enterprise manager is not giving correct results of memory/cpu usage by oc4j_home and bc4j.
    Some times it does not gives result, when i refresh it twice or thrice it shows results.
    But results are not correct. On each refresh it gives different results.
    Then it is very hard to find which resuslt is correct.
    waiting for response,
    Tahir.

    i have been using 9iAS versions 102*, 90200, 90201, and now using 903.
    As stated above, some times the results for oc4j_home is displayed.
    But the memory/cpu usage for bc4j is never shown.
    Also, its radio-button is always disabled. while its status is "running".
    On BC4J page, it also shows results of application modules created. But these results are usually wrong.
    How bc4j will be enabled, and how its memory results can be get ???
    Tahir.

  • Calling PL/SQL Procedure In Another Schema Gives Unexpected Result

    I have a SQL Script that does this:
    conn pnr/<password for user pnr>;
    set serveroutput on;
    exec vms.disable_all_fk_constraints;
    SELECT owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R';
    and the disable_all_fk_constraints procedure that is owned by user 'vms' is defined as:
    create or replace
    procedure disable_all_fk_constraints is
    v_sql   VARCHAR2(4000);
    begin
    dbms_output.put_line('Disabling all referential integrity constraints.');
    for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type='R') loop
    dbms_output.put_line('Disabling constraint ' || rec.constraint_name || ' from ' || rec.table_name || '.');
    v_sql := 'ALTER TABLE ' || rec.table_name || ' DISABLE CONSTRAINT ' || rec.constraint_name;
    execute immediate(v_sql);
    end loop;
    end;
    When I run the SQL script, the call to vms.disable_all_fk_constraints disables the FK constrains in the 'vms' schema, whereas I wanted it to disable the FK constraints in the 'pnr' schema (the invoker of the procedure). I know that I could make this work by copying the disable_all_fk_constraints procedure to the 'pnr' schema and calling it as "+exec disable_all_fk_constraints;+" from within the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.
    What can I do?
    Thank you

    You have two issues to solve.
    First you need to write a packaged procedure that works with INVOKER rights. The default is DEFINER rights.
    The difference is excatly what you need. Usually the package has the rights from the schema where it is defined (=Definer rights). In your case schema VMS. Whereas you need the privileges from the user that calls the package (PNR).
    => Check out the documentation for INVOKER rights
    The second problem is that the view "user_constraints" will not give the results you expect when called from inside a procedure in another schema. An alternative could be to use the view DBA_CONSTRAINTS with a filter on the owner (where owner = 'PNR'). Not sure if there are other working possibilities. Well you could create a list of constraint names that you want to disable, instead of creating the list dynamically.
    And you could have another potential disaster creeping up upon you. If you run this thing, then at this moment you don't have any referential integrity anymore. You can't be sure that you can create the FKs again after this action. This is EXTREMLY DANGEROUS. I would never ever do this in any kind of production or test database. I would be very careful when I do it on a development database.

  • 0I_FYPER - Variable in BEx gives no result

    Hello all,
    I have a problem in BEx-reporting after a releasechange from BW3.5 to BI7.0 and at the same time SEM-BCS4.0 to SEM-BCS6.0 which belongs to the variable 0I_FYPER. I use this variable in the columns (only) in order to give the user the possibillity to define which periods to show. In the rows I use the rest for defining which numbers to bring up. It worked in BW3.5/SEM-BCS4.0 fine.
    I debuged the content of the variable in user-exit ZXRSRU01 (after processing the selection screen) and could find the data I entered but the query gives no result. Any ideas?
    Thank you for any feedback,
    Chris

    Hi Guru,
    We have a work around for your issue. Just create a customer Exit variable on the calendar month and use it in the filter.
    In the customer Exit variable read the Plant variable and if it is empty populate # as result. Else read the calmonth input variable and populate it as the result.
    Use the following snippet to read input ready variables.
    DATA: loc_var_range LIKE rrrangeexit.
    READ TABLE i_t_var_range WITH KEY vnam = 'VARNAME' INTO loc_var_range.
    (loc_var_range-low will have the value of the variable)
    Hope this helps.
    Regards.
    Shafi.

  • NonLinearFitWithMaxIters does not give correct results for phase

    Dear all,
    I am trying to fit a sin cuve with NonLinearFitWithMaxIters function of labwindows, but the results given by this function are dispersed a lot (the function does not give same results).
    In fact, I have two waveforms signals v and i (of 104 points), and I  find the phase between the two signals with NonLinearFitWithMaxIters.
    The two singals v and i are  measured with an osciloscope.
    I use the following fit functions :
    v=p1*sin(wt+p2) ;
    i=p3*sin(wt+p4) ;
    I use the NonLinearFitWithMaxIters function to fit the data and to have the parameters  p1, p2, p3, p4. Then, the phase is claculated as follow phase=p4-p3.
    The problem is that the phase calculted between the two signals (v and i) is different for each run for the same conditions.
    In fact, for a same condition, I measure different times the signals v and i, and I calculate the phase p4-p3, using NonLinearFitWithMaxIters. The goal is to calculate a mean of phases for the same condition. For example, there are cases where the phase=-5 degree, and other cases when phase=12 degree.
    For ten measures of v and i, the phase calculated is different. I get a big dispersion between the phases.
    I would like to know please why I have a big difference in phases calculated with the same condition?whern using NonLinearFitWithMaxIters.
    I read that this function does not give all time the correct results, is there a way to know when the results are not corrects and when they are correct ?
    And is there any solution to find accuratly the phase between the two waveforms.
    Thank you for your precious answer.

    The pseudocode which I am using is :
    v_err=NonLinearFitWithMaxIters(array_x,array_v,v_y_fit,1252,100,sinus,v_coef,2,&v_mean_squareError);
    The fit function is
    double sinus(double x, double a[],int noef){
        return (a[0]*sin((w*x)+a[1]));
     I use the same inital coeficient of v_coef for each run :     
    v_coef[0]=0.03;
    v_coef[1]=0.2;
    These coeficient are choosen arbitrary.
    In this case, the number of points of the data is 1252 (the data of array_v).
    The number of iterations is 100.
    For the array_x, the distance between adjacents values of the array is dt=0.4*1e-9(difference between array_x[i] anv array_x[i+1]=dt=0.4*1e-9 ).
    for (i=0;i<1252;i++){
    array_x[i]=i*(0.4*1e-9);
    The means square error returnned by the function when it is complished is  small, of the order of 0,001.
    I read the help
    « From the help:
    You must pass a pointer to the nonlinear function f(x,a) along with a set of initial guess coefficients a. NonLinearFitWithMaxIters does not always give the correct answer. The correct output sometimes depends on the initial choice of a. It is very important to verify the final result.
    That means that the function cannot be used, as it does not give correct results. How
    can we check if the results are good or not ? in my case.
    I think that in my case, the function does not give correct results, but how can I check if the results are good, or not ? The mean square error is small.

  • Select for update gives wrong results. Is it a bug?

    Hi,
    Select for update gives wrong results. Is it a bug?
    CREATE TABLE TaxIds
    TaxId NUMBER(6) NOT NULL,
    LocationId NUMBER(3) NOT NULL,
    Status NUMBER(1)
    PARTITION BY LIST (LocationId)
    PARTITION P111 VALUES (111),
    PARTITION P222 VALUES (222),
    PARTITION P333 VALUES (333)
    ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
    CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
    Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200103, 222, NULL);
    --Session_1 return TAXID=100101
    select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
    --Session_2 waits commit
    select TAXID from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
    --Session_1
    update TAXIDS set STATUS=1 Where TaxId=100101;
    commit;
    --Session_2 return 100101 opps!?
    --Session_1 return TAXID=100102
    select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
    --Session_2 waits commit
    select TAXID, STATUS from TAXIDS where LOCATIONID=111 and NVL(STATUS,0)=0 AND rownum=1 for update
    --Session_1
    update TAXIDS set STATUS=1 Where TaxId=100102;
    commit;
    --Session_2 return 100103                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    This is a bug. Got to be a bug.
    This should be nothing to do with indeterminate results from ROWNUM, and nothing to do with read consistency at the point of statement start time in session2., surely.
    Session 2 should never return 100101 once the lock from session 1 is released.
    The SELECT FOR UPDATE should restart and 100101 should not be selected as it does not meet the criteria of the select.
    A statement restart should ensure this.
    A number of demos highlight this.
    Firstly, recall the original observation in the original test case.
    Setup
    SQL> DROP TABLE taxids;
    Table dropped.
    SQL> 
    SQL> CREATE TABLE TaxIds
      2  (TaxId NUMBER(6) NOT NULL,
      3   LocationId NUMBER(3) NOT NULL,
      4   Status NUMBER(1))
      5  PARTITION BY LIST (LocationId)
      6  (PARTITION P111 VALUES (111),
      7   PARTITION P222 VALUES (222),
      8   PARTITION P333 VALUES (333));
    Table created.
    SQL>
    SQL> ALTER TABLE TaxIds ADD ( CONSTRAINT PK_TaxIds PRIMARY KEY (TaxId));
    Table altered.
    SQL>
    SQL> CREATE INDEX NI_TaxIdsStatus ON TaxIds ( NVL(Status,0) ) LOCAL;
    Index created.
    SQL>
    SQL>
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100101, 111, NULL);
    1 row created.
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100102, 111, NULL);
    1 row created.
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100103, 111, NULL);
    1 row created.
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (100104, 111, NULL);
    1 row created.
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200101, 222, NULL);
    1 row created.
    SQL> Insert into TAXIDS (TAXID, LOCATIONID, STATUS) Values (200102, 222, NULL);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> Original observation:
    Session1>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    ROWNUM        = 1
      6  FOR UPDATE;
         TAXID
        100101
    Session1>
    --> Session 2 with same statement hangs until
    Session1>BEGIN
      2   UPDATE taxids SET status=1 WHERE taxid=100101;
      3   COMMIT;
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    Session1>
    --> At which point, Session 2 returns
    Session2>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    ROWNUM        = 1
      6  FOR UPDATE;
         TAXID
        100101
    Session2>There's no way that session 2 should have returned 100101. That is the point of FOR UPDATE. It completely reintroduces the lost UPDATE scenario.
    Secondly, what happens if we drop the index.
    Let's reset the data and drop the index:
    Session1>UPDATE taxids SET status=0 where taxid=100101;
    1 row updated.
    Session1>commit;
    Commit complete.
    Session1>drop index NI_TaxIdsStatus;
    Index dropped.
    Session1>Then try again:
    Session1>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    ROWNUM        = 1
      6  FOR UPDATE;
         TAXID
        100101
    Session1>
    --> Session 2 hangs again until
    Session1>BEGIN
      2   UPDATE taxids SET status=1 WHERE taxid=100101;
      3   COMMIT;
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    Session1>
    --> At which point in session 2:
    Session2>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    ROWNUM        = 1
      6  FOR UPDATE;
         TAXID
        100102
    Session2>Proves nothing, Non-deterministic ROWNUM you say.
    Then let's reset, recreate the index and explicity ask then for row 100101.
    It should give the same result as the ROWNUM query without any doubts over the ROWNUM, etc.
    If the original behaviour was correct, session 2 should also be able to get 100101:
    Session1>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    taxid         = 100101
      6  FOR UPDATE;
         TAXID
        100101
    Session1>
    --> same statement hangs in session 2 until
    Session1>BEGIN
      2   UPDATE taxids SET status=1 WHERE taxid=100101;
      3   COMMIT;
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    Session1>
    --> so session 2 stops being blocked and:
    Session2>SELECT taxid
      2  FROM   taxids
      3  WHERE  locationid    = 111
      4  AND    NVL(STATUS,0) = 0
      5  AND    taxid         = 100101
      6  FOR UPDATE;
    no rows selected
    Session2>Of course, this is how it should happen, surely?
    Just to double check, let's reintroduce ROWNUM but force the order by to show it's not about read consistency at the start of the statement - restart should prevent it.
    (reset, then)
    Session1> select t.taxid
      2   from
      3    (select taxid, rowid rd
      4      from   taxids
      5      where  locationid = 111
      6      and    nvl(status,0) = 0
      7      order by taxid) x
      8   ,  taxids t
      9   where t.rowid = x.rd
    10   and   rownum = 1
    11   for update of t.status;
         TAXID
        100101
    Session1>
    --> Yes, session 2 hangs until...
    Session1>BEGIN
      2   UPDATE taxids SET status=1 WHERE taxid=100101;
      3   COMMIT;
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    Session1>
    --> and then
    Session2> select t.taxid
      2   from
      3    (select taxid, rowid rd
      4      from   taxids
      5      where  locationid = 111
      6      and    nvl(status,0) = 0
      7      order by taxid) x
      8   ,  taxids t
      9   where t.rowid = x.rd
    10   and   rownum = 1
    11   for update of t.status;
         TAXID
        100102
    Session2>Session 2 should never be allowed to get 100101 once the lock is released.
    This is a bug.
    The worrying thing is that I can reproduce in 9.2.0.8 and 11.2.0.2.

  • [solved]lspci gives strange results

    I just reinstalled, and am trying to get my wireless card up and running.  I ran lspci, then lspci -nn, and it gives unexpected results.  Instead of listing things like vendors and such as intel, and ralink, it just lists non-useful stuff in a format like this:
    xx.xx.x Class [xxxx] Device [xxxx:xxxx] rev 40
    (where all x's are digits)
    what does this mean?  where is the useful information that I was expecting to find (like actual device names)?  What did I forget to do?
    edit:
    Now I have Xorg up, so I'll post the output:
    lspci
    00:00.0 Class 0600: Device 1002:5957
    00:02.0 Class 0604: Device 1002:5978
    00:09.0 Class 0604: Device 1002:597e
    00:0a.0 Class 0604: Device 1002:597f
    00:11.0 Class 0106: Device 1002:4390 (rev 40)
    00:12.0 Class 0c03: Device 1002:4397
    00:12.2 Class 0c03: Device 1002:4396
    00:13.0 Class 0c03: Device 1002:4397
    00:13.2 Class 0c03: Device 1002:4396
    00:14.0 Class 0c05: Device 1002:4385 (rev 42)
    00:14.1 Class 0101: Device 1002:439c (rev 40)
    00:14.3 Class 0601: Device 1002:439d (rev 40)
    00:14.4 Class 0604: Device 1002:4384 (rev 40)
    00:14.5 Class 0c03: Device 1002:4399
    00:15.0 Class 0604: Device 1002:43a0
    00:16.0 Class 0c03: Device 1002:4397
    00:16.2 Class 0c03: Device 1002:4396
    00:18.0 Class 0600: Device 1022:1200
    00:18.1 Class 0600: Device 1022:1201
    00:18.2 Class 0600: Device 1022:1202
    00:18.3 Class 0600: Device 1022:1203
    00:18.4 Class 0600: Device 1022:1204
    01:00.0 Class 0c03: Device 1033:0194 (rev 03)
    02:00.0 Class 0200: Device 10ec:8168 (rev 06)
    03:00.0 Class 0c00: Device 1106:3403 (rev 01)
    04:00.0 Class 0300: Device 10de:0e22 (rev a1)
    04:00.1 Class 0403: Device 10de:0beb (rev a1)
    05:05.0 Class 0280: Device 1814:0301
    05:06.0 Class 0401: Device 1102:0004 (rev 04)
    05:06.1 Class 0980: Device 1102:7003 (rev 04)
    05:06.2 Class 0c00: Device 1102:4001 (rev 04)
    Last edited by Convergence (2012-06-07 02:48:41)

    Falconinidy:  You're right!  That was a  bad move.  Thanks!

  • 0CRM_OPPT_H  (Transaction RSA3 gives wrong result)

    Hi gurus,
    <b>0CRM_OPPT_H  (Transaction RSA3 gives wrong result)
    BBPCRM 4.0
    BW 3.50 version</b>
    I had enhanced the structure "crmt_bw_oppt_h"
    and also written a BADI to populate Opportunity header status.
    But when I run extract checker RSA3 for CRM data,
    I get wrong number of records.
    I am having 95 records for Opportunities header data.
    Data Records / Call = "100"
    Display Extr. Calls = "10"
    Above settings, I am retrieving only 61 records.
    <b>Data Records / Call = "1"
    Display Extr. Calls = "200"
    For the above settings in RSA3,
    I am able to retrieve 95 records correctly.</b>
    The problem is that in RSA1 transaction of BW 3.50 server also,
    61 records are being loaded from CRM server.
    <b>Could this be a Cache memory problem,
    Are any of my BASIS settings a cause for this problem?</b>
    Any help is really appreciated and will be rewarded.
    Thanks,
    Aby Jacob
    ========

    Dear Friends,
    <b>I had to do a small correction in my BADI code.
    I got a solution from Online SAP HELP portal.</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7cf4940e11d295df0000e82de14a/frameset.htm
    Notes on BADI Usage
    ====================
    The instance generated through the factory method should be declared
    as globally as possible or generally be passed as a parameter
    to ensure that the initialization process must be run as rarely as possible
    – just once would be best. In no case should you discard the instance as soon as
    it is generated or repeatedly run the initialization process in a loop.
    Within the adapter class interface,
    required database accesses are buffered locally,
    so that each access is executed once only.
    However, repeated initialization makes
    the buffer useless and dramatically reduces performance.
    Due to the local buffering, you can call Business-Add-In methods
    without having to expect considerable performance restrictions,
    even if no active implementations exist.
    Also, if the definition of the Business-Add-In is filter-dependent,
    a single instance is sufficient.
    However, you should not do without initialization altogether.
    Even if you could call static methods of the implementing
    class of the Business-Add-In implementation without an instance,
    you would lose the benefit of performance improvement through
    the Business-Add-Ins and the possibility of multiple use.
    If you switch the method type in the interface from the static method
    to the instance method at any time in the future,
    many code adjustments are required.
    In addition, you can no longer use default code that is provided.
    <b>Many Thanks to ROBIN
    and the whole SDN team</b>
    Aby Jacob ,,,,,

Maybe you are looking for