# General Usage

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

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

**Page:** 88

---

## [Sharp edge with \`Threads.threadid()\` and task migration](https://discourse.julialang.org/t/sharp-edge-with-threads-threadid-and-task-migration/124550)

<div class="topic-metadata">

**Author:** [@GeorgeGkountouras](https://discourse.julialang.org/u/GeorgeGkountouras)\
**Replies:** 64\
**Last updated:** [February 12, 2025, 6:55am UTC](https://discourse.julialang.org/t/sharp-edge-with-threads-threadid-and-task-migration/124550 "2025-02-12T06:55:37Z")

</div>

Your code might get rescheduled on a different thread between the check and the access.

---

## [Moving a new package to GitHub](https://discourse.julialang.org/t/moving-a-new-package-to-github/125741)

<div class="topic-metadata">

**Author:** [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Replies:** 6\
**Last updated:** [February 11, 2025, 10:29pm UTC](https://discourse.julialang.org/t/moving-a-new-package-to-github/125741 "2025-02-11T22:29:20Z")

</div>

I’m getting ready to upload my little experimental package to GitHub, though still not read to publish it to the world. Any free advice? And how do I separate tooling I don’t even want to see on GitHub from the package i…

---

## [Is Compat.jl worth it for the \`public\` keyword?](https://discourse.julialang.org/t/is-compat-jl-worth-it-for-the-public-keyword/119041)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 37\
**Last updated:** [February 11, 2025, 9:10pm UTC](https://discourse.julialang.org/t/is-compat-jl-worth-it-for-the-public-keyword/119041 "2025-02-11T21:10:10Z")

</div>

With the introduction of public by @Lilith, many packages will want to mark their unexported public symbols that way. Since public is only available in Julia 1.11, the current recommended way to do this in 1.10 is with t…

---

## [Plots.jl bug with twinx and link](https://discourse.julialang.org/t/plots-jl-bug-with-twinx-and-link/125809)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 0\
**Last updated:** [February 11, 2025, 9:02pm UTC](https://discourse.julialang.org/t/plots-jl-bug-with-twinx-and-link/125809 "2025-02-11T21:02:04Z")

</div>

I was doing some plotting and wondering why my x-axis behaved strangely when using link=:x. First the code using Plots x1 = 0:0.1:π x2 = 0:0.1:3; p1 = plot(x1,sin.(x1)) p1 = plot!(twinx(), x2,cos.(x2)) p2 = plot(…

---

## [\_str string interpolation?](https://discourse.julialang.org/t/str-string-interpolation/125766)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 12\
**Last updated:** [February 11, 2025, 7:55pm UTC](https://discourse.julialang.org/t/str-string-interpolation/125766 "2025-02-11T19:55:43Z")

</div>

I am not sure what is the issue, but I would like to this to work: julia\> macro test\_str(s) :($(esc(s))) end @test\_str (macro with 1 method) julia\> test"a 1" # "works" "a 1" julia\> i = 1 1 julia\> t…

---

## [Circular dependency](https://discourse.julialang.org/t/circular-dependency/125794)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [February 11, 2025, 5:42pm UTC](https://discourse.julialang.org/t/circular-dependency/125794 "2025-02-11T17:42:53Z")

</div>

After updating my package KiteModels.jl I get the following warning: ┌ Warning: Circular dependency detected. │ Precompilation will be skipped for dependencies in this cycle: │ ┌ LinearSolve → LinearSolveSparseArraysEx…

---

## [Interpolations on scatter data of fun= f(x,y,z)](https://discourse.julialang.org/t/interpolations-on-scatter-data-of-fun-f-x-y-z/125754)

<div class="topic-metadata">

**Author:** [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)\
**Replies:** 4\
**Last updated:** [February 11, 2025, 4:41pm UTC](https://discourse.julialang.org/t/interpolations-on-scatter-data-of-fun-f-x-y-z/125754 "2025-02-11T16:41:59Z")

</div>

Hello everyone, If I have scatter data of control points with x, y, z coordinates and its corresponding output (A). How can I find the interpolation for A = f(x,y,z) ? where x, y, z and A are vectors. Thank you so much…

---

## [Pushing the Limits of Small Binary Creation](https://discourse.julialang.org/t/pushing-the-limits-of-small-binary-creation/120989)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 7\
**Last updated:** [February 11, 2025, 4:35pm UTC](https://discourse.julialang.org/t/pushing-the-limits-of-small-binary-creation/120989 "2025-02-11T16:35:09Z")

</div>

Hi all, quick story: It was at a hotel bar the other day that @asinghvi17 , @avik , @mortenpi , Professor Rebecca Killick, and I did an impromptu hackathon for about 5 hours to see what could be possible with the newly …

---

## ["simple" Dates one line question](https://discourse.julialang.org/t/simple-dates-one-line-question/125465)

<div class="topic-metadata">

**Author:** [@Perrin\_Meyer](https://discourse.julialang.org/u/Perrin_Meyer)\
**Replies:** 6\
**Last updated:** [February 11, 2025, 4:06pm UTC](https://discourse.julialang.org/t/simple-dates-one-line-question/125465 "2025-02-11T16:06:24Z")

</div>

can a Dates guru help me with the one line function DateString(now()) that returns a string: Sat 01 Feb 2025 2:33pm I can’t figure out why Date(now()),DateFormat("yyyy-mm-dd")) is not valid… but I’m also being lazy… …

---

## [SavingCallback when using Ensemble Simulations](https://discourse.julialang.org/t/savingcallback-when-using-ensemble-simulations/88483)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 13\
**Last updated:** [February 11, 2025, 2:58pm UTC](https://discourse.julialang.org/t/savingcallback-when-using-ensemble-simulations/88483 "2025-02-11T14:58:24Z")

</div>

Hello, I’m able to use SavingCallback with single simulations, for example using LinearAlgebra using SparseArrays using DifferentialEquations H0 = sprand(ComplexF64, 10, 10, 0.5) H0 \*= H0' ψ0 = normalize(rand(ComplexF…

---

## [ODE parameter estimation, parameter not updating](https://discourse.julialang.org/t/ode-parameter-estimation-parameter-not-updating/125783)

<div class="topic-metadata">

**Author:** [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Replies:** 2\
**Last updated:** [February 11, 2025, 1:16pm UTC](https://discourse.julialang.org/t/ode-parameter-estimation-parameter-not-updating/125783 "2025-02-11T13:16:47Z")

</div>

Hi, I have this code to estimate the parameters of a ODE system. I do not know why it is not updating the parameters inside the optimization. I print them and they do not change. This is a test sample of the code: impor…

---

## [Unicode in vscode on Raspberry Pi 5](https://discourse.julialang.org/t/unicode-in-vscode-on-raspberry-pi-5/125740)

<div class="topic-metadata">

**Author:** [@Alis](https://discourse.julialang.org/u/Alis)\
**Replies:** 1\
**Last updated:** [February 11, 2025, 10:19am UTC](https://discourse.julialang.org/t/unicode-in-vscode-on-raspberry-pi-5/125740 "2025-02-11T10:19:08Z")

</div>

Hello there, On my Windows machine, I successfully use Julia and vscode. In the editor, I make use of unicode for Greek letters. But, I have installed Julia and vscode on my Raspberry Pi, and the unicode works in the J…

---

## [Makie Categorical colors](https://discourse.julialang.org/t/makie-categorical-colors/118967)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 5\
**Last updated:** [February 11, 2025, 7:03am UTC](https://discourse.julialang.org/t/makie-categorical-colors/118967 "2025-02-11T07:03:52Z")

</div>

How to map a categorical column to a categorical color palette in Makie? using CairoMakie,AlgebraOfGraphics,RDatasets diamonds = dataset("ggplot2","diamonds") In AoG it’s just data(diamonds) \* mapping(:Carat, :Price; …

---

## [Trouble creating Package Extension](https://discourse.julialang.org/t/trouble-creating-package-extension/125767)

<div class="topic-metadata">

**Author:** [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Replies:** 4\
**Last updated:** [February 10, 2025, 8:41pm UTC](https://discourse.julialang.org/t/trouble-creating-package-extension/125767 "2025-02-10T20:41:23Z")

</div>

I’m trying to create a package extension (see 5. Creating Packages · Pkg.jl) for a package I’ve created, triggered by the Plots package. I have the following in my package’s Project.toml file: \[extensions\] Plotting = "…

---

## [Julia is slower than Python when appending elements to untyped arrays](https://discourse.julialang.org/t/julia-is-slower-than-python-when-appending-elements-to-untyped-arrays/125745)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 41\
**Last updated:** [February 10, 2025, 7:15pm UTC](https://discourse.julialang.org/t/julia-is-slower-than-python-when-appending-elements-to-untyped-arrays/125745 "2025-02-10T19:15:24Z")

</div>

An equivalent Julia code to this small Python benchmark runs nearly 10x slower, even with higher levels of optimization enabled. import time def main(): N = 100000000 data = \[\] for i in range(N): v…

---

## [Compiler performance regression](https://discourse.julialang.org/t/compiler-performance-regression/125729)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 4\
**Last updated:** [February 10, 2025, 2:36pm UTC](https://discourse.julialang.org/t/compiler-performance-regression/125729 "2025-02-10T14:36:55Z")

</div>

Hi, We are currently developing a Julia package. Running this demo script (branch “dev”) results in 10x longer compilation in Julia 1.11.3, compared to 1.10.x. The package relies heavily on automatic differentiation, …

---

## [Reduce allocations & lock conflicts and speed up when using multithreads](https://discourse.julialang.org/t/reduce-allocations-lock-conflicts-and-speed-up-when-using-multithreads/125749)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 1\
**Last updated:** [February 10, 2025, 2:11pm UTC](https://discourse.julialang.org/t/reduce-allocations-lock-conflicts-and-speed-up-when-using-multithreads/125749 "2025-02-10T14:11:41Z")

</div>

Hello there, performance enhancement help wanted: ▶ Initial function which gives 309.934138 seconds (5.00 M allocations: 1.982 GiB, 0.23% gc time, 2007 lock conflicts, 0.52% compilation time) 48-element Vector{String}: …

---

## [Another problem with Julia 1.11.1](https://discourse.julialang.org/t/another-problem-with-julia-1-11-1/121432)

<div class="topic-metadata">

**Author:** [@Dario-Rosa85](https://discourse.julialang.org/u/Dario-Rosa85)\
**Replies:** 9\
**Last updated:** [February 10, 2025, 12:27pm UTC](https://discourse.julialang.org/t/another-problem-with-julia-1-11-1/121432 "2025-02-10T12:27:11Z")

</div>

I have freshly updated Julia to 1.11.1 but, like others, I am getting in trouble. Superficially, I would say that my problem is slightly different from what others are reporting. Therefore, I report also my version: I…

---

## [Running Julia Script through another Script](https://discourse.julialang.org/t/running-julia-script-through-another-script/125744)

<div class="topic-metadata">

**Author:** [@Kamran\_Ali](https://discourse.julialang.org/u/Kamran_Ali)\
**Replies:** 1\
**Last updated:** [February 10, 2025, 11:51am UTC](https://discourse.julialang.org/t/running-julia-script-through-another-script/125744 "2025-02-10T11:51:47Z")

</div>

I have two scripts A.jl and B.jl, and want to create a script in A.jl that runs B.jl, if there is any idea, how can i do that ? In short, I want to run my julia script through another julia file.

---

## [Performance Difference in Matrix Multiplication with Symmetric Matrices](https://discourse.julialang.org/t/performance-difference-in-matrix-multiplication-with-symmetric-matrices/125727)

<div class="topic-metadata">

**Author:** [@swanchristmas](https://discourse.julialang.org/u/swanchristmas)\
**Replies:** 3\
**Last updated:** [February 10, 2025, 10:09am UTC](https://discourse.julialang.org/t/performance-difference-in-matrix-multiplication-with-symmetric-matrices/125727 "2025-02-10T10:09:29Z")

</div>

Hi everyone, I have a question regarding the performance of matrix multiplication involving symmetric matrices in Julia. Here’s my code and the results: let N = 1000 λ, Γp = \[randn(N, N) for \_ in 1:2\] Γp\_symm =…

---

## [Problem not updating param while running optimzation](https://discourse.julialang.org/t/problem-not-updating-param-while-running-optimzation/125738)

<div class="topic-metadata">

**Author:** [@Marta\_Pardo\_Araujo](https://discourse.julialang.org/u/Marta_Pardo_Araujo)\
**Replies:** 0\
**Last updated:** [February 10, 2025, 10:17am UTC](https://discourse.julialang.org/t/problem-not-updating-param-while-running-optimzation/125738 "2025-02-10T10:17:27Z")

</div>

Hi, I have this code to estimate the parameters of a ODE system. I do not know why it is not updating the parameters inside the optimization. I print them and they do not change. This is a test sample of the code: impor…

---

## [Reverse Makie Colorbar](https://discourse.julialang.org/t/reverse-makie-colorbar/125659)

<div class="topic-metadata">

**Author:** [@JoergF](https://discourse.julialang.org/u/JoergF)\
**Replies:** 2\
**Last updated:** [February 10, 2025, 10:18am UTC](https://discourse.julialang.org/t/reverse-makie-colorbar/125659 "2025-02-10T10:18:26Z")

</div>

I was wondering if there is any possibility to reverse the ticks in a Colorbar. I.e. instead of counting up 1:4 doing something like 4:-1:1. This snippet however still has 1 at the bottom and 4 at the top fig = Figure(…

---

## [Symbolic .+ fails when substitute with fold=true](https://discourse.julialang.org/t/symbolic-fails-when-substitute-with-fold-true/125687)

<div class="topic-metadata">

**Author:** [@RobbesU](https://discourse.julialang.org/u/RobbesU)\
**Replies:** 2\
**Last updated:** [February 10, 2025, 8:57am UTC](https://discourse.julialang.org/t/symbolic-fails-when-substitute-with-fold-true/125687 "2025-02-10T08:57:49Z")

</div>

When substituteing a symbolic equation, I get .+ throwing an error when used on its own with fold=true. Example below: All equations work apart from a1b, which fails with MethodError: no method matching +(::Vector{Floa…

---

## [Julia version of state-machine pattern](https://discourse.julialang.org/t/julia-version-of-state-machine-pattern/125484)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.julialang.org/u/Dan)\
**Replies:** 1\
**Last updated:** [February 3, 2025, 12:03pm UTC](https://discourse.julialang.org/t/julia-version-of-state-machine-pattern/125484 "2025-02-03T12:03:18Z")

</div>

There is an interesting tweet-thread about a Swift pattern which should have a corresponding Julia version: Anyone wants to show a Julia version?

---

## [Help with shared arrays - code update](https://discourse.julialang.org/t/help-with-shared-arrays-code-update/125692)

<div class="topic-metadata">

**Author:** [@Fernando1](https://discourse.julialang.org/u/Fernando1)\
**Replies:** 2\
**Last updated:** [February 9, 2025, 6:13pm UTC](https://discourse.julialang.org/t/help-with-shared-arrays-code-update/125692 "2025-02-09T18:13:05Z")

</div>

Hi all, this is the same post as I had done before but with the code correctly added. I am trying to run a “Simulate” function living in a separate module and extract the states from it with a getStates function. The id…

---

## [Speed of ldiv! for banded matrices in BandedMatrices.jl](https://discourse.julialang.org/t/speed-of-ldiv-for-banded-matrices-in-bandedmatrices-jl/125647)

<div class="topic-metadata">

**Author:** [@Ouyuan](https://discourse.julialang.org/u/Ouyuan)\
**Replies:** 2\
**Last updated:** [February 9, 2025, 4:11am UTC](https://discourse.julialang.org/t/speed-of-ldiv-for-banded-matrices-in-bandedmatrices-jl/125647 "2025-02-09T04:11:45Z")

</div>

Theoretically, solving banded matrix stored in Float32 should be twice faster than that stored in Float64. But this is not verified in my codes using BandedMatrices.jl. (Note that creating a random vector costs far less …

---

## [Help with shared arrays](https://discourse.julialang.org/t/help-with-shared-arrays/125233)

<div class="topic-metadata">

**Author:** [@Fernando1](https://discourse.julialang.org/u/Fernando1)\
**Replies:** 3\
**Last updated:** [February 8, 2025, 7:11pm UTC](https://discourse.julialang.org/t/help-with-shared-arrays/125233 "2025-02-08T19:11:12Z")

</div>

I am trying to run a “Simulate” function living in a separate module and extract the states from it with a getStates function. The idea is that I launch the sim to a parallel process and get the states after some time t…

---

## [\`eigen\` with \`sortby\` does not work for \`StaticArrays\`](https://discourse.julialang.org/t/eigen-with-sortby-does-not-work-for-staticarrays/125682)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 1\
**Last updated:** [February 8, 2025, 12:29pm UTC](https://discourse.julialang.org/t/eigen-with-sortby-does-not-work-for-staticarrays/125682 "2025-02-08T12:29:59Z")

</div>

As reported in the following post, eigen can be called with a sortby argument to provide the output in a different order, e.g. in descending order of the eigenvalues’ real part instead of the default. However, this doe…

---

## [How to copy the fields of a structure as new local variables?](https://discourse.julialang.org/t/how-to-copy-the-fields-of-a-structure-as-new-local-variables/125683)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 5\
**Last updated:** [February 8, 2025, 11:07am UTC](https://discourse.julialang.org/t/how-to-copy-the-fields-of-a-structure-as-new-local-variables/125683 "2025-02-08T11:07:37Z")

</div>

Let’s say I have a loooong Parameters structure and a function where I want to refer simply with the parameter names rather than something like p.parameterx, how can I “automatically” copy the struct fields as local para…

---

## [\`task\_local\_storage\`, why and where?](https://discourse.julialang.org/t/task-local-storage-why-and-where/125670)

<div class="topic-metadata">

**Author:** [@Pedro](https://discourse.julialang.org/u/Pedro)\
**Replies:** 3\
**Last updated:** [February 8, 2025, 9:58am UTC](https://discourse.julialang.org/t/task-local-storage-why-and-where/125670 "2025-02-08T09:58:51Z")

</div>

I recently discovered that there exists such function as task\_local\_storage for task. It’s exported. Can anyone give me an example of practical application of such functionality?

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

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