# General Usage

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

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

**Page:** 201

---

## [This function seems to allocate memory only if the argument types are not annotated in the definition](https://discourse.julialang.org/t/this-function-seems-to-allocate-memory-only-if-the-argument-types-are-not-annotated-in-the-definition/110193)

<div class="topic-metadata">

**Author:** [@Joaquin\_Rodriguez](https://discourse.julialang.org/u/Joaquin_Rodriguez)\
**Replies:** 5\
**Last updated:** [February 14, 2024, 1:41pm UTC](https://discourse.julialang.org/t/this-function-seems-to-allocate-memory-only-if-the-argument-types-are-not-annotated-in-the-definition/110193 "2024-02-14T13:41:17Z")

</div>

I am defining a custom data type that behaves like a vector (in the linear algebra sense). I defined it as a structure with a 6-element StaticVector that holds the underlying data: using StaticArrays struct MyVectorTyp…

---

## [PlutoPlotly: save a plot with LaTeX strings](https://discourse.julialang.org/t/plutoplotly-save-a-plot-with-latex-strings/110163)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 3\
**Last updated:** [February 14, 2024, 1:03pm UTC](https://discourse.julialang.org/t/plutoplotly-save-a-plot-with-latex-strings/110163 "2024-02-14T13:03:29Z")

</div>

Hi, I can produce a plot in Pluto with some LaTeX ingredients using PlutoPlotly and LaTexStrings (which is not possible to achieve to the best of my knowledge using PlotlyJS). The plot is perfectly rendered in the noteb…

---

## [Multi-threaded code requiring scratch space](https://discourse.julialang.org/t/multi-threaded-code-requiring-scratch-space/109997)

<div class="topic-metadata">

**Author:** [@PGS62](https://discourse.julialang.org/u/PGS62)\
**Replies:** 17\
**Last updated:** [February 14, 2024, 12:40pm UTC](https://discourse.julialang.org/t/multi-threaded-code-requiring-scratch-space/109997 "2024-02-14T12:40:37Z")

</div>

I think it’s true that to get decent performance from multi-threaded code, it’s a good idea to minimise the amount of allocation done by each task. One way to do this can be calling functions that accept a “scratch” argu…

---

## [Pointer-like field in a struct?](https://discourse.julialang.org/t/pointer-like-field-in-a-struct/109835)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 7\
**Last updated:** [February 14, 2024, 9:56am UTC](https://discourse.julialang.org/t/pointer-like-field-in-a-struct/109835 "2024-02-14T09:56:59Z")

</div>

Hi, I hope somebody here can help me with this one. I’m building a Monte Carlo code for a system of particles. Position coordinates of these N particles are stored in a 3xN array of coordinates r\[:,:\], like for instanc…

---

## [Closest cousin of mapview in julia](https://discourse.julialang.org/t/closest-cousin-of-mapview-in-julia/110197)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 1\
**Last updated:** [February 14, 2024, 8:37am UTC](https://discourse.julialang.org/t/closest-cousin-of-mapview-in-julia/110197 "2024-02-14T08:37:41Z")

</div>

The package mapview in R allows one to generate interactive html (with JS) maps, i.e. ones that can be zoomed in and out, moved, shared with others, etcetera. Is there a good alternative in Julia? I’m aware of Leaflet.…

---

## [How to define ode without mass\_matrix](https://discourse.julialang.org/t/how-to-define-ode-without-mass-matrix/110190)

<div class="topic-metadata">

**Author:** [@whucsu](https://discourse.julialang.org/u/whucsu)\
**Replies:** 4\
**Last updated:** [February 14, 2024, 2:12am UTC](https://discourse.julialang.org/t/how-to-define-ode-without-mass-matrix/110190 "2024-02-14T02:12:45Z")

</div>

Dear All, I am not so familary with Julia ode. Here as to the ode definition using ODEfunction: also online:CMSB-2023/UKF.jl at main · H-Sax/CMSB-2023 · GitHub the code as below: function NIK!(du, u, p, t) pLV, psa…

---

## [Startup.jl with \`@spawn @eval\`](https://discourse.julialang.org/t/startup-jl-with-spawn-eval/110076)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 0\
**Last updated:** [February 11, 2024, 7:49pm UTC](https://discourse.julialang.org/t/startup-jl-with-spawn-eval/110076 "2024-02-11T19:49:31Z")

</div>

To reduce startup latency, I’m trying a new startup.jl with atreplinit(repl-\> Threads.@spawn @eval begin using Revise using OhMyREPL using Compat ... end) Are there any issues I need to be aware of when doing this? Ed…

---

## [How to write a unit test for a conditional macro?](https://discourse.julialang.org/t/how-to-write-a-unit-test-for-a-conditional-macro/110168)

<div class="topic-metadata">

**Author:** [@rssdev10](https://discourse.julialang.org/u/rssdev10)\
**Replies:** 6\
**Last updated:** [February 13, 2024, 10:01pm UTC](https://discourse.julialang.org/t/how-to-write-a-unit-test-for-a-conditional-macro/110168 "2024-02-13T22:01:06Z")

</div>

Hi, is there any way to invalidate the code of a macro? I have implemented a macro that depends on system environment. Now I’m trying to write a unit test for it. I’m able to delay macro code expansion by placing the fir…

---

## [Pluto - Clear Stale / Deleted Notebooks](https://discourse.julialang.org/t/pluto-clear-stale-deleted-notebooks/110152)

<div class="topic-metadata">

**Author:** [@benslinux](https://discourse.julialang.org/u/benslinux)\
**Replies:** 0\
**Last updated:** [February 13, 2024, 1:03pm UTC](https://discourse.julialang.org/t/pluto-clear-stale-deleted-notebooks/110152 "2024-02-13T13:03:27Z")

</div>

Pluto Notebooks work great with Julia. When Pluto opens, you may have a list of “stale” or deleted notebook.jl files which appear in list when opened. Deleting them from your computer won’t remove them from this list. Th…

---

## [Pluto: Table of Contents´ position](https://discourse.julialang.org/t/pluto-table-of-contents-position/110111)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 3\
**Last updated:** [February 13, 2024, 7:04pm UTC](https://discourse.julialang.org/t/pluto-table-of-contents-position/110111 "2024-02-13T19:04:33Z")

</div>

Hi, Does anyone know how to force the Table of Contents to be kept at a fixed distance from the main body of the Pluto window? When we change the size of the browser’s window, the Table of Contents can overlap with Plut…

---

## [NonlinearSolve OrdinaryDiffEq ModelingToolkit](https://discourse.julialang.org/t/nonlinearsolve-ordinarydiffeq-modelingtoolkit/108737)

<div class="topic-metadata">

**Author:** [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Replies:** 13\
**Last updated:** [February 13, 2024, 3:36pm UTC](https://discourse.julialang.org/t/nonlinearsolve-ordinarydiffeq-modelingtoolkit/108737 "2024-02-13T15:36:19Z")

</div>

Hi everybody ! I’m experiencing problems when using those packages together here is the command line pkg\> add Lux Optimization CUDA LuxCUDA Random ComponentArrays ModelingToolkit NeuralPDE none of NonlinearSolve Or…

---

## [Working with path at module level?](https://discourse.julialang.org/t/working-with-path-at-module-level/110142)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [February 13, 2024, 10:34am UTC](https://discourse.julialang.org/t/working-with-path-at-module-level/110142 "2024-02-13T10:34:35Z")

</div>

Hello, I have a package with directories structured like this: Packgage data datafile.txt src package.jl In package.jl, there is a function function foo() f = read("data/datafile.txt") #do smth end …

---

## [Edit() doesn't use JULIA\_EDITOR](https://discourse.julialang.org/t/edit-doesnt-use-julia-editor/110136)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 2\
**Last updated:** [February 13, 2024, 10:08am UTC](https://discourse.julialang.org/t/edit-doesnt-use-julia-editor/110136 "2024-02-13T10:08:14Z")

</div>

I defined the environment variable JULIA\_EDITOR=“gedit” in my startup.jl file, but edit(path) or edit(fn) still open with nano: shell\> echo $JULIA\_EDITOR gedit julia\> edit( "~/.julia/juliaup/julia-1.10.0+0.x64.linu…

---

## [Struct with field types defined by parametric type](https://discourse.julialang.org/t/struct-with-field-types-defined-by-parametric-type/110117)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 5\
**Last updated:** [February 13, 2024, 8:48am UTC](https://discourse.julialang.org/t/struct-with-field-types-defined-by-parametric-type/110117 "2024-02-13T08:48:53Z")

</div>

Say I have a struct MyStruct such that struct A ... end struct B ... end struct MyStruct{T \<: Union{A, B}} t::T v::Vector end I want v to be of type Vector{Float64} if T == A, else if T == B then v should be of t…

---

## [Massive delay when calling a fast function](https://discourse.julialang.org/t/massive-delay-when-calling-a-fast-function/110120)

<div class="topic-metadata">

**Author:** [@narnold0](https://discourse.julialang.org/u/narnold0)\
**Replies:** 13\
**Last updated:** [February 13, 2024, 1:48am UTC](https://discourse.julialang.org/t/massive-delay-when-calling-a-fast-function/110120 "2024-02-13T01:48:01Z")

</div>

Hey there. I’m having trouble with delay from dictionaries and functions. For example, I have a funciton that takes a graph and vertex positions that gets the edge line segments. This function itself takes \<15 μs from Ti…

---

## [Custom fancy printing of non-empty Dict?](https://discourse.julialang.org/t/custom-fancy-printing-of-non-empty-dict/110127)

<div class="topic-metadata">

**Author:** [@GPhMorin](https://discourse.julialang.org/u/GPhMorin)\
**Replies:** 3\
**Last updated:** [February 13, 2024, 1:27am UTC](https://discourse.julialang.org/t/custom-fancy-printing-of-non-empty-dict/110127 "2024-02-13T01:27:14Z")

</div>

For a project, I would like the output of a Dict (and, more specifically, an OrderedDict) containing a type specific to my project to be a custom fancy print instead of an overview of the dictionary’s contents. When I a…

---

## [Overload broadcasting for custom struct?](https://discourse.julialang.org/t/overload-broadcasting-for-custom-struct/42240)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 11\
**Last updated:** [February 12, 2024, 11:13pm UTC](https://discourse.julialang.org/t/overload-broadcasting-for-custom-struct/42240 "2024-02-12T23:13:44Z")

</div>

Hello! I have a struct defined as: struct T3{T} x::T y::T z::T end I want to overload it such that when I write: T3(1,1,1) .\* 5 = T3(5,5,5) But I do not know how to overload “.\*”. Ca…

---

## [Error for 396^n](https://discourse.julialang.org/t/error-for-396-n/110099)

<div class="topic-metadata">

**Author:** [@Jeroens](https://discourse.julialang.org/u/Jeroens)\
**Replies:** 8\
**Last updated:** [February 12, 2024, 11:08pm UTC](https://discourse.julialang.org/t/error-for-396-n/110099 "2024-02-12T23:08:19Z")

</div>

Something weird is happening in Julia when using 396^8… In fact 396^n with n \< 8 works fine, with n =\>8 gives you a large negative number…

---

## [GUI integrated with Pluto for 3D and 2D plots](https://discourse.julialang.org/t/gui-integrated-with-pluto-for-3d-and-2d-plots/110013)

<div class="topic-metadata">

**Author:** [@vambrosi](https://discourse.julialang.org/u/vambrosi)\
**Replies:** 3\
**Last updated:** [February 12, 2024, 10:56pm UTC](https://discourse.julialang.org/t/gui-integrated-with-pluto-for-3d-and-2d-plots/110013 "2024-02-12T22:56:14Z")

</div>

I’m having trouble finding the right combination of GUI and plotting package that would work with a package I’m developing, and I was hoping to get an opinion from someone more familiar with the Julia ecosystem. The con…

---

## [Make functions in the present model available to workers](https://discourse.julialang.org/t/make-functions-in-the-present-model-available-to-workers/110034)

<div class="topic-metadata">

**Author:** [@kingoslo](https://discourse.julialang.org/u/kingoslo)\
**Replies:** 6\
**Last updated:** [February 12, 2024, 6:37pm UTC](https://discourse.julialang.org/t/make-functions-in-the-present-model-available-to-workers/110034 "2024-02-12T18:37:56Z")

</div>

Hello. I am trying to use pmap to call a function that is defined inside the present module, but I can’t make it work. I’ve searched for a few hours for the solution. Therefore I decided to write here. This is a minimal…

---

## [Creating a method dynamically with keyword arguments](https://discourse.julialang.org/t/creating-a-method-dynamically-with-keyword-arguments/110108)

<div class="topic-metadata">

**Author:** [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Replies:** 4\
**Last updated:** [February 12, 2024, 6:25pm UTC](https://discourse.julialang.org/t/creating-a-method-dynamically-with-keyword-arguments/110108 "2024-02-12T18:25:33Z")

</div>

I have a context structure with many fields and want to mutate some by reinitialising, where I could do various validations. I know there is an excellent SetField.jl package, but I have only one structure, and thus, I wo…

---

## [How to use WriteVTK properly when saving continous simulation results?](https://discourse.julialang.org/t/how-to-use-writevtk-properly-when-saving-continous-simulation-results/109506)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 7\
**Last updated:** [February 12, 2024, 6:16pm UTC](https://discourse.julialang.org/t/how-to-use-writevtk-properly-when-saving-continous-simulation-results/109506 "2024-02-12T18:16:21Z")

</div>

Hello! I would just like to check that I am doing this right. I use WriteVTK a lot and really love it. I run a simulation in which every N time steps I output a .vtp file. The ‘pseudo’ code I use looks like this: # Th…

---

## [Is it possible to uniquely identify computing threads?](https://discourse.julialang.org/t/is-it-possible-to-uniquely-identify-computing-threads/110084)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [February 12, 2024, 5:59pm UTC](https://discourse.julialang.org/t/is-it-possible-to-uniquely-identify-computing-threads/110084 "2024-02-12T17:59:59Z")

</div>

Let us say I spin up a certain number of threads, julia -t 5. Is it possible to uniquely identify which thread is running my code at some point in time? I don’t mean threadid(), unless that is guaranteed to be unique.

---

## [Access a tuple of structs using the values of an integer array](https://discourse.julialang.org/t/access-a-tuple-of-structs-using-the-values-of-an-integer-array/109980)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 16\
**Last updated:** [February 12, 2024, 4:30pm UTC](https://discourse.julialang.org/t/access-a-tuple-of-structs-using-the-values-of-an-integer-array/109980 "2024-02-12T16:30:30Z")

</div>

I have a tuple of heterogeneous structures: struct Foo{T} a :: T b :: T end foos = (Foo(1,2), Foo(3.0,4.0)) and I have a 3D grid which is separated into different regions such that in a given region I want to …

---

## [Programming error or language understanding error?](https://discourse.julialang.org/t/programming-error-or-language-understanding-error/110053)

<div class="topic-metadata">

**Author:** [@mpeters2](https://discourse.julialang.org/u/mpeters2)\
**Replies:** 7\
**Last updated:** [February 12, 2024, 3:47pm UTC](https://discourse.julialang.org/t/programming-error-or-language-understanding-error/110053 "2024-02-12T15:47:44Z")

</div>

I either have a bug in my code, or a misunderstanding of the Julia language. I have two struct types: an Ellipse and a Circle. In order to simplify my code, I have a single drawing function that draws an ellipse. Since…

---

## [Generate and evaluate functions programmatically](https://discourse.julialang.org/t/generate-and-evaluate-functions-programmatically/110083)

<div class="topic-metadata">

**Author:** [@VPBML](https://discourse.julialang.org/u/VPBML)\
**Replies:** 2\
**Last updated:** [February 12, 2024, 12:27pm UTC](https://discourse.julialang.org/t/generate-and-evaluate-functions-programmatically/110083 "2024-02-12T12:27:55Z")

</div>

Hi, I wonder what is the best way (performance-wise) to generate and evaluate functions programmatically. The functions I need are generated dynamically via a Genetic Programming algorithm (i.e., they are based on previ…

---

## [Cuda (Julia vs C++)](https://discourse.julialang.org/t/cuda-julia-vs-c/109865)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 4\
**Last updated:** [February 12, 2024, 12:03pm UTC](https://discourse.julialang.org/t/cuda-julia-vs-c/109865 "2024-02-12T12:03:44Z")

</div>

Are there any benchmarks between C++ cuda and Cuda.jl?

---

## [How to implement hybrid parallelized programs](https://discourse.julialang.org/t/how-to-implement-hybrid-parallelized-programs/109604)

<div class="topic-metadata">

**Author:** [@mdyuki](https://discourse.julialang.org/u/mdyuki)\
**Replies:** 29\
**Last updated:** [February 12, 2024, 8:31am UTC](https://discourse.julialang.org/t/how-to-implement-hybrid-parallelized-programs/109604 "2024-02-12T08:31:30Z")

</div>

Hello. I have scientific computing codes that contain nested loops. I have parallelized them so far with multithreading one of the loops. This improved performance, but I need to reduce more computational time. To increa…

---

## [Packaging a Julia library with PyJulia](https://discourse.julialang.org/t/packaging-a-julia-library-with-pyjulia/108900)

<div class="topic-metadata">

**Author:** [@stefanjon](https://discourse.julialang.org/u/stefanjon)\
**Replies:** 8\
**Last updated:** [February 12, 2024, 5:59am UTC](https://discourse.julialang.org/t/packaging-a-julia-library-with-pyjulia/108900 "2024-02-12T05:59:14Z")

</div>

I have a general question about the possibilities of Packaging a Julia library that is wrapped in python using PyJulia so that it can easily be put into a wheel for distribution. To give some context, I have develop an …

---

## [What does Aqua mean here?](https://discourse.julialang.org/t/what-does-aqua-mean-here/110085)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [February 12, 2024, 4:14am UTC](https://discourse.julialang.org/t/what-does-aqua-mean-here/110085 "2024-02-12T04:14:04Z")

</div>

Compare Project.toml and test/Project.toml | 1 1 0.00000e+00s Stale dependencies: Test Failed at C:\\Users\\pkonl\\VSCode\_Julia\_portable-main\\assets\\.julia-1.10.0-depot\\packages\\Aqua\\9p8ck\\src\\stale\_deps.jl:31 Ex…

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

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