# General Usage

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

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

**Page:** 223

---

## [Mktempdir bug](https://discourse.julialang.org/t/mktempdir-bug/103022)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 10\
**Last updated:** [December 7, 2023, 12:30pm UTC](https://discourse.julialang.org/t/mktempdir-bug/103022 "2023-12-07T12:30:17Z")

</div>

Julia has an issue caused by mktempdir() that prevents precompiling of multiple packages on affected systems. This bug is three or more years old, yet is manifested sporadically, which is probably why it has not been fi…

---

## [Help with launching Pluto](https://discourse.julialang.org/t/help-with-launching-pluto/107234)

<div class="topic-metadata">

**Author:** [@adannenberg](https://discourse.julialang.org/u/adannenberg)\
**Replies:** 3\
**Last updated:** [December 7, 2023, 12:06pm UTC](https://discourse.julialang.org/t/help-with-launching-pluto/107234 "2023-12-07T12:06:41Z")

</div>

I have Julia 1.9.4 and 1.10.0 rc 2 installed on a Macbook Pro. I use Pluto extensively. Suddenly today I can’t launch it. I get the screenshot below, and this is true in both the default browser (Chrome) and alternate…

---

## [Transformers.jl: How to train for masked languge model tasks in Julia?](https://discourse.julialang.org/t/transformers-jl-how-to-train-for-masked-languge-model-tasks-in-julia/107227)

<div class="topic-metadata">

**Author:** [@roeya](https://discourse.julialang.org/u/roeya)\
**Replies:** 4\
**Last updated:** [December 7, 2023, 11:25am UTC](https://discourse.julialang.org/t/transformers-jl-how-to-train-for-masked-languge-model-tasks-in-julia/107227 "2023-12-07T11:25:53Z")

</div>

What am I missing here - seems to be easy enough but I cannot find any documentation on how to do it

---

## [Symbolically evaluating an in-place function](https://discourse.julialang.org/t/symbolically-evaluating-an-in-place-function/107264)

<div class="topic-metadata">

**Author:** [@Neodym](https://discourse.julialang.org/u/Neodym)\
**Replies:** 2\
**Last updated:** [December 7, 2023, 11:05am UTC](https://discourse.julialang.org/t/symbolically-evaluating-an-in-place-function/107264 "2023-12-07T11:05:03Z")

</div>

Hi there, I have an in-place function (RHS of an ODE) and would like to evaluate it with Symbolics.jl. Later on, I want to compute its Jacobian. However, I cannot figure out how to do that. It appears to not do anythin…

---

## [Boxing obvious cases where the type is clear](https://discourse.julialang.org/t/boxing-obvious-cases-where-the-type-is-clear/107192)

<div class="topic-metadata">

**Author:** [@feribg](https://discourse.julialang.org/u/feribg)\
**Replies:** 13\
**Last updated:** [December 7, 2023, 9:57am UTC](https://discourse.julialang.org/t/boxing-obvious-cases-where-the-type-is-clear/107192 "2023-12-07T09:57:47Z")

</div>

Im new to Julia but this whole world of dynamic and static typing is becoming very disconcerning. Take a look at this: Regardless what i do i get: Locals #15::var"#15#17"{String, Int64, Int64, Int64} n\_markets::C…

---

## [How to properly use Tullio + CUDA on a package extension?](https://discourse.julialang.org/t/how-to-properly-use-tullio-cuda-on-a-package-extension/103569)

<div class="topic-metadata">

**Author:** [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Replies:** 5\
**Last updated:** [December 7, 2023, 8:39am UTC](https://discourse.julialang.org/t/how-to-properly-use-tullio-cuda-on-a-package-extension/103569 "2023-12-07T08:39:02Z")

</div>

Hi! I have a package that defines many functions which are the evaluation of complex expressions over a multidimensional grid. Sometimes I want the expressions to be allocating, and sometimes not, so there are a lot of …

---

## [Zygote gradient Error](https://discourse.julialang.org/t/zygote-gradient-error/38206)

<div class="topic-metadata">

**Author:** [@amirmasud](https://discourse.julialang.org/u/amirmasud)\
**Replies:** 3\
**Last updated:** [December 7, 2023, 6:56am UTC](https://discourse.julialang.org/t/zygote-gradient-error/38206 "2023-12-07T06:56:34Z")

</div>

Hi all, I’m trying to write an Automatic Differentiation example, I get this error and I don’t know how to solve it. ERROR: Need an adjoint for constructor Transpose{Float64,Array{Float64,2}}. Gradient is of type Arra…

---

## [Is loading non-trigger packages in extensions disallowed now?](https://discourse.julialang.org/t/is-loading-non-trigger-packages-in-extensions-disallowed-now/107254)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [December 7, 2023, 5:58am UTC](https://discourse.julialang.org/t/is-loading-non-trigger-packages-in-extensions-disallowed-now/107254 "2023-12-07T05:58:01Z")

</div>

After #48533, it appears that package extensions are only allowed to load the host and the trigger packages directly, and other packages (including stdlibs) should be loaded as using hostpackage.thirdpackage or using tri…

---

## [What does 'lazy' mean?](https://discourse.julialang.org/t/what-does-lazy-mean/107247)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 3\
**Last updated:** [December 7, 2023, 5:44am UTC](https://discourse.julialang.org/t/what-does-lazy-mean/107247 "2023-12-07T05:44:46Z")

</div>

When I checked the usage of the function ‘transpose’, I got Lazy transpose. Mutating the returned object should appropriately mutate A. Often, but not always, yields Transpose(A), where Transpose is a lazy transpose w…

---

## [Arithmetic operations with NamedTuples](https://discourse.julialang.org/t/arithmetic-operations-with-namedtuples/107140)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 8\
**Last updated:** [December 6, 2023, 8:50pm UTC](https://discourse.julialang.org/t/arithmetic-operations-with-namedtuples/107140 "2023-12-06T20:50:52Z")

</div>

I often use Julia to calculate the nutrition of my meals. I know there are calculators for this online, but I prefer doing this myself in Julia. I normally do this by first defining NamedTuples with the nutritional infor…

---

## [Matrix Free Differentiation](https://discourse.julialang.org/t/matrix-free-differentiation/107134)

<div class="topic-metadata">

**Author:** [@nicrummel](https://discourse.julialang.org/u/nicrummel)\
**Replies:** 7\
**Last updated:** [December 6, 2023, 10:36pm UTC](https://discourse.julialang.org/t/matrix-free-differentiation/107134 "2023-12-06T22:36:31Z")

</div>

Hello all, I am an Applied Mathematics PhD student at CU Boulder, and I want to implement fast matrix free finite difference methods using Julia. This appeared at first glance to be quite simple task, but when I compare…

---

## [What happened to the \`..\` operator?](https://discourse.julialang.org/t/what-happened-to-the-operator/107224)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 7\
**Last updated:** [December 6, 2023, 9:33pm UTC](https://discourse.julialang.org/t/what-happened-to-the-operator/107224 "2023-12-06T21:33:51Z")

</div>

I was trying the example from Makie for a Streamplot which involves the .. operator which is listed as an operator in the docs. However, on Julia 1.9.4 I receive julia\> 1..42 ERROR: UndefVarError: \`..\` not defined Stac…

---

## [How to clear the terminal of VS code?](https://discourse.julialang.org/t/how-to-clear-the-terminal-of-vs-code/107216)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 2\
**Last updated:** [December 6, 2023, 2:34pm UTC](https://discourse.julialang.org/t/how-to-clear-the-terminal-of-vs-code/107216 "2023-12-06T14:34:50Z")

</div>

How to clear the terminal of VS code? In MATLAB, we have ‘clc’.

---

## [ERROR: MethodError: Cannot \`convert\` an object of type Missing to an object of type String](https://discourse.julialang.org/t/error-methoderror-cannot-convert-an-object-of-type-missing-to-an-object-of-type-string/107183)

<div class="topic-metadata">

**Author:** [@steveo314](https://discourse.julialang.org/u/steveo314)\
**Replies:** 18\
**Last updated:** [December 6, 2023, 4:09pm UTC](https://discourse.julialang.org/t/error-methoderror-cannot-convert-an-object-of-type-missing-to-an-object-of-type-string/107183 "2023-12-06T16:09:46Z")

</div>

I get this when trying to run CSV.read("chuckle/random.csv", DataFrame) But when running the same thing on another CSV in the same directory, it works fine.

---

## [Performance and memory in large tensor: Julia vs Fortran](https://discourse.julialang.org/t/performance-and-memory-in-large-tensor-julia-vs-fortran/107218)

<div class="topic-metadata">

**Author:** [@fordonez](https://discourse.julialang.org/u/fordonez)\
**Replies:** 3\
**Last updated:** [December 6, 2023, 3:35pm UTC](https://discourse.julialang.org/t/performance-and-memory-in-large-tensor-julia-vs-fortran/107218 "2023-12-06T15:35:23Z")

</div>

I have a tensor with dimensions (I, J, K, L, M, N), which I am modifying through a loop. I am trying to reach Fortran’s speed in Julia (if (I, J, K, L, M, N) = (100, 100, 100, 100, 10, 10) the Julia/Fortran time ratio is…

---

## [Best way to shift a window around a multidimensional Array?](https://discourse.julialang.org/t/best-way-to-shift-a-window-around-a-multidimensional-array/107219)

<div class="topic-metadata">

**Author:** [@capri](https://discourse.julialang.org/u/capri)\
**Replies:** 2\
**Last updated:** [December 6, 2023, 2:53pm UTC](https://discourse.julialang.org/t/best-way-to-shift-a-window-around-a-multidimensional-array/107219 "2023-12-06T14:53:55Z")

</div>

Okay so let’s say I have a multidimensional Array m and I want to extract a window around a center point that has a size of 3 (for example) in every dimension. The following code does what I want: m = rand(5,5,5) cent…

---

## [Assign a float value to a vector originally of integer type](https://discourse.julialang.org/t/assign-a-float-value-to-a-vector-originally-of-integer-type/107215)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 4\
**Last updated:** [December 6, 2023, 1:24pm UTC](https://discourse.julialang.org/t/assign-a-float-value-to-a-vector-originally-of-integer-type/107215 "2023-12-06T13:24:51Z")

</div>

I created a vector: a = \[1, 2, 3 \] Then I tried to modify its value: a\[2\] = 0.1 I got an error. This kind of performace is ok in MATLAB. How to make it work in Julia? I have to declare that ‘a’ is a float vector at…

---

## [zero(a::Real)?](https://discourse.julialang.org/t/zero-a-real/107175)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 24\
**Last updated:** [December 6, 2023, 12:29pm UTC](https://discourse.julialang.org/t/zero-a-real/107175 "2023-12-06T12:29:20Z")

</div>

Why is zero() of a Real an Int(0) ? The example below looks weird, because it’s as if zero(0.3333333333) == 0::Int. It took me some time to locate the cause of my bug. The bug was that I was getting Vector{Int64} from…

---

## [Inplace axpy! but storing to a third arguement rather than y](https://discourse.julialang.org/t/inplace-axpy-but-storing-to-a-third-arguement-rather-than-y/107188)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 4\
**Last updated:** [December 6, 2023, 10:49am UTC](https://discourse.julialang.org/t/inplace-axpy-but-storing-to-a-third-arguement-rather-than-y/107188 "2023-12-06T10:49:32Z")

</div>

Hello, from the BLAS package, I know that axpy!(a,X,Y) computes Y += a X, where a is a scalar and X and Y are a matrix or a vector. Now I want instead something like Z = a X + Y So, something like axpyz!(a,X,Y,Z). I…

---

## [Tests pass on github, fail locally](https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [December 6, 2023, 10:29am UTC](https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204 "2023-12-06T10:29:41Z")

</div>

If I executing: using PkgHelpers, Pkg Pkg.test("PkgHelpers") this fails with: freeze: Error During Test at /home/ufechner/.julia/packages/PkgHelpers/UHq7F/test/runtests.jl:28 Got exception outside of a @test Syste…

---

## [Median doesn't behave like mean on a vector of vectors](https://discourse.julialang.org/t/median-doesnt-behave-like-mean-on-a-vector-of-vectors/107156)

<div class="topic-metadata">

**Author:** [@ovt](https://discourse.julialang.org/u/ovt)\
**Replies:** 3\
**Last updated:** [December 6, 2023, 10:20am UTC](https://discourse.julialang.org/t/median-doesnt-behave-like-mean-on-a-vector-of-vectors/107156 "2023-12-06T10:20:43Z")

</div>

julia\> using Statistics julia\> y = \[\[i for i in 4\*(j-1)+1:4\*j\] for j in 1:3\] 3-element Vector{Vector{Int64}}: \[1, 2, 3, 4\] \[5, 6, 7, 8\] \[9, 10, 11, 12\] julia\> mean(y) 4-element Vector{Float64}: 5.0 6.0 7.0 8.0 …

---

## [IOError(EOFError() during request with HTTP.jl](https://discourse.julialang.org/t/ioerror-eoferror-during-request-with-http-jl/107184)

<div class="topic-metadata">

**Author:** [@Simone\_Gabbriellini](https://discourse.julialang.org/u/Simone_Gabbriellini)\
**Replies:** 1\
**Last updated:** [December 6, 2023, 8:46am UTC](https://discourse.julialang.org/t/ioerror-eoferror-during-request-with-http-jl/107184 "2023-12-06T08:46:03Z")

</div>

I am experiencing a weird behaviour with HTTP.jl, I have a pipeline where I can load a file, it reads data from the file and then calls three times an AWS endpoint using this code: resp = HTTP.request( "POST", …

---

## [FunctionWrapper somewhat dodges world age restrictions](https://discourse.julialang.org/t/functionwrapper-somewhat-dodges-world-age-restrictions/107025)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 4\
**Last updated:** [December 6, 2023, 5:32am UTC](https://discourse.julialang.org/t/functionwrapper-somewhat-dodges-world-age-restrictions/107025 "2023-12-06T05:32:26Z")

</div>

MWE below, it appears that rather than using a function in a preexisting world age, FunctionWrapper uses the first evaled method inside a function but not any after that; EDIT unless you redefine the function after a cal…

---

## [Acceptable pattern when two structs of the same type share the same fields](https://discourse.julialang.org/t/acceptable-pattern-when-two-structs-of-the-same-type-share-the-same-fields/57959)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 14\
**Last updated:** [December 6, 2023, 3:57am UTC](https://discourse.julialang.org/t/acceptable-pattern-when-two-structs-of-the-same-type-share-the-same-fields/57959 "2023-12-06T03:57:51Z")

</div>

Consider the following structs: abstract type AbstractTransport end struct Warp limit::Float32 end struct Galaxy \<:AbstractTransport name::String drive::Warp end struct Intrepid \<:AbstractTransport na…

---

## [Quick way to create a vector of only rationals wthin a range?](https://discourse.julialang.org/t/quick-way-to-create-a-vector-of-only-rationals-wthin-a-range/107189)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 2\
**Last updated:** [December 6, 2023, 2:18am UTC](https://discourse.julialang.org/t/quick-way-to-create-a-vector-of-only-rationals-wthin-a-range/107189 "2023-12-06T02:18:17Z")

</div>

Hi all, I want to create a vector of 30 rational numbers between 10^(-5) to 10^(-1). Preferably evenly spaced. Is there a quick and efficient way to do it in Julia? Thank you!

---

## [Sharpen Tuple Element Types](https://discourse.julialang.org/t/sharpen-tuple-element-types/107179)

<div class="topic-metadata">

**Author:** [@willtebbutt](https://discourse.julialang.org/u/willtebbutt)\
**Replies:** 1\
**Last updated:** [December 5, 2023, 5:39pm UTC](https://discourse.julialang.org/t/sharpen-tuple-element-types/107179 "2023-12-05T17:39:49Z")

</div>

struct Foo end typeof((Foo, )) yields Tuple{DataType} rather than something more precise like Tuple{Type{Foo}} This is causing me some type-instability problems. Question: is there a way to produce a Tuple whose t…

---

## [Generating types using a macro from XML schema](https://discourse.julialang.org/t/generating-types-using-a-macro-from-xml-schema/107161)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 0\
**Last updated:** [December 5, 2023, 12:04pm UTC](https://discourse.julialang.org/t/generating-types-using-a-macro-from-xml-schema/107161 "2023-12-05T12:04:09Z")

</div>

Hi all, I’ve been scratching my head on this all morning, and I can’t figure what’s missing… I’m trying to define types based on the contents of an xml file and its schema. This is not unlike Trouble understanding macros…

---

## [Equality of mutable structs](https://discourse.julialang.org/t/equality-of-mutable-structs/107146)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 7\
**Last updated:** [December 5, 2023, 12:40pm UTC](https://discourse.julialang.org/t/equality-of-mutable-structs/107146 "2023-12-05T12:40:44Z")

</div>

should this be the case ? mutable struct X x::Int64 end X(1)==X(1) #false

---

## [Multithreading in Julia \>1.8 - Threadsafety of @threads vs @spawn](https://discourse.julialang.org/t/multithreading-in-julia-1-8-threadsafety-of-threads-vs-spawn/107159)

<div class="topic-metadata">

**Author:** [@PatAsch](https://discourse.julialang.org/u/PatAsch)\
**Replies:** 3\
**Last updated:** [December 5, 2023, 12:19pm UTC](https://discourse.julialang.org/t/multithreading-in-julia-1-8-threadsafety-of-threads-vs-spawn/107159 "2023-12-05T12:19:46Z")

</div>

Hi there, I have recently read the blog post about changes in @threads behavior from version 1.8 onwards: PSA: Thread-local state is no longer recommended, and I am unsure if I do need to change up code that I wrote for…

---

## [Optimization of differentiation using Fourier transforms](https://discourse.julialang.org/t/optimization-of-differentiation-using-fourier-transforms/107149)

<div class="topic-metadata">

**Author:** [@mikk](https://discourse.julialang.org/u/mikk)\
**Replies:** 8\
**Last updated:** [December 5, 2023, 11:34am UTC](https://discourse.julialang.org/t/optimization-of-differentiation-using-fourier-transforms/107149 "2023-12-05T11:34:47Z")

</div>

In my Bachelor thesis I need to solve a nonlinear wave equation using the pseudospectral method that relies on the basic property of the Fourier transform \\mathcal{F}(\\frac{d^n f}{dx^n}) = (ik)^n \\mathcal{F}(f) where i …

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

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