Fixing Homebrew on OS X Yosemite

Homebrew is “The missing package manager for OS X”. It’s pretty great. Unfortunately, upgrading to OS X Yosemite might break it, as it did for me.

There are several paths for fixing it, depending on when you realize it’s broken. Here are a few possible fixes that you can use.

If you just want the bottom line, here it is:

  1. If you still haven’t upgraded to OS X Yosemite, run brew update before the OS X upgrade.
  2. If you already upgraded OS X and your Homebrew is broken, run git pull from /usr/local, and then run brew update.

Read on for more details on my experience with the break and fix.

Continue Reading…

Shell Foo: Random Log Sampling

Say you’re executing some long-running program (maybe a service) multiple times. Each execution creates a new log file in /tmp/. Log files are named something like myprog.log.timestamp.pid. Each log entry is a line of text in the file, containing the log level (e.g. “ERROR”, “INFO”, etc.).

How would you choose a random sample of 10 error messages from the latest execution?

Shell-Foo credit for this one: Eyal Fink.

Shell-Foo is a series of fun ways to take advantage of the powers of the shell. In the series, I highlight shell one-liners that I found useful or interesting. Most of the entries should work on bash on Linux, OS X and other UNIX-variants. Some probably work with other shells as well. Your mileage may vary.

Feel free to suggest your own Shell-Foo one-liners!

Continue Reading…

Google Inbox: Initial Thoughts and Feedback

I started using the new Google Inbox with my personal Gmail account a couple of days ago. Here’s my initial impression, along with some feedback that I sent to Google.

First, it’s important to understand that people use Email in extremely diverse ways. This means that most people probably try to apply their existing Email workflows with Inbox. As a result, the experience may be very different!

Before Inbox, my Gmail workflow can be generally summed up as:

  • Daily inbox zero.
  • Mostly not using email as “todo” items.
  • Using Boomerang for Gmail to followup on sent email.
  • Using Priority Inbox (not the categories that replaced it) heavily.
  • Archiving everything that I can (search-don’t-sort).

Moving to the new Inbox, I am forced to switch from Priority Inbox to the bundles (same as categories). I will need to get used to it.

The “Done” concept is identical to archiving email, so that’s something that I can preserve from the Gmail workflow. Seems that keyboard shortcuts are the same. At least those I use regularly – y to archive-and-return-to-list, [/] to archive-and-move-to-prev/next, and j/k to move-to-prev-next.

Looks like “Pinning” is similar to “Starring” email. In practice, I used stars in Gmail to pin email in Priority Inbox, so it fits the same workflow. A nice feature is the toggle between “show all items” and “show pinned items”.

“Snoozing” is new and interesting. It’s pretty much identical to setting “Email reminders” with Boomerang, which I rarely used. I think I didn’t use it mostly because the Boomerang implementation was clunky. To make the item “jump up”, they had to reply-to-self when the reminder is due, which I didn’t like. Being able to snooze “better” may help reach inbox-zero by snoozing instead of processing, which may be good or bad, depending on my will power at the moment.

The UI is all modern and nice (material?). Bundling many items into one “UI element” is a little weird. What value do I get from seeing one line that says “Social (25) Twitter, Facebook, LinkedIn, Quora and 10 others”, that I need to click to see another list of 25 items? I’m not sure what I think about it yet.

I like it that the web UI and the Android client are much more in-sync compared to Gmail. I remember avoiding a couple of Gmail-tweaks that could have been useful, but were available only with the web UI. It’s important that I can do the same things from my different devices. Yay Polymer?

There are, of course, a couple of things I don’t like (or I miss) in the new Inbox. For each of the following bullets, I submitted feedback to the Inbox team. If you agree with any – please submit it too, so the issue gets the attention it needs!

  1. Attachments are shown as big icons in the main view. They take a lot of space, but produce very little value… Especially on mobile!
  2. Not clear how to modify bundles. Couldn’t figure out how to move a specific mailing list from the “Forums” bundle to a dedicated one.
  3. Feature request: Allow “snoozing” also outgoing emails (e.g. “remind me to followup on this if no reply within X”). Like Boomerang.
  4. Feature request: Support scheduled outgoing email (e.g. “send this email / reply at X”). Like Boomerang.
  5. Support Google Apps domains! Why is it too much to ask?? O_o

To submit feedback, scroll to the bottom of the sidebar, click “Help & Feedback”, and “Send Feedback”.

I also encourage you to share your feedback that I didn’t cover!

Continue Reading…

Local WordPress Sandbox With Bitnami On OS X

By Monday, October 27, 2014 0 , , Permalink 1

Whether you want to start your own WordPress-powered site, or you’re a WordPress developer – a local WordPress installation is a useful tool. Luckily, with the Bitnami WordPress stack, it’s also a breeze to set up!

WordPress, as a PHP-based web application, requires a full-blown web stack to run. At the very least, you’ll need a PHP-enabled web server, and a database engine. An often-used combination is the LAMP stack, which stands for Linux, Apache, MySQL & PHP.

Setting up a full stack on your own is definitely possible. For most, it’s not considered a fun way to spend an afternoon (or a weekend, if things get hairy). Got several computers with different OSes? Expect a completely different experience with each one…

Enter Bitnami. In a nutshell, Bitnami provides pre-configured, self-contained, application stacks for many popular web applications. And they do it for Windows, Linux, and OS X! Want to install a local WordPress stack? Simply download the installer for your platform, run it, and rejoice!

This short how-to post demonstrates installing a WordPress Bitnami stack on OS X.

Continue Reading…

Escaping Shortcodes In WordPress Posts

By Sunday, October 26, 2014 0 , , Permalink 0

WordPress shortcodes are an easy way to embed dynamic content in WordPress posts. But sometimes I want to write about using shortcodes. To display the verbatim shortcode text in a post, without having WordPress parse it, it must be escaped.

Escaping a shortcode is easy. Just double the enclosing square brackets.

For instance, to display [gallery] in a post, write [[gallery]].

For short codes with start and end tags, only double the first and last brackets: [[shortcode]...[/shortcode]].

It worths noting that currently the escaping will occur only if the shortcode is active. Escaping a disabled shortcode will result a doubling brackets in the output: [[fakeshortcode]] remains [[fakeshortcode]]

This is true for WordPress 4.0, but is recognized as a bug. So if it’s fixed sometime in the future, and the above example contains a single bracket – let me know in the comments so I can fix this 🙂 .

Weekly Review, October 25

By Saturday, October 25, 2014 0 Permalink 0

I’m a productivity / self-management geek. I love making TODO lists, and I’m always on the hunt for the “perfect tool” to fit my GTD-based workflow. Combined with the fact that I also love tinkering with my workflow constantly, it’s not surprising that I still haven’t found that perfect tool.

For a long time I wanted to tackle my “personal productivity system”, rethinking it given the changes in my life. The last time I did it, I had no kids, different day job, and I was working mostly in a Windows environment. Now, with twins, very different day job, and mostly Mac / Linux environments – the old system is rotting.

My plan was to finish with the website project, and start the next project – rethinking my GTD system. I’m babbling about it now, because Google launched Inbox, forcing me to jump straight into evaluating it as a candidate for a TODO system. I got my invite today (h/t @erang). So far I like it. It feels like merging features from Gmail, Google Now, and Boomerang. I just wish I had it on my two Google-Apps-powered accounts too… Who wants invites?

In an unrelated thread, I’m getting annoyed with post-sharing on Facebook. Looks like it ignores the post thumbnail image for most of my shared posts… Anyone has any idea what’s up with that..?

The Weekly Review is (hopefully) a recurring summary, reviewing highlights from the last week.

Continue Reading…

Getting Rid of Redundant Import In SConscripts

This is the seventh post in my SCons series. The topic of this post is getting rid of the last bit of overhead in SConscript files – the Import('*') line.

According the the SCons user guide, a SConscript files needs to Import('...') shared symbols. It’s possible to import all exported symbols with Import('*'). This is the method I used in previous episodes to make shortcuts available in module-level SConscript files

Perhaps you’re fine with this little remaining overhead in every SConscript file. After all, it’s not such a big deal. With the wildcard syntax, you will never need to go over old SConscript files and update their import list when you add a new shortcut.

If you prefer your SConscript files as minimal as possible, here’s a dirty little hack I use. Instead of passing the shortcuts dictionary to a delegated SConscript file using the exports argument, I modify the _SConscript.GlobalDictdirectly before invoking the SConscript() function.

Using my example project, you may recall from the previous episode how the delegation looks like:

def process_module(self, module):
    print 'scons: |- Reading module', module, '...'
    # Execute the SConscript file, with variant_dir set to the
    #  module dir under the project flavored build dir.
    self._env.SConscript(
        sconscript_path,
        variant_dir=os.path.join(self._env['BUILDROOT'], module),
        exports=shortcuts)

The hack is a minor modification of this snippet:

def process_module(self, module):
    print 'scons: |- Reading module', module, '...'
    # Execute the SConscript file, with variant_dir set to the
    #  module dir under the project flavored build dir.
    SCons.Script._SConscript.GlobalDict.update(shortcuts)
    self._env.SConscript(
        sconscript_path,
        variant_dir=os.path.join(self._env['BUILDROOT'], module))

The result of the hack is that the shortcuts are injected directly into the global dictionary. This means that these symbols are available in SConscript files, without any call to Import(..)!

As always, the entire project is available on my GitHub scons-series repository. Feel free to use / fork / modify. If you do, I’d appreciate it if you share back improvements.

See the scons tag for more in my SCons series.

Continue Reading…

Choosing Hosting Service for The Ostrich Website

By Monday, October 20, 2014 1 , The Ostrich Website Permalink 0

To start a new website, I need to choose a hosting service provider. This is the fourth milestone in The Ostrich website project roadmap. This post is a project progress report, summarizing the completion of the milestone.

The expected outcome, from the roadmap: Hosting plan purchased; Mock instance of chosen content platform installed.

I eventually chose HostGator. Read on for more details on the options I explored.

Continue Reading…

Weekly Review, October 18

By Saturday, October 18, 2014 0 Permalink 0

Last week of the holidays for the foreseeable future. Back the work..!

Google announced Android 5.0 (Lollipop) and Nexus 6 and 9 the other day. That’s pretty exciting! I can’t wait to get Lollipop on my Nexus 5 (no, I don’t want to install developer preview on my daily-use phone)! As much as I love the Nexus line, I can’t be too excited about the Nexus 6. It got decent specs, although I’d expect a 128GB option if there’s no SD expansion slot. But the size! And the price! Oh my god! 5.96″?! for $650?!?! Damn you Google, I don’t want that! What I really liked about the Nexus line so far was “excellent Google-experience devices at great price points”. When people ask me for smartphone recommendation, if they’re not tech-savvy, I usually recommend an iPhone. If they say they don’t want one (due to price, or other reasons), I used to recommend the latest Nexus as the best value-for-money alternative. With Nexus 6, I can’t do it anymore. In addition, Nexus devices used to be reference devices for developers, which isn’t reasonable anymore at that price point.

I guess that’s the downside of Nexus devices gaining popularity. Do you have a different opinion? Let me know in the comments!

OS X Yosemite became publicly available this week, after a couple of months of beta. I upgraded my MacBook Pro (mid 2012 model) yesterday, and looks like it passed smoothly. Didn’t run into any problems so far. Did you? What’s the best new feature for you? (didn’t find mine yet)

The Weekly Review is (hopefully) a recurring summary, reviewing highlights from the last week.

Continue Reading…

How to Simplify Your SConscripts

This is the sixth post in my SCons series. The topic of this post is building reusable infrastructure that can extremely simplify your module-level SConscript files.

Starting with the first non-trivial SCons project, the module-level SConscript files contained too much repetitive code. The goal of this enhancement is to go back to minimalistic SConscript files. The objective is to let the developer define the module-level targets with minimal code, and no hassle.

I continue using the same C++ project that I introduced in the basic example. In this post I present SCons shortcuts that are available in module-level SConscript files. These shortcuts are Python functions that take care of dirty details behind the scenes.

The final result is available on my GitHub scons-series repository.

Continue Reading…