A question about blocking IO

This sample code doesn't work. One thread waits for user input, and I was hoping to have another thread interrupt the first thread so that it would stop waiting for user input and continue processing. I think the problem is that the readLine() method in BufferedReader synchronizes on the reader's lock object. close() also synchronizes on the lock object, which creates a sort of deadlock that can only be resolved by pressing enter on the keyboard.
This seems like a common situation, so I'm guessing it has a simple answer that just hasn't occurred to me yet.
import java.io.*;
public class testMain extends Thread
     BufferedReader m_in;
     public static void main(String[] args)
          new testMain();
     testMain()
          start();
          try {
               m_in = new BufferedReader(new InputStreamReader(System.in));
               System.out.println("reading");
               String stuff = m_in.readLine();
          catch (IOException ex) {
               ex.printStackTrace();
          finally {
               System.out.println("read done");
     public void run()
          try {
               Thread.sleep(1000);
               System.out.println("closing");
               m_in.close();
          catch (Exception ex) {
               ex.printStackTrace();
          finally {
               System.out.println("close done");
}

If I were you I would not put the main logic in the
constructor. That just seems like a problem waiting
to happen.
Why don't you try making a method that you call after
constructing the object, that does the work you're
currently doing in it?It was just for illustration. But if you'd rather...
import java.io.*;
public class testMain extends Thread
     BufferedReader m_in;
     public static void main(String[] args)
          new testMain().workDamnYou();
     testMain()
          m_in = new BufferedReader(new InputStreamReader(System.in));
     private void workDamnYou()
          start();
          try {
               System.out.println("reading");
               String stuff = m_in.readLine();
          catch (IOException ex) {
               ex.printStackTrace();
          finally {
               System.out.println("read done");
     public void run()
          try {
               Thread.sleep(1000);
               System.out.println("closing");
               m_in.close();
          catch (Exception ex) {
               ex.printStackTrace();
          finally {
               System.out.println("close done");
}Better code. Same result.

Similar Messages

  • Simple question about block splitting

    Hello Experts,
    My question is, aren't the following DML performing 90-10 block split?? Because it has been said that the first one performs 50-50 block splitting.
    SQL> CREATE TABLE album_sales_IOT(album_id number, country_id number, total_sals number, album_colour varchar2(20),
         CONSTRAINT album_sales_iot_pk PRIMARY KEY(album_id, country_id)) ORGANIZATION INDEX;
    Table created.
    1
    SQL> BEGIN 
      2    FOR i IN 5001..10000 LOOP
      3      FOR c IN 201..300 LOOP
      4        INSERT INTO album_sales_iot VALUES(i,c,ceil(dbms_random.value(1,5000000)), 'Yet more new rows');
      5      END LOOP;
      6    END LOOP;
      7    COMMIT;
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    SQL> BEGIN 
      2    FOR i IN 1..5000 LOOP
      3       FOR c IN 101..200 LOOP
      4          INSERT INTO album_sales_iot
      5          VALUES(i,c,ceil(dbms_random.value(1,5000000)), 'Some new rows');
      6       END LOOP;
      7    END LOOP;
      8    COMMIT;
      9  END;
    10  /
    PL/SQL procedure successfully completed.

    Hi NightWing,
    > Because it has been said that the first one performs 50-50 block splitting.
    Who said it? .. However it can easily be answered with Snapper by Tanel Poder.
    First PL/SQL procedure
        SID, USERNAME  , TYPE, STATISTIC                                                 ,         DELTA, HDELTA/SEC,    %TIME, GRAPH       , NUM_WAITS,  WAITS/SEC,
          8, SYS       , STAT, leaf node splits                                          ,          2427,      12.14,         ,             ,          ,           ,
          8, SYS       , STAT, leaf node 90-10 splits                                    ,          2427,      12.14,         ,             ,          ,           ,
          8, SYS       , STAT, branch node splits                                        ,             4,        .02,         ,             ,          ,           ,
          8, SYS       , STAT, root node splits                                          ,             1,        .01,         ,             ,          ,           ,
    Second PL/SQL procedure
        SID, USERNAME  , TYPE, STATISTIC                                                 ,         DELTA, HDELTA/SEC,    %TIME, GRAPH       , NUM_WAITS,  WAITS/SEC,
          8, SYS       , STAT, leaf node splits                                          ,          2179,       10.9,         ,             ,          ,           ,
          8, SYS       , STAT, branch node splits                                        ,             8,        .04,         ,             ,          ,           ,
    Regards
    Stefan

  • Question about block viewer software

    Hi,
    please tell me have anybody used terlingua The Block Viewer for Oracle?
    I have tried to get key to use demo of this software, but nobody replay.
    I know about bbed.
    Best regards.

    If you know about BBED and how to use it, I don't think you should spend time on this product since no one is better capable than oracle itself to tell you how their blocks work and how to deal with the internal stuff. I am not sure about the views that these guys are mentioning in their pdf but I am not very convinced that I can think of spending time over this software.
    Stik with BBEd and other commands from Oracle to deal and work with its internal strucutres IMO!
    HTH
    Aman....

  • Few questions about apex + epg and cookie blocked by IE6

    Hi,
    I would like to ask a few questions about apex and epg.
    I have already installed and configured apex 3.2 on oracle 10g (on my localhost - computer name 'chen_rong', ip address -192.168.88.175 ), and enable anonymous access xdb http server.
    now,
    1. I can access 'http://chen_rong' , 'http://localhost' , 'http://192.168.88.175' without input username / password for realm 'XDB' in IE6;
    2. I can access 'http://localhost/apex/apex_admin' , 'http://192.168.88.175/apex/apex_admin' , and I can be redirected into apex administation page after input admin/<my apex admin password> for realm 'APEX' in IE6;
    3. I can access 'http://chen_rong/apex/apex_admin' in IE6, but after input admin/password , I can not be redirected into administation page, because the cookie was blocked by IE6.
    then, the first question is :
    Q1: What is the difference among 'http://chen_rong' , 'http://localhost' , 'http://192.168.88.175' ? I have already include site 'chen_rong' into my trusted stes! why the cookie was blocked by IE6. I have already tried firefox and google browser, both of them were ok for 'chen_rong', no cookie blocked from site 'chen_rong'!
    and,
    1. I have tried to use the script in attachment to test http authentication and also want to catch the cookie by utl_http .
    2. please review the script for me.
    3. I did:
    SQL> exec show_url('http://localhost/apex/apex_admin/','ADMIN','Passw0rd');
    HTTP response status code: 401
    HTTP response reason phrase: Unauthorized
    Please supplied the required Basic authentication username/password for realm XDB for the Web page.
    Web page http://localhost/apex/apex_admin/ is protected.
    MS-Author-Via: DAV
    DAV: 1,2,<http://www.oracle.com/xdb/webdav/props>
    Server: Oracle XML DB/Oracle Database
    WWW-Authenticate: Basic realm="XDB"
    Date: Tue, 04 Aug 2009 02:25:15 GMT
    Content-Type: text/html; charset=GBK
    Content-Length: 147
    ======================================
    PL/SQL procedure successfully completed
    4. I also did :
    SQL> exec show_url('http://localhost/apex/apex_admin/','ANONYMOUS','ANONYMOUS');
    HTTP response status code: 500
    HTTP response reason phrase: Internal Server Error
    Check if the Web site is up.
    PL/SQL procedure successfully completed
    SQL> exec show_url('http://localhost/apex/apex_admin/','SYSTEM','apexsite');
    HTTP response status code: 401
    HTTP response reason phrase: Unauthorized
    Please supplied the required Basic authentication username/password for realm APEX for the Web page.
    Web page http://localhost/apex/apex_admin/ is protected.
    Content-Type: text/html
    Content-Length: 147
    WWW-Authenticate: Basic realm="APEX"
    ======================================
    PL/SQL procedure successfully completed
    my second questions is :
    Q2: After I entered into realm 'XDB', I still need went into realm'APEX'. how could I change the script show_url to accomplish these two tasks and successfully get the cookie from site.
    the show_url script is as following:
    CREATE OR REPLACE PROCEDURE show_url
    (url IN VARCHAR2,
    username IN VARCHAR2 DEFAULT NULL,
    password IN VARCHAR2 DEFAULT NULL)
    AS
    req UTL_HTTP.REQ;
    resp UTL_HTTP.RESP;
    name VARCHAR2(256);
    value VARCHAR2(1024);
    data VARCHAR2(255);
    my_scheme VARCHAR2(256);
    my_realm VARCHAR2(256);
    my_proxy BOOLEAN;
    cookies UTL_HTTP.COOKIE_TABLE;
    secure VARCHAR2(1);
    BEGIN
    -- When going through a firewall, pass requests through this host.
    -- Specify sites inside the firewall that don't need the proxy host.
    -- UTL_HTTP.SET_PROXY('proxy.example.com', 'corp.example.com');
    -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
    -- rather than just returning the text of the error page.
    UTL_HTTP.SET_RESPONSE_ERROR_CHECK(FALSE);
    -- Begin retrieving this Web page.
    req := UTL_HTTP.BEGIN_REQUEST(url);
    -- Identify yourself.
    -- Some sites serve special pages for particular browsers.
    UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
    -- Specify user ID and password for pages that require them.
    IF (username IS NOT NULL) THEN
    UTL_HTTP.SET_AUTHENTICATION(req, username, password, 'Basic', false);
    END IF;
    -- Start receiving the HTML text.
    resp := UTL_HTTP.GET_RESPONSE(req);
    -- Show status codes and reason phrase of response.
    DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
    DBMS_OUTPUT.PUT_LINE
    ('HTTP response reason phrase: ' || resp.reason_phrase);
    -- Look for client-side error and report it.
    IF (resp.status_code >= 400) AND (resp.status_code <= 499) THEN
    -- Detect whether page is password protected
    -- and you didn't supply the right authorization.
    IF (resp.status_code = UTL_HTTP.HTTP_UNAUTHORIZED) THEN
    UTL_HTTP.GET_AUTHENTICATION(resp, my_scheme, my_realm, my_proxy);
    IF (my_proxy) THEN
    DBMS_OUTPUT.PUT_LINE('Web proxy server is protected.');
    DBMS_OUTPUT.PUT('Please supply the required ' || my_scheme ||
    ' authentication username/password for realm ' || my_realm ||
    ' for the proxy server.');
    ELSE
    DBMS_OUTPUT.PUT_LINE('Please supplied the required ' || my_scheme ||
    ' authentication username/password for realm ' || my_realm ||
    ' for the Web page.');
    DBMS_OUTPUT.PUT_LINE('Web page ' || url || ' is protected.');
    END IF;
    ELSE
    DBMS_OUTPUT.PUT_LINE('Check the URL.');
    END IF;
    -- UTL_HTTP.END_RESPONSE(resp);
    -- RETURN;
    -- Look for server-side error and report it.
    ELSIF (resp.status_code >= 500) AND (resp.status_code <= 599) THEN
    DBMS_OUTPUT.PUT_LINE('Check if the Web site is up.');
    UTL_HTTP.END_RESPONSE(resp);
    RETURN;
    END IF;
    -- HTTP header lines contain information about cookies, character sets,
    -- and other data that client and server can use to customize each
    -- session.
    FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(resp) LOOP
    UTL_HTTP.GET_HEADER(resp, i, name, value);
    DBMS_OUTPUT.PUT_LINE(name || ': ' || value);
    END LOOP;
    -- Read lines until none are left and an exception is raised.
    --LOOP
    -- UTL_HTTP.READ_LINE(resp, value);
    -- DBMS_OUTPUT.PUT_LINE(value);
    --END LOOP;
    UTL_HTTP.GET_COOKIES(cookies);
    dbms_output.put_line('======================================');
    FOR i in 1..cookies.count LOOP
    IF (cookies(i).secure) THEN
    secure := 'Y';
    ELSE
    secure := 'N';
    END IF;
    -- INSERT INTO my_cookies
    -- VALUES (my_session_id, cookies(i).name, cookies(i).value,
    -- cookies(i).domain,
    -- cookies(i).expire, cookies(i).path, secure, cookies(i).version);
    dbms_output.put_line('site:'||url);
    dbms_output.put_line('cookies:');
    dbms_output.put_line('name:'||cookies(i).name);
    dbms_output.put_line('value:'||cookies(i).value);
    dbms_output.put_line('domain:'||cookies(i).domain);
    dbms_output.put_line('expire:'||cookies(i).expire);
    dbms_output.put_line('path:'||cookies(i).path);
    dbms_output.put_line('secure:'||secure);
    dbms_output.put_line('version:'||cookies(i).version);
    END LOOP;
    UTL_HTTP.END_RESPONSE(resp);
    EXCEPTION
    WHEN UTL_HTTP.END_OF_BODY THEN
    UTL_HTTP.END_RESPONSE(resp);
    END;
    /

    I use oracle database enterprise edtion 10.2.0.3. I have already figured out the epg on 10.2.0.3 to support apex 3.2.
    And as I described above, the apex site works fine for ip address , and localhost. but the cookie will be blocked by IE6, if I want to access the site by 'http://computername:port/apex/apex_admin'. This problem does not occured in firefox and google browser. Could someone give me answer?

  • Important conceptual question about Application Module, Maximum Pool Size

    Hello everyone,
    We have a critical question about the Application Module default settings (taking the DB connections from a DataSource)
    I know that on the Web it is generally suggested that each request must end with either a commit or rollback when executing PL/SQL blocks "directly" on the DB without the framework BC/ViewObject/Entity service intervention.
    Now, for some reasons, we started to develop our applications with thinking that each Web Session would reference exactly one DB session (opened by any instance taken from the AM pool) for the whole duration of the session, so that the changes made by each Web session to its DB session would never interfere with the changes made by "other" Web Sessions to "other" DB sessions .
    In other words, because of that convincement we often implemented sort of "transactions" that open and close (with either commit or rollback) each DB session not in/after a single HTTP request, but during many HTTP Requests.
    As a concrete example think of this scenario:
    1. the user presses the "Insert" button. An HTTP request is fired. The action listener is executed and ends up with inserting rows in a table via a PL SQL block (not via the ViewObjects API).
    2. no commit or rollback after the above PL/SQL block is done yet.
    3. finally the user presses a "Commit" or "Rollback" button, firing the call to the appropriate AM methos.
    Those three requests consist of what I called "transaction".
    From the documentation it's clear that there is no guarantee that the couple AM istance + DB session is the same during all the requests.
    This means that, during step 2, it's possible that another user might reference the same "pending" AM/DbSession for his needs and "steal" somehow the work done via PL/SQL after step 1. (This happens because sessions taken by the pool are always rolled back by default.)
    Now my question is:
    Suppose we set the "Maximum Pool Size" parameter to very a great number (always inferior to the maximum number of concurrent users):
    Is there any guarantee that all the requests will be isolated in that case?
    I hope the problem is clear.
    Let me know if you want more details.

    Thanks for the answers.
    If I am right, from all your answers about resource avaiability, this means that even supposing the framework is able to always give us the same AM instance back from the AM pool (by following the session-affinity criterias), there is, however, no "connection affinity" with the connections from the DataSource. This means that the "same AM instance" might take the "a new DB connection", if necessary, from the connection pool of the DataSource. If that happens, that could give us the same problems as taking "a new AM instance" (that is, not following session-affinity) from the beginning, since each time an a new connection is taken (either via a new AM instance or via the same AM instance plus a new DB connection), the corresponding DB session is rolle back by default, clearing all the pending transactions we might have performed before with direct PL/SQL calls bypassing the AM services during the life cycle of our application, so that the new HTTP request will have a clean DB session to start to work with.

  • I need to reset security question but the email that was saved for changing the password and security question is blocked , what can i do

    i need to reset security question but the email that was saved for changing the password and security question is blocked , what can i do?
    i purchased my account but i cant use that because apple ask me about security question and i forgot the correct answer

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
    Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                             Apple ID- All about Apple ID security questions.

  • 3 questions about the evalution license ?

    Hi - I have some questions about the Weblogic Server Eval license.
    Before I start let me just say I'm not trying to rip BEA off, I just
    want to know what's possible.
    1. Firstly what happens after the 30 days does the server just not
    work or only work in a restricted form ? If restricted, how so ?
    2. I read that the eval edition will only access 3 unique IP
    addresses. I intend to have WL running on a RedHat linux box whilst
    the pages are served by IIS on a W2K box (both machines are on our
    internal LAN). Am I going to be able to do this with the eval license
    ? I'm not quite sure what the 3 IP addresses refer to ...
    3. Do I need anything super-strong in the way of a Linux box to run
    this on ? I've got an old Pentium with 32Mb of RAM in it. I can't see
    a "minimum spec" on the BEA site. Bear in mind it's not to do any
    "real" work just to give the thing a run around the block ?
    4. When the Eval license is dead what's the minimum amount a small s/w
    house would pay for a licence to develop under (US (or anywhere)
    prices will do I just want a ballpark).
    Sorry that was 4 questions ;-). I'd appreciate any information you
    have to share.
    Thanks
    Richard Shea.

    1)The server won't start if the license expires.
    2)The 3 unique IP'S refer to the number of clients that can access the
    server. It means that WLS will server requests coming from 3 different
    ip's at most. A request coming froma 4th client with a different ip will
    be rejected.
    3)I guess 32 MB's is relatively less The default scripts always use 64 MB
    exclusively for the JVM . Having 32mb RAM means that a part of it will be
    used by t he Operating System and other Applications. You might experience
    OutOfmemory errors and slow performance
    4)email [email protected] and they should be able to handle this
    Yeshwant
    Richard Shea wrote:
    Hi - I have some questions about the Weblogic Server Eval license.
    Before I start let me just say I'm not trying to rip BEA off, I just
    want to know what's possible.
    1. Firstly what happens after the 30 days does the server just not
    work or only work in a restricted form ? If restricted, how so ?
    2. I read that the eval edition will only access 3 unique IP
    addresses. I intend to have WL running on a RedHat linux box whilst
    the pages are served by IIS on a W2K box (both machines are on our
    internal LAN). Am I going to be able to do this with the eval license
    ? I'm not quite sure what the 3 IP addresses refer to ...
    3. Do I need anything super-strong in the way of a Linux box to run
    this on ? I've got an old Pentium with 32Mb of RAM in it. I can't see
    a "minimum spec" on the BEA site. Bear in mind it's not to do any
    "real" work just to give the thing a run around the block ?
    4. When the Eval license is dead what's the minimum amount a small s/w
    house would pay for a licence to develop under (US (or anywhere)
    prices will do I just want a ballpark).
    Sorry that was 4 questions ;-). I'd appreciate any information you
    have to share.
    Thanks
    Richard Shea.

  • The question about portlet customization and synchronization

    I have a question about portlet customization and synchronization.
    When I call
    NameValuePersonalizationObject data = (NameValuePersonalizationObject) PortletRendererUtil.getEditData(portletRenderRequest);
    portletRenderRequest.setPortletTitle(str);
    portletRenderRequest.putString(aKey, aValue);
    PortletRendererUtil.submitEditData(portletRenderRequest, data);
    Should I make any synchronization myself (use "synchronized" blocks or something else) or this procedure is made thread-safe on the level of the Portal API?

    HI Dimitry,
    I dont think you have to synchronize the block. i guess the code is synchronized internally.
    regards,
    Harsha

  • Question about "synchronized" and "wait"

    Hello, everyone!
    I have seen a piece of code like this,
    synchronized (lock)
    //do operation 1
    lock.wait();
    //do operation 2
    I think in the above piece of code, when a thead finished operation 1, it will release the lock and let other threads waiting for the lock have chance to run the same block of code. Am I correct?
    If I am correct, I have a further question, a "synchronized" block means a set of operations that can not be interrupted, but when invoke "wait" method, the thread running in the "synchronized" block will be terminated (interrupted) by release the lock and other threads will have chance to enter the "synchronized" block. In short, the execution inside the "synchronized" block will be interrupted. So, I wonder whether the above piece of code is correct and conforms to the principle of "synchronized". And what is its real use?
    Thanks in advance,
    George

    Thanks, pkwooster buddy!You're welcome
    I just wondered whether "wait inside a synchronized
    block" technology is thread safe. Please look at the
    following example,wait and synchronized are thread safe.
    public class Foo {
    int mVal= 0;
    public final Object mLock = ...;
    public void doIt() {
    synchronized(mLock) {
    mVal = ...;
    mLock.wait();
    if (mVal == ...) {
    // do something
    } else {
    // do something else
    }If we have two threads, T1 and T2, enter the block in
    their respective order, and T1 is woken up first, T2
    may have tampered with T1's execution path because T2
    changed mVal while T1 was asleep. So T2 manipulate
    instance field mVal is a side-effect.when you do the wait() you give up the lock and the other threads get a chance to run. When you exit the wait() you get the new value of the myVal variable which may have been changed. This is exactly what you want. To make that not thread save you could do
    int temp = myVal;
    wait();
    if(temp == ...)in this case the variable temp contains the old vale of myVal.
    >
    I think the most safest way is never wait inside a
    synchronized block, but it is less efficient. What do
    you think about the trick of wait inside a
    synchronized block? I think you are very experienced
    in thread field from your kind reply.
    Thanks in advance,
    Georgewait(), notify() and notifyAll() are very useful. You need them when you want threads to cooperate in an predictable manner. I recommend that you review the section on consumer and producer classes and wait and notify in the Threads Tutorial. It gives good examples. For a practical example of this you could also take a look at my Multithreaded Server Example. It implements a simple chat server that switches String messages. Look especially at the send(), doSend() and popMessage() methods in the StreamConnection class. These allow the receive thread of one user to send messages out using the send thread of another user. If you have questions about that example, please post the questions on that topic.
    Hope this helps.

  • Questions about ActiveX Bridge and SWT

    Hi !
    I found few weeks ago the www.reallyusefulcomputing.com site answering my question about Java & Macro of MSWord. Now I've found two steps that I am not able to overcome.
    First, when I build a simple application and I have internal libraries to use, am I compelled to place the jars in the lib/ext directory of the Java Runtime Directory? I have many difficulties in placing a convenient class-path in the manifest file. Why does the application ignore the manifest string?
    The second problem (and the biggest one) is that I am trying to build an SWT java-bean-application but I have problems during runtime. Is it possible to use this technology for my software or am I compelled to use AWT and SWING?
    I really hope you can help me.
    Thank you in advance.

    hi,
    I have to catch events from excel sheet in my java code..events like some change in value or a click of some user defined button etc.I have written th follwoing code but it does not gives me any event.It simply opens the specified file in the excel in a seperate window.but when i click on the sheet or change some value no event is captured by my code....can ne one pls tell me how to go about it....
    public class EventTry2 {
         private Shell shell;
         private static OleAutomation automation;
         static OleControlSite controlSite;
         protected static final int Activate = 0x00010130;
         protected static final int BeforeDoubleClick = 0x00010601;
         protected static final int BeforRightClick = 0x000105fe;
         protected static final int Calculate = 0x00010117;
         protected static final int Change = 0x00010609;
         protected static final int Deactivate = 0x000105fa;
         protected static final int FollowHyperlink = 0x000105be;
         protected static final int SelectionChange = 0x00010607;
         public void makeVisible()
              Variant[] arguments = new Variant[1];
              arguments[0]=new Variant("true");
              //Visible---true
              automation.setProperty(558,arguments);
              //EnableEvent--true
              boolean b =automation.setProperty(1212,arguments);
            System.out.println(b);
             public Shell open(Display display){
             this.shell=new Shell(display);
              this.shell.setLayout(new FillLayout());
              Menu bar = new Menu(this.shell,SWT.BAR);
              this.shell.setMenuBar(bar);
              OleFrame frame = new OleFrame(shell,SWT.NONE);
            File file= new File("C:\\Book1.xls");
              try{
              controlSite =  new OleControlSite(frame, SWT.NONE, "Excel.Application");
              this.shell.layout();
              boolean a2=true;
              a2=(controlSite.doVerb(OLE.OLEIVERB_SHOW|OLE.OLEIVERB_OPEN|OLE.OLEIVERB_UIACTIVATE|OLE.OLEIVERB_HIDE|OLE.OLEIVERB_PROPERTIES|OLE.OLEIVERB_INPLACEACTIVATE)== OLE.S_OK);
              System.out.println("Activated::\t"+a2);
            }catch(SWTException ex)
                 System.out.println(ex.getMessage());
                 return null;
              automation = new OleAutomation(controlSite);
              //make the application visible
              makeVisible();
              System.out.println("Going to create Event listener");
              OleListener eventListener=new OleListener(){
                   public void handleEvent(OleEvent event){
                        System.out.println("EVENT TYPE==\t"+event.type);
                   switch(event.type){
                   case Activate:{
                        System.out.println("Activate Event");
                   case BeforeDoubleClick:{
                        System.out.println("BeforeDoubleClick Event");
                   case BeforRightClick:{
                        System.out.println("BeforeRightClick Event");
                   case Calculate:{
                        System.out.println("Calculate Event");
                   case Change:{
                        System.out.println("Change Event");
                   case Deactivate:{
                        System.out.println("DeActivate Event");
                   case FollowHyperlink:{
                        System.out.println("Activate Event");
                   case SelectionChange:{
                        System.out.println("Activate Event");
                        Variant[] arguments = event.arguments;
                        for(int i=0;i<arguments.length;i++)
                             System.out.println("@@");
                             arguments.dispose();
              System.out.println("outside");
              OleAutomation sheetAutomation=this.openFile("C:\\Book1.xls");
              controlSite.addEventListener(sheetAutomation,Activate,eventListener);
              controlSite.addEventListener(sheetAutomation,BeforeDoubleClick,eventListener);
              controlSite.addEventListener(sheetAutomation,BeforRightClick,eventListener);
              controlSite.addEventListener(sheetAutomation,Calculate,eventListener);
              controlSite.addEventListener(sheetAutomation,Change,eventListener);
              controlSite.addEventListener(sheetAutomation,Deactivate,eventListener);
              controlSite.addEventListener(sheetAutomation,FollowHyperlink,eventListener);
              controlSite.addEventListener(sheetAutomation,SelectionChange,eventListener);
              shell.open();
              return shell;
         public OleAutomation openFile(String fileName)
              Variant workbooks = automation.getProperty(0x0000023c);//get User Defined Workbooks
              Variant[] arguments = new Variant[1];
              arguments[0]= new Variant(fileName);
              System.out.println("workbooks::\t"+workbooks);
              IDispatch p1=workbooks.getDispatch();
              int[] rgdispid = workbooks.getAutomation().getIDsOfNames(new String[]{"Open"});
              int dispIdMember = rgdispid[0];
              Variant workbook = workbooks.getAutomation().invoke( dispIdMember, arguments );
              System.out.println("Opened the Work Book");
              try {
                   Thread.sleep(500);
              } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              int id = workbook.getAutomation().getIDsOfNames(new String[]{"ActiveSheet"})[0];
              System.out.println(id);
              Variant sheet = workbook.getAutomation().getProperty( id );
              OleAutomation sheetAutomation=sheet.getAutomation();
              return(sheetAutomation);
         * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              Display display=new Display();
              Shell shell=(new EventTry2()).open(display);
              while(!shell.isDisposed()){
                   if(!display.readAndDispatch()){
                        display.sleep();
              controlSite.dispose();
              display.dispose();
              System.out.println("-----------------THE END-----------------------------");

  • A question about comments

    Hi, all,
    I have a question about the comments:
    Program function comments should be included on the block diagram or Front panel, or both. Thanks.

    Many good things have already been mentioned.
    For the Front panel, there should be a clear distinction between toplevel VIs (or any subVIs where the user must interact with the front panel), and subVIs where the front panel is only of interest to the programmer. The needs here are quite different:
    User Interface VIs
    The front panel should be clear and easy to use. All "help" elements, tip strips, etc are geared towards the end user. The icon is irrelevant, because it is typically not even shown. Everything of interest to code maintenance should be on the diagram.
    subVIs
    Here, the front panel can contain a description of what the subVI does, who created it, company and copyright information, version information, limitations (e.g. input A must be >0), URLs or literature references to the algorithm, etc. (Have a look at any of the openG tools!). The "VI properties...documentation" section should be populated. The icon should be descriptive. All controls and indicators should have intuitive names (not just "Numeric 4", or "Array" )
    Comments specific to certain areas of the code should be placed where they apply, especially if the code uses some exotic algorithm that would make the code hard to interpret.
    Use a programming style that is self-documenting. (e.g. Don't unbundle the error cluster check for "equal zero" to switch a case statement. Wire the error cluster directly to the case so you'll get a red/green error case structure. Much more obvious!)
    If these are proprietary VIs with password protected diagrams You should split the comments: Anything of interest to the non-privileged user goes on the front panel, anything else on the diagram.
    In the end, it does not really matters where you place the comments as long as they are easy to find later and still make sense to somebody else 10 years from now. Message Edited by altenbach on 05-30-2005 01:13 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Question about Depreciation Posting Run

    I Gurus:
    I have a question about Depreciation Posting Run;  I want to block two active assets for not entry in the Depreciation Posting Run and don´t affected it.
    I try to blocked the fixed asset in AS06 transaction but de active asset is affected in Depreciation Posting Run.
    Could you please help me??
    Thanks a lot

    Hi,
    To my limited knowledge, one can deactivate the assets after transfering the value from the to be deactivated asset.
    As per the generally accepted accounting principles, assets with value should have an impact in our financial statment.  In SAP, deactivating assets means, wrongly created assets which will not have any value and will not have impact any of your financial books of accounts.
    I think, you are looking for a functionality, where you do not want to depreciate the assets (ex. Land).  If it is so, you can give the Zero percentage by creating a new dep. key if you are using depreciation key based calculation of depreciation.
    Hope it clears your doubt,
    Regards
    A.Saravanan.

  • Another one question about how to download applet (not using external tool)

    Hi
    i write tool for downloading applet on card. I use apdu trace from NXP eclipse plugin as source of information and i read also about cap-file format in Java Card Virtual Machine specification. And i have questions about data transferred by LOAD command.
    As example - from apdu trace i see that transferred data are "C4820E33 DATA1 DATA2". Full length of transferred data is 0x2EE2.
    C4 - OK, this is "Load File Data Block" tag as specified in Global Platform
    820E33 - OK, this length of tag, =0x0E33
    DATA1 - sequence of cap-file components: Header.cap, Directory.cap, Import.cap, Applet.cap, Class.cap, Method.cap, StaticField.cap, ConstantPool.cap, RefLocation.cap. Length of DATA1 is 0x0E33, i.e. DATA1 = 'C4'-tag value.
    DATA2 - sequence of two cap-file components: Descriptor.cap and Debug.cap. These components are out of 'C4'-tag.
    the questions mentioned above... here they are:
    1. Global Platform does not define any data in LOAD command except 'E2' and 'C4' tag. Why DATA2 is transferred out of any tags?
    2. Whether the sequence of cap-file components is important? i.e. Can i load Header.cap, Directory.cap etc. in other order than i see in DATA1 field from apdu-trace?
    3. Debug.cap seems to be optional component. And what about Descriptor.cap component? Need i load it on card?

    666 wrote:
    1. Global Platform does not define any data in LOAD command except 'E2' and 'C4' tag. Why DATA2 is transferred out of any tags?Because the components are either optional or only required when communicating with a JCRE that has debugging capabilities. I assume you ran the project in JCOP Tools in debug mode against the simulator? If you did this against a real card it would fail as it does not have an instrumented JCRE capable of debugging code. You could try running the project as opposed to debugging to see the difference.
    2. Whether the sequence of cap-file components is important? i.e. Can i load Header.cap, Directory.cap etc. in other order than i see in DATA1 field from apdu-trace?Yes it is. It is defined in the JCVM specification available from the Oracle website.
    3. Debug.cap seems to be optional component. And what about Descriptor.cap component? Need i load it on card?No, it is optional and is not referenced by any other CAP file component.
    Cheers,
    Shane

  • Some question about georaster?

    Hello,
    I have some question about how to create high efficiency georaster model. I have 3T capacity raster data. It's bands is from 8 bands to 12 bands and the resolution is 0.5 meter. In order to ensure the original information of raster data, I consider not use the SDO_GEOR.mosaic, this means that a import file is a georaster object. I keep the original data capacity, not compression. I use JPEG-B to compress pyramid data.
    Does anyone can tell me my georaster model is OK? or tell me some areas for improvement.
    Thanks who have lool my page.

    i don't have specific performance number on georaster using bigfile tablespaces. "A bigfile tablespace with 32K blocks can contain a 128 terabyte datafile" and should be doable with georaster in considering your data size is just 8 TB. It should have some advantages over small file tablespaces, for example, it would be easiler to manage because it has only one datafile. but note, "Bigfile tablespaces are intended to be used with Automatic Storage Management (ASM) or other logical volume managers that supports striping or RAID, and dynamically extensible logical volumes". "Using bigfile tablespaces on platforms that do not support large file sizes is not recommended and can limit tablespace capacity." please refer to the Oracle Database Administrator's Guide.
    thanks

  • I wont to fix my old id account my email is  and when you whant to reset the password i dont recieve any email from apple id and when you answer question about your birth date it says not file is found.

    When i try and reset my id account it says it has been blocked for security reason. When you answer question about your birth date no souch record found and when i resset it by email io dont recieve any email from apple id reseat password. can anyone hep me ?
    <Email Edited by Host>

    Security questions:
    https://discussions.apple.com/docs/DOC-4551
    http://support.apple.com/kb/HT5312

Maybe you are looking for

  • The FIOS Channel Listings need to be rearranged.

    When I first got FIOS over a year ago, there were slightly less channels, and the channels that were here were well organized by the group of 10 they were in. For example, the 50s are for major entertainment channels. The 70s to 90s are for Sports. I

  • Cannot save form error after form has been created

    I've created a form and fucntions well. It has been saved as a interactive pdf. When people with just the acrobat reader open the file and click anywhere on the form a window pops up stating that " you cannot save form..." then the OK button appears

  • Cin details in vendor and customer master

    Hi In my user id i am not getting the CIN details while using vendor and customer masters where as my coleague is getting these details while creating, displaying or editing the vendor and customer masters, please suggest regarding. Prakash

  • After downloading software updates, I am locked out of G4 running 10.4.11

    This problem occurred when I restarted after taking the latest software update from Apple (online). As I recall, the three recommended updates were for ITunes, Safari, and Security. When my computer restarted, I got a Log On screen, which I have neve

  • Is it possible to find image name in PDF?

    Hi, There are times when I have a PDF but do not have the native file from which it is created. I would like to know the name of the images in the PDF. There is a program--PitStop--that I used to use years ago that could tell you all the parameters o