Our Archive

Welcome to your Archive. This is your all post. Edit or delete them, then start writing!

brain.flush(); > Development

The last post about Eclipse coding is from February... Time to change this! :)

There are several things that happened in the Eclipse world in the last six months. The most visible one might be the latest simultaneous release know as Eclipse 4.4 Luna. Regarding my Eclipse coding I updated the word-wrap plugin to be compatible with Luna. I was also happy to read that the review of my LineNumberRulerColumn patch is progressing. Probably my proposed changes are revised often enough to make it into the next release.

Currently my solution to activate word-wrap is a separate plugin. To have it included in an official Eclipse release I need to provide a patch for one of the existing plugins. I think it fits best to the Platform Text project which contains (among others) the org.eclipse.ui.editors plugin. Therefore I'm currently merging my plugin with this one and try to find out the best practices (where to put stuff, naming conventions, package structure, etc.) within the project by looking at other portions of the code. ;)

Holger Voorman writes the yearly Eclipse report ("Eclipse Jahresrückblick"). In the latest report Holger talks about Eclipse Luna and mentions my word-wrap patch again. What's even cooler is that his previous report (for Eclipse Kepler) is published in the Software Development Trends 2014 and therefore I'm mentioned in this book on page 108. :eek3:

Read More

A direct link to a Zotero entry is very useful but using only the title is not sufficient. ;)

I've changed my Zotero exporter to include some additional data such as authors, publication title, date and DOI. The created string is not compliant to any of the well-known citations styles (Chicago Manual of Style, Harvard, IEEE, etc.) but covers the necessary information to retrieve the reference in case Zotero does not work or some other "Zoterocalypse". :D

Zotero Export (Full)

Read More

In addition to my previous post about connecting Zotero and Evernote I present a solution to create RTF links to Zotero elements in Evernote.

For my workflow it would be great to copy an element in Zotero and paste it as clickable link into Evernote, ideally using the title as text and the Zotero select URI as target. This could only be possible if the function of Zotero that copies text to the clipboard supports formatted (i.e. RTF) content. Usually the clipboard contains several data formats when copying something. If you e.g. copy text from a website containing a link the plain text is stored in the clipboard and additionally there is a version preserving the links, font style and color. Now when you paste the contents e.g. into Microsoft Word, all the formatting will be shown as it was on the website. In notepad only the plain text will be visible. The Zotero (export) translator will always fill the plain text area of the clipboard. Based on my experiments even RTF text with a valid RTF header written to the output won't be recognised as RTF text when pasted into Word or Evernote.

So, what can we do? The first step was to change the output of the Zotero export translator (quick copy) as you can see here. The output now contains at least the Zotero select URI and the title (e.g. <a href="zotero://select/items/0_KJ6MZWKT">CloudML</a>). Then I found the shell command textutil which is able to convert HTML to RTF. You can try the following command in the Terminal which converts an HTML link to RTF and copies the result into the clipboard. Pasting in Word or Evernote will result in a clickable link to Google.com with the text "Test".

echo "<a href=\"http://www.google.com\">Test</a>" | textutil -stdin -stdout -format html -convert rtf | pbcopy

Now that we have a way to get HTML links out of Zotero and found a tool to convert HTML to RTF it's time to put everything together. Automator is a tool in OS X that enables the creation of custom services and workflows. I use it to create a service running a shell command for which a keyboard shortcut can be assigned later on. It's straightforward: Create a service, select "Run Shell Script" and add the command.

Automator in OS X

Automator in OS X

It is very important to set the encoding of the shell environment first because it's not set to UTF-8 as it might be in your Terminal. This is the command I eventually used (Set encoding, use the contents of the clipboard as input for textutil and then save the output in the clipboard):

export LANG=de_DE.UTF-8; pbpaste | textutil -stdin -stdout -format html -convert rtf -inputencoding utf-8 | pbcopy

When you save the workflow it's available in this menu: System Preferences > Keyboard > Shortcuts. In the services category you will find your newly created service and can assign a keyboard shortcut.

Keyboard Shortcuts in OS X

Keyboard Shortcuts in OS X

This is my upgraded workflow with the goal to create clickable links in Evernote pointing to Zotero entries:

  1. Select entries in Zotero, press CMD+Shift+C to copy the HTML links
  2. Press CMD+CTRL+Shift+C to convert the HTML code in the clipboard to RTF
  3. Paste links in Evernote
Evernote with RTF links

Evernote with RTF links

Read More

For collecting and managing references and scientific publications I use Zotero because it has a nice browser integration. You can simply click on the Zotero icon and the reference will be automatically saved to Zotero including the full-text PDF (e.g. on IEEE Xplore), title, author, entry type (e.g. journal article, website, thesis, book), etc. You can arrange your findings using folders for different topics and even use an entry simultaneously in multiple folders without having duplicate files. After collecting references I export them in BibTeX format to use them in TeXlipse.

Although Zotero can store various file types such as text, audio, video, images and much more I prefer Evernote for organizing my notes, writing paper summaries and collecting ideas. Now we need a way to connect both worlds. ;)

The Goal

Ideally, I would select a reference in Zotero, press CMD+C to copy its absolute URI, select some text in Evernote, add a hyperlink to the URI and that's it. The result would be a link in Evernote which brings up the reference in Zotero when I click on it. Well, let's see what is possible.

