Heroku: Cannot run more than 1 Free size dynos

 Cannot run more than 1 Free size dynos.

This is a common error when you forget or cancel a connection to heroku when using commands like:

heroku run rake db:migrate
bc(language-bash). heroku run  rails c --app you_app_name

Check your sessions

You will need to check if you have any sessions running with:

$ heroku ps --app your_app_name
=== web (Free): bundle exec puma -C config/puma.rb (1)
web.1: up 2017/06/13 10:23:38 +0800 (~ 33m ago)

=== worker (Free): bundle exec sidekiq -c 5 -q mailers -q default (1)
worker.1: up 2017/06/13 10:23:19 +0800 (~ 33m ago)

=== run: one-off processes (1)
run.2943 (Free): up 2017/06/13 10:39:57 +0800 (~ 17m ago): rails c

Stop the session

We will need to stop the session so that we can create a new session which we can use.

heroku ps:stop run.2943 --app your_app_name

Try to run your session

$ heroku run rails c --app your_app_name
Running rails c on your_app_name... up, run.9284 (Free)
Loading staging environment (Rails 4.2.8)
[1] pry(main)>

Done!

 Swift: How to Join an Array of Strings into a single String

It is a common task to join an array of strings into a single string in programming. Here’s how you do it in Swift.

Swift 2

let array = ["Matthew", "John", "Paul", "Peter"]

let stringOfNames = array.joinedWithSeparator(", ")

Swift 3

let array = ["Matthew", "John", "Paul", "Peter"]

let stringOfNames = array.joined(separator: ", ")

Screen shot 2016 11 28 at 10.13.45 am

 Excel: Days Function

Compute for the number of days between two dates

Description

=DAYS(end_date, start_date)

Parameters

  • end_date – end date for computation
  • start_date – start date for computation

Screen shot 2016 10 03 at 8.40.13 am

 Excel: Date Function

Create a valid date from year, month, and day

Description

=DATE(year, month, day)

Parameters

  • year – year to use when creating the date
  • month – month to use when creating the date
  • day – day to use when creating the date

Examples

Create date for August 8, 1982

=DATE(1982, 08, 21)

Create date for October 10, 2016

=DATE(2016, 10, 10)

Create date for April 21, 2000

=DATE(2000, 04, 21)

Create date for May 5, 1983

=DATE(1983, 05, 05)

Screen shot 2016 10 03 at 8.29.36 am