# General Usage

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

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

**Page:** 266

---

## [Is accessing an \`undef\` array undefined behavior?](https://discourse.julialang.org/t/is-accessing-an-undef-array-undefined-behavior/101899)

<div class="topic-metadata">

**Author:** [@DNF](https://discourse.julialang.org/u/DNF)\
**Replies:** 47\
**Last updated:** [July 23, 2023, 11:18pm UTC](https://discourse.julialang.org/t/is-accessing-an-undef-array-undefined-behavior/101899 "2023-07-23T23:18:40Z")

</div>

From the Rust vs Julia in scientific computation blog post: v = Vec{Int64}(undef, 3) What would happen if you forget to set an undef (undefined) value and read it by mistake? One possible output of v is: 139974349418…

---

## [Is there a way to build a static matrix programmatically?](https://discourse.julialang.org/t/is-there-a-way-to-build-a-static-matrix-programmatically/101982)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 6\
**Last updated:** [July 23, 2023, 8:17pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-build-a-static-matrix-programmatically/101982 "2023-07-23T20:17:26Z")

</div>

Hi! I need to remove the runtime allocations for a project that is targeting embedding Julia code in a satellite computer. One big problem I have is to create static matrices programmatically. For example, in C++, we ca…

---

## [HDF5 variable length Array](https://discourse.julialang.org/t/hdf5-variable-length-array/101971)

<div class="topic-metadata">

**Author:** [@thomaskroi1996](https://discourse.julialang.org/u/thomaskroi1996)\
**Replies:** 0\
**Last updated:** [July 23, 2023, 5:20pm UTC](https://discourse.julialang.org/t/hdf5-variable-length-array/101971 "2023-07-23T17:20:33Z")

</div>

Hello! I was wondering what the cleanest way to write variable length arrays to HDF5 format in Julia, using HDF5.jl. In python this can be easily done with create\_dataset('StepNumbers', data=\[\], dtype=np.dtype('uint32…

---

## [How to activate the current project with Distributed](https://discourse.julialang.org/t/how-to-activate-the-current-project-with-distributed/101965)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [July 23, 2023, 4:19pm UTC](https://discourse.julialang.org/t/how-to-activate-the-current-project-with-distributed/101965 "2023-07-23T16:19:10Z")

</div>

I am trying to activate the current project with Distributed, which fails: using Distributed @everywhere begin cd("..") using Pkg; Pkg.activate(@\_\_DIR\_\_) Pkg.instantiate(); Pkg.precompile() Pkg.status() end Ou…

---

## [Julia for audio live coding?](https://discourse.julialang.org/t/julia-for-audio-live-coding/101593)

<div class="topic-metadata">

**Author:** [@JTriggerFish](https://discourse.julialang.org/u/JTriggerFish)\
**Replies:** 19\
**Last updated:** [July 23, 2023, 4:30am UTC](https://discourse.julialang.org/t/julia-for-audio-live-coding/101593 "2023-07-23T04:30:20Z")

</div>

Hi all, I’m new to Julia and trying to gauge feasibility with regards to audio live coding. What I would like to do essentially is to use the REPL or the “Run code” function in vscode to create audio callbacks that gene…

---

## [Building and precompiling a package depending on unregistered packages](https://discourse.julialang.org/t/building-and-precompiling-a-package-depending-on-unregistered-packages/101955)

<div class="topic-metadata">

**Author:** [@Matthew\_Ozon](https://discourse.julialang.org/u/Matthew_Ozon)\
**Replies:** 8\
**Last updated:** [July 23, 2023, 1:35pm UTC](https://discourse.julialang.org/t/building-and-precompiling-a-package-depending-on-unregistered-packages/101955 "2023-07-23T13:35:53Z")

</div>

When testing a local package X, some issues appear while build-ing and precompile-ing. The reason for that is the unregistered packages in the dependency tree. The unregistered packages (Y and Z) are installed locally …

---

## [Project Specific Startup.jl](https://discourse.julialang.org/t/project-specific-startup-jl/101947)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 3\
**Last updated:** [July 23, 2023, 9:22am UTC](https://discourse.julialang.org/t/project-specific-startup-jl/101947 "2023-07-23T09:22:39Z")

</div>

Hello, I am using DrWatson to manage some simulations for an upcoming conference. I am using some locally developed packages that do not include DrWatson in their dependencies. They create some complicated data structu…

---

## [Convert matrix of 3D arrays to 3D array](https://discourse.julialang.org/t/convert-matrix-of-3d-arrays-to-3d-array/101888)

<div class="topic-metadata">

**Author:** [@mastrof](https://discourse.julialang.org/u/mastrof)\
**Replies:** 12\
**Last updated:** [July 23, 2023, 9:05am UTC](https://discourse.julialang.org/t/convert-matrix-of-3d-arrays-to-3d-array/101888 "2023-07-23T09:05:04Z")

</div>

I have N^2 3D arrays, all with size (nx, ny, nz). These arrays are arranged in a square matrix (N x N). I would like to expand the inner arrays concatenating them along the first two dimensions but not along the third, s…

---

## [Which environment do dependencies need to be loaded from to trigger loading package extensions?](https://discourse.julialang.org/t/which-environment-do-dependencies-need-to-be-loaded-from-to-trigger-loading-package-extensions/101952)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [July 23, 2023, 8:54am UTC](https://discourse.julialang.org/t/which-environment-do-dependencies-need-to-be-loaded-from-to-trigger-loading-package-extensions/101952 "2023-07-23T08:54:27Z")

</div>

I’m a bit confused about how package extensions are loaded. The Pkg docs state An extension will only be loaded if the extension dependencies are loaded from the same environment or environments higher in the environme…

---

## [Change legend entries order in Plots.jl](https://discourse.julialang.org/t/change-legend-entries-order-in-plots-jl/101927)

<div class="topic-metadata">

**Author:** [@teob](https://discourse.julialang.org/u/teob)\
**Replies:** 1\
**Last updated:** [July 22, 2023, 3:24pm UTC](https://discourse.julialang.org/t/change-legend-entries-order-in-plots-jl/101927 "2023-07-22T15:24:27Z")

</div>

Imagine having 6 series of data, labeled using the cardinal numbers. When I split the legend into two columns using legendcolumns = 2 I get the following order: 1 2 3 4 5 6 Is there any way to get the following order…

---

## [Using DataFrames to split overlapping datetime intervals into non overlapping intervals](https://discourse.julialang.org/t/using-dataframes-to-split-overlapping-datetime-intervals-into-non-overlapping-intervals/101149)

<div class="topic-metadata">

**Author:** [@vtomar](https://discourse.julialang.org/u/vtomar)\
**Replies:** 9\
**Last updated:** [July 23, 2023, 7:00am UTC](https://discourse.julialang.org/t/using-dataframes-to-split-overlapping-datetime-intervals-into-non-overlapping-intervals/101149 "2023-07-23T07:00:58Z")

</div>

test = DataFrame(Time1 = \[DateTime(2022, 1, 1, 10, 0, 0), DateTime(2022, 1, 1, 10, 5, 0), DateTime(2022, 1, 1, 10, 14, 0)\], Time2 = \[DateTime(2022, 1, 1, 10, 15, 0), DateTime(2022, 1, 1, 10, 10, 0), DateTime(2022, 1, 1…

---

## [How to Add, Build and Precompile Package that is downloaded from github in Julia?](https://discourse.julialang.org/t/how-to-add-build-and-precompile-package-that-is-downloaded-from-github-in-julia/101949)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [July 23, 2023, 5:20am UTC](https://discourse.julialang.org/t/how-to-add-build-and-precompile-package-that-is-downloaded-from-github-in-julia/101949 "2023-07-23T05:20:31Z")

</div>

I was adding this package: using Pkg Pkg.add(PackageSpec(url="https://github.com/luchr/ComplexPortraits.jl", rev="master")) it is cloning the github and build it and precompile it. If I download a package (any Julia…

---

## [Speed of EnsembleProblem](https://discourse.julialang.org/t/speed-of-ensembleproblem/101929)

<div class="topic-metadata">

**Author:** [@George\_Stepaniants](https://discourse.julialang.org/u/George_Stepaniants)\
**Replies:** 4\
**Last updated:** [July 23, 2023, 1:26am UTC](https://discourse.julialang.org/t/speed-of-ensembleproblem/101929 "2023-07-23T01:26:10Z")

</div>

Here I’ve written a simple MRE that generates 100 simulations of a linear ODE with 100 different controls/forcings. I find that simply writing a for-loop to generate this 100 simulations is 10x faster than generating the…

---

## [Why can we not easily compile to standalone binary?](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936)

<div class="topic-metadata">

**Author:** [@The\_Mastermage](https://discourse.julialang.org/u/The_Mastermage)\
**Replies:** 3\
**Last updated:** [July 22, 2023, 6:36pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936 "2023-07-22T18:36:41Z")

</div>

So I am new to Julia and in recent time I was learning abit about Interpreters and Compilers, still dont understand much beyond Lexer and Tokenizer so go easy on me here. I was wondering if Julia does rely on the LLVM Co…

---

## [Profiling tests: how to tell for how long did each test set execute?](https://discourse.julialang.org/t/profiling-tests-how-to-tell-for-how-long-did-each-test-set-execute/101938)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 0\
**Last updated:** [July 22, 2023, 6:25pm UTC](https://discourse.julialang.org/t/profiling-tests-how-to-tell-for-how-long-did-each-test-set-execute/101938 "2023-07-22T18:25:55Z")

</div>

Sometimes, while developing tests, the test suite will take too long to run. In such a situation I’m interested in optimizing the test suite by removing test cases from some test sets. How to tell which test sets execute…

---

## [Any guideline on which atomic ordering to choose?](https://discourse.julialang.org/t/any-guideline-on-which-atomic-ordering-to-choose/72055)

<div class="topic-metadata">

**Author:** [@findmyway](https://discourse.julialang.org/u/findmyway)\
**Replies:** 2\
**Last updated:** [July 22, 2023, 2:33pm UTC](https://discourse.julialang.org/t/any-guideline-on-which-atomic-ordering-to-choose/72055 "2023-07-22T14:33:37Z")

</div>

In the upcoming Julia@v1.7 Per-field atomics, it mentions several atomic orderings: (:monotonic, :acquire, :release, :acquire\_release, or :sequentially\_consistent). Do you have any general suggestions for which one to …

---

## [All Adjoint Methods Fail on Simple Neural ODE Example](https://discourse.julialang.org/t/all-adjoint-methods-fail-on-simple-neural-ode-example/101836)

<div class="topic-metadata">

**Author:** [@George\_Stepaniants](https://discourse.julialang.org/u/George_Stepaniants)\
**Replies:** 7\
**Last updated:** [July 22, 2023, 1:17pm UTC](https://discourse.julialang.org/t/all-adjoint-methods-fail-on-simple-neural-ode-example/101836 "2023-07-22T13:17:03Z")

</div>

Hello, I have an MRE where if I use any sensitivity algorithm apart from ForwardDiffSensitivity() I get an error. In particular, when I use the sensitivity algorithm InterpolatingAdjoint(autojacvec=ZygoteVJP()) I get the…

---

## [Runtime of program using a large amount of memory stalls](https://discourse.julialang.org/t/runtime-of-program-using-a-large-amount-of-memory-stalls/99981)

<div class="topic-metadata">

**Author:** [@ilanggear](https://discourse.julialang.org/u/ilanggear)\
**Replies:** 4\
**Last updated:** [July 22, 2023, 6:41am UTC](https://discourse.julialang.org/t/runtime-of-program-using-a-large-amount-of-memory-stalls/99981 "2023-07-22T06:41:32Z")

</div>

I’m working on code to collect unigram and bigram counts of words and word features. For now I’m just working with less than a dozen smallish documents. Below are the results of @time on the first few docs. After the la…

---

## [Mutable struct and function as parameters. Why can't the function access the new values?](https://discourse.julialang.org/t/mutable-struct-and-function-as-parameters-why-cant-the-function-access-the-new-values/101915)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 2\
**Last updated:** [July 22, 2023, 4:11am UTC](https://discourse.julialang.org/t/mutable-struct-and-function-as-parameters-why-cant-the-function-access-the-new-values/101915 "2023-07-22T04:11:06Z")

</div>

Mutable struct and function as parameters. Why can’t the function access the new values? Both calls to p.f() return the same value, 2.0, despite the new value of x @with\_kw mutable struct Params x = 1.0 f::Fu…

---

## [Programatic function (and variable) names](https://discourse.julialang.org/t/programatic-function-and-variable-names/101861)

<div class="topic-metadata">

**Author:** [@Anton\_Hinneck](https://discourse.julialang.org/u/Anton_Hinneck)\
**Replies:** 16\
**Last updated:** [July 22, 2023, 12:07am UTC](https://discourse.julialang.org/t/programatic-function-and-variable-names/101861 "2023-07-22T00:07:06Z")

</div>

I have a use case, where code needs to generate multiple sets of functions. So functions do not get overwritten, I want to add a unique pre-/postfix equal for each function in a set. Specifically, functions init() ru…

---

## [Multi-Threading hangs in Windows](https://discourse.julialang.org/t/multi-threading-hangs-in-windows/101905)

<div class="topic-metadata">

**Author:** [@schev](https://discourse.julialang.org/u/schev)\
**Replies:** 0\
**Last updated:** [July 21, 2023, 7:52pm UTC](https://discourse.julialang.org/t/multi-threading-hangs-in-windows/101905 "2023-07-21T19:52:43Z")

</div>

Hi Julia friends! I have a persistent problem with multi-threading hanging, sometimes for many minutes at a time. Notably, I only witness this when my code is allocating large amounts of memory. Of course, pre-allocating…

---

## [Error \`CURL\_OPENSSL\_4' not found when using Julia and R](https://discourse.julialang.org/t/error-curl-openssl-4-not-found-when-using-julia-and-r/101847)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 1\
**Last updated:** [July 21, 2023, 6:40pm UTC](https://discourse.julialang.org/t/error-curl-openssl-4-not-found-when-using-julia-and-r/101847 "2023-07-21T18:40:17Z")

</div>

I am using Julia 1.9.2 in a package I am developing. The package makes some calls to the R language forecast package, and pulls the outputs back to julia. I am getting this error, but I am not clear on how to read this m…

---

## [What kinds of runtime dispatch are "problematic" for performance?](https://discourse.julialang.org/t/what-kinds-of-runtime-dispatch-are-problematic-for-performance/101895)

<div class="topic-metadata">

**Author:** [@loonatick-src](https://discourse.julialang.org/u/loonatick-src)\
**Replies:** 0\
**Last updated:** [July 21, 2023, 3:20pm UTC](https://discourse.julialang.org/t/what-kinds-of-runtime-dispatch-are-problematic-for-performance/101895 "2023-07-21T15:20:45Z")

</div>

My understanding is that runtime dispatch is not always problematic. E.g. exceptions result in runtime-dispatch, but that should not affect performance as long as the exception is not raised. Then there are runtime dispa…

---

## [Chunk an array](https://discourse.julialang.org/t/chunk-an-array/101878)

<div class="topic-metadata">

**Author:** [@tommy\_J](https://discourse.julialang.org/u/tommy_J)\
**Replies:** 5\
**Last updated:** [July 21, 2023, 3:12pm UTC](https://discourse.julialang.org/t/chunk-an-array/101878 "2023-07-21T15:12:02Z")

</div>

Hello to all, I would like to know how the most efficient way to chunk a multi-dimensional array in julia. arr = rand(Float64, (10, 100)) How can split it into chunks of size 30 so that I get 3 (10, 30) and 1 (10,10) …

---

## [Separating stderr based on task](https://discourse.julialang.org/t/separating-stderr-based-on-task/101841)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 1\
**Last updated:** [July 21, 2023, 12:28pm UTC](https://discourse.julialang.org/t/separating-stderr-based-on-task/101841 "2023-07-21T12:28:04Z")

</div>

Say I have: a background task BT which may write to stderr a main task MT which may also write to stderr I care about stderr from (MT) but not from (BT) and would like to hide things that come from (BT) as they’re unr…

---

## [Writeshortest error](https://discourse.julialang.org/t/writeshortest-error/92764)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 14\
**Last updated:** [July 21, 2023, 12:25pm UTC](https://discourse.julialang.org/t/writeshortest-error/92764 "2023-07-21T12:25:27Z")

</div>

I keep getting this error as below, after I upgraded my DIVAnd.jl package. Not sure if they are realted, but I was able to run scripts like CSV.write without any issues even yesterday. “UndefVarError: writeshortest not …

---

## [Mutating function-like objects, enforcing "!"?](https://discourse.julialang.org/t/mutating-function-like-objects-enforcing/101825)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 6\
**Last updated:** [July 21, 2023, 11:38am UTC](https://discourse.julialang.org/t/mutating-function-like-objects-enforcing/101825 "2023-07-21T11:38:28Z")

</div>

For many users, this is probably a minor bike-shed thing but I wanted to dump it ;) maybe it’s even a bug or let’s say, design flaw (see at the end), no idea. I use function-like objects a lot in my packages and I const…

---

## [Font Unavailable in JuliaHub's Pluto](https://discourse.julialang.org/t/font-unavailable-in-juliahubs-pluto/101881)

<div class="topic-metadata">

**Author:** [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)\
**Replies:** 0\
**Last updated:** [July 21, 2023, 10:16am UTC](https://discourse.julialang.org/t/font-unavailable-in-juliahubs-pluto/101881 "2023-07-21T10:16:34Z")

</div>

I recently uploaded my first notebook to JuliaHub. However, I’ve encountered an issue where, due to the absence of font files on the cloud machine, I cannot perform my visualizations. Any advice to rectify this would be …

---

## [Unclear documentation of \`collect\`? (similarity and difference with brackets)](https://discourse.julialang.org/t/unclear-documentation-of-collect-similarity-and-difference-with-brackets/101843)

<div class="topic-metadata">

**Author:** [@pierre-haessig](https://discourse.julialang.org/u/pierre-haessig)\
**Replies:** 2\
**Last updated:** [July 21, 2023, 9:10am UTC](https://discourse.julialang.org/t/unclear-documentation-of-collect-similarity-and-difference-with-brackets/101843 "2023-07-21T09:10:25Z")

</div>

Hello, I just came across the docstring of collect (Collections and Data Structures · The Julia Language) and I’ve got the feeling that the second usage example would need some more explanation, or is it just me? julia\>…

---

## [Intersection and area of non-convex polygons](https://discourse.julialang.org/t/intersection-and-area-of-non-convex-polygons/101856)

<div class="topic-metadata">

**Author:** [@ferrolho](https://discourse.julialang.org/u/ferrolho)\
**Replies:** 1\
**Last updated:** [July 21, 2023, 6:25am UTC](https://discourse.julialang.org/t/intersection-and-area-of-non-convex-polygons/101856 "2023-07-21T06:25:26Z")

</div>

I am trying to use Julia for visualising instances of the moving sofa problem. I would like to be able to calculate the intersection between non-convex shapes and to also calculate the area of the resulting shapes. Howev…

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

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