Author Archives: Nejc Zupan


Every time when I am in a pair-programming session and the other person does not use a clipboard manager I am taken aback at how such a thing is even possible. To me, a clipboard manager is such an essential piece of toolkit that I forget it’s there.

What is a clipboard manager? In its simplest form it’s a history of the things you copied. For example, you select text “Foo”, press Ctrl+C (Cmd+C on a Mac), then repeat the same on text “Bar”. The clipboard manager will keep both “Foo” and “Bar” values handy for use when needed.

Screen Shot 2016-06-21 at 23.15.17

My entire clipboard history, searchable, just one keypress away. Priceless.

Simple as that. And so, so effective! Every time you need to copy many things from one window to another, select and copy them one by one, go to the other window, paste them one by one. You save a ton of window switching and clicking around! Good clipboard managers support searching through the history of things you copied and they are smart about the type of content you copied, such as plain text, URLs, images, etc. There are many more reasons why using a clipboard manager makes your day easier.

Personally, I use the clipboard manager that comes with Alfred, the OS X productivity app. But there are literally hundreds of clipboard managers out there, for all major OSes and most of them do their job just fine. Choosing one is mostly about personal preference on keyboard for keyboard shortcuts and styling.

So, what are you waiting for? Get one!


Dear Plone, welcome to year 2014

TL;DR: Production-level Plone on free-tier Heroku:

First, a bit of history: it was year 2006 and I was realizing that I was not made to be an academic. I made my first strides into entrepreneurship and being in IT, the first logical step was to create a few websites and try to get paid for my work. I did have some programming experience but haven’t done any web development yet. I heard PHP was not the ideal solution so I started looking elsewhere. In my student association I heard about this Plone thingy and gave it a go: I purchased a 20€ per month shared Plone hosting account at Nidelven IT and started hacking. It was the Plone 2.x era and boy was I productive! I threw in content, installed a ready-made theme and did some TTW tweaks. Done! First customer happy! Rinse & repeat, upgrade to a beefier server, rinse & repeat. NiteoWeb Ltd. was born.

Fast forward to a couple of months ago: we used GeckoBoard to drive a wall-mounted dashboard display. GeckoBoard works fine, but they want almost $60 per month if you want to drive more than one display. Sounds quite expensive for a bit of HTML and JavaScript, doesn’t it? So I looked around for alternatives and one of them was the Dashing dashboard from Spotify. I was reluctant to even give it a try as it was a self-hosted Ruby app. And I didn’t know *any* Ruby. But there, in their documentation, I found a short guide on how to deploy your very own version of a sample dashbord to your personal Heroku account. And when I say short, I mean short! I copy/pasted 6 simple commands into my console and that was it! My very own dashboard! After it was running I was motivated enough to read through Dashing’s docs and did a few minor tweaks. One “git push heroku master” later, my changes were again deployed to Heroku and showing up on my dashboard display. Wow, is this developer-friendly or what!

My mind drifted and I thought: Boy wouldn’t it be nice if a non-Plone person could come to a Plone add-on page and create their very own Plone instance with the add-on installed, and they could immediately start using it. Uhm … why not? Why don’t we, as a community, provide “private” demos that people can use? Is there something that prevents us from using Heroku for demos, the same was as Dashing, and many other Ruby products, use it?

Turns out, there isn’t. During the Plone dinner at EuroPython 2014 conference last week, I ordered a few beers and got hacking. Goal: get Plone to run on a free-tier Heroku account.

There have been attempts to run Plone on Heroku before, but they failed because they took the wrong approach. Look, Heroku, by default, supports Python apps that are installed with “pip“. Previous attempts were all focused on fixing Plone so it could be installed with pip. And they failed, Plone’s ecosystem is just too complex.

I decided to take a different approach: buildpacks. Heroku allows you to build *anything* on it. So I created a buildpack that supports zc.buildout. Once I got that done, it was not far from getting Plone installed on Heroku.

The next roadblock came in the form of Heroku’s ephemeral filesystem. Everytime your Heroku “dyno” is restarted, the filesystem is recreated. And you lose your Data.fs. Humpff. Wait, but what about the PostgreSQL that Heroku offers? A production-quality PostgreSQL, for free, with a 10k row limit. That could work! So, add in support for RelStorage and you have a production-ready Plone site running on Heroku. For free. And you are not limited to one, you can have as many as you wish, on the same account. Heroku really is awesome!

