# General Usage

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

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

**Page:** 699

---

## [Read-all echo TCP server](https://discourse.julialang.org/t/read-all-echo-tcp-server/47107)

<div class="topic-metadata">

**Author:** [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Replies:** 8\
**Last updated:** [September 23, 2020, 10:23pm UTC](https://discourse.julialang.org/t/read-all-echo-tcp-server/47107 "2020-09-23T22:23:50Z")

</div>

I need to write a Julia server that reads the entire message coming from a client, and then sends a reply back. However, it seems that when the message is read, the socket gets closed, so I can’t write the reply. Server…

---

## [How to speed up tasks?](https://discourse.julialang.org/t/how-to-speed-up-tasks/46511)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 8\
**Last updated:** [September 23, 2020, 9:58pm UTC](https://discourse.julialang.org/t/how-to-speed-up-tasks/46511 "2020-09-23T21:58:59Z")

</div>

i have a function that i need to call 10s of thousands of times that only takes a few milliseconds to run. there is no I/O. and it doesn’t return anything, so no communication. it is strictly just compute. how do i b…

---

## [solve(ODEAdjointProblem(...)) with timespan different from the input solution](https://discourse.julialang.org/t/solve-odeadjointproblem-with-timespan-different-from-the-input-solution/47120)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 2\
**Last updated:** [September 23, 2020, 9:27pm UTC](https://discourse.julialang.org/t/solve-odeadjointproblem-with-timespan-different-from-the-input-solution/47120 "2020-09-23T21:27:17Z")

</div>

I’m currently doing all my ODE adjoint solves with something like fwd\_sol = solve(ODEProblem(f, (0.0, 1.0))) solve(ODEAdjointProblem(fwd\_sol, InterpolatingAdjoint(), (out, x, p, t, i) -\> (out\[:\] = g), \[1.0\])) which is …

---

## [Minimizing a numerical function](https://discourse.julialang.org/t/minimizing-a-numerical-function/47139)

<div class="topic-metadata">

**Author:** [@DShiu](https://discourse.julialang.org/u/DShiu)\
**Replies:** 8\
**Last updated:** [September 23, 2020, 5:30pm UTC](https://discourse.julialang.org/t/minimizing-a-numerical-function/47139 "2020-09-23T17:30:41Z")

</div>

I am using Optim.jl to minimize a function: optimize(δ-\> nls\_obj(δ, theta2, y, c, d, p0, B), 0, LBFGS(), Optim.Options(g\_tol = 1e-2, iterations=100\_000, show\_trace=true, show\_every=50)) Given other input values, functi…

---

## [Numerical integration for array](https://discourse.julialang.org/t/numerical-integration-for-array/47043)

<div class="topic-metadata">

**Author:** [@DShiu](https://discourse.julialang.org/u/DShiu)\
**Replies:** 17\
**Last updated:** [September 23, 2020, 4:16pm UTC](https://discourse.julialang.org/t/numerical-integration-for-array/47043 "2020-09-23T16:16:31Z")

</div>

I have a function f(x1, x2) that returns an array. I need to compute a definite integral for each element of the returned array over a space of (x1, x2). I am considering writing a Monte Carlo integration inside functio…

---

## [Why Combinatorics package doesn't warn of overflow?](https://discourse.julialang.org/t/why-combinatorics-package-doesnt-warn-of-overflow/47136)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [September 23, 2020, 2:54pm UTC](https://discourse.julialang.org/t/why-combinatorics-package-doesnt-warn-of-overflow/47136 "2020-09-23T14:54:20Z")

</div>

This is dangerous, as the following code doesn’t emit any warning, just give very different results (I assume due to overflowing ???) using Combinatorics # 4 players get exactly one ace each: sol1 = 4 \* 3 \*2 \* multinom…

---

## [Dictionaries with abstract types for keys/values as function arguments](https://discourse.julialang.org/t/dictionaries-with-abstract-types-for-keys-values-as-function-arguments/47063)

<div class="topic-metadata">

**Author:** [@MJHutchinson](https://discourse.julialang.org/u/MJHutchinson)\
**Replies:** 7\
**Last updated:** [September 23, 2020, 2:43pm UTC](https://discourse.julialang.org/t/dictionaries-with-abstract-types-for-keys-values-as-function-arguments/47063 "2020-09-23T14:43:53Z")

</div>

I am currently writing a library that for a number of applications needs to take a dictionary of matrices as arguments. In order to make the functions reasonably general, I wanted to make the key/value types in the funct…

---

## [Pretty macroexpand in Base?](https://discourse.julialang.org/t/pretty-macroexpand-in-base/47132)

<div class="topic-metadata">

**Author:** [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)\
**Replies:** 6\
**Last updated:** [September 23, 2020, 1:22pm UTC](https://discourse.julialang.org/t/pretty-macroexpand-in-base/47132 "2020-09-23T13:22:59Z")

</div>

Whenever I talk to someone about macros, I always suggest they start by looking at the expansion of the macro. But the default expansion isn’t super readable because of LineNumberNode’s, gensyms, etc. So I almost always…

---

## [Experimental reproducibility: julia vs the rest](https://discourse.julialang.org/t/experimental-reproducibility-julia-vs-the-rest/46769)

<div class="topic-metadata">

**Author:** [@healyp](https://discourse.julialang.org/u/healyp)\
**Replies:** 13\
**Last updated:** [September 23, 2020, 12:40pm UTC](https://discourse.julialang.org/t/experimental-reproducibility-julia-vs-the-rest/46769 "2020-09-23T12:40:27Z")

</div>

One of the things I find very appealing about julia is the ability to provide, through {Project,Manifest}.toml files, the exact environment some code was run in so enabling somebody else to reproduce the results generate…

---

## [Soft vs Hard Scopes, Macros, and \`@everywhere\`](https://discourse.julialang.org/t/soft-vs-hard-scopes-macros-and-everywhere/47124)

<div class="topic-metadata">

**Author:** [@chisquared](https://discourse.julialang.org/u/chisquared)\
**Replies:** 3\
**Last updated:** [September 23, 2020, 12:23pm UTC](https://discourse.julialang.org/t/soft-vs-hard-scopes-macros-and-everywhere/47124 "2020-09-23T12:23:44Z")

</div>

I’m reading the section on the manual regarding the scope of variables: https://docs.julialang.org/en/v1.5/manual/variables-and-scoping/ It says that macros introduce a hard local scope. There is some ambiguity here wh…

---

## [\[ANN\] CuCountMap.jl - CUDA.jl-enabled faster \`StatsBase.countmap\` for small types](https://discourse.julialang.org/t/ann-cucountmap-jl-cuda-jl-enabled-faster-statsbase-countmap-for-small-types/47125)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 0\
**Last updated:** [September 23, 2020, 9:45am UTC](https://discourse.julialang.org/t/ann-cucountmap-jl-cuda-jl-enabled-faster-statsbase-countmap-for-small-types/47125 "2020-09-23T09:45:30Z")

</div>

See GitHub - xiaodaigh/CuCountMap.jl: Fast \`StatsBase.countmap\` for small types on the GPU via CUDA.jl I can get about 3x the performance for small types on the GPU via CUDA.jl vs a purely CPU implementation. This is in…

---

## [Help eliminating allocations in a call to a Fortran subroutine](https://discourse.julialang.org/t/help-eliminating-allocations-in-a-call-to-a-fortran-subroutine/47078)

<div class="topic-metadata">

**Author:** [@zyth0s](https://discourse.julialang.org/u/zyth0s)\
**Replies:** 2\
**Last updated:** [September 22, 2020, 5:09pm UTC](https://discourse.julialang.org/t/help-eliminating-allocations-in-a-call-to-a-fortran-subroutine/47078 "2020-09-22T17:09:17Z")

</div>

I would like to ask you for help to improve a call to a critical routine written in Fortran. A minimal version of the library is the following Fortran library sourcemodule fortran\_lib contains subroutine density\_gra…

---

## [Show axis border when legend is outside plot](https://discourse.julialang.org/t/show-axis-border-when-legend-is-outside-plot/46970)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [September 23, 2020, 9:38am UTC](https://discourse.julialang.org/t/show-axis-border-when-legend-is-outside-plot/46970 "2020-09-23T09:38:12Z")

</div>

Hi all- Is it possible to show the right y-axis border when placing the legend outside the plot? Thanks. using Plots pyplot() plot(rand(10), legend = :outertopright)

---

## [Package Pkg not found in current path AppVeyor julia Nightly #2032](https://discourse.julialang.org/t/package-pkg-not-found-in-current-path-appveyor-julia-nightly-2032/47118)

<div class="topic-metadata">

**Author:** [@Saer\_Samanipour1](https://discourse.julialang.org/u/Saer_Samanipour1)\
**Replies:** 0\
**Last updated:** [September 23, 2020, 7:37am UTC](https://discourse.julialang.org/t/package-pkg-not-found-in-current-path-appveyor-julia-nightly-2032/47118 "2020-09-23T07:37:09Z")

</div>

Hi, When I test my code via CI services such as AppVeyor for julia Nightly I get the below error. Would appreciate any help there. Cheers, Saer code using CompCreate using Test using JLD using CSV using DataFra…

---

## [How to obtain a Julia 1.4.1 kernel in Jupyter on Windows 10?](https://discourse.julialang.org/t/how-to-obtain-a-julia-1-4-1-kernel-in-jupyter-on-windows-10/47106)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 2\
**Last updated:** [September 23, 2020, 2:29am UTC](https://discourse.julialang.org/t/how-to-obtain-a-julia-1-4-1-kernel-in-jupyter-on-windows-10/47106 "2020-09-23T02:29:34Z")

</div>

Hello, I have Julia 1.3.0 available as a kernel in Jupyter Lab, and I’ve installed the IJulia package in my installation of Julia 1.4.1. But when I open Jupyter Lab, there is no 1.4.1. kernel there. I can’t remember b…

---

## [Stable hashing across Julia versions](https://discourse.julialang.org/t/stable-hashing-across-julia-versions/44423)

<div class="topic-metadata">

**Author:** [@grero](https://discourse.julialang.org/u/grero)\
**Replies:** 7\
**Last updated:** [September 23, 2020, 2:22am UTC](https://discourse.julialang.org/t/stable-hashing-across-julia-versions/44423 "2020-09-23T02:22:57Z")

</div>

Did something change with respect to hashing since 1.4.2? I have code that checks whether data have already been computed by checking a hash of the arguments used to compute the data, and I appear to be getting different…

---

## [Replicating Ruby's dig() in Julia](https://discourse.julialang.org/t/replicating-rubys-dig-in-julia/20551)

<div class="topic-metadata">

**Author:** [@Amval](https://discourse.julialang.org/u/Amval)\
**Replies:** 6\
**Last updated:** [September 23, 2020, 12:33am UTC](https://discourse.julialang.org/t/replicating-rubys-dig-in-julia/20551 "2020-09-23T00:33:44Z")

</div>

Hello, in Ruby there’s a method useful for navigating nested dictionaries called dig() nested = Dict( :a =\> Dict( :b =\> "b", :c =\> Dict( :d =\> "d" ) ) ) dig(nested, :a, :b) …

---

## [Windows 10: Package operations slow](https://discourse.julialang.org/t/windows-10-package-operations-slow/46355)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 15\
**Last updated:** [September 22, 2020, 11:33pm UTC](https://discourse.julialang.org/t/windows-10-package-operations-slow/46355 "2020-09-22T23:33:53Z")

</div>

Erase .julia. Activate and instantiate an environment. Windows 10:126 seconds WSL2: 13 seconds Is there a solution?

---

## [State of the Art in Combinator Parsers?](https://discourse.julialang.org/t/state-of-the-art-in-combinator-parsers/40935)

<div class="topic-metadata">

**Author:** [@tro3](https://discourse.julialang.org/u/tro3)\
**Replies:** 8\
**Last updated:** [September 22, 2020, 8:30pm UTC](https://discourse.julialang.org/t/state-of-the-art-in-combinator-parsers/40935 "2020-09-22T20:30:10Z")

</div>

I have need of parsing in a few different languages, so I sat down to find the Julia equivalent of Parsec (Haskell) or pyparsing (Python). There is ParserCombinator.jl, but does not appear to be maintained (or functiona…

---

## [WebIO unresponsive over Apache proxy](https://discourse.julialang.org/t/webio-unresponsive-over-apache-proxy/47091)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 0\
**Last updated:** [September 22, 2020, 7:02pm UTC](https://discourse.julialang.org/t/webio-unresponsive-over-apache-proxy/47091 "2020-09-22T19:02:07Z")

</div>

We have this WebIO app of which we’re trying to run multiple instances, each with its own Julia process. So myserver/app1 is served by process 1 at myserver:8001, and so on for app2, 3 etc. The Apache config looks like …

---

## [DecFP.jl no longer precompiling on Julia v1.6 (master)](https://discourse.julialang.org/t/decfp-jl-no-longer-precompiling-on-julia-v1-6-master/47032)

<div class="topic-metadata">

**Author:** [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Replies:** 3\
**Last updated:** [September 22, 2020, 4:58pm UTC](https://discourse.julialang.org/t/decfp-jl-no-longer-precompiling-on-julia-v1-6-master/47032 "2020-09-22T16:58:16Z")

</div>

julia\> using DecFP \[ Info: Precompiling DecFP \[55939f99-70c6-5e9b-8bb0-5071ed7d61fd\] ERROR: LoadError: UndefVarError: libbid not defined Stacktrace: \[1\] \_parse(#unused#::Type{DecFP.Dec32}, s::String) @ DecFP ~/.julia…

---

## [HTTP.jl no longer precompiling on Julia v1.6 (i.e. master)](https://discourse.julialang.org/t/http-jl-no-longer-precompiling-on-julia-v1-6-i-e-master/47028)

<div class="topic-metadata">

**Author:** [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Replies:** 4\
**Last updated:** [September 22, 2020, 4:10pm UTC](https://discourse.julialang.org/t/http-jl-no-longer-precompiling-on-julia-v1-6-i-e-master/47028 "2020-09-22T16:10:24Z")

</div>

Sometime within the last week or two, it seems that HTTP.jl will no longer precompile on a recently built Julia. julia\> using HTTP \[ Info: Precompiling HTTP \[cd3eb016-35fb-5094-929b-558a96fad6f3\] ERROR: LoadError: LoadE…

---

## [How to find missing dependencies of .jl file without executing it](https://discourse.julialang.org/t/how-to-find-missing-dependencies-of-jl-file-without-executing-it/47049)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 8\
**Last updated:** [September 22, 2020, 2:54pm UTC](https://discourse.julialang.org/t/how-to-find-missing-dependencies-of-jl-file-without-executing-it/47049 "2020-09-22T14:54:15Z")

</div>

I have a program consisting of a single .jl file, which is using a bunch of packages with directive using. There is more of them than absolutely necessary, since sometimes it’s not clear from documentation what is the ba…

---

## [Activate project in multiple cores when running script from command line](https://discourse.julialang.org/t/activate-project-in-multiple-cores-when-running-script-from-command-line/47074)

<div class="topic-metadata">

**Author:** [@AAL](https://discourse.julialang.org/u/AAL)\
**Replies:** 0\
**Last updated:** [September 22, 2020, 2:32pm UTC](https://discourse.julialang.org/t/activate-project-in-multiple-cores-when-running-script-from-command-line/47074 "2020-09-22T14:32:16Z")

</div>

I have a project folder with a package that can make computations in parallel processes and a script that makes use of the package. Because I want my script to run in parallel I need to load the package in all process, s…

---

## [How do I make a dynamic website with the help of genie.jl?](https://discourse.julialang.org/t/how-do-i-make-a-dynamic-website-with-the-help-of-genie-jl/47072)

<div class="topic-metadata">

**Author:** [@babaid](https://discourse.julialang.org/u/babaid)\
**Replies:** 0\
**Last updated:** [September 22, 2020, 2:18pm UTC](https://discourse.julialang.org/t/how-do-i-make-a-dynamic-website-with-the-help-of-genie-jl/47072 "2020-09-22T14:18:07Z")

</div>

I recently started with genie.jl, and I would like to know how I can manage so everything works together. My first test project would be a page where a user can sign up, and another where he can login. My question would …

---

## [Whos element of vector y is in Set x](https://discourse.julialang.org/t/whos-element-of-vector-y-is-in-set-x/47065)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [September 22, 2020, 1:05pm UTC](https://discourse.julialang.org/t/whos-element-of-vector-y-is-in-set-x/47065 "2020-09-22T13:05:23Z")

</div>

I have a long vectros of strings. How to do this fasastest ? julia\> x=\["a" "b"\] 1×2 Array{String,2}: "a" "b" julia\> x=\["a", "b"\] 2-element Array{String,1}: "a" "b" julia\> y=\["a","c","b","a","b"\] 5-element Array{St…

---

## [Dict's different behavior for using and include](https://discourse.julialang.org/t/dicts-different-behavior-for-using-and-include/47058)

<div class="topic-metadata">

**Author:** [@N5N3](https://discourse.julialang.org/u/N5N3)\
**Replies:** 2\
**Last updated:** [September 22, 2020, 10:59am UTC](https://discourse.julialang.org/t/dicts-different-behavior-for-using-and-include/47058 "2020-09-22T10:59:26Z")

</div>

First, I created a file named DictTest.jl with the following content: module DictTest data = Dict(GlobalRef(Base,:sum) =\> GlobalRef(Base,:prod), 1 =\> GlobalRef(Base,:sum)) end and put the file into the JULIA\_LOAD\_P…

---

## [\`\] update Foo\` vs \`\] up Foo\`](https://discourse.julialang.org/t/update-foo-vs-up-foo/46738)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 13\
**Last updated:** [September 22, 2020, 8:03am UTC](https://discourse.julialang.org/t/update-foo-vs-up-foo/46738 "2020-09-22T08:03:08Z")

</div>

Ok, so I recently discovered – much to my surprise – that \] update Foo in fact updates all of the packages in my project. To update a single package you have to instead do \] up Foo. This is super, super confusing. I’ve b…

---

## [Iterating n items at a time and filling](https://discourse.julialang.org/t/iterating-n-items-at-a-time-and-filling/47045)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 5\
**Last updated:** [September 22, 2020, 7:46am UTC](https://discourse.julialang.org/t/iterating-n-items-at-a-time-and-filling/47045 "2020-09-22T07:46:33Z")

</div>

In Slack, @mastrof wanted the equivalent of the following Python 3 code which returns n items at a time and pads with fillvalue if there are less than n items remaining def f(iterable, n, fillvalue=None): args = \[it…

---

## [Improving the code speed by employing parallelism for asynchronous task](https://discourse.julialang.org/t/improving-the-code-speed-by-employing-parallelism-for-asynchronous-task/47041)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 5\
**Last updated:** [September 22, 2020, 7:06am UTC](https://discourse.julialang.org/t/improving-the-code-speed-by-employing-parallelism-for-asynchronous-task/47041 "2020-09-22T07:06:01Z")

</div>

I was trying to employ parallelism to improve the speed of the code using multi-threading. However, I noticed that I get wrong answer using multi-threading. The reason for that is my code update a value in a for loop con…

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

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