# General Usage

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

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

**Page:** 169

---

## [What are the best practices for using incompatible downstream packages in package development?](https://discourse.julialang.org/t/what-are-the-best-practices-for-using-incompatible-downstream-packages-in-package-development/114275)

<div class="topic-metadata">

**Author:** [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Replies:** 3\
**Last updated:** [May 17, 2024, 1:12am UTC](https://discourse.julialang.org/t/what-are-the-best-practices-for-using-incompatible-downstream-packages-in-package-development/114275 "2024-05-17T01:12:04Z")

</div>

When developing a package, you may want to use its downstream packages for testing and documentation. However, its downstream packages may not officially support the development version because the development version h…

---

## [Error trying to ForwardDiff through an ODE solver](https://discourse.julialang.org/t/error-trying-to-forwarddiff-through-an-ode-solver/114339)

<div class="topic-metadata">

**Author:** [@orebas](https://discourse.julialang.org/u/orebas)\
**Replies:** 9\
**Last updated:** [May 16, 2024, 10:53pm UTC](https://discourse.julialang.org/t/error-trying-to-forwarddiff-through-an-ode-solver/114339 "2024-05-16T22:53:35Z")

</div>

I am trying to use AD to differentiate the solution of an ODE. Various docs seem to indicate this is very well supported, so I was surprised to get an error. For some additional color, I got a different error before ad…

---

## [Solving DAEs with known sparsity pattern and IDA](https://discourse.julialang.org/t/solving-daes-with-known-sparsity-pattern-and-ida/114318)

<div class="topic-metadata">

**Author:** [@ataideneto](https://discourse.julialang.org/u/ataideneto)\
**Replies:** 4\
**Last updated:** [May 16, 2024, 10:51pm UTC](https://discourse.julialang.org/t/solving-daes-with-known-sparsity-pattern-and-ida/114318 "2024-05-16T22:51:55Z")

</div>

Hi everyone! Can someone provide a minimal example of how to use sparsity patterns (jac\_prototype) when solving DAEs with IDA solver? I manage to use sparsity patterns with ODEs and the julia solvers… Here are some exa…

---

## [How to Use Operator Overloading with Optional Arguments in Julia](https://discourse.julialang.org/t/how-to-use-operator-overloading-with-optional-arguments-in-julia/114375)

<div class="topic-metadata">

**Author:** [@Akhil\_Akkapelli](https://discourse.julialang.org/u/Akhil_Akkapelli)\
**Replies:** 2\
**Last updated:** [May 16, 2024, 8:56pm UTC](https://discourse.julialang.org/t/how-to-use-operator-overloading-with-optional-arguments-in-julia/114375 "2024-05-16T20:56:44Z")

</div>

I’m working on a Julia project and I’ve defined a custom function with operator overloading. My function, which I’ve defined using the | operator, initializes a matrix of Box objects with properties derived from a parent…

---

## [Plots do not display, unless I call gui(), when using custom sysimage](https://discourse.julialang.org/t/plots-do-not-display-unless-i-call-gui-when-using-custom-sysimage/92207)

<div class="topic-metadata">

**Author:** [@rdiaz02](https://discourse.julialang.org/u/rdiaz02)\
**Replies:** 3\
**Last updated:** [May 16, 2024, 8:02pm UTC](https://discourse.julialang.org/t/plots-do-not-display-unless-i-call-gui-when-using-custom-sysimage/92207 "2024-05-16T20:02:30Z")

</div>

I have created a custom sysimage that contains Plots, as explained here https://julialang.github.io/PackageCompiler.jl/dev/examples/plots.html (see \[1\] below for complete details). If I start Julia from the REPL using…

---

## [Unable to precompile any packages](https://discourse.julialang.org/t/unable-to-precompile-any-packages/114311)

<div class="topic-metadata">

**Author:** [@gplayer](https://discourse.julialang.org/u/gplayer)\
**Replies:** 18\
**Last updated:** [May 16, 2024, 7:52pm UTC](https://discourse.julialang.org/t/unable-to-precompile-any-packages/114311 "2024-05-16T19:52:53Z")

</div>

I’ve run into the following error which I’ve been unable to fix. Whenever I try to run “using \*” for any packages (I’ve tried Plots, CSV, JSON, QuadGK, and a few others), it fails to precompile. The top line of the erro…

---

## [Union type confusion](https://discourse.julialang.org/t/union-type-confusion/114366)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 6\
**Last updated:** [May 16, 2024, 7:11pm UTC](https://discourse.julialang.org/t/union-type-confusion/114366 "2024-05-16T19:11:22Z")

</div>

Consider an abstract type with a parameter T and its two concrete types: abstract type AbstractMyType{T} end struct MyType1{T} \<: AbstractMyType{T} end struct MyType2{T} \<: AbstractMyType{T} end Construct a vector of i…

---

## [How to extend structs for equality, in order to make use of operator like \`in\`?](https://discourse.julialang.org/t/how-to-extend-structs-for-equality-in-order-to-make-use-of-operator-like-in/114322)

<div class="topic-metadata">

**Author:** [@BuddhiLW](https://discourse.julialang.org/u/BuddhiLW)\
**Replies:** 7\
**Last updated:** [May 16, 2024, 6:32pm UTC](https://discourse.julialang.org/t/how-to-extend-structs-for-equality-in-order-to-make-use-of-operator-like-in/114322 "2024-05-16T18:32:15Z")

</div>

I’m creating a package to run Black Jack simulations. I would like to write structs A, C2 (2-card), … etc for each card type in a deck. And, to have a general Card struct, so I can overload methods like +, ==, with Car…

---

## [Slow package load after initially starting Julia on Windows](https://discourse.julialang.org/t/slow-package-load-after-initially-starting-julia-on-windows/114369)

<div class="topic-metadata">

**Author:** [@TomRottier](https://discourse.julialang.org/u/TomRottier)\
**Replies:** 2\
**Last updated:** [May 16, 2024, 6:05pm UTC](https://discourse.julialang.org/t/slow-package-load-after-initially-starting-julia-on-windows/114369 "2024-05-16T18:05:07Z")

</div>

When I open a fresh terminal session on Windows: julia\> @time using GLMakie 56.724200 seconds (4.40 M allocations: 459.433 MiB, 0.63% gc time, 0.09% compilation time: 57% of which was recompilation) If I then close th…

---

## [Running Old Project on Latest Julia Version?](https://discourse.julialang.org/t/running-old-project-on-latest-julia-version/114356)

<div class="topic-metadata">

**Author:** [@r0b0ty](https://discourse.julialang.org/u/r0b0ty)\
**Replies:** 8\
**Last updated:** [May 16, 2024, 5:23pm UTC](https://discourse.julialang.org/t/running-old-project-on-latest-julia-version/114356 "2024-05-16T17:23:52Z")

</div>

Is there a proper way (best practice) to convert a project originally compiled in an older Julia version, to the latest released version? The message I’m greeted with in this scenario is: Warning: The active manifest …

---

## [Assigning value to time dependent symbolic function inside a function](https://discourse.julialang.org/t/assigning-value-to-time-dependent-symbolic-function-inside-a-function/114361)

<div class="topic-metadata">

**Author:** [@PrimulaBunce](https://discourse.julialang.org/u/PrimulaBunce)\
**Replies:** 4\
**Last updated:** [May 16, 2024, 3:41pm UTC](https://discourse.julialang.org/t/assigning-value-to-time-dependent-symbolic-function-inside-a-function/114361 "2024-05-16T15:41:46Z")

</div>

Hi, In the following code: using ModelingToolkit @variables t @register\_symbolic u(t) u(t) = 60 is there a way I can assign a value to u(t) from inside a function? The following doesn’t work. function assignValue…

---

## [How to define a \`struct\` that has keyword arguments?](https://discourse.julialang.org/t/how-to-define-a-struct-that-has-keyword-arguments/114353)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 10\
**Last updated:** [May 16, 2024, 3:26pm UTC](https://discourse.julialang.org/t/how-to-define-a-struct-that-has-keyword-arguments/114353 "2024-05-16T15:26:59Z")

</div>

I want to define a struct whose instances are created with explicit keyword arguments just like a function. How? struct MyStruct kwarg1::Real kwarg2::String end MyStruct(kwarg1=1, kwarg2="hello")

---

## [JuliaCall setup script not working (Ubuntu)](https://discourse.julialang.org/t/juliacall-setup-script-not-working-ubuntu/114328)

<div class="topic-metadata">

**Author:** [@Rohit](https://discourse.julialang.org/u/Rohit)\
**Replies:** 0\
**Last updated:** [May 15, 2024, 10:30pm UTC](https://discourse.julialang.org/t/juliacall-setup-script-not-working-ubuntu/114328 "2024-05-15T22:30:54Z")

</div>

Hi, I installed the latest version of Julia 1.10.3 in my AWS Ubuntu and I’m now trying to set it up in R. I tried using JuliaCall’s setup function but it shows me the following error: \> library(JuliaCall) \> julia \<- ju…

---

## [Update on Base.@kwdef versus Parameters.jl](https://discourse.julialang.org/t/update-on-base-kwdef-versus-parameters-jl/95042)

<div class="topic-metadata">

**Author:** [@mocalvao](https://discourse.julialang.org/u/mocalvao)\
**Replies:** 10\
**Last updated:** [May 16, 2024, 2:41pm UTC](https://discourse.julialang.org/t/update-on-base-kwdef-versus-parameters-jl/95042 "2024-05-16T14:41:23Z")

</div>

Hi, I have checked the Stackoverflow topic Difference between @with\_kw and Base.@kwdef in Julia?, whose last update is from Oct, 18, 2021, and would like to know whether there should be any drawbacks due to my current p…

---

## [Discrepancy between complex gradients calculate with Zygote.jl and Python's Jax](https://discourse.julialang.org/t/discrepancy-between-complex-gradients-calculate-with-zygote-jl-and-pythons-jax/114301)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 10\
**Last updated:** [May 16, 2024, 11:24am UTC](https://discourse.julialang.org/t/discrepancy-between-complex-gradients-calculate-with-zygote-jl-and-pythons-jax/114301 "2024-05-16T11:24:31Z")

</div>

When I translated another python project code into julia code, there was a problem. After unremitting efforts, I finally got the following two sample codes Julia codeusing Zygote using FiniteDifferences function test(x…

---

## [Why falling back to linear interpolation once I use saveat?](https://discourse.julialang.org/t/why-falling-back-to-linear-interpolation-once-i-use-saveat/114343)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 1\
**Last updated:** [May 16, 2024, 7:57am UTC](https://discourse.julialang.org/t/why-falling-back-to-linear-interpolation-once-i-use-saveat/114343 "2024-05-16T07:57:18Z")

</div>

julia\> solve(prob,Tsit5(),calck=false) retcode: Success Interpolation: specialized 4th order "free" interpolation t: 7-element Vector{Float64}: -1.0 -0.9999 -0.9989 -0.9889 -0.8889 0.11109999999999953 1.0 u: 7-e…

---

## [Precompilation gridlock on HPC cluster](https://discourse.julialang.org/t/precompilation-gridlock-on-hpc-cluster/114213)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 9\
**Last updated:** [May 16, 2024, 4:12am UTC](https://discourse.julialang.org/t/precompilation-gridlock-on-hpc-cluster/114213 "2024-05-16T04:12:26Z")

</div>

I’m running a batch script on an HPC cluster where each Julia execution is expected to be \<1 min, within a bash loop. I ran into this weird “precompilation gridlock”, shown below. Has anybody experienced something like t…

---

## [I have a problem with error : cuda driver not found](https://discourse.julialang.org/t/i-have-a-problem-with-error-cuda-driver-not-found/114337)

<div class="topic-metadata">

**Author:** [@rbfks1003](https://discourse.julialang.org/u/rbfks1003)\
**Replies:** 0\
**Last updated:** [May 16, 2024, 4:00am UTC](https://discourse.julialang.org/t/i-have-a-problem-with-error-cuda-driver-not-found/114337 "2024-05-16T04:00:45Z")

</div>

Hello, I’m trying it because I want to use it while reading about scLENS among the papers presented in nature. It’s being done based on julia. In the paper, code availability is provided, so I practiced demo data based …

---

## [Map Function to Slice with Index Names](https://discourse.julialang.org/t/map-function-to-slice-with-index-names/114280)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [May 15, 2024, 5:36am UTC](https://discourse.julialang.org/t/map-function-to-slice-with-index-names/114280 "2024-05-15T05:36:52Z")

</div>

I’d like to apply a function to slices of a named array such that the function has access to the array index names as well as the slice contents. The syntax below uses a KeyedArray and passes a NamedTuple ( slice, index…

---

## [Inquiry about Symbolics.jl](https://discourse.julialang.org/t/inquiry-about-symbolics-jl/114331)

<div class="topic-metadata">

**Author:** [@cnf](https://discourse.julialang.org/u/cnf)\
**Replies:** 0\
**Last updated:** [May 16, 2024, 12:13am UTC](https://discourse.julialang.org/t/inquiry-about-symbolics-jl/114331 "2024-05-16T00:13:52Z")

</div>

I am running Julia 1.6.7 on a Linux machine and trying to use the Symbolics.jl package. Any assistance with the following would be appreciated. (1) The function simplify() does not simplify the following trigonometri…

---

## [Shuffle lines in a big file, and trim it](https://discourse.julialang.org/t/shuffle-lines-in-a-big-file-and-trim-it/114247)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 5\
**Last updated:** [May 15, 2024, 9:46pm UTC](https://discourse.julialang.org/t/shuffle-lines-in-a-big-file-and-trim-it/114247 "2024-05-15T21:46:44Z")

</div>

Hi, In shell, whatever the size of the file, I do: cat file.txt | shuf | head -n 5000 \> shuffled\_trimmed\_file.txt With Julia, I tried to load the file with readdlm(), but it is too big and the process stops. I looked…

---

## [Operation on transpose sparse array is slow](https://discourse.julialang.org/t/operation-on-transpose-sparse-array-is-slow/114330)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 11:50pm UTC](https://discourse.julialang.org/t/operation-on-transpose-sparse-array-is-slow/114330 "2024-05-15T23:50:13Z")

</div>

Hi Friends, I am searching for a better solution for speed up my script, my script accept a sparse matrix as input, (some time the sparse matrix is sample X features, and sometimes it is features X sample), I have to tr…

---

## [How can I make a result of expand\_derivative() callable](https://discourse.julialang.org/t/how-can-i-make-a-result-of-expand-derivative-callable/114323)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 2\
**Last updated:** [May 15, 2024, 9:51pm UTC](https://discourse.julialang.org/t/how-can-i-make-a-result-of-expand-derivative-callable/114323 "2024-05-15T21:51:24Z")

</div>

Hello, good evening. Im solving some differentiation and I dont know how to make a result from expand\_derivative function from Symbolics callable. This will enhance my workflow. Is there a way to do? @variables t i =…

---

## [Clustering\_quality not defined](https://discourse.julialang.org/t/clustering-quality-not-defined/114309)

<div class="topic-metadata">

**Author:** [@GiuliaM](https://discourse.julialang.org/u/GiuliaM)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 5:47pm UTC](https://discourse.julialang.org/t/clustering-quality-not-defined/114309 "2024-05-15T17:47:11Z")

</div>

Hello everyone! I’m trying to use the package Clustering.jl. The documentation reports this code to calculate different performance indices. using Plots, Clustering X = hcat(\[4., 5.\] .+ 0.4 \* randn(2, 10), \[9.,…

---

## [Matrix handling in memory](https://discourse.julialang.org/t/matrix-handling-in-memory/114258)

<div class="topic-metadata">

**Author:** [@MatheusJanczkowski](https://discourse.julialang.org/u/MatheusJanczkowski)\
**Replies:** 15\
**Last updated:** [May 15, 2024, 3:57pm UTC](https://discourse.julialang.org/t/matrix-handling-in-memory/114258 "2024-05-15T15:57:15Z")

</div>

I have a code that is divided in three parts: pre-processing, iterative scheme, and post-processing. In the pre-processing, it calculates a matrix (that can be very large); but it won’t be used in the iterative scheme, w…

---

## [Is it possible to access point coordinates from Plots using the box and lasso select from Plotly(JS)](https://discourse.julialang.org/t/is-it-possible-to-access-point-coordinates-from-plots-using-the-box-and-lasso-select-from-plotly-js/68776)

<div class="topic-metadata">

**Author:** [@Diego\_Javier\_Zea](https://discourse.julialang.org/u/Diego_Javier_Zea)\
**Replies:** 10\
**Last updated:** [May 15, 2024, 1:48pm UTC](https://discourse.julialang.org/t/is-it-possible-to-access-point-coordinates-from-plots-using-the-box-and-lasso-select-from-plotly-js/68776 "2024-05-15T13:48:00Z")

</div>

Hi! When performing a scatter plot using the Plotly or PlotlyJS backends of Plots, it is possible to use the box and lasso select tools. How can I access the coordinates of the selected points from Julia? Best,

---

## [Implement Matlab/Simbiology concepts (e.g. compartments, repeated assignments) in Julia/Catalyst](https://discourse.julialang.org/t/implement-matlab-simbiology-concepts-e-g-compartments-repeated-assignments-in-julia-catalyst/114266)

<div class="topic-metadata">

**Author:** [@valerdam](https://discourse.julialang.org/u/valerdam)\
**Replies:** 9\
**Last updated:** [May 15, 2024, 2:13pm UTC](https://discourse.julialang.org/t/implement-matlab-simbiology-concepts-e-g-compartments-repeated-assignments-in-julia-catalyst/114266 "2024-05-15T14:13:21Z")

</div>

I am testing ways to code Matlab/Simbiology concepts (e.g. compartments, repeated assignments) in Julia/Catalyst and I would appreciate both general pointers on where to find more information as well as figuring out one…

---

## [@take macro?](https://discourse.julialang.org/t/take-macro/114282)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 2\
**Last updated:** [May 15, 2024, 1:51pm UTC](https://discourse.julialang.org/t/take-macro/114282 "2024-05-15T13:51:19Z")

</div>

I’m using a Channel to keep a few instances of a struct that I need to use inside a thread (following the instructions in Thread-Safe Storage · OhMyThreads.jl): using OhMyThreads nthings = 4 const things = Channel{…

---

## [Best solution to Julia's soft scope problem?](https://discourse.julialang.org/t/best-solution-to-julias-soft-scope-problem/70199)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 15\
**Last updated:** [May 15, 2024, 1:01pm UTC](https://discourse.julialang.org/t/best-solution-to-julias-soft-scope-problem/70199 "2024-05-15T13:01:06Z")

</div>

For example, a loop like the below will consistently cause an error. A = 5 for i in 1:10 A = A+i; end Error message: Assignment to \`A\` in soft scope is ambiguous because a global variable by the same name exists: …

---

## [Julia Genie API - handling multiple requests](https://discourse.julialang.org/t/julia-genie-api-handling-multiple-requests/88715)

<div class="topic-metadata">

**Author:** [@cjproud](https://discourse.julialang.org/u/cjproud)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 4:52am UTC](https://discourse.julialang.org/t/julia-genie-api-handling-multiple-requests/88715 "2024-05-15T04:52:30Z")

</div>

Hi, I’m using Genie.jl as a web server which basically contains some API endpoints that do some calculations using the provided JSON request data. One of these calculations can take up to a minute or two and I’ve notice…

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

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