# General Usage

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

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

**Page:** 544

---

## [Can I use \`@eval\` to dynamically define methods for dispatch on \`Val\`s?](https://discourse.julialang.org/t/can-i-use-eval-to-dynamically-define-methods-for-dispatch-on-val-s/68468)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 3\
**Last updated:** [September 22, 2021, 7:21am UTC](https://discourse.julialang.org/t/can-i-use-eval-to-dynamically-define-methods-for-dispatch-on-val-s/68468 "2021-09-22T07:21:57Z")

</div>

Hi all, I’m trying to dynamically define methods for a function to dispatch on specific names (symbols/strings) which seems to work outside a loop, but not inside a loop. Can someone explain how I may be mis-applying t…

---

## [How to make this function compatible with ForwardDiff?](https://discourse.julialang.org/t/how-to-make-this-function-compatible-with-forwarddiff/67415)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 15\
**Last updated:** [September 22, 2021, 5:00am UTC](https://discourse.julialang.org/t/how-to-make-this-function-compatible-with-forwarddiff/67415 "2021-09-22T05:00:04Z")

</div>

How can I make this function compatible with ForwardDiff with respect to τ? using ForwardDiff randmat = rand(10, 2) sto = similar(randmat) function claytonsample!(sto, τ; randmat=randmat) sto .= randmat τ == 0…

---

## [BetaPrime Distribution](https://discourse.julialang.org/t/betaprime-distribution/68542)

<div class="topic-metadata">

**Author:** [@Naba7](https://discourse.julialang.org/u/Naba7)\
**Replies:** 2\
**Last updated:** [September 22, 2021, 4:37am UTC](https://discourse.julialang.org/t/betaprime-distribution/68542 "2021-09-22T04:37:35Z")

</div>

b1 = BetaPrime() rand(rng, b1) === quantile(b1, rand(rng)) this returns false, while this says otherwise.

---

## [How to divide block threads in warps?](https://discourse.julialang.org/t/how-to-divide-block-threads-in-warps/68562)

<div class="topic-metadata">

**Author:** [@fza\_ch](https://discourse.julialang.org/u/fza_ch)\
**Replies:** 0\
**Last updated:** [September 22, 2021, 2:52am UTC](https://discourse.julialang.org/t/how-to-divide-block-threads-in-warps/68562 "2021-09-22T02:52:12Z")

</div>

I have watched you tutorial video GPU programming in Julia | Workshop | JuliaCon 2021 - YouTube. I have clear the concept, how to assign blocks and thread. But I want to get video about Streaming process(SP).how can war…

---

## [Plot with sticks or arrows](https://discourse.julialang.org/t/plot-with-sticks-or-arrows/68422)

<div class="topic-metadata">

**Author:** [@ccmejia](https://discourse.julialang.org/u/ccmejia)\
**Replies:** 14\
**Last updated:** [September 22, 2021, 12:33am UTC](https://discourse.julialang.org/t/plot-with-sticks-or-arrows/68422 "2021-09-22T00:33:15Z")

</div>

Hi there, I’m trying to plot scatter data with impulses, specifically with arrows. But, it seems that it does not exist in seriestype options. Any idea about how I can obtain that? Thanks in advance!

---

## [Questions about Polyester.jl](https://discourse.julialang.org/t/questions-about-polyester-jl/68369)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 7\
**Last updated:** [September 21, 2021, 11:56pm UTC](https://discourse.julialang.org/t/questions-about-polyester-jl/68369 "2021-09-21T23:56:12Z")

</div>

It this package work only with simple operations? Can I use SpinLock() inside cycle? Can I use variables declared outside cycle? (now I get UndefVarError: varname#661 not defined) Actually, I try to get a sum of multi…

---

## [Automatic differentiation - ForwardDiff: components of gradient](https://discourse.julialang.org/t/automatic-differentiation-forwarddiff-components-of-gradient/68528)

<div class="topic-metadata">

**Author:** [@bdc](https://discourse.julialang.org/u/bdc)\
**Replies:** 1\
**Last updated:** [September 21, 2021, 8:49pm UTC](https://discourse.julialang.org/t/automatic-differentiation-forwarddiff-components-of-gradient/68528 "2021-09-21T20:49:00Z")

</div>

Hello, I’m once again running into some limitation of my Julia skills Background I’m using forward mode automated differentiation on a function F that maps a matrix A\\in\\mathbb{R}^{N \\times N} to \\mathbb{R} F(A):\\mathbb…

---

## [Observables, Verilog style](https://discourse.julialang.org/t/observables-verilog-style/68537)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 2\
**Last updated:** [September 21, 2021, 8:34pm UTC](https://discourse.julialang.org/t/observables-verilog-style/68537 "2021-09-21T20:34:07Z")

</div>

I was looking for an observable implementation similar to Verilog AMS or SystemVerilog. There you would have constructs like always @(sig1 && posedge(sig2)) // when sig1 (analog) changes AND sig2 (digital) does trans 0…

---

## [Can't figure out why this code isn't working](https://discourse.julialang.org/t/cant-figure-out-why-this-code-isnt-working/68546)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [September 21, 2021, 7:48pm UTC](https://discourse.julialang.org/t/cant-figure-out-why-this-code-isnt-working/68546 "2021-09-21T19:48:31Z")

</div>

using CSV using StringDistances using Unicode data = CSV.File(raw"C:\\Users\\mthel\\Julia\\src\_data\\data.csv", normalizenames=true) data = clean\_strings(data\[i\]\[2\] for i in 1:200) function build\_dict(data) dict = Dict…

---

## [Speed up a loop with matrix operations](https://discourse.julialang.org/t/speed-up-a-loop-with-matrix-operations/68533)

<div class="topic-metadata">

**Author:** [@HJWang](https://discourse.julialang.org/u/HJWang)\
**Replies:** 4\
**Last updated:** [September 21, 2021, 4:37pm UTC](https://discourse.julialang.org/t/speed-up-a-loop-with-matrix-operations/68533 "2021-09-21T16:37:16Z")

</div>

Hello: I am working on a maximum simulated likelihood estimation on a multi-layer (group/firm/time) model. There are three random variables and I have to do simulation draws for two of them. The estimation is very slow …

---

## [Difference between rem2pi and mod2pi?](https://discourse.julialang.org/t/difference-between-rem2pi-and-mod2pi/68527)

<div class="topic-metadata">

**Author:** [@pierre-haessig](https://discourse.julialang.org/u/pierre-haessig)\
**Replies:** 8\
**Last updated:** [September 21, 2021, 3:52pm UTC](https://discourse.julialang.org/t/difference-between-rem2pi-and-mod2pi/68527 "2021-09-21T15:52:38Z")

</div>

I’m trying to understand the difference between rem2pi(x, RoundNearest) and mod2pi (or more precisely mod2pi - π) from Base, Math functions. Is that correct that roughly speaking both function return the same thing, tha…

---

## [Unexpected end of JSON input with PlotlyJS](https://discourse.julialang.org/t/unexpected-end-of-json-input-with-plotlyjs/67823)

<div class="topic-metadata">

**Author:** [@Jorge\_Silva](https://discourse.julialang.org/u/Jorge_Silva)\
**Replies:** 1\
**Last updated:** [September 21, 2021, 3:09pm UTC](https://discourse.julialang.org/t/unexpected-end-of-json-input-with-plotlyjs/67823 "2021-09-21T15:09:29Z")

</div>

The following code work well with PlotlyBase.jl. using DataFrames, PlotlyBase, PlotlyJS using Dash, DashHtmlComponents, DashCoreComponents using JSON MMM = DataFrame(GRADE = \["M", "M", "F"\], LOTE = \["L1","L2","L3"\], f…

---

## [Pkg can not create Manifest.toml as "nt authority\\system" user account on Windows](https://discourse.julialang.org/t/pkg-can-not-create-manifest-toml-as-nt-authority-system-user-account-on-windows/68452)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 1\
**Last updated:** [September 21, 2021, 2:33pm UTC](https://discourse.julialang.org/t/pkg-can-not-create-manifest-toml-as-nt-authority-system-user-account-on-windows/68452 "2021-09-21T14:33:58Z")

</div>

Hi All :slight\_smile: I run into a very wired error. It only happens while using Julia as system-user on Windows. Let me explain what I’m doing: 1.) Created an project with the following structure: /my\_project /my\_p…

---

## [Parsing a bespoke file format](https://discourse.julialang.org/t/parsing-a-bespoke-file-format/68463)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 5\
**Last updated:** [September 21, 2021, 1:36pm UTC](https://discourse.julialang.org/t/parsing-a-bespoke-file-format/68463 "2021-09-21T13:36:19Z")

</div>

I have a text file that has the following structure begin"head" \<head1 content\> end"head" begin"body" \<body1 content\> end"body" begin"foot" \<foot1 content\> end"foot" begin"head" \<head2 content\> end"head"…

---

## [Measurements.jl: how to zero values without eliminating the uncertainty / strange behavior with deepcopy](https://discourse.julialang.org/t/measurements-jl-how-to-zero-values-without-eliminating-the-uncertainty-strange-behavior-with-deepcopy/68221)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 22\
**Last updated:** [September 21, 2021, 1:34pm UTC](https://discourse.julialang.org/t/measurements-jl-how-to-zero-values-without-eliminating-the-uncertainty-strange-behavior-with-deepcopy/68221 "2021-09-21T13:34:10Z")

</div>

I have the following scenario: I want to propagate the uncertainty of the positions of particles in a simulation. At each time step, I compute the forces, a computation that starts with setting the forces to zero. The co…

---

## [CellListMap.jl: Is it suitable for detecting collision of particles?](https://discourse.julialang.org/t/celllistmap-jl-is-it-suitable-for-detecting-collision-of-particles/68428)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 5\
**Last updated:** [September 21, 2021, 11:43am UTC](https://discourse.julialang.org/t/celllistmap-jl-is-it-suitable-for-detecting-collision-of-particles/68428 "2021-09-21T11:43:29Z")

</div>

@lmiq I am trying to implement a naive algorithm to generate a Self-Avoiding Walk. At present I use following O(N^2) algorithm to check whether two beads are colloiding. using Random using CellListMap function random\_v…

---

## [How to measure execution time of entire jupyter notebook comprising of different cells in JULIA?](https://discourse.julialang.org/t/how-to-measure-execution-time-of-entire-jupyter-notebook-comprising-of-different-cells-in-julia/68517)

<div class="topic-metadata">

**Author:** [@H\_Shrestha](https://discourse.julialang.org/u/H_Shrestha)\
**Replies:** 4\
**Last updated:** [September 21, 2021, 10:26am UTC](https://discourse.julialang.org/t/how-to-measure-execution-time-of-entire-jupyter-notebook-comprising-of-different-cells-in-julia/68517 "2021-09-21T10:26:54Z")

</div>

have a script written in JULIA language in Jupyter notebook. The script is divided into different cells. I’d like to calculate the execution time of not only a single line or cell, but the entire script comprising all th…

---

## [Plot a graph with specific sub labels](https://discourse.julialang.org/t/plot-a-graph-with-specific-sub-labels/68491)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 8\
**Last updated:** [September 21, 2021, 8:02am UTC](https://discourse.julialang.org/t/plot-a-graph-with-specific-sub-labels/68491 "2021-09-21T08:02:09Z")

</div>

I need plot something with a particular axis labels. More specifically, sub-labels. First, I’m gointo to plot the standar plot: tg = 0:0.001:0.7 points = rand(size(tg)\[1\]) sublabels = fill("Julia", size(tg)\[1\] ) tab …

---

## [Inheriting package dependencies in test environment](https://discourse.julialang.org/t/inheriting-package-dependencies-in-test-environment/68505)

<div class="topic-metadata">

**Author:** [@madhavkrishnan](https://discourse.julialang.org/u/madhavkrishnan)\
**Replies:** 3\
**Last updated:** [September 21, 2021, 7:12am UTC](https://discourse.julialang.org/t/inheriting-package-dependencies-in-test-environment/68505 "2021-09-21T07:12:46Z")

</div>

I am trying to write a test module for a package I am developing. However it looks like I don’t understand exactly how to set it up. My understanding was that the test environment would automatically inherit the packages…

---

## [Cannot use package from system image without first adding it to the environment?](https://discourse.julialang.org/t/cannot-use-package-from-system-image-without-first-adding-it-to-the-environment/68507)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 1\
**Last updated:** [September 21, 2021, 6:54am UTC](https://discourse.julialang.org/t/cannot-use-package-from-system-image-without-first-adding-it-to-the-environment/68507 "2021-09-21T06:54:16Z")

</div>

So, I have created a system image using PackageCompiler.jl with Plots. When I start julia with this system image, it cannot find the Plots package unless I also add Plots to my project environment. I thought the package …

---

## [How can I prevent the memory distributed in Julia?](https://discourse.julialang.org/t/how-can-i-prevent-the-memory-distributed-in-julia/68426)

<div class="topic-metadata">

**Author:** [@Lyupinpin](https://discourse.julialang.org/u/Lyupinpin)\
**Replies:** 8\
**Last updated:** [September 20, 2021, 8:18pm UTC](https://discourse.julialang.org/t/how-can-i-prevent-the-memory-distributed-in-julia/68426 "2021-09-20T20:18:11Z")

</div>

I want to use julia to write a code parallel reading data from txt file and saved into a big matrix. However, I found the matrix seems to be distributed to each CPU and I need each CPU to be tremedous big. How can I pre…

---

## [Is there anything similar to "..." in Matlab to write a Matrix over several lines?](https://discourse.julialang.org/t/is-there-anything-similar-to-in-matlab-to-write-a-matrix-over-several-lines/68490)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 3\
**Last updated:** [September 20, 2021, 5:50pm UTC](https://discourse.julialang.org/t/is-there-anything-similar-to-in-matlab-to-write-a-matrix-over-several-lines/68490 "2021-09-20T17:50:29Z")

</div>

I there a way in julia to write similar to the below in Matlab? L = \[1 2 3;... 4 5 6;... 7 8 9\];

---

## [LoadError: UndefVarError: model not defined](https://discourse.julialang.org/t/loaderror-undefvarerror-model-not-defined/68465)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 1\
**Last updated:** [September 20, 2021, 5:03pm UTC](https://discourse.julialang.org/t/loaderror-undefvarerror-model-not-defined/68465 "2021-09-20T17:03:05Z")

</div>

When trying to run the example schoolyard.jl from Agents.jl I have this problem in the last line: fig, \_, \_ = abm\_data\_exploration(model, agent\_step!, dummystep, sliders; static\_preplot!)

---

## [Latex Output from MixedModels.jl](https://discourse.julialang.org/t/latex-output-from-mixedmodels-jl/54797)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 7\
**Last updated:** [September 20, 2021, 3:17pm UTC](https://discourse.julialang.org/t/latex-output-from-mixedmodels-jl/54797 "2021-09-20T15:17:22Z")

</div>

I was wondering if there is a LaTeX table package that supports MixedModels.jl similar to RegressionTables.jl for FixedEffectModels? I have hacked something together usint PrettyTables.jl in case there is not: function…

---

## [How to interact with a Julia process inside a Julia process](https://discourse.julialang.org/t/how-to-interact-with-a-julia-process-inside-a-julia-process/68460)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 2\
**Last updated:** [September 20, 2021, 2:42pm UTC](https://discourse.julialang.org/t/how-to-interact-with-a-julia-process-inside-a-julia-process/68460 "2021-09-20T14:42:48Z")

</div>

I want to measure compilation and TTFP latencies. So my idea was to run different scripts in fresh Julia processes which I start from a main Julia process so that each time Julia has to reliably compile everything anew. …

---

## [Constructor with multiple parametric arguments](https://discourse.julialang.org/t/constructor-with-multiple-parametric-arguments/68449)

<div class="topic-metadata">

**Author:** [@luchino\_96](https://discourse.julialang.org/u/luchino_96)\
**Replies:** 6\
**Last updated:** [September 20, 2021, 2:27pm UTC](https://discourse.julialang.org/t/constructor-with-multiple-parametric-arguments/68449 "2021-09-20T14:27:49Z")

</div>

Hi, I encounter a bizzare behaviour for an inner constructor of a struct, and I am trying to understand what is happening. The first attempt was the following struct Log\_Float{T \<: Integer, S \<: Number} sign::T #…

---

## [How does Julia stack up to Python, its and e.g. C++ standard library?](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 4\
**Last updated:** [September 20, 2021, 1:23pm UTC](https://discourse.julialang.org/t/how-does-julia-stack-up-to-python-its-and-e-g-c-standard-library/68455 "2021-09-20T13:23:14Z")

</div>

\[EDIT: I answered my own question in a comment below, the Python standard library doesn’t seem to have anything important for general programming missing in the Julia ecosystem. If you can think on an exception, please c…

---

## [Adding a NamedTuple to DataFrame row](https://discourse.julialang.org/t/adding-a-namedtuple-to-dataframe-row/68447)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 11\
**Last updated:** [September 20, 2021, 1:59pm UTC](https://discourse.julialang.org/t/adding-a-namedtuple-to-dataframe-row/68447 "2021-09-20T13:59:02Z")

</div>

I have a simulation model that iteratively produces NamedTuples which I want to aggregate (summing) to a DataFrame. Only a portion of the columns are updated, as I keep statistics for different simulation periods (years)…

---

## [Promote with "minimum" type](https://discourse.julialang.org/t/promote-with-minimum-type/68464)

<div class="topic-metadata">

**Author:** [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Replies:** 1\
**Last updated:** [September 20, 2021, 1:50pm UTC](https://discourse.julialang.org/t/promote-with-minimum-type/68464 "2021-09-20T13:50:10Z")

</div>

Is there a particular way to promote a group of variables while specifying a “minimum” type? For example, I find myself using x, y, \_ = promote(x, y, 1.0) to ensure that x and y have the same type and that the type is …

---

## [Speed up multidimensional code without Base.Cartesian](https://discourse.julialang.org/t/speed-up-multidimensional-code-without-base-cartesian/68328)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 19\
**Last updated:** [September 20, 2021, 9:54am UTC](https://discourse.julialang.org/t/speed-up-multidimensional-code-without-base-cartesian/68328 "2021-09-20T09:54:20Z")

</div>

Hello, I wonder if someone could help me speeding up my arbitrary dimension code to run as fast as the explicit version but without using Base.Cartesian Consider the following examples using Random using BenchmarkTool…

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

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