Archive for the ‘how-to’ Category
Back in August of last year, for one of the first posts on my brand-new blog, I put up the slides from a lunch-time presentation that I gave on find, grep, sed, and awk. I put it up so that it would be available as reference to those that attended the talk, even though the slides weren’t designed for stand-alone use, and slides make a poor Internet reference.
Given the surprising popularity of that post, it seemed reasonable to repackage the information in a format that is more fitting for a blog post.
grep are incredibly powerful. But many never learn a fraction of what they can do. Did you know that
grep can print the surrounding lines? Or that you can search for files based on permissions? Here’s a collection of examples that might expand your notion of what can be done with
I’ve been learning my way around Lucene, the popular Java open source information retrieval software library, lately. Which is to say, I’ve been making mistakes with Lucene.
Much of the time spent with any new technology is in making mistakes, discovering mistakes, and correcting mistakes. An inexperienced programmer would view these mistakes as impediments to progress. It’s far more sensible, and more encouraging, to view these mistakes as the evidence of progress.
With that in mind, I’ll have no shame in sharing my newbie Lucene blunders, with hopes of helping someone that hasn’t yet had the opportunity to fail in all of these ways. Read the rest of this entry »
I love the command line, and it is my primary interface for version control. When using Subversion, I appreciate the advantages of TortoiseSVN and Subclipse, and I use them on particular occasions. But the speed and precision offered at the CLI are too much of an advantage for any SVN user to ignore.
Some of you are snickering already. “Subversion? It’s almost 2012, past time to move to Git or Mercurial.” Sure, and we’ve all left Java behind, and spend our days coding in Clojure or Scala. The fact is that if you don’t work at a startup, you are unlikely to actually use a DVCS at work, so Subversion is still relevant to more developers than any other version control system, and will be for the next five years, regardless of how you feel about that.
If you are one of those that uses Subversion, read on, and I’ll detail the commands that you should know and use regularly. Read the rest of this entry »
I love keyboard shortcuts, and I do my best to incorporate them with every GUI application that I use regularly. I’ve been comparatively negligent in learning keyboard shortcut for the command-line applications, as it seems less advantages. After all, there’s no need to reach for the mouse, what are we hoping to save?
Nevertheless, there are real efficiencies out there, and here are my favorite Bash shortcuts. Read the rest of this entry »
When you want to see the contents of a text file in unix, the first two things to come to mind are
less. I choose
cat when the files are small, but the pagination and navigation in
less makes it the better choice most of the time.
Suppose you find a directory with five files that are unknown to you. Printing the contents of all five is easy enough with
cat and a pipe:
$ ls | xargs cat
But if you have five files, chances are you don’t just want everything scrolling past you. So we try:
$ ls | xargs less
Hmm … when you get to the bottom of
file1.txt we find the message
(END) - Next: file2.txt. What to do?
As always, the answer is in the
:n for next file,
:p for previous file.
Of course, this isn’t only useful when piping input into
less, it also works when specifying multiple arguments:
$ less file1.txt file2.txt file3.txt
If the question involves mathematical typesetting, then you can be sure that the answer is LaTeX. But if you are off the beaten path, LaTeX can be both the solution and a new problem.
I was interested in typesetting some elementary-school style vertical arithmetic problems. You know, like:
28 + 15 ----
Except with better readability.
Every programmer should read The Little Schemer (pdf) at some point. It doesn’t take long to read, and I hope to provide a review of it soon. For now, I hope to explain how to get started practically with Scheme, as used in this book, since these details are hard to find.