My First Safari Extension: Copy All Links

Say you encountered a list of links you want to download. How did you do that? So far in Safari, what you can do is to copy the links one by one. Not that convenience huh? In Chrome, you can use Link2Clip and select all links, then Shift-C to copy all links.

I can’t find such extension for Safari in the unofficial Safari Extension repository. So I thought I will make it myself and in the same time learn a thing about Safari Extension.

It turns out that it’s not that hard. The only problem I encountered is just because the documentation of Safari objects is not complete and the fact that it must be created with Javascript. I hate Javascript! But after spending some time reading this post and watching the WWDC video session 505 and 506 about creating extensions for Safari, I finally managed to finish the plugin.

So please welcome to world my first plugin:

Copy All Links Safari Extension

(if you have a problem by downloading, try to right click and click Download Linked File)

How to use the extension. Well, first you need to install the extension. After that select any text with links and right click. Select Copy All Links and you’ll get a dialog will all links in there. You can copy the links by selecting the text in the dialog. It’s not that convenience but Safari Extension AFAIK doesn’t provide any way to insert something to the clipboard.

Be gentle with the safari extension. It is after all my first safari extension.

Eclipse's Quick Diff: See What Changes You've Made Since Last Checkout

A new morning. You’ve checked out the last code from SVN. Stand up and prepare a coffee and when you were back to the computer, Eclipse had loaded the newest code. You ready to code. And you code. Until afternoon and you need to check-in the changes you’ve made. Now you wonder, what have you changed? You know the file you’ve changed, it’s decorated by Eclipse after all. But which lines?

This question is always arisen to most of us. Unfortunately, as default, Eclipse didn’t easily show which lines have you added since last check out. Before I know this feature, I usually compare my code with the latest code in repository. How annoying is that?

It turns out that Eclipse actually already have functionality for that. See this picture.

This feature is called Quick Diff. It is turned on as default but the reference source is the last saved version. If your project use SVN (or CVS, Mercurial, Git as long as you use the Eclipse plugin for that SCM), you can change the Quick Diff behavior to compare the code on your machine with the latest code in the SCM. How nice is that? If you delete lines, you’ll get something like this.

How to do that? As you can guess, go to Preferences and select General → Editors → Text Editors → Quick Diff. Then change the last combo box to SCM you used. That’s it. Now close the main screen and close all opened files. You’ll get the information about which lines have you changed once you open any files.

There is another option in the preference to ‘Show differences in overview ruler’. If you activate this, you’ll get something like in on the right side of the editor.

Now there is still problem with this quick diff functionality. If you have several projects that come from different SCMs, you can’t set the source project based. It’s so not nice and I have filed a enhancement request for that. Vote it up if you also want that functionality!

technology and stuffs