# General Usage

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

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

**Page:** 289

---

## [Create an executable from script](https://discourse.julialang.org/t/create-an-executable-from-script/99243)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 1\
**Last updated:** [May 22, 2023, 7:00pm UTC](https://discourse.julialang.org/t/create-an-executable-from-script/99243 "2023-05-22T19:00:16Z")

</div>

Googling here and there I managed to rename some .JPG files (produced, I believe, by an iphone) using the exif metadata. I have to give the script to a friend of mine who can’t install programs on his Windows PC. How c…

---

## [Curious case of FFTW performance benchmarking](https://discourse.julialang.org/t/curious-case-of-fftw-performance-benchmarking/99215)

<div class="topic-metadata">

**Author:** [@vvbond](https://discourse.julialang.org/u/vvbond)\
**Replies:** 6\
**Last updated:** [May 22, 2023, 5:06pm UTC](https://discourse.julialang.org/t/curious-case-of-fftw-performance-benchmarking/99215 "2023-05-22T17:06:41Z")

</div>

While benchmarking FFTW’s rfft() transform, I’ve stumbled upon an interesting behaviour that I’d like to pick the collective brain about. The behaviour goes as follows: bm = @benchmark rfft(A,1) setup=(A=rand(Float32,…

---

## [Julia 1.9-rc2 Pluto not plots not working](https://discourse.julialang.org/t/julia-1-9-rc2-pluto-not-plots-not-working/97811)

<div class="topic-metadata">

**Author:** [@peteole](https://discourse.julialang.org/u/peteole)\
**Replies:** 1\
**Last updated:** [May 22, 2023, 4:35pm UTC](https://discourse.julialang.org/t/julia-1-9-rc2-pluto-not-plots-not-working/97811 "2023-05-22T16:35:59Z")

</div>

Hi, a selecting the Julia 1.9-rc2 kernel in a Pluto notebook on my Apple silicon Mac and plotting (for instance running plot(rand(10)) results in the following error: MethodError: no method matching project\_rel\_path(::…

---

## [Can I do linear regression over physical data with Unitful?](https://discourse.julialang.org/t/can-i-do-linear-regression-over-physical-data-with-unitful/99229)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [May 22, 2023, 3:27pm UTC](https://discourse.julialang.org/t/can-i-do-linear-regression-over-physical-data-with-unitful/99229 "2023-05-22T15:27:17Z")

</div>

Hi all! I want to fit a multiple linear model on some data I collected. I decorated my data with units of measure using Unitful.jl, and I use GLM.jl’s lm function to produce the model. However, I can’t make it work. To …

---

## [Bug during redefinition of \`Base.getproperty\` for abstract type](https://discourse.julialang.org/t/bug-during-redefinition-of-base-getproperty-for-abstract-type/99203)

<div class="topic-metadata">

**Author:** [@sirion34](https://discourse.julialang.org/u/sirion34)\
**Replies:** 7\
**Last updated:** [May 22, 2023, 2:27pm UTC](https://discourse.julialang.org/t/bug-during-redefinition-of-base-getproperty-for-abstract-type/99203 "2023-05-22T14:27:28Z")

</div>

why does this bug occur? if you run this code, the console will give a lot of “name” and close with an error, but I didn’t even run the function abstract type AbstractNewType end function Base.getproperty(x::Type{A}, …

---

## [Is it just me getting frequent error messages from Revise.jl?](https://discourse.julialang.org/t/is-it-just-me-getting-frequent-error-messages-from-revise-jl/99210)

<div class="topic-metadata">

**Author:** [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Replies:** 2\
**Last updated:** [May 22, 2023, 1:52pm UTC](https://discourse.julialang.org/t/is-it-just-me-getting-frequent-error-messages-from-revise-jl/99210 "2023-05-22T13:52:20Z")

</div>

When working with Julia (and using my startup file that has @eval using Revise in it), many operations fail with the error message: ERROR: UndefVarError: re\_section\_capture not defined This seems to come from Revise. I…

---

## [Why is for loops so slow?](https://discourse.julialang.org/t/why-is-for-loops-so-slow/99199)

<div class="topic-metadata">

**Author:** [@perebalazs](https://discourse.julialang.org/u/perebalazs)\
**Replies:** 9\
**Last updated:** [May 22, 2023, 1:48pm UTC](https://discourse.julialang.org/t/why-is-for-loops-so-slow/99199 "2023-05-22T13:48:46Z")

</div>

I tried to write a simple code for solving a system of equations using Gauss elimination. The coefficient matrix is symmetric. This code runs more than 16 times slower than the built-in x=A\\b algorithm. I’ve tried almost…

---

## [Still not able to render a Quarto file (qmd) using Julia in VSCode. Help?](https://discourse.julialang.org/t/still-not-able-to-render-a-quarto-file-qmd-using-julia-in-vscode-help/98701)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 5\
**Last updated:** [May 22, 2023, 6:30am UTC](https://discourse.julialang.org/t/still-not-able-to-render-a-quarto-file-qmd-using-julia-in-vscode-help/98701 "2023-05-22T06:30:07Z")

</div>

My questions is basically a follow up to a very similar question you can find here. I have: run Pkg.build("IJulia"), removed and reinstalled IJulia, and then built the package again, removed the Jupyter extension and…

---

## [Symbolics- Expression changing behaviour after println()](https://discourse.julialang.org/t/symbolics-expression-changing-behaviour-after-println/99195)

<div class="topic-metadata">

**Author:** [@Whyborn](https://discourse.julialang.org/u/Whyborn)\
**Replies:** 0\
**Last updated:** [May 22, 2023, 1:56am UTC](https://discourse.julialang.org/t/symbolics-expression-changing-behaviour-after-println/99195 "2023-05-22T01:56:55Z")

</div>

Hi, I have observed some very strange behaviour using Symbolics.jl that I’m trying to understand. The behaviour of expressions in a dictionary, one which I might pass to Symbolics.substitute(), changes after I println() …

---

## [Recue Interpolated data from old JLD2](https://discourse.julialang.org/t/recue-interpolated-data-from-old-jld2/99181)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 6\
**Last updated:** [May 21, 2023, 3:50pm UTC](https://discourse.julialang.org/t/recue-interpolated-data-from-old-jld2/99181 "2023-05-21T15:50:01Z")

</div>

Hi everyone, a couple of years ago a created some interpolated functions with Interpolations.jl and saved then to files in JLD2. I used them a lot back in the day, but trying to load them now (new computer, new OS, new J…

---

## [Area of Surface of Revolution Integral too Hard to be Computed By JULIA' SymPy and Python' SymPy](https://discourse.julialang.org/t/area-of-surface-of-revolution-integral-too-hard-to-be-computed-by-julia-sympy-and-python-sympy/92981)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 10\
**Last updated:** [May 21, 2023, 1:04pm UTC](https://discourse.julialang.org/t/area-of-surface-of-revolution-integral-too-hard-to-be-computed-by-julia-sympy-and-python-sympy/92981 "2023-05-21T13:04:46Z")

</div>

Hi all, I want to get the numerical answer of the area integral. the curve is y =( x^6 + 2)/(8x^2) with 1 \\le x \\le 3, revolved about x-axis. the formula is: A = 2 \\pi \* \\int\_{a}^{b} f(x) \* \\sqrt{1 + f'(x)} dx Julia…

---

## [Compact display of Floats with @show?](https://discourse.julialang.org/t/compact-display-of-floats-with-show/97554)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 4\
**Last updated:** [May 21, 2023, 11:17am UTC](https://discourse.julialang.org/t/compact-display-of-floats-with-show/97554 "2023-05-21T11:17:25Z")

</div>

julia\> Base.active\_repl.options.iocontext\[:compact\]=true true julia\> e = exp(1) 2.71828 julia\> @show e; e = 2.718281828459045

---

## [Create matrix, such that each row is the difference of an array with one of its values](https://discourse.julialang.org/t/create-matrix-such-that-each-row-is-the-difference-of-an-array-with-one-of-its-values/86040)

<div class="topic-metadata">

**Author:** [@elii17](https://discourse.julialang.org/u/elii17)\
**Replies:** 3\
**Last updated:** [May 21, 2023, 10:06am UTC](https://discourse.julialang.org/t/create-matrix-such-that-each-row-is-the-difference-of-an-array-with-one-of-its-values/86040 "2023-05-21T10:06:02Z")

</div>

Hey ! I was wondering if there was an efficient if given an array a = \[x\_1,...,x\_i\] to get a matrix that is given by M = \[\[x\_1-x\_1,x\_2-x\_1,...,x\_i - x\_1\],\[x\_1-x\_2,x\_2-x\_2,...,x\_i - x\_2\] ,etc.\] The only thing I ha…

---

## [Does a package extension need its deps installed directly?](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 3\
**Last updated:** [May 20, 2023, 11:07pm UTC](https://discourse.julialang.org/t/does-a-package-extension-need-its-deps-installed-directly/99148 "2023-05-20T23:07:31Z")

</div>

I was trying out writing a package extension to use with Makie. GitHub - jkrumbiegel/MakiePkgExtTest In my testing, it appeared that the extension did not load when I had only CairoMakie and SomePackage installed in the…

---

## [Storing collections of heterogeneous data](https://discourse.julialang.org/t/storing-collections-of-heterogeneous-data/99159)

<div class="topic-metadata">

**Author:** [@bvanderbeek](https://discourse.julialang.org/u/bvanderbeek)\
**Replies:** 7\
**Last updated:** [May 20, 2023, 9:55pm UTC](https://discourse.julialang.org/t/storing-collections-of-heterogeneous-data/99159 "2023-05-20T21:55:38Z")

</div>

I’m writing some Julia code in which I need to loop over a collection of observations. The observations are not all of the same type and each type of observation is defined in a specific structure. I need to then perform…

---

## [Copy array elements by index](https://discourse.julialang.org/t/copy-array-elements-by-index/99127)

<div class="topic-metadata">

**Author:** [@Simon\_Exner](https://discourse.julialang.org/u/Simon_Exner)\
**Replies:** 5\
**Last updated:** [May 20, 2023, 3:03pm UTC](https://discourse.julialang.org/t/copy-array-elements-by-index/99127 "2023-05-20T15:03:13Z")

</div>

Hi, MWE: function y\_from\_x!(y, x) interesting\_indices = \[7, 2, 4\] for i in keys(interesting\_indices) y\[i\] = x\[interesting\_indices\[i\]\] end end a=collect(2:9) b=zeros(3) y\_from\_x!(b,a) then b is \[8.0…

---

## [Patterns for precompiling workloads that could error](https://discourse.julialang.org/t/patterns-for-precompiling-workloads-that-could-error/99156)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 0\
**Last updated:** [May 20, 2023, 10:02am UTC](https://discourse.julialang.org/t/patterns-for-precompiling-workloads-that-could-error/99156 "2023-05-20T10:02:21Z")

</div>

I’ve been thinking about precompilation and code that could error. In this situation, I would like to run a workload that might throw an error during precompilation. The workload is just for optimization, an error here s…

---

## [Where are the C API header files when I install with juliaup?](https://discourse.julialang.org/t/where-are-the-c-api-header-files-when-i-install-with-juliaup/99151)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [May 20, 2023, 9:40am UTC](https://discourse.julialang.org/t/where-are-the-c-api-header-files-when-i-install-with-juliaup/99151 "2023-05-20T09:40:12Z")

</div>

I switched from manually downloading Julia to using the juliaup installer. Now I just get a binary executable that launches Julia, but I cannot find the header files for embedding Julia in C/C++. Is this a limitation of …

---

## [Macro to create a generated function](https://discourse.julialang.org/t/macro-to-create-a-generated-function/99135)

<div class="topic-metadata">

**Author:** [@devetak-m](https://discourse.julialang.org/u/devetak-m)\
**Replies:** 3\
**Last updated:** [May 20, 2023, 7:51am UTC](https://discourse.julialang.org/t/macro-to-create-a-generated-function/99135 "2023-05-20T07:51:57Z")

</div>

Hello. I want to create a macro that reads: macro store(agent, value) f\_name = Symbol("store\_", value) f = quote @inline @generated function $f\_name(a, v) return quote a.value = v end …

---

## [How can I easily upgrade to the latest version of Julia?](https://discourse.julialang.org/t/how-can-i-easily-upgrade-to-the-latest-version-of-julia/99141)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [May 20, 2023, 6:23am UTC](https://discourse.julialang.org/t/how-can-i-easily-upgrade-to-the-latest-version-of-julia/99141 "2023-05-20T06:23:44Z")

</div>

For example, if I am currently using Julia v1.8, and I want to upgrade to Julia v1.9 while keeping all previously installed packages, how can I do that? I am using the VS Code development environment on win10. Thanks!

---

## [Fastest way to check for Inf or NaN in an array?](https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 57\
**Last updated:** [May 19, 2023, 11:10pm UTC](https://discourse.julialang.org/t/fastest-way-to-check-for-inf-or-nan-in-an-array/76954 "2023-05-19T23:10:44Z")

</div>

What is the fastest way to check for Inf or NaN in an array? This has surprisingly become the bottleneck in one of my codes, and I’m looking for the fastest possible strategy I noticed that running sum on an array, then…

---

## [Solving non-linear coupled ODEs backwards in time vs reverse-mode autodiff](https://discourse.julialang.org/t/solving-non-linear-coupled-odes-backwards-in-time-vs-reverse-mode-autodiff/98979)

<div class="topic-metadata">

**Author:** [@differentialoperator](https://discourse.julialang.org/u/differentialoperator)\
**Replies:** 10\
**Last updated:** [May 19, 2023, 9:19pm UTC](https://discourse.julialang.org/t/solving-non-linear-coupled-odes-backwards-in-time-vs-reverse-mode-autodiff/98979 "2023-05-19T21:19:38Z")

</div>

I have a very silly question. I am trying to understand how reverse-mode autodiff is able to actually work on coupled non-linear ODE systems that are very hard to solve backwards in time. Take the Lorenz system (I am ne…

---

## [Wrong word in the manual?](https://discourse.julialang.org/t/wrong-word-in-the-manual/99123)

<div class="topic-metadata">

**Author:** [@chskcau](https://discourse.julialang.org/u/chskcau)\
**Replies:** 1\
**Last updated:** [May 19, 2023, 6:56pm UTC](https://discourse.julialang.org/t/wrong-word-in-the-manual/99123 "2023-05-19T18:56:02Z")

</div>

Hello, I’m just in the process of learning Julia and reading the manual, and in the section on promotion I noticed the following statement: The most common usages of promote occur in outer constructors methods, provid…

---

## [Topology optimization in gridap for structural problem](https://discourse.julialang.org/t/topology-optimization-in-gridap-for-structural-problem/98945)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 19\
**Last updated:** [May 19, 2023, 5:16pm UTC](https://discourse.julialang.org/t/topology-optimization-in-gridap-for-structural-problem/98945 "2023-05-19T17:16:35Z")

</div>

HI, I am using gridap package to FE and then topology optimization. i just followed the tutorial 18 of gridap but I get error as below. i really appreciate if anyone help me. also my model is 2D i dont know if i should s…

---

## [Implementing a Trie](https://discourse.julialang.org/t/implementing-a-trie/99022)

<div class="topic-metadata">

**Author:** [@spionkaese](https://discourse.julialang.org/u/spionkaese)\
**Replies:** 6\
**Last updated:** [May 19, 2023, 4:06pm UTC](https://discourse.julialang.org/t/implementing-a-trie/99022 "2023-05-19T16:06:10Z")

</div>

I am currently trying to implement a (bitwise?) Trie mapping Ints to some type V, and want to branch k bits at a time (resulting in 2^k children per node). For a first attempt I went with k = 1 and my nodes looked like …

---

## [Multithreading over multiple CPU](https://discourse.julialang.org/t/multithreading-over-multiple-cpu/99106)

<div class="topic-metadata">

**Author:** [@astro-kevin](https://discourse.julialang.org/u/astro-kevin)\
**Replies:** 8\
**Last updated:** [May 19, 2023, 3:57pm UTC](https://discourse.julialang.org/t/multithreading-over-multiple-cpu/99106 "2023-05-19T15:57:00Z")

</div>

Is the @threads macro available for multithreading over multiple CPU, or does it only work for setups with one CPU?

---

## [Construct Tuple containing NamedTuple from Tuple](https://discourse.julialang.org/t/construct-tuple-containing-namedtuple-from-tuple/98954)

<div class="topic-metadata">

**Author:** [@baumgold](https://discourse.julialang.org/u/baumgold)\
**Replies:** 8\
**Last updated:** [May 19, 2023, 2:46pm UTC](https://discourse.julialang.org/t/construct-tuple-containing-namedtuple-from-tuple/98954 "2023-05-19T14:46:52Z")

</div>

I’m trying to construct a Tuple containing a member NamedTuple from a Tuple. I believe this should work but it doesn’t. julia\> T = Tuple{Int64, Int64, NamedTuple{(:d, :e), Tuple{Int64, Int64}}}; julia\> vals = (1,2,(3,…

---

## [How can I avoid using global variables that will vary their values?](https://discourse.julialang.org/t/how-can-i-avoid-using-global-variables-that-will-vary-their-values/99085)

<div class="topic-metadata">

**Author:** [@AliceandBob](https://discourse.julialang.org/u/AliceandBob)\
**Replies:** 14\
**Last updated:** [May 19, 2023, 2:21pm UTC](https://discourse.julialang.org/t/how-can-i-avoid-using-global-variables-that-will-vary-their-values/99085 "2023-05-19T14:21:45Z")

</div>

I am using Julia to solve a quantum system with a self-consistence iteration algorithm. In my current code, many global variables and arrays are used which, from many documents, are harmful to the performance. However, I…

---

## [Adding new field to existing structure](https://discourse.julialang.org/t/adding-new-field-to-existing-structure/99117)

<div class="topic-metadata">

**Author:** [@josimar](https://discourse.julialang.org/u/josimar)\
**Replies:** 2\
**Last updated:** [May 19, 2023, 1:54pm UTC](https://discourse.julialang.org/t/adding-new-field-to-existing-structure/99117 "2023-05-19T13:54:25Z")

</div>

I am trying to learn more about the way to organize my Julia code. I know from the documentation that I can create a structure to hold some data like this: ## The structure below has lots of fields, I am just showing on…

---

## [Collect for CuArray composite types](https://discourse.julialang.org/t/collect-for-cuarray-composite-types/99082)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 2\
**Last updated:** [May 19, 2023, 11:46am UTC](https://discourse.julialang.org/t/collect-for-cuarray-composite-types/99082 "2023-05-19T11:46:44Z")

</div>

Using CUDA.jl single index access is discouraged for good reasons. However, if I want to implement a composite type (e.g. ShiftedArrays.jl) to work well with CuArray it needs to support collect. Yet the collect mechanis…

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

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