# General Usage

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

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

**Page:** 182

---

## [I've developed a new Perlin-style noise. Can you improve it?](https://discourse.julialang.org/t/ive-developed-a-new-perlin-style-noise-can-you-improve-it/112618)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 3\
**Last updated:** [April 7, 2024, 10:11am UTC](https://discourse.julialang.org/t/ive-developed-a-new-perlin-style-noise-can-you-improve-it/112618 "2024-04-07T10:11:32Z")

</div>

This is a simplified version of the OpenSimplex noise (and all its versions). seed = 0x120367e73b381c44 #Modified version of random number generator by Bernard Widynski. https://arxiv.org/abs/2004.06278 get\_random\_n…

---

## [Downloading website content (HTTP, BufferedStreams)](https://discourse.julialang.org/t/downloading-website-content-http-bufferedstreams/112595)

<div class="topic-metadata">

**Author:** [@Anton\_Hinneck](https://discourse.julialang.org/u/Anton_Hinneck)\
**Replies:** 3\
**Last updated:** [April 6, 2024, 8:09pm UTC](https://discourse.julialang.org/t/downloading-website-content-http-bufferedstreams/112595 "2024-04-06T20:09:47Z")

</div>

Hi, I would like to download HTML from urls. For this purpose I use HTTP.jl and BufferedStreams.jl. using HTTP using BufferedStreams url = "https://discourse.julialang.org/" htmlData = String\[\] io = nothing HTTP.…

---

## [Cubic spline for non monotonic vector](https://discourse.julialang.org/t/cubic-spline-for-non-monotonic-vector/112599)

<div class="topic-metadata">

**Author:** [@jgr](https://discourse.julialang.org/u/jgr)\
**Replies:** 5\
**Last updated:** [April 6, 2024, 7:48pm UTC](https://discourse.julialang.org/t/cubic-spline-for-non-monotonic-vector/112599 "2024-04-06T19:48:59Z")

</div>

I am using Spline1D from Dierckx package, and my code is Ev = \[2, 1, 3,4\] sgrid = \[0, 1, 2,4\] spl = Spline1D(Ev,sgrid) The error I got is Error on entry, no approximation returned. The following conditions must hold: …

---

## [Numerical integration over 3D domain of vector-valued function](https://discourse.julialang.org/t/numerical-integration-over-3d-domain-of-vector-valued-function/112284)

<div class="topic-metadata">

**Author:** [@Lisette\_de\_Bruin](https://discourse.julialang.org/u/Lisette_de_Bruin)\
**Replies:** 33\
**Last updated:** [April 6, 2024, 6:52pm UTC](https://discourse.julialang.org/t/numerical-integration-over-3d-domain-of-vector-valued-function/112284 "2024-04-06T18:52:50Z")

</div>

Hi all, I am interested in evaluating a volume integral of a vector-valued function. So the integral has the following form: I already tried to use nested quadgk and hcubature. Both methods give me the correct result…

---

## [What are the best practices for setting compat entries?](https://discourse.julialang.org/t/what-are-the-best-practices-for-setting-compat-entries/112607)

<div class="topic-metadata">

**Author:** [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 4:01pm UTC](https://discourse.julialang.org/t/what-are-the-best-practices-for-setting-compat-entries/112607 "2024-04-06T16:01:21Z")

</div>

Hello! When creating packages, I have consistently found it hard to set the compat entries for my dependencies. On one hand, one would like to use the least restrictive compat entries possible, in order do be able to sa…

---

## [Printing progress and updates messages SDE problem](https://discourse.julialang.org/t/printing-progress-and-updates-messages-sde-problem/112277)

<div class="topic-metadata">

**Author:** [@matt1](https://discourse.julialang.org/u/matt1)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 3:37pm UTC](https://discourse.julialang.org/t/printing-progress-and-updates-messages-sde-problem/112277 "2024-04-06T15:37:26Z")

</div>

Hello, I’m solving a system of stochastic differential equations: #define drift fuction F!(du,u,t,p)=... #define noise function G!(du,u,t,p)=... #constructing and solving the problem u\_0=zeros(100,100)#initial condi…

---

## [State of AD in 2024](https://discourse.julialang.org/t/state-of-ad-in-2024/112601)

<div class="topic-metadata">

**Author:** [@bayesian\_fish](https://discourse.julialang.org/u/bayesian_fish)\
**Replies:** 4\
**Last updated:** [April 6, 2024, 1:43pm UTC](https://discourse.julialang.org/t/state-of-ad-in-2024/112601 "2024-04-06T13:43:22Z")

</div>

Hi, I’m new to the Julia language and am trying to understand the AD ecosystem. From what I understand, Julia wants to broaden AD beyond the type of models you might find in Pytorch and Jax while also retaining similar …

---

## [How to pass variables to several levels up without going through headings (arguments) in functions](https://discourse.julialang.org/t/how-to-pass-variables-to-several-levels-up-without-going-through-headings-arguments-in-functions/112582)

<div class="topic-metadata">

**Author:** [@fmontans](https://discourse.julialang.org/u/fmontans)\
**Replies:** 24\
**Last updated:** [April 6, 2024, 12:28pm UTC](https://discourse.julialang.org/t/how-to-pass-variables-to-several-levels-up-without-going-through-headings-arguments-in-functions/112582 "2024-04-06T12:28:46Z")

</div>

In fortran90, there are two ways to pass variables that is not through the function/subroutine heading/arguments. Those are common blocks (old Fortran77 style) or modules (new fortran90 style). This is extremely useful i…

---

## [Saving only specific solutions in ODE solver](https://discourse.julialang.org/t/saving-only-specific-solutions-in-ode-solver/112604)

<div class="topic-metadata">

**Author:** [@Balaji\_Lakshminaraya](https://discourse.julialang.org/u/Balaji_Lakshminaraya)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 11:50am UTC](https://discourse.julialang.org/t/saving-only-specific-solutions-in-ode-solver/112604 "2024-04-06T11:50:22Z")

</div>

I’m solving a simultaneous system of linear differential equations (about 40 million simultaneous equations). I am using QNDF solver, with option dense= false. it works well. Since I have a lot of save points, storage i…

---

## [Makie edit does not recognize Enter key](https://discourse.julialang.org/t/makie-edit-does-not-recognize-enter-key/112587)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 6:50am UTC](https://discourse.julialang.org/t/makie-edit-does-not-recognize-enter-key/112587 "2024-04-06T06:50:06Z")

</div>

I have a Makie GUI with a TextBox. I can enter a number, and the value is accepted when I press the RETURN key. But it is not accepted when I press the Enter key next to the numerical keyboard. Why, and how can I fix th…

---

## [Gridap uses in Industry](https://discourse.julialang.org/t/gridap-uses-in-industry/112457)

<div class="topic-metadata">

**Author:** [@Mishal](https://discourse.julialang.org/u/Mishal)\
**Replies:** 1\
**Last updated:** [April 6, 2024, 1:30am UTC](https://discourse.julialang.org/t/gridap-uses-in-industry/112457 "2024-04-06T01:30:57Z")

</div>

Hi Guys I have been messing around with Gridap lately, it is a very nice well built package. I am currently a practicing engineer designing complex machines. In general I have used Julia (previously Matlab/Octave) to so…

---

## [Julia slower than Python for finding pangrams?](https://discourse.julialang.org/t/julia-slower-than-python-for-finding-pangrams/112481)

<div class="topic-metadata">

**Author:** [@Flavio\_Barros](https://discourse.julialang.org/u/Flavio_Barros)\
**Replies:** 28\
**Last updated:** [April 5, 2024, 11:55pm UTC](https://discourse.julialang.org/t/julia-slower-than-python-for-finding-pangrams/112481 "2024-04-05T23:55:34Z")

</div>

I came up with a neat Julia solution using sets to solve that simple pangram. However, I’m a bit perplexed… C benchmarks show it running over 200 times faster, and even Python outperforms my Julia code substantially. Cur…

---

## [Way to enforce \`BigFloat\` math by default](https://discourse.julialang.org/t/way-to-enforce-bigfloat-math-by-default/112557)

<div class="topic-metadata">

**Author:** [@tgross35](https://discourse.julialang.org/u/tgross35)\
**Replies:** 6\
**Last updated:** [April 5, 2024, 8:37pm UTC](https://discourse.julialang.org/t/way-to-enforce-bigfloat-math-by-default/112557 "2024-04-05T20:37:12Z")

</div>

julia\> big(pi)/2 1.570796326794896619231321691639751442098584699687552910487472296153908203143099 julia\> big(pi/2) 1.5707963267948965579989817342720925807952880859375 That is quite an easy mistake to make. Is there a w…

---

## [Is there a coalesce function for other types?](https://discourse.julialang.org/t/is-there-a-coalesce-function-for-other-types/60112)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 13\
**Last updated:** [April 5, 2024, 8:16pm UTC](https://discourse.julialang.org/t/is-there-a-coalesce-function-for-other-types/60112 "2024-04-05T20:16:52Z")

</div>

I found this nice function called coalesce and now I am wondering if there is a more general one. Is there a function like coalesce which can specify the missing value/type. a = \[NaN,missing,"",2,3.0\] coalesce.(a,0) coa…

---

## [How can I get a fully-specified type of a \`Dict\`?](https://discourse.julialang.org/t/how-can-i-get-a-fully-specified-type-of-a-dict/112570)

<div class="topic-metadata">

**Author:** [@scheidan1](https://discourse.julialang.org/u/scheidan1)\
**Replies:** 5\
**Last updated:** [April 5, 2024, 8:04pm UTC](https://discourse.julialang.org/t/how-can-i-get-a-fully-specified-type-of-a-dict/112570 "2024-04-05T20:04:27Z")

</div>

Hi all, I’m working in a package where the user provides a Dict that is never changed by my package. While I know the structure of the entries, I do not know the which types it contains. Is there a way to “convert” a po…

---

## [Parameterize by Value with Union](https://discourse.julialang.org/t/parameterize-by-value-with-union/112388)

<div class="topic-metadata">

**Author:** [@densmojd](https://discourse.julialang.org/u/densmojd)\
**Replies:** 8\
**Last updated:** [April 5, 2024, 6:13pm UTC](https://discourse.julialang.org/t/parameterize-by-value-with-union/112388 "2024-04-05T18:13:37Z")

</div>

I’d like to use a struct to represent a spatial mesh with an arbitrary number of dimensions D, something like struct Mesh{D} ... end Of course, D can only be 1, 2, or 3. Is there a way to enforce this using a union, e…

---

## [Optimising superbee! function](https://discourse.julialang.org/t/optimising-superbee-function/112568)

<div class="topic-metadata">

**Author:** [@alemelis](https://discourse.julialang.org/u/alemelis)\
**Replies:** 20\
**Last updated:** [April 5, 2024, 4:40pm UTC](https://discourse.julialang.org/t/optimising-superbee-function/112568 "2024-04-05T16:40:55Z")

</div>

Hello, I’m profiling my simulation with profview and this is the flame graph where I’m pointing to the four function calls that seem to be among the most expensive. Those are calling the same function – superbee! – i…

---

## [Concise way to initialize field in terms of another field](https://discourse.julialang.org/t/concise-way-to-initialize-field-in-terms-of-another-field/112536)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 6\
**Last updated:** [April 5, 2024, 3:53pm UTC](https://discourse.julialang.org/t/concise-way-to-initialize-field-in-terms-of-another-field/112536 "2024-04-05T15:53:32Z")

</div>

Suppose I have: Base.@kwdef struct Example a::Int b::Int end I would like the initialization of b to refer to the initial value of a, but the following does not work: x = Example(a = 6, b = a+9) because the “a…

---

## [Trying to solve KU=F, FEA problem, with roughly 5-10million DOFs](https://discourse.julialang.org/t/trying-to-solve-ku-f-fea-problem-with-roughly-5-10million-dofs/112480)

<div class="topic-metadata">

**Author:** [@balaji\_sriram](https://discourse.julialang.org/u/balaji_sriram)\
**Replies:** 7\
**Last updated:** [April 5, 2024, 2:20pm UTC](https://discourse.julialang.org/t/trying-to-solve-ku-f-fea-problem-with-roughly-5-10million-dofs/112480 "2024-04-05T14:20:48Z")

</div>

Hi, Im new to Julia, but i have experience with MATLAB, im trying to solve a KU=F, FEA type problem , with over 1 million DOFs. Note: the K matrix is sparse, symmetric, positive definite and banded. In matlab, the comman…

---

## [\`@kwdef\` with \`const\` in mutable struct triggering "Missing Reference"](https://discourse.julialang.org/t/kwdef-with-const-in-mutable-struct-triggering-missing-reference/112561)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 3\
**Last updated:** [April 5, 2024, 1:41pm UTC](https://discourse.julialang.org/t/kwdef-with-const-in-mutable-struct-triggering-missing-reference/112561 "2024-04-05T13:41:32Z")

</div>

Why does @kwdef mutable struct MyStruct const x::Float64 = 1.0 end trigger a Missing reference: x? (using the standard VSCode extension)

---

## [Trying to read from a HDF5 file and convert to another format in parallel?](https://discourse.julialang.org/t/trying-to-read-from-a-hdf5-file-and-convert-to-another-format-in-parallel/112479)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 17\
**Last updated:** [April 5, 2024, 10:50am UTC](https://discourse.julialang.org/t/trying-to-read-from-a-hdf5-file-and-convert-to-another-format-in-parallel/112479 "2024-04-05T10:50:51Z")

</div>

Hello! Using HDF5.jl I have constructed a .h5 file with multiple groups, with the keys, “0”, “1”, “2” up to “401”. I wish to read in data in parallel and convert to another format. I have tried to used such as loop: …

---

## [Loading from parent scope in package](https://discourse.julialang.org/t/loading-from-parent-scope-in-package/112434)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 34\
**Last updated:** [April 4, 2024, 11:07pm UTC](https://discourse.julialang.org/t/loading-from-parent-scope-in-package/112434 "2024-04-04T23:07:29Z")

</div>

I have one package that contains all types and another packages that uses those types. Here is the types package: module MatTypes using LinearAlgebra using StaticArrays include("types.jl") end # module MatTypes and…

---

## [Why does using StaticArrays causes more allocations?](https://discourse.julialang.org/t/why-does-using-staticarrays-causes-more-allocations/112515)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [April 4, 2024, 10:27pm UTC](https://discourse.julialang.org/t/why-does-using-staticarrays-causes-more-allocations/112515 "2024-04-04T22:27:51Z")

</div>

I have the following code: using OrdinaryDiffEq, ControlPlots, Sundials, StaticArrays STATIC\_ARRAYS::Bool = true if STATIC\_ARRAYS const G\_EARTH = SA\[0.0, 0.0, -9.81\] # gravitational acceleration else const G\_E…

---

## [Multiple dispatch](https://discourse.julialang.org/t/multiple-dispatch/112541)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [April 4, 2024, 8:47pm UTC](https://discourse.julialang.org/t/multiple-dispatch/112541 "2024-04-04T20:47:44Z")

</div>

Is it possible to do a dispatch on a parameter of the types Vector{Float64} and Vector{Vector{Float64}} ?

---

## [Unexpected behavior of vectorized += with duplicate indices](https://discourse.julialang.org/t/unexpected-behavior-of-vectorized-with-duplicate-indices/112537)

<div class="topic-metadata">

**Author:** [@mattwigway](https://discourse.julialang.org/u/mattwigway)\
**Replies:** 4\
**Last updated:** [April 4, 2024, 7:26pm UTC](https://discourse.julialang.org/t/unexpected-behavior-of-vectorized-with-duplicate-indices/112537 "2024-04-04T19:26:33Z")

</div>

I have some code that accumulates a list of indices in a vector that need to be incremented, and then does the incrementing after the fact with vector\[indices\] += increment (I do it this way instead of incrementing as I …

---

## [PlutoUI: Trigger long computation only after user sets many parameters and confirms](https://discourse.julialang.org/t/plutoui-trigger-long-computation-only-after-user-sets-many-parameters-and-confirms/112475)

<div class="topic-metadata">

**Author:** [@70Gage70](https://discourse.julialang.org/u/70Gage70)\
**Replies:** 7\
**Last updated:** [April 4, 2024, 6:15pm UTC](https://discourse.julialang.org/t/plutoui-trigger-long-computation-only-after-user-sets-many-parameters-and-confirms/112475 "2024-04-04T18:15:31Z")

</div>

Consider the case where you have many e.g. TextFields across many cells which set the parameters for some long computation. You want the user to be able to set all the parameters and not have the long calculation trigge…

---

## [@test\_throws UndefVarError f(x::A)=x](https://discourse.julialang.org/t/test-throws-undefvarerror-f-x-a-x/112497)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 3\
**Last updated:** [April 4, 2024, 5:18pm UTC](https://discourse.julialang.org/t/test-throws-undefvarerror-f-x-a-x/112497 "2024-04-04T17:18:43Z")

</div>

With a fresh Julia session: julia\> using Test julia\> @test\_throws UndefVarError foo(x::A)=x ERROR: UndefVarError: \`A\` not defined Should this be a passing test? I don’t quite get why the UndefVarError escapes the @tes…

---

## [Two ways to get C++ interface class from C API](https://discourse.julialang.org/t/two-ways-to-get-c-interface-class-from-c-api/112522)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 0\
**Last updated:** [April 4, 2024, 1:41pm UTC](https://discourse.julialang.org/t/two-ways-to-get-c-interface-class-from-c-api/112522 "2024-04-04T13:41:09Z")

</div>

Consider simple C++ interface class: ▶ File \`shape.h\` Since Cxx.jl in obsolete, so you cannot generate julia types from C++, and CxxWrap.jl means you have to make changes on C++ side, so I’ve made two C library wrappers …

---

## [Traits and type piracy](https://discourse.julialang.org/t/traits-and-type-piracy/112516)

<div class="topic-metadata">

**Author:** [@pat-alt](https://discourse.julialang.org/u/pat-alt)\
**Replies:** 3\
**Last updated:** [April 4, 2024, 12:27pm UTC](https://discourse.julialang.org/t/traits-and-type-piracy/112516 "2024-04-04T12:27:31Z")

</div>

TLDR: I’m defining a trait in a meta package A and trying to assign the trait in a package B that imports A. This causes type piracy and I don’t know how to resolve it. Background: Inspired by other examples such as MLJ…

---

## [Troubleshooting Precompilation Failure of the NMoons Package in Julia](https://discourse.julialang.org/t/troubleshooting-precompilation-failure-of-the-nmoons-package-in-julia/112512)

<div class="topic-metadata">

**Author:** [@josemanuel22](https://discourse.julialang.org/u/josemanuel22)\
**Replies:** 0\
**Last updated:** [April 4, 2024, 10:11am UTC](https://discourse.julialang.org/t/troubleshooting-precompilation-failure-of-the-nmoons-package-in-julia/112512 "2024-04-04T10:11:16Z")

</div>

I have the following problem: Stacktrace: \[1\] error(s::String) @ Base ./error.jl:35 \[2\] compilecache(pkg::Base.PkgId, path::String, internal\_stderr::IO, internal\_stdout::IO, keep\_loaded\_modules::Bool) @ Base…

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

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