# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=671

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 672

---

## [Silence \`const\` re-definition warning](https://discourse.julialang.org/t/silence-const-re-definition-warning/51095)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 7\
**Last updated:** [December 2, 2020, 2:00pm UTC](https://discourse.julialang.org/t/silence-const-re-definition-warning/51095 "2020-12-02T14:00:45Z")

</div>

Is there a way to silence the const re-definition warning? julia\> const x = 2 2 julia\> x = 3 WARNING: redefinition of constant x. This may fail, cause incorrect answers, or produce other errors. 3 Maybe a macro, like: …

---

## [Using ... uses outdated Package](https://discourse.julialang.org/t/using-uses-outdated-package/51111)

<div class="topic-metadata">

**Author:** [@Volker\_Weissmann](https://discourse.julialang.org/u/Volker_Weissmann)\
**Replies:** 1\
**Last updated:** [December 2, 2020, 1:09pm UTC](https://discourse.julialang.org/t/using-uses-outdated-package/51111 "2020-12-02T13:09:11Z")

</div>

Why does @which set\_cache\_path("arg") find something in the following example? \[volker@battle SimpleCache\]$ cat src/SimpleCache.jl module SimpleCache end # module \[volker@battle SimpleCache\]$ julia \_ …

---

## [Question about Javis.jl](https://discourse.julialang.org/t/question-about-javis-jl/50811)

<div class="topic-metadata">

**Author:** [@adeil](https://discourse.julialang.org/u/adeil)\
**Replies:** 31\
**Last updated:** [December 2, 2020, 12:21pm UTC](https://discourse.julialang.org/t/question-about-javis-jl/50811 "2020-12-02T12:21:08Z")

</div>

Hello, @sudomaze I’m following tutorial 1: Making Your First Javis Animation. However, I do not understand this error warning. myvideo = Video(500,500) Background(1:70, ground) red\_ball = Object(1:70, (args...) -\> objec…

---

## [Struct syntax](https://discourse.julialang.org/t/struct-syntax/51099)

<div class="topic-metadata">

**Author:** [@j2b2](https://discourse.julialang.org/u/j2b2)\
**Replies:** 5\
**Last updated:** [December 2, 2020, 11:05am UTC](https://discourse.julialang.org/t/struct-syntax/51099 "2020-12-02T11:05:06Z")

</div>

Hi, I wonder why line breaks are required when defining fields of a structure, and where this is documented: julia\> struct S a b end julia\> struct S a b end ERROR: syntax: extra token "b" after en…

---

## [Named tuples - construction, unpacking](https://discourse.julialang.org/t/named-tuples-construction-unpacking/51074)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 2\
**Last updated:** [December 2, 2020, 8:13am UTC](https://discourse.julialang.org/t/named-tuples-construction-unpacking/51074 "2020-12-02T08:13:45Z")

</div>

I stumbled by accident upon the fact that you can create a named tuple by naming one or more of the elements, not all of them. At least, it seems, as long as the un-named elements are given by existing variables: julia\> …

---

## [Most accurate way to compute x/sqrt(y) in Julia?](https://discourse.julialang.org/t/most-accurate-way-to-compute-x-sqrt-y-in-julia/51061)

<div class="topic-metadata">

**Author:** [@marcus](https://discourse.julialang.org/u/marcus)\
**Replies:** 11\
**Last updated:** [December 1, 2020, 8:39pm UTC](https://discourse.julialang.org/t/most-accurate-way-to-compute-x-sqrt-y-in-julia/51061 "2020-12-01T20:39:28Z")

</div>

As part of a numerical algorithm, I want to compute x/\\sqrt{y} for real numbers x and y. In general is it preferable to compute x/sqrt(y) or x\*sqrt(1/y) or x\*1/sqrt(y)? As a slightly less trivial example, is there an op…

---

## [Streaming CSV Reader from IO Type which does not load all Data into memory](https://discourse.julialang.org/t/streaming-csv-reader-from-io-type-which-does-not-load-all-data-into-memory/51050)

<div class="topic-metadata">

**Author:** [@altre](https://discourse.julialang.org/u/altre)\
**Replies:** 2\
**Last updated:** [December 1, 2020, 3:56pm UTC](https://discourse.julialang.org/t/streaming-csv-reader-from-io-type-which-does-not-load-all-data-into-memory/51050 "2020-12-01T15:56:08Z")

</div>

I am looking for a way to read from a stream of CSV Rows, i.e. from an IO (or LibuvStream) type without reading the whole table into memory. This currently works e.g. with CSV.jl’s CSV.Rows when reading a file since it …

---

## [Creating a registry](https://discourse.julialang.org/t/creating-a-registry/12094)

<div class="topic-metadata">

**Author:** [@adamslc](https://discourse.julialang.org/u/adamslc)\
**Replies:** 29\
**Last updated:** [December 1, 2020, 3:13pm UTC](https://discourse.julialang.org/t/creating-a-registry/12094 "2020-12-01T15:13:12Z")

</div>

I just spend quite a lot of time trying to create a custom registry for the new package manager, so I figured I would document my process so that it goes smoother for the next person. Our goal is to create a registry Te…

---

## [When should I write loops or vectorised calls?](https://discourse.julialang.org/t/when-should-i-write-loops-or-vectorised-calls/50812)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 17\
**Last updated:** [December 1, 2020, 6:36am UTC](https://discourse.julialang.org/t/when-should-i-write-loops-or-vectorised-calls/50812 "2020-12-01T06:36:23Z")

</div>

Hi, Comming from numpy and R, I am customed to the fact that vectorised expressions are faster than loops. I understood this is not the case in julia, where vectorised expression are usually expended out to loops by the…

---

## [Evaluation in calling scope?](https://discourse.julialang.org/t/evaluation-in-calling-scope/34897)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 22\
**Last updated:** [December 1, 2020, 4:51am UTC](https://discourse.julialang.org/t/evaluation-in-calling-scope/34897 "2020-12-01T04:51:27Z")

</div>

from docs, eval() “Evaluate an expression in the global scope of the containing module” as follows: julia\> ex = :(x + 1) :(x + 1) julia\> f() = (x = 10; println(x + 1, " ", eval(ex) ); g() ) f (generic function with 1 m…

---

## [Multi-threaded matrix exponential slower than the single threaded version](https://discourse.julialang.org/t/multi-threaded-matrix-exponential-slower-than-the-single-threaded-version/51009)

<div class="topic-metadata">

**Author:** [@JakobA](https://discourse.julialang.org/u/JakobA)\
**Replies:** 7\
**Last updated:** [December 1, 2020, 3:49am UTC](https://discourse.julialang.org/t/multi-threaded-matrix-exponential-slower-than-the-single-threaded-version/51009 "2020-12-01T03:49:29Z")

</div>

I am trying to perform many matrix exponentials in parallel. However, the multi-threaded code running on 40 cores (2x Skylake 6148) takes about twice as long as the single-threaded code. Here is a minimal working example…

---

## [Make own personal static website in julia?](https://discourse.julialang.org/t/make-own-personal-static-website-in-julia/51024)

<div class="topic-metadata">

**Author:** [@Ravinder\_Ram](https://discourse.julialang.org/u/Ravinder_Ram)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 3:41am UTC](https://discourse.julialang.org/t/make-own-personal-static-website-in-julia/51024 "2020-12-01T03:41:42Z")

</div>

Like in rmarkdown in R and you can crreate own static website … is there any feature / package in julia for that

---

## [Proper way to make an empty sizehinted Dict](https://discourse.julialang.org/t/proper-way-to-make-an-empty-sizehinted-dict/50962)

<div class="topic-metadata">

**Author:** [@malacroi](https://discourse.julialang.org/u/malacroi)\
**Replies:** 1\
**Last updated:** [December 1, 2020, 2:03am UTC](https://discourse.julialang.org/t/proper-way-to-make-an-empty-sizehinted-dict/50962 "2020-12-01T02:03:13Z")

</div>

I have an application where it seems appropriate to have a Dict effectively containing a large number of lightly wrapped Dict containers. Say something like, d = Dict{Int64,Dict{Int64,Int128}}(), where the indices of d …

---

## [Packages for Optimization](https://discourse.julialang.org/t/packages-for-optimization/50926)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 22\
**Last updated:** [December 1, 2020, 1:10am UTC](https://discourse.julialang.org/t/packages-for-optimization/50926 "2020-12-01T01:10:51Z")

</div>

What are some good packages for optimization. I’ve been using Roots.jl and ModelingToolkit.jl to do symbolic derivatives and find the zero roots, but I’m considering packages that actually look for minimums and maximums…

---

## [Implementing finite difference with periodic B.C](https://discourse.julialang.org/t/implementing-finite-difference-with-periodic-b-c/50975)

<div class="topic-metadata">

**Author:** [@yhchang](https://discourse.julialang.org/u/yhchang)\
**Replies:** 9\
**Last updated:** [November 30, 2020, 9:09pm UTC](https://discourse.julialang.org/t/implementing-finite-difference-with-periodic-b-c/50975 "2020-11-30T21:09:39Z")

</div>

I am pretty new to Julia and ultimately I want to transfer my python code for solving a nonlinear PDE into Julia (and see whether I can get the speedup I hope). The PDE I want to solve is similar to a nonlinear heat equ…

---

## [How to call wait on multiple Tasks?](https://discourse.julialang.org/t/how-to-call-wait-on-multiple-tasks/50981)

<div class="topic-metadata">

**Author:** [@s-kap](https://discourse.julialang.org/u/s-kap)\
**Replies:** 3\
**Last updated:** [November 30, 2020, 7:46pm UTC](https://discourse.julialang.org/t/how-to-call-wait-on-multiple-tasks/50981 "2020-11-30T19:46:18Z")

</div>

Hey all, I have some code that uses @spawn to generate ~50 tasks tasks=Vector{Task}() function process\_row\_group(range::Tuple{Int64,RangeMarker}) for col\_name in col\_names push!(tasks, Threads.@spawn proces…

---

## [Documenter fails with ssh error](https://discourse.julialang.org/t/documenter-fails-with-ssh-error/50976)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 9\
**Last updated:** [November 30, 2020, 7:24pm UTC](https://discourse.julialang.org/t/documenter-fails-with-ssh-error/50976 "2020-11-30T19:24:51Z")

</div>

I’m trying to create my first package (using pkgtemplate) but am running into problems generating the documentation using Documenter. I’ve generated ssh keys using DocumenterTools and have stuck them in the indicated pl…

---

## [Need help with Flux CUDA.jl warning and error message](https://discourse.julialang.org/t/need-help-with-flux-cuda-jl-warning-and-error-message/50146)

<div class="topic-metadata">

**Author:** [@forestacorn](https://discourse.julialang.org/u/forestacorn)\
**Replies:** 7\
**Last updated:** [November 30, 2020, 12:49pm UTC](https://discourse.julialang.org/t/need-help-with-flux-cuda-jl-warning-and-error-message/50146 "2020-11-30T12:49:13Z")

</div>

I need some help understanding the following Flux problem and hopefully finding a fix for it. When I run using Flux on my desktop system I get the following warning and error messages: ┌ Warning: This version of CUDA.j…

---

## [How to use github & friends tools for package development in late 2020](https://discourse.julialang.org/t/how-to-use-github-friends-tools-for-package-development-in-late-2020/50984)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 11:11am UTC](https://discourse.julialang.org/t/how-to-use-github-friends-tools-for-package-development-in-late-2020/50984 "2020-11-30T11:11:23Z")

</div>

I recall some weeks ago to have quickly read some topic, and having received some emails, dealing with some change of policy for some of the tools we use in package development (something related to cron). Now, I someho…

---

## [Dotted pair operator .=\>](https://discourse.julialang.org/t/dotted-pair-operator/50978)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 8:32am UTC](https://discourse.julialang.org/t/dotted-pair-operator/50978 "2020-11-30T08:32:35Z")

</div>

I just realized today that it is possible to create a dict with .=\>: julia\> Dict(\['a', 'b', 'c'\] .=\> 1:3) Dict{Char,Int64} with 3 entries: 'a' =\> 1 'c' =\> 3 'b' =\> 2 Dotted syntax for pairs: this made my day!

---

## [Nested Pipes](https://discourse.julialang.org/t/nested-pipes/49573)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [November 30, 2020, 6:12am UTC](https://discourse.julialang.org/t/nested-pipes/49573 "2020-11-30T06:12:55Z")

</div>

For a Pipe within a Pipe is there an \_ equivalent for the inner pipe ? \_\_ ? \_2 ?

---

## [Using Optim.Options (Syntax)](https://discourse.julialang.org/t/using-optim-options-syntax/50930)

<div class="topic-metadata">

**Author:** [@schubbiaschwilli](https://discourse.julialang.org/u/schubbiaschwilli)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 5:22am UTC](https://discourse.julialang.org/t/using-optim-options-syntax/50930 "2020-11-30T05:22:43Z")

</div>

Hello! I am fitting curves with 2 parameters and I’m using Optim.optimize; especially the LBFGS method because there are lower and upper bounds. —snip— Optim.optimize(par → Loss(Testdata, par), \[0.005, 0.00001\], \[1000…

---

## [Performance of recursively building tuples](https://discourse.julialang.org/t/performance-of-recursively-building-tuples/50917)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 6\
**Last updated:** [November 30, 2020, 2:51am UTC](https://discourse.julialang.org/t/performance-of-recursively-building-tuples/50917 "2020-11-30T02:51:58Z")

</div>

I was reading through the source code for broadcasting and CartesianIndices, and I noticed that there were many methods that recursively operated on tuples. I thought it strange because I thought iteration was more intui…

---

## [Us-west.pkg.julialang.org is down. How to switch to east?](https://discourse.julialang.org/t/us-west-pkg-julialang-org-is-down-how-to-switch-to-east/50973)

<div class="topic-metadata">

**Author:** [@tbenst](https://discourse.julialang.org/u/tbenst)\
**Replies:** 1\
**Last updated:** [November 30, 2020, 2:49am UTC](https://discourse.julialang.org/t/us-west-pkg-julialang-org-is-down-how-to-switch-to-east/50973 "2020-11-30T02:49:07Z")

</div>

I cannot reach us-west.pkg.julialang.org, and it appears to be down: Us-west.pkg.julialang.org down? Current problems and status. How can I temporarily switch to https://us-east.pkg.julialang.org/? Edit: as a hack work…

---

## [Writing protobuf message to a websocket](https://discourse.julialang.org/t/writing-protobuf-message-to-a-websocket/50951)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 0\
**Last updated:** [November 29, 2020, 5:56pm UTC](https://discourse.julialang.org/t/writing-protobuf-message-to-a-websocket/50951 "2020-11-29T17:56:26Z")

</div>

I’m interested in writing a server process in julia that will periodically publish protocol buffer messages over a web socket. I’ve done a little naive experimenting, and haven’t gotten very far (did manage to get an err…

---

## [Stability Issues in Optim](https://discourse.julialang.org/t/stability-issues-in-optim/50949)

<div class="topic-metadata">

**Author:** [@Gregor](https://discourse.julialang.org/u/Gregor)\
**Replies:** 0\
**Last updated:** [November 29, 2020, 5:30pm UTC](https://discourse.julialang.org/t/stability-issues-in-optim/50949 "2020-11-29T17:30:53Z")

</div>

Hello, I am trying to optimize a simple linear system towards some known parameters and switched from the ADAMs optimizer to (L)BFGS. I didn’t change the problem/ode but for some reason the (L)BFGS optimizer runs in sev…

---

## [Fitting Data](https://discourse.julialang.org/t/fitting-data/50938)

<div class="topic-metadata">

**Author:** [@WEEZEERAE](https://discourse.julialang.org/u/WEEZEERAE)\
**Replies:** 1\
**Last updated:** [November 29, 2020, 3:40pm UTC](https://discourse.julialang.org/t/fitting-data/50938 "2020-11-29T15:40:13Z")

</div>

Hello Community! I would like to know about which package you would recommend me to fit data sets, i.e received from a spectral analysis. Currently I am working with GnuPlot, but I guess there is a more accurate way to …

---

## [What is the fastest way to parse a string of numbers into a tuple / struct with different field types?](https://discourse.julialang.org/t/what-is-the-fastest-way-to-parse-a-string-of-numbers-into-a-tuple-struct-with-different-field-types/50905)

<div class="topic-metadata">

**Author:** [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Replies:** 5\
**Last updated:** [November 29, 2020, 1:51pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-way-to-parse-a-string-of-numbers-into-a-tuple-struct-with-different-field-types/50905 "2020-11-29T13:51:52Z")

</div>

Suppose I have a large table whose rows look like 3 1 2.5 4.0 10.1 and I know for sure that the first two columns are Ints and the next three are Float64s. Is there a way to use that information to write a fast parsin…

---

## [Calling Julia functions (which take custom structs as inputs) from Python](https://discourse.julialang.org/t/calling-julia-functions-which-take-custom-structs-as-inputs-from-python/50567)

<div class="topic-metadata">

**Author:** [@apg](https://discourse.julialang.org/u/apg)\
**Replies:** 9\
**Last updated:** [November 29, 2020, 7:25am UTC](https://discourse.julialang.org/t/calling-julia-functions-which-take-custom-structs-as-inputs-from-python/50567 "2020-11-29T07:25:03Z")

</div>

I’ve been trying to figure out a systematic way to call Julia functions from Python. I came across pyjulia library (in python) and PyCall modules (in julia) which seem to be pretty useful. However, most of the examples s…

---

## [Unable to numerically differentiate in Calculus.jl Integers not Reals](https://discourse.julialang.org/t/unable-to-numerically-differentiate-in-calculus-jl-integers-not-reals/49211)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 19\
**Last updated:** [November 29, 2020, 3:55am UTC](https://discourse.julialang.org/t/unable-to-numerically-differentiate-in-calculus-jl-integers-not-reals/49211 "2020-11-29T03:55:57Z")

</div>

using Calculs f(x) = sin(x) f'(1.0) - cos(1.0) When I run this, I get an error saying it doesn’t accept 64bit integers. How do I change the type of a function to a real number?

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=670)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=672)