So, Plone is suddenly again a viable option for college dropouts starting their businesses! No need for system administration knowledge, how to setup Nginx in front of Plone, how to do proper backups, just a few command-line commands and your site is online!

And, our add-ons can now have demos. If you use Data.fs instead of PostgreSQL, the demo instance’s data will be recreated at least once per day, giving visitors an up-to-date demo instance, displaying what your Plone add-on does and how it looks.

Does this really works? Hell yeah it does! This blog has been running on Heroku since last week! And here’s a Plone 4.3 demo, a Plone 5 demo and a collective.cover demo. Wanna see in action?

Why doesn’t your add-on have a demo yet? Follow instructions on and showcase your add-on to the world!

Load overrides.zcml in

Today I was working on a project where we use overrides.zcml to easily override some default Plone behavior. All was working fine (in the browser, that is) until I started writing tests for our custom behavior.

First thing I noticed was that the overrides.zcml was not loaded in our test layer. “Doh, I need to load it manually with the loadZCML() method!” I thought to myself. Boy was I wrong :).

The problem with using loadZCML() is that it loads whatever ZCML you tell it to load in a “normal” way. So, obviously, you get conflict errors, since declarations in your overrides.zcml directly map declarations that they override. Hence I needed to find a way to tell to load my overrides.zcml in an “override” manner and not throw conflict errors.

After quite some research and asking around, I got a tip from JC Brand on the #plone IRC channel: use xmlconfig.includeOverrides(). This indeed got me the exact result I wanted.

Here’s a snippet for my future self and any other plonista struggling with the same problem that happen to stumble upon this blog:

from import PLONE_FIXTURE
from import PloneSandboxLayer
from plone.testing import z2
from zope.configuration import xmlconfig

class MyProductLayer(PloneSandboxLayer):

    defaultBases = (PLONE_FIXTURE,)

    def setUpZope(self, app, configurationContext):
        import my.product
        xmlconfig.includeOverrides(configurationContext, 'overrides.zcml', package=my.product)
        z2.installProduct(app, 'my.product')

Dexterity vs. Archetypes

TL;DR: migrating your Archetypes content to Dexterity shrinks your Data.fs considerably!

I’ve started looking into migrating Archetypes content in one of the sites we’re running to Dexterity. But before I started coding I wanted to make sure that the juice is worth the squeeze.

The site contains roughly 130k content objects. Most of them are default Plone File type, with a few additional string fields (added with archetypes.schemaextender) and a custom workflow. Nothing fancy, just your standard integration project. New content is imported into the site in batches of ~10k items every now and then with the help of the awesome collective.transmogrifier.

To test how Dexterity compares to Archetypes for our use-case I first created a new Dexterity type that matched the feature-set of the Archetypes type. Then I created a fresh instance, used Transmogrifier to import 13k items (10% of our production data) and ran some numbers.

Results are pretty amazing. With Archetypes, an import of 13k items into a fresh Plone 4.2 site took 61 minutes and the resulting Data.fs had 144 MB (details). With Dexterity, the same import took only 18 minutes and the resulting Data.fs had 64 MB (details). That’s a whopping 70% decrease in import time and a 55% decrease in Data.fs size!

More than enough to be a valid reason to invest in rewriting our types and write that migration script.

Raspberry PI boot to browser

Here at NiteoWeb, we use various SaaS monitoring and logging providers such as Librato Metrics and Papertrail to keep on top of our Plone and Pyramid projects. Hence the need to have a wall-mounted screen to display various graphs and outputs these services. What better way to drive the screen than a Raspberry Pi!

Getting the Raspberry Pi to boot into X and connect to the net was fairly trivial, just follow the official docs. However, getting the Pi to boot directly into a browser (also called “kiosk” mode) required some research. This is how I’ve done it in the end:

  1. Disable screen sleep — so the screen stays on
    $ sudo nano /etc/lightdm/lightdm.conf
    # add the following lines to the [SeatDefaults] section
    # don’t sleep the screen
    xserver-command=X -s 0 dpms
  2. Hide cursor on inactivity
    $ sudo apt-get install unclutter
  3. Configure LXDE to start the Midori browser on login
    $ sudo nano /etc/xdg/lxsession/LXDE/autostart 
    # comment everything and add the following lines
    @xset s off
    @xset -dpms
    @xset s noblank
    @midori -e Fullscreen -a

That’s it! Reboot and you are done!