# General Usage

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

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

**Page:** 448

---

## ["Warning: Package \_\_\_\_ does not have \_\_\_\_\_ in its dependencies" when Genie loaded but not in REPL](https://discourse.julialang.org/t/warning-package-does-not-have-in-its-dependencies-when-genie-loaded-but-not-in-repl/81404)

<div class="topic-metadata">

**Author:** [@andromodon](https://discourse.julialang.org/u/andromodon)\
**Replies:** 0\
**Last updated:** [May 21, 2022, 3:00am UTC](https://discourse.julialang.org/t/warning-package-does-not-have-in-its-dependencies-when-genie-loaded-but-not-in-repl/81404 "2022-05-21T03:00:53Z")

</div>

I’m fairly new to Genie, but I created an app called “Jane” with a resource called TTIntervals: Here is the code I’m running as part of a route: push!(LOAD\_PATH, "src/resources/ttintervals") println("") @show LOAD\_PATH…

---

## [Speed up a derivative calculation?](https://discourse.julialang.org/t/speed-up-a-derivative-calculation/80921)

<div class="topic-metadata">

**Author:** [@vshesh](https://discourse.julialang.org/u/vshesh)\
**Replies:** 10\
**Last updated:** [May 21, 2022, 2:04am UTC](https://discourse.julialang.org/t/speed-up-a-derivative-calculation/80921 "2022-05-21T02:04:41Z")

</div>

Hi, I am trying to write a function to compute the derivative of a cost function. The cost function is used to express how good a distance function is at separating labeled data into its respective classes. I’m trying …

---

## [Read Joystick from Julia](https://discourse.julialang.org/t/read-joystick-from-julia/81325)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 22\
**Last updated:** [May 20, 2022, 11:42pm UTC](https://discourse.julialang.org/t/read-joystick-from-julia/81325 "2022-05-20T23:42:37Z")

</div>

Hello, I would like to read a joystick on Linux to control my kite simulator (see: GitHub - aenarete/KiteViewers.jl: 3D viewer for airborne wind energy systems ). The following test on the command line works: jstest --…

---

## [Generate all possible codewords given a dictionary](https://discourse.julialang.org/t/generate-all-possible-codewords-given-a-dictionary/81388)

<div class="topic-metadata">

**Author:** [@Alehud](https://discourse.julialang.org/u/Alehud)\
**Replies:** 2\
**Last updated:** [May 20, 2022, 9:29pm UTC](https://discourse.julialang.org/t/generate-all-possible-codewords-given-a-dictionary/81388 "2022-05-20T21:29:27Z")

</div>

I have a 1D array that is my “dictionary”. E.g., d = \['a', 'b', 'c'\] I want to generate all possible codewords of length n composed of elements from d. For example, if n = 2, then the output I expect is \['a', 'a'\] \['a…

---

## [What is the best type for a Matrix to be used in Multiplication to give good performance?](https://discourse.julialang.org/t/what-is-the-best-type-for-a-matrix-to-be-used-in-multiplication-to-give-good-performance/81115)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 34\
**Last updated:** [May 20, 2022, 2:01pm UTC](https://discourse.julialang.org/t/what-is-the-best-type-for-a-matrix-to-be-used-in-multiplication-to-give-good-performance/81115 "2022-05-20T14:01:00Z")

</div>

I have a matrix (size 35x35) that I build at the beginning of my code, in which does not change later in the code. This matrix is used to be multiped with other matrices in a for loop. Since I care about the performance,…

---

## [Can I modify the fields of a designed structure?](https://discourse.julialang.org/t/can-i-modify-the-fields-of-a-designed-structure/80980)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 11\
**Last updated:** [May 20, 2022, 1:53pm UTC](https://discourse.julialang.org/t/can-i-modify-the-fields-of-a-designed-structure/80980 "2022-05-20T13:53:23Z")

</div>

I was working on a structure with theirs fields are vectors and matrices and I have a vector of it. I need to change elements of this vector to be of a structure which its fields are static vectors and matrices. How can …

---

## [How to draw histogram of a sine?](https://discourse.julialang.org/t/how-to-draw-histogram-of-a-sine/81361)

<div class="topic-metadata">

**Author:** [@youxiuqingnianyyy](https://discourse.julialang.org/u/youxiuqingnianyyy)\
**Replies:** 2\
**Last updated:** [May 20, 2022, 1:32pm UTC](https://discourse.julialang.org/t/how-to-draw-histogram-of-a-sine/81361 "2022-05-20T13:32:10Z")

</div>

I want to draw the figure like this in Julia Plots. Is there any package I could use? Need suggestion.

---

## [Multi-threading to the “combine” function](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783)

<div class="topic-metadata">

**Author:** [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Replies:** 5\
**Last updated:** [May 20, 2022, 10:15am UTC](https://discourse.julialang.org/t/multi-threading-to-the-combine-function/67783 "2022-05-20T10:15:43Z")

</div>

Hello folks, Could anybody guide me, please? Can multi-threading be designated to the “combine” function in the example below? Thank you in advance Boris julia\> begin using DataFrames, Chain d…

---

## [Need help with incomprehensible typeinference](https://discourse.julialang.org/t/need-help-with-incomprehensible-typeinference/81056)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 9\
**Last updated:** [May 20, 2022, 9:44am UTC](https://discourse.julialang.org/t/need-help-with-incomprehensible-typeinference/81056 "2022-05-20T09:44:01Z")

</div>

Hi there, I am the author of ExtensibleEffects.jl. This is an advanced functional package, hence please bear with me if the following example looks totally alien and not understandable why you ever would like to do some…

---

## [Using Julia on a cluster](https://discourse.julialang.org/t/using-julia-on-a-cluster/80755)

<div class="topic-metadata">

**Author:** [@Marius\_123](https://discourse.julialang.org/u/Marius_123)\
**Replies:** 2\
**Last updated:** [May 20, 2022, 9:37am UTC](https://discourse.julialang.org/t/using-julia-on-a-cluster/80755 "2022-05-20T09:37:46Z")

</div>

Hello, i am new to parallel computing and wanted to parallelize a for loop. This for loop is embarassingly parallel. In each iteration of the for loop it calls sciml\_train with a initial guess and computes a parameter e…

---

## [Stipple busy](https://discourse.julialang.org/t/stipple-busy/81276)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 4\
**Last updated:** [May 20, 2022, 7:59am UTC](https://discourse.julialang.org/t/stipple-busy/81276 "2022-05-20T07:59:11Z")

</div>

Is there way to add an icon or something to show that computations are done in the background … something like an hourglass or “working …” label.

---

## [How to run julia script as a command in the terminal?](https://discourse.julialang.org/t/how-to-run-julia-script-as-a-command-in-the-terminal/81341)

<div class="topic-metadata">

**Author:** [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Replies:** 5\
**Last updated:** [May 20, 2022, 5:26am UTC](https://discourse.julialang.org/t/how-to-run-julia-script-as-a-command-in-the-terminal/81341 "2022-05-20T05:26:33Z")

</div>

I want to create some CLI applications in julia, but instead of the users writing (in the terminal): julia --project /path-to/src/MyScript.jl arg1 --opt-1 I want to be able to type: myscript arg1 --opt-1

---

## [To normalize or not to normalize a Neural or Universal ODE](https://discourse.julialang.org/t/to-normalize-or-not-to-normalize-a-neural-or-universal-ode/81124)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 2\
**Last updated:** [May 20, 2022, 4:58am UTC](https://discourse.julialang.org/t/to-normalize-or-not-to-normalize-a-neural-or-universal-ode/81124 "2022-05-20T04:58:19Z")

</div>

Hey folks. I have been working on creating a Neural ODE and a Universal ODE for a 6 compartment model. One common neural network practice is to normalize the inputs to be between 0 and 1. For example in a convolutional n…

---

## [Project.toml](https://discourse.julialang.org/t/project-toml/81342)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 6\
**Last updated:** [May 19, 2022, 11:11pm UTC](https://discourse.julialang.org/t/project-toml/81342 "2022-05-19T23:11:21Z")

</div>

I recently forked a package https://github.com/marouanehanhasse/Lora.jl that i want to try but it does have REQUIRE instead of Project.toml, is there any direct method to switch from REQUIRE to Project.toml in Github?

---

## [Python-to-Julia (and more) translator - py2many](https://discourse.julialang.org/t/python-to-julia-and-more-translator-py2many/81327)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [May 19, 2022, 8:02pm UTC](https://discourse.julialang.org/t/python-to-julia-and-more-translator-py2many/81327 "2022-05-19T20:02:32Z")

</div>

I thought it was intriguing: Preliminary support exists for Julia, Kotlin, Nim, Go and Dart. py2many can also emit Python 3 code that includes inferred type annotations, and revisions to the syntax intended to simpli…

---

## [Reinterpet fails on empty array](https://discourse.julialang.org/t/reinterpet-fails-on-empty-array/81245)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 37\
**Last updated:** [May 19, 2022, 6:14pm UTC](https://discourse.julialang.org/t/reinterpet-fails-on-empty-array/81245 "2022-05-19T18:14:51Z")

</div>

Reinterpreting an empty array fails. I don’t know why A fails, while it is clear that B will succeed: julia\> struct A end julia\> reinterpret(A, Int8\[\]) ERROR: DivideError: integer division error Stacktrace: \[1\] rem …

---

## [A safe inbounds use with great performance effect](https://discourse.julialang.org/t/a-safe-inbounds-use-with-great-performance-effect/81319)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [May 19, 2022, 6:05pm UTC](https://discourse.julialang.org/t/a-safe-inbounds-use-with-great-performance-effect/81319 "2022-05-19T18:05:53Z")

</div>

As a followup from this: Matt has shown that enumerate(eachindex(a)) is quite fast: julia\> function f!(A) for (count, idx) in enumerate(eachindex(A)) A\[idx\] = count\*2 end e…

---

## [Question about A' and Transpose(A)](https://discourse.julialang.org/t/question-about-a-and-transpose-a/81317)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 9\
**Last updated:** [May 19, 2022, 5:57pm UTC](https://discourse.julialang.org/t/question-about-a-and-transpose-a/81317 "2022-05-19T17:57:41Z")

</div>

julia\> A = \[1 + 0.2im, 2 + 0.6im\] 2-element Vector{ComplexF64}: 1.0 + 0.2im 2.0 + 0.6im julia\> A' 1×2 adjoint(::Vector{ComplexF64}) with eltype ComplexF64: 1.0-0.2im 2.0-0.6im julia\> Transpose(A) 1×2 transpose(::Ve…

---

## [Escaping properly a bash command](https://discourse.julialang.org/t/escaping-properly-a-bash-command/81316)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 1\
**Last updated:** [May 19, 2022, 5:00pm UTC](https://discourse.julialang.org/t/escaping-properly-a-bash-command/81316 "2022-05-19T17:00:20Z")

</div>

I am trying to execute a command which has its own variable. Specifically, I am trying to submit jobs on a cluster using Njobs = 10 for r in res submit = \`bsub -R 'rusage\[mem=800\]' -J jobname\\\[1-$Njobs\\\] julia\_scri…

---

## [Shared library code crashing, but only from REPL](https://discourse.julialang.org/t/shared-library-code-crashing-but-only-from-repl/81314)

<div class="topic-metadata">

**Author:** [@andrew\_s](https://discourse.julialang.org/u/andrew_s)\
**Replies:** 0\
**Last updated:** [May 19, 2022, 4:03pm UTC](https://discourse.julialang.org/t/shared-library-code-crashing-but-only-from-repl/81314 "2022-05-19T16:03:19Z")

</div>

I am calling a Fortran shared library in my program. If I run my Julia program (which calls the Fortran library) everything runs as expected. However, if I run exactly the same code in the Julia REPL (connected to Visu…

---

## [Defining a subclass](https://discourse.julialang.org/t/defining-a-subclass/80716)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 19\
**Last updated:** [May 19, 2022, 2:07pm UTC](https://discourse.julialang.org/t/defining-a-subclass/80716 "2022-05-19T14:07:18Z")

</div>

I realise this is a newbie question, but I think it’s sort of central to the whole Julia ethos. I really like the idea of moving away from object-orientation’s emphasis on single dispatch, and that lattices of types perf…

---

## [Parallel processing using FLoops](https://discourse.julialang.org/t/parallel-processing-using-floops/80893)

<div class="topic-metadata">

**Author:** [@devanshu](https://discourse.julialang.org/u/devanshu)\
**Replies:** 27\
**Last updated:** [May 19, 2022, 1:27pm UTC](https://discourse.julialang.org/t/parallel-processing-using-floops/80893 "2022-05-19T13:27:18Z")

</div>

Hi, I am trying to enhance the performance of my Julia code by using all the cores on my computer. For this, I am using the FLoops package. My code is simple: I am generating 100 instances of a random density matrix of s…

---

## [Following Tutorial for JuliaInXL Gives World Age Error - How to Fix?](https://discourse.julialang.org/t/following-tutorial-for-juliainxl-gives-world-age-error-how-to-fix/81153)

<div class="topic-metadata">

**Author:** [@ameresv](https://discourse.julialang.org/u/ameresv)\
**Replies:** 3\
**Last updated:** [May 19, 2022, 12:30pm UTC](https://discourse.julialang.org/t/following-tutorial-for-juliainxl-gives-world-age-error-how-to-fix/81153 "2022-05-19T12:30:37Z")

</div>

Hi, I have identified an issue with JuliaInXL by the time to follow the provided tutorial at minute 10:50. I am trying to create a function in the REPL as simple as: mm2(x) = x + 2 # as same as the video suggests How…

---

## [Does Julia have a Stratified Sampling function?](https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293)

<div class="topic-metadata">

**Author:** [@DWSchulze](https://discourse.julialang.org/u/DWSchulze)\
**Replies:** 1\
**Last updated:** [May 19, 2022, 10:41am UTC](https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293 "2022-05-19T10:41:18Z")

</div>

It looks like StratifiedRandomSub was added at some point, but I can’t find it: https://github.com/JuliaStats/MLBase.jl/issues/3

---

## [Exporting and importing a 3D matrix](https://discourse.julialang.org/t/exporting-and-importing-a-3d-matrix/81300)

<div class="topic-metadata">

**Author:** [@CactusHamster](https://discourse.julialang.org/u/CactusHamster)\
**Replies:** 4\
**Last updated:** [May 19, 2022, 9:53am UTC](https://discourse.julialang.org/t/exporting-and-importing-a-3d-matrix/81300 "2022-05-19T09:53:42Z")

</div>

We generate a matrix like this for i = 1:5 for j = 1:5 for k = 1:5 d\[i, j, k\] = rand(1) end end end Is there an easy way to save matrix d somewhere and later on just call it and use it? With …

---

## [How To Broadcast "in" to Compare Two Arrays?](https://discourse.julialang.org/t/how-to-broadcast-in-to-compare-two-arrays/81280)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 6\
**Last updated:** [May 19, 2022, 2:42am UTC](https://discourse.julialang.org/t/how-to-broadcast-in-to-compare-two-arrays/81280 "2022-05-19T02:42:19Z")

</div>

Hi all, I was doing some googling today and stumbled across this interesting syntax for an “in” broadcast where I want to check to see if any element from the first array is present in the second array: in(\[1, 2\]).(\[1,…

---

## [How does push!() work within accumulate()?](https://discourse.julialang.org/t/how-does-push-work-within-accumulate/81286)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 1\
**Last updated:** [May 18, 2022, 11:32pm UTC](https://discourse.julialang.org/t/how-does-push-work-within-accumulate/81286 "2022-05-18T23:32:58Z")

</div>

why are the two formulations of accumulate() different? accumulate((s,c)-\>push!(s,c),1:3,init=\[\]) != accumulate((s,c)-\>\[s;c\],1:3,init=\[\]) #true push!(\[1,2\],3)==\[\[1,2\];3\] # true

---

## [Fetch from remote machine produces "TypeError: non-boolean (Nothing) used in boolean context" for differing Julia versions](https://discourse.julialang.org/t/fetch-from-remote-machine-produces-typeerror-non-boolean-nothing-used-in-boolean-context-for-differing-julia-versions/81271)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 1\
**Last updated:** [May 18, 2022, 10:57pm UTC](https://discourse.julialang.org/t/fetch-from-remote-machine-produces-typeerror-non-boolean-nothing-used-in-boolean-context-for-differing-julia-versions/81271 "2022-05-18T22:57:57Z")

</div>

I know it used to work before, but currently I can’t get distributed computing on remote machines working again. If I simply run using Distributed addprocs(\["\<remotename\>"\], exename="\<pathToRemoteJuliaExe\>", dir="\<path…

---

## [Efficient "parent" reference for structs](https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 7\
**Last updated:** [May 18, 2022, 9:03pm UTC](https://discourse.julialang.org/t/efficient-parent-reference-for-structs/81194 "2022-05-18T21:03:18Z")

</div>

I have got the following two structs abstract type \_MyType end mutable struct Type1 \<: \_MyType a::Int end mutable struct Type2 \<: \_MyType a::Int end Furthermore there is some sort of “parent” / “global” cont…

---

## [Badge for generic-safe/OffsetArray-safe packages](https://discourse.julialang.org/t/badge-for-generic-safe-offsetarray-safe-packages/81270)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [May 18, 2022, 4:33pm UTC](https://discourse.julialang.org/t/badge-for-generic-safe-offsetarray-safe-packages/81270 "2022-05-18T16:33:39Z")

</div>

Most packages are safe (with or without @inbounds) when used with regular arrays. I do not want to get people to alarmed, but most packages are likely unsafe when the user uses OffsetArray.jl and passes such an array in…

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

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