taking-off's People
Forkers
tvjames thiagoramos23 georgeharley eric-guo stephanvs krustee wakproductions jayfliz tdenkinger adrianpell iamajvillalobos raksonibs vegahu sqeezy whodathought viktor-evdokimov jsturtevant tomazbracic chusri raufa zoeleblanc mtngrown davorbadrov yourfriendwes wwps123 jedt3d edgarfgptaking-off's Issues
So confused... debugging chapter
At the start of the Debugging chapter, before doing anything, I'm just trying to run the tests, and I'm getting the following when running "mix test --trace":
warning: variable "deps" does not exist and is being expanded to "deps()", please use parentheses to remove the ambiguity or change the variable name
mix.exs:10
Compiling 6 files (.ex)
warning: variable "val" is unused
lib/converter.ex:3
warning: variable "val" is unused
lib/converter.ex:7
warning: variable "val" is unused
lib/converter.ex:11
warning: variable "val" is unused
lib/converter.ex:15
warning: variable "earth" does not exist and is being expanded to "earth()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:9
warning: variable "mars" does not exist and is being expanded to "mars()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:14
warning: variable "moon" does not exist and is being expanded to "moon()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:19
warning: variable "newtons_gravitational_constant" does not exist and is being expanded to "newtons_gravitational_constant()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:31
warning: variable "earth" does not exist and is being expanded to "earth()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:31
warning: variable "newtons_gravitational_constant" does not exist and is being expanded to "newtons_gravitational_constant()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:40
warning: variable "earth" does not exist and is being expanded to "earth()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:40
warning: variable "earth" does not exist and is being expanded to "earth()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:46
warning: variable "newtons_gravitational_constant" does not exist and is being expanded to "newtons_gravitational_constant()", please use parentheses to remove the ambiguity or change the variable name
lib/physics/rocketry.ex:50
Generated physics app
PhysicsTest
* test escape velocity of planet X is correct (0.00ms)
1) test escape velocity of planet X is correct (PhysicsTest)
test/physics_test.exs:19
** (FunctionClauseError) no function clause matching in Converter.to_km/1
The following arguments were given to Converter.to_km/1:
# 1
926.9623828717426
Attempted function clauses (showing 1 out of 1):
def to_km(val) when -is_integer(val)-
code: ev = %{mass: 4.0e22, radius: 6.21e6} |> Physics.Rocketry.escape_velocity
stacktrace:
(physics) lib/converter.ex:27: Converter.to_km/1
(physics) lib/physics/rocketry.ex:25: Physics.Rocketry.escape_velocity/1
test/physics_test.exs:20: (test)
* test Converter one works (0.00ms)
* test ConverterTwo works (0.00ms)
2) test ConverterTwo works (PhysicsTest)
test/physics_test.exs:35
** (UndefinedFunctionError) function ConverterTwo.to_light_seconds/2 is undefined (module ConverterTwo is not available)
code: ls = ConverterTwo.to_light_seconds({:miles, 1000}, precision: 5)
stacktrace:
ConverterTwo.to_light_seconds({:miles, 1000}, [precision: 5])
test/physics_test.exs:36: (test)
* test ConverterTwo works with default values (15.0ms)
3) test ConverterTwo works with default values (PhysicsTest)
test/physics_test.exs:40
** (UndefinedFunctionError) function ConverterTwo.to_light_seconds/1 is undefined (module ConverterTwo is not available)
code: ls = ConverterTwo.to_light_seconds({:miles, 1000})
stacktrace:
ConverterTwo.to_light_seconds({:miles, 1000})
test/physics_test.exs:41: (test)
* test escape velocity of earth is correct (0.00ms)
4) test escape velocity of earth is correct (PhysicsTest)
test/physics_test.exs:4
** (FunctionClauseError) no function clause matching in Converter.to_km/1
The following arguments were given to Converter.to_km/1:
# 1
11183.2516621689
Attempted function clauses (showing 1 out of 1):
def to_km(val) when -is_integer(val)-
code: ev = Physics.Rocketry.escape_velocity(:earth)
stacktrace:
(physics) lib/converter.ex:27: Converter.to_km/1
(physics) lib/physics/rocketry.ex:25: Physics.Rocketry.escape_velocity/1
test/physics_test.exs:5: (test)
* test escape velocity of moon is correct (0.00ms)
5) test escape velocity of moon is correct (PhysicsTest)
test/physics_test.exs:14
** (FunctionClauseError) no function clause matching in Converter.to_km/1
The following arguments were given to Converter.to_km/1:
# 1
2375.1809330874535
Attempted function clauses (showing 1 out of 1):
def to_km(val) when -is_integer(val)-
code: ev = Physics.Rocketry.escape_velocity(:moon)
stacktrace:
(physics) lib/converter.ex:27: Converter.to_km/1
(physics) lib/physics/rocketry.ex:25: Physics.Rocketry.escape_velocity/1
test/physics_test.exs:15: (test)
* test escape velocity of mars is correct (0.00ms)
6) test escape velocity of mars is correct (PhysicsTest)
test/physics_test.exs:9
** (FunctionClauseError) no function clause matching in Converter.to_km/1
The following arguments were given to Converter.to_km/1:
# 1
5007.130210128
Attempted function clauses (showing 1 out of 1):
def to_km(val) when -is_integer(val)-
code: ev = Physics.Rocketry.escape_velocity(:mars)
stacktrace:
(physics) lib/converter.ex:27: Converter.to_km/1
(physics) lib/physics/rocketry.ex:25: Physics.Rocketry.escape_velocity/1
test/physics_test.exs:10: (test)
* test Converting to to_light_seconds (0.00ms)
Finished in 0.06 seconds
8 tests, 6 failures
Randomized with seed 272000
I've made sure all my code matches the code here: https://github.com/bigmachine-io/taking-off/tree/7c05b129cd6c9bf7fd95a3aadecd0472eb510408. I'm assuming that this code should basically be the ending code for the Orbital Distance chapter.
Any help?
Mnesia chapter issues
I had 2 issues with amnesia_test.exs when completing this chapter:
- Should be "Amnesia.start" instead of "Amnesia.Start"
- this only applies to the code shown in the video
- book & github code are correct
- I needed to add a directive for "use Amnesia" in amnesia_test.exs or i get
"(UndefinedFunctionError) function Amnesia.Helper.result/1 is undefined or private"
- seems to be missing from video, book & github code.
- think this is caused by a change to the Amnesia library (in Aug 2016).
confused by unit tests referenced in video around 45:32
The video says to look at chp 6 for more unit tests however when looking at that tag, the underlying Rocketry lib is completely different from what we've built so far on the video series and the tests all don't work....is that really the correct tag from which to pull at this point in the video?
Passing maps as function argument
Just started working through this book and it's been great so far!
A quick question on this example though --
def to_light_seconds({:meters, meters} = val, precision: precision) do
(meters * 3.335638620368e-9) |> round_up
end
What is val
(in the functional argument) used for? When I run the tests, I get this warning:
warning: variable "val" is unused
lib/physics/rocketry.ex:47
What is the point of val
in this example? Also, is val
bound to the map that is passed as argument?
Thanks!
Added Error Conditions - running the tests and watching the video don't correlate.
Hi. I checked out the code as explained in the video but running the tests does not correlate at all with what is shown in the video. The first error is multiple clauses of the same test being defined. The second, after commenting the second, is that no function clause because we are passing in a float. Am I doing something wrong or did the tests and the video get out of sync?
d2eb25f1789b9cd7c5e89973a84de1c45189c870
<--- this is the commit I checked out.
Additional error in compiler_problem_test.exs (@ Chapter 8)
in commit d2eb25f there is an error over and above the intentional errors discussed in the video.
There are 2 methods named as "test rounding an integer". As such the test resolution process does not follow the same flow as the video or the book. Instead a "ExUnit.DuplicateTestError" is thrown and no test assertions are shown (failing or otherwise).
Extra Credit Challenge
On the last page of the 'Calculating Orbital Distance' chapter, there's an 'Extra Credit Challenge'. We're supposed to fix the function and correctly apply the orbital term formula. I checked and double checked and can't see what's wrong. I'm sure it's a blatantly obvious thing, but can someone let me know what I'm missing?
Issue downloading Amnesia from GitHub (ch 13)
For chapter 13, when trying to use Amnesia
, I get an error when downloading the package from Github.
For this line of deps()
:
[{:timex, "~> 2.1.4"}, {:amnesia, github: "meh/amnesia", tag: :master}]
I get the following error:
* Updating amnesia (https://github.com/meh/amnesia.git)
** (ArgumentError) all arguments for System.cmd/3 must be binaries
(elixir) lib/system.ex:613: System.cmd/3
(mix) lib/mix/scm/git.ex:250: Mix.SCM.Git.git!/2
(mix) lib/mix/scm/git.ex:124: Mix.SCM.Git.checkout/2
(elixir) lib/file.ex:1419: File.cd!/2
(mix) lib/mix/dep/fetcher.ex:61: Mix.Dep.Fetcher.do_fetch/3
(mix) lib/mix/dep/converger.ex:185: Mix.Dep.Converger.all/9
(mix) lib/mix/dep/converger.ex:196: Mix.Dep.Converger.all/9
(mix) lib/mix/dep/converger.ex:121: Mix.Dep.Converger.all/7
Although the video states not to download the package from Hex, I believe there has been updated version since the release of chapter 13. I am able to download the package fine with https://hex.pm/packages/amnesia/0.2.7, i.e.,
{:amnesia, "~> 0.2.7"}
I would like more editor setup information
Id like to know what all Elixir plugins you use with Sublime. Also Im curious what theme youre using with Sublime.
Physics.Repo not started
While going through the book I hit a roadblock on getting data back from the database. When I try to query something I get this error.
I am using the files from the BOMBS AWAY Commit and just adding a planet schema file and editing the following planet.ex file
planet.ex.txt
== Compilation error on file lib/physics/rocketry.ex ==
** (ArgumentError) repo Physics.Repo is not started, please ensure it is part of your supervision tree
lib/ecto/query/planner.ex:65: Ecto.Query.Planner.query_lookup/5
lib/ecto/query/planner.ex:48: Ecto.Query.Planner.query_with_cache/6
lib/ecto/repo/queryable.ex:119: Ecto.Repo.Queryable.execute/5
lib/ecto/repo/queryable.ex:40: Ecto.Repo.Queryable.all/4
lib/planet.ex:21: Planet.select/0
lib/physics/rocketry.ex:9: (module)
Concurrency Example Postgrex.close/1
I get error Postgrex.close/1 is undefined or private in the example where we are using the Postgrex driver directly. The Postgrex docs only show close/3 & close!/3 (although 1 of the parameters is optional so I think that also makes it close/2).
Named tuple in func signature? What is this?
{:inches, inches} = val
What is that doing? Is it a named tuple? You do not use val
in the to_light_seconds function, so I'm not sure why it's there at all. And you can simply pass the result to round_up without having it be the name of val, so I just don't understand the point of it in the code. Yet, it's consistently in this entire chapter up until the very end.
def to_light_seconds({:inches, inches} = val) do
(inches * 8.472522095734715723e-11) |> round_up
end
def round_up(val) when is_float(val), do: trunc(val)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.