Is there a "Drag-Select" Method?

I remember many years ago when Aldus PageMaker was popular. In that program I was able to script and perform a "drag-select" in a specific area of choice.
Can anyone describe or offer any ideas on how to go about this using Applescript or with Javascript?
(Ps: I only understand applescript, but lets have fun and discover new ways to do something new and learn at the same time!)
Thank you everyone...

This will let you act on all items whose top left fall within a range of coordinates; you could easily modify it to deal with items contained by the ranges:
tell application "Adobe InDesign CS3"
tell document 1
<do something to> (every item of all page items of page 1 where item 1 of its geometric bounds is greater than 72 and item 1 of its geometric bounds is less than 400 and item 2 of its geometric bounds is greater than 72 and item 2 of its geometric bounds is less than 500)
end tell
end tell
Shane Stanley <[email protected]>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>

Similar Messages

  • Is there an equivalent SELECT() method in Java for passive-waiting?

    I have been using C code that will open a file descriptor, then use the "select" function to passively-wait for new events in the descriptor (versus something like an active while-loop strategy that will loop indefinitely, attempting to read from the descriptor each time through the loop).
    Can someone describe the best way of migrating this C code to Java? I am particularly interested in finding out how to duplicate the "select" behavior in Java.
    Thanks for your help.
    -TJW
    Here is part of the C code as it currently stands:
    #define PS2_DEVICE "/dev/psaux"
    /* the descriptor */
    int fd_ps2;
    if ((fd_ps2 = open(PS2_DEVICE, O_RDWR | O_SYNC | O_NDELAY)) == -1 )
    perror("Error opening PS2 port.");
    exit(-1);
    int ret;
    /* an array of file descriptors */
    fd_set fds;
    /* a structure to hold select time-out information */
    struct timeval tv;
    /* the acknowledgement byte */
    unsigned char ack_byte = -2;
    /* attempt to send the byte, i.e. write to the file descriptor */
    if (write(fd, &snd_byte, 1) != SUCCESS) {
    perror("Error sending the byte.");
    return ERROR;
    /* clear the file descriptor set */
    FD_ZERO(&fds);
    /* add the desired descriptor(s) to the set. In our case, we are only
    * concerned with the psaux descriptor */
    FD_SET(fd, &fds);
    /* set the time structure's time values that will be used to enforce
    * time-outs for the select */
    tv.tv_sec = 0; // seconds
    tv.tv_usec = 200; // milli-seconds
    /* wait on the file descriptor for communication
    * to the host */
    ret = select(fd + 1, &fds, 0, 0, &tv);
    /* ret should contain the number of descriptors contained in the
    * descriptor set, which may be zero if the timeout expires before
    * anything interesting happens */
    if (ret == -1) {
    puts("Select error.");
    return ERROR;
    else if (ret == 0) {
    puts("Timed out.");
    return ERROR;
    else if (ret > 0) {
    /* there is at least one descriptor still in the set */
    else {
    /* some other error occurred */
    return ERROR;
    if (read(fd, (void *)&ack_byte, 1) != SUCCESS) {
    puts("Error reading from the descriptor.");
    return ERROR;
    .........

    Hi TJW,
    Assuming you haven't already read it, perhaps this article will help:
    http://www.developer.com/net/net/article.php/626271
    Hope it helps you.
    Good Luck,
    Avi.

  • Tap to drag select by whole words using the Trackpad!

    I figured out that there is an easy way to drag select by whole words using the Trackpad... just put your mouse over the word you want to start the selection from and ...
    tap, pause, tap, tap
    ... or another way to say it might be ...
    tap, double tap
    I find this method almost 100% reliable, it's effortless to get the timing right.
    Being able to do this now removes the only thing that I've missed about a mouse since switching to the trackpad.
    Yay!

    On the trackpad, after double tapping to select a word, you cannot drag to continue selecting more words. And if you triple tap, it selects the entire paragraph. If you double tap to select a word, pause and tap-drag, the selection doesn't change with your dragging. If you double tap to select a word, pause, and double-tap-drag, it starts a drag/drop operation using the original selection.
    The method I described allows you to accomplish with a trackpad, the operation that mouse users take for granted - double click/drag to select a word and drag to select more words.
    As far as I know, the technique I posted at the top is not widely known. At least I didn't turn up anything with my google searching and have used this trackpad for almost a year without knowing about this trick.
    FYI - my trackpad "Point & Click" settings are:
    tap to click
    secondary click is tap with two fingers
    3 finger drag disabled

  • Drag Selection Area implementation

    Hello,
    I'm trying to implement a "drag selection area"
    functionality, like a clipping style. Where user will draw a
    rectangle on top of a series of sprites, and that will perform an
    action to those sprited whitin the rectangle.
    I was wondering how it would be best to implment it? In
    terms of performance.
    I was thinking of using the .containsPoint() of the
    Rectangle, however, that means I have to do lots os calculations as
    my sprites are lines drawn all over the screen. So, calculating the
    intersection points for all lines would not be good...
    Is there a way to get the sprites or elements that are drawn
    "behind" the rectangle? since this lines are sprites and they are
    drawn before the rectangle I thought that will be a better way of
    getting the "selected" items?
    Marcela

    You may want to use openGL calls instead of
    java.awt.Graphics otherwise you would lose hardware
    acceleration for drawing the box. These calls would
    be made within gl4java's GLAnimCanvas display()
    method. Basically, if your GLAnimCanvas implements
    MouseListener and MouseMotionListener you can change
    the box coordinates within the appropriate method
    (e.g. mouseDragged, mousePressed) and have the box
    rendering code within display()Not necessarily. Java2D is accelerated in version 1.4

  • Search help for a field using a selection method which has a text table.

    Hello all,
    I am trying to create a search help for one of the fields in a structure say RFCDEST. Now for this i am giving the selection method as the DB table where all the RFCDEST are maintained. However there is a text table which is also comes up for this selection method and the description of the filed RFCDEST is in that text table and the description is not stored in the main table which i specified as the selection method.
    My query is that on F4 now all the rfc destinations are being shown however the description i am not able to show them because there is no field in the table specified in the selectionmethod which hold s the description but instead it is there in the text table, how can i fetch the description from there and display in the search help.
    Warm Regards,
    Naveen M

    look at search help FC_RFCDEST. that problem has already been solved with this search help.

  • How Do I Drag Select Multiple Comments or Annotations in Adobe Acrobat Pro 9

    How Do I Drag Select Multiple Comments or Annotations in Adobe Acrobat Pro 9

    Hello Sara,
    Yes, command+click will work to select multiple comments. However, I'm working with some PDFs that have a substantial number of comments and this is taking quite some time to select them all. Additionally, it is tricky to click some of them, and if I mis-click, all the selection work is undone and everything becomes deselected. I'd like to know if there is a simpler way to select many multiple comments, such as a simple drag selection in Adobe Acrobat Pro 9.

  • Many more selection methods!! Period!!

    Hi everyone, and especially you, the developers of Illustrator and other Adobe programs...:
    I work a lot in both 3ds Max and Illustrator, and I often find myself working with hundreds of thousand polygons. The selection tools are so cool in 3ds Max, and give me every option of selecting faces on a complex model... For instance - just naming SOME options available in 3ds Max:
    Rectangular selection.*
    Circular selection
    Fence selection (selection in perfect straight lines)
    Lasso Selection.*
    Paint selection (like a brush - everything within the stroke gets selected)
    Soft selection (Selection method using a tolerance setting, see reference picture: http://fanous.persiangig.com/egg/egg03.gif )
    Video examples of some different ways to select in 3ds Max: http://www.digitaltutors.com/store/video.php?detectqt=false&vid=1694
    .*Illustrator present
    Another thing I think is missing in Illustrator is the ability to "make selection from guides" - because, you already have the ability to make costume guides, but you can't make a selection out of them ( as far as I know?)
    There are soooo many tips and tricks you developers of Adobe products could "borrow" from 3ds Max... Fx. clicking on the scroll wheel on the mouse as the "Hand tool" instead of the "Space command" on the keyboard. In Indesign it is especially a pain in the ***, when you are in the middle of writing text, and just need to have a look further down on the page, then you get a double space in the text when clicking space. - Imagine how easy it would be with a click on the scroll button on the mouse instead?!
    Cheers!
    Martin

    the ONLY thing Illustrator need is a
    RECTANGULAR WINDOW SELECTION TOOL
    WINDOW SELECTION TOOL
    WINDOW SELECTION TOOL
    WINDOW SELECTION TOOLWINDOW SELECTION TOOLWINDOW SELECTION TOOLWINDOW SELECTION TOOLWINDOW SELECTION TOOL
    WINDOW SELECTION TOOL
    WINDOW SELECTION TOOLWINDOW SELECTION TOOL
    WINDOW SELECTION TOOLWINDOW SELECTION TOOL
    WINDOW SELECTION TOOLWINDOW SELECTION TOOL.............so that all the object which are INSIDE the selction are selected
    so that all the object which are INSIDE the selction are selected
    so that all the object which are INSIDE the selction are selected
    so that all the object which are INSIDE the selction are selected
    so that all the object which are INSIDE the selction are selected
    so that all the object which are INSIDE the selction are selected
    LIKE ALL THE OTHER, similar software
    ps: sorry for this typical layout, but I am Sooooo frustrated about this!

  • Drag selection in spark datagrid?

    Is there an easy way to enable a spark DataGrid to use drag selection, similar to how you can select cells in Excel or Google Docs? Or will I need to track mouse movements and manually manipulate the selectedCells?
    Thanks!
    -Aaron

    Couldn't find a built in way to do this, but it turned out to be pretty easy thanks to the GridEvent classes that solve the challenge of know what row/column index the mouse is interacting with. My final solution:
    A class that extends spark::DataGrid
    private var _allowDragSelection:Boolean = false;
    private var dragSelectionAnchor:CellPosition;
    private var dragSelectionStarted:Boolean;
    * If true and selectionMode is GridSelectionMode.MULTIPLE_CELLS the user can drag their
    * mouse to select a rectangular area of cells, just like Excel or Google Docs.
    public function get allowDragSelection():Boolean { return this._allowDragSelection; }
    public function set allowDragSelection(value:Boolean):void {
              if(this._allowDragSelection == value)
                        return;
              this._allowDragSelection = value;
              if(this.allowDragSelection)
                        this.addEventListener(GridEvent.GRID_MOUSE_DOWN, this.handleGridMouseDown);
              else
                        this.removeEventListener(GridEvent.GRID_MOUSE_DOWN, this.handleGridMouseDown);
    private function handleGridMouseDown(e:GridEvent):void {
              if(this.selectionMode != GridSelectionMode.MULTIPLE_CELLS)
                        return;
              this.dragSelectionAnchor = new CellPosition(e.rowIndex, e.columnIndex);
              this.dragSelectionStarted = false;
              this.addEventListener(GridEvent.GRID_MOUSE_DRAG, this.handleGridMouseDrag);
              this.stage.addEventListener(MouseEvent.MOUSE_UP, this.handleDragMouseUp);
    private function handleGridMouseDrag(e:GridEvent):void {
              // don't start processing selection drag until mouse has left the selection anchor
              if(!this.dragSelectionStarted && e.rowIndex == this.dragSelectionAnchor.rowIndex && e.columnIndex == this.dragSelectionAnchor.columnIndex)
                        return;
              // once started, process changes even if the user drags back over the anchor
              this.dragSelectionStarted = true;
              // local to avoid expensive getter cost
              const selectedCells:Vector.<CellPosition> = e.grid.selectedCells;
              // determine the selection rectangle from the anchor to the current cell
              const rowFromIndex:int = Math.min(this.dragSelectionAnchor.rowIndex, e.rowIndex);
              const rowToIndex:int = Math.max(this.dragSelectionAnchor.rowIndex, e.rowIndex);
              const colFromIndex:int = Math.min(this.dragSelectionAnchor.columnIndex, e.columnIndex);
              const colToIndex:int = Math.max(this.dragSelectionAnchor.columnIndex, e.columnIndex);
              // create new cell positions selection vector, and track if any new cell is added
              var cells:Vector.<CellPosition> = new Vector.<CellPosition>();
              var cellsChanged:Boolean = false;
              for(var row:int = rowFromIndex; row <= rowToIndex; row++){
                        for(var col:int = colFromIndex; col <= colToIndex; col++){
                                  var cell:CellPosition = new CellPosition(row, col);
                                  cells.push(cell);
                                  cellsChanged = cellsChanged || !selectedCells.some(function(c:CellPosition, i:int, v:Vector.<CellPosition>):Boolean {
                                            return c.rowIndex == cell.rowIndex && c.columnIndex == cell.columnIndex;
              // assign the new selection only if it changed (Flex is pretty slow here with big selections)
              if(cellsChanged || selectedCells.length != cells.length){
                        this.selectedCells = cells;
                        // maintain the selection anchor for any following SHIFT click selection
                        this.grid.anchorRowIndex = rowFromIndex;
                        this.grid.anchorColumnIndex = colFromIndex;
    private function handleDragMouseUp(e:MouseEvent):void {
              this.removeEventListener(GridEvent.GRID_MOUSE_DRAG, this.handleGridMouseDrag);
              this.stage.removeEventListener(MouseEvent.MOUSE_UP, this.handleDragMouseUp);
    Cheers.
    -Aaron

  • Universal Entity EJB find/select method for single db table

    Hi there.
    I'm quite new in bea spheres and my question reflects my small knowledge:
    Is there any way to perform "universal" sql query on single database table via find/select methods? This means, that I would like to pass whole WHERE clause to these methods, not just some fields values.
    What do I mean?
    Normally we define find/select method that looks like this one:
    SELECT OBJECT(o) FROM Cities AS o WHERE population>=?1 AND state=?2
    We call this a method this way:
    finder1 (1000000, 'France')
    Method returns collection with objects holding data about cities in France with more than 1000000 inhabitans..
    But, I want to define method, that could be called this way:
    finder1 ("o.population>=1000000 AND o.state='France'")
    This method should be able to perform any query on 'Cities' database table.
    I tried with defining find method for following query:
    SELECT OBJECT(o) FROM Cities AS o WHERE ?1
    but it does not work, of course.
    Is there possibility to define method that could be called this way?
    I use Bea Weblogic Workshop 8.1 SP3
    Message was edited by akla at Oct 23, 2004 5:21 PM

    Hi,
    The 'Dynamic Query' feature of WebLogic 8.1's EJB container can help you here. This feature enables you to execute complete EJB QL queries that are constructed on the fly. Check the WebLogic 8.1 documentation for more details.
    -thorick

  • Drag select and move multiple items

    Hi there,
    I'm currently creating a word game where I would like to place tiles, but if possible I need it to be possible to drag select groups of tiles (preferably with a visible selection box as you drag) and move them around all together.. is there a simple way to implement this and still have the tiles snap to a grid ?
    Many Thanks in advance
    Martin

    you can reparent your selected group to a new parent and drag the parent.

  • Drag Select Inside Points With The Direct Selection Tool While Above An Object?

    I'm trying to modify a path in InDesign CS5 (Fig. 2), as it is now I have to select each point individually. Becasue while you're zoomed in (Fig. 1), you can't drag and select the points. When you attempt to do that, you end up dragging the whole image.
    Is there a way to drag select inside points with the direct selection tool while your directly above the image with the paths you want to select?
    Fig. 1
    Fig. 2

    FAIL #1:
    No. When you copy paste the Cliiping Path [NOT the frame] into Illustrator, then alter the path and paste back into Indesign, it pastes it back as a FRAME, NOT a CLIPPING PATH.
    FAIL #2:
    Why do people comment on this stuff without first testing what they are suggesting?
    What you suggested doesn't work or even make sense.
    Apprently in InDesign, you can't have a CLIPPING PATH without an IMAGE there to begin with. When a FRAME OBJECT contains an IMAGE the option to convert the object to an UNNASSIGNED OBJECT is greyed-out, as in UNSELECTABLE, as in NOT POSSIBLE, which is another way of saying IMPOSSIBLE, which in most circles pertains to MAJOR FAILAGE.
    When you CUT [hold command then press X] the CLIPPING PATH, from the FRAME/OBJECT you can then unassign the object, but when you paste the CLIPPING PATH back in, it invariably pastes the IMAGE along with the CLIPPING PATH, and once again the UNASSIGNED OBJECT is simply an ordinary frame with an image, and thus NO LONGER AN UNASSIGNED FRAME.
    People like you make life harder dude, seriously.
    Again, like some of the folks above, you're confusing a FRAME PATH [that you can alter and create with the pen tool as well] with a CLIPPING PATH. They are NOT the same thing. 
    Know the difference between the two before you feel inclined to respond.
    My kingdom for someone out there with some merit and sense of accountability.
    It's like, where do you people work? Are you serious? SMH.

  • Java.nio select() method return 0 in my client application

    Hello,
    I'm developing a simple chat application who echo messages
    But my client application loop because the select() method return 0
    This is my code
    // SERVER
    package test;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.ServerSocketChannel;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    public class Server {
         private int port = 5001;
         public void work() {               
              try {
                   ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
                   serverSocketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(port);               
                   serverSocketChannel.socket().bind(isa);
                   Selector selector = Selector.open();
                   serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
                   System.out.println("Listing on "+port);
                   while(selector.select()>0) {
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();) {
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isAcceptable()) {
                                  ServerSocketChannel keyChannel = (ServerSocketChannel)key.channel();                              
                                  SocketChannel channel = keyChannel.accept();
                                  channel.configureBlocking(false);                              
                                  channel.register(selector, SelectionKey.OP_READ );
                             } else if (key.isReadable()) {
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  String m = Help.read(keyChannel );
                                  Help.write(m.toUpperCase(), keyChannel );
              } catch (IOException e) {                                             
                   e.printStackTrace();                         
         public static void main(String[] args) {
              Server s = new Server();
              s.work();
    // CLIENT
    package test;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    public class Client extends JFrame  {
         private String host = "localhost";
         private int port = 5001;
         private SocketChannel socketChannel;
         private Selector selector;
         public void work() {               
              try {
                   socketChannel = SocketChannel.open();
                   socketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(host, port);               
                   socketChannel.connect(isa);
                   selector = Selector.open();
                   socketChannel.register(selector, SelectionKey.OP_CONNECT | SelectionKey.OP_READ );
                   while(true) {
                        selector.select();
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();) {
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isConnectable()) {
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  if (keyChannel.isConnectionPending()) {
                                       System.out.println("Connected "+keyChannel.finishConnect());                                                                           
                             } else if (key.isReadable()) {                                                                                                                                                           
                                  SocketChannel keyChannel = (SocketChannel) key.channel();                                             
                                  String m = Help.read(keyChannel);
                                  display(m);                                                                                                                                                                                                                   
              } catch (IOException e) {                                             
                   e.printStackTrace();                         
         private void display(final String m) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        area.append(m+"\n");
                        textFieed.setText("");
         private void sendMessage(final String m) {
              Thread t = new Thread(new Runnable() {               
                   public void run() {                                                                                
                        try {                         
                             Help.write(m, socketChannel);
                        } catch (IOException e) {               
                             e.printStackTrace();
              t.start();                    
         public Client() {
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(1);
              textFieed.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode()== KeyEvent.VK_ENTER) {
                             String m = textFieed.getText();
                             sendMessage(m);     
              area.setEditable(false);
              getContentPane().add(textFieed, "North");
              getContentPane().add(new JScrollPane(area));
              setBounds(200, 200, 400, 300);
              show();
         private String messageToSend;
         private JTextArea area = new JTextArea();
         JTextField textFieed = new JTextField();
         public static void main(String[] args) {
              Client s = new Client();
              s.work();
    // HELPER CLASS
    package test;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.nio.CharBuffer;
    import java.nio.channels.SocketChannel;
    import java.nio.charset.Charset;
    import java.nio.charset.CharsetDecoder;
    import java.nio.charset.CharsetEncoder;
    public class Help {
         private static Charset charset = Charset.forName("us-ascii");
         private static CharsetEncoder enc = charset.newEncoder();
         private static CharsetDecoder dec = charset.newDecoder();
         private static void log(String m) {
              System.out.println(m);
         public static String read(SocketChannel channel) throws IOException {
              log("*** start READ");                              
              int n;
              ByteBuffer buffer = ByteBuffer.allocate(1024);
              while((n = channel.read(buffer)) > 0) {
                   System.out.println("     adding "+n+" bytes");
              log("  BUFFER REMPLI : "+buffer);
              buffer.flip();               
              CharBuffer cb = dec.decode(buffer);          
              log("  CHARBUFFER : "+cb);
              String m = cb.toString();
              log("  MESSAGE : "+m);          
              log("*** end READ");
              //buffer.clear();
              return m;                    
         public static void write(String m, SocketChannel channel) throws IOException {          
              log("xxx start WRITE");          
              CharBuffer cb = CharBuffer.wrap(m);
              log("  CHARBUFFER : "+cb);          
              ByteBuffer  buffer = enc.encode(cb);
              log("  BUFFER ALLOUE REMPLI : "+buffer);
              int n;
              while(buffer.hasRemaining()) {
                   n = channel.write(buffer);                         
              System.out.println("  REMAINING : "+buffer.hasRemaining());
              log("xxx end WRITE");

    Here's the fix for that old problem. Change the work method to do the following
    - don't register interest in things that can't happen
    - when you connect register based on whether the connection is complete or pending.
    - add the OP_READ interest once the connection is complete.
    This doesn't fix all the other problems this code will have,
    eg.
    - what happens if a write is incomplete?
    - why does my code loop if I add OP_WRITE interest?
    - why does my interestOps or register method block?
    For code that answers all those questions see my obese post Taming the NIO Circus
    Here's the fixed up Client code
    // CLIENT
    package test
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.nio.channels.SelectionKey;
    import java.nio.channels.Selector;
    import java.nio.channels.SocketChannel;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    public class Client extends JFrame  {
         private String host = "localhost";
         private int port = 5001;
         private SocketChannel socketChannel;
         private Selector selector;
         public void work() {
              try {
                   socketChannel = SocketChannel.open();
                   socketChannel.configureBlocking(false);
                   InetSocketAddress isa = new InetSocketAddress(host, port);
                   socketChannel.connect(isa);
                   selector = Selector.open();
                   int interest = 0;
                   if(socketChannel.isConnected())interest = SelectionKey.OP_READ;
                   else if(socketChannel.isConnectionPending())interest = SelectionKey.OP_CONNECT;
                   socketChannel.register(selector, interest);
                   while(true)
                        int nn = selector.select();
                        System.out.println("nn="+nn);
                        Set keys = selector.selectedKeys();
                        for(Iterator i = keys.iterator(); i.hasNext();)
                             SelectionKey key = (SelectionKey) i.next();
                             i.remove();
                             if (key.isConnectable())
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  System.out.println("Connected "+keyChannel.finishConnect());
                                  key.interestOps(SelectionKey.OP_READ);
                             if (key.isReadable())
                                  SocketChannel keyChannel = (SocketChannel) key.channel();
                                  String m = Help.read(keyChannel);
                                  display(m);
              } catch (IOException e) {
                   e.printStackTrace();
         private void display(final String m) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        area.append(m+"\n");
                        textFieed.setText("");
         private void sendMessage(final String m) {
              Thread t = new Thread(new Runnable() {
                   public void run() {
                        try {
                             Help.write(m, socketChannel);
                        } catch (IOException e) {
                             e.printStackTrace();
              t.start();
         public Client() {
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(1);
              textFieed.addKeyListener(new KeyAdapter() {
                   public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode()== KeyEvent.VK_ENTER) {
                             String m = textFieed.getText();
                             sendMessage(m);
              area.setEditable(false);
              getContentPane().add(textFieed, "North");
              getContentPane().add(new JScrollPane(area));
              setBounds(200, 200, 400, 300);
              show();
         private String messageToSend;
         private JTextArea area = new JTextArea();
         JTextField textFieed = new JTextField();
         public static void main(String[] args) {
              Client s = new Client();
              s.work();

  • Hello, I just bought a 2013 Mac mini and I cannot get the sound to output to my Dell U2713HM monitor.  I went to sound output but even though my Dell shows up there when I select it there is no sound output to it.  I am using a mini DP to DP cable...

    Hello, I just bought a 2013 Mac mini and I cannot get the sound to output to my Dell U2713HM monitor.  I went to sound output but even though my Dell shows up there when I select it there is no sound output to it.  I am using a mini DP to DP cable...Any ideas? Thanks

    Hi Alxx911, and John Hammer1. After reading John's reply - " You can plug something into it's headphone jack. though" . I thought i'd try out of curiosity. I plugged in some headphones. I didn't expect anything to happen  and nothing happened. The audio jack is for the Dell soundbar which is optional.
    Here's a direct copy and paste from the users manual: Section About Your Monitor.
    Attaching the Soundbar AX510 / AX510PA (Optional) CAUTION: Do not use with any device other than the Dell Soundbar. NOTE: The Soundbar power connector (+12 V DC output) is for the optional Dell Soundbar AX510/AX510PAonly. To attach the Soundbar: 1. Working from the back of the monitor, attach the Soundbar by aligning the two slots with the two tabs along the bottom of the monitor. 2. Slide the Soundbar to the left until it snaps into place. 3.  Connectthe Soundbar with the DC power connector. 4. Insert the mini stereo plug from the back of the Soundbar into the computerís audio output jack. For HDMI/DP, you can insert the mini stereo plug into the monitorís audio output port.  If there is no sound, check your PC if the Audio output is configured to HDMI/DP output.
    This monitor has no speakers. (Like John Hammer1 mentioned). The no speakers feature was one of the reasons I chose this monitor.
    Good Luck !

  • My iPad camera photos will wirelessly sync with my iMac and iCLoud photo stream, but the videos do not, is USB connection the only way to transfer videos or is there also a wireless method?

    My iPad camera photos will wirelessly sync with my iMac and iCLoud photo stream, but the videos do not, is USB connection the only way to transfer videos or is there also a wireless method?

    Videos are not included with the Photo Stream. Photo Stream is for photos only.
    There is not a wireless method for importing videos from the iPad's Camera Roll.

  • I want to change my account payment method to none and I do not have a credit card yet.Plus, iTunes gave a message saying that I need to review my account and when I go there,the none payment method is hidden.

    I want to change my account payment method to none and I do not have a credit card yet.Plus, iTunes gave a message saying that I need to review my account and when I go there,the none payment method is hidden.

    Assuming that you want help and that you aren't just copying-and-pasting that thread's title and posting a link to it, then have you tried the steps on the post that I linked to in my first reply on that thread ?
    If you don't get the 'none' option when trying those instructions then you will need to enter credit card details before you will be able to use the account - when you've entered credit card details you should get the 'none' option and be able to remove your card details.
    Or you can create a new account, and follow, exactly, the steps on this page when creating it' : http://support.apple.com/kb/HT2534

Maybe you are looking for