Skip to content
Phil Myers edited this page Apr 3, 2017 · 19 revisions

FAQs - Module 1

General Questions

Installation

Common Issues

General Questions


Q: Where are the FAQs from previous courses?

A: You may be able to find the answer to your question in the FAQs for a previous course if you can't find it here.

Here are links to FAQs from previous courses

Installation


Q: How can I install Imagemagick 6 on macOS?

A: Here is a link to installing imagemagick 6 using MacPorts. Unfortunately Homebrew will only allow you to install version 7. There are workarounds to installing version 6 using Homebrew, but we haven't gotten any of them to work.

ImageMagic will not be necessary until Module 5. Prior to module 5 we will provide more info on a workaround for people who are only able to install version 7.

Q: How to downgrade from Rails 5?

A: For the course, the supported Rails version is Rails 4.2.6. If you used Rails Installer to download Rails 5, you can follow these instructions to downgrade to 4.2.6.

gem uninstall rails
gem uninstall railties

An them install the version you will need:

gem install rails -v 4.2.6

If you have multiple versions of Rails installed, just add the version that you want to uninstall to the end of the command:

gem uninstall rails -v 4.2.6    # uninstall version 4.2.6
gem uninstall railties -v 4.2.6

Q: What is the default Postgres password?

In Linux and MacOS X postgres is configured by default to only allow the user 'postgres' to connect to the Postgres database. This way of authentication is managed by a file called 'pg_hba.conf', which is located in /var/lib/pgsql/9.3/data (NOTE: In this example, the 9.3 is the specific version of postgres).

Run the following command to become user postgres: sudo -u postgres psql

Then, at the postgres command prompt, enter the following

postgres=> alter user postgres password 'apassword'; postgres=> create user your_username createdb createuser password 'somepass'; postgres=> create database your_username owner your_username; postgres=> \q

Please update your_username with the username you would like to use. This will now give you the ability to login to Postgres as yourself and connect with the password you supply.

Common Issues


Q: I get an error but when I look at my code I cannot see anything wrong with it. What should I do?

A: When working in a new language or environment it can be easy to make a mistake with syntax or mistype a function name. After looking at the code shown in the lecture videos, and comparing it to your own, you swear there is nothing wrong with your code. Unfortunately, the Ruby interpreter "thinks" otherwise.

When this happens, and after you have given an earnest effort to try to spot the error, resort to getting the code from the course's git repository. You can use the code from the repository to compare to your own code. Upon comparison, look for typos, syntax errors, or missing lines.

Here's how to get the code from the course's git repository:

Sections of the course have a git tags associated with them containing the code used in the lectures. Running git tag will list the available tags you can use.

  1. From the command prompt, type: git clone [email protected]:jhu-ep-coursera/capstone_demoapp.git courseRepo (You may replace courseRepo with whatever string you like.

  2. A new directory has been created called courseRepo. cd into that directory

  3. Checkout using the tag relevant to the lecture you are on. For instance, if you want to checkout the code for module2 then type the following

git checkout module2.start

  1. If you want to get a specific commit that was performed in module2, rather than getting the starting code, you can use the git log command to find that commit and check it out.

Here is an example section from git log:

commit 2a2eb5c2b2626d85bedf653c114e453f45791043
Author: jim [email protected]
Date: Sat Dec 3 17:42:26 2016 -0500
added pry-byebug

Now, you can use the value tied to "commit", shown in print out of the git log command, to jump to that specific commit. In this case containing the code that includes the addition of pry-bybug:

git checkout 2a2eb5c2b2626d85bedf653c114e453f45791043

Remember, git clean -df will remove files that are left over from latter branches, which might not be pertinent to earlier branches.

Q: How do you fix the following error: "Expected string default value for '--rc'; got false (boolean)"?

A: Adding the following entry in your Gemfile will stop this error from happening: gem 'thor', '~>0.19', '<=0.19.1'

Once added into the Gemfile run bundle again and try to run the rails server.

Q: How can I handle when a rails hangs and times out?

A: If you execute a command that causes the terminal to timeout or just hang without doing anything, Ctrl+C, or if that doesn't work just kill the process. Then try running spring stop, then re-run your command.

Q: How to handle attach_file related tests failing using poltergeist on Ubuntu 16.04?

A: The gist of it is that this issue is caused by the Ubuntu 16.04 installation of PhantomJS. Since there's currently not a fix for this problem, you can use the Selenium driver instead. Add Capybara.javascript_driver = :selenium to the top of the files where you're having problems below the require statements.

For a detailed discussion of this issue, check out this thread.

If you can't see that thread because you weren't in that session, here are some of the important messages:

Original Question

I am using Ubuntu 16.04 and the default poltergeist driver with phantomjs 2.1.1 etc

I tried using a different jpg, save_and_open_screenshot, raising wait times to 60s. The software versions all seem okay, and I am not aware of any existing incompatibilities with phantomjs, so this is all very strange. From the screenshots, the images can be populated successfully via factories, so it is only attach_file that is failing. It is a pity as I have used poltergeist in the past for other work, just nothing to do with file uploads

Instructor Response

I don't know if anything intelligent will be produced, but you can try enabling debug for poltergeist. It might be trying to tell you something.

Also -- just thought of this.

  • Have you tried this with a pristine copy from the repository?
  • If that works and your code is not working, try simplifying your HTML so you are 100% positive you do not have a missing closing div tag. I found that gave my live browser fits in that case and when the browser was taking up too small of a width. Finding the missing closing div tag cured all in that case.

Student Response

That was actually from the images-assignment tag. I already know from earlier, having ran the whole test suite once, that tests involving attach_file are not working. So I just wanted to focus on one specific test, apart from that it can be considered pristine.

I did try to enable debug earlier, but the output is extremely verbose (you can see many lines related to the capybara waiting mechanism for ajax) and appears to produce no warnings or outright failures. It looks more like a "no-op" than any tangible failure. I will try to include it when I get the chance to run the test again.

As for phantomjs version, I am pretty sure that it is 2.1.1 (16.04, or Xenial, ships with this version: https://launchpad.net/ubuntu/xenial/+source/phantomjs). I did try to remove any possible older versions installed from gem or npm, but it is quite unlikely any one of them can override the system-installed phantomjs. I read about the 2.0 issue but it may or may not be related since that was supposedly fixed.

I am going to test on a native 14.04 soon (this one will need a pre-built phantomjs 2.1.1). If that works too, then the cause is probably something within or related to the 16.04 environment.

Yeah, it was indeed a problem with the system package version: https://bugs.launchpad.net/ubuntu/+source/phantomjs/+bug/1605628 due to some intricacies related to QtWebKit

14.04 with prebuilt binary: working

16.04 with prebuilt binary: working

16.04 with system package: not working

Anyway, situations like this are unfortunate, but can happen if you have been using Linux for a while. Sometimes it can be due to a maintainer's mistake, but in this case it is something beyond his control.