14th Oct2011

Dennis Ritchie has Passed Away at 70

by Skibs

Dennis M. Ritchie (a.k.a. dmr) was found dead this Wednesday at his home in Berkeley Heights, New Jersey. Ritchie was modest by nature, but current-day technology is a testament to his contributions in computer science.

His legacy includes creating the C programming language, which proceeded BCPL, and inspired the design of pretty much every new language to pop-up after the 1970’s (C++, Objective C, Perl, Java, PHP, C#, Go, etc.). He was also a co-developer of UNIX, where he wrote the I/O portions as well as some of utilities.

Rest in Peace, dmr (September 9, 1941 – October 8, 2011).

[Sources: Dr.Dobb’s, New York Times]

16th Aug2011

Fast Banded Rows for Google Spreadsheets

by Skibs

I couldn’t find any other scripts for formatting a Google spreadsheet with banded rows, so here’s some quick code I wrote that gets the job done. Hopefully, this is useful to someone else out there.

Banded rows script:

//Method gives odd rows one background colour and even rows another background color
function addBandedRowColor() {
   //Hex Code for white color, used of even rows
   var colorRowEven = '#CCCCCC';
   //Hex code for light grey color, used for odd rows
   var colorRowOdd = '#FFFFFF';
   //Get the current work area from the current spreadsheet
   var range = SpreadsheetApp.getActiveSheet().getDataRange();

   //Iterate accross each row of the work area
   for (var i = range.getRow(); i < range.getLastRow(); i++) {
      if (i % 2 == 0){ //if even row
         //Set row background to a one color
         range.offset(i, range.getColumn()-1, 1, range.getNumColumns()).setBackgroundColor(colorRowEven);
      } else { //if odd row
         //set row background to another color
         range.offset(i, range.getColumn()-1, 1, range.getNumColumns()).setBackgroundColor(colorRowOdd);
      }
   }
}

And for the sake of balance, here’s a script that gets rid of the banded rows:

//Method gives each row in the spreadsheet a flat background color
function removeBandedRowColor() {
   //Hex code for white color
   var colorRow = '#FFFFFF';
   //Get the current work area from the current spreadsheet
   var range = SpreadsheetApp.getActiveSheet().getDataRange();

   //Give the area a single background color
   range.setBackgroundColor(colorRow);
}