# General Usage

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

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

**Page:** 819

---

## [Advice on working with a "persistent" Julia Docker image](https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 1\
**Last updated:** [November 1, 2019, 12:27pm UTC](https://discourse.julialang.org/t/advice-on-working-with-a-persistent-julia-docker-image/30574 "2019-11-01T12:27:32Z")

</div>

I am using Julia docker but I want to make the packages I install persist across sessions. Is the best way to just mount a directory using the -v option and point Julia to that directory for all package installs? e.g. …

---

## [Is it possible to integrate the similar functions into one?](https://discourse.julialang.org/t/is-it-possible-to-integrate-the-similar-functions-into-one/30576)

<div class="topic-metadata">

**Author:** [@Yan](https://discourse.julialang.org/u/Yan)\
**Replies:** 7\
**Last updated:** [November 1, 2019, 12:00pm UTC](https://discourse.julialang.org/t/is-it-possible-to-integrate-the-similar-functions-into-one/30576 "2019-11-01T12:00:35Z")

</div>

Is it possible to integrate the similar functions into one, by expending its abilities. For instance: max; maximum; findmax.

---

## [Matplotlib Jupyter extension and Plots/PyPlot.jl?](https://discourse.julialang.org/t/matplotlib-jupyter-extension-and-plots-pyplot-jl/30579)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 0\
**Last updated:** [November 1, 2019, 10:51am UTC](https://discourse.julialang.org/t/matplotlib-jupyter-extension-and-plots-pyplot-jl/30579 "2019-11-01T10:51:25Z")

</div>

Did anyone manage to make the Matplotlib Jupyter extension work with PyPlot.jl resp. Plots with the PyPlot backend?

---

## [How to Create new method signature on union of types](https://discourse.julialang.org/t/how-to-create-new-method-signature-on-union-of-types/30375)

<div class="topic-metadata">

**Author:** [@Fisheryu1234](https://discourse.julialang.org/u/Fisheryu1234)\
**Replies:** 3\
**Last updated:** [November 1, 2019, 8:14am UTC](https://discourse.julialang.org/t/how-to-create-new-method-signature-on-union-of-types/30375 "2019-11-01T08:14:46Z")

</div>

First we create a composite type AffineExpression using struct struct AffineExpression variables::Vector{Variable} coeffs::Vector{Float64} constant::Float64 end Then we define the expression “+” as AffineE…

---

## [Nested parallelization in Julia?](https://discourse.julialang.org/t/nested-parallelization-in-julia/30568)

<div class="topic-metadata">

**Author:** [@bashonubuntu](https://discourse.julialang.org/u/bashonubuntu)\
**Replies:** 4\
**Last updated:** [November 1, 2019, 6:30am UTC](https://discourse.julialang.org/t/nested-parallelization-in-julia/30568 "2019-11-01T06:30:21Z")

</div>

Hello, I was curious to know if there has been some thought regarding nested parallelization in julia. For example, a typical parallelizable routine with a for loop inside may look like function my\_parallel\_function() …

---

## [Partial transpose / block transpose of matrix: transpose!() overwritten](https://discourse.julialang.org/t/partial-transpose-block-transpose-of-matrix-transpose-overwritten/30521)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 5\
**Last updated:** [October 31, 2019, 5:13pm UTC](https://discourse.julialang.org/t/partial-transpose-block-transpose-of-matrix-transpose-overwritten/30521 "2019-10-31T17:13:49Z")

</div>

I’m writing a function to do partial transpose of some matrix. Mathematically, consider a d1-by-d1 blocked matrix, where each block is d2-by-d2, such that the whole matrix is n-by-n, with n=d1\*d2. The partial transpose I…

---

## [Plotting broken?](https://discourse.julialang.org/t/plotting-broken/29692)

<div class="topic-metadata">

**Author:** [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Replies:** 19\
**Last updated:** [October 31, 2019, 3:13pm UTC](https://discourse.julialang.org/t/plotting-broken/29692 "2019-10-31T15:13:21Z")

</div>

After upgrading (in Atom + Juno on Ubuntu 19.04 inside VirtualBox) julia-client from 0.10.1 to 0.11.2, uber-juno from 0.2.0 to 0.3.0 I find the following problem. Any help? julia\> using Plots julia\> plot(1:5) Error s…

---

## ["Getvalue" and "JuMP.value" -\> collection JuMP decision variables](https://discourse.julialang.org/t/getvalue-and-jump-value-collection-jump-decision-variables/30510)

<div class="topic-metadata">

**Author:** [@baprata](https://discourse.julialang.org/u/baprata)\
**Replies:** 6\
**Last updated:** [October 31, 2019, 1:41pm UTC](https://discourse.julialang.org/t/getvalue-and-jump-value-collection-jump-decision-variables/30510 "2019-10-31T13:41:40Z")

</div>

I have the following decision variables in JuMP: @variable(model, x\[j in positions, k in orders, i in machines\], Bin) @variable(model, D\[i in machines, j in positions\] \>=0) The functions “getvalue” or “JuMP.value” are…

---

## [Loading Images is very slow, is there a work around?](https://discourse.julialang.org/t/loading-images-is-very-slow-is-there-a-work-around/30529)

<div class="topic-metadata">

**Author:** [@onetonfoot](https://discourse.julialang.org/u/onetonfoot)\
**Replies:** 2\
**Last updated:** [October 31, 2019, 10:06am UTC](https://discourse.julialang.org/t/loading-images-is-very-slow-is-there-a-work-around/30529 "2019-10-31T10:06:04Z")

</div>

Loading images seems to be very slow? Comparing my Julia code to Python using BenchmarkTools, FileIO path = "/home/dom/Pictures/sd1/jpegs/DSCF0201.jpg" @btime load(path); # 1.890 s (245 allocations: 206.01 MiB) Vs f…

---

## [Documentation List of Packages . Wher is list of them?](https://discourse.julialang.org/t/documentation-list-of-packages-wher-is-list-of-them/30503)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 10\
**Last updated:** [October 31, 2019, 8:58am UTC](https://discourse.julialang.org/t/documentation-list-of-packages-wher-is-list-of-them/30503 "2019-10-31T08:58:31Z")

</div>

Existing list o pacakges is not usefull . https://pkg.julialang.org/docs/ Where is full list of them ? i.e. alfabetical ? Thanks Paul

---

## [Status of and need for ParallelAccelerator](https://discourse.julialang.org/t/status-of-and-need-for-parallelaccelerator/19277)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 2\
**Last updated:** [October 31, 2019, 8:43am UTC](https://discourse.julialang.org/t/status-of-and-need-for-parallelaccelerator/19277 "2019-10-31T08:43:25Z")

</div>

I just notice it’s one of the packages that hasn’t been upgraded, still stuck on 0.6. I’m just thinking is this more of a testament of there no longer being a need with Julia 1.0+ much faster with or without say thread …

---

## [Save complex array into h5 file](https://discourse.julialang.org/t/save-complex-array-into-h5-file/30516)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 15\
**Last updated:** [October 31, 2019, 7:34am UTC](https://discourse.julialang.org/t/save-complex-array-into-h5-file/30516 "2019-10-31T07:34:03Z")

</div>

Why this does not work? what is the appropriate syntax ? f = h5open("file.h5", "w") dset\_f = d\_create(f, "psi", datatype(Complex{Float64}), dataspace(5, 5, 10)) for i in 1:10 dset\_f\[:, :, i\] = zeros(Complex{Float64}…

---

## [How to get the non-Nothing type from \`Union{T,Nothing}\`](https://discourse.julialang.org/t/how-to-get-the-non-nothing-type-from-union-t-nothing/30523)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [October 31, 2019, 7:23am UTC](https://discourse.julialang.org/t/how-to-get-the-non-nothing-type-from-union-t-nothing/30523 "2019-10-31T07:23:18Z")

</div>

If I define const Maybe{T} = Union{T,Nothing} How to “pop” the T type from Maybe? I want to do this because I have the following type using Parameters @with\_kw struct A a::Maybe{String} = nothing b::Maybe{Flo…

---

## [Writing to shared arrays with CUDAnative](https://discourse.julialang.org/t/writing-to-shared-arrays-with-cudanative/30518)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 0\
**Last updated:** [October 30, 2019, 11:48pm UTC](https://discourse.julialang.org/t/writing-to-shared-arrays-with-cudanative/30518 "2019-10-30T23:48:59Z")

</div>

I wondering what the potential and limits are to writing to shared arrays on the GPU in julia, and generally. My WIP spatial simulation package DynamicGrids.jl seems like a prime candidate fro running on the GPU, as the…

---

## [How to compile Julia on cluster with slightly different login / compute nodes?](https://discourse.julialang.org/t/how-to-compile-julia-on-cluster-with-slightly-different-login-compute-nodes/30515)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 3\
**Last updated:** [October 30, 2019, 11:27pm UTC](https://discourse.julialang.org/t/how-to-compile-julia-on-cluster-with-slightly-different-login-compute-nodes/30515 "2019-10-30T23:27:07Z")

</div>

I’m on a cluster where I think the login / compute nodes are sufficiently different architectures that compiling Julia (1.3.0-rc4) on one and running on the either always yields a ERROR: Unable to find compatible target …

---

## [How to prevent type instability in for loops?](https://discourse.julialang.org/t/how-to-prevent-type-instability-in-for-loops/30508)

<div class="topic-metadata">

**Author:** [@Ronneesley](https://discourse.julialang.org/u/Ronneesley)\
**Replies:** 13\
**Last updated:** [October 30, 2019, 10:00pm UTC](https://discourse.julialang.org/t/how-to-prevent-type-instability-in-for-loops/30508 "2019-10-30T22:00:28Z")

</div>

When we create a for loop with range, Julia alert a type of instability in the range created. Using the code below. v = \[1, 2, 3\] function f(v::Array{Int, 1}) s = 0 for i = 1:length(v) s += v\[i\] end…

---

## [How to get commit hash in Pkg3?](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 4\
**Last updated:** [October 30, 2019, 7:47pm UTC](https://discourse.julialang.org/t/how-to-get-commit-hash-in-pkg3/11927 "2019-10-30T19:47:18Z")

</div>

With the old package manager, I could go into the package directory and do a git status or something similar to find out which commit I was on. How do I do this with Pkg3? While \]st does print a hash next to each package…

---

## [Merging dictionaries indexed by elements of struct type](https://discourse.julialang.org/t/merging-dictionaries-indexed-by-elements-of-struct-type/30499)

<div class="topic-metadata">

**Author:** [@Pierre-Emmanuel\_Chap](https://discourse.julialang.org/u/Pierre-Emmanuel_Chap)\
**Replies:** 2\
**Last updated:** [October 30, 2019, 6:19pm UTC](https://discourse.julialang.org/t/merging-dictionaries-indexed-by-elements-of-struct-type/30499 "2019-10-30T18:19:12Z")

</div>

Hello, I am failing merging correctly dictionaries that are indexed by a mutable struct that I defined before. Here is the code of a baby example : mutable struct my\_vector v::Vector{Int} end Base.:(==)(v1::my\_vector…

---

## [How do we know if a registeration attempt succeeded?](https://discourse.julialang.org/t/how-do-we-know-if-a-registeration-attempt-succeeded/30488)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 6\
**Last updated:** [October 30, 2019, 12:20pm UTC](https://discourse.julialang.org/t/how-do-we-know-if-a-registeration-attempt-succeeded/30488 "2019-10-30T12:20:10Z")

</div>

If I $ git commit -am "@JuliaRegistrator register()" for one of my packages (namely COBS.jl), how do I know if my registration attempt succeeded? I understand that I’ll get an issue if things didn’t work, but is there su…

---

## [Threading pool](https://discourse.julialang.org/t/threading-pool/30481)

<div class="topic-metadata">

**Author:** [@fracasss](https://discourse.julialang.org/u/fracasss)\
**Replies:** 1\
**Last updated:** [October 30, 2019, 9:16am UTC](https://discourse.julialang.org/t/threading-pool/30481 "2019-10-30T09:16:37Z")

</div>

How can I change the number of threads in my jl script, like the threading pool in Python? If there is no way to do this, can I set the number of threads Julia will use when Julia starts in VSCode? I really don’t want …

---

## [The packages in different paths can't work together](https://discourse.julialang.org/t/the-packages-in-different-paths-cant-work-together/30472)

<div class="topic-metadata">

**Author:** [@Yan](https://discourse.julialang.org/u/Yan)\
**Replies:** 4\
**Last updated:** [October 30, 2019, 8:38am UTC](https://discourse.julialang.org/t/the-packages-in-different-paths-cant-work-together/30472 "2019-10-30T08:38:21Z")

</div>

The package “StringEncodings” installed in Repl, which only could be loaded in Repl but not in script by “using StringEncodings”

---

## [How to read blocks or sections one by one from a txt file?](https://discourse.julialang.org/t/how-to-read-blocks-or-sections-one-by-one-from-a-txt-file/30469)

<div class="topic-metadata">

**Author:** [@Yan](https://discourse.julialang.org/u/Yan)\
**Replies:** 3\
**Last updated:** [October 30, 2019, 3:57am UTC](https://discourse.julialang.org/t/how-to-read-blocks-or-sections-one-by-one-from-a-txt-file/30469 "2019-10-30T03:57:20Z")

</div>

Is there a read block function besides readline and readlines, or more powerful function of them according a separate symbol. Such as: readline(“\*.txt”, separate=“\>”) # Change the default=“\\n” into “\>”

---

## [Leading Zeros](https://discourse.julialang.org/t/leading-zeros/30450)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 10\
**Last updated:** [October 30, 2019, 3:20am UTC](https://discourse.julialang.org/t/leading-zeros/30450 "2019-10-30T03:20:03Z")

</div>

Hi, I have a simple question but i cannot find the answer. I have an array of integers between 1 to 999. I need the left pading of 3 so that every element is composed of 3 digits.E.g. \[ 001, 002,…090…, 900\]. But I woul…

---

## [CuArrays error: Unknown package Compat found in the compatibility requirements of MacroTools](https://discourse.julialang.org/t/cuarrays-error-unknown-package-compat-found-in-the-compatibility-requirements-of-macrotools/30464)

<div class="topic-metadata">

**Author:** [@jchen975](https://discourse.julialang.org/u/jchen975)\
**Replies:** 0\
**Last updated:** [October 29, 2019, 10:13pm UTC](https://discourse.julialang.org/t/cuarrays-error-unknown-package-compat-found-in-the-compatibility-requirements-of-macrotools/30464 "2019-10-29T22:13:34Z")

</div>

Hi, I’m trying to train a CNN on a compute cluster with a Nvidia V100 GPU. I ran a test .jl file (with Julia 1.1.1) that just does Pkg.test("CuArrays") and this is the error message I got ERROR: LoadError: Unknown packa…

---

## [Synchronous requests needs to be performed one at a time on remote worker](https://discourse.julialang.org/t/synchronous-requests-needs-to-be-performed-one-at-a-time-on-remote-worker/30140)

<div class="topic-metadata">

**Author:** [@cwiese](https://discourse.julialang.org/u/cwiese)\
**Replies:** 3\
**Last updated:** [October 29, 2019, 7:21pm UTC](https://discourse.julialang.org/t/synchronous-requests-needs-to-be-performed-one-at-a-time-on-remote-worker/30140 "2019-10-29T19:21:57Z")

</div>

We want to prevent race conditions on remote workers serving requests from HTTP.jl on porocess 1. We are trying to stack the “requests” in a channel… trying to figure out how to do this with remotecall\_fetch and Channe…

---

## [Plot, pyplot() - marker size inside the legend](https://discourse.julialang.org/t/plot-pyplot-marker-size-inside-the-legend/30454)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 0\
**Last updated:** [October 29, 2019, 5:52pm UTC](https://discourse.julialang.org/t/plot-pyplot-marker-size-inside-the-legend/30454 "2019-10-29T17:52:16Z")

</div>

Hi, I can change the legendfont but the market size inside the legend doesn’t change accordingly. How can I change it? Thanks

---

## [DifferentialEquations: Change parameter in ODE after some time](https://discourse.julialang.org/t/differentialequations-change-parameter-in-ode-after-some-time/30438)

<div class="topic-metadata">

**Author:** [@rad1um](https://discourse.julialang.org/u/rad1um)\
**Replies:** 3\
**Last updated:** [October 29, 2019, 5:24pm UTC](https://discourse.julialang.org/t/differentialequations-change-parameter-in-ode-after-some-time/30438 "2019-10-29T17:24:38Z")

</div>

Hello everyone, I hope that this question belongs here, since my problem is mostly about the DifferentialEquations package. I have the following dynamical system: using DifferentialEquations function some\_dynamics(u,p…

---

## [DifferentialEquations: Enforce that variables are inside a domain (isoutofdomain, PositiveDomain)](https://discourse.julialang.org/t/differentialequations-enforce-that-variables-are-inside-a-domain-isoutofdomain-positivedomain/30452)

<div class="topic-metadata">

**Author:** [@LolianSh](https://discourse.julialang.org/u/LolianSh)\
**Replies:** 1\
**Last updated:** [October 29, 2019, 4:20pm UTC](https://discourse.julialang.org/t/differentialequations-enforce-that-variables-are-inside-a-domain-isoutofdomain-positivedomain/30452 "2019-10-29T16:20:43Z")

</div>

Hi, I am using DifferentialEquations.jl to solve a system of SDEs. This is a model of an electrochemical system, where I have reaction-diffusion equations. My variables are the following (\\theta, CO, OH, S\_t). All of t…

---

## [Is there a /dev/null for AbstractArrays?](https://discourse.julialang.org/t/is-there-a-dev-null-for-abstractarrays/30447)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 9\
**Last updated:** [October 29, 2019, 4:18pm UTC](https://discourse.julialang.org/t/is-there-a-dev-null-for-abstractarrays/30447 "2019-10-29T16:18:01Z")

</div>

Is there some type that I can pass into functions that would indicate that I don’t care about the result? The background is that I always try to write in place functions. When I have a, b, c = f(x, y, z) I always implem…

---

## [Blas dot doing weird things depending on size](https://discourse.julialang.org/t/blas-dot-doing-weird-things-depending-on-size/30430)

<div class="topic-metadata">

**Author:** [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Replies:** 3\
**Last updated:** [October 29, 2019, 12:56pm UTC](https://discourse.julialang.org/t/blas-dot-doing-weird-things-depending-on-size/30430 "2019-10-29T12:56:34Z")

</div>

I’m working on some by hand matrix multiplication. function slowMult!(A::AbstractMatrix{T},B::AbstractMatrix{T}) where T\<:Number C = Matrix{T}(undef,size(A,1),size(B,2)) for i in 1:size(A,1) for j in 1:s…

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

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