Customizing Desk

The Desk App for Mac OS X – in all its simplistic glory – really is a fantastic editor for working in a non-interrupted flow with your texts.

However, for those of us with particular aesthetic contemplations, we may wish to change the default font used. Currently, it doesn’t seem that Desk supports this in a graphical user interface, which is why I bring to you this simple 9 step guide for setting the font you like!


Disclaimer: proceed at your own risk and remember to take proper backups!


Our goal is to edit the cascading style-sheet (CSS) that Desk uses for its built-in editor and configure it to use a another font installed on our Mac. To accomplish this, we’ll locate the CSS file within the Desk application package and edit it with the built-in GUI text-editor “TextEdit”.

The steps to accomplish this are as follows:

  1. Open a Finder window
  2. Navigate to the folder “Applications”
  3. Right-click on the “Desk” app icon and click “Show Package Contents”
  4. Navigate to the folder “Contents” > “Resources” > “MCE” > “css” (shown below)Screen Shot 2015-01-20 at 13.20.55
  5. Right-click on the file “iframe.css” and choose “Open With” > “TextEdit”
  6. Search for the line starting with “body {” (currently around line 20)
  7. Edit the “font-family” statement found a couple of lines below that to reflect your choice of font by placing the font name first in the list (see below for an example)
  8. Save the file (possibly needing you to authenticate as this is a restricted file)
  9. Start Desk – your changes should be visible

I have found that the font Quadon works great for me, and therefore my customized “font-family” statement in “iframe.css” has Quadon as the first font mentioned, with fallback to the usual sans serif suspects:

body{
 display: inline-block;
 overflow: hidden !important;
 border: 0 !important;
 margin: 0 !important;
 font-family: Quadon, Helvetica, Arial, sans-serif;

Happy hacking! 

Aside

Accessing a locked HSQLDB database file in read-only mode

Working a lot with the Atlassian tools (JIRA, Confluence, Crowd, Stash etc.), I often have to connect to the databases running behind them in order to perform various SQL queries on the data.

In a couple of use cases, it’s very convenient just to use the standard embedded HSQL database (HSQLDB) instead of a standalone relational database management system. However, with HSQLDB running in embedded mode, a lock file is set on the database file to inhibit other JDBC connections from writing to the database, which is, of course, very sensible (wouldn’t want any inconsistent data, now would we).

Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@d446e57c[file =/SOME_FOLDER/database.lck, exists=true, locked=false, valid=false, ]

To remove the lock on the database file, we would have to stop the application altogether. However, in many cases I want to query the database in read-only mode while the application is running, and fortunately the HSQLDB JDBC driver provides a property that can be set to provide lock-ignoring read-only access to the database file.

My database query tool of choice is the excellent Java-based tool called DbVisualizer, and setting the property can be done very simply in the Driver Properties tab of the connection settings view, adding a parameter “readonly” with value “true”.

HSQLDB readonly property in DbVisualizerWith that set, all that is left is rock and roll – SQL style! 


Further reading

Atlassian: Connecting to HSQLDB using DBVisualizer or HSQL database manager

Exploratory Ruby-magic with the iRuby Notebook

Learning the programming language Ruby can be a wonderful experience. The language is elegant and well-designed, promoting the use of eloquent and very human-readable programming constructs. Also, it speaks to my aesthetic sense in its syntactic simplicity and no-nonsense approach.

Personally, I learned Ruby through why the lucky stiff’s “The Poignant Guide to Ruby”, the Rails handbook, the Ruby Pickaxe book, and a lot of chatting on IRC. At the time there weren’t that many available screencasts (and no MOOCs), which, fortunately, has changed since then.

I like the idea of learning new programming languages ever so often, as it expands and enriches my way of thinking and creativity related to problem solving in the software domain.

Learning can be done in a lot of ways, and I have found that note-taking is an important activity for efficient learning during my personal learning endeavors. However, I’ve always felt like there was some gap between the notes I was taking about programming and the code and examples that I wanted to go with them to completely support my comprehension (especially after some time). You know, runnable code and notes intermixed.

Sure, you can make a Ruby-script and insert a lot of comments, but I’m more of the aesthetic type, so I wanted to be able to throw different fonts, graphics etc. in there. What to do?

Lo and behold! On the O’Reilly Strata + Hadoop World conference in New York, iPython and iPython Notebook was presented, and was is exactly what I have been longing for: Notebooks mixing HTML/Markdown, graphics and, not least, runnable Ruby code.

While installing iPython I ran into some problems, so here’s an end-to-end installation guide using Brew on Apple OS X:

 $ mkdir iruby # Create a new directory
 $ echo 'iruby' > iruby/.ruby-gemset # Define the Gemset to use
 $ echo 'ruby-2.2.0' > iruby/.ruby-version # Define the Ruby-version to use
 $ cd iruby # cd into the directory
 $ brew install zeromq # Install the libzmq dependency
 $ sudo pip install ipython pyzmq jinja2 tornado # Install Python dependencies
 $ gem install iruby pry rmagick rubyvis gruff # Install iruby and other Ruby goodness
 $ iruby notebook # Start iRuby Notebook