Commit graph

636 commits

Author SHA1 Message Date
Vince Pike
454ceb34ff Old Code Would Not Compile (#522)
* Old Code Would Not Compile

I researched the Chrono library and made sure the code would compile with the latest Rust 2018 setup.

* Remove the DateTime part for the chrono piece

* Removed Chrono to simplify example
2019-04-15 13:59:34 -07:00
Stefan Mesken
5e1e788198 fixed broken links (#521) 2019-04-12 09:06:11 -07:00
Jonas Galvez
f1ad9ad44c add unicode-segmentation example (#517)
Thanks!
2019-04-12 09:05:36 -07:00
Stefan Mesken
5824ee21eb added data aggregation example for postgres (#520) 2019-04-12 08:22:10 -07:00
Yogesh
2ee24f4bc7 fixed rand crate deprecation warning (#510) 2019-04-12 08:18:01 -07:00
Stefan Mesken
539183c86b added invert-matrix to /science/mathematics/linear_algebra (#508)
* added invert-matrix to /science/mathematics/linear_algebra

* added nalgebra as dependency

* added nalgebra to dictionary

* fixed link to nalgebra

* Remove statistics file only includes the header
2019-04-12 08:17:46 -07:00
Andrew Gauger
35daea8254
update to sqlite version syntax (#516)
Fix merge artifact
2019-01-25 16:57:20 -08:00
Adrian Stanciu
3263728193 sqlite transactions recipe (#493)
* sqlite transactions recipe

* Reordered/cleaned-up references

* Removed package version from links

* Updates after review

* Removed comment

* Taking out a pronoun
2019-01-25 16:16:03 -08:00
Brett Lyons
e2a58821c3 Updates for rand 0.6.4 (#511)
* Updated to use Uniform instead of non-extant Range

* SliceRandom replaces depcrated Rng.choose

* Updated Cargo.tml rand version "0.6"
2019-01-25 16:06:23 -08:00
Autoclave
490e97363c Fix SQLite example so it compiles (#512)
* Fix SQLite example so it compiles

* Bump rusqlite version
2019-01-25 16:04:39 -08:00
Stefan Mesken
c5f6880ac0 Implement the FromStr trait for a custom struct (#509)
* added Text Processing > String Parsing > Implement the FromStr trait for a custom struct

* Implement the FromStr trait for a custom struct

* fixed formatting

* fixed formatting
2019-01-10 14:13:00 -08:00
Stefan Mesken
fad847ef2d fixed missing links to /science/mathematics/statistics (#507) 2018-12-27 08:29:46 -08:00
Stjepan Glavina
c1d3f12ef4 Update crossbeam-spawn.md (#496)
* Update crossbeam-spawn.md

In the latest version od Crossbeam ([docs](https://docs.rs/crossbeam/0.5.0/crossbeam/)) we have two changes:

1. Spawned closures take an argument of type `&Scope` which can be used for nested spawns.
2. The `scope` function returns a `Result` indicating whether spawned threads have been joined with success or not.

Updating the example accordingly.

* Return option from find_max

* Use split_at
2018-12-07 18:51:26 -08:00
Pawel Duzinkiewicz
c786f03e92 add big integer example (#477)
* add big integer example

* review fixes
2018-12-07 18:51:13 -08:00
Erich Cordoba
598eccc04e Fix little typo (#494) 2018-12-07 06:36:05 -08:00
Vishal Sodani
029b24503b Add recipe to show insert and select query for sqlite database (#455) (#491) 2018-12-07 06:29:24 -08:00
Jim Turner
77739fb73c Fix link to dot method for 2-D arrays (#489)
Note that this also changes the link name from `dot` to
`ndarray::Array2::dot` to avoid conflicting with the `vector-norm.md`
recipe.
2018-12-07 06:25:25 -08:00
burrrata
dc8f1f2dd2 typo
line 7: change siply to simply
2018-12-05 23:58:44 +01:00
Ben Elliott
a79932c9a6 Add Statistics Section With Examples (#476)
* Add Statistics Section With Examples

Add a statistics section to the cookbook!

Add an example showing how to calculate mean, median, and mode using the
Rust standard library.

Add a second example showing how to compute the standard deviation and zscore
of a set of data.

* Seek Brevity, Improve Median Example

Shorten some of the example descriptions, preferring to let the code and
Rust documentation speak for itself.

Calculate the median using an adaptation of the quickselect algorithm,
which does not mutate the original data set and should (in theory) be
slightly more performant.

Remove the unneeded statistics summary file
2018-12-04 12:22:39 -08:00
Chris Couzens
811331100f Correct referenced crate in percent-encode chapter (#498)
The source code uses the `url` crate not the `percent-encoding` crate.
This change makes the text consistent with the source code.
2018-11-20 15:53:41 -08:00
Chris Couzens
7119dc5ad9 Use provided struct in CSV tab delimiter example (#499)
The CSV encoding tab delimiter example has a struct to deserialize into.
However it wasn't used.

I've changed it to use the provided struct.
It may make more sense to remove it instead, as it isn't the point of
this example. If it turns out to be the preferred method in the pull
request process, I'll do so.
2018-11-20 15:53:29 -08:00
Julian Gehring
3491f21654 Fix swapped links for web client examples (#495)
Two link targets for web client download examples have been swapped, revert them. And also remove a dot at the end of a heading in one of the examples.
2018-11-12 16:48:21 -08:00
Jim Turner
26744a77b9 Fix multiply-scalar-vector-matrix recipe (#487)
The original version was incorrect about `ndarray`'s treatment of 1-D
arrays as vectors, and it incorrectly indicated that `*` performed
matrix multiplication.

`ndarray` decides whether a 1-D array is a row vector or column vector
in matrix multiplication by whether it is on the left-hand side or
right-hand side. (The behavior matches NumPy. If it's on the left-hand
side, it's a row vector, while if it's on the right-hand side, it's a
column vector.) The original version incorrectly indicated that
calling `.reversed_axes()` on a 1-D array would make it into a column
vector. In fact, calling `.reversed_axes()` on a 1-D array has no
effect since a 1-D array has only 1 axis.

Matrix multiplication is performed with `.dot()`, not `*`. The `*`
operator performs element-wise multiplication.
2018-10-11 13:56:32 -07:00
Jim Turner
cb852c17d8 Improve vector norm recipe (#486)
This removes an unnecessary allocation caused by `.mapv()` in the
original version, replaces `&Array1<f64>` argument types with
`ArrayView1<f64>` (see the new text for reasoning), and takes
advantage of the `array!` macro to make the array creation more
concise.
2018-10-11 13:55:47 -07:00
Vishal Sodani
720e65780e Add Postgres database recipe (#456) (#481)
Postgres Database Recipes
2018-10-11 13:54:46 -07:00
Andrew Gauger
5d3f4a1e76
Merge pull request #485 from rust-lang-nursery/revert-482-bump-mdbook
Revert "Bump mdbook version"
2018-10-10 15:17:00 -07:00
Andrew Gauger
40265251d8 Revert "Update to mdbook 0.2.1 (#482)"
This reverts commit fbcaca6c05.
2018-10-10 15:15:49 -07:00
James Hinshelwood
fbcaca6c05 Update to mdbook 0.2.1 (#482) 2018-10-10 09:13:29 -07:00
James Hinshelwood
45b2243cf1 Add various simple matrix recipes (#471)
* Add various simple matrix recipes
2018-10-10 09:00:02 -07:00
Andrew Gauger
3486ccebd7
Install Python 3.6 before using it (#480) 2018-10-09 09:05:14 -07:00
James Hinshelwood
580e16feff Reorganise science and fix broken links (#473) 2018-10-08 15:10:09 -07:00
Jeff Hajewski
4147bdf696 Removes quick run in favor of main for compression recipes. (#468)
See issue #433
2018-10-05 16:59:48 -07:00
Laurențiu Nicola
bbc81c48d7 Bump crossbeam, image and memmap (#467) (#467) 2018-10-05 16:58:59 -07:00
Jeff Hajewski
d70df91077 Adds vector norm example. (#466)
Part of tracking issue #450.

Once #452 is merged I will rebase and add appropriate section links.
Similarly, once #463 is merged I will update badge links.
2018-10-05 16:56:15 -07:00
Laurențiu Nicola
78a99d0eb1 Add SQLite database open recipe (#464) (#464)
Databases yay!
2018-10-05 16:54:57 -07:00
Jeff Hajewski
466b74ca72 Adds vector sum example. (#461)
This is part of tracking issue #450.
2018-10-03 15:59:14 -07:00
Andy Gauge
656e486ff6 cleanup 2018-10-03 15:32:21 -07:00
Andy Gauge
b00bcde000 Merge branch 'master' of https://github.com/brson/rust-cookbook 2018-10-03 15:25:53 -07:00
Laurențiu Nicola
d4cbf55038 CONTRIBUTING.md clarifications (#465) 2018-10-03 15:21:24 -07:00
James Hinshelwood
c362fcadf5 Add ndarray badge and link (#463) 2018-10-03 15:13:31 -07:00
James Hinshelwood
d3ce33c9fe Add trigonometry recipes (#462) 2018-10-03 15:12:56 -07:00
Ludwig PACIFICI
d6f4af68e3 Recipe: Distance between points (#452)
* Update std badge version

* Added recipe: Distance between two points on the Earth

Fixes #446
2018-10-03 15:09:49 -07:00
Andy Gauge
bb607c6069 Active voice 2018-10-02 15:38:41 -07:00
Laurențiu Nicola
2b29e72423 Upgrade to reqwest 0.9 (#460) 2018-10-02 15:14:37 -07:00
Siddharth Naithani
d4e44638ee added ansi_term example (#457)
* added ansi_term example

* added ansi and ansiterm to dictionary

* Delete ansi_terminal.md

* Update arguments.md

* link shows but does not work

* bug fix [link now shows and works perfectly]

* highlighted `` ansi-term name

* resolved flaws

* fixed issues with travis CI
2018-10-02 15:07:35 -07:00
Andy Gauge
bb73dd9c7f Alphabetize Categories 2018-10-02 10:54:47 -07:00
Petri-Johan Last
e8eb3d1a58 Complex numbers example (#458)
* Added Mathematics section. A Complex Numbers section was added under this new section

* Complex numbers are now under the correct heading and sub-headings. Added some more examples for using complex numbers

* Forgot to add new sections in science.md for the new recipes
2018-10-02 09:02:03 -07:00
Januson
c6d6b58835 Recipe Series: Sort Vector #437 (#444)
* Add simple sorting vector of integers
* Add sorting of vector of floats
* Add sorting of vector of structs
2018-09-20 07:53:22 -07:00
Anmol Sharma
cdb53e75bd Update rand.md (#451)
Fixed a typo
2018-09-20 07:52:58 -07:00
nimtiazm
7e59e4efb4 Fixed file-descriptor leak by waiting for child processes to terminate. Fixes #393. (#435) 2018-07-17 09:51:29 -07:00