# General Usage

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

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

**Page:** 324

---

## [Strange memory allocations](https://discourse.julialang.org/t/strange-memory-allocations/95203)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [February 27, 2023, 2:12am UTC](https://discourse.julialang.org/t/strange-memory-allocations/95203 "2023-02-27T02:12:10Z")

</div>

I have the following function: function residual!(res, yd, y::MVector{S, SimFloat}, s::KPS3, time) where S if false T = S-2 # T: three times the number of particles excluding the origin segments = di…

---

## [Help with error: "N not defined" in method signature but it is](https://discourse.julialang.org/t/help-with-error-n-not-defined-in-method-signature-but-it-is/95226)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 11\
**Last updated:** [February 26, 2023, 11:59pm UTC](https://discourse.julialang.org/t/help-with-error-n-not-defined-in-method-signature-but-it-is/95226 "2023-02-26T23:59:04Z")

</div>

I understand this might not be idiomatic, but I would like to understand what’s going on here. When compiling, the code below gives warning: WARNING: method definition for test at {File:Line} declares type variable N b…

---

## [Best way to perform AD of an array](https://discourse.julialang.org/t/best-way-to-perform-ad-of-an-array/94999)

<div class="topic-metadata">

**Author:** [@tomkimpson](https://discourse.julialang.org/u/tomkimpson)\
**Replies:** 6\
**Last updated:** [February 26, 2023, 10:06pm UTC](https://discourse.julialang.org/t/best-way-to-perform-ad-of-an-array/94999 "2023-02-26T22:06:13Z")

</div>

I have a function that defines some 2D array. A toy example might be something like: function create\_array(coordinates,a) g = zeros(typeof(a),4,4) g\[1,1\] = coordinates\[1\]^2 + coordinates\[2\] + 3 g\[2,2\] = co…

---

## [Mysterious runtime difference](https://discourse.julialang.org/t/mysterious-runtime-difference/95234)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 3\
**Last updated:** [February 26, 2023, 9:44pm UTC](https://discourse.julialang.org/t/mysterious-runtime-difference/95234 "2023-02-26T21:44:46Z")

</div>

I would expect the two functions f1(a; dims=:) = reduce(+, a; dims) f2(a, b; dims=:) = b ? reduce(+, a; dims) : reduce(+, a; dims) to have virtually identical runtime, but that is not the case: julia\> a=\[1,2,3\]; julia\>…

---

## [Print a Flux network](https://discourse.julialang.org/t/print-a-flux-network/95239)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 0\
**Last updated:** [February 26, 2023, 9:36pm UTC](https://discourse.julialang.org/t/print-a-flux-network/95239 "2023-02-26T21:36:15Z")

</div>

I cannot figure out how to printout a Flux network. I assume there is a command to do this? Thanks.

---

## [Error relating to Zygote](https://discourse.julialang.org/t/error-relating-to-zygote/95102)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 15\
**Last updated:** [February 26, 2023, 4:24pm UTC](https://discourse.julialang.org/t/error-relating-to-zygote/95102 "2023-02-26T16:24:50Z")

</div>

@ChrisRackauckas I am getting the following error (which I did not use to get): ┌ Warning: Reverse-Mode AD VJP choices all failed. Falling back to numerical VJPs What generates this error? Does it basically mean that …

---

## [Passing new Parameters in symbolics and ModelingToolKit](https://discourse.julialang.org/t/passing-new-parameters-in-symbolics-and-modelingtoolkit/95194)

<div class="topic-metadata">

**Author:** [@bombadil224](https://discourse.julialang.org/u/bombadil224)\
**Replies:** 3\
**Last updated:** [February 26, 2023, 4:22pm UTC](https://discourse.julialang.org/t/passing-new-parameters-in-symbolics-and-modelingtoolkit/95194 "2023-02-26T16:22:17Z")

</div>

I am trying to create a few different equations, pass them to a function that puts them together adding new parameters to the system and then returns the result to the user who will later pass them to other functions. A…

---

## [Pkg API for getting UUID of another package](https://discourse.julialang.org/t/pkg-api-for-getting-uuid-of-another-package/15061)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 6\
**Last updated:** [February 26, 2023, 8:37am UTC](https://discourse.julialang.org/t/pkg-api-for-getting-uuid-of-another-package/15061 "2023-02-26T08:37:15Z")

</div>

How can I look up the UUID of a package by name in the current project using the Pkg API? julia\> import Pkg; Pkg.status() Status \`~/.julia/environments/v1.1/Project.toml\` \[6e4b80f9\] BenchmarkTools v0.4.1 \[31c24e…

---

## [Recipe to plot several line segments on the same graph](https://discourse.julialang.org/t/recipe-to-plot-several-line-segments-on-the-same-graph/94698)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 9\
**Last updated:** [February 26, 2023, 1:24pm UTC](https://discourse.julialang.org/t/recipe-to-plot-several-line-segments-on-the-same-graph/94698 "2023-02-26T13:24:42Z")

</div>

A custom type contains a vector of matrices. Each two-column matrix defines a continuous line segment. To plot this type, a plot!() function needs to be called as many times as there are line segments. I am not sure wh…

---

## [Roots::find\_zero fails depending on small differences in initial condition](https://discourse.julialang.org/t/roots-find-zero-fails-depending-on-small-differences-in-initial-condition/95202)

<div class="topic-metadata">

**Author:** [@nvonturk](https://discourse.julialang.org/u/nvonturk)\
**Replies:** 6\
**Last updated:** [February 26, 2023, 11:20am UTC](https://discourse.julialang.org/t/roots-find-zero-fails-depending-on-small-differences-in-initial-condition/95202 "2023-02-26T11:20:15Z")

</div>

Hi there, I’m having trouble with the Roots package. I have an MVE below (base of post) which is setting up a simple economics model. The last two lines showcase the issue. The first line works and returns the correct …

---

## [How to avoid shipping large object to remote workers repeatedly](https://discourse.julialang.org/t/how-to-avoid-shipping-large-object-to-remote-workers-repeatedly/95217)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 1\
**Last updated:** [February 26, 2023, 7:36am UTC](https://discourse.julialang.org/t/how-to-avoid-shipping-large-object-to-remote-workers-repeatedly/95217 "2023-02-26T07:36:34Z")

</div>

I’ve got some large object dataset which is very slow and memory intensive to serialize/deserialize to ship to remote workers, so I’d like to do it just once. However, this object gets used from some library function foo …

---

## [How to solve a combination of ODEs and PDEs and organize the solution](https://discourse.julialang.org/t/how-to-solve-a-combination-of-odes-and-pdes-and-organize-the-solution/95092)

<div class="topic-metadata">

**Author:** [@markowkes](https://discourse.julialang.org/u/markowkes)\
**Replies:** 6\
**Last updated:** [February 26, 2023, 1:38am UTC](https://discourse.julialang.org/t/how-to-solve-a-combination-of-odes-and-pdes-and-organize-the-solution/95092 "2023-02-26T01:38:57Z")

</div>

Is it possible to use a struct to hold the dependent variables when using the solvers in DifferentialEquations.jl, or is it needed to create a single vector u of all dependent variables? For example, I have a system wit…

---

## [Max size for SVector or SArray](https://discourse.julialang.org/t/max-size-for-svector-or-sarray/95209)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 4\
**Last updated:** [February 25, 2023, 11:44pm UTC](https://discourse.julialang.org/t/max-size-for-svector-or-sarray/95209 "2023-02-25T23:44:17Z")

</div>

What are the recommended maximum sizes for an SVector or SArray? I realize there is no hard limit, but are there some rules of thumb?

---

## [Unnecessary copy using convert.()](https://discourse.julialang.org/t/unnecessary-copy-using-convert/95009)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 10\
**Last updated:** [February 25, 2023, 8:00pm UTC](https://discourse.julialang.org/t/unnecessary-copy-using-convert/95009 "2023-02-25T20:00:16Z")

</div>

I was surprised by this call to convert on a vector generating a copy, when the output type is the same as the input type. Is this desired behaviour?: julia\> A = \[1, 2, 3, 4\] 4-element Vector{Int64}: 1 2 3 4 julia\> …

---

## [Why is this dependency not allowed?](https://discourse.julialang.org/t/why-is-this-dependency-not-allowed/95180)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [February 25, 2023, 5:45pm UTC](https://discourse.julialang.org/t/why-is-this-dependency-not-allowed/95180 "2023-02-25T17:45:40Z")

</div>

I tried to register a package that contains: \[compat\] DiffEqBase = "\<6.116.0" Sundials = "~4.11" and get the error message: The following dependencies do not have a \[compat\] entry that is upper-bounded and only inclu…

---

## [Findgroups in Julia](https://discourse.julialang.org/t/findgroups-in-julia/95187)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 1\
**Last updated:** [February 25, 2023, 3:30pm UTC](https://discourse.julialang.org/t/findgroups-in-julia/95187 "2023-02-25T15:30:16Z")

</div>

is there an equivalent to the function findgroups in Julia as defined in Matlab,

---

## [Append! on arrays of arryas](https://discourse.julialang.org/t/append-on-arrays-of-arryas/95183)

<div class="topic-metadata">

**Author:** [@gasparalfaro](https://discourse.julialang.org/u/gasparalfaro)\
**Replies:** 5\
**Last updated:** [February 25, 2023, 3:15pm UTC](https://discourse.julialang.org/t/append-on-arrays-of-arryas/95183 "2023-02-25T15:15:15Z")

</div>

I want to create an array of empty arrays so I can append and have different sized arrays like this: But, if I use fill to create the array of empty arrays and then I append it the result is this: Why is it any di…

---

## [Copy only modified files to destination folder](https://discourse.julialang.org/t/copy-only-modified-files-to-destination-folder/95176)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 2\
**Last updated:** [February 25, 2023, 10:19am UTC](https://discourse.julialang.org/t/copy-only-modified-files-to-destination-folder/95176 "2023-02-25T10:19:56Z")

</div>

I am wondering, if there is a package or a command to copy only new files to a destination folder (one way synchronization). I have tried to find something here and on GitHub, but failed :frowning:

---

## [Assigning a UnitRange to an array](https://discourse.julialang.org/t/assigning-a-unitrange-to-an-array/95115)

<div class="topic-metadata">

**Author:** [@sransome](https://discourse.julialang.org/u/sransome)\
**Replies:** 7\
**Last updated:** [February 25, 2023, 3:17am UTC](https://discourse.julialang.org/t/assigning-a-unitrange-to-an-array/95115 "2023-02-25T03:17:11Z")

</div>

Hi, I have a matrix with elements of type UnitRange a = Array{UnitRange}(undef ,2,2) I would like to assign a unit range like (200:375) to a range of elements using broadcast. a\[1,:\] .= (200:375) but I get this erro…

---

## [HTTP.jl get fails with 404 - Postman counterpart works](https://discourse.julialang.org/t/http-jl-get-fails-with-404-postman-counterpart-works/95098)

<div class="topic-metadata">

**Author:** [@algunion](https://discourse.julialang.org/u/algunion)\
**Replies:** 2\
**Last updated:** [February 25, 2023, 2:18am UTC](https://discourse.julialang.org/t/http-jl-get-fails-with-404-postman-counterpart-works/95098 "2023-02-25T02:18:10Z")

</div>

Hello people, I have an issue with the HTTP.jl package. I am trying to access Firestore REST API. This is my URL: https://firestore.googleapis.com/v1/projects/my-project/databases/(default)/documents/ The only stated…

---

## [Parity of sorting permutations for vectors with very small size](https://discourse.julialang.org/t/parity-of-sorting-permutations-for-vectors-with-very-small-size/95172)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 0\
**Last updated:** [February 24, 2023, 11:39pm UTC](https://discourse.julialang.org/t/parity-of-sorting-permutations-for-vectors-with-very-small-size/95172 "2023-02-24T23:39:52Z")

</div>

What would be the fastest way to get the parity of sorting permutations for vectors with very small size? The obvious way is to use the sortperm! function and the parity function from Combinatorics.jl. However, sortper…

---

## [Linux: Start bash-script and don't wait for execution](https://discourse.julialang.org/t/linux-start-bash-script-and-dont-wait-for-execution/95162)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 3\
**Last updated:** [February 24, 2023, 9:21pm UTC](https://discourse.julialang.org/t/linux-start-bash-script-and-dont-wait-for-execution/95162 "2023-02-24T21:21:56Z")

</div>

Is it possible in a standalone REPL (outside of VScode) to start a bash-script and get back focus on the current external REPL right after? Here my snippet that works fine in VScode, but fails outside the integrated VSc…

---

## [Is it good to include a function in my struct?](https://discourse.julialang.org/t/is-it-good-to-include-a-function-in-my-struct/95129)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 6\
**Last updated:** [February 24, 2023, 8:32pm UTC](https://discourse.julialang.org/t/is-it-good-to-include-a-function-in-my-struct/95129 "2023-02-24T20:32:04Z")

</div>

I have a struct which has a field referring to a function, which is used as following. struct myT f::Function end function Base.getindex(foo::myT, i)::Float64 foo.f(...) end I noticed that code\_warntype shows │ …

---

## [Is there barrier condition in Mulit-threading?](https://discourse.julialang.org/t/is-there-barrier-condition-in-mulit-threading/95157)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 0\
**Last updated:** [February 24, 2023, 5:45pm UTC](https://discourse.julialang.org/t/is-there-barrier-condition-in-mulit-threading/95157 "2023-02-24T17:45:09Z")

</div>

Is there a barrier synchronization primitive to synchronize multiple threads created by @threads and ensure that they all reach a certain point in a for loop before continuing execution. Such as below? barrier = Threads…

---

## [Multivariate hypergeometric distribution?](https://discourse.julialang.org/t/multivariate-hypergeometric-distribution/95081)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 2\
**Last updated:** [February 24, 2023, 5:26pm UTC](https://discourse.julialang.org/t/multivariate-hypergeometric-distribution/95081 "2023-02-24T17:26:41Z")

</div>

Is there a package that implements sampling for the multivariate hypergeometric distribution?

---

## [Finalizer bug? Or am I dumb?](https://discourse.julialang.org/t/finalizer-bug-or-am-i-dumb/95113)

<div class="topic-metadata">

**Author:** [@cadaverous](https://discourse.julialang.org/u/cadaverous)\
**Replies:** 3\
**Last updated:** [February 24, 2023, 5:22pm UTC](https://discourse.julialang.org/t/finalizer-bug-or-am-i-dumb/95113 "2023-02-24T17:22:21Z")

</div>

I have a julia object that contains some data fields that are initialized inside a ccall, so I am trying to write a finalizer to allow C to free the allocated memory, but I’m getting some weird behavior that I think migh…

---

## [Problem with condition with @async threads?](https://discourse.julialang.org/t/problem-with-condition-with-async-threads/95147)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 0\
**Last updated:** [February 24, 2023, 4:14pm UTC](https://discourse.julialang.org/t/problem-with-condition-with-async-threads/95147 "2023-02-24T16:14:16Z")

</div>

I want to synchronize between threads by using notify&wait as in the example MWE, in which nthreads()=3. Each thread executes for-loop and while-loop inside it. It is similar to what mentioned in Can the threads synchron…

---

## [How to write shell && and || in julia cmd syntax?](https://discourse.julialang.org/t/how-to-write-shell-and-in-julia-cmd-syntax/95148)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 3\
**Last updated:** [February 24, 2023, 4:40pm UTC](https://discourse.julialang.org/t/how-to-write-shell-and-in-julia-cmd-syntax/95148 "2023-02-24T16:40:08Z")

</div>

Hi there, I guess this is a standard question, but my google skills failed so far. Can someone explain how to map shell’s && and || to julia’s own cmd syntax/api? thanks

---

## [List existing global variables, e.g. via varinfo()](https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 1\
**Last updated:** [February 24, 2023, 2:02pm UTC](https://discourse.julialang.org/t/list-existing-global-variables-e-g-via-varinfo/95124 "2023-02-24T14:02:01Z")

</div>

The output of the function varinfo() is of type: Markdown.MD For me it is not clear, how to handle this variable type. My task is: Display the available variables Below is my workaround, but I am sure, there is a more…

---

## [Changing the line width of error bars](https://discourse.julialang.org/t/changing-the-line-width-of-error-bars/34489)

<div class="topic-metadata">

**Author:** [@yanivab](https://discourse.julialang.org/u/yanivab)\
**Replies:** 5\
**Last updated:** [February 24, 2023, 12:31pm UTC](https://discourse.julialang.org/t/changing-the-line-width-of-error-bars/34489 "2023-02-24T12:31:09Z")

</div>

Using Plots.jl, I know how to change the line width for the data with attribute “linewidth”. But this does not change the thickness of the lines comprising the error bar. How does one change those? e.g.: @df dat plot(:…

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

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