<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
 
 <title>Doc Gecko</title>
 
 <link href="http://docgecko.github.com/" />
 <updated>2011-12-22T05:40:40-08:00</updated>
 <id>http://docgecko.github.com/</id>
 <author>
   <name>Doc Gecko</name>
   <email>daren.sdw@gmail.com</email>
 </author>

 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/docgecko" /><feedburner:info uri="docgecko" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>docgecko</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry>
   <title>Creating Facebook Account and Page access tokens for the fb_graph gem</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/HGoKXPoGVBU/creating-facebook-account-and-page-access-tokens-for-the-fb_graph-gem.html" />
   <updated>2011-12-22T00:00:00-08:00</updated>
   <id>http://docgecko.github.com/rails/fb_graph/gem/facebook/2011/12/22/creating-facebook-account-and-page-access-tokens-for-the-fb_graph-gem</id>
   <content type="html">&lt;h1&gt;Creating Facebook Account and Page access tokens for the fb_graph gem&lt;/h1&gt;
&lt;p class="meta"&gt;22 Dec 2011 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#rails"&gt;rails&lt;/a&gt; &lt;a href="/tags.html#fb_graph"&gt;fb_graph&lt;/a&gt; &lt;a href="/tags.html#gem"&gt;gem&lt;/a&gt; &lt;a href="/tags.html#facebook"&gt;facebook&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have a jobs board app built in Ruby on Rails (http://infrajobshq.com).  As jobs are posted to the site by job advertisers, the app posts shortened information about each jobs to both Twitter and Facebook pages.&lt;/p&gt;
&lt;p&gt;Recently, the app started failing when jobs were posted and I wasn&amp;#8217;t sure why.  After investigation, I found that it was because I had changed by Facebook password.  I didn&amp;#8217;t realise that the password is also associated with the ACCESS_TOKEN of Facebook Graph &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;So, again I needed to go through the process to generate the ACCESS_TOKEN for my app.  As such, I thought I would post the process as it requires a little bit of work and is not necessarily an easy process to remember: I had to go through a number of pages on the Facebook Developers section in the Facebook Graph &lt;span class="caps"&gt;API&lt;/span&gt; (https://developers.facebook.com/docs/reference/api/).&lt;/p&gt;
&lt;p&gt;The process is a &lt;b&gt;2 step process&lt;/b&gt;. Firstly you have to obtain an ACCESS_TOKEN that gains you access to your Facebook account.  Once you have that level of access, you then need to find the access token of your Facebook Page you would like to gain access to.  So here goes:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;1. Step 1: Obtain Facebook Account Access Token&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In order to gain your Facebook account &lt;span class="caps"&gt;ACCESS&lt;/span&gt; &lt;span class="caps"&gt;TOKEN&lt;/span&gt;, you can use the following url (in your chosen browser):&lt;/p&gt;
&lt;pre&gt;https://www.facebook.com/dialog/oauth?
     client_id=YOUR_APP_ID&amp;amp;redirect_uri=YOUR_URL&amp;amp;scope=manage_pages&amp;amp;
     response_type=token&lt;/pre&gt;
&lt;p&gt;YOUR_APP_ID and YOUR_URL can be found on your personal Facebook Developers page, where you apps exist, i.e.:&lt;/p&gt;
&lt;pre&gt;https://developers.facebook.com/apps&lt;/pre&gt;
&lt;p&gt;As you can see from this page, under the Summary section, you can find your:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;App ID/&lt;span class="caps"&gt;API&lt;/span&gt; Key&lt;/li&gt;
	&lt;li&gt;Site &lt;span class="caps"&gt;URL&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, substituting YOUR_APP_ID with your &amp;#8220;App ID/&lt;span class="caps"&gt;API&lt;/span&gt; Key&amp;#8221; and YOUR_URL with your &amp;#8220;Site &lt;span class="caps"&gt;URL&lt;/span&gt;&amp;#8221;, you will have a url that looks something like this:&lt;/p&gt;
&lt;pre&gt;https://www.facebook.com/dialog/oauth?
     client_id=542148432111423&amp;amp;redirect_uri=http://infrajobshq.com/&amp;amp;scope=manage_pages&amp;amp;
     response_type=token&lt;/pre&gt;
