Commit graph

607 commits

Author SHA1 Message Date
AndyGauge
fdf9ea086e Not testing with Appveyor 2019-12-16 20:13:07 -08:00
AndyGauge
5e201b99da Do not run skeptic on pbkdf2 2019-12-16 19:48:06 -08:00
Pietro Danzi
ff903b0b66 fix PBKDF2 example (#538) 2019-12-16 19:14:59 -08:00
AndyGauge
2a57fa3904 add spsc to dictionary 2019-12-16 18:35:11 -08:00
Andrew Gauger
bc641257e7
Exclude percent encoding from skeptic (#561)
* Exclude percent encoding from skeptic

* Exclude tests that are affected by skeptic #111

* More failing tests exlcuded from Skeptic

* add ignore to infostring
2019-12-16 18:23:09 -08:00
Jeff Hajewski
084f51cff9 Adds simple single producer, single consumer crossbeam channel example. (#551) 2019-12-16 18:22:36 -08:00
Dan Wilhelm
d7c291151f Update to ndarray 0.13 (#560) 2019-12-16 18:13:33 -08:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి)
3fcb08bee2 Fix the compilation error (#532)
Try `cargo run --verbose` after copying the code into a separate project. This example snippet does not compile and requires `serde` create to be present in the main.rs. So include the serde crate will fix the compilation error.
2019-09-19 16:21:40 -07:00
Thomas Mulvaney
9c72aecdfc Remove error-chain from examples having only one error variant (#531)
* Rmove error-chain from examples having only one error variant

Remove error_chain from csv example 'Serde deserializes data into ...'
Remove error_chain from toml example 'Parse TOML into your ...'

* remove linebreak after main

* remove line break
2019-09-19 16:14:38 -07:00
wangzengdi
d3a407a433 optimize variable: min -> max (#534) 2019-09-19 16:02:29 -07:00
Andrew Gauger
ad5f968c89
postgres version doesn't conflict with rand (#550) 2019-09-19 15:45:49 -07:00
Jubilee
5eba1a6068 run() -> main() (#548)
* [433] remove old run function

* Completes run() -> main() transitions
2019-09-19 13:05:17 -07:00
Andrew Gauger
f4d63dada2 Merge branch 'master' of github.com:rust-lang-nursery/rust-cookbook 2019-09-19 12:52:40 -07:00
Andrew Gauger
638246385a Removing references to rand < .5 2019-09-19 12:52:27 -07:00
Stefan Hoelzl
6d3f7f97a2 removed unsafe block from rand-choose.md (#536)
the unsafe block in this example is not necessary and might confuse beginners.
2019-09-19 11:56:04 -07:00
felipe
3d90852592 eextern -> extern (#535)
was this intentional?
2019-09-19 11:55:08 -07:00
Alex Touchet
4e05e2e205 Update Travis CI URL (#545) 2019-09-19 11:54:33 -07:00
Jubilee
16a043b09a Update inclusive range syntax, fix script pathname, crate deps (#547)
Fix docs directing developer to incorrect pathname for spellcheck.sh
Add note on the normal behavior of spellcheck.sh for clarity
Fix instances of inclusive range syntax to use '..=' style
Depend directly on percent-encoding instead of expecting re-exports
This commit compiles and tests correctly on rustc v1.37.0

link-checker found 452 failures before this commit
link-checker found 452 failures after this commit
no new errors were added by this commit
2019-09-19 11:04:37 -07:00
Stefan Mesken
cb949b04c0 removed error-chain from examples having only one error variant (#525)
* removed error-chain from 'Calculate SHA1 sum of iso files concurrently'

* removed error chain from 'Salt and hash a password with PBKDF2'

* removed error-chain from 'Parse string into DateTime struct'

* removed error-chain from 'Log messages with a custom logger'

* fixed compiler errors

* removed unnecessary feature flag

* removed error-chain from 'Log to the Unix syslog'

* removed error-chain from 'Parse and increment a version string.'

* removed error-chain from 'Parse a complex version string.'

* removed error-chain from 'Check if given version is pre-release.'

* removed error-chain from 'Percent-encode a string'

* removed error-chain from 'Encode and decode hex'

* removed error-chain from 'Read CSV records'

* removed error-chain from 'Read CSV records with different delimiter'

* removed error-chain from 'Handle invalid CSV data with Serde'

* removed error-chain from 'Serialize and deserialize unstructured JSON'

* removed error-chain from 'Deserialize a TOML configuration file'

* removed error-chain from 'Read and write integers in little-endian byte order'

* removed error-chain from 'Read lines of strings from a file'

* removed error-chain from 'Avoid writing and reading from a same file'

* removed error-chain from 'Access a file randomly using a memory map'

* removed error-chain from 'Listen on unused port TCP/IP'

* removed error-chain from 'Redirect both stdout and stderr of child process to the same file'

* removed error-chain from 'Continuously process child process' outputs'

* removed error-chain from 'Parse a URL from a string to a `Url` type'

* removed error-chain from 'Create new URLs from a base URL'

* removed error-chain from 'Extract the URL origin (scheme / host / port)'

* removed error-chain from 'Remove fragment identifiers and query pairs from a URL'

* removed error-chain from 'Query the GitHub API'

* removed error-chain from 'Check if an API resource exists'

* removed error-chain from 'Consume a paginated RESTful API'

* addressed Travis CI failure

* addressed Travis CI failure

* addressed Travis CI issue
2019-04-15 21:24:07 -07:00
lzutao
99e3d6b333 Use gen_range instead of rand::choose (#527) 2019-04-15 21:13:45 -07:00
Stefan Dombrowski
353ccf46cc Fix link (#526) 2019-04-15 14:00:23 -07:00
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