# General Usage

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

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

**Page:** 148

---

## [Why does Juliaup install the musl version on Linux?](https://discourse.julialang.org/t/why-does-juliaup-install-the-musl-version-on-linux/117388)

<div class="topic-metadata">

**Author:** [@Azureuse](https://discourse.julialang.org/u/Azureuse)\
**Replies:** 7\
**Last updated:** [July 23, 2024, 9:13pm UTC](https://discourse.julialang.org/t/why-does-juliaup-install-the-musl-version-on-linux/117388 "2024-07-23T21:13:38Z")

</div>

It looks like Juliaup now prefers the musl version for Linux: juliaup/deploy/shellscript/juliaup-init.sh at main · JuliaLang/juliaup · GitHub and has done for a while (since 08ad054310bcaaa13d6364d41cdae9b31d391630). T…

---

## [Enzyme not working](https://discourse.julialang.org/t/enzyme-not-working/116214)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 10\
**Last updated:** [July 23, 2024, 9:07pm UTC](https://discourse.julialang.org/t/enzyme-not-working/116214 "2024-07-23T21:07:18Z")

</div>

Hi there, Opening this issue to see whether I could get some help (@wsmoses ) with making Reverse mode in autodiff work. I made it work on trivial examples, even containing conditional statements but for some reason it …

---

## [Pass vectors by reference using CxxWrap.@safe\_cfunction](https://discourse.julialang.org/t/pass-vectors-by-reference-using-cxxwrap-safe-cfunction/117350)

<div class="topic-metadata">

**Author:** [@afossa](https://discourse.julialang.org/u/afossa)\
**Replies:** 6\
**Last updated:** [July 23, 2024, 7:51pm UTC](https://discourse.julialang.org/t/pass-vectors-by-reference-using-cxxwrap-safe-cfunction/117350 "2024-07-23T19:51:37Z")

</div>

Hello, I have a Julia function like function f(x::AbstractVector{Float64}, y::AbstractVector{Float64}) y\[1\] = 2.0\*x\[1\]; y\[2\] = 2.0\*x\[2\]; return nothing; end; which takes in input two arrays of Float64 and …

---

## [Understanding error "function type in method definition is not a type" for function-like types](https://discourse.julialang.org/t/understanding-error-function-type-in-method-definition-is-not-a-type-for-function-like-types/116105)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 9\
**Last updated:** [July 23, 2024, 5:16pm UTC](https://discourse.julialang.org/t/understanding-error-function-type-in-method-definition-is-not-a-type-for-function-like-types/116105 "2024-07-23T17:16:15Z")

</div>

I don’t understand why the second way to construct a method (dispatched by ::Val{2}) is not allowed: julia\> abstract type MyFunc \<: Function end julia\> struct MyF1 \<: MyFunc end julia\> (f::MyFunc)(::Val{1}) = "method …

---

## [Figure title for a faceted plot in AlgebraOfGraphics](https://discourse.julialang.org/t/figure-title-for-a-faceted-plot-in-algebraofgraphics/63329)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 10\
**Last updated:** [July 23, 2024, 5:05pm UTC](https://discourse.julialang.org/t/figure-title-for-a-faceted-plot-in-algebraofgraphics/63329 "2024-07-23T17:05:26Z")

</div>

I can’t seem to get an overall figure title for a faceted plot in AlgebraOfGraphics: using CairoMakie using AlgebraOfGraphics using DataFrames df = DataFrame( x = randn(100), y = randn(100), g = rand(\["a", …

---

## [Serious issue: Julia language Keyboard Lag Typing Very Slow](https://discourse.julialang.org/t/serious-issue-julia-language-keyboard-lag-typing-very-slow/32081)

<div class="topic-metadata">

**Author:** [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Replies:** 55\
**Last updated:** [July 23, 2024, 4:01pm UTC](https://discourse.julialang.org/t/serious-issue-julia-language-keyboard-lag-typing-very-slow/32081 "2024-07-23T16:01:26Z")

</div>

PROBLEM I am writing a long Julia code: https://github.com/joseph-pollacco/SoilWaterToolbox After I run Julia code either directly from Visual Studio Code or from the Julia REPL the typing becomes incredibly slow. The…

---

## [Case study: Real time hardware control for adaptive optics with Julia](https://discourse.julialang.org/t/case-study-real-time-hardware-control-for-adaptive-optics-with-julia/117155)

<div class="topic-metadata">

**Author:** [@sefffal](https://discourse.julialang.org/u/sefffal)\
**Replies:** 9\
**Last updated:** [July 23, 2024, 3:29pm UTC](https://discourse.julialang.org/t/case-study-real-time-hardware-control-for-adaptive-optics-with-julia/117155 "2024-07-23T15:29:10Z")

</div>

\[not sure this is the best category, mods feel free to move\] Hi all, I wanted to share our recent conference proceeding on using Julia in a real time application: \[2407.07207\] Real-time adaptive optics control with a h…

---

## [What does the new "public" keyword actually do?](https://discourse.julialang.org/t/what-does-the-new-public-keyword-actually-do/108975)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 12\
**Last updated:** [July 23, 2024, 3:18pm UTC](https://discourse.julialang.org/t/what-does-the-new-public-keyword-actually-do/108975 "2024-07-23T15:18:25Z")

</div>

Continuing from Does the new public keyword actually do anything? From the current 1.11 documentation and release notes, I don’t see that public has any effect on using/import. It seems that maybe Documenter would be…

---

## [What is the recommended way to filter rows of a Dataframe?](https://discourse.julialang.org/t/what-is-the-recommended-way-to-filter-rows-of-a-dataframe/117367)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 6\
**Last updated:** [July 23, 2024, 1:15pm UTC](https://discourse.julialang.org/t/what-is-the-recommended-way-to-filter-rows-of-a-dataframe/117367 "2024-07-23T13:15:48Z")

</div>

Hello, I am asking for recommendations/tips on how to filter rows of a dataframe. I was using filter for sometime. But it seems inefficient/slow compared to subsetting dataframe using other methods. Here are benchmarks …

---

## [Saving model with best loss in NeuralPDE](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087)

<div class="topic-metadata">

**Author:** [@gradureau](https://discourse.julialang.org/u/gradureau)\
**Replies:** 2\
**Last updated:** [July 23, 2024, 1:08pm UTC](https://discourse.julialang.org/t/saving-model-with-best-loss-in-neuralpde/117087 "2024-07-23T13:08:47Z")

</div>

Hey everyone, I am trying to use NeuralPDE to solve equations and I’ve been trying to use the QuasiRandomTraining method, with Adam optimizer. Now the learning curve is quite chaotic, so I would wish to save the best mo…

---

## [Strange difference between running readline in REPL or VSCode](https://discourse.julialang.org/t/strange-difference-between-running-readline-in-repl-or-vscode/117381)

<div class="topic-metadata">

**Author:** [@marcsgil](https://discourse.julialang.org/u/marcsgil)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 11:27am UTC](https://discourse.julialang.org/t/strange-difference-between-running-readline-in-repl-or-vscode/117381 "2024-07-23T11:27:42Z")

</div>

I’m encountering a strange behavior when running Julia through VSCode, and I’m hoping someone can help me understand and resolve it. Consider the following function: function test() @show Base.stdin x = readlin…

---

## [Inject julia code as string inside julia function](https://discourse.julialang.org/t/inject-julia-code-as-string-inside-julia-function/117373)

<div class="topic-metadata">

**Author:** [@JesperMartinsson](https://discourse.julialang.org/u/JesperMartinsson)\
**Replies:** 2\
**Last updated:** [July 23, 2024, 8:12am UTC](https://discourse.julialang.org/t/inject-julia-code-as-string-inside-julia-function/117373 "2024-07-23T08:12:15Z")

</div>

Hi all, I’m receiving a pice of julia code as a string and I need to evaluate this code inside a function and access the local scope. Is it possible to access local scope with eval(Meta.parse(....)) or is there another …

---

## [Pkg.project() inside a unit test](https://discourse.julialang.org/t/pkg-project-inside-a-unit-test/87337)

<div class="topic-metadata">

**Author:** [@rssdev10](https://discourse.julialang.org/u/rssdev10)\
**Replies:** 1\
**Last updated:** [July 23, 2024, 2:37am UTC](https://discourse.julialang.org/t/pkg-project-inside-a-unit-test/87337 "2024-07-23T02:37:50Z")

</div>

Is any way to get the current package name while running a unit test? The issue Pkg.project().name gives nothing I’m activating the tests with \]test The reason why I need it, I want to have a template unit test that mig…

---

## [Save/load REPL state](https://discourse.julialang.org/t/save-load-repl-state/102433)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 9\
**Last updated:** [July 22, 2024, 7:51pm UTC](https://discourse.julialang.org/t/save-load-repl-state/102433 "2024-07-22T19:51:09Z")

</div>

Julia has a strong point in being JIT-compiled language that incremental compilation works (it has to). Still, to take full advantage of that, saving state is required. Imagine you have a codebase which takes 20 minutes…

---

## [Strangely small output when returning tuple](https://discourse.julialang.org/t/strangely-small-output-when-returning-tuple/117250)

<div class="topic-metadata">

**Author:** [@Joetrahedron](https://discourse.julialang.org/u/Joetrahedron)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 4:58pm UTC](https://discourse.julialang.org/t/strangely-small-output-when-returning-tuple/117250 "2024-07-22T16:58:35Z")

</div>

I’ve been using QuantumOptics.jl in Jupyter to run some physics simulations, and I’ve encountered an odd behaviour with one of my functions. My function is defined as follows function lprϕ(Δ, tf, ψ0, tspan1, Δ\_11) t…

---

## [Date to float](https://discourse.julialang.org/t/date-to-float/20094)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 8\
**Last updated:** [July 22, 2024, 4:23pm UTC](https://discourse.julialang.org/t/date-to-float/20094 "2024-07-22T16:23:34Z")

</div>

Is there an easy way to convert date/datetime to a float representing year? I.e. f(2000-01-01) = 2000, f(2015-07-01) ~ 2015.5 and so on. The most obvious method is 2000 + (x - DateTime(2000, 1, 1)) / (DateTime(2001, 1, 1…

---

## [Code Generation with macro](https://discourse.julialang.org/t/code-generation-with-macro/117080)

<div class="topic-metadata">

**Author:** [@Andy\_Zhang](https://discourse.julialang.org/u/Andy_Zhang)\
**Replies:** 6\
**Last updated:** [July 22, 2024, 12:58pm UTC](https://discourse.julialang.org/t/code-generation-with-macro/117080 "2024-07-22T12:58:38Z")

</div>

Background I am writing a package that provides some structures of matrices, and I want them to have different properties. module MyModuleA export TypeA, properties # function interfaces properties(::Type{\<:Ab…

---

## [Cannot add package in super computer](https://discourse.julialang.org/t/cannot-add-package-in-super-computer/117224)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 12\
**Last updated:** [July 22, 2024, 9:58am UTC](https://discourse.julialang.org/t/cannot-add-package-in-super-computer/117224 "2024-07-22T09:58:04Z")

</div>

Hi all. I am new to HPC, so I need your help. I encounted the following errors in super computer, Unfortunately the super computer does not support julia but permits manually installing. So I installed julia using jul…

---

## [Questions with building a chainrules for mutating array function](https://discourse.julialang.org/t/questions-with-building-a-chainrules-for-mutating-array-function/117237)

<div class="topic-metadata">

**Author:** [@chooron](https://discourse.julialang.org/u/chooron)\
**Replies:** 2\
**Last updated:** [July 22, 2024, 8:30am UTC](https://discourse.julialang.org/t/questions-with-building-a-chainrules-for-mutating-array-function/117237 "2024-07-22T08:30:42Z")

</div>

I want to build two functions for replacing values in a vector and an array, as shown below: function mutate\_vec(vec::AbstractVector{T}, new\_value::T, idx::Int) where {T} vec\[idx\] = new\_value vec end function m…

---

## [Findfirstsorted](https://discourse.julialang.org/t/findfirstsorted/117313)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 5\
**Last updated:** [July 22, 2024, 8:18am UTC](https://discourse.julialang.org/t/findfirstsorted/117313 "2024-07-22T08:18:49Z")

</div>

I’m looking for a predicate version of binary search. That is, a function that tests a predicate p(x) on elements of an array xs and finds the first index i for which p(xs\[i\]) returns true, assuming that i \< j implies (…

---

## [Testing 3rd party package in my local environment](https://discourse.julialang.org/t/testing-3rd-party-package-in-my-local-environment/117325)

<div class="topic-metadata">

**Author:** [@Yannik](https://discourse.julialang.org/u/Yannik)\
**Replies:** 1\
**Last updated:** [July 22, 2024, 8:06am UTC](https://discourse.julialang.org/t/testing-3rd-party-package-in-my-local-environment/117325 "2024-07-22T08:06:19Z")

</div>

I am uncertain how to run the tests of the packages installed in my environment. When i write \] test package\_name It creates temporary project and manifest files. Is it possible to run the test files in the environmen…

---

## [LoadError: ArgumentError: Package X does not have Y in its dependencies](https://discourse.julialang.org/t/loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies/117322)

<div class="topic-metadata">

**Author:** [@Jollywatt](https://discourse.julialang.org/u/Jollywatt)\
**Replies:** 2\
**Last updated:** [July 22, 2024, 7:44am UTC](https://discourse.julialang.org/t/loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies/117322 "2024-07-22T07:44:18Z")

</div>

I have been using Julia for years and dread this error because I have never been able to reliably fix it. I am developing packages A and B, where A uses B as a dependency. In Julia, in the main environment, using A err…

---

## [How to make RangeSlider larger in Pluto?](https://discourse.julialang.org/t/how-to-make-rangeslider-larger-in-pluto/117234)

<div class="topic-metadata">

**Author:** [@ultrapoci](https://discourse.julialang.org/u/ultrapoci)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 5:51am UTC](https://discourse.julialang.org/t/how-to-make-rangeslider-larger-in-pluto/117234 "2024-07-22T05:51:19Z")

</div>

I’m using a RangeSlider in Pluto but it is way too small. I’ve found this reddit post where a user wrote that putting this inside a cell will make all sliders bigger: html""" \<style\> input\[type\*="range"\] { width: 100%;…

---

## [Best practices to add more than one bound to type parameters](https://discourse.julialang.org/t/best-practices-to-add-more-than-one-bound-to-type-parameters/117212)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 23\
**Last updated:** [July 21, 2024, 10:18pm UTC](https://discourse.julialang.org/t/best-practices-to-add-more-than-one-bound-to-type-parameters/117212 "2024-07-21T22:18:45Z")

</div>

MWE: julia\> const TwoOrThreeTuple{T} = Union{NTuple{2, T}, NTuple{3, T}} Union{Tuple{T, T}, Tuple{T, T, T}} where T julia\> struct myT{T, N, NTuple{N, T}\<:V\<:TwoOrThreeTuple{T}} a::V end julia\> myT((1,2))…

---

## [Using PETSc to solve Ax=rhs](https://discourse.julialang.org/t/using-petsc-to-solve-ax-rhs/117140)

<div class="topic-metadata">

**Author:** [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)\
**Replies:** 2\
**Last updated:** [July 21, 2024, 9:32pm UTC](https://discourse.julialang.org/t/using-petsc-to-solve-ax-rhs/117140 "2024-07-21T21:32:44Z")

</div>

Hello everyone, I am trying to reduce the time for solving the system of linear equations: Ax=rhs. My method is to use factorization provided by “pkg:LinearAlgebra”. However, I know that if we can use PETSc it will be…

---

## [Parallel Computing with Threads.@threads in HPC is slow?](https://discourse.julialang.org/t/parallel-computing-with-threads-threads-in-hpc-is-slow/112591)

<div class="topic-metadata">

**Author:** [@Van\_Sy\_Tnut](https://discourse.julialang.org/u/Van_Sy_Tnut)\
**Replies:** 12\
**Last updated:** [July 21, 2024, 9:24pm UTC](https://discourse.julialang.org/t/parallel-computing-with-threads-threads-in-hpc-is-slow/112591 "2024-07-21T21:24:17Z")

</div>

Hello everyone! I am wondering why parallel computing with “Threads.@threads” in my own PC is faster than that in HPC? Although the maximum number of “Threads.nthreads()” I can set up in my PC is only 16 while in HPC I…

---

## [Subplotting incoherent behaviour](https://discourse.julialang.org/t/subplotting-incoherent-behaviour/117303)

<div class="topic-metadata">

**Author:** [@traincopter](https://discourse.julialang.org/u/traincopter)\
**Replies:** 3\
**Last updated:** [July 21, 2024, 6:51pm UTC](https://discourse.julialang.org/t/subplotting-incoherent-behaviour/117303 "2024-07-21T18:51:35Z")

</div>

Hello, I’m experiencing the following behavior, which confuses me a lot. First of all, let’s consider the following code: using Plots x = range(0, 10, length=100) y1 = @. exp(-0.1x) \* cos(4x) y2 = @. exp(-0.3x) \* cos(…

---

## [Holy traits vs "boolean traits"](https://discourse.julialang.org/t/holy-traits-vs-boolean-traits/111954)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 9\
**Last updated:** [July 21, 2024, 5:09pm UTC](https://discourse.julialang.org/t/holy-traits-vs-boolean-traits/111954 "2024-07-21T17:09:06Z")

</div>

I’ve been exploring how holy traits are typically implemented in Julia, often seeing patterns like the following: SomeTrait(x::Type) = B() SomeTrait(::Type{\<:T}) = A() somefunc(x::T) where {T} = somefunc(SomeTrait(T), …

---

## [Mixed Python/ Julia package](https://discourse.julialang.org/t/mixed-python-julia-package/117299)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [July 21, 2024, 3:31pm UTC](https://discourse.julialang.org/t/mixed-python-julia-package/117299 "2024-07-21T15:31:29Z")

</div>

I try to package a software that contains of a Julia package and a Python wrapper. The wrapper uses http, so no PythonCall is used. Questions: would it be possible to package it such that it can be installed with pip?…

---

## [An elementary symbolics question: simplifying a nested/continued fraction?](https://discourse.julialang.org/t/an-elementary-symbolics-question-simplifying-a-nested-continued-fraction/117170)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 5\
**Last updated:** [July 21, 2024, 8:27am UTC](https://discourse.julialang.org/t/an-elementary-symbolics-question-simplifying-a-nested-continued-fraction/117170 "2024-07-21T08:27:49Z")

</div>

(Julia version 1.10.3, Symbolics version 5.33.0) Here’s a simple example: using Symbolics @variables y eq = 1/(7+1/(2+1/(4+y))) simplify(eq) simplify\_fractions(eq) expand(eq) None of the last three work - the fractio…

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

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