Copying text to the clipboard using Java

This works for me and is quite simple: Import these: import java.awt.datatransfer.StringSelection; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; And then put this snippet of code wherever you’d like to alter the clipboard: String myString = “This text will be copied into clipboard”; StringSelection stringSelection = new StringSelection(myString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, null);

How to send data to local clipboard from a remote SSH session

My favorite way is ssh [remote-machine] “cat log.txt” | xclip -selection c. This is most useful when you don’t want to (or can’t) ssh from remote to local. Edit: on Cygwin ssh [remote-machine] “cat log.txt” > /dev/clipboard. Edit: A helpful comment from nbren12: It is almost always possible to setup a reverse ssh connection using … Read more

Copy text to clipboard with iOS

Although the accepted answer is a good walkthrough of how UIPasteboard works, I figured I’d post the relevant snippet right here for everyone’s convenience: Obj-C UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = @”Paste me!”; Swift 2.2 let pasteBoard = UIPasteboard.generalPasteboard() pasteBoard.string = “Paste me!” Swift 3+: let pasteBoard = UIPasteboard.general pasteBoard.string = “Paste me!”

JavaScript get clipboard data on paste event (Cross browser)

Solution #1 (Plain Text only and requires Firefox 22+) Works for IE6+, FF 22+, Chrome, Safari, Edge (Only tested in IE9+, but should work for lower versions) If you need support for pasting HTML or Firefox <= 22, see Solution #2. function handlePaste(e) { var clipboardData, pastedData; // Stop data actually being pasted into div … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)