How can I “intercept” Ctrl+C in a CLI application?

Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { /* my shutdown code here */ } }); This should be able to intercept the signal, but only as an intermediate step before the JVM completely shutdowns itself, so it may not be what you are looking after. You need to use a SignalHandler (sun.misc.SignalHandler) to intercept the … Read more

jQuery bind to Paste Event, how to get the content of the paste

There is an onpaste event that works in modern day browsers. You can access the pasted data using the getData function on the clipboardData object. $(“#textareaid”).bind(“paste”, function(e){ // access the clipboard using the api var pastedData = e.originalEvent.clipboardData.getData(‘text’); alert(pastedData); } ); Note that bind and unbind are deprecated as of jQuery 3. The preferred call … Read more

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