Thursday, September 19, 2013

ng-grid review

I really, really wanted to like the ng-grid   When you are using angular, it definitely gives you a lot of functionality that you would have to build in your own ng-repeat directive.  Actually, it is pretty easy to set up too.

Unfortunately, I think jqgrid has it beat.  jqgrid has some pretty awesome sorting and filtering functionality.  ng-grid is lacking the column 'auto' width.  It does not sound like a big deal, but if you don't know what your data widths will be, it is a pain.  I don't want to specify each width of each column.

EDIT:  I changed my mind!

I came up with a pretty cool solution which computes your column widths for ng-grid!  Includes jasmine unit test FTW!





Thursday, September 5, 2013

Perl cfg file processing

This is some pretty awesome code I wrote a while ago.  I had to share.  I removed the code that reads the config file into an array, @cfgList, which is trivial.


    #-- Load cfg file into a hash --#
    # How the regex's work:
    # Ignore/blank out any comment lines.
    # Remove any beginning space.
    # Remove any trailing space.
    # Capture the first word as the hash key, look for space = space, then
    # capture the words in between the single quotes as the hash value.
    my %cfgHash = map {
      s/#.*//;
      s/^\s+//;
      s/\s+$//;
      m/(.*?)\s*=\s*'(.*)'/;
    } @cfgList;

This will load a config file into a hash.  Here's a sample cfg file:

# -----------------------------------------------------------

# Read input from here:
inputDir = '/some/dir'

# Processing dir
localDir = '/other/dir'