add more instructions on how to run the codes

This commit is contained in:
Bogumił Kamiński 2022-03-16 21:12:52 +01:00
parent f62a3b2ab0
commit 973d696831
2 changed files with 36 additions and 7 deletions

View File

@ -1,30 +1,52 @@
# Julia for Data Analysis
This repository contains source codes for the "Julia for Data Analysis" book This repository contains source codes for the "Julia for Data Analysis" book
that is written by Bogumił Kamiński and is planned to be published in 2022 by that is written by Bogumił Kamiński and is planned to be published in 2022 by
[Manning Publications Co.](https://www.manning.com/). [Manning Publications Co.](https://www.manning.com/).
## Setting up your environment
In order to prepare the Julia environment before working with the materials In order to prepare the Julia environment before working with the materials
presented in the book please perform the following setup steps: presented in the book please perform the following setup steps:
* [download](https://julialang.org/downloads/) and * [download](https://julialang.org/downloads/) and
[install](https://julialang.org/downloads/platform/) [install](https://julialang.org/downloads/platform/)
[Julia](https://julialang.org/); [Julia](https://julialang.org/);
all the codes were tested under Julia 1.7; all the codes were tested under Julia 1.7;
* make sure you can start Julia by running `julia` command in your system shell * make sure you can start Julia by running `julia` command in your terminal;
(alternative ways to use Julia are described in Appendix A to the book)
* download [this repository](https://github.com/bkamins/JuliaForDataAnalysis) * download [this repository](https://github.com/bkamins/JuliaForDataAnalysis)
to a local folder on your computer; to a local folder on your computer;
* start Julia in a folder containing the downloaded material using the command * start Julia in a folder containing the downloaded material using the command
`julia --project`; the folder must `julia --project`; the folder must
contain the Project.toml and Manifest.toml files prepared for this book contain the Project.toml and Manifest.toml files prepared for this book that
(an explanation what these files do and why they are required is given in allow Julia to automatically set up the project environment that will allow
Appendix A to the book); you to work with material presented in this book
(a more detailed explanation what these files do and why they are required is
given in Appendix A to the book);
* press *]*, write `instantiate` and press *Enter* (this process will ensure * press *]*, write `instantiate` and press *Enter* (this process will ensure
that Julia properly configures the working environment for working with that Julia properly configures the working environment for working with
the codes from the book); the codes from the book);
* press *Backspace*, write `exit()` and press *Enter*; now you should exit Julia * press *Backspace*, write `exit()` and press *Enter*; now you should exit Julia
and everything is set up to work with the materials presented in the book. and everything is set up to work with the materials presented in the book.
Additional instructions how to manage your Julia installation are given in
Appendix A to the book.
In particular, if you use
[Visual Stuido Code](https://code.visualstudio.com/) with
[Julia extenssion](https://marketplace.visualstudio.com/items?itemName=julialang.language-julia)
then open the folder with the materials contained in this repository (you can
open it in Folder/Open Folder... menu option). Then if you run
*Start Julia REPL* command (e.g. under Windows its keyboard shortcut is Alt-J Alt-O)
a proper project environment will be automatically activated (the Julia extension
will use the Project.toml and Manifest.toml files that are present in this folder).
## Organization of the code
The codes for each chapter are stored in files named *chXX.jl*, where *XX* is The codes for each chapter are stored in files named *chXX.jl*, where *XX* is
chapter number. chapter number. The only exception is chapter 14, where additionally a separate
*ch14_server.jl* is present along with *ch14.jl* (the reason is that in this
chapter we create a web service and the *ch14_server.jl* contains the
server-side code that should be run in a separate Julia process).
Solutions to the exercises that are presented in appendix B in Solutions to the exercises that are presented in appendix B in
the book are stored in *appB.jl* file. These solutions assume that they are the book are stored in *appB.jl* file. These solutions assume that they are
@ -32,9 +54,12 @@ executed in the same Julia session as the codes from the chapter where the
question was posted (so that appropriate variables and functions are defined question was posted (so that appropriate variables and functions are defined
and appropriate packages are loaded). and appropriate packages are loaded).
## Running the example codes
To work with codes from some given chapter: To work with codes from some given chapter:
* start a fresh Julia session using the `julia --project` command in a folder * start a fresh Julia session using the `julia --project` command in a folder
containing the downloaded material; containing the downloaded material (or alternatively use Visual Studio Code
to activate the appropriate project environment automatically);
* execute the commands sequentially as they appear in the file; * execute the commands sequentially as they appear in the file;
the codes were prepared in a way that you do not need to restart Julia the codes were prepared in a way that you do not need to restart Julia
when working with material from a single chapter, unless it is explicitly when working with material from a single chapter, unless it is explicitly
@ -44,6 +69,8 @@ To work with codes from some given chapter:
consecutive code sections this means that in the book these codes are consecutive code sections this means that in the book these codes are
separated by the text of the book explaining what the code does separated by the text of the book explaining what the code does
## Data used in the book
For your convenience I additionally stored data files that we use in this book. For your convenience I additionally stored data files that we use in this book.
They are respectively: They are respectively:
* movies.dat (for chapter 6, shared on GitHub repository * movies.dat (for chapter 6, shared on GitHub repository

View File

@ -1,3 +1,5 @@
# run this file using julia --project -t4 ch14_server.jl command
using Genie using Genie
using Statistics using Statistics
using ThreadsX using ThreadsX