# General Usage

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

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

**Page:** 165

---

## [Can I guarentee two tasks run on different threads?](https://discourse.julialang.org/t/can-i-guarentee-two-tasks-run-on-different-threads/114858)

<div class="topic-metadata">

**Author:** [@Larbino1](https://discourse.julialang.org/u/Larbino1)\
**Replies:** 1\
**Last updated:** [May 28, 2024, 5:25pm UTC](https://discourse.julialang.org/t/can-i-guarentee-two-tasks-run-on-different-threads/114858 "2024-05-28T17:25:21Z")

</div>

I have what I though would be a simple problem but have been disappointed in julia’s ability regarding it. I have a program that send a bunch of packets over UDP. I want to receive them in julia as follows: Have a “list…

---

## [Several questions on distributed computing from a beginner](https://discourse.julialang.org/t/several-questions-on-distributed-computing-from-a-beginner/114620)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 21\
**Last updated:** [May 28, 2024, 3:00pm UTC](https://discourse.julialang.org/t/several-questions-on-distributed-computing-from-a-beginner/114620 "2024-05-28T15:00:53Z")

</div>

Hi, everyone! I’d like to ask several questions that have confused me very much during my learning distributed computing as a complete beginner. So I came here looking for some confirmation, and also hope it can help oth…

---

## [Android studio, tflite and random forest](https://discourse.julialang.org/t/android-studio-tflite-and-random-forest/114839)

<div class="topic-metadata">

**Author:** [@Rahmat](https://discourse.julialang.org/u/Rahmat)\
**Replies:** 1\
**Last updated:** [May 28, 2024, 2:59pm UTC](https://discourse.julialang.org/t/android-studio-tflite-and-random-forest/114839 "2024-05-28T14:59:15Z")

</div>

how to connect tflite to android studio using machine learning random forest and using csv or excell data

---

## [Package extension for data-specific (unregister) package to use - how to add the extension?](https://discourse.julialang.org/t/package-extension-for-data-specific-unregister-package-to-use-how-to-add-the-extension/114835)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [May 28, 2024, 12:41pm UTC](https://discourse.julialang.org/t/package-extension-for-data-specific-unregister-package-to-use-how-to-add-the-extension/114835 "2024-05-28T12:41:23Z")

</div>

Package extensions are typically used when the user of a package may or may not already have a certain functionality-provided package installed in his own environment. But how can I use them instead as a conditional dep…

---

## [Why \`map\` requires \`collect\` to use for general iterable things?](https://discourse.julialang.org/t/why-map-requires-collect-to-use-for-general-iterable-things/114748)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 18\
**Last updated:** [May 28, 2024, 10:05am UTC](https://discourse.julialang.org/t/why-map-requires-collect-to-use-for-general-iterable-things/114748 "2024-05-28T10:05:54Z")

</div>

Why map requires to collect for general iterable things? julia\> foreach(println, "あいうえお") あ い う え お julia\> map(println, "あいうえお"); あ ERROR: ArgumentError: map(f, s::AbstractString) requires f to return AbstractChar; try…

---

## [Add row and column labels to grid plot](https://discourse.julialang.org/t/add-row-and-column-labels-to-grid-plot/114750)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 10\
**Last updated:** [May 28, 2024, 9:29am UTC](https://discourse.julialang.org/t/add-row-and-column-labels-to-grid-plot/114750 "2024-05-28T09:29:49Z")

</div>

Hi all, I have a grid of contour plots, each with the same x and y dimensions. The grid is formed by varying two other dimensions. I would like to add labels r1, r2, …, rn to the rows and c1, c2, …, cn to the columns. c…

---

## [Improving speed of runtime dispatch detector](https://discourse.julialang.org/t/improving-speed-of-runtime-dispatch-detector/114697)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 63\
**Last updated:** [May 28, 2024, 8:29am UTC](https://discourse.julialang.org/t/improving-speed-of-runtime-dispatch-detector/114697 "2024-05-28T08:29:52Z")

</div>

I’m working on this small package DispatchDoctor – GitHub - MilesCranmer/DispatchDoctor.jl which helps to address some of the issues discussed in this thread. This package provides the @stable macro as a more ergonomic …

---

## [Is there no ldiv! for Choleski factorization of a sparse matrix?](https://discourse.julialang.org/t/is-there-no-ldiv-for-choleski-factorization-of-a-sparse-matrix/114806)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [May 28, 2024, 2:27am UTC](https://discourse.julialang.org/t/is-there-no-ldiv-for-choleski-factorization-of-a-sparse-matrix/114806 "2024-05-28T02:27:00Z")

</div>

MWE: using SparseArrays using LinearAlgebra a = sparse(\[1, 2, 3, 4\], \[1, 2, 3, 4\], \[1.0, 2.0, 3.0, 4.0\], 4, 4) af = cholesky(a) b = rand(4) y = zeros(4) ldiv!(y, af, b) Results in error: ERROR: MethodError: no method …

---

## [Examples of when to use @async over @spawn?](https://discourse.julialang.org/t/examples-of-when-to-use-async-over-spawn/114631)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 8\
**Last updated:** [May 28, 2024, 2:26am UTC](https://discourse.julialang.org/t/examples-of-when-to-use-async-over-spawn/114631 "2024-05-28T02:26:17Z")

</div>

I’m trying to figure out if there’s ever a good reason to use @async over Threads.@spawn anymore. It seems like you want Threads.@spawn the vast majority of the time – it’s more composable, gives more freedom to the sch…

---

## [Question on Loading HDF Data Saved in Python](https://discourse.julialang.org/t/question-on-loading-hdf-data-saved-in-python/114562)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 19\
**Last updated:** [May 28, 2024, 12:35am UTC](https://discourse.julialang.org/t/question-on-loading-hdf-data-saved-in-python/114562 "2024-05-28T00:35:15Z")

</div>

Hello, Does anyone have experience with this? My colleague has some large data saved on our cluster in the .h5 file format. He saved it in python using the h5py package. I’d like to now open and analyze the same data …

---

## [Unclear error message when trying to install package with incompatible julia version](https://discourse.julialang.org/t/unclear-error-message-when-trying-to-install-package-with-incompatible-julia-version/114632)

<div class="topic-metadata">

**Author:** [@iago-lito](https://discourse.julialang.org/u/iago-lito)\
**Replies:** 3\
**Last updated:** [May 27, 2024, 10:00pm UTC](https://discourse.julialang.org/t/unclear-error-message-when-trying-to-install-package-with-incompatible-julia-version/114632 "2024-05-27T22:00:42Z")

</div>

Our package’s Project.toml states the following: \[compat\] julia = "1.10" As a consequence, issuing the following from a previous version of julia fails: $ ../julia-1.6.7/bin/julia --project=. \_ \_ …

---

## [Inverse of cdf](https://discourse.julialang.org/t/inverse-of-cdf/53397)

<div class="topic-metadata">

**Author:** [@nh3436](https://discourse.julialang.org/u/nh3436)\
**Replies:** 5\
**Last updated:** [August 5, 2021, 9:12am UTC](https://discourse.julialang.org/t/inverse-of-cdf/53397 "2021-08-05T09:12:59Z")

</div>

Hi all, I am a beginner to Julia and I am trying to code inverse function of normal cdf. In Distribution.ji, I see there is invlogcdf, inverse function of log cdf of a distribution but not inverse function of cdf. Any s…

---

## [Return Bool When Checking Type Stability](https://discourse.julialang.org/t/return-bool-when-checking-type-stability/114796)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 3\
**Last updated:** [May 27, 2024, 9:26pm UTC](https://discourse.julialang.org/t/return-bool-when-checking-type-stability/114796 "2024-05-27T21:26:25Z")

</div>

In Julia, we all use @code\_warntype to conclude whether a function is type stable or not. However, @code\_warntype returns a long text which tells us in detail the infered types of related variables. I wonder is there a w…

---

## [Integratror interface skips timesteps in DifferentialEquations.jl?](https://discourse.julialang.org/t/integratror-interface-skips-timesteps-in-differentialequations-jl/114789)

<div class="topic-metadata">

**Author:** [@flmuk](https://discourse.julialang.org/u/flmuk)\
**Replies:** 1\
**Last updated:** [May 27, 2024, 4:14pm UTC](https://discourse.julialang.org/t/integratror-interface-skips-timesteps-in-differentialequations-jl/114789 "2024-05-27T16:14:33Z")

</div>

Hello, I have a question about the integrator interface of the DifferentialEquations package. I want to step through the solution process of a set of coupled ODEs (to wich I want to add a nonlinearity that I can’t use a…

---

## [TOML.print NamedTuple](https://discourse.julialang.org/t/toml-print-namedtuple/114780)

<div class="topic-metadata">

**Author:** [@Alessandra\_Bonfanti](https://discourse.julialang.org/u/Alessandra_Bonfanti)\
**Replies:** 2\
**Last updated:** [May 27, 2024, 1:50pm UTC](https://discourse.julialang.org/t/toml-print-namedtuple/114780 "2024-05-27T13:50:12Z")

</div>

Hi all, I am trying to write a function that should create a .toml file. Here is a simplified version: using TOML data = Dict(“settings” =\> (a = 2, b = 3)) fname = “example.toml” open(fname, “w”) do io TOML.print(i…

---

## [Print things differently in an array](https://discourse.julialang.org/t/print-things-differently-in-an-array/114563)

<div class="topic-metadata">

**Author:** [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Replies:** 9\
**Last updated:** [May 27, 2024, 10:39am UTC](https://discourse.julialang.org/t/print-things-differently-in-an-array/114563 "2024-05-27T10:39:40Z")

</div>

If I got my custom type MyType I’d like to keep the default printing when showing it isolated, but when in an array I’d like it to only show one of its fields NWE: struct MyType foo bar end m = MyType(1, 2) Base…

---

## [ERROR: Python: ModuleNotFoundError: No module named 'python-vehicle-simulator'](https://discourse.julialang.org/t/error-python-modulenotfounderror-no-module-named-python-vehicle-simulator/114760)

<div class="topic-metadata">

**Author:** [@liuwa666](https://discourse.julialang.org/u/liuwa666)\
**Replies:** 1\
**Last updated:** [May 27, 2024, 9:17am UTC](https://discourse.julialang.org/t/error-python-modulenotfounderror-no-module-named-python-vehicle-simulator/114760 "2024-05-27T09:17:14Z")

</div>

julia\> versioninfo() Julia Version 1.10.3 Commit 0b4590a550 (2024-04-30 10:59 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Windows (x86\_64-w64-mingw32) CPU: 16 × AMD Ryzen 9 5900HX wi…

---

## [How to test with multiple versions of a dependency in CI](https://discourse.julialang.org/t/how-to-test-with-multiple-versions-of-a-dependency-in-ci/114761)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [May 27, 2024, 8:56am UTC](https://discourse.julialang.org/t/how-to-test-with-multiple-versions-of-a-dependency-in-ci/114761 "2024-05-27T08:56:02Z")

</div>

I’d like to support more than one incompatible version of a dependency from a package extension. How to test with all relevant versions of the dependency in CI?

---

## [Static mixed type mutable vector - programmatic access?](https://discourse.julialang.org/t/static-mixed-type-mutable-vector-programmatic-access/114768)

<div class="topic-metadata">

**Author:** [@aramend](https://discourse.julialang.org/u/aramend)\
**Replies:** 0\
**Last updated:** [May 27, 2024, 8:55am UTC](https://discourse.julialang.org/t/static-mixed-type-mutable-vector-programmatic-access/114768 "2024-05-27T08:55:23Z")

</div>

I created an interesting structure for my use case. I managed to get everything nice and static, but I’m having trouble using it programmatically. Here are my goals and how they guided the design. Iterate tens of thous…

---

## [Stipples using voronoi plot](https://discourse.julialang.org/t/stipples-using-voronoi-plot/114745)

<div class="topic-metadata">

**Author:** [@Manasa\_S](https://discourse.julialang.org/u/Manasa_S)\
**Replies:** 11\
**Last updated:** [May 26, 2024, 6:43pm UTC](https://discourse.julialang.org/t/stipples-using-voronoi-plot/114745 "2024-05-26T18:43:47Z")

</div>

Hi, I’m new to Julia and I’m trying to create a stippling based on voronoi diagrams. I’m using DelaunayTriangulation package. I’m confused on how to iterate for each point in the time series and generate a voronoi and ex…

---

## [Wrap Parameter of ODE in struct with automatic differentiation](https://discourse.julialang.org/t/wrap-parameter-of-ode-in-struct-with-automatic-differentiation/114647)

<div class="topic-metadata">

**Author:** [@jgsimard](https://discourse.julialang.org/u/jgsimard)\
**Replies:** 5\
**Last updated:** [May 25, 2024, 7:50pm UTC](https://discourse.julialang.org/t/wrap-parameter-of-ode-in-struct-with-automatic-differentiation/114647 "2024-05-25T19:50:38Z")

</div>

Hi, I would like to learn the parmeters of an ode, I can do it when the parameters to learn are a vector of floats64, but it doesn’t work if I wrap them in a struct. I am using the SIR model to test it and I get this e…

---

## [Does PythonCall block all \`@async\` routines?](https://discourse.julialang.org/t/does-pythoncall-block-all-async-routines/114722)

<div class="topic-metadata">

**Author:** [@aryavorskiy](https://discourse.julialang.org/u/aryavorskiy)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 5:05pm UTC](https://discourse.julialang.org/t/does-pythoncall-block-all-async-routines/114722 "2024-05-25T17:05:14Z")

</div>

I am trying to write a simple timing function. To avoid waiting for too long, I made it stop waiting and return Inf at some point. I achieved it this way: function time\_function(f, input...; maxtime=1) c = Channel{F…

---

## [Custom location for julia, using juliaup](https://discourse.julialang.org/t/custom-location-for-julia-using-juliaup/114724)

<div class="topic-metadata">

**Author:** [@sfranchel](https://discourse.julialang.org/u/sfranchel)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 4:53pm UTC](https://discourse.julialang.org/t/custom-location-for-julia-using-juliaup/114724 "2024-05-25T16:53:54Z")

</div>

I’m trying to install julia in a remote shared server, but I have limited resources in the $HOME directory. I’m therefore trying to change the location for julia installation to a path with much more disk space. The jul…

---

## [Is there a way to know in advance if a function definition will overwrite a previous one?](https://discourse.julialang.org/t/is-there-a-way-to-know-in-advance-if-a-function-definition-will-overwrite-a-previous-one/114670)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 30\
**Last updated:** [May 25, 2024, 3:00pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-know-in-advance-if-a-function-definition-will-overwrite-a-previous-one/114670 "2024-05-25T15:00:01Z")

</div>

I’d like to know if there is any way to know in advance if this can be done, e.g. say I have f(x::Int) = 3 In pseudo-code I’m trying to do something like m = method overwritten by f(x::Int) = 4 if m !== nothing Ba…

---

## [Package to avoid allocations in some functions when using StaticArrays.jl](https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 18\
**Last updated:** [May 25, 2024, 2:54pm UTC](https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539 "2024-05-25T14:54:53Z")

</div>

Hi! As I mentioned before, I am trying to build a full satellite attitude control subsystem (ACS) using Julia, which maybe one day will hopefully fly in a CubeSat. One very important requirement is to avoid runtime allo…

---

## [Creating documentation when remote name is not \`origin\`](https://discourse.julialang.org/t/creating-documentation-when-remote-name-is-not-origin/110466)

<div class="topic-metadata">

**Author:** [@phx](https://discourse.julialang.org/u/phx)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 8:27am UTC](https://discourse.julialang.org/t/creating-documentation-when-remote-name-is-not-origin/110466 "2024-05-25T08:27:08Z")

</div>

Hello everyone, I’m trying to use Documenter to build the documentation for a package I wrote. Everything builds fine, but every time I run julia --project make.jl the following warning appears: ┌ Warning: Unable to de…

---

## [Zygote.jl with NamedArrays and adjoint](https://discourse.julialang.org/t/zygote-jl-with-namedarrays-and-adjoint/114707)

<div class="topic-metadata">

**Author:** [@PaterPen](https://discourse.julialang.org/u/PaterPen)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 6:52am UTC](https://discourse.julialang.org/t/zygote-jl-with-namedarrays-and-adjoint/114707 "2024-05-25T06:52:54Z")

</div>

Hi, I can’t get Zygote.jl to work with the adjoint of NamedVectors: using Zygote using NamedArrays foo(a, b, c) = a' \* b \* c function bar() a = NamedArray(\[1.0, 2.0\], \["x", "y"\]) b = NamedArray(\[1.0, 2.0\], \["x…

---

## [Can I use \`pmap\` on a recursive program?](https://discourse.julialang.org/t/can-i-use-pmap-on-a-recursive-program/114684)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [May 25, 2024, 6:46am UTC](https://discourse.julialang.org/t/can-i-use-pmap-on-a-recursive-program/114684 "2024-05-25T06:46:16Z")

</div>

Can I use pmap on a recursive program? Take the following recursive function as an example: using Distributed addprocs(3) function mymax(x) n = length(x) if n == 1 x\[1\] else y = pmap(mymax, \[…

---

## [Merge Dictionaries with values of type Vector](https://discourse.julialang.org/t/merge-dictionaries-with-values-of-type-vector/114703)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 3\
**Last updated:** [May 25, 2024, 6:42am UTC](https://discourse.julialang.org/t/merge-dictionaries-with-values-of-type-vector/114703 "2024-05-25T06:42:10Z")

</div>

Hi everyone, I try to merge two dictionaries and one of them contains a vector value. Unfortunately, all the merging methods used return the same error: body = Dict( :scope =\> "deposited" ) # an optional paramete…

---

## [Fastest way of resetting a vector](https://discourse.julialang.org/t/fastest-way-of-resetting-a-vector/114709)

<div class="topic-metadata">

**Author:** [@xiaoming](https://discourse.julialang.org/u/xiaoming)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 5:23am UTC](https://discourse.julialang.org/t/fastest-way-of-resetting-a-vector/114709 "2024-05-25T05:23:47Z")

</div>

For a vector a=collect(1:1000), what is the fastest way to reset it? Currently, I only have one solution: a=collect(1:1000) deleteat!(a, 1:length(a))

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

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