Writing Markdown with Editorial

Since last time I updated, I’ve been playing with a new (to me) iOS app called Editorial. It is, put simply, a Markdown-based text editor which can sync with Dropbox, which is well-designed and very nice to use, and for some, that will be more than enough reason to give it a look.

However, perhaps you’re familiar with Python, or a fan of Automator on OS X, and that is where Editorial becomes even more relevant to your interests. This is because Editorial has support for workflows, which can be written in and run from the app, and these workflows can include scripts in Python. Written by the same developer as Pythonista, Editorial makes it very easy to take your Markdown documents and do cool things with them, either by using workflows with the built-in Automator-style actions or by harnessing the power of Python.

To give you an example of the power of Editorial, let me tell you all what I spent my Tuesday night doing. I found a workflow on the Editorial Workflow Directory that allows the user to post the current document to a WordPress site, and decided to have a go at writing something that would make my life easier. I embarked on a quest to write a similar workflow for posting to LiveJournal.

Now, full disclosure: as part of my day job, I spend a lot of time coding in IDL, but I’ve never really written anything in Python before, and I’ve never used anything that involves XML-RPC before, and I’ve never written any code involving blogging or LiveJournal before. With just a little Googling, a lot of distress at how awful LiveJournal’s documentation is, and some luck, I put together a workflow in Editorial that allows me to easily post to my LiveJournal, and even gives me pop ups showing me my list of tags and a list of moods to pick from. Now, obviously, this might be less useful for some (most) of you than it is for me, but it’s a good example of how easy putting things together in both Editorial and in Python can be!

All in all, I can’t recommend Editorial enough. It feels like the Markdown editor I’ve been waiting for on iOS.

Workflows in Workflow

I have recently been discovering an iOS app called Workflow, which is basically a tool similar to Automator, but available on the iPad. In this blog post I just want to share a couple of workflows that I’ve written for the app, which I’ve been finding useful. (Obviously, your mileage may vary.)

Firstly, a workflow that lets me easily mail links to myself for later. I generally use Instapaper, but sometimes I want to come back to a page on a schedule, rather than just catching up with it when I go through my Instapaper queue. As a result, I wrote a quick workflow that will take the link of the current page, called Email Myself.

Bookmarklet replacements

I’ve been using bookmarklets in Safari to open pages in other apps for ages, but this has the disadvantage that these bookmarklets can only be used from Safari. If I’m reading a webpage in Reeder, for instance, I have to open it in Safari before I can use a bookmarklet to open it in another app. Workflows allow me, in essence, to use a bookmarklet from any app, via the share sheet.

The first workflow that takes advantage of this allows for a Tumblr post to be opened in Tumblr.app. This is handy if you read Tumblr through an RSS reader like I do, since it allows easier reblogging. Open in Tumblr.app is the workflow, and I actually constructed this myself by using Safari on OS X to deconstruct the way in which Tumblr.com can call Tumblr.app.

The next workflows allow for pages to be opened in Tweetbot, my iOS Twitter app of choice. Find User in Tweetbot and Find Tweet in Tweebot are both fairly self-explanatory, and both allow me to avoid using the Twitter website as much as possible.

Finally, a workflow for Basil simply opens the current webpage in Basil. Open in Basil is a very simple workflow and is based upon the bookmarklet that the app itself presents to users.

I hope someone else finds these workflows useful, and I heartily recommend the app!

A bookmarklet for the Guardian quick crossword

I’ve been doing the Guardian quick crossword with my colleagues since starting my PhD back in 2012. Eventually, crossword mania took us and we started doing crosswords in the afternoon as well as in the morning. This necessitates printing ‘back issue’ crosswords, which in turn makes getting to those crosswords on my phone1 a little harder than getting to today’s crossword.

It eventually occurred to me that I could create a bookmarklet which would pop up a dialogue asking for the number of the crossword we were doing, and would then take me to that crossword’s page. It’s a bit niche, but the JavaScript for this bookmarklet is below, just in case anyone else finds it useful.

javascript:N=prompt('Quick crossword no','');if(N){location.href='http://www.theguardian.com/crosswords/quick/'+escape(N)}

It should be noted that if you don’t input a number, or you hit cancel, then nothing happens. If you want to be taken to the Guardian’s crossword page instead, then you can add the following code to the end of the bookmarklet.

else{location.href='http://www.theguardian.com/crossword/quick'}

  1. We don’t cheat, we just check our answers. Honest. 

Unpacking .pkg files in OS X with BetterZip

I had cause today to try to unpack a .pkg file. I had installed PDF File Unlocker and found it was a bit pants1. Unfortunately, it installed from a .pkg file and there was no uninstaller or list of files that get installed, so I wanted to make sure I’d efficiently purged it from my system.

