The Joy of Sublime

A couple of years back, after using Eclipse as the IDE of my choice, I switched to Coda. It was really nice to be able to work in a native Mac app. It was quick, responsive and beautiful. However, every so often I used to feel little disgruntled with how it is a little difficult to extend, especially, when it comes to snippets and setting up other workflows. I still love Coda, but I’ve been flirting with TextMate, BBEdit, even MacVim on the side. TextMate came close, but it has its own quirks.

A couple of days back I came across Sublime Text 2. Its tag line says: “The text editor you will fall in love with”. And it is true! I’m in love with it.

There are quite a few things that like about it:

  • Extremely Responsive: Extremely quick once it starts up. Startup time is ok, but once it is up and running, it is blazing fast.
  • Great sidebar: The sidebar where files and folders are displayed is very nicely done. It is simple — you can simply drag a folder from your filesystem there and it becomes available for navigation and file editing. Plus you can open bespoke files, which show up in a file list. Coda doesn’t have something like this, but TextMate does. But Sublime does it better. The only thing the sidebar lacks at the moment, is the ability to rename/add/delete files. But that is not something I do too often. Anyway, it is the most requested feature. So I’m sure it’ll be added soon.
  • View file content without opening: Once you click a file in the sidebar, the contents of the file are display, without actually opening the file. That is pretty useful!
  • Compatibility with TextMate: The language files and snippets from TextMate can be used pretty easily. And that means that a whole bunch of existing syntax/snippets can be used straightaway. Complete TextMate bundles are not supported however. You need to extract the snippets and language files.
  • No need to reload: Customizing the snippets and language files and color schemes is a simple matter of opening them in Sublime (they are in XML format), and editing them. As you save them, they are reloaded. No need to “Reload Bundle”!
  • Key Bindings and Preferences: The key bindings are completely, and easily, customizable. And so are the Options. They are stored in JSON format in a couple of files. Simply open, and change away. Again, no need to reload, they become available straightaway as you save.
  • Useful find and select: The ability to find is very, very nice. You can easily find a word, symbol, file. Search and replace is very nice as well. There is an extremely useful “Goto Anything” option. A gem!
  • Map of the file: You can see a little map of the file you are working on. If it is a long file, you can see exactly where you are in the file. Very handy. If you search for terms, you can even see them highlighted in the map. Very cool.
  • Decent Forum: The forum for Sublime Text has a lot of discussion, and is pretty active. I posted a few questions, and with the exception of one, all were answered satisfactorily very quickly.
  • Full Screen: A very useful Full Screen mode. Switch to it, and no distractions!
  • Cross Platform: Works on Windows, Mac and Linux. I’ve only tried the Mac version. But I believe the Windows version works well as well.
  • Portable: Apparently one can run it off a USB key. Which is great. But I haven’t tried that as yet.

The latest stable version is 1.4. But I’m using Sublime Text 2 — which is in alpha, but very stable. Except for one minor issue, I am pretty happy with the overall experience.

The documentation for Sublime Text 2 is still under development. The basic usage is pretty straightforward. But if want to extend it, forums are the best way to get going. But it’d be good to see more complete documentation soon.

I think it is an editor that is worth a try. I’ve already switch the associations on my system to open text files in Sublime!

Would like to hear what you think about it.

PS: I am using Sublime for a ColdFusion project. So I customized the TextMate snippets and language file to work with Sublime — a ColdFusion plugin for Sublime Text 2 so to speak..

Is My Home Ready for IPV6?

IPv6I was listening to the Guardian Tech Weekly podcast the other day. In it they discussed the implications of IPV4 addresses running out and the impending arrival of IPV6 address.

So I started looking at the various modems/routers I have around the house to figure out if they support IPV6.

And as expected the main Dynalink ADSL modem which connects to the ISP and provides broadband to the house does not support IPV6. The other wireless routers (and I have three of them around the house — an Airport Extreme and two Airport Express) both have the options to configure IPV6.

Now, I still don’t fully understand what exactly are the implications on my home infrastructure when the time comes to switch to IPV6, but might have start looking for a new modem over the next year!

Create Custom Dictionaries For Mac OSX

Over the last couple of months I’ve been chipping away at creating an add-on dictionary for the Dictionary application on Mac. I wanted to create a dictionary for CFWheels.

Information on how to create such dictionaries was not all that easy to find. So I thought I’d share what I found in case it helps some else.

Apple’s Dictionary Services Programming Tutorial

First up, have a look at this tutorial on Dictionary Services Programming over at developer.apple.com. It provides all the information one needs to get started. You can also download a PDF of this tutorial.

Template Files for Dictionary

One thing that the tutorial assumes is that you have the template files for dictionary development are. First challenge was to figure out where they were. I found that they are installed with XCode at: /Developer/Examples/Dictionary Development Kit. If you don’t have XCode installed, then you can download the this zip file that contains the Dictionary Development Kit.

The Make Command

Before you customize anything in these files, simply run ‘make’ command in directory where you unzip these files. It should create a dictionary called “My Dictionary”. If you move this dictionary to /Library/Dictionaries or ~/Library/Dictionaries, it will start showing up i the Dictionary app.

There are a couple of other things that the make command can do:

  • make clean : cleans older builds
  • make install : installs the created dictionary to ~/Library/Dictionaries folder
  • make : creates the dictionary

Change the XML and Info.plist

Now add the stuff you want in the XML that will be used to create the dictionary. You will have to generate the XML with the appropriate structure and content. Also modify the plist file as required. Run “make” to create your dictionary.

