Ctrl+C to copy does not always work in Eclipse

Alright, here’s an annoying one.  When using Eclipse, I find that Ctrl+C fails to perform the “copy” operation.  Sometimes.

So, I press Ctrl+C to copy and go someplace else to paste and find the previous contents of the clipboard have been inserted.  Somewhat annoying.  I got into the habit of pressing Ctrl+C several times to make sure the copy command went through, but sometimes it still would not.

This issue does not appear to be specific to any particular platform or version.  I am experiencing the issue with Eclipse 4.1.2 on Windows, and a coworker of mine is experiencing the same thing in Eclipse 3.7.2 for OS X.  However, we are working on a rather large project (a few thousand files), which means Eclipse’s memory use is rather high and the editor seems to briefly “stall” from time to time.  These stalls aren’t long or annoying enough to get in the way of getting work done, but if you happen to hit the Ctrl+C while it is stalling, the copy command does not process.  The problem may get slightly worse if Eclipse is open for a long time.

That’s my working theory, anyway; I may be completely off, as others are reporting this and making no mention of a large project.  There is in fact a bug report on the issue in the Eclipse bug tracker that suggests that the bug may have been introduced in Indigo SR1 (Eclipse 3.7.1 and 4.1.1) — and also an older report describing similar behavior as far back as 2007, that was supposedly fixed, but people continued to report the issue was occurring.

In the newer report, Jun Luo suggested on Monday to unbind the keyboard shortcuts for cut, copy, and paste in Eclipse Preferences -> General -> Keys.  I tried removing the Ctrl+C binding and all week I have not experienced this issue, so I am calling it fixed.  My Mac-using coworker has not reported the issue recurring since removing the ⌘+C binding, either.

It is strange that removing the registered Ctrl+C shortcut for copying text actually fixes it.  I am supposing that this removes any special binding that Eclipse itself makes to Ctrl+C; however, the underlying SWT element still processes it as a copy command, and this works even if Eclipse is a little busy.

What’s funny is later on in the week, I experienced the same issue with Ctrl+X for “cut.”  I cut some text, it disappeared, and when I went to paste it, I got the previous contents of my clipboard.  So, I’ve disabled the “Ctrl+X” binding for “cut” as well.

Use rsync to copy only one type of file

Scenario: A remote server has a bunch of PHP files that I want to copy down to my machine.  I want to periodically update my local copy of the files, catching up with changes that have been made to the files on the server, but ideally not copying over everything again.

rsync is perfect for this.

However, there’s a catch:  There’s an enormous amount of data on the remote side that I do not want.  I only want the PHP files.  How do I tell rsync to copy only one type of file?

The solution is not very complicated but it is also not very intuitive.  Here’s what I ended up with, which seems to work fine:

rsync (--options) username@remoteserver.com:/path/to/remote/files/ /path/to/local/copy --include '*/' --include '*.php' --exclude '*'

That --include '*/' is the part that is particularly confusing.  This instructs rsync to include files in subdirectories, even though the --exclude '*' is given (which keeps rsync from copying everything).  If you don’t have it, you’ll only get the PHP files from the root level of the copy source.

Thanks to Maururu for the hint.