• Display Photos On Your TV With Chromecast

    or display anything on your TV actually, from your Mac or PC.

    When I first got Google’s gadget (it only just came out in The Netherlands), I was a bit underwhelmed. Google’s vision for it seems to be that all content should be available online and that your mobile phone or tablet is the primary input device. This means that streaming photos, videos or audio from your Mac or PC is not as easy as it sounds.


    That is, until I found this relatively hard to spot menu item in the Chrome browser extension. It allows you to choose what to stream; just the browser tab, the browser tab with audio or the entire screen! Obviously the last option makes it trivial to use your favorite photo app to display you holiday pictures on the TV in the living room. I can see this working for Keynote slides as well.

    Stream your entire screen with Chromecast

    For videos, I’ve been trying this extension called Videostream for Google Chromecast. It’s not as user friendly as Beamer, but works fine technically. It even supports subtitles. You might want to enable Caffeine though, to keep your Mac from falling asleep while playing.

    Looking at streaming music, you can output audio while casting your screen (at least on Windows and Linux you can). The ‘Cast this tab (audio mode)’-setting works well for the web versions of Spotify, Soundcloud, Rdio, Pandora etc. It’s quite promising, but doesn’t come close to what Porthole can do for AirPlay yet.

    SDK’s are available for iOS, Android and Chrome. When asked, Google said that an SDK for Macs isn’t planned. Which is understandable, but still disappointing. The user experience of working with local files through Chrome extensions isn’t perfect.

  • Creating an Alfred 2 Workflow With Ruby

    Alfred is a tool that I use literally dozens of times a day. Every time I launch an app, clone a git repo, search on Google et cetera. It’s a productivity tool like no other. One of its coolest features is the ability to create your own productivity boosters, by making (and sharing) ‘workflows’.

    I recently made a workflow that adds keyboard controls to Reign, the Spotify remote that works on any device with a browser.

    Reign for Spotify Alfred 2 Workflow

    As Alfred’s own documentation can be somewhat lacking around workflows, I thought I’d share my experience. As such, this is by no means a definitive guide, just some things I learned in the process.

    Getting to know workflows

    All the workflows I've setup

    While Alfred 2 if free, you’ll need the Powerpack to be able to create and import workflows. So get that, if you didn’t have it already.

    A basic workflow gets some input, performs an action and optionally shows some output. Alfred passes the return value of each of these steps to the next. Additionally you can activate a workflow using a trigger, like a hotkey or file action. While the workflow is active, it can use Alfred’s interface to show feedback, like preset actions or autocomplete suggestions.

    Simple workflows can be a matter of dragging and dropping the right components on the canvas and connecting the dots. The solution I was after required some scripting though. This is where Alfred really shines, with support for Bash, Zsh, PHP, Ruby, Python, Perl and osascript (Apple Script).

    Sublime Workflow, using Apple Script

    You can write scripts directly into the text area, but when things get a little more extensive it’s probably easier to use a Bash script to invoke your script.

    Using a template project

    I chose Ruby because I wanted to take advantage of its network and JSON parsing capabilities. Some of these features are contained in gems that might not available on every Mac without installing them first. It’s quite easy to install Gems locally and include them with your Ruby project, but I was hoping to find a tool that does this work for me and could provide me with some wrapper functions around Alfred specific functions.

    After some digging around I discovered Zhao Cai’s alfred2-ruby-template. This template contains everything you need to include gems with your workflow and actually streamlines the development process a great deal. I won’t go over the entire setup process here. Zhao has explained pretty much all of it in the Quick Start Guide section on the GitHub page mentioned before.


    To put this walkthrough in some perspective, these were the goals I had for the workflow.

    • Activate by entering a specific keyword;
    • Find/set/save the ip address/hostname and port for the Reign server;
    • Execute play/pause/next/previous commands;
    • Show ‘Now Playing’ information;
    • Open the current track in a local Spotify client.

    All these features are available through Reign’s API, by accessing specific URLs.

    http://[ip/hostname]:[port]/playpause = Toggle play/pause
    http://[ip/hostname]:[port]/next = Next song
    http://[ip/hostname]:[port]/previous = Previous song
    http://[ip/hostname]:[port]/nowplaying = Returns the artist and title for the current track
    http://[ip/hostname]:[port]/status = Returns a JSON response with more song information (including a Spotify URI)

    The actual workflow (finally..)

    Alright, with all the context in place, let’s get to work on the workflow! You can get the full source for this workflow on GitHub.

    Edit your workflow description

    After following the template setup, you should have a folder containing your workflow and an empty canvas in Alfred.

    Start off by entering some information about your workflow. Double-click your workflow in the overview on the left to do so.

    We'll use the Script Filter input

    Setup the workflow input

    To activate the workflow I wanted to use the keyword reign. As soon as I type that into Alfred, a script should run. Alfred provides a component called a Script Filter that does just that. Add it to the canvas by clicking the circled + in the top right corner and selecting Inputs → Script Filter.

    Take a look at the Script Filter that activates the Reign for Spotify workflow.

    Script Filter to trigger the workflow

    The most important field is the Keyword, which will trigger the scripts. I wanted the workflow to complete several tasks (e.g. play/next/previous) and used an argument to accomplish this. To learn more about how arguments work, read this post on Alfred’s forums.

    You’ll notice that I didn’t set my language to Ruby, but to Bash. This allows me to enter a Bash command that runs a Ruby script. I can then edit the script using my favorite editor.

    In this article I want stay away from the code as much as possible (it’s available on GitHub if you want it), but I want to point out two things that cost me some time to learn.

    Storing settings

    For my workflow to work, I need to know the host that will receive the commands via HTTP. I could add a script to discover hosts using Bonjour (like Reign does), but that would complicate thing a lot. I chose to just ask for the data and store it, through Alfred.

    Zhao (from the Ruby template, remember) thought of this and provides a way to save and load settings. Here’s what it looks like.

    Alfred.with_friendly_error do |alfred|
      # Save settings
      alfred.setting.dump({ "host", value })
      # Load settings
      settings = alfred.setting.load
      puts settings['host']


    You can pop-up options in Alfred, while typing. Like “Copy ‘Ozzy Osbourne - Crazy Train’” in the screenshot at the start of this article. This is called feedback and frankly is quite cool.

    Alfred.with_friendly_error do |alfred|
      fb =
        :uid      => "",
        :title    => "Copy '#{np}'",
        :subtitle => "Copy to clipboard.",
        :arg      => np, # This gets passed as 'output' when the user selects the item
        :valid    => "yes"

    After the user selects one of these options the assigned arg gets passed to the next item in the workflow.

    Caveat: one thing I noticed was that when you pass user input in the arg it might not ‘be there’ instantly if the user presses return too soon. Still looking for a way around that.


    To share your workflow with others, right-click it and select Export. This will save your workflow as an .alfredworkflow file. Others can add this to their setup by simply double-clicking it.

    Export your workflow

    Add your workflow to the list on Alfred’s forums. Try to spot Reign’s entry. Also consider putting it up on GitHub.


    While you continue to work on your workflow, you’ll want people to be able to update to the latest version. There’s currently no official way to go about this, but Alleyoop gets the job done.

  • Got two presents this week, one made me sick

    By random coincidence both the Ouya and Oculus Rift arrived at my doorstep this week. One day after each other. The Ouya on Wednesday, the Oculus on Thursday. I backed the Ouya kickstarter project nearly a year ago.

    Unpacking the Ouya

    I haven’t gotten a chance to give them a proper spin, but I can say they’re both quite impressive. The Ouya lacks great games, but makes up for it by its looks and emulators. The Oculus Rift is even more mind blowing than I thought, but left me inches from puking after about five minutes of wearing it. Apparently this happens more often and should get better after getting used to the effect. Although I already get nauseated again by just thinking of the Rift Roller Coaster demo.

    For the Oculus I’m not just curious about games (the horror genre is never going to be the same), but also looking forward to trying more ‘experiences’ as I’ll call them. You can find quite a few on Rift Enabled. From watching movies in a cinema, to simply floating through space and reading about the planets in our solar system.

    Also, there’s these kinds of projects:

    I need to go see The Lawnmower Man again..

  • Recommended Podcasts

    Tweeting about Instacast made me review the podcasts I like. Why not share them here?

    Most shows on my list are Apple development and game orientated. I’m still looking for a few that cover web development. Anyway, in a slightly particular order, these are the podcasts I enjoy listening to.

    Core Intuition

    A podcast about indie software development for the Mac, iOS and other Apple technologies

    Hosted by Daniel Jalkut (@danielpunkass) and Manton Reece (@manton).

    Developing Perspective

    A podcast discussing news of note in iOS Development, Apple and the like.

    David Smith (@_DavidSmith) talks about his experiences as a independent iOS and Mac developer. I like how it covers the things he comes across in his daily activities. It’s always around 15 minutes, making it super convenient to listen to when you have a moment to spare.

    The Talk Show With John Gruber

    Sort of like the director’s commentary track for Daring Fireball.

    Software Indie

    Empowering Indie Software Makers To Be Better At What They Do

    A spin-off from the iDeveloper Live podcast, hosted by Steve ‘Scotty’ Scott (@scotty). Very specifically aimed at independent software development.

    ScrewAttack’s SideScrollers

    The most entertaining 30 to 45 minutes of your video game week

    I like ScrewAttack and their video game items, both on their website and in the podcast.

    I’m pretty loyal to the podcasts above and try to stay up to date. Occasionally I’ll listen to an episode of Identical Cousins, Video Game Hangover, Bloody Good Horror and a few others.

  • Tracking Knowledge Base Articles with Google Analytics

    Basic analytics these days: put Google’s Javascript snippet on your website and you’re pretty much set. Every visit gets logged. But what if you want to track something specific? This is by no means an article on super advanced Google Analytics Wizardry, but a short recount of how I took the time to make Google Analytics work for me, and people using my apps.

    I use Uservoice to manage tickets for Porthole, AirVLC and other Danger Cove apps. While doing helpdesk, I usually notice that some questions get asked more than once. That’s when I try to wrap the answer in a knowledge base article. First and foremost because it will help people out even faster than I can respond via email. Questions like: “Will this work on my Mac?” and “If I buy Porthole, how will I get it?” are perfect for a knowledge base entry. The answer is similar for everyone and it’s something that you want to know now, instead of in an hour. The huge downside however, is that I don’t get the chance to interact with my customer. This goes double for questions that have similar solutions for everyone, but when asked a lot might indicate an underlying problem that could be fixed in an update.

    This means that when the knowledge base expands, I need a way to track how often each article is read. Seeing the amount of support calls drop (good), but not knowing when everybody encounters the same problem and silently discards your app (pretty bad) is a very uncomfortable feeling. Trust me. Uservoice has some built-in analytics that provide general statistics, but because I chose to show knowledge base articles on the product pages as well, I need something extra.

    Click on the title to unfold the full article

    The embedded knowledge base shows each article’s title, clicking it will unfold the answer. Much like you see on countless other sites. The only thing I need is an overview of which of these titles get clicked most. Easy right? It is actually. Events make this ridiculously straight forward. Trigger an event and it will show up in Google Analytics, even in real-time. This is what it looks like in Javascript.

    _gaq.push(['_trackEvent', 'Support', 'Open article_107729', 'article_107729']);

    Or if you prefer to make the call inline.

    <a href="#" onclick="_gaq.push(['_trackEvent', 'Support', 'Open article_107729', 'article_107729']);">Article title</a>

    These events fire every time someone opens (or closes; I log that separately) an article.

    Overview of the  most popular knowledge base article

    What I end up with is a nice overview of which topics get consulted the most! This still doesn’t beat communicating via email, but it makes sure that I can at least determine where to focus my attention (and sleep at night).