# General Usage

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

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

**Page:** 709

---

## [Common legend using layouts](https://discourse.julialang.org/t/common-legend-using-layouts/45553)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 4\
**Last updated:** [August 28, 2020, 1:07pm UTC](https://discourse.julialang.org/t/common-legend-using-layouts/45553 "2020-08-28T13:07:57Z")

</div>

Dear all, I am plotting this: plot(rand(32,10), layout = (2,5), legend=false) plot!(rand(32,10), layout = (2,5), legend=false) And I’d like to have just one legend saying what the blue lines stand for and what the ora…

---

## [Strange behavior when defining a function inside an \`if\`](https://discourse.julialang.org/t/strange-behavior-when-defining-a-function-inside-an-if/45684)

<div class="topic-metadata">

**Author:** [@ismedina](https://discourse.julialang.org/u/ismedina)\
**Replies:** 2\
**Last updated:** [August 28, 2020, 12:40pm UTC](https://discourse.julialang.org/t/strange-behavior-when-defining-a-function-inside-an-if/45684 "2020-08-28T12:40:50Z")

</div>

Hi! I have encountered this weird behavior when using Julia. If I define: function f(x) if x \> 0 function g() 1 end return g else function g() 0 en…

---

## [Performance of NamedArrays vs Dictionaries of Tuples](https://discourse.julialang.org/t/performance-of-namedarrays-vs-dictionaries-of-tuples/1854)

<div class="topic-metadata">

**Author:** [@NickNack](https://discourse.julialang.org/u/NickNack)\
**Replies:** 2\
**Last updated:** [August 28, 2020, 9:27am UTC](https://discourse.julialang.org/t/performance-of-namedarrays-vs-dictionaries-of-tuples/1854 "2020-08-28T09:27:58Z")

</div>

I’d like to use a datastructure with named indexes for optimization models (using JuMP or Optim) or simulation models in ordinary Julia. The main purpose of named indexes is to enhance readability of complex models. I’m …

---

## [PMAP Throws Exception on ProcessExitedException](https://discourse.julialang.org/t/pmap-throws-exception-on-processexitedexception/45667)

<div class="topic-metadata">

**Author:** [@Edward\_Wall](https://discourse.julialang.org/u/Edward_Wall)\
**Replies:** 1\
**Last updated:** [August 28, 2020, 9:13am UTC](https://discourse.julialang.org/t/pmap-throws-exception-on-processexitedexception/45667 "2020-08-28T09:13:40Z")

</div>

A short question. Is there some way to use pmap such that the following doesn’t throw an exception and crash? I have a distributed system, where a process might use too much memory and be killed by the os. This seems to …

---

## [ERROR: Unknown package DataStructures found in the compatibility requirements of DiffEqBase](https://discourse.julialang.org/t/error-unknown-package-datastructures-found-in-the-compatibility-requirements-of-diffeqbase/45650)

<div class="topic-metadata">

**Author:** [@anon22248738](https://discourse.julialang.org/u/anon22248738)\
**Replies:** 2\
**Last updated:** [August 28, 2020, 1:09am UTC](https://discourse.julialang.org/t/error-unknown-package-datastructures-found-in-the-compatibility-requirements-of-diffeqbase/45650 "2020-08-28T01:09:10Z")

</div>

I was trying to get Surrogates.jl to work on my computer but ended up with this error after trying to re-update to the current version of DiffEqFlux. Now I can’t add any packages, and Pkg.resolve() and Pkg.update() also …

---

## [Building an MPI-parallelized library with BinaryBuilder.jl using MPI.jl](https://discourse.julialang.org/t/building-an-mpi-parallelized-library-with-binarybuilder-jl-using-mpi-jl/45629)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 10\
**Last updated:** [August 27, 2020, 10:37pm UTC](https://discourse.julialang.org/t/building-an-mpi-parallelized-library-with-binarybuilder-jl-using-mpi-jl/45629 "2020-08-27T22:37:56Z")

</div>

We would like to use an external, MPI-parallelized library in our Julia project that itself is parallelized using MPI.jl. A key requirement for us, however, is to keep everything within the Julia package-sphere, thus we …

---

## [Is this a symptom of potential memory leak/corruption in Julia?](https://discourse.julialang.org/t/is-this-a-symptom-of-potential-memory-leak-corruption-in-julia/45625)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 3\
**Last updated:** [August 27, 2020, 8:10pm UTC](https://discourse.julialang.org/t/is-this-a-symptom-of-potential-memory-leak-corruption-in-julia/45625 "2020-08-27T20:10:03Z")

</div>

I had a Julia session open for 2 days. I wasn’t doing much, just testing little fragments of code. At the same time I had launched Jupyterlab with 2 Julia notebooks open and running. Julia has no contract that it is re-e…

---

## [Use of 'in' or function in array](https://discourse.julialang.org/t/use-of-in-or-function-in-array/45636)

<div class="topic-metadata">

**Author:** [@jobdiogenes](https://discourse.julialang.org/u/jobdiogenes)\
**Replies:** 2\
**Last updated:** [August 27, 2020, 6:00pm UTC](https://discourse.julialang.org/t/use-of-in-or-function-in-array/45636 "2020-08-27T18:00:46Z")

</div>

Example array: C = \[1 2 3 5;4 5 6 8;7 8 9 0; 3 6 9 12\] 4×4 Array{Int64,2}: 1 2 3 5 4 5 6 8 7 8 9 0 3 6 9 1 I could strip out cols, or rows by C\[1:end .!=2,1:end .!=3\] 3×3 Array{Int64,2}: 1 2 5…

---

## [Computing pairwise Sørensen–Dice coefficient between many BitVectors](https://discourse.julialang.org/t/computing-pairwise-sorensen-dice-coefficient-between-many-bitvectors/45567)

<div class="topic-metadata">

**Author:** [@Brian\_Thorne](https://discourse.julialang.org/u/Brian_Thorne)\
**Replies:** 4\
**Last updated:** [August 27, 2020, 3:33pm UTC](https://discourse.julialang.org/t/computing-pairwise-sorensen-dice-coefficient-between-many-bitvectors/45567 "2020-08-27T15:33:58Z")

</div>

Hi all, I’m trying to match (or ideally beat) the performance of a Python/C library (anonlink) that computes the Sørensen–Dice coefficient but I’m struggling to match the performance - except when calling the same C code…

---

## [Using @sprintf inside a macro](https://discourse.julialang.org/t/using-sprintf-inside-a-macro/45275)

<div class="topic-metadata">

**Author:** [@anj](https://discourse.julialang.org/u/anj)\
**Replies:** 31\
**Last updated:** [August 27, 2020, 3:11pm UTC](https://discourse.julialang.org/t/using-sprintf-inside-a-macro/45275 "2020-08-27T15:11:47Z")

</div>

I need to prefix my log lines with a timestamp. so I was thinking overloading @printf along those lines import Printf.@printf macro printf(args...) tmp\_str = @sprintf(args...) return :(print(now(), " : ", tmp\_s…

---

## [A minor group-by benchmark - DataFrames.jl plenty fast](https://discourse.julialang.org/t/a-minor-group-by-benchmark-dataframes-jl-plenty-fast/45622)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 5\
**Last updated:** [August 27, 2020, 3:00pm UTC](https://discourse.julialang.org/t/a-minor-group-by-benchmark-dataframes-jl-plenty-fast/45622 "2020-08-27T15:00:39Z")

</div>

I once made a FastGroupBy.jl to do some fast group by but now DataFrames.jl is plenty fast by itself! DataFrames.jl has done lots of optimizations, I wonder what’s been done. Database-like ops benchmark is showing real…

---

## [Cygdrive/StackOverflowError() error - any ideas how to fix this?](https://discourse.julialang.org/t/cygdrive-stackoverflowerror-error-any-ideas-how-to-fix-this/45589)

<div class="topic-metadata">

**Author:** [@cbasile21](https://discourse.julialang.org/u/cbasile21)\
**Replies:** 0\
**Last updated:** [August 26, 2020, 7:11pm UTC](https://discourse.julialang.org/t/cygdrive-stackoverflowerror-error-any-ideas-how-to-fix-this/45589 "2020-08-26T19:11:30Z")

</div>

Hi All, every time I run any code ever since I started using version 1.4 the following pops up, any ideas of how to fix it. I am thinking of jumping to version 1.5 , (Now I am using version 1.5.1) again thank you! Some…

---

## [Package does not meet sequential version number guideline](https://discourse.julialang.org/t/package-does-not-meet-sequential-version-number-guideline/44752)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 16\
**Last updated:** [August 27, 2020, 1:29pm UTC](https://discourse.julialang.org/t/package-does-not-meet-sequential-version-number-guideline/44752 "2020-08-27T13:29:40Z")

</div>

I keep getting these messages when registering new versions of my package. But I do not see how I am not following the guideline, I released a patch and changed the version from 0.2.0 to 0.2.1 and after fixing another mi…

---

## [Output in loops (Pluto.jl)](https://discourse.julialang.org/t/output-in-loops-pluto-jl/45597)

<div class="topic-metadata">

**Author:** [@joergbuchwald](https://discourse.julialang.org/u/joergbuchwald)\
**Replies:** 1\
**Last updated:** [August 27, 2020, 10:50am UTC](https://discourse.julialang.org/t/output-in-loops-pluto-jl/45597 "2020-08-27T10:50:34Z")

</div>

Hi! Is there an elegant way for printing output in loops in pluto notebooks, i.e., something like for i in 1:3 md"test: $(i)" end without concatenating the multiline string and output it afterward?

---

## [Is it possible in Julia?: Support a limited type inference version in order to decide whether a function is defined or not](https://discourse.julialang.org/t/is-it-possible-in-julia-support-a-limited-type-inference-version-in-order-to-decide-whether-a-function-is-defined-or-not/45509)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 20\
**Last updated:** [August 27, 2020, 8:33am UTC](https://discourse.julialang.org/t/is-it-possible-in-julia-support-a-limited-type-inference-version-in-order-to-decide-whether-a-function-is-defined-or-not/45509 "2020-08-27T08:33:28Z")

</div>

I think it would be a super helpful addition to the julia ecosystem if we could check whether some function is defined for certain arguments or not. To be precise, I don’t refer to applicable or hasmethod. They only che…

---

## [Question about call the Pkg in python](https://discourse.julialang.org/t/question-about-call-the-pkg-in-python/45602)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 0\
**Last updated:** [August 27, 2020, 2:17am UTC](https://discourse.julialang.org/t/question-about-call-the-pkg-in-python/45602 "2020-08-27T02:17:28Z")

</div>

my code: using PyCall, Conda root = Conda.ROOTENV pipPath = joinpath(root, "bin", "pip") \`$(pipPath) install KMeans\_elbow\` Conda.add("KMeans\_elbow") KM=pyimport("KMeans\_elbow") the error: ERROR: LoadError: failed proc…

---

## [Stop running code pasted into REPL on first error](https://discourse.julialang.org/t/stop-running-code-pasted-into-repl-on-first-error/44637)

<div class="topic-metadata">

**Author:** [@fredcallaway](https://discourse.julialang.org/u/fredcallaway)\
**Replies:** 20\
**Last updated:** [August 27, 2020, 1:11am UTC](https://discourse.julialang.org/t/stop-running-code-pasted-into-repl-on-first-error/44637 "2020-08-27T01:11:02Z")

</div>

Hi there, first time poster so not sure if this is the appropriate venue for this. My workflow involves writing code in a text editor and pasting it into a terminal (I use the Terminus and SendCode plugins in Sublime Te…

---

## [Interpolations WeightedIndex trouble](https://discourse.julialang.org/t/interpolations-weightedindex-trouble/45547)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 4\
**Last updated:** [August 27, 2020, 12:47am UTC](https://discourse.julialang.org/t/interpolations-weightedindex-trouble/45547 "2020-08-27T00:47:46Z")

</div>

Have a bit of an advanced Interpolations.jl question here… I guess I just don’t understand how to use the weightedindices or its output. Based on the docs, I assumed that I pass it the point to which I would want to int…

---

## [Null bytes in repl\_history on shared home directory](https://discourse.julialang.org/t/null-bytes-in-repl-history-on-shared-home-directory/42471)

<div class="topic-metadata">

**Author:** [@lhupe](https://discourse.julialang.org/u/lhupe)\
**Replies:** 3\
**Last updated:** [August 26, 2020, 7:43pm UTC](https://discourse.julialang.org/t/null-bytes-in-repl-history-on-shared-home-directory/42471 "2020-08-26T19:43:56Z")

</div>

I’m currently using julia on a network of computers with shared home directories. I’ve noticed that when I open REPLs on two machines simultaneously, the repl\_history.jl file gets corrupted and I get this error message t…

---

## [Type parameters by default?](https://discourse.julialang.org/t/type-parameters-by-default/45577)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 4\
**Last updated:** [August 26, 2020, 6:23pm UTC](https://discourse.julialang.org/t/type-parameters-by-default/45577 "2020-08-26T18:23:27Z")

</div>

Hi everyone, I’ve noticed a pattern in my Julia code and I wondered if it would make sense to have some compiler technology to automatically add type parameters for fields that have no explicit type. For example, consi…

---

## [Easier way to assign a variable to a row of an array?](https://discourse.julialang.org/t/easier-way-to-assign-a-variable-to-a-row-of-an-array/45545)

<div class="topic-metadata">

**Author:** [@Jaepil\_Lee](https://discourse.julialang.org/u/Jaepil_Lee)\
**Replies:** 2\
**Last updated:** [August 26, 2020, 4:15pm UTC](https://discourse.julialang.org/t/easier-way-to-assign-a-variable-to-a-row-of-an-array/45545 "2020-08-26T16:15:28Z")

</div>

Hello Julia users! I am trying to make a hypothetical dataset of variables X2, Z1, Z2, and ε with some mean and covariance. Using Distributions and Random packages works just fine, but I was wondering if I can assign th…

---

## [Union splitting over abstract types](https://discourse.julialang.org/t/union-splitting-over-abstract-types/45568)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 5\
**Last updated:** [August 26, 2020, 2:59pm UTC](https://discourse.julialang.org/t/union-splitting-over-abstract-types/45568 "2020-08-26T14:59:18Z")

</div>

If I have an abstract type X whose only subtypes are A and B, will union-splitting kick in and make dispatching over an object inferred as X as efficient as dispatching over one inferred as Union{A, B}?

---

## [Question about PyCall](https://discourse.julialang.org/t/question-about-pycall/45565)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [August 26, 2020, 2:15pm UTC](https://discourse.julialang.org/t/question-about-pycall/45565 "2020-08-26T14:15:59Z")

</div>

this is my code : using PyCall, Conda pyexec = pyimport("KMeans\_elbow") this is the error: ERROR: LoadError: PyError (PyImport\_ImportModule The Python package KMeans\_elbow could not be found by pyimport. Usually this…

---

## [Plotly(JS) fails due to ORCA](https://discourse.julialang.org/t/plotly-js-fails-due-to-orca/45090)

<div class="topic-metadata">

**Author:** [@omrilesser](https://discourse.julialang.org/u/omrilesser)\
**Replies:** 1\
**Last updated:** [August 26, 2020, 1:41pm UTC](https://discourse.julialang.org/t/plotly-js-fails-due-to-orca/45090 "2020-08-26T13:41:29Z")

</div>

I’m trying to use Plots.jl with PlotlyJS for simple plotting, for example: using Plots plotlyjs() x = range(0,stop=1,length=100) y = x.^2 Plots.plot(x,y, legend=false, linecolor="red") This fails in the ORCA precompila…

---

## [Parallel testing](https://discourse.julialang.org/t/parallel-testing/45574)

<div class="topic-metadata">

**Author:** [@kulowf](https://discourse.julialang.org/u/kulowf)\
**Replies:** 0\
**Last updated:** [August 26, 2020, 12:56pm UTC](https://discourse.julialang.org/t/parallel-testing/45574 "2020-08-26T12:56:48Z")

</div>

parallel testing How i make parallel test for many testfunctions with separate outputs? The test sources use in many ways stdout, stderr. A redirect is for threads separatly not possible!? The example has only one testf…

---

## [Observe stderr](https://discourse.julialang.org/t/observe-stderr/45533)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 5\
**Last updated:** [August 26, 2020, 7:03am UTC](https://discourse.julialang.org/t/observe-stderr/45533 "2020-08-26T07:03:44Z")

</div>

Is there a way to have an observable containing a number (let’s say float) that updates on updates to stderr, but where the stderr is a string that contains in it the number to be pushed into the observable? So if I run…

---

## [Return multiple values not in a tuple?](https://discourse.julialang.org/t/return-multiple-values-not-in-a-tuple/45234)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 7\
**Last updated:** [August 26, 2020, 4:13am UTC](https://discourse.julialang.org/t/return-multiple-values-not-in-a-tuple/45234 "2020-08-26T04:13:26Z")

</div>

I have a function that takes several arguments. I have another function that returns several values. I’d like the second function to be able to directly feed the first. But my attempt doesn’t work because multiple return…

---

## [In place copying and duplication](https://discourse.julialang.org/t/in-place-copying-and-duplication/45535)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 5\
**Last updated:** [August 25, 2020, 10:16pm UTC](https://discourse.julialang.org/t/in-place-copying-and-duplication/45535 "2020-08-25T22:16:43Z")

</div>

Suppose I have an instance of a nontrivial data structure x, of type mytype that I would like to copy over into a new instance of mytype, y, and I would like to do this in as efficient a manner as possible. If these wer…

---

## [What do people think about the package mode being persistent?](https://discourse.julialang.org/t/what-do-people-think-about-the-package-mode-being-persistent/45527)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 13\
**Last updated:** [August 25, 2020, 9:44pm UTC](https://discourse.julialang.org/t/what-do-people-think-about-the-package-mode-being-persistent/45527 "2020-08-25T21:44:53Z")

</div>

The package mode is persistent. Once you hit \] Julia is in package mode until one hits the backspace. I find that a bit annoying at times. Especially when I do something in package mode, forget about it, and then try to…

---

## [Compiling a portable shared lib with PackageCompiler](https://discourse.julialang.org/t/compiling-a-portable-shared-lib-with-packagecompiler/45513)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 2\
**Last updated:** [August 25, 2020, 4:17pm UTC](https://discourse.julialang.org/t/compiling-a-portable-shared-lib-with-packagecompiler/45513 "2020-08-25T16:17:27Z")

</div>

So, I’m in a situation at work where I’m trying to build a docker image to run on the “AWS Batch” service (it just runs docker containers), preferably with a compiled system image from PackageCompiler. My docker images …

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

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