Solving the “Could not find all biber source files” Error

Biblatex is a fantastic bibliography/citation manager for LaTeX. It trumps the older bibtex for its much easier customizability and configuration. It does however, have one bug that can be very perplexing to figure out due to the misleading error message that results: "Could not find all biber source files". At first glance this message seemed straightforward enough to send me poking about the project file structure and build system, checking paths and names. When all that seemed intact, I started Read more [...]

Vim: Insert Mode is Like the Passing Lane

Insert mode is not the mode for editing text. It is a mode for editing text, because both normal and insert modes are modes for editing text. Insert mode, however, is the mode for inserting new/raw text directly from the keyboard (as opposed to, e.g., from a register or a file). Thus, you will only be in insert mode when you are actually typing in inserting (raw) text directly. For almost every other editing operation, normal mode is where you will be. Once you grok this you will realize that, Read more [...]

From Acolyte to Adept: The Next Step After NOP-ing Arrow Keys in Vim

We all know about no-op'ing arrow keys in Vim to get us to break the habit of relying on them for inefficient movement. But, as this post points out, it is not the location of the arrow keys that makes them inefficient, but the modality of the movement: single steps in insert mode is a horrible way to move around when normal mode provides so much better functionality. But here is the thing: while normal mode provides for much better and more efficient ways to move around than insert mode, Read more [...]

Setting up a Python Scientific Environment (NumPy, SciPy, pandas, StatsModels, etc.) in OS X 10.9 Mavericks

It is better than a nightmare from which you cannot wake up ... Install Homebrew: $ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" Find problems and fix them (typically resulting from Homebrew becoming very stroppy if it does not have exclusive access to "/usr/local"): $ brew doctor VERY IMPORTANT NOTE: Make ABSOLUTELY sure that the DYLD_LIBRARY_PATH environmental variable is NOT set. Having this set will cause all sorts of problems Read more [...]

Taking it to a 11: Dramatically Speeding Up Keyboard/Typing Responsiveness in OSX

If you use a Mac/OSX, then enter the following commands in your shell and reboot: $ defaults write -g KeyRepeat -int 0 $ defaults write -g InitialKeyRepeat -int 15 If you live in a text editor or the shell, or otherwise spend most of your typing hammering away at the keyboard like I do, then this makes an absolutely wonderful difference in the responsiveness of any typing activity. It will make your previous typing feel like you were pecking away in slow motion at the Read more [...]

Dynamic On-Demand LaTeX Compilation

Most of the existing approaches to integrating LaTeX compilation into a LaTeX writing workflow centered around a text editor (as opposed to a fancy-schmancy IDE) are horrendously bloated creatures, aggressively and voraciously hijacking so many key-mappings and normal functionality that it makes your Vim feel like it is diseased and is experiencing a pathological personality disorder of some kind. Yes, LaTeX-Suite, I am looking at mainly at you. I did not want a platoon of obnoxiously cheery elves Read more [...]

Setting up the Text Editor in My Computing Ecosystem

Image from WikiMedia Commons Basic Setup of Shell to Support My Text Editor Preferences By "text editor", I mean Vim, of course. There are pseudo-operating systems that include rudimentary text-editing capabilities (e.g. Emacs), and integrated development environments that allow for editing of text, but there really is only one text editor that deserves the title of "text editor": Vim, that magical mind-reading mustang that carries out textual mogrifications with surgical precision Read more [...]

Smart (`infercase`) Dictionary Completions in Vim While Preserving Your Preferred `ignorecase` Settings

Dictionary completions in Vim can use a 'infer case' mode, where, e.g., "Probab" will correctly autocomplete to, e.g., "Probability", even though the entry in the dictionary might be in a different case. The problem is that this mode only works if `ignorecase` is on. And sometimes, we want one (`infercase`) but not the other (`ignorecase`). The following function, if added to your "`~/.vimrc`", sets it up so that `ignorecase` is forced on when dictionary completions are invoked via Read more [...]

Building MacVim Natively on OS X 10.7 and Higher

You might want to do this if you want to install the latest snapshot and no pre-built release is available. OR you might want MacVim to use a custom Python installation instead of the default one on the system path. This latter was my motivation. Once you have downloaded and unpacked the code base that you want to build, step into the `src/` subdirectory: $ cd src Before proceeding, make sure that your Python installations have been built with the "``--enable-shared``"! If this is not the Read more [...]

