Tag Archives: Tricks

Your IDE’s font matters: Fantasque Sans Mono

A good development environment is crucial to your productivity, there’s no question about it. The phrase ‘good development environment’ is subjective. For example, I’m pretty efficient using WebStorm and VisualStudio. I use vim pretty often but I’m nowhere near ‘efficient’. Matias Niemelä, on the other hand can easily manipulate text in vim.

A year or two ago, I read a blog post somewhere that suggested a font is just as important as your tool of choice. I thought, “yeah, right!”, but downloaded the font anyway. After a day of using the font, I realized how much more quickly I could read through code and how much easier it was to visually identify code blocks. I know that sentence sounds trivial, but after two years of using what I consider a better font I definitely notice a difference when I’m not using the font.

My font of choice these days is called Fantasque Sans Mono.

Here’s a screenshot comparison of Arial and Fantasque Sans Mono, both at 14pt.

Atom: arial 14pt
Atom: arial 14pt
Atom: fantasque sans mono 14pt
Atom: fantasque sans mono 14pt

The first thing to notice is how uncluttered letters are in Fantasque. On line 17, the word ‘function’ feels like it runs together in Arial but the letters clearly stand out in Fantasque. Also notice how the letter ‘g’ is unmistakable on line 18. On line 21, the kerning between parentheses, braces, brackets, and vertical pipes all make the line of code slightly easier to read. On line 23, the zero in Arial and many other fonts often resembles the capital letter ‘O’. For literals, this is obviously a number but it can be an easy typo to overlook within a string. In Fantasque, a zero has a line through it to clearly differentiate the number from the letter. Line 25 is easily consumed in the Arial screenshot mostly because the Atom editor clearly distinguishes between patterns and operations in the regex literal. Take a look at the difference without JavaScript syntax highlighting:

Atom: arial 14pt plain text
Atom: arial 14pt plain text
Atom: fantasque sans mono 14pt
Atom: fantasque sans mono 14pt

The actual code tends to be wider than other fonts. In the Arial screenshot, the image stops at the 80 character vertical indicator, which can easily be seen in the Fantasque screenshot. I actually like to use a 12pt or 13pt font size with Fantasque, which gives me a little more code on screen.

Although these points may seem trivial, I challenge you to at least give a few different fonts a try. You’ll be as surprised as I was to find that subtle differences in your font can improve productivity.

Download Fantasque Sans Mono from OpenFontLibrary.

Flattr this!

Hard link in OS X

Under linux, I used mount --bind olddir newdir to link a source code directory from a git repository in my Dropbox folder to another public git repository. I did this to avoid using git submodules and, for whatever reason, git had trouble following hard links under Ubuntu.

I recently purchased a Macbook Pro, and I was trying to use the same bound mount point. The mount provided with OS X doesn’t offer --bind. A main suggestion I found online is to use bindfs. bindfs didn’t work for my needs, and I didn’t want to manually compile a link/unlink application as others suggested.

I found that the homebrew package coreutils provides the gnu version of ln. To install:

brew install coreutils

This package doesn’t overwrite OS X default packages unless you run the above command with the --default-names switch, otherwise all utilities are prefixed with a g. Using the gnu ln program, I was able to hard-link successfully:

gln -d src target

I don’t know what the difference is between Ubuntu and OS X (both running git 1.8.4), but I can now work properly under git with hard links as expected.

Installing more gnu utilities

You can go one step further and install more gnu utilities (found on StackExchange):

brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt

Then, add the following to your .bashrc:


Thanks to the Apple StackExchange user lri for the excellent post.

Flattr this!

Disable scrollbar overlays in Ubuntu 13.10

Working with Tizen IDE, I noticed the overlay doesn’t actually display for the scrollbar in Ubuntu 13.10. This isn’t so bad for vertical scrolling because I use the touchpad to scroll. For horizontal scrolling, it is a huge pain. I’ve never liked the overlays, and they don’t really fit well with Cinnamon.

Here’s how to set the scrollbars back to normal:

$ gsettings set com.canonical.desktop.interface scrollbar-mode normal

If you discover the normal mode causes problems for you, you can reset it to the overlay:

$ gsettings set com.canonical.desktop.interface scrollbar-mode overlay-auto

Or, if you prefer a GUI, open dconf-editor and expand the node on the left to com→canonical→desktop→interface, then select the scrollbar style you like best.

Flattr this!

Android Studio and Library Projects

This is basically a quick brain-dump post. I have previously attempted to get into Android application development, but with only 8-10 hours of “free” time per month, it was difficult to get traction with an app before the goog machine overhauled everything. This happened repeatedly. I had some great ideas for a mobile app over the weekend, and thought I’d give it another go and guess what? Everything is overhauled: Android Studio is the next big thing, ant builds are out and gradle builds are in. I decided to force myself to overcome my annoyances and try out Android Studio.