&lt;p&gt;As you enter this url, you will be redirected to your site&amp;#8217;s url, in my case to http://infrajobshq.com.  And now, as you will see from the url, it contains additional information after sites main address, e.g. it looks something like this:&lt;/p&gt;
&lt;pre&gt;http://infrajobshq.com/#access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZA
		 xQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&amp;amp;expires_in=0&lt;/pre&gt;
&lt;p&gt;As you can see, the url contains the &lt;span class="caps"&gt;ACCESS&lt;/span&gt; &lt;span class="caps"&gt;TOKEN&lt;/span&gt; for your Facebook Account.  You will need this for the next step.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2. Step 2: Obtain Facebook Page Access Token&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Now, to find the &lt;span class="caps"&gt;ACCESS&lt;/span&gt; &lt;span class="caps"&gt;TOKEN&lt;/span&gt; for your Facebook Page, use the following url:&lt;/p&gt;
&lt;pre&gt;https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN&lt;/pre&gt;
&lt;p&gt;Simply replace the ACCESS_TOKEN with your Facebook Account ACCESS_TOKEN (and no need to include the bit on the end of the url that is &amp;#8216;&amp;amp;expires_in=0&amp;#8217;).  In my case, the url looks like this:&lt;/p&gt;
&lt;pre&gt;https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4O
		 sI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&lt;/pre&gt;
&lt;p&gt;Once you have entered this, you will be given a page that contains your Facebook Page ACCESS_TOKEN, e.g.:&lt;/p&gt;
&lt;pre&gt;{
   "data": [
      {
         "name": "InfraJobs",
         "access_token": "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8w
  LnX3wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD",
         "category": "Consulting/business services",
         "id": "130231394756745"
      },
      {
         "name": "InfraJobs",
         "access_token": "AAADGIb8OYp4BAMJBpufj6LhsDq2W8JhCpQW6P1zjZCK32uwuK0njrRItJybbfFPXKEOsZCCf
  4Sfjxkmk4dcJz43OQN8ttOKoPZClOnJZCwZDZD",
         "category": "Application",
         "id": "327845241634422"
      }
   ],
   "paging": {
      "next": "https://graph.facebook.com/me/accounts?access_token=BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps2
  3xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6kAgtFNm3X4wezyvK7VWEZD&amp;amp;limit=5000&amp;amp;offset=5000&amp;amp;_
  _after_id=327845241634422"
   }
}&lt;/pre&gt;
&lt;p&gt;As you see, there are two sets of data related to my site.  Once relates to my Facebook Page and the other relates to the Facebook App of the same name.  The ACCESS_TOKEN you require is the one related to the Facebook Page: in my case its the the first once in the list.&lt;/p&gt;
&lt;p&gt;Wow, so many ACCESS_TOKENs hey!&lt;/p&gt;
&lt;p&gt;Anyway, I am using these codes in my App to post to my Facebook Page, so my Ruby on Rails code look like this:&lt;/p&gt;
&lt;pre&gt;def facebook(message)
  fb_message = message(message) + ": " + job.short_url
  me = FbGraph::User.me("BBBDGIb5OYp4BAJK0qYw8qw3fY4uPps23xfMpvobHvVCN4OsI50LGIshL8fUZAxQsgnUt45b6k
	AgtFNm3X4wezyvK7VWEZD")
  me.feed!(
    :access_token =&amp;gt; "BBBDGIb8OUp4BDNWFlERsVcEaeS1lylDAqpN3FtDET4L2fdeS6TPoNvYZAZBbzeDXC6TKTB8wLnX3
		wPZA0HU8n6pvZCmRndGwOcQmvU1T4BAZDZD",
    :message =&amp;gt; fb_message
  )
end&lt;/pre&gt;
&lt;p&gt;As you can see, the Facebook Account ACCESS_TOKEN is used in the 3rd line of code, and the Facebook Page ACCESS_TOKEN is used in the 5th line of code.  The first one gains me access to my account and the second that allows access to the the Page&amp;#8217;s feed.&lt;/p&gt;
&lt;p&gt;Damn, finally got there.  I realise now that I was a little confused the first time I did this, simply as there were a few ACCESS_TOKENs knocking about, and that I wasn&amp;#8217;t initially clear from the Facebook Developer Graph &lt;span class="caps"&gt;API&lt;/span&gt; Authentication which urls I should have been using.  But now after going through the process, its quite straight-forward.  Even so, glad its all written down here now :-).&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/HGoKXPoGVBU" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/rails/fb_graph/gem/facebook/2011/12/22/creating-facebook-account-and-page-access-tokens-for-the-fb_graph-gem.html</feedburner:origLink></entry>
 
 <entry>
   <title>time.strftime(string) reminder</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/7KlEMFLp4CI/time.strftime%28string%29-reminder.html" />
   <updated>2011-06-23T00:00:00-07:00</updated>
   <id>http://docgecko.github.com/rails/strftime/reminder/2011/06/23/time.strftime(string)-reminder</id>
   <content type="html">&lt;h1&gt;time.strftime(string) reminder&lt;/h1&gt;
&lt;p class="meta"&gt;23 June 2011 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#rails"&gt;rails&lt;/a&gt; &lt;a href="/tags.html#strftime"&gt;strftime&lt;/a&gt; &lt;a href="/tags.html#reminder"&gt;reminder&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This is a major reminder, as I constantly have to search for this one whenever it comes to formatting dates and times in Ruby / Rails:&lt;/p&gt;
&lt;pre&gt;%a - The abbreviated weekday name (``Sun'')
%A - The  full  weekday  name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The  full  month  name (``January'')
%c - The preferred local date and time representation
%C - Century (20 in 2009)
%d - Day of the month (01..31)
%D - Date (%m/%d/%y)
%e - Day of the month, blank-padded ( 1..31)
%F - Equivalent to %Y-%m-%d (the ISO 8601 date format)
%h - Equivalent to %b
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%k - hour, 24-hour clock, blank-padded ( 0..23)
%l - hour, 12-hour clock, blank-padded ( 0..12)
%L - Millisecond of the second (000..999)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%n - Newline (\n)
%N - Fractional seconds digits, default is 9 digits (nanosecond)
        %3N  millisecond (3 digits)
        %6N  microsecond (6 digits)
        %9N  nanosecond (9 digits)
%p - Meridian indicator (``AM''  or  ``PM'')
%P - Meridian indicator (``am''  or  ``pm'')
%r - time, 12-hour (same as %I:%M:%S %p)
%R - time, 24-hour (%H:%M)
%s - Number of seconds since 1970-01-01 00:00:00 UTC.
%S - Second of the minute (00..60)
%t - Tab character (\t)
%T - time, 24-hour (%H:%M:%S)
%u - Day of the week as a decimal, Monday being 1. (1..7)
%U - Week  number  of the current year,
        starting with the first Sunday as the first
        day of the first week (00..53)
%v - VMS date (%e-%b-%Y)
%V - Week number of year according to ISO 8601 (01..53)
%W - Week  number  of the current year,
        starting with the first Monday as the first
        day of the first week (00..53)
%w - Day of the week (Sunday is 0, 0..6)
%x - Preferred representation for the date alone, no time
%X - Preferred representation for the time alone, no date
%y - Year without a century (00..99)
%Y - Year with century
%z - Time zone as  hour offset from UTC (e.g. +0900)
%Z - Time zone name
%% - Literal ``%'' character&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;t = Time.now                        #=&amp;gt; 2007-11-19 08:37:48 -0600
t.strftime("Printed on %m/%d/%Y")   #=&amp;gt; "Printed on 11/19/2007"
t.strftime("at %I:%M%p")            #=&amp;gt; "at 08:37AM"&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/7KlEMFLp4CI" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/rails/strftime/reminder/2011/06/23/time.strftime%28string%29-reminder.html</feedburner:origLink></entry>
 
 <entry>
   <title>Kill rails server</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/kyARn5X1a50/kill-rails-server.html" />
   <updated>2011-05-27T00:00:00-07:00</updated>
   <id>http://docgecko.github.com/rails/grep/console/2011/05/27/kill-rails-server</id>
   <content type="html">&lt;h1&gt;Kill rails server&lt;/h1&gt;
&lt;p class="meta"&gt;27 May 2011 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#rails"&gt;rails&lt;/a&gt; &lt;a href="/tags.html#grep"&gt;grep&lt;/a&gt; &lt;a href="/tags.html#console"&gt;console&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This is just a brief reminder to myself of how to get rid of an already running rails server (for when it happens).&lt;/p&gt;
&lt;p&gt;All you need to do in the console, within your application subdirectory is type:&lt;/p&gt;
&lt;pre&gt;ps aux | grep rails&lt;/pre&gt;
&lt;p&gt;After which you should see some output like this:&lt;/p&gt;
&lt;pre&gt;Daren    89314   0.2  2.0  2551940  82732 s003  R+    2:38PM   2:38.93 /Users/Daren/.rvm/rubies/ruby-1.9.2-p180/bin/ruby script/rails s
Daren     2881   0.1  0.1  2524112   3296 s005  R+   Wed06PM   2:11.62 /Users/Daren/.rvm/rubies/ruby-1.9.2-p180/bin/ruby script/rails c&lt;/pre&gt;
&lt;p&gt;The second line is my running server that I need to shutdown, which can be done as follows:&lt;/p&gt;
&lt;pre&gt;kill -9 &amp;lt;pid&amp;gt;&lt;/pre&gt;
&lt;p&gt;In my case, the pid is 89314, so I use the following:&lt;/p&gt;
&lt;pre&gt;kill -9 2881&lt;/pre&gt;
&lt;p&gt;You can check if the server is down, by again typing in:&lt;/p&gt;
&lt;pre&gt;ps aux | grep rails&lt;/pre&gt;
&lt;p&gt;In my case, I would see something like this:&lt;/p&gt;
&lt;pre&gt;Daren     2881   0.1  0.1  2524112   3296 s005  R+   Wed06PM   2:11.62 /Users/Daren/.rvm/rubies/ruby-1.9.2-p180/bin/ruby script/rails c&lt;/pre&gt;
&lt;p&gt;i.e the rails server process has been killed!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/kyARn5X1a50" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/rails/grep/console/2011/05/27/kill-rails-server.html</feedburner:origLink></entry>
 
 <entry>
   <title>Upgrading and downgrading your rubygems</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/J7a8Zl5PiSA/upgrading-and-downgrading-your-rubygems.html" />
   <updated>2011-04-10T00:00:00-07:00</updated>
   <id>http://docgecko.github.com/rails/rubygems/sunspot/2011/04/10/upgrading-and-downgrading-your-rubygems</id>
   <content type="html">&lt;h1&gt;Upgrading and downgrading your rubygems&lt;/h1&gt;
&lt;p class="meta"&gt;10 Apr 2011 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#rails"&gt;rails&lt;/a&gt; &lt;a href="/tags.html#rubygems"&gt;rubygems&lt;/a&gt; &lt;a href="/tags.html#sunspot"&gt;sunspot&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I just upgraded to rubygems version 1.8.1, which generates a large number of depreciation errors.  This is not a major problem as all still continues to work fine, expect for a couple of my gems: the sunspot (1.2.1) and sunspot_rails (1.2.1) gem.  Currently, under gem 1.8.1, I was unable to start or reindex solr.&lt;/p&gt;
&lt;p&gt;As such, for now I decided to revert back to version 1.7.2 of rubygems.  In order to downgrade your rubygems version, you have to do the following:&lt;/p&gt;
&lt;pre&gt;gem uninstall rubygems-update -v 1.8.1
gem install rubygems-update -v 1.7.2
update_rubygems _1.7.2_&lt;/pre&gt;
&lt;p&gt;And, going the other way, if you wish to update to the latest version, simply run:&lt;/p&gt;
&lt;pre&gt;gem update --system&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/J7a8Zl5PiSA" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/rails/rubygems/sunspot/2011/04/10/upgrading-and-downgrading-your-rubygems.html</feedburner:origLink></entry>
 
 <entry>
   <title>Excel SUMIF with criteria in multiple columns</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/Ouxvn770_qc/Excel-SUMIF-with-criteria-in-multiple-columns.html" />
   <updated>2010-12-01T00:00:00-08:00</updated>
   <id>http://docgecko.github.com/excel/sumif/multiple criteria/2010/12/01/Excel-SUMIF-with-criteria-in-multiple-columns</id>
   <content type="html">&lt;h1&gt;Excel &lt;span class="caps"&gt;SUMIF&lt;/span&gt; with criteria in multiple columns&lt;/h1&gt;
&lt;p class="meta"&gt;1 Dec 2010 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#excel"&gt;excel&lt;/a&gt; &lt;a href="/tags.html#sumif"&gt;sumif&lt;/a&gt; &lt;a href="/tags.html#multiple criteria"&gt;multiple criteria&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The &lt;span class="caps"&gt;SUMIF&lt;/span&gt; function is designed to &lt;span class="caps"&gt;SUM&lt;/span&gt; one column if another column contains the some expected criteria.  For those who have already noticed, the &lt;span class="caps"&gt;SUMIF&lt;/span&gt; function does not work when your criteria exists in multiple columns.  This is an issue I just had to face.&lt;/p&gt;
&lt;h2&gt;Multiple Column Criteria&lt;/h2&gt;
&lt;p&gt;When criteria exists in more than 1 column, you have to take a completely different approach, e.g. when you have a situations such as given in the table below:&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/excel-sumif.png" alt="Excel SUMIF" width="230px" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;Here I have 3 columns:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Column A&lt;/strong&gt; contains a &lt;strong&gt;Length&lt;/strong&gt; (in meters).&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Column B&lt;/strong&gt; contains a &lt;strong&gt;Code&lt;/strong&gt; (i.e. 2, 4a &amp;amp; 4b)&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Column C&lt;/strong&gt; contains a &lt;strong&gt;Score&lt;/strong&gt; (1 to 4)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I need to check that both data in Columns B and C match the criteria of specific Code and Score, and for those that match both criteria, I need to &lt;span class="caps"&gt;SUM&lt;/span&gt; the lenths in Column A.&lt;/p&gt;
&lt;p&gt;To do this you need to use an &lt;strong&gt;Array Formula&lt;/strong&gt;, also known as a &lt;strong&gt;&lt;span class="caps"&gt;CSE&lt;/span&gt; Formula&lt;/strong&gt; or even a &lt;strong&gt;Super Formula&lt;/strong&gt;.  This is a formula that requires you to press &lt;strong&gt;Ctrl+Shift+Enter&lt;/strong&gt; after typing it, instead of just Enter.&lt;/p&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;p&gt;If you wanted to sum together all Lengths where the Code is 4a and the Score is 2, here is the formula you can to use:&lt;/p&gt;
&lt;pre&gt;=SUM((B2:B11="4a")*(C2:C11="2")*A2:A11)&lt;/pre&gt;
&lt;p&gt;This will find that rows 4 and 11 contain both criteria at the same time, and will thus return the sum of lengths in those columns, i.e. A4 and A11, which is 141.09m + 731.38m = 872.47m.&lt;/p&gt;
&lt;p&gt;The formula looks a little strange and probably not what you&amp;#8217;d expect; however, it works very well, as long as you remember to use &lt;strong&gt;Ctrl+Shift+Enter&lt;/strong&gt; instead of Enter when inputting the formula.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/Ouxvn770_qc" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/excel/sumif/multiple criteria/2010/12/01/Excel-SUMIF-with-criteria-in-multiple-columns.html</feedburner:origLink></entry>
 
 <entry>
   <title>Excel cell validation - counting of non-blank cells</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/rWUd4JL4mp8/excel-cell-validation-counting-of-non-blank-cells.html" />
   <updated>2010-08-01T00:00:00-07:00</updated>
   <id>http://docgecko.github.com/excel/validation/countblank/2010/08/01/excel-cell-validation-counting-of-non-blank-cells</id>
   <content type="html">&lt;h1&gt;Excel cell validation &amp;#8211; counting of non-blank cells&lt;/h1&gt;
&lt;p class="meta"&gt;1 August 2010 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#excel"&gt;excel&lt;/a&gt; &lt;a href="/tags.html#validation"&gt;validation&lt;/a&gt; &lt;a href="/tags.html#countblank"&gt;countblank&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When building Excel-based models, more-and-more it is becoming clear that it is necessary to include such functionality as Validation and, to some degree, to the degree expected from web-based software.&lt;/p&gt;
&lt;p&gt;With a model I am building at the moment, it has been necessary to reduce the chance of a user not including certain data that would consequently cause the model to crash when run.  As such, to reduce the likelihood of not entering all of the required data, I am building in checks that will then provide an error list if certain data is not entered.&lt;/p&gt;
&lt;h2&gt;Error Checking&lt;/h2&gt;
&lt;p&gt;The error checking includes a count of remaining errors in an obvious place on the input excel sheet, i.e. in a place that can be easily checked by the user.&lt;/p&gt;
&lt;p&gt;So my problem was that I need to firstly check each input to see if data has been entered or not.  So firstly I have a single column of cells (e.g. column A3:A()) that must be filled with data by the user.  In the column next to this (e.g. column B3:B8) is the data check.  This column contains an initial data check, i.e. Cell B3 contains the following (which can be copied down the other cells in column B):&lt;/p&gt;
&lt;pre&gt;=IF(AND($A3&amp;lt;&amp;gt;""),"Please enter data", "")&lt;/pre&gt;
&lt;p&gt;So if the user fills in cell A3, B3 remains blank, i.e. it does not report an error.  However, if A3 does not contain data, the error appears in Cell B3 saying &amp;#8220;Please enter data&amp;#8221;&lt;/p&gt;
&lt;h2&gt;Error Count&lt;/h2&gt;
&lt;p&gt;So my actual problem was now to count the number of remaining errors, i.e. how to count the number of cells in column B that report the error.  Sounds easy to do right&amp;#8230;well, thats what I thought.  I thought I have to do is count the number of &lt;span class="caps"&gt;NON&lt;/span&gt; &lt;span class="caps"&gt;BLANK&lt;/span&gt; cells in column B.  Well, for example using any of the following do not work:&lt;/p&gt;
&lt;pre&gt;=COUNTIF(B3:B8,&amp;lt;&amp;gt;"") or =COUNTIF(B3:B8,"&amp;lt;&amp;gt;""") or =COUNTIF(B3:B8,"&amp;lt;&amp;gt;")&lt;/pre&gt;
&lt;p&gt;In the end I used an approach offered by &lt;a href="http://pcsplace.com/tips-n-tricks/how-to-count-blank-and-non-blank-cells-in-ms-excel/"&gt;Prasanth Chandra&lt;/a&gt;.  What you have to do is essentially count all of the cells in the range and remove from that the number of blank cells, as follows:&lt;/p&gt;
&lt;pre&gt;=(ROWS(B3:B8)*COLUMNS(B3:B8))-COUNTBLANK(B3:B8)&lt;/pre&gt;
&lt;p&gt;Looks complex, but works right away!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/rWUd4JL4mp8" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/excel/validation/countblank/2010/08/01/excel-cell-validation-counting-of-non-blank-cells.html</feedburner:origLink></entry>
 
 <entry>
   <title>Welcome to Doc Gecko's Blog</title>
   <link href="http://feedproxy.google.com/~r/docgecko/~3/1ALTpFxoEDE/welcome-to-doc-geckos-blog.html" />
   <updated>2010-07-11T00:00:00-07:00</updated>
   <id>http://docgecko.github.com/asset/risk/performance/modelling/2010/07/11/welcome-to-doc-geckos-blog</id>
   <content type="html">&lt;h1&gt;Welcome to Doc Gecko&amp;#8217;s Blog&lt;/h1&gt;
&lt;p class="meta"&gt;11 Jul 2010 &amp;#8211; Lisboa | &lt;span class="tags"&gt;&lt;a href="/tags.html#asset"&gt;asset&lt;/a&gt; &lt;a href="/tags.html#risk"&gt;risk&lt;/a&gt; &lt;a href="/tags.html#performance"&gt;performance&lt;/a&gt; &lt;a href="/tags.html#modelling"&gt;modelling&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I began modelling the performance of assets as part of my &lt;a href="http://ethos.bl.uk/OrderDetails.do?did=1&amp;amp;uin=uk.bl.ethos.391581"&gt;PhD&lt;/a&gt;, when I developed a methodology for predicting the life of an ultra-reliable electro-actuator for deepwater oil &amp;amp; gas production, for &lt;a href="http://www.rotork.co.uk"&gt;Rotork Actuation Ltd&lt;/a&gt;.  The results identified a number of design-risks that were subsequently modified in advance of actually building the actuator.&lt;/p&gt;
&lt;p&gt;However, since 1999 I have been developing Asset and Performance-based Risk Models for commercial use, with great success and varied / continual use on both &lt;a href="http://en.wikipedia.org/wiki/Private_finance_initiative"&gt;Private Finance Initiative&lt;/a&gt; (&lt;span class="caps"&gt;PFI&lt;/span&gt;) and &lt;a href="http://en.wikipedia.org/wiki/Public-private_partnership"&gt;Public Private Partnership&lt;/a&gt; (&lt;span class="caps"&gt;PPP&lt;/span&gt;) projects, including:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Dutch (Southern) High Speed Rail link&lt;/li&gt;
	&lt;li&gt;Tube Lines Ltd&lt;/li&gt;
	&lt;li&gt;Dutch Gelre line Tender&lt;/li&gt;
	&lt;li&gt;M25 &lt;span class="caps"&gt;DBFO&lt;/span&gt; (Design Build Finance Operate)&lt;/li&gt;
	&lt;li&gt;Crossrail&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There varied uses have included:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Prediction of the Performance of Assets over a 30-year period (&lt;a href="http://www.tubelines.com"&gt;Tube Lines Ltd&lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Expert Maintenance Optimisation of a 7-year infrastructure rail concession (&lt;a href="http://www.spitzke.de/site/en/the-group/international/spitzke-spoorbouw/"&gt;Spitzke Spoorbouw, S.A.&lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Whole Life Costing of design options, over a 60-year period (&lt;a href="http://www.crossrail.com"&gt;Crossrail&lt;/a&gt;)&lt;/li&gt;
	&lt;li&gt;Lane Availability Prediction of the UK &lt;a href="http://www.highways.gov.uk/roads/projects/24041.aspx"&gt;M25&lt;/a&gt; Motorway&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Unlike the electro-actuator model, which was based on a particular failure mechanism (and thus at component level), the later models have been based on modelling entire infrastructure systems, such as Rail and Highways networks.&lt;/p&gt;
&lt;p&gt;Furthermore, instead of focusing on on asset failure alone, they have linked failure, degradation and operations to the cost of interventions and contractual requirements, as found in many &lt;span class="caps"&gt;PPP&lt;/span&gt; and &lt;span class="caps"&gt;PFI&lt;/span&gt; projects, including costs of:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Major Capital Works (Modernisations and Upgrades)&lt;/li&gt;
	&lt;li&gt;New Infrastructure&lt;/li&gt;
	&lt;li&gt;Minor Upgrades&lt;/li&gt;
	&lt;li&gt;Planned and Reactive Maintenance&lt;/li&gt;
	&lt;li&gt;Performance-Penalties &amp;amp; Bonuses&lt;/li&gt;
	&lt;li&gt;Operational Modifications (e.g. change to train routes and time-tabling)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The most recent models have been built using a combination of Microsoft Excel, Visual Basic for Application (&lt;a href="http://en.wikipedia.org/wiki/Visual_Basic_for_Applications"&gt;&lt;span class="caps"&gt;VBA&lt;/span&gt;&lt;/a&gt;), Visual Basic (&lt;a href="http://en.wikipedia.org/wiki/Visual_Basic"&gt;VB6+&lt;/a&gt;) and &lt;a href="http://www.palisade.com/"&gt;Palisade&amp;#8217;s&lt;/a&gt; &lt;a href="http://www.palisade.com/risk/default.asp"&gt;@Risk&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But now I am in the process of transferring the modelling approach to &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As such, this blog will discuss both the Excel and Rails approaches to modelling, as well as a few other bits-n-bobs!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/docgecko/~4/1ALTpFxoEDE" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://docgecko.github.com/asset/risk/performance/modelling/2010/07/11/welcome-to-doc-geckos-blog.html</feedburner:origLink></entry>
 
 
</feed>

