Do i use selector ??

hi again, i have situation where i have to perform a repetitive 'case'  comparison. see below
switch (var).
case 1:
[self.button1 setTitle: someText forState:UIControlStateNormal];
case 2:
[self.button2 setTitle: someText forState:UIControlStateNormal];
and so on... for about 20 more cases. someText wont change either.
is there some way of reducing this to a single command that changes at runtime ?, using sel or something like that.
apologies if im 'barking up the wrong tree' with 'sel''. still fairly new to all this..
still sure something can be done though!

When creating the buttons, set the tag property to the appropriate value (whatever var becomes).
Pseudo-code:
UIButton *buttonFound;
Loop through the buttons until you find the one whose tag matches the value of var.
if (buttonFound.tag == var)
     [buttonFound setTitle: someText forState:UIControlStateNormal];

Similar Messages

  • FD leaks on high load in JBOSS using Selector

    We observed FD leaks when our application is moved from Geronimo to  JBOSS. Ours is a multi-threaded application getting a response from UDP server.
    We were using Selector and DatagramChannel. we saw FD leak on high load. But when I removed Selector usage, the same does not leak any FDs.
    Is there any known issue in JDK?
    Thanks

    JBoss and Geronimo both run on top of Java.
    Obviously if you are using the same Java version for both then it is unlikely to be a JDK problem.
    If you are using a different version then there are too many variables to determine the cause.  So reduce the number of variables by using the same Java version.

  • Problem using selector string in JMSn receiver

    Hi
    We are creating own JMS Queues in our code, and are using the message selector clause to distinguish between the messages.
    We are using Weblogic version 9.1.
    Although, this works when it is a standalone application (i.e when have two files to send and receive from the JMS Queue), but however the same logic fails when we integrate this with our existing code deployed on WebLogic.
    In our code, we initially receive messages from IBM MQ, before passing it onto the JMS Queue.
    On the receiver side, we use the selector clause to separate the messages.
    The code snippet is as below:
    Here we are doing the steps necessary to receive message from the weblogic queue. But we are getting exception at line createReceiver(this.queue, strQuery); The exception is in the file attached.
    ctx = getInitialContext(WEBLOGICURL);
    System.out.println("this.connectionFactoryString: \r" +
    this.connectionFactoryString);
    this.qconFactory = (QueueConnectionFactory) ctx.lookup(this.connectionFactoryString);
    System.out.println("this.qconFactory: \r" + this.qconFactory);
    this.qcon = this.qconFactory.createQueueConnection();
    System.out.println("this.qcon: \r" + this.qcon);
    this.qsession = this.qcon.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
    System.out.println("this.qsession: \r" + this.qsession);
    this.queue = (Queue) ctx.lookup(this.queueName);
    System.out.println("this.queue: \r" + this.queue);
    // Note find out whether we are getting this
    final String strQuery;
    strQuery = "JmsConductorID = '1234'";
    System.out.println(
    "strQuery in jmsReceive()of LTDSRequest.java: \r" + strQuery);
    this.qreceiver = this.qsession.createReceiver(this.queue, strQuery);
    System.out.println("Receiver created "+qreceiver);
    this.qreceiver.setMessageListener(this);
    this.qcon.start();
    javax.jms.InvalidSelectorException: weblogic.messaging.kernel.InvalidExpressionException: Expression : "JmsConductorID = '1234'"
    at weblogic.jms.dispatcher.DispatcherAdapter.convertToJMSExceptionAndThrow(DispatcherAdapter.java:110)
    at weblogic.jms.dispatcher.DispatcherAdapter.dispatchSync(DispatcherAdapter.java:45)
    at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:2473)
    at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:2231)
    at weblogic.jms.client.JMSSession.createReceiver(JMSSession.java:2102)
    at weblogic.jms.client.WLSessionImpl.createReceiver(WLSessionImpl.java:866)
    at com.mycom.dep.myfunc.Request.init(Request.java:203)
    at com.mycom.dep.myfunc.Request.<init>(Request.java:151)
    at jrockit.reflect.NativeConstructorInvoker.newInstance([Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
          at jrockit.reflect.InitialConstructorInvoker.newInstance([Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
          at java.lang.reflect.Constructor.newInstance([Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
          at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:82)
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:156)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:683)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:621)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
          at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
          at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:324)
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:97)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:683)
    Please can someone help?
    Regards,
    Prasad                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    In SQL*Plus you SET DEFINE OFF like this:
    SQL> set define off
    SQL> select 'S&R' from dual;
    'S&
    S&R(can't help you with Toad)

  • Use Selector to multiplex Pipe.SourceChannels?

    Hi,
    i am a little confused. I 'd like an object to have some references to multiple Pipe.SourceChannels and periodically check for incomig data. MultiPortEcho.java seems to do what i want, but by using SocketChannels.
    Do i have to do something similar? Create a Selector, get the keys and check for OP_ACCEPT and OP_READ?
    MultiPortEcho.java
    ibm.com/developerWorks
    import java.io.*;
    import java.net.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.util.*;
    public class MultiPortEcho
      private int ports[];
      private ByteBuffer echoBuffer = ByteBuffer.allocate( 1024 );
      public MultiPortEcho( int ports[] ) throws IOException {
        this.ports = ports;
        go();
      private void go() throws IOException {
        // Create a new selector
        Selector selector = Selector.open();
        // Open a listener on each port, and register each one
        // with the selector
        for (int i=0; i<ports.length; ++i) {
          ServerSocketChannel ssc = ServerSocketChannel.open();
          ssc.configureBlocking( false );
          ServerSocket ss = ssc.socket();
          InetSocketAddress address = new InetSocketAddress( ports[i] );
          ss.bind( address );
          SelectionKey key = ssc.register( selector, SelectionKey.OP_ACCEPT );
          System.out.println( "Going to listen on "+ports[i] );
        while (true) {
          int num = selector.select();
          Set selectedKeys = selector.selectedKeys();
          Iterator it = selectedKeys.iterator();
          while (it.hasNext()) {
            SelectionKey key = (SelectionKey)it.next();
            if ((key.readyOps() & SelectionKey.OP_ACCEPT)
              == SelectionKey.OP_ACCEPT) {
              // Accept the new connection
              ServerSocketChannel ssc = (ServerSocketChannel)key.channel();
              SocketChannel sc = ssc.accept();
              sc.configureBlocking( false );
              // Add the new connection to the selector
              SelectionKey newKey = sc.register( selector, SelectionKey.OP_READ );
              it.remove();
              System.out.println( "Got connection from "+sc );
            } else if ((key.readyOps() & SelectionKey.OP_READ)
              == SelectionKey.OP_READ) {
              // Read the data
              SocketChannel sc = (SocketChannel)key.channel();
              // Echo data
              int bytesEchoed = 0;
              while (true) {
                echoBuffer.clear();
                int r = sc.read( echoBuffer );
                if (r<=0) {
                  break;
                echoBuffer.flip();
                sc.write( echoBuffer );
                bytesEchoed += r;
              System.out.println( "Echoed "+bytesEchoed+" from "+sc );
              it.remove();
    //System.out.println( "going to clear" );
    //      selectedKeys.clear();
    //System.out.println( "cleared" );
      static public void main( String args[] ) throws Exception {
        if (args.length<=0) {
          System.err.println( "Usage: java MultiPortEcho port [port port ...]" );
          System.exit( 1 );
        int ports[] = new int[args.length];
        for (int i=0; i<args.length; ++i) {
          ports[i] = Integer.parseInt( args[i] );
        new MultiPortEcho( ports );
    }Message was edited by:
    uig

    You don't have to worry about OP_ACCEPT with Pipe because there are no server pipes. You already have both sides of the Pipe by construction, so just implement the OP_READ part.

  • Browsing JMS messages using selector

    Requirement
    I want to browse for messages, using a selector.
    SENDER
    I'm sending messages in my Queue, with a property PARAMETER_ID set in it as.
    message.setStringProperty("PARAMETER_ID",param_id);
    Assume there are 4 messages sent in my Queue.
    1. Text=Message1,PARAMETER_ID=1233
    2. Text=Message2,PARAMETER_ID=4566
    3. Text=Message3,PARAMETER_ID=1233
    4. Text=Message4,PARAMETER_ID=4566
    RECEIVER
    I want to browse messages that have a certain PARAMETER_ID property set in it.
    So here's what I'll do.
    String myselector = "PARAMETER_ID=1233";
    QueueBrowser qb=session.createBrowser(queue,myselector );
    The QueueBrowser instance returned, should have 2 messages in it, that can be browsed.
    But I dont get any results and there's no exception.
    What am I doing wrong?
    btw - If I set the myselector to "", it returns me all 4 messages to browse.
    I'm using JBOSS with JMS 1.1
    Thanks

    4. Text=Message4,PARAMETER_ID=4566
    What is this ? is this msg in queue? what is
    PARAMETER_ID?that jms implementation appears to use PARAMETER_ID to identify its messages
    Header {
    jmsDestination : QUEUE.TMSQueueRemote
    jmsDeliveryMode : 2
    jmsExpiration : 0
    jmsPriority : 4
    jmsMessageID : ID:6-11824034000315
    jmsTimeStamp : 1182403400031
    jmsCorrelationID: null
    jmsReplyTo : null
    jmsType : null
    jmsRedelivered : true
    jmsProperties : {JMS_JBOSS_REDELIVERY_COUNT=1}
    jmsPropertiesReadWrite:false
    msgReadOnly : true
    producerClientId: ID:6
    Body {
    TEsf
    }MQ message implementation is different (but JMS-compliant)
    if you want to use message selectors by identifier, try jmsMessageID='123'

  • Detect loss of socket connection using java.nio.channels.Selector

    I'm using the nio package to write a "proxy" type application, so I have a ServerSocketChannel listening for incoming connections from a client and then create a SocketChannel to connect to a server. Both SocketChannels are registered to the same Selector for OP_READ requests.
    All works fine, until either the client or server drops the connection. How can I detect this has happened, so my proxy app can drop the other end of the connection ?
    The Selector.select() method is not triggered by this event. I have tried using Selector.select(timeout) and then checking the status of each channel, but they still show isConnected()=true.
    Thanks,
    Phil Blake

    Please don't cross post.
    http://forum.java.sun.com/thread.jsp?thread=184411&forum=4&message=587874

  • How to use Excel file in Xcelsius dynamically

    I want to use an excel sheet in Xcelsius dashboard,  dynamically it should get data from the excel sheet.
    Any modifications done in that excel sheet should be reflected in the dashboard.
    How can I do this?
    Thanks in advance

    Hi,
    If you only want to get data from excel spreadsheet, you could use selector> spreadsheet table or selector> listview. Bind your data area to the component's "Display Data" could reach your requirement. All your modification on the embedded excel could be reflected at the component.
    I hope it could help.
    Thanks,
    Christina

  • How to find right selector of my selected element

    Hi, see the 60th line. i want to get that record.
    how can i use selector to get that element value (28). i am using jtable and that element was displaying as a second level child.
    Thanks
    Venkat
    <pre><nowiki><div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-1" aria-labelledby="ui-id-2">uiDraggable=Object { element={...}, uuid=4, eventNamespace=".draggable4", more...}uiResizable=Object { element={...}, uuid=5, eventNamespace=".resizable5", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-3" aria-labelledby="ui-id-4">uiDraggable=Object { element={...}, uuid=10, eventNamespace=".draggable10", more...}uiResizable=Object { element={...}, uuid=11, eventNamespace=".resizable11", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-5" aria-labelledby="ui-id-6">uiDraggable=Object { element={...}, uuid=16, eventNamespace=".draggable16", more...}uiResizable=Object { element={...}, uuid=17, eventNamespace=".resizable17", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-7" aria-labelledby="ui-id-8">uiDraggable=Object { element={...}, uuid=22, eventNamespace=".draggable22", more...}uiResizable=Object { element={...}, uuid=23, eventNamespace=".resizable23", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-9" aria-labelledby="ui-id-10">uiDraggable=Object { element={...}, uuid=28, eventNamespace=".draggable28", more...}uiResizable=Object { element={...}, uuid=29, eventNamespace=".resizable29", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-11" aria-labelledby="ui-id-12">uiDraggable=Object { element={...}, uuid=34, eventNamespace=".draggable34", more...}uiResizable=Object { element={...}, uuid=35, eventNamespace=".resizable35", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-13" aria-labelledby="ui-id-14">uiDraggable=Object { element={...}, uuid=40, eventNamespace=".draggable40", more...}uiResizable=Object { element={...}, uuid=41, eventNamespace=".resizable41", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-15" aria-labelledby="ui-id-16">uiDraggable=Object { element={...}, uuid=46, eventNamespace=".draggable46", more...}uiResizable=Object { element={...}, uuid=47, eventNamespace=".resizable47", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable" style="display: none;" tabindex="-1" role="dialog" aria-describedby="dialog-confirm" aria-labelledby="ui-id-17">uiDraggable=Object { element={...}, uuid=52, eventNamespace=".draggable52", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front dlg-no-close ui-draggable" style="height: auto; width: 750px; top: 378px; left: 296px; display: none;" tabindex="-1" role="dialog" aria-describedby="dialog-comp" aria-labelledby="ui-id-18">uiDraggable=Object { element={...}, uuid=55, eventNamespace=".draggable55", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-19" aria-labelledby="ui-id-20">uiDraggable=Object { element={...}, uuid=60, eventNamespace=".draggable60", more...}uiResizable=Object { element={...}, uuid=61, eventNamespace=".resizable61", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-21" aria-labelledby="ui-id-22">uiDraggable=Object { element={...}, uuid=66, eventNamespace=".draggable66", more...}uiResizable=Object { element={...}, uuid=67, eventNamespace=".resizable67", more...}
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="display: none; position: absolute;" tabindex="-1" role="dialog" aria-describedby="ui-id-23" aria-labelledby="ui-id-24">uiDraggable=Object { element={...}, uuid=72, eventNamespace=".draggable72", more...}uiResizable=Object { element={...}, uuid=73, eventNamespace=".resizable73", more...}
    <div class="ui-widget-overlay ui-front"></div>
    <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable" style="height: auto; width: 750px; top: 610px; left: 296px; display: block;" tabindex="-1" role="dialog" aria-describedby="dialog-orgs" aria-labelledby="ui-id-25">uiDraggable=Object { element={...}, uuid=76, eventNamespace=".draggable76", more...}
    <div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
    <div id="dialog-orgs" class="ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; max-height: none; height: 551px;">uiDialog=Object { element={...}, uuid=74, eventNamespace=".dialog74", more...}
    <fieldset>
    <fieldset>
    <legend>
    <div id="OrganizationTableContainer">hikJtable=Object { element={...}, uuid=24, eventNamespace=".jtable24", more...}
    <div class="jtable-main-container">
    <div class="jtable-busy-panel-background" style="display: none; width: 703px; height: 87px;"></div>
    <div class="jtable-busy-message" style="display: none;"></div>
    <div class="jtable-title">
    <table class="jtable">
    <thead>
    <tbody>
    <tr class="jtable-data-row jtable-row-even" data-record-key="5">record=Object { SiteCode="ACS", SiteID=5, OrgName="American Cancer Society"}childRow=jQuery(tr.jtable-child-row)
    <tr class="jtable-child-row" style="display: none;">
    <tr class="jtable-data-row jtable-row-selected" data-record-key="6">record=Object { SiteCode="UNKNOWN", SiteID=6, OrgName="American Red Cross"}childRow=jQuery(tr.jtable-child-row)
    <tr class="jtable-child-row" style="display: table-row;">
    <td colspan="5">childTable=jQuery(div.jtable-child-table-container✉)
    <div class="jtable-child-table-container" style="display: block;">hikJtable=Object { element={...}, uuid=77, eventNamespace=".jtable77", more...}
    <div class="jtable-main-container">
    <div class="jtable-busy-panel-background" style="display: none; width: 697px; height: 87px;"></div>
    <div class="jtable-busy-message" style="display: none;"></div>
    <div class="jtable-title">
    <table class="jtable">
    <thead>
    <tbody>
    <tr class="jtable-data-row jtable-row-even jtable-row-selected">record=Object { BranchID=24, Name="Metro Atlanta Chapter", SiteID=6}childRow=jQuery(tr.jtable-child-row)
    <tr class="jtable-child-row" style="display: table-row;">
    <td colspan="8">childTable=jQuery(div.jtable-child-table-container✉)
    <div class="jtable-child-table-container" style="display: block;">hikJtable=Object { element={...}, uuid=101, eventNamespace=".jtable101", more...}
    <div class="jtable-main-container">
    <div class="jtable-busy-panel-background" style="display: none; width: 691px; height: 87px;"></div>
    <div class="jtable-busy-message" style="display: none;"></div>
    <div class="jtable-title">
    <table class="jtable">
    <thead>
    <tbody>
    <tr class="jtable-data-row jtable-row-even" data-record-key="28">record=Object { ZipCode=30324, CountryCode="USA", PhoneNumber="404-876-3302", more...}
    <td class="jtable-selecting-column">
    <td>28</td>
    <td>1955 Monroe Dr. NE</td>
    <td>Atlanta</td>
    <td>30324</td>
    <td>404-876-3302</td>
    </tr>
    </tbody>
    </table>
    <div class="jtable-column-resize-bar" style="display: none;"></div>
    <div class="jtable-column-selection-container"></div>
    </div>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    <div class="jtable-column-resize-bar" style="display: none;"></div>
    <div class="jtable-column-selection-container"></div>
    </div>
    </div>
    </td>
    </tr>
    </tbody>
    </table>
    <div class="jtable-column-resize-bar" style="display: none;"></div>
    <div class="jtable-column-selection-container"></div>
    </div>
    </div>
    </fieldset>
    <input id="Done" class="submit-org" type="submit" value="Submit">
    </div>
    </div>
    </body>
    </html></nowiki></pre>

    As you can see, this forum doesn't cope very well with HTML...
    Can you post the code on a site such as [http://pastebin.com/] and then edit your post to switch in the URL for the HTML? Then your reference to a line number will make a lot more sense.
    Alternately, since this forum focuses on end-user support, you might get more focused assistance on the unofficial [http://forums.mozillazine.org/viewforum.php?f=25 mozillaZine Web Development board]. It's a separate site with separate registration. ''And'' it support BBCode [code] tags.

  • Selector field in table control

    Hi,
    Using selector field how can i delete a perticular row from the table control. Only selected rows should be deleted.
    please help me.
    Shyja

    Dear Shyja,
    Please try the sample code given below:
    Case sy-ucomm.
    when 'DELETE'.
    READ TABLE it_emp INTO wa_emp WITH KEY sel = 'X'.
    DELETE it_emp WHERE sel = 'X'.                  
    APPEND wa_emp to it_undo.                       
    endcase.
    Here  it_emp is the internal table from which the table control is populated. It is always good that you keep a copy of the deleted entries for some time, for that is the internal table it_undo.
    Please contact if you don't get the solution with your code.
    Regards,
    Renjith Michael.

  • How to specify different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position?

    Hello,
    I am trying to provide different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position. I have 2 af:panelSplitter with orientation="horizontal" - One with positionedFromEnd="true" one with positionedFromEnd="false". I want to specify the horizontal collapse and restore icon using Skinning. I want specify different icons based on positionedFromEnd. When I specify icons they are appearing for both splitters. I gave 2 different styleClass to these splitter but it is not taking them in account,
    JSPX Page -
    <af:panelSplitter orientation="horizontal" splitterPosition="196" positionedFromEnd="false" id="pnlSplitterLeft" collapsed="false" styleClass="panelSplitterLeftClass">
      <f:facet name="first">
      <!-- Content of First Facets -->
      </f:facet>
      <f:facet name="second">
      <af:panelSplitter orientation="horizontal" splitterPosition="196" positionedFromEnd="true" id="pnlSplitterRight" collapsed="false" styleClass="panelSplitterRighClass">
      <f:facet name="first">
      <!-- Content of First Facets -->
      </f:facet>
      <f:facet name="second">
      <!-- Content of First Facets -->
      </f:facet>
      </af:panelSplitter>
      </f:facet>
    </af:panelSplitter>
    CSS Skinn
    af|panelSplitter::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Open.gif");
    af|panelSplitter::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Close.gif");
    af|panelSplitter.panelSplitterLeftClass::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Open.gif");
    af|panelSplitter.panelSplitterLeftClass::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Left_Close.gif");
    af|panelSplitter.panelSplitterRighClass::horizontal-restore-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Right_Open.gif");
    af|panelSplitter.panelSplitterRighClass::horizontal-collapse-icon {
        width: 10px;
        height: 55px ;
        content : url("/skins/AppSkin/Right_Close.gif");
    It is always showing Left_Open.gif and Left_Close.gif for both splitters. But I want different image.
    How to specify different horizontal restore & collapse icon for af|panelSplitter using Skinning based on Style class or position?
    - Sujay

    CSS attribute selectors are what you are talking about, but binding the selector with EL is a more-common approach. Using selectors like this require you to ensure browser support.
    af|panelSplitter.panelSplitterRighClass::horizontal-collapse-icon [positionedFromEnd=true]

  • JMS selector NOT LIKE

    Does Oracle JMS implementation support using selector 'NOT LIKE' syntax?
    I used the string "JMSCorrelationID NOT LIKE 'abc%'" as receiver selector, I got an exception saying:
    JMS-159: Invalid selector Selector Parse error"
    However, using 'LIKE' is OK.
    any idea?
    - David

    Following the rationale that the selector must evaluate to true for the message to be picked up, an absent property would equate to false. Hence not being picked up.
    TE

  • Selector.selectedKeys() random ordering vs. fairness

    All Sun's selector implementations are based on SelectorImpl, which keeps selectedKeys in a classic HashSet with a random order of elements.
    Now, suppose I insist on processing the incoming requests in the exact order as they were received, to ensure fairness. The classic mechanism for ensuring fairness are threads, but this a single-thread solution, and even with threads, it would be more fair to dispatch firstly-received requests first.
    So far the only solution seems to be a dirty (should I say dodgy) replace (via reflection) of the aforementioned HashSet with a LinkedHashSet. (tested on Linux/epoll, works)
    If you know of any other solution please let me know.

    Hi, thanks for replying to both of my comments. (the other thread: http://forum.java.sun.com/thread.jspa?threadID=407203&tstart=0 )
    These two issues are correlated so I will sum it up here, as the other thread is old and in a wrong forum.
    I'm getting the following results:
    1. only a single OP_ACCEPT is signalled in any given select() operation
    2. OP_READs are grouped to a single select(), no matter what time intervals they came in
    Tested on Windows (sun.nio.ch.WindowsSelectorImpl) and Linux (sun.nio.ch.EPollSelectorImpl).
    The accepts are fired inside of 100ms (linux) and 50ms (windows). The reads are split into 3 groups separated by 5 second wait.
    I'm attaching my test program. The two tests are separated and must be manually switched on.
    import java.net.InetSocketAddress;
    import java.net.Socket;
    import java.nio.ByteBuffer;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.ServerSocketChannel;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    public class test2 {
         public static void main(String[] args) throws Exception {
              server server = new server();
              server.bind();
              int test = 1;
              p("running test " + test);
              if(test == 1) { //test the partitioning of read events into more select() operations
                   client cc[] = new client[30];
                   for(int i = 0; i < cc.length; i++) {
                        cc[i] = new client("" + i);
                        cc.connect_to_server();
                   while(server.process_a_single_loop()); //process all the accepts
                   for(int i = 0; i < cc.length; i++) { //send requests in 3 groups separated by 2 waits
                        cc[i].send_data_to_server("hello");
                        if(i == 9 || i == 19) {
                             p("waiting 5 sec");
                             Thread.sleep(5000L);
                   while(server.process_a_single_loop()); //now process the reads
                   p("done");
              if(test == 2) { //test the grouping of more accept events into a single select() operation
                   connect_thread tt[] = new connect_thread[30];
                   client cc[] = new client[30];
                   for(int i = 0; i < cc.length; i++) {
                        cc[i] = new client("" + i); //create new clients
                        tt[i] = new connect_thread(cc[i]); //create connector threads
                   //now quick-start the threads
                   long max = 0L, start = System.currentTimeMillis();
                   for(int i = 0; i < tt.length; i++)
                        tt[i].start();
                   Thread.sleep(1000L); //let the dust settle
                   for(int i = 0; i < tt.length; i++) { //gather client connect time statistics
                        if(max < tt[i].finished)
                             max = tt[i].finished;
                   p("all connections happened inside of " + (max - start) + " ms");
                   while(server.process_a_single_loop()); //now process the accepts
                   p("done");
              server.unbind();
         static class connect_thread extends Thread {
              client c;
              long finished;
              connect_thread(client c) {
                   this.c = c;
              public void run() {
                   try {
                        c.connect_to_server();
                        finished = System.currentTimeMillis();
                   catch(Exception e) {
                        e.printStackTrace();
         static void p(Object o) {
              System.out.println(o);
         static class server {
              ServerSocketChannel server_chan;
              Selector server_selector;
              int loop;
              void bind() throws Exception {
                   server_chan = ServerSocketChannel.open();
                   server_selector = Selector.open();
                   server_chan.socket().bind(new InetSocketAddress (8401));
                   server_chan.configureBlocking(false);
                   server_chan.register(server_selector, SelectionKey.OP_ACCEPT);
                   p("Used selector implementation: " + server_selector.getClass().getName());
              boolean process_a_single_loop() throws Exception {
                   boolean anything_done = false;
                   loop++;
                   p("server - processing loop " + loop);
                   server_selector.selectNow();
                   Iterator<SelectionKey> it = server_selector.selectedKeys().iterator();
                   while(it.hasNext()) {
                        anything_done = true;
                        SelectionKey key = it.next();
                        if(key.isAcceptable()) {
                             ServerSocketChannel server = (ServerSocketChannel) key.channel();
                             SocketChannel channel = server.accept();
                             channel.configureBlocking(false);
                             channel.register(server_selector, SelectionKey.OP_READ, channel);
                             p("server - accepted a new connection");
                        if(key.isReadable()) {
                             anything_done = true;
                             SocketChannel channel = (SocketChannel) key.attachment();
                             ByteBuffer bb = ByteBuffer.wrap(new byte[10000]);
                             channel.read(bb);
                             bb.flip();
                             String s = new String(bb.array(), bb.position(), bb.limit() - bb.position(), "UTF-16");
                             p("server - received data: " + s);
                        it.remove();
                   return anything_done;
              void unbind() throws Exception {
                   server_chan.close();
         static class client {
              String id;
              Socket socket;
              client(String id) throws Exception {
                   this.id = id;
              void connect_to_server() throws Exception {
                   socket = new Socket();
                   //s.setTcpNoDelay(true);
                   socket.connect(new InetSocketAddress("localhost", 8401));
              void send_data_to_server(String data) throws Exception {
                   String buf = "hello from " + s() + ": " + data; // + "\n";
                   socket.getOutputStream().write(buf.getBytes("UTF-16"));
              String s() {
                   return "client[" + id + "]";
    I think I can solve this "unfairness" problem by having a dedicated thread constantly transferring any new events from the selector to my own queue - the select() would be called frequently enough to get the events properly ordered.

  • Java.nio selector non-blocking IO question

    Hi,
    I am designing an interactive server where multiple clients can log on and communicate with the server. I designed a protocol that the client/server use to talk to each other. My server runs a Selector to monitor a ServerSocket, accepting connections and reading continuously from clients.
    Now my question is, since read() on ServerChannel are non-blocking using selector, how can I be sure that my entire protocol message will be read each time selector wakes up? For example, a slow client sends me a 5kb message, in one write() command, can I be sure that I will be able to read the entire message in one non-blocking read() command as well? If not, then the design becomes much more complicated, as I have to pipe each client's input into a handler thread that performs blocking i/o to read a protocol message one at a time. If I do that, then I might as well not use select() at all.
    I did some preliminary tests, and it seems that for my purpose (message of size <= 50kb), a read() command will always be able to read the entire message. But I can't find any documentation on this subject. My guess is that I cannot trust non-blocking I/O as well, which means it does not fit my purpose.
    Any help will be much appreciated.
    Thanks,
    Frank

    You can't be sure a read() will read in all the data from a client in one call.
    For example, say your message from the client to the server is of the following format. <start>message here<end>, where <start> indicates the start of a message and <end> the end of the message. In one read() call you might get "<start>message he". Your server would recognize this is partially correct but it needs the rest of the message. The server would store this and on the second read() you might get "re<end>" for the complete message.
    The purpose of non-blocking I/O is so you don't have to wait around for the second part of the message, you can process other client messages while the first client finishes sending their message. This way other clients aren't waiting around while you(the server) sit and wait for client 1 to finish sending it's data.
    So basically there is no gaurantee you will get a whole message intact. Your protocol will have to deal with partial messages, recognize them, store the partial message in a buffer, and on subsequent reads get the rest of the message.
    Nick

  • Selector for layouts??

    Hi all,
    I have <b>two different layouts from the same package</b> and would like to <b>use "selector for layout" so end usuers can switch layouts.</b> I created a SELECTOR and tried to assign these two layouts to it but got an error message-<b>'selectorxxxx is not used'</b>. Can someone advise me how to make it work. Thank you.
    J.

    Hi John,
    You cannot assign the layouts in the selector itself.
    The referencing layouts would be entered automatically in the selecotr.
    1) First of all create one layout, say L_LAY1.
    2) Then create the "selector for layout". Enter the properties area and level.
    3) Now set the default value of the layout selector using F4-Selection to one of the layouts. Select one of the parameter group.
    4) You would now see the property "Referenced Component" to L_LAY1.
    5) At runtime, this layout would be changed as per the selection made in the layout selector.
    Regards!

  • Selector and Arrays...

    Example:
    We have a PublicObject, which has an attribute call members, this attribute is a publicobjectarray.
    Now we want to search for all publicobjects, that have a special person included in the members-attribute.
    How is it possible to realize that with a selector?

    This cannot be done using Selectors. You will
    need to use the search API (oracle.ifs.beans.Search) to do this.
    Selectors will work in cases where search
    involves one table (in most cases that translates to one iFS class) only. Because
    of the way array type attributes are represented in iFS, you will need to use search api.

Maybe you are looking for

  • New to using Apple TV and edd some hints and help

    hi, I've just set up my Apple TV, and have a few questions. When you are showing a movie off your Mac through Apple TV does it use up any data? How much data does it generally use? and anything else that I shod know would be very helpful. Thank you

  • I cant uncheck movies or music on itunes

    I put a few movies on my iphone from itunes now i want to change the movies and i tunes wont let me. I cant change or uncheck movies or music. What should i do or am i stuck with these songs and movies on my iphone?

  • IMac graphics card going nuts

    We use Archicad as a CAD program to a high level on our 20" intel based iMac's. when in the 3D window of archicad for a period of time, our graphics cards are, to put it technically, crapping out. we loose all visual graphics content, however all men

  • Adobe form code initialization with HCM Processes and Forms?

    Hi, We're trying to dynamically determine some language-dependent text label values in the form interface code initialization routine before displaying an interactive PDF form. All works fine when using the transaction SFP test tool, label values are

  • How do I get the option to capture image when placing  signature for the first time.

    According to the help screen for Adobe Reader the first time a signature is placed I should be presented with a dialog box that has the option to import a signature image.  But what I get is only the option to drag over an area of the screen to place