Skip to content

Blog

MT4j with Processing 2

This post is archived. It is left as is and won't receive updates.

In our TouchCORE project at the Software Engineering Lab at McGill University, we use MT4j (Multitouch for Java) for the multitouch-enabled user interface.

For a long time, we had the problem that we couldn't run it on OSX using Java 7 and newer, because it is based on an older version of Processing (1.x), which in turn uses an old version of JOGL (Java Binding for the OpenGL API). That version is only compatible with the Java supplied by Apple. As we know, they stopped support with Java 6.

We begrudgingly lived with this state for a long time, which meant that OSX users needed to download and use an old version of Java. Now, with the new release of Eclipse Mars, support for Java 6 was dropped, i.e., Java 7 or greater is required. We wanted to update to Mars, and since we use some Eclipse plugins, such as the Eclipse Modeling Framework (EMF), we needed to use at least Java 7.

This finally pushed us to update MT4j ourselves. With the help of the UltraCom project who did the same but added a ton of other stuff. Based on their commits we managed to update it on our copy (which already had some minor improvements) of MT4j's last official release v0.98.

We put it up on GitHub so hopefully other people can benefit from it: https://github.com/mschoettle/mt4j

How to use OCL when running EMF standalone with Eclipse Mars

This post is archived. It is left as is and won't receive updates.

I previously explained on how to use OCL when running EMF in standalone (not as an Eclipse application). This method works until Eclipse Luna. With Eclipse Mars, OCL was heavily updated again. For instance, it was promoted out of the examples space.

The good thing is it seems to be much easier to initialize it now. Add a dependency to org.eclipse.ocl.xtext.completeocl and use the following code:

PivotStandaloneSetup.doSetup();
CompleteOCLStandaloneSetup.doSetup();

Move more than one directory into a new repository

This post is archived. It is left as is and won't receive updates.

I just realized that my previous post on how to move one directory from one repository to another really only works for one directory.

Fortunately, there is a very easy solution to that using a nice little tool called git_filter.

Basically follow the instructions of it's README. Then, all I did was put the two directories into the filter file. It is important to note here that this file had to end with an empty line in my case, otherwise the last directory will be ignored.

You will get a new branch, which can be pushed to an empty repository:

git remote add origin_repoB <url of repo>
git push origin_repoB <localBranch>:master

It also works for one directory and is a lot faster compared to the other method.

Move directory from one repository to another, preserving history

This post is archived. It is left as is and won't receive updates.

I just moved one directory within a Git repository to a directory within another repository including its history. For example:

.
├── repositoryA
   ├── directoryToKeep
   ├── otherDirectory
   └── someFile.ext
└── repositoryB
    └── someStuff

Show old title bar in Thunderbird

This post is archived. It is left as is and won't receive updates.

With the latest release of Thunderbird 17, the menu bar and tabs are drawn into the title bar. On Windows XP, this then looks like the following:

New title bar in Thunderbird

In the default theme, the active title bar is blue. Thunderbird adds more stuff to the title bar which increases the blue area. This looks odd, and fortunately this can be configured. Go to Settings > Advanced > Config Editor (in the Advanced Configuration section).

Search for the setting mail.tabs.drawInTitlebar and change the value to false (e.g., by double-clicking on it). And voilà, much better:

Restored title bar in Thunderbird

Modifying the "New Child" sub-menu items in EMF

This post is archived. It is left as is and won't receive updates.

I was just looking into a way to adjust the text of the items in the "New Child" (the same applies to "New Sibling" as well) sub-menu of the generated editor with EMF. By default the items just show the type name of the element to create. Depending on your meta-model it might be necessary to add some more information in order to be able to see which feature the new element gets added (or set) to.

The available items are depending on the current selected element. The collectNewChildDescriptors(Collection<Object>, Object) method is called on the item provider of this element. The actions for those menu items are created inside your ActionBarContributor class (see generateCreateChildActions(Collection<?>, ISelection)), which is located in the editor project. The text for this action is determined by CreateChildCommand.getText(), which in turn calls getCreateChildText(Object, Object, Object, Collection<?>) of the corresponding item provider. The default case is implemented in ItemProviderAdapter.

There seem to be two approaches, depending on what your goal is.

Reducing file size of a PDF on Mac OS

The file size of PDFs can become quite large, especially when scanning documents or documents containing images. Instead of sending large files, it is almost always recommended to reduce the file size. To do that, there are several ways. For example, there is an app called PDF Squeezer in the Mac App Store (in 2013: €3.59 or $3.99, more expensive today).

The same functionality can be achieved using Quartz filters in the ColorSync Utility. There is already one called Reduce File Size but it might lead to a blurry PDF. You can copy this filter and adjust the settings. However, I found custom filters in the Apple Support Community that work quite well.

  • Download the filters
  • Move the filters to ~/Library/Filters
  • Open your PDF with ColorSync Utility
  • In the bottom, choose the appropriate filter. There are several options starting with "Reduce to ..."
  • Click "Apply"
  • If you are satisfied with the result, save the file under a different file name (File > Save As).

Alternatively, you can place them into /Library/PDF Services/ instead. Besides the fact that the filters will be available to all system users, when exporting PDFs in Preview, you can select a filter directly in the dropdown under Quartz Filters.

If the filters don't work perfectly for your use, you can adjust the settings within the ColorSync Utility.

The original creator of the filters to be credited seems to be Jerome Colas according to this GitHub repository.

Updates to this blog post

  • December 2017: Uploaded the ZIP file to my own server, since the original link became unavailable.
  • 27.10.2024: Replaced ZIP file with link to GitHub repository to download filters

LyX: Installing unknown document classes

This post is archived. It is left as is and won't receive updates.

If you either received a LyX file that uses a document class unknown to your LyX installation or you would like to create a document using one of the options in the settings dialog, you need to install that document class.

This description is for Mac OS based on the latest version of MacTeX (as of May 28th 2012 this is MacTeX-2011), but should work with any version.

PostgreSQL accepts any or no password when connecting

This post is archived. It is left as is and won't receive updates.

When connecting to the database with the postgres user I realized it accepts any password or no password even though the user has a password set. I don't know if this happens also when using the installer to install PostgreSQL. In my case I used initdb to set it up.

I remember it mentioned something regarding "trust" after setting it up but didn't take much notice until I realized it accepts any password.

In pg_hba.conf it adds all local connections to be trusted which means connecting from the same host doesn't require authentication.

host    all             all             127.0.0.1/32            trust

If you don't like that just change it to another method.