Site Moved

This site has been moved to a new location - Bin-Blog. All new post will appear at the new location.

Bin-Blog

Saving Code Snippets - Part 2

Fileing

In the last post, we saw various methods of storing text snippets. Each of the discussed methods had its advantages and disadvantages. I could not use any of those methods. But eventually I found one method that was perfect. It was WordPress.

My requirements for a text snippets storing system are simple...

  • Must be able to store text snippets (Duh!)
  • Searchable
  • Tagging support
  • Easy to use interface
  • Backupable

After looking at the list for a few moments, I had an epiphany. I don't need a custom solution for this problem - all I have to do is make a few adjustments to a system I am already using. I already have experience using WordPress - so there is no learning curve.

So, I created a new domain and installed WordPress using Dreamhost's One Click install system. I made a few adjustments to the default configuration, installed a few plugins, customized the theme - and I have a shiny new site...

txt - Text Snippets collection of BinnyVA

Go on, click on that link and play around on my Text Snippets collection for a while - I'll wait.

Storing Text Snippets using WordPress

Advantages

New Site
You have a new site which will be updated frequently - without having to put much effort into it. Another plus point is that your collection is useful for others also.
Stable/Supported Platform
WordPress is an industry standard Platform - used by thousands of people world wide. If you run into a problem, you will be able to get help.
Open Source
You can modify the software - and make it 'just right' for your need.
Offline Access Possible
Just install the WordPress on your system and sync the database once in a while.
Multiple Clients can be used
You are not forced to use the WordPress's web interface to add/edit snippets - there are a lot of clients that support WordPress. I prefer ScribeFire(was known as Performancing earlier).

Disadvantages

  • Added overhead of managing a new site
  • Need Hosting
  • Need net access
  • Need a web/database server for Offline site
  • The purpose of the tool is different

Tagging Problem

There was one problem associated with using WordPress for this purpose - tagging. Sure, you could use categories to tag each snippet - but that is nowhere as intuitive as, say, tagging on del.icio.us. To add a new category, you have to use a separate text field - instead of just typing it after a ','. That is when I found out about a great WordPress plugin - Ultimate Tag Warriors.

Ultimate Tag Warrior

Using Ultimate Tag Warrior you can tag your post with multiple tags. These are completely independent of the 'Categories' feature of wordpress. Two important features for this plugin makes it perfect for our purpose.

Friendly Link support

del.icio.us style links makes it easier for us to find the snippets later on. For example, the URL for all the text snippets with the tag 'perl' is http://txt.binnyva.com/tag/perl.

Can embed tags inside the content

You can specify the tags within the content of the post - you are not forced to use the web panel's tags field to do it. This makes it possible to tag the text snippets even if you are posting from a client.

All you have to do is is enclose the tags within '[tags]...[/tags]'. For example, say you wish to tag a snippet, with database, mysql, sql. So you put this at the end of the snippet...

[tags]database, mysql, sql[/tags]

txt

My Text Snippets collection site have been running for two months. As of yet, I don't have a single complaint about it. In my opinion, this is the best method to store text snippets. If you know a better way of doing this, please let me know.

Most of the saved snippets on txt are Linux Commands. There are some code snippets as well. This is a site where I store script snippets, Linux commands and other such tidbits of information. The posts will be minimal and often crude.

Before leaving you, I want to highlight some cool snippets in that site...

And for Linux users...

1 Comment:

Anonymous said...
This comment has been removed by a blog administrator.