gnuplot with AquaTerm on OSX Snow Leopard

The gnuplot graphing utility has always had excellent support for multiple terminal types. While the X11 terminal is a satisfactory GUI view for the graphs, I prefer to use the AquaTerm terminal on OSX as it is more ‘Mac-like’ and feels more natural.

Also, I do prefer to compile gnuplot by myself on OSX rather than downloading the pre-packaged binaries – as this gives me more control over the compilation (including getting around the stupid Apple readline bug – where Apple has essentially shipped a broken readline by using libedit to emulate the non-existent libreadline).

This local compile requires that AquaTerm be installed so that the library dependencies for aquaterm exists in:

terminal.png

and the corresponding headers are available at:

1____terminal.png
In addition, the AquaTerm.app itself resides in /Applications.

However, on OS X Snow Leopard, there is a catch – the version of AquaTerm is 32 bit, whereas the default compilation of gnuport results in a 64-bit version – which is not able to load the 32-bit libaquaterm dynamic libraries.

littlesnapper.png

In such a case, the gnuplot compilation does succeed – however, the default terminal becomes the X11 version – which is back to square-one.

A darwinports port does exist for gnuplot – however, as mentioned in an earlier post, this port seems to depend on half of the port repository (i.e., a ton of stuff you do NOT want gets installed as well).

However, there is a easier way to get around this situation. Here’s how.

  1. First install the default binary for AquaTerm from SourceForge and install normally. This step is to basically setup the right folders and symlinks so that you do not have to muck with these later
  2. Now install AquaTerm again from Darwinports – this port has the correct patches needed – and more importantly – builds a 64 bit version by default. This will also install the application under /Applications/MacPorts/

2____terminal.png

  1. Now comes the fun part. We will replace two folders from the darwinports version to the previously installed AquaTerm.
    • Step 1: Replace /Library/Frameworks/AquaTerm.framework with /opt/local/Library/Frameworks/AquaTerm.framework. This will ensure that the correct 64 bit AquaTerm libraries get referenced by the gnuplot compilation
    • Step 2: Replace /Applications/AquaTerm.app with /Applications/MacPorts/AquaTerm.app. This will ensure that the correct 64-bit AquaTerm binary is in the correct location
    • Step 3 (Optional): You can now uninstall the darwinports version by running sudo port uninstall aquaterm from a terminal window
  2. Download the source code for gnuplot and extract the same.
  3. Run ./configure (using a command line parameter to ignore the broken Apple readline) and then make and make install (install will happen in /usr/local)

3____terminal.png

That’s it! The compilation should now succeed and gnuplot will be linked with the correct 64-bit aquaterm dynamic library. Enjoy!

4____terminal.png
figure0.png


Using Emacs and Markdown for WordPress posting

While setting up this site (which is based on WordPress), I was evaluating 
a few offline blog editors, and came upon MarsEdit and Ecto – both of which seem to be well-accepted commercial blog editors in the Mac 
world. Both allow easy setup of the blog configurations, have a hassle-free 
configuration, and allow a mail-inbox like access to previous posts.
My needs for the offline blogging tool are:

  1. Support WordPress (obviously)
  2. Support formatting in Markdown (the default WordPress formatting         is atrocious). Note that you will need to enable Markdown syntax on your blog by using any         of the plugins available for WordPress.
  3. Provide easy access to prior posts
  4. Have a decent text editor built-in
  5. Provide at least a subset of my current editing muscle-memory

However, I happen to be a Emacs fanatic, and perform majority of my day-to-day computing tasks in that tool (another post on this later). So I googled around a bit for the current state of blogging using Emacs, and voila! EmacsWiki pointed to the weblogger mode, which supports WordPress, and also handles Markdown formatting easily with the markdown mode. And to top it off, the code is open-source, which means that I can tinker and change the functionality when needed.

The default version of Weblogger mode seems to have some problems as listed in Emacs Wiki, but the patched versions from jwicker work great!

The next section describes the Emacs configuration needed to setup offline blogging using Weblogger mode.

Emacs Configuration

After downloading the patched versions of xml-rpc.el and weblogger.el to your computer, perform the following steps:

  1. Rename both files, as the downloaded files have the incorrect suffix/extension .doc, which should be removed
  2. Add the renamed .el files in your Emacs load-path directory (e.g., site-lisp)
  3. Load the adding the following lines to your .emacs (i.e., the user-init) file: 
(require ‘weblogger)
  4. Restart Emacs, and initialize the blog-setup by issuing the command:
 M-x weblogger-setup-weblog and follow the prompts. Note that for WordPress, your blog URL needs to be suffixed with /xmlrpc.php
  5. If the setup worked fine till this point, you can fetch all previous posts by using the M-x weblogger-fetch-entries command, and
  6. Then access each entry using the command: M-x weblogger-next-entry or M-x weblogger-previous-entry

You can create a new post by using the weblogger-start-entry command. This brings up a mail-like buffer, where the subject line denotes title of the post, and the body is the actual post content.

At this point, you can enter your post-entry (using Markdown syntax, if you have enabled the WordPress plugin, or else by using raw HTML). Once the content is completed, press C-x C-s to save the file, which will also post the entry to your blog.

    Caveat: The current Emacs mode does not provide any categorization mechanism, which still needs to be done via the admin interface on your blog. Categorization is actually supported. While composing the post, use the Keywords: meta-header to provide names of existing categories, separated by comma.

      Summary

      This setup has been working pretty well for me, and lets me use all the other 
Emacs functionalities as well. In summary, the pros and cons are:

      Pros

      • Enables me to blog from within Emacs, and use all the Emacs-goodness the platform brings
      • Emacs is a multi-platform editor, and I can blog from any system I have access to (i.e., not tied to my Mac)
      • I can tweak the behavior of the system by directly accessing the code, if needed
      • This is a free and open-source solution

      Cons

      Note that Ecto and MarsEdit are both capable systems, and are more Mac-like. I do have the trial versions downloaded, and will be trying both out over the next couple of weeks as well.


      Follow

      Get every new post delivered to your Inbox.

      Join 67 other followers