# General Usage

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

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

**Page:** 232

---

## [How to display project dependencies in a tree?](https://discourse.julialang.org/t/how-to-display-project-dependencies-in-a-tree/79567)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 11\
**Last updated:** [November 8, 2023, 3:17pm UTC](https://discourse.julialang.org/t/how-to-display-project-dependencies-in-a-tree/79567 "2023-11-08T15:17:10Z")

</div>

Using the package manager I can display the direct dependencies of my package: (KiteModels) pkg\> st Project KiteModels v0.2.2 Status \`~/repos/KiteModels/Project.toml\` \[39dd38d3\] Dierckx v0.5.2 \[ffbed154\] …

---

## [Interrupting wait(Threads.Event())](https://discourse.julialang.org/t/interrupting-wait-threads-event/105047)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 14\
**Last updated:** [November 8, 2023, 6:41am UTC](https://discourse.julialang.org/t/interrupting-wait-threads-event/105047 "2023-11-08T06:41:18Z")

</div>

I want to wait for a Threads.Event() for at most 1 second, then I want to move on regardless of whether the event was notified or not. The following works, but it leaks a Task and a dummy event every time I do this. eve…

---

## [Slow L-BFGS code](https://discourse.julialang.org/t/slow-l-bfgs-code/105917)

<div class="topic-metadata">

**Author:** [@yhuang](https://discourse.julialang.org/u/yhuang)\
**Replies:** 5\
**Last updated:** [November 7, 2023, 10:08pm UTC](https://discourse.julialang.org/t/slow-l-bfgs-code/105917 "2023-11-07T22:08:38Z")

</div>

I’m customizing Burer-Monteiro method on a specific problem, which involves solving many subproblems using L-BFGS. However, I noticed that my L-BFGS runs slow. The critical operation of computing the descent direction i…

---

## [Syntax for dispatching on subtypes](https://discourse.julialang.org/t/syntax-for-dispatching-on-subtypes/105871)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 10\
**Last updated:** [November 7, 2023, 10:30pm UTC](https://discourse.julialang.org/t/syntax-for-dispatching-on-subtypes/105871 "2023-11-07T22:30:51Z")

</div>

If I have a type with multiple subtypes, and I want to dispatch on one of the types I usually type: struct Foo{A,B,...} ... end function somefunc(f::F{A, SomeSubtype,C,...}) where {A,C,...} ... end This becomes …

---

## [GC occurs at the worst time in tight loop (Garbage Collection)](https://discourse.julialang.org/t/gc-occurs-at-the-worst-time-in-tight-loop-garbage-collection/104934)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 93\
**Last updated:** [November 7, 2023, 4:36pm UTC](https://discourse.julialang.org/t/gc-occurs-at-the-worst-time-in-tight-loop-garbage-collection/104934 "2023-11-07T16:36:34Z")

</div>

I have julia code which I’ve compiled into a C-library. We intend to run this on a real-time system to test some hardware. When I run a test on the function call in julia using the BenchmarkTools. The @benchmarks look…

---

## [We Do Need Exportable New Structs and Functions in Extension](https://discourse.julialang.org/t/we-do-need-exportable-new-structs-and-functions-in-extension/105810)

<div class="topic-metadata">

**Author:** [@Sole](https://discourse.julialang.org/u/Sole)\
**Replies:** 9\
**Last updated:** [November 6, 2023, 10:31pm UTC](https://discourse.julialang.org/t/we-do-need-exportable-new-structs-and-functions-in-extension/105810 "2023-11-06T22:31:02Z")

</div>

I’m not the last man struggling with transfering from Requires pkg to officially supported extension feature for Julia1.9+. With Requires pkg we don’t care about where a function and a struct are defined because we can …

---

## [Compat bounds for stdlib and empty intersection issue on CI](https://discourse.julialang.org/t/compat-bounds-for-stdlib-and-empty-intersection-issue-on-ci/105898)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 3\
**Last updated:** [November 7, 2023, 3:17pm UTC](https://discourse.julialang.org/t/compat-bounds-for-stdlib-and-empty-intersection-issue-on-ci/105898 "2023-11-07T15:17:14Z")

</div>

I was trying to do a patch release for Franklin but the registry stopped me from doing this indicating that a bunch of stdlib libraries (Dates, Logging, Random, …) did not have compat bounds and that they should. So I ad…

---

## [SIMD struggles, seeking solutions (with KangarooTwelve.jl)](https://discourse.julialang.org/t/simd-struggles-seeking-solutions-with-kangarootwelve-jl/105800)

<div class="topic-metadata">

**Author:** [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Replies:** 23\
**Last updated:** [November 7, 2023, 11:38am UTC](https://discourse.julialang.org/t/simd-struggles-seeking-solutions-with-kangarootwelve-jl/105800 "2023-11-07T11:38:11Z")

</div>

A bit ago I mentioned a new hashing library I have been working on: After a huge amount of effort, I’ve just managed to make the “simple” single-threaded version (k12\_singlethreaded) zero-alloc and only off the C perf…

---

## [Modellingtoolkit and PackageCompiler](https://discourse.julialang.org/t/modellingtoolkit-and-packagecompiler/105877)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [November 7, 2023, 10:09am UTC](https://discourse.julialang.org/t/modellingtoolkit-and-packagecompiler/105877 "2023-11-07T10:09:35Z")

</div>

I have the impression that PackageCompiler does not reduce the compilation time for ModelingToolkit models much. I have a function that creates my model and call it in test\_for\_precompile.jl script of PackageCompiler. If…

---

## [How to make Julia game mods composable?](https://discourse.julialang.org/t/how-to-make-julia-game-mods-composable/105888)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 0\
**Last updated:** [November 7, 2023, 5:44am UTC](https://discourse.julialang.org/t/how-to-make-julia-game-mods-composable/105888 "2023-11-07T05:44:55Z")

</div>

Preamble: Julia has many tools for game development from geometric algebra to physics simulation and AI and so on. It may also solve the two-culture problem of game designers and game developers. However, getting to that…

---

## [Compat bounds for stdlibs that are test dependencies?](https://discourse.julialang.org/t/compat-bounds-for-stdlibs-that-are-test-dependencies/105852)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 4\
**Last updated:** [November 6, 2023, 11:40pm UTC](https://discourse.julialang.org/t/compat-bounds-for-stdlibs-that-are-test-dependencies/105852 "2023-11-06T23:40:04Z")

</div>

Currently, one needs to add compat bounds for stdlibs that are direct dependencies. Should one also add compat bounds for stdlibs that are only test dependencies, to avoid fetching breaking versions in the CI runs?

---

## [Cannot build packages with Julia 1.10.0-rc1 without disabling startup.jl](https://discourse.julialang.org/t/cannot-build-packages-with-julia-1-10-0-rc1-without-disabling-startup-jl/105878)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 0\
**Last updated:** [November 6, 2023, 9:25pm UTC](https://discourse.julialang.org/t/cannot-build-packages-with-julia-1-10-0-rc1-without-disabling-startup-jl/105878 "2023-11-06T21:25:55Z")

</div>

The following came up in the context of IJulia; @stevengj suggested to post it here. Building packages with Julia 1.10.0-rc1 fails on my machine unless I start Julia with --startup-file=no. My startup.jl contains the li…

---

## [The value of \`one\` when using pi and E](https://discourse.julialang.org/t/the-value-of-one-when-using-pi-and-e/105875)

<div class="topic-metadata">

**Author:** [@scottrsm](https://discourse.julialang.org/u/scottrsm)\
**Replies:** 4\
**Last updated:** [November 6, 2023, 8:33pm UTC](https://discourse.julialang.org/t/the-value-of-one-when-using-pi-and-e/105875 "2023-11-06T20:33:44Z")

</div>

When using \\pi or \\euler with the function one the value is the boolean value: true rather than 1.0. For other irrational values like sqrt(2) the value is 1.0 as it should be. Why is this?

---

## [Performance of generating uniform Float32 numbers](https://discourse.julialang.org/t/performance-of-generating-uniform-float32-numbers/105863)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 4\
**Last updated:** [November 6, 2023, 6:11pm UTC](https://discourse.julialang.org/t/performance-of-generating-uniform-float32-numbers/105863 "2023-11-06T18:11:22Z")

</div>

I’m trying to generate Float32’s from a uniformly from a range, and found Normal from distributions doesn’t offer great performance compared to just stretching and shifting what rand(Float32) already produces. Am I doing…

---

## [Type functions in structs](https://discourse.julialang.org/t/type-functions-in-structs/105864)

<div class="topic-metadata">

**Author:** [@atteson](https://discourse.julialang.org/u/atteson)\
**Replies:** 3\
**Last updated:** [November 6, 2023, 4:08pm UTC](https://discourse.julialang.org/t/type-functions-in-structs/105864 "2023-11-06T16:08:22Z")

</div>

Is there a way to implement the following without error: B2I(T) = T == Bool ? Int : T struct S{T} x::B2I(T) end s1 = S{Bool}( 3 )

---

## [Creating a call graph for Julia](https://discourse.julialang.org/t/creating-a-call-graph-for-julia/105857)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [November 6, 2023, 3:34pm UTC](https://discourse.julialang.org/t/creating-a-call-graph-for-julia/105857 "2023-11-06T15:34:08Z")

</div>

Is there a tool to create a call graph from a Julia function? See: What is a Call Graph? And How to Generate them Automatically

---

## [Generating Float32 uniform random numbers with Distributions.jl](https://discourse.julialang.org/t/generating-float32-uniform-random-numbers-with-distributions-jl/63889)

<div class="topic-metadata">

**Author:** [@bad\_at\_math](https://discourse.julialang.org/u/bad_at_math)\
**Replies:** 2\
**Last updated:** [November 6, 2023, 2:32pm UTC](https://discourse.julialang.org/t/generating-float32-uniform-random-numbers-with-distributions-jl/63889 "2023-11-06T14:32:43Z")

</div>

I can define and sample from a uniform distribution with Float32 bounds as follows: using Distributions dist = Uniform{Float32}(-1.0f0, 1.0f0) x = rand(dist) However, the x here has type Float64, not Float32. Is there…

---

## [Dlopen appending file extensions for shared libraries?](https://discourse.julialang.org/t/dlopen-appending-file-extensions-for-shared-libraries/105761)

<div class="topic-metadata">

**Author:** [@Gokhan\_Kof](https://discourse.julialang.org/u/Gokhan_Kof)\
**Replies:** 4\
**Last updated:** [November 6, 2023, 1:11pm UTC](https://discourse.julialang.org/t/dlopen-appending-file-extensions-for-shared-libraries/105761 "2023-11-06T13:11:09Z")

</div>

In the documentation, it says, in the string, you might omit the file extension (.so, .dylib) , dlopen appends it and loads the library but I cannot get it to work. lib = Libdl.dlopen(joinpath(@\_\_DIR\_\_, "mylib")) mylib …

---

## [MonteCarloMeasurements.jl - Object with Particles Passed to Function with Comparison Operator](https://discourse.julialang.org/t/montecarlomeasurements-jl-object-with-particles-passed-to-function-with-comparison-operator/105843)

<div class="topic-metadata">

**Author:** [@matthew3245](https://discourse.julialang.org/u/matthew3245)\
**Replies:** 5\
**Last updated:** [November 6, 2023, 12:56pm UTC](https://discourse.julialang.org/t/montecarlomeasurements-jl-object-with-particles-passed-to-function-with-comparison-operator/105843 "2023-11-06T12:56:06Z")

</div>

I’m trying to pass an object that contains particles to a function that uses comparison operators. Consider the following simple example: using MonteCarloMeasurements mutable struct Foo{T} p::T end function add\_on…

---

## [Stopping a task based on a variable](https://discourse.julialang.org/t/stopping-a-task-based-on-a-variable/105773)

<div class="topic-metadata">

**Author:** [@vettert](https://discourse.julialang.org/u/vettert)\
**Replies:** 15\
**Last updated:** [November 6, 2023, 12:17pm UTC](https://discourse.julialang.org/t/stopping-a-task-based-on-a-variable/105773 "2023-11-06T12:17:04Z")

</div>

Hi, I am trying to stop a @spawn’ed task based on the value of a variable. Here is an example: Using Base.Threads function f(running) i = 0 while running\[\] == true i = i + 1 end println("I'm done…

---

## [How can I control the LaTeX settings of Weave output?](https://discourse.julialang.org/t/how-can-i-control-the-latex-settings-of-weave-output/105692)

<div class="topic-metadata">

**Author:** [@homocomputeris](https://discourse.julialang.org/u/homocomputeris)\
**Replies:** 1\
**Last updated:** [November 6, 2023, 8:21am UTC](https://discourse.julialang.org/t/how-can-i-control-the-latex-settings-of-weave-output/105692 "2023-11-06T08:21:12Z")

</div>

How can I configure the LaTeX output of Weave.jl such as packages used, typefaces, etc.? Basically, can I pass LaTeX preamble to Weave?

---

## [Makie: save PNG with a particular num of pixels in x?](https://discourse.julialang.org/t/makie-save-png-with-a-particular-num-of-pixels-in-x/105807)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 7\
**Last updated:** [November 6, 2023, 6:02am UTC](https://discourse.julialang.org/t/makie-save-png-with-a-particular-num-of-pixels-in-x/105807 "2023-11-06T06:02:06Z")

</div>

I’d like to get a “reasonably” high-resolution PNG image. My image is wider than it is tall (which seems to be the default with CairoMakie) and so I’d like to say that “There should be 1200 pixels in the horizontal dire…

---

## [Is println type instable?](https://discourse.julialang.org/t/is-println-type-instable/105818)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 10\
**Last updated:** [November 5, 2023, 8:18pm UTC](https://discourse.julialang.org/t/is-println-type-instable/105818 "2023-11-05T20:18:56Z")

</div>

See, there are Any’s poping out in the middle of the journey. julia\> using JET julia\> @report\_opt println(\["Bla", "Bla"\]) ═════ 4 possible errors found ═════ ┌ println(xs::Vector{String}) @ Base ./coreio.jl:4 │┌ printl…

---

## [Generic Associated Types](https://discourse.julialang.org/t/generic-associated-types/105829)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 3\
**Last updated:** [November 5, 2023, 6:33pm UTC](https://discourse.julialang.org/t/generic-associated-types/105829 "2023-11-05T18:33:05Z")

</div>

Hi, I am looking to define a type as below: gat1(::Type{Float64}) = Int64 gat2(::Type{Float64}) = String struct Foo{T} a::gat1(T) b::gat2(T) end f = Foo{Float64}(10, "Hello") Is there any way to get generic a…

---

## [Standard library versions required for package registration](https://discourse.julialang.org/t/standard-library-versions-required-for-package-registration/105823)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 4\
**Last updated:** [November 5, 2023, 5:42pm UTC](https://discourse.julialang.org/t/standard-library-versions-required-for-package-registration/105823 "2023-11-05T17:42:35Z")

</div>

The registration of a new version of one of my packages failed with the message: However, two of these packages do not report any versions: How is one supposed to come by this information?

---

## [Struggling with Passing Multiple Initial Conditions to ODE](https://discourse.julialang.org/t/struggling-with-passing-multiple-initial-conditions-to-ode/105627)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 2\
**Last updated:** [November 5, 2023, 2:23pm UTC](https://discourse.julialang.org/t/struggling-with-passing-multiple-initial-conditions-to-ode/105627 "2023-11-05T14:23:14Z")

</div>

Hi folks, :wave: Been doing a lot of work with the great SciML ecosystem and building more familiarity with its offerings. I am struggling with an ODE that I am trying to model. Here is the equation: \\frac{dI}{dt} = a…

---

## [RFC: Freeze package versions](https://discourse.julialang.org/t/rfc-freeze-package-versions/105795)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [November 5, 2023, 2:08pm UTC](https://discourse.julialang.org/t/rfc-freeze-package-versions/105795 "2023-11-05T14:08:40Z")

</div>

I wrote the following function freeze(): # freeze the current package versions; overwrites the current Project.toml file using Pkg, TOML """ freeze() Freezes the current package versions by adding them to the Proje…

---

## [Type-safe conversion of strings to numbers](https://discourse.julialang.org/t/type-safe-conversion-of-strings-to-numbers/105812)

<div class="topic-metadata">

**Author:** [@janonime](https://discourse.julialang.org/u/janonime)\
**Replies:** 7\
**Last updated:** [November 5, 2023, 10:00am UTC](https://discourse.julialang.org/t/type-safe-conversion-of-strings-to-numbers/105812 "2023-11-05T10:00:08Z")

</div>

It is easy to convert a string to a Float64: julia\> parse(Float64,"1.23456789") 1.23456789 It is (obviously) not possible to convert a string to an AbstractFloat: julia\> parse(AbstractFloat,"1.23456789") ERROR: Method…

---

## [\[Documenter\] docstrings not included in the manual](https://discourse.julialang.org/t/documenter-docstrings-not-included-in-the-manual/70299)

<div class="topic-metadata">

**Author:** [@sami1](https://discourse.julialang.org/u/sami1)\
**Replies:** 1\
**Last updated:** [November 5, 2023, 8:55am UTC](https://discourse.julialang.org/t/documenter-docstrings-not-included-in-the-manual/70299 "2023-11-05T08:55:10Z")

</div>

Hi, I’m developing a bridge sampling package and I’m struggling with automatizing the documentation. When I run make.jl, the docstrings are actually detected but I get this warning : 1 docstring not included in the manu…

---

## [Did Julia community do something to improve its correctness?](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515)

<div class="topic-metadata">

**Author:** [@LarkyJulia](https://discourse.julialang.org/u/LarkyJulia)\
**Replies:** 216\
**Last updated:** [November 4, 2023, 4:18pm UTC](https://discourse.julialang.org/t/did-julia-community-do-something-to-improve-its-correctness/102515 "2023-11-04T16:18:27Z")

</div>

I hope I can use it for control system simulation and deep learning. I want to introduce Julia to my students, but I heard many things about its correctness. I learned Julia but never use it to do any real job. I hope th…

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

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