A Big Gotcha – Cached Dictionaries

On thing that really had me flummoxed was that despite making a new dictionary, the Dictionary app was not reliably showing all the changes I expected.

This took a while to figure. There is a bunch of caching that comes into play if you are creating new builds of the dictionary. Cached versions show up and throw you off the track.

So I had to write this shell script to clean Dictionary app cache. Make sure that you

  • make the script executable before running it, and
  • quit the Dictionary app before you run

I found that I had run this each time I made a change to the XML file.

A downside to doing this is that it resets all Dictionary preferences. So when you start the Dictionary app after running this script, you have go to Preferences and turn on the dictionary you are working on. A bit painful, but not such a biggie.

My Development Workflow

So as I was making changes to the XML file with data, I was running the following commands:

  • ./clean.sh (cleans out all dictionary caches)
  • make clean (cleans out older builds of the dictionary)
  • make (makes the dictionary)
  • make install (installs the dictionary)

Example Dictionary: CFWheels

If you want to see an example of the dictionary that I created, check out: https://github.com/indynagpal/CFWheels-Mac-Dictionary

Look at the XML and Info.plist files.

That’s it… go and have fun creating dictionaries now!

CFWheels Dictionary for Mac OS X

Working with any framework involves learning many things like file structure, information flow, etc. One of the most critical aspects of being proficient in a framework is how well one has learned the API. And this holds true of CFWheels as well.

CFWheels provides a simple API that one has to refer to time and again as one learns and develops with it. The CFWheels website has a great section on documentation which lists various API calls. And this helps the process of learning/working with the framework. But…

There were a couple of occasions when I was offline and a few when my connectivity not too good. Under those circumstances it was proving a little slow to figure out various API calls.

So I was browsing around a few months back and came across the ColdFusion 9 dictionary for Mac. That got me thinking that I should probably do something like that for CFWheels. The nice thing about a dictionary is that it is a desktop application, so it is very quick, has a very nice search, and most importantly, integrates very well with native Mac apps.

So here it is!

Download: CFWheels Dictionary for Mac

Installation is simple.

  • Unzip the zip file
  • Copy CFWheels.dictionary to either /Library/Dictionaries OR ~/Library/Dictionaries.

Fire up the Dictionary app, and you should see the CFWheels dictionary in the list of dictionaries available.

A few tips:

  • Once the CFWheels dictionary is installed, you can search for the word “api” and it lists a page where all CFWheels API calls are available. You can select what you want.
  • If you use a native Mac app like Panic’s Coda or TextMate the Mac dictionary service integrates beautifully with them. What that means is that you can select a word and right-click it and then “Look Up in Dictionary”. It opens dictionary and information about the text you selected.
  • Setup a keyboard shortcut (through System Preferences > Keyboards > Keyboard Shortcuts) for “Look Up in Dictionary” so that you can fire it up through keyboard.
  • If you want you can enable/disable various dictionaries through the Preferences menu of the Dictionary app. I find that to be quite handy.

Have fun! And do drop me a line if you like it! Or if you find any bugs/issues.

Update: Source Available on GitHub

The source for the dictionary is now on GitHub: https://github.com/indynagpal/CFWheels-Mac-Dictionary

Hello WordPress!

So I’ve finally given in, I’ve switched my blog to run on WordPress.Wordpress

This is the fourth time in six-odd years of blogging that I’ve had to change the blogging software.

For the last couple of years, my blog was been running on MangoBlog. It is really nice and I quite liked the fact that it was running on ColdFusion. More important, it was nicely customizable.

Prior to MangoBlog I had been using BlogCFC, and had found a bit restricting in terms of theme support etc. MangoBlog made it easy to re-theme the blog, plus has a nice plugin architecture.

I had toyed with moving to WordPress an year or so back. But wasn’t too convinced. But when I re-evaluated it in detail last month, I was struck by its maturity and the dizzying number of really useful plugins and themes.

This weekend I gave it a whirl and setup a dev instance on an Amazon Micro instance. It didn’t take too long for me to decide that the time had come to switch.

The process of migration from MangoBlog to WordPress was quite simple.

I had to write a couple of simple scripts that gathered data from MangoBlog tables and inserted it into WordPress tables. I also set up a couple redirects so that old links continue to work. And I updated the Feedburner feed details so that the feed from the old blog points to the feed from the new blog.

And here it is! Shiny and new with a decent theme!

While moving the blog across, I decided to do away with the many categories I had in the previous blog. I’m going to now categorize posts based on what broad areas like “Software Development”, “Photography”, etc. This reflects the change in the nature of my blogging. Till now I’ve been quite focused on tech blogging. But I’m going to broaden the scope a bit. And I’ll be using tags to categorize posts as more detailed mechanism of categorization.

The other major change I made was to change the permalink structure of blog entries. It is now extremely simple and minimalistic — server name followed by the slug (e.g., http://blog.nagpals.com/hello-wordpress).

The more I’ve played with Ruby on Rails, Grails, and CFWheels, the more I’ve become a fan of simplicity in URIs. For me they are windows into an application — they give a sneak peak on how well an application is structure. I even go a step further and say that if you look carefully, they give you a view of the mind of the application developer! But more on that in another blog post.

For now, the migration from MangoBlog to WordPress is over. It was very smooth and painless. And I’m quite happy to be getting back to blogging again!

The RSS Feeds for the blog are:

If you don’t want to be bothered with other ramblings, just subscribe to the Software Development category RSS.

Do drop me a line if you have any questions/issues with the new blog.