# General Usage

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

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

**Page:** 203

---

## [M. learning with regularization using Flux is too slow?](https://discourse.julialang.org/t/m-learning-with-regularization-using-flux-is-too-slow/105683)

<div class="topic-metadata">

**Author:** [@taka255](https://discourse.julialang.org/u/taka255)\
**Replies:** 5\
**Last updated:** [February 9, 2024, 12:32pm UTC](https://discourse.julialang.org/t/m-learning-with-regularization-using-flux-is-too-slow/105683 "2024-02-09T12:32:49Z")

</div>

I am trying to do supervised learning with Flux, as a way to add a regularization term to the loss function referring to the official documentation. I have tried two ways to add a regularization term to the loss functio…

---

## [Type-instability with DifferentialEquations.jl when using nested structs](https://discourse.julialang.org/t/type-instability-with-differentialequations-jl-when-using-nested-structs/109764)

<div class="topic-metadata">

**Author:** [@fgittins](https://discourse.julialang.org/u/fgittins)\
**Replies:** 6\
**Last updated:** [February 9, 2024, 10:24am UTC](https://discourse.julialang.org/t/type-instability-with-differentialequations-jl-when-using-nested-structs/109764 "2024-02-09T10:24:57Z")

</div>

Hi Julia community, I have been using DifferentialEquations.jl recently, which is an excellent package. In the spirit of writing performant Julia code, I have been trying to eliminate unnecessary heap allocations. I ha…

---

## [Is there a way to create task from not yet defined function without eval?](https://discourse.julialang.org/t/is-there-a-way-to-create-task-from-not-yet-defined-function-without-eval/109961)

<div class="topic-metadata">

**Author:** [@Dandan](https://discourse.julialang.org/u/Dandan)\
**Replies:** 6\
**Last updated:** [February 9, 2024, 7:39am UTC](https://discourse.julialang.org/t/is-there-a-way-to-create-task-from-not-yet-defined-function-without-eval/109961 "2024-02-09T07:39:56Z")

</div>

I have a code like this jobs = \[\] function main() while true sleep(1) for j in jobs @async j() end end end # f() = println("f") # this works @async main() f() = println("f")…

---

## [Use Dict to store tree with uninitialized tree nodes](https://discourse.julialang.org/t/use-dict-to-store-tree-with-uninitialized-tree-nodes/109895)

<div class="topic-metadata">

**Author:** [@Julia2001](https://discourse.julialang.org/u/Julia2001)\
**Replies:** 4\
**Last updated:** [February 8, 2024, 8:03pm UTC](https://discourse.julialang.org/t/use-dict-to-store-tree-with-uninitialized-tree-nodes/109895 "2024-02-08T20:03:02Z")

</div>

I would like to use a Dict with string keys to store a tree. The relations between nodes evolve over time. So they have to be left uninitialized for the most part during initial construction. I read about inner and oute…

---

## [Questions on the versioning semantics of Julia packages](https://discourse.julialang.org/t/questions-on-the-versioning-semantics-of-julia-packages/109926)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 5\
**Last updated:** [February 8, 2024, 4:48pm UTC](https://discourse.julialang.org/t/questions-on-the-versioning-semantics-of-julia-packages/109926 "2024-02-08T16:48:18Z")

</div>

I read this post that tells the rules of Julia package versioning: But didn’t get under what circumstances will the package version string turn from a pre-1.0 form to a post-1.0 form (0.y.z → 1.0.0)? And does Julia’s o…

---

## [GeoData: "array has wrong ordering"](https://discourse.julialang.org/t/geodata-array-has-wrong-ordering/109916)

<div class="topic-metadata">

**Author:** [@Aqeel\_Abbas](https://discourse.julialang.org/u/Aqeel_Abbas)\
**Replies:** 6\
**Last updated:** [February 8, 2024, 1:56pm UTC](https://discourse.julialang.org/t/geodata-array-has-wrong-ordering/109916 "2024-02-08T13:56:48Z")

</div>

Dear All, I am a new user of Julia following this Example. I got an error using the below code, any suggestions or comments will be appreciated : using GeophysicalModelGenerator, GeoDatasets,DelimitedFiles Load data: …

---

## [When should allocations be documented?](https://discourse.julialang.org/t/when-should-allocations-be-documented/109928)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [February 8, 2024, 12:58pm UTC](https://discourse.julialang.org/t/when-should-allocations-be-documented/109928 "2024-02-08T12:58:13Z")

</div>

I’m making a PR to Base, and before the code there had avoidable allocations. I’m thinking mostly about Base, but people can answer about packages too. If you have no allocations, ever, e.g. not dependent on code path, …

---

## [On building symbolic integrators, can we do better than RUBI?](https://discourse.julialang.org/t/on-building-symbolic-integrators-can-we-do-better-than-rubi/109923)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 1\
**Last updated:** [February 8, 2024, 12:22pm UTC](https://discourse.julialang.org/t/on-building-symbolic-integrators-can-we-do-better-than-rubi/109923 "2024-02-08T12:22:58Z")

</div>

Rule based integration could be considered state of the art, with a long collections of rules. In fact, there is a plan to integrate it in Symbolics.jl However, let’s have a second thought on it. Can we do better? Is c…

---

## [Vector of vectors non-allocating](https://discourse.julialang.org/t/vector-of-vectors-non-allocating/109762)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 10\
**Last updated:** [February 8, 2024, 12:28pm UTC](https://discourse.julialang.org/t/vector-of-vectors-non-allocating/109762 "2024-02-08T12:28:11Z")

</div>

How do I make the function that follows non-allocating? function genvec2(N) result = \[zeros(Int64,2) for i=1:N\] for i=1:N result\[i\] = \[2\*i, 2i+1\] end return result end

---

## [Problems when running conda environment from Julia](https://discourse.julialang.org/t/problems-when-running-conda-environment-from-julia/108988)

<div class="topic-metadata">

**Author:** [@CrisCool](https://discourse.julialang.org/u/CrisCool)\
**Replies:** 3\
**Last updated:** [February 8, 2024, 12:16pm UTC](https://discourse.julialang.org/t/problems-when-running-conda-environment-from-julia/108988 "2024-02-08T12:16:40Z")

</div>

Hei julians I need help! I’m running external commands from julia, using run(pipeline(Cmd)). The commands (Cmd) are of the type: conda run -n conda\_env external\_tool. I have a julia program where I’m running several …

---

## [Why is garbage collection called here?](https://discourse.julialang.org/t/why-is-garbage-collection-called-here/109870)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 11\
**Last updated:** [February 8, 2024, 11:02am UTC](https://discourse.julialang.org/t/why-is-garbage-collection-called-here/109870 "2024-02-08T11:02:48Z")

</div>

Hello! I’ve been hitting my head on the wall for a few days now. I have a function which when using @profview seems to call the garbage collection (red bar), but it does not allocate. It is updatexij! (which is resized …

---

## [How to properly implement logging in Julia package?](https://discourse.julialang.org/t/how-to-properly-implement-logging-in-julia-package/109863)

<div class="topic-metadata">

**Author:** [@p-gw](https://discourse.julialang.org/u/p-gw)\
**Replies:** 5\
**Last updated:** [February 8, 2024, 9:34am UTC](https://discourse.julialang.org/t/how-to-properly-implement-logging-in-julia-package/109863 "2024-02-08T09:34:49Z")

</div>

Hi everyone, I was wondering how to properly implement logging for a function in a julia package. My problem looks something like this: I have an algorithm with iter iterations and I want to provide the user with infor…

---

## [PSA: new version of codecov-action requires additional setup](https://discourse.julialang.org/t/psa-new-version-of-codecov-action-requires-additional-setup/109857)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 12\
**Last updated:** [February 8, 2024, 7:55am UTC](https://discourse.julialang.org/t/psa-new-version-of-codecov-action-requires-additional-setup/109857 "2024-02-08T07:55:06Z")

</div>

What’s going on Codecov is a very useful tool to assess code coverage, that is, how much of the package source code is hit by the test suite. In GitHub continuous integration workflows, this happens through the codecov-a…

---

## [Different behaviour of the identical code](https://discourse.julialang.org/t/different-behaviour-of-the-identical-code/109910)

<div class="topic-metadata">

**Author:** [@ttx002000](https://discourse.julialang.org/u/ttx002000)\
**Replies:** 1\
**Last updated:** [February 8, 2024, 7:52am UTC](https://discourse.julialang.org/t/different-behaviour-of-the-identical-code/109910 "2024-02-08T07:52:45Z")

</div>

Dear all, I am using VS code to compile my Julia code. I have the following code, which is “test.jl”. I also have another file that hosts my\_function, which is called “test\_test.jl”. Basically, my\_function takes into k a…

---

## [Makie - reliably updating plots from another thread](https://discourse.julialang.org/t/makie-reliably-updating-plots-from-another-thread/109905)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 0\
**Last updated:** [February 8, 2024, 2:53am UTC](https://discourse.julialang.org/t/makie-reliably-updating-plots-from-another-thread/109905 "2024-02-08T02:53:05Z")

</div>

Why does the following code not reliably update the plot and sometimes fail with a bounds access error? using GLMakie fig = Figure() # Heatmap cm = rand(500, 500) const obc = Observable(cm) ax = Axis(fig\[3, 1\]) heat…

---

## [@kwdef kwargs](https://discourse.julialang.org/t/kwdef-kwargs/109853)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [February 8, 2024, 12:45am UTC](https://discourse.julialang.org/t/kwdef-kwargs/109853 "2024-02-08T00:45:25Z")

</div>

Could there be a flag added to @kwdef (say @kwargs) that adds a kwargs... to the constructor inputs so that @kwdef @kwargs struct X a b end X(; a=1, b=2, c=3 ) Would work the same as X(; a=1, b=2 ) i.e. a…

---

## [Represent multidimensional array at higher dimension](https://discourse.julialang.org/t/represent-multidimensional-array-at-higher-dimension/109889)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 9\
**Last updated:** [February 7, 2024, 11:30pm UTC](https://discourse.julialang.org/t/represent-multidimensional-array-at-higher-dimension/109889 "2024-02-07T23:30:15Z")

</div>

suppose I have a 2x3 array called mat1. I would like to pretend that this 2x3 array is actually a 2x3x4 array called mat1\_3d\_representation, such that mat1\_3d\_representation\[i, j, k\] == mat1\[i, j\] for all valid scala…

---

## [Playing audio files from Julia](https://discourse.julialang.org/t/playing-audio-files-from-julia/109829)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 13\
**Last updated:** [February 7, 2024, 5:08pm UTC](https://discourse.julialang.org/t/playing-audio-files-from-julia/109829 "2024-02-07T17:08:01Z")

</div>

What would be the recommended way to (just) play a MP3 file from Julia? Most related posts was Audio processing in Julia but I wonder if there is anything new, and also if you would know of some cross-platform binaries…

---

## [How not to commit type piracy when handling automatic conversion for field with Union type](https://discourse.julialang.org/t/how-not-to-commit-type-piracy-when-handling-automatic-conversion-for-field-with-union-type/109877)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 10\
**Last updated:** [February 7, 2024, 4:07pm UTC](https://discourse.julialang.org/t/how-not-to-commit-type-piracy-when-handling-automatic-conversion-for-field-with-union-type/109877 "2024-02-07T16:07:32Z")

</div>

I’d like to handle the conversion in structs just like when you have a concrete type for a field, but when a field as a Union type like below: struct A end struct B x::Union{A, Int} end I’d like this to work: B(t…

---

## [Reinterpreting vectors into vector of SVectors?](https://discourse.julialang.org/t/reinterpreting-vectors-into-vector-of-svectors/109864)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 5\
**Last updated:** [February 7, 2024, 1:04pm UTC](https://discourse.julialang.org/t/reinterpreting-vectors-into-vector-of-svectors/109864 "2024-02-07T13:04:59Z")

</div>

Hello! Suppose I have three vectors: N = 100 x = rand(N) y = rand(N) z = rand(N) Is there any way in which I can reinterpret this into a vector of svector without having to perform allocations? Kind regards

---

## [How to find the linearly independent columns (rows) of a matrix](https://discourse.julialang.org/t/how-to-find-the-linearly-independent-columns-rows-of-a-matrix/109772)

<div class="topic-metadata">

**Author:** [@qua4tre](https://discourse.julialang.org/u/qua4tre)\
**Replies:** 24\
**Last updated:** [February 7, 2024, 11:40am UTC](https://discourse.julialang.org/t/how-to-find-the-linearly-independent-columns-rows-of-a-matrix/109772 "2024-02-07T11:40:10Z")

</div>

Say I have a matrix A. How would I go about finding the linearly independent columns (or rows) of A? I.e., I’m looking for a set of steps I can use to get either the indices which correspond to the linearly independent…

---

## [HTTP.jl query fails based on context: IOError: stream is closed or unusable](https://discourse.julialang.org/t/http-jl-query-fails-based-on-context-ioerror-stream-is-closed-or-unusable/109808)

<div class="topic-metadata">

**Author:** [@TimG](https://discourse.julialang.org/u/TimG)\
**Replies:** 1\
**Last updated:** [February 7, 2024, 11:38am UTC](https://discourse.julialang.org/t/http-jl-query-fails-based-on-context-ioerror-stream-is-closed-or-unusable/109808 "2024-02-07T11:38:27Z")

</div>

I’ve struggled to pin down an mwe for this. The problem is that an HTTP query to the ONS Open Geography sparql endpoint fails intermittently - about one time in two or three - so very often. I don’t think the query is a…

---

## [Why are empty ranges normalized?](https://discourse.julialang.org/t/why-are-empty-ranges-normalized/109836)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 5\
**Last updated:** [February 7, 2024, 8:55am UTC](https://discourse.julialang.org/t/why-are-empty-ranges-normalized/109836 "2024-02-07T08:55:16Z")

</div>

What the motivation for this normalization? julia\> 5:1 5:4

---

## [How to do readuntil(io, ::Regex)?](https://discourse.julialang.org/t/how-to-do-readuntil-io-regex/109855)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 0\
**Last updated:** [February 7, 2024, 7:31am UTC](https://discourse.julialang.org/t/how-to-do-readuntil-io-regex/109855 "2024-02-07T07:31:18Z")

</div>

I have a TCP connection over which I can send a command and then the remote end responds with some output followed by either OK or ERROR. For example: \>\> GETSTATE \<\< 0002 # Some status code \<\< OK To make it easier to…

---

## [ERROR using JumpProcesses and Catalyst](https://discourse.julialang.org/t/error-using-jumpprocesses-and-catalyst/109753)

<div class="topic-metadata">

**Author:** [@martacunial](https://discourse.julialang.org/u/martacunial)\
**Replies:** 6\
**Last updated:** [February 7, 2024, 7:43am UTC](https://discourse.julialang.org/t/error-using-jumpprocesses-and-catalyst/109753 "2024-02-07T07:43:38Z")

</div>

I’m trying to run this code (julia version 1.9.2) found on Continuous-Time Jump Processes and Gillespie Methods · JumpProcesses.jl and I get the error "JumpSystem equations must contain MassActionJumps, ConstantRateJumps…

---

## [Problem loading Distributions package in Pluto](https://discourse.julialang.org/t/problem-loading-distributions-package-in-pluto/109814)

<div class="topic-metadata">

**Author:** [@mirandaholmes](https://discourse.julialang.org/u/mirandaholmes)\
**Replies:** 2\
**Last updated:** [February 7, 2024, 6:43am UTC](https://discourse.julialang.org/t/problem-loading-distributions-package-in-pluto/109814 "2024-02-07T06:43:25Z")

</div>

I am using Pluto for assigning homework, and one of my students is unable to load the Distributions package. The error they get after running “using Distributions” is below. Subsequently, the functions from the Distribut…

---

## [Non-numeric Dual{ForwardDiff.Tag...} output when solving DAE](https://discourse.julialang.org/t/non-numeric-dual-forwarddiff-tag-output-when-solving-dae/109589)

<div class="topic-metadata">

**Author:** [@David\_F](https://discourse.julialang.org/u/David_F)\
**Replies:** 12\
**Last updated:** [February 7, 2024, 6:28am UTC](https://discourse.julialang.org/t/non-numeric-dual-forwarddiff-tag-output-when-solving-dae/109589 "2024-02-07T06:28:41Z")

</div>

While solving a system of DAE using the integrator interface, I face a weird behavior with derivatives of the solution vector. At random steps, the resultant value (da here) is returned as non-numeric but a “Dual”. Each …

---

## [De-bugging method](https://discourse.julialang.org/t/de-bugging-method/109852)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 1\
**Last updated:** [February 7, 2024, 5:30am UTC](https://discourse.julialang.org/t/de-bugging-method/109852 "2024-02-07T05:30:31Z")

</div>

I like to execute code line by line with CTRL/SHIFT +Enter (rather than F5 Debug) I often begin a function with two lines of the form global X = (; function\_inputs ) (; function\_inputs) = X So if an error occurs I…

---

## [Eval() fails inside a function when it works stand alone](https://discourse.julialang.org/t/eval-fails-inside-a-function-when-it-works-stand-alone/109846)

<div class="topic-metadata">

**Author:** [@Paul\_Warburton](https://discourse.julialang.org/u/Paul_Warburton)\
**Replies:** 6\
**Last updated:** [February 7, 2024, 4:15am UTC](https://discourse.julialang.org/t/eval-fails-inside-a-function-when-it-works-stand-alone/109846 "2024-02-07T04:15:35Z")

</div>

I have this code, which works just fine outside of the function but when I enclose it inside the function it fails at the eval() command with the following hard to decipher message. I have looked at other similar proble…

---

## [Type vs tuple that contains a type, Type vs DataType](https://discourse.julialang.org/t/type-vs-tuple-that-contains-a-type-type-vs-datatype/109850)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [February 7, 2024, 3:11am UTC](https://discourse.julialang.org/t/type-vs-tuple-that-contains-a-type-type-vs-datatype/109850 "2024-02-07T03:11:52Z")

</div>

Is there a rationale for the failure here: julia\> Val(Int) Val{Int64}() julia\> Val((Int,)) ERROR: TypeError: in Type, in parameter, expected Type, got a value of type Tuple{DataType} Stacktrace: \[1\] Val(x::Tuple{DataT…

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

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