Android Studio is beautiful and operationally stable, although very buggy. I’ve found four bugs in less than two days. The biggest bug and usability issue, however, is in creating an Android Library project and adding a reference to it in another project.

Here are the steps I took to reference another project. These steps may not be accurate, but I don’t care. I figured they may help save someone some time.

  1. Create an Android library project using Android Studio.

    There’s a bug in Android Studio 0.1.3 which apparently does not mark android library projects as library projects, so navigate to MyLibProject/MyLib and change the android plugin reference to:

    apply plugin: 'android-library'
  2. Create a main application project, in my case MyApplication2
  3. Add library as git submodule or nested directory under MyApplication2
  4. Edit settings.gradle in the main project to:
    include ':MyLibProject:MyLib’, ':MyApplication2'
  5. Edit MyApplication2/build.gradle to compile the lib project in the dependencies task:
    compile project(':MyLibProject:MyLib’)
  6. Navigate to your library subdirectory and execute:
    gradle clean && gradle assemble
  7. Press CTRL+ALT+SHIFT+S to open the Project Structure dialog
  8. Create a new module, change module name and point content root to MyLibProject
  9. Change Package name to the package name of your lib and press Finish
  10. Click MyApplication2 (not MyApplication2Project) in the Project Structure dialog and select the Dependencies tab.
  11. Click the green plus icon and select Library|Java
  12. Select MyLibProject/MyLib/build/bundle/release folder, choose Project Library, and hit ok
  13. Save. The library should now be usable.

These instructions may seem a bit hurried, but it should get the job done. I’ve run through numerous attempts at different options, and these are the only ones that seem to have stuck.

I might also mention, I’ve created an ANDROID_HOME environment variable to load in my shell which points to the sdk directory under the android-studio installation. I’ve also downloaded gradle-1.6 to ~/bin, and symlinked gradle to ~/bin/gradle which adds gradle to my path.

Flattr this!

bash function: md.view

One of my favorite bash functions is md.view, which is available in my dotfiles repository.

# test markdown files, probably a better way to test for programs.
function md.view {
    local i=true
    type -p markdown &> /dev/null || i=false
    if $i ; then 
        local output="/tmp/md.view-$(date +%F).html";
        markdown $1 > "$output";
        google-chrome "$output"; # xdg-open would open default browser after next line executes
        rm "$output";
        echo "markdown is not installed"

There’s not really anything particularly cool about this function. It checks for markdown and reminds me to install it if I haven’t yet. It doesn’t do this for Google Chrome because that’s the first application I install on new machines. Usually, you’d use xdg-open to choose a browser, but this can cause problems with the remove command at the end of the function (depending on how the browser creates its process).

Anyway, this is really useful when I’m creating README files using markdown for my github repositories. For instance, I was just updating a README to refer to *_32.png images. The problem is that * and _ are special tokens in markdown. I’d never attempted to escape one after the other, which is often broken in parsers. With this function in my extended .bash\functions, I can quickly check output with:

$ md.view README.md

I know, it’s such a simple thing to have as a favorite. Sometimes really simple things have a huge impact, especially if you type out README files regularly

Flattr this!

dotfiles backup using GitHub

I was recently looking for a solution to backup my configuration files (bash, vim, etc) using GitHub. After some looking around, I’ve compiled a pretty nice project for myself.


First, this script checks dependencies. My dependencies are git, ruby, vim, tree, rake, gem, bundle, and trash. You could check out the code and add any number of dependencies here. Rubygems and bundler are required because the script later installs all gems listed in Gemfile.

Next, the script copies ~/.bashrc to ~/.bashrc.local. This allows you to keep your current bash configuration as a ‘local-only’ config that doesn’t get copied or committed to github.

The script, as I copied most of bootstrap.sh and the rakefile from @gf3, expects the repository to be cloned to ~/.dotfiles. From there, it calls rake.

Rake looks at every file in ~/.dotfiles and copies the corresponding file relatively from ~/ to, essentially, ~/dotfiles-backup/`date`. I recommend first running the backup to make sure your files are properly backed up.

rake backup

The script then calls ‘bundle install’ to install all gems. It then copies all files from ~/.dotfiles to replace those relative files that were previously backed up from ~/.

The post-install displays a message to remind you to edit .gitconfig and .hgrc.

Because I’ve done some copying and compiling, these are relative close to the three projects in the README for right now.

Here is an excerpt from the README:


$ tree ~/.bash
├── aliases
├── completions
├── completion_scripts
│   └── git_completion
├── config
├── functions
├── paths
└── prompt

The above files are loaded by .bashrc. The files are pretty self-explanatory, other than prompt which colorizes the bash prompt with tweaks for git.

Cool Aliases

  • cd : pushd
  • bd : popd
  • cd.. | .. : back one directory
  • cd… | … : back two directories
  • ^ up to five directories
  • rm : trash
  • undopush
  • ip


  • sets editor to vim
  • sets English/UTF-8
  • sets manpager
  • sets commands to ignore in history
  • sets noclobber (e.g. prevents cat > IMPORTANT_FILE mistakes )
  • sets nocaseglob (e.g. ls ~/.B* will list contents of ~/.bash)


The two functions, md and c may not seem like much, but they simplify some commands. For example:

$ md projects; git clone git@github.com:jimschubert/dotfiles.git && cd dotfiles

In the above line, md will create the projects directory and cd into it.

c stands for ‘code’ and works like this:

jim at computer in ~
$ pwd
jim at computer in ~
$ c dotfiles
~/projects/dotfiles ~
jim at computer in ~/projects/dotfiles on master

You can change it to whatever shortcut and issue reload, which is also an alias from this setup.


Notice the color scheme and github branch notifications created by ~/.bash/prompt.

Flattr this!

Posting complex models to ASP.NET MVC

Nick Riggs wrote a nice little jQuery plugin called postify that I have found extremely handy on many occasions. The code builds posted data into a format which is more understandable to the default ModelBinder in ASP.NET MVC.

Check out his post for details.

Here is Nick Riggs code for $.postify:

// postify.js
// Converts an object to an ASP.NET MVC  model-binding-friendly format
// Author: Nick Riggs
// http://www.nickriggs.com

$.postify = function(value) {
    var result = {};

    var buildResult = function(object, prefix) {
        for (var key in object) {

            var postKey = isFinite(key)
                ? (prefix != "" ? prefix : "") + "[" + key + "]"
                : (prefix != "" ? prefix + "." : "") + key;

            switch (typeof (object[key])) {
                case "number": case "string": case "boolean":
                    result[postKey] = object[key];

                case "object":
                    if (object[key].toUTCString)
                        result[postKey] = object[key].toUTCString().replace("UTC", "GMT");
                    else {
                        buildResult(object[key], postKey != "" ? postKey : key);

    buildResult(value, "");

    return result;

Flattr this!

Running additional Google Chrome profiles in Linux

Google Chrome supports running multiple profiles.

In newer versions of Google Chrome, you’ll be able to enable profiles by navigating to chrome://flags and enabling Multiple Profiles. Restart the browser, and you’ll have a switcher and multiple profiles which can be activated in different windows. This allows you to sync to different gmail accounts. For instance, if you have a personal account and a work or school account, each with different bookmarks… you can run two or three different profiles and have access to all of your data.

If you’re using an older version of Chrome or Chromium and you don’t have the Multiple Profiles option, you can use the switch


when opening the browser and the profile for your session will be pulled from the given folder instead of the Default folder. The folder specified should be created automatically. To be safe, I like to create the folder before providing it as an argument.

As explained here, the default directory is located at:

Google Chrome: ~/.config/google-chrome/Default
Chromium: ~/.config/chromium/Default

Open a terminal and create a new directory for your second profile. For instance:

mkdir ~/.config/google-chrome/work

Then, open Google Chrome with the switch:

google-chrome --user-data-dir='~/.config/google-chrome/work'  &

If this is a profile you’ll be using often, you can also create a menu entry under Applications -> Internet (‘Chrome|Work’, maybe?).

Flattr this!

System.Data.OracleClient and Windows 7… love at first sight!


I spent nearly two days trying to resolve this issue. My new desktop at work is running Windows 7 (64-bit) and some of our applications are still using System.Data.OracleClient as an adapter instead of Oracle’s own ODP.NET. Microsoft’s driver interops with Oracle’s own client installed on the developer machine (oci.dll). We need to continue running our web applications under 32-bit IIS, which is where the problem lies.

FYI… According to Microsoft:

The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider.

Back to the comment about IIS. Apparently, IIS 7 in Windows 7 is 64-bit only. Yes, you can set an application pool to 32-bit. That would be perfectly fine, except that Oracle’s client native methods don’t like running through WoW64. So, you have to install both the 64-bit client and the 32-bit client. After all, 32-bit adapter code can’t call a 64-bit client. If you fire up procmon, though, you’ll see that calling the 32-bit Oracle client still queries 64-bit settings (and fails if they don’t exist). WoW64!, indeed.

Continue reading to see my resolution…
Note: this forces Oracle to use 32-bit only in a 64-bit environment.
Continue reading System.Data.OracleClient and Windows 7… love at first sight!

Flattr this!