Some apps support a certain URI scheme to give other applications access to their content. E.g. in Evernote you can copy the link of a note and get something like evernote:///view/12345689/s123/.../ which can be used to create clickable hyperlinks between your notes. Zotero is also capable of creating and understanding links but it takes a custom translator-plugin to access it. First you have to distinguish between the Zotero item URI, which is in fact a web URL pointing to the reference in your Zotero online account (http://zotero.org/users/12345/items/XXYYZZZ), and the Zotero select link that is the desired URI in the format zotero://select/items/0_XXYYZZAA. Based on the translator-plugin by nschneid I created my own simplified version that exports only the plain URIs of the selected elements by using the shortcut CMD+Shift+C.

Now that we have the URI for accessing the reference it's time to make use of it. Evernote is a very smart program but sometimes it's too smart. When you create a link it only supports URLs that start with the common schemas such as http, https, ftp, ssh, etc. Using a zotero://... URI the "OK" button is simply deactivated and adding the link is not possible. To create clickable Zotero select links it is necessary to enable intelligent links (right click > replacements). This way pasted Zotero select links are automatically converted in clickable links when you hit enter! :eek3:

(It is possible that the URI is not associated with Zotero and nothing happens when you click on it. What helped in my case is to create a .html file containing a hypertext reference such as <a href="zotero://select/items/0_XXYYZZAA">My Link</a>, open it in your browser, click on it and make sure to allow your browser to open Zotero for this specific URI schema.)

Summary / TL;DR:

  1. Goal: Create clickable links in Evernote pointing to Zotero entries
  2. Zotero: Install my customized translator-plugin (download on GitHub Gist)
  3. Zotero: Select entries, press CMD+Shift+C to copy the item URI
  4. Evernote: Right click > Enable Intelligent Links
  5. Evernote: Paste item URI and press enter
Links to Zotero entries in Evernote

Links to Zotero entries in Evernote

The connection of Evernote and Zotero is awesome for managing references, writing summaries, collecting ideas and organizing research. :}

Read More

It's always funny what kind of crazy stuff is possible by just using bash and basic Unix tools. :eek3:

Most websites hosting scientific publications offer citation information in BibTeX format. Unfortunately some of them think it would be extremely helpful to force you to download a single .bib file containing the requested citation data. Of course you can save the file, open it, select the contents, copy it and paste it into your desired bibliography file. But this is neither convenient nor efficient. :D

At first I tried to find a program that watches the contents of a folder on OS X. A post on StackOverflow suggested to take a look at the launchctl daemon. It's a nice program that can launch a script (or other program) when a file path has changed. Based on that I wrote a small bash script which reads the contents of a directory, copies the first file into the clipboard and deletes the file eventually. For an easy installation please follow the instructions I present on GitHub. :}

Now I can just save the file into this folder and the content is copied to the clipboard, ready to be pasted into my bibliography file. ;)

Read More

With all your helpful feedback it was easy to determine the most anticipated feature I would implement next: Automatically enabled word-wrap!

The latest version (v0.1.1) of my Eclipse Word-Wrap plugin offers the possibility to automatically enable the word-wrap when certain file types are opened. (By the way: You can take a look at the source code at github if you like to.)

The filename extensions can be configured in the Eclipse preference pane "Word Wrap":

Auto Word-Wrap preferences

Auto Word-Wrap preferences

You can add or remove file extensions to enable the auto word-wrap only for certain file types. After adding a new entry to the list word-wrapping is automatically activated when a file with the specified extension is opened. Of course it is still possible to toggle the word-wrapping for each editor separately.

If you have any suggestions or problems please don't hesitate to contact me. :}

Read More

I planned to post more often about the little side projects I created in the past. This is one of them. ;)

My girlfriend is a future elementary school teacher and was preparing teaching material for her math lesson a few months ago. She had a template of a handout for a geometry lesson with several angles for the children to measure. The problem was that the lines were too thick and looked almost like tiny rectangles sticked together. The kids won't be able to accurately measure the angle because it was not obvious where to put the center of the set square.

Imprecise display of an angle

Imprecise display of an angle

This is where my idea for the CreateAngles class came from. I wrote a simple Java program to generate SVG files providing sharp and crisp angles for her handout. I chose SVG because it's based on a simple XML structure which can be created easily. The crucial part is the configuration of the line style. By adding the stroke-linejoin and stroke-miterlimit properties I was able to create sharp and pointed intersections (take a look at the line in the source code). I also added an arc indicating the angle to be measured.

Sharp and pointed angle

Sharp and pointed angles

Read More

Many people wrote me an email that the word-wrap unfortunately isn't working for the XML editor. The new version now supports XML editors and can be downloaded via update site or manually from the word-wrap development website. Credit is due to Tamás Szekeres who provided a great idea on how to enable the plugin for XML editors. Thank you very much!

The update is developed for Eclipse version 4.3 Kepler but it's also working with 4.2 Juno. By the way: The source code of the word-wrap plugin is now also available on Github.

I'm curious which version of Eclipse you are using. Feel free to leave a comment in the blog or to send me an email. This way I get an overview for which versions my plugins are used or going to be requested. ;)

Read More