I have BetterZip, which is a really good utility for unzipping basically any file on the planet for OS X. I will just note at this stage that I have an older version of the utility and I haven’t upgraded to BetterZip 2, but I’ve got a lot of use out of the app. The below steps rely on having BetterZip. If you’d like to do it without BetterZip, I found this blog post and this Stack Overflow post to be very helpful in informing my actions.

  1. Change the extension from .pkg to .xar.
  2. Open the file with BetterZip. This took a while on my system but did eventually work.
  3. Three files should appear: Payload, Bom, and PackageInfo.
  4. PackageInfo: Just open this in your favourite text editor.
  5. Payload:
    • Add the extension .cpio.gz.
    • Open the file with BetterZip.
  6. Bom:
    • Open Terminal.
    • Navigate to the file.
    • lsbom Bom

Hopefully that all helps somebody else, too!


  1. If you generate a PDF with the free trial, it’ll be the first half of the PDF and every time you open it Adobe Acrobat will give you a little pop-up window. I disliked it. 

Facebook and their psychology experiment

Today it was reported by the AV Club that Facebook (or their researchers) has recently submitted a paper to a journal of psychology exploring the impact of social media on mood. It’s actually quite an interesting finding, if perhaps an expected result: people get happier or sadder depending on whether the mood of their news feed is light or heavy.

But the ethics are a bit problematic. Facebook conducted this experiment by skewing users’ feeds to either be more positive or more negative and then seeing whether future posts from a user were likely to be more negative or positive as a result. This means that they manipulated users’ emotions, which is somewhat concerning. It’s entirely legal under the terms of the agreements you make with Facebook when you open an account, but is it ethical? After a conversation with my girlfriend, I rather think not: informed consent is the key thing here, and the users in this experiment did not give informed consent despite any agreements they might have clicked ‘OK’ on.

What really interests me, however, is the question of utility. There’s an argument that if Facebook can make its users more happy by manipulating their feed, then they should. But what this exposes is the question of whether Facebook is an information service or an entertainment service: is the primary goal to keep you updated about your friends and what they’re doing, or is the primary goal to entertain your users and make them happy? This research makes me think Facebook is more interested in the latter, compared to Twitter, which seems to focus more on the former1. That’s potentially an insight into Facebook’s goals and what they’re aiming to do in the future.

The thing I’m most curious about isn’t the utility but rather the way in which the experiment was conducted. I don’t get why Facebook used the methodology they did. They manipulated the feed to give more positive and more negative messages and measured the change in mood of the resulting status updates: that’ll get you the results you want, sure. But why not the following methodology?

  1. Choose a user.
  2. Let the existing algorithms automatically generate that user’s feed.
  3. Monitor those algorithms’ output over a month and determine the average happiness of their feed and their statuses.
  4. Keep monitoring, but now looking for a period of time which deviates from the average happiness by some amount.
  5. Upon measuring this, measure the change in happiness of status posts.

It would surely allow researchers to explore the same question but without actually needing to manipulate users’ emotions at all, thus neatly removing any ethical qualms whilst still allowing interesting research to be conducted. The level of happiness might be hard to quantify, but they’ve already quantified it in the study so I don’t see that as a huge stumbling block. Is there a flaw I’m not seeing here, and if so, what is it?

Edited on 29 June 2014: Thanks to the commenters for their intriguing discussion of this idea! A lot of people have pointed out that this is not the equivalent of an intervention study; this has been noted both in the comments on this piece and by @tedsvo and @masnick (who wrote a follow-up to my blog post talking about my idea) on Twitter.

I’m aware that this is the case, but my background is in solar-terrestrial physics and so none of my research can be based on intervention studies. As a result, the scientists in my field have to develop techniques to explore causality based on observed correlations. What I’m essentially proposing, above, is a superposed epoch analysis in which users’ happiness is expressed for a number of days on either side of observed impacts on newsfeed positivity. It isn’t as definitive as Facebook’s method, but it is a more ethical way to conduct research which would hopefully shed light on the questions at hand.

I would be fascinated to see whether the same result could be reached using a non-intervention-based method, and I wonder whether the advent of large datasets from companies like Facebook and Google could be an opportunity for physicists to utilise data analysis skills over large timescales?


  1. This might also be why businesses are starting to find their outreach on Twitter is much more effective than on Facebook: Facebook is focusing on users to the detriment of businesses posts appearing in feeds, whereas Twitter isn’t doing quite the same thing. (Both companies allow sponsored posts so the monetisation strategy is equal between the two.)