Using Python’s “timeit” Module to Benchmark Functions Directly (Instead of Passing in a String to be Executed)

All the basic examples for Python's timeit module show strings being executed. This lead to, in my opinion, somewhat convoluted code such as: #! /usr/bin/env python import timeit def f(): pass if __name__ == "__main__": timer = timeit.Timer("__main__.f()", "import __main__") result = timer.repeat(repeat=100, number=100000) print("{:8.6f}".format(min(result))) For some reason, the fact that you can call a function directly is only (again, in my opinion) obscurely Read more [...]

‘xargs’ – Handling Filenames With Spaces or Other Special Characters

xargs is a great little utility to perform batch operations on a large set of files. Typically, the results of a find operation are piped to the xargs command: find . -iname "*.pdf" | xargs -I{} mv {} ~/collections/pdf/ The -I{} tells xargs to substitute '{}' in the statement to be executed with the entries being piped through. If these entries have spaces or other special characters, though, things will go awry. For example, filenames with spaces in them passed to xargs will result in xargs Read more [...]

YonderGit: Simplified Git Remote Repository Management

One of the great strengths of Git is the multiple and flexible ways of handling remote repositories. Just like Subversion, they can be "served" out of a location, but more generally, if you can reach it from your computer through any number of ways (ssh, etc.), you can git it. YonderGit wraps up a number of a common operations with remote repositories: creating, initializing, adding to (associating with) the local repository, removing, etc. You can clone your own copy of the YonderGit Read more [...]

Some Vim Movement Tips

Within-line character-based movement: `h` and `l` move you left and right one character, respectively. `fc` or `Fc` will take you forward to the next or back to the previous, respectively, occurrence of character "c` on the current line (e.g., `fp` will jump you forward to the next occurrence of "p" on the line, while `Fp` will jump you back to the previous occurrence of "p" on the line). `tc` or `Tc` will take you forward to just before the next or back to just Read more [...]

Safe and const-correct std::map Access in C++ STL

The Standard Template Library std::map[] operator will create and return a new entry if passed a key that does not already exist in the map. This means that you cannot use this operator when you do not want to create a new entry (i.e., you expect the key-value pair to already exist in the map), or in a const context (i.e., in a const method or when using a const object). Instead, in these situations, you need to first pull a (const) iterator using std::map.find(), and then check to see if its value Read more [...]

Useful diff Aliases

Add the following aliases to your '~/.bashrc' for some diff goodness: alias diff-side-by-side='diff --side-by-side -W"`tput cols`"' alias diff-side-by-side-changes='diff --side-by-side --suppress-common-lines -W"`tput cols`"' < p>You can, of course, use shorter alias names in good old UNIX tradition, e.g. 'ssdiff' and 'sscdiff'. You might be wondering why (a) I did not do so, and (b) what is the point, conversely, of having aliases that are almost as long as the commands that they are Read more [...]

Setting Up Git to Use Your Diff Viewer or Editor of Choice

Git offers two ways of viewing differences between commits, or between commits and your working tree: diff and difftool. The first of these, by default, dumps the results to the standard output. This mode of presentation is great for quick summaries of small sets of changes, but is a little cumbersome if there are a large number of changes between the two commits being compared and/or you want to closely examine the changes, browsing back-and-forth between different files/lines, search for specific Read more [...]

Using DendroPy Interoperability Modules to Download, Align, and Estimate a Tree from GenBank Sequences

The following example shows how easy it can be to use the three interoperability modules provided by the DendroPy Phylogenetic Computing Library to download nucleotide sequences from GenBank, align them using MUSCLE, and estimate a maximum-likelihood tree using RAxML. The automatic label composition option of the DendroPy genbank module creates practical taxon labels out the original data. We also pass in additional arguments to RAxML to request that the tree search be carried out 250 times (['-N', Read more [...]

Vim Regular Expression Special Characters: To Escape or Not To Escape

Vim's regular expression dialect is distinct from many of the other more popular ones out there today (and actually predates them). One of the dialect differences that always leaves me fumbling has to do with which special characters need to be escaped. Vim does have a special "very magic" mode (that is activated by "\v" in the regular expression) that makes thing very clean and simple in this regard: only letters, numbers and underscores are treated as literals without escaping. But I have never Read more [...]