This version of the site is now archived. See the next iteration at v4.chriskrycho.com.
Filed under: “Posts”

Launch an editor with a list of files containing a string

This one’s here for my own reference as much as anything, because I will want to do this again and I’d rather not have to go dig it up.

If you want to launch an editor with a list of files matching a specific pattern from any Unix or Linux terminal, the quickest and simplest way I’ve found to do it as follows:

find directory [-name modifiers] -exec grep -l pattern | xargs editor

So, for example, I just wanted to use Sublime Text 2 open every Fortran 95 file in a directory that writes to disk, so I ran the following:

find . -name "*.f95" -exec grep -l 'write(' {} + | xargs subl

Read on, intrepid explorer →

Four more anti-patterns

Another set of absolutely lovely gems we found this week: an empty for, the almost-impossible if, continue just because, and source that doesn’t match the executable. Oh my!

The empty for

I’d seen this before, but we found it again while trying to diagnose an (unrelated) infinite loop bug in our source (more on that below): Read on, intrepid explorer →

Two (absurd) anti-patterns

A pair of anti-patterns I’ve run into recently in my software development work, both of which are absolutely awful, though in completely different (and quite distinct) ways. I thought I’d share The Empty If and Wash, Rinse, Repeat, just so the world can share a bit of my pain. Read on, intrepid explorer →

Bitbucket

I recently started using Bitbucket for just about all my software repositories. I like GitHub, too, but Bitbucket has support for both Mercurial and Git, and I prefer the former (even if the latter has a bit broader usage in the software community).

You can find my public project(s) at Bitbucket itself or (identically) on a CNAME mirror of the site here at chriskrycho.com – a lovely feature that both GitHub and Bitbucket support.

One software development effort I’m involved with is actually testing Bitbucket for all its source repositories. If you’re on a small team, it’s a very good resource, as it you can have unlimited repositories for free if you have five or fewer people on the team, and for $10 a month for 10 people on the team. If your team is large enough that you can have a dedicated IP person, it’s probably less effective – but it’s hard to beat that for small teams without a dedicated IT employee.

Don’t Confuse Your Semantics

I was reading an article on Foreign Policy, and encountered a lovely little design decision that I thought I’d highlight as something not to do. Their visual cuing for links sets a different color for the text (quite normal) and bolds it (not so normal). This latter change, in my view, breaks the user’s expectations on semantics in some really unfortunate ways.

Here’s what I mean: we expect bold text to indicate increased importance, and with a few decades of experience we expect altered color to indicate a link. The problem here is that both are in play. You can occasionally get away with breaking the user’s expectations, but in this case the result is that every time there’s a link I interpreted the text as being emphasized. It wasn’t; it was just bolded because it was a link.

The lesson here is simple: keep your semantics clean and distinct. If you have a reason to override the user’s normal expectations, that’s okay, but you should have a very good reason for it. The rest of the time, don’t use bold when you really mean link. Similarly, you shouldn’t normally use color or underlines for emphasis; those have established semantic meaning on the web; when you use them to other purposes it’s just confusing.

Bundling!

"Why do we have to choose between print and digital?" asked Richard Curtis at Digital Book World last week, before tackling the topic of bundling – getting ebooks at reduced cost or even free when buying a physical copy of the book. Drawing an analogy from music purchases that have moved in the same direction, he suggests that publishers ought to be bundling, and then poses the query: When you purchase a print book you should be able to get the e-book for…

  1. the full combined retail prices of print and e-book editions
  2. an additional 50% of the retail price of the print edition
  3. an additional 25% of the retail price of the print edition
  4. $1.00 more than the retail price of the print edition
  5. free

He suggests that this proves to be something of a conundrum for decision-makers in the publishing industry. With respect, and while recognizing that it probably feels like a conundrum to the publishers, I think the answer is really quite simple. Publishers can dramatically increase their profits, and do it in a way that readers will love. (This is the part where you call me crazy. Up next is the part where I show you why I’m not.) Read on, intrepid explorer →

LaTeX & MathJax Demo

I recently discovered MathJax, a JavaScript library that implements LaTeX equation display. It’s brilliant; we’re now using it in our documentation (it’s bundled with Doxygen) and I plan to make heavy use of it in the future wherever it makes sense. Some samples of its capabilities:

Einstein’s famous equation:

Something a little more complicated (one of the equations implemented in the code I’ve been working on for the last few months):

And now, something more complicated yet (defining the elements in the equation above):

I highly recommend MathJax. I’m currently running it via the MathJax-LaTeX WordPress plugin, which allows you to embed it with handy [​latex]...[​/latex] shortcode syntax.