# General Usage

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

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

**Page:** 393

---

## [PlotlyJS: subplots and individual layouts](https://discourse.julialang.org/t/plotlyjs-subplots-and-individual-layouts/87740)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 3\
**Last updated:** [September 25, 2022, 6:51pm UTC](https://discourse.julialang.org/t/plotlyjs-subplots-and-individual-layouts/87740 "2022-09-25T18:51:26Z")

</div>

Hi, I am stuck with an apparently simple problem. I am using PlotlyJS v0.18.8, Julia 1.8.1. I have some time series. If I plot each one separately, I have no problem: all layout attributes are fully displayed. For examp…

---

## [Explain Performance of a Ylm Code](https://discourse.julialang.org/t/explain-performance-of-a-ylm-code/87764)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 6\
**Last updated:** [September 25, 2022, 5:55pm UTC](https://discourse.julialang.org/t/explain-performance-of-a-ylm-code/87764 "2022-09-25T17:55:42Z")

</div>

The code below evaluates the standard complex spherical harmonics for a batch of inputs given in terms of cos, sin and the associated legendre functions (which are already precomputed - in the “real” scenario they would …

---

## [How to sparsify an input graph using laplacian](https://discourse.julialang.org/t/how-to-sparsify-an-input-graph-using-laplacian/87785)

<div class="topic-metadata">

**Author:** [@m\_shah2](https://discourse.julialang.org/u/m_shah2)\
**Replies:** 0\
**Last updated:** [September 25, 2022, 5:51pm UTC](https://discourse.julialang.org/t/how-to-sparsify-an-input-graph-using-laplacian/87785 "2022-09-25T17:51:55Z")

</div>

I want to sparsify my graph using laplacian, can anyone help?

---

## [Major performance boost when precaching random inputs to \`\`\`exp\`\`\`?](https://discourse.julialang.org/t/major-performance-boost-when-precaching-random-inputs-to-exp/85740)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 8\
**Last updated:** [September 25, 2022, 1:28pm UTC](https://discourse.julialang.org/t/major-performance-boost-when-precaching-random-inputs-to-exp/85740 "2022-09-25T13:28:41Z")

</div>

I’m writing a Monte Carlo simulation which requires exponentials of uniformly distributed random numbers. Calling exp takes a sizeable portion of my my inner loop runtime, and so I thought to cache pre-calculated value. …

---

## [Clarification on dependencies and examples in documentation](https://discourse.julialang.org/t/clarification-on-dependencies-and-examples-in-documentation/87732)

<div class="topic-metadata">

**Author:** [@adamhsparks](https://discourse.julialang.org/u/adamhsparks)\
**Replies:** 2\
**Last updated:** [September 25, 2022, 2:04am UTC](https://discourse.julialang.org/t/clarification-on-dependencies-and-examples-in-documentation/87732 "2022-09-25T02:04:34Z")

</div>

I’m trying to understand how examples in the documentation work. I’m very familiar with R and there we can include other libraries that are not specifically needed for package functionality in the “Suggests” field of th…

---

## [Unhandled Task Error](https://discourse.julialang.org/t/unhandled-task-error/87749)

<div class="topic-metadata">

**Author:** [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Replies:** 2\
**Last updated:** [September 24, 2022, 11:13pm UTC](https://discourse.julialang.org/t/unhandled-task-error/87749 "2022-09-24T23:13:34Z")

</div>

Hi, I am trying to use pmap to speed up my code. When I try to run a sample code with a for loop of just 10 cycles, I faced an unhandled task error. What does it mean? Personally I think the 10 cycles have finished …

---

## [What functions are lowered to native instructions?](https://discourse.julialang.org/t/what-functions-are-lowered-to-native-instructions/87741)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 8\
**Last updated:** [September 24, 2022, 5:54pm UTC](https://discourse.julialang.org/t/what-functions-are-lowered-to-native-instructions/87741 "2022-09-24T17:54:18Z")

</div>

Many times, when seeing others’ code or Base, I run into comments like “This function is used instead of X because it has native instructions for many architectures”. Is there any way to know which functions behave like…

---

## [Help with appending row in read in DataFrame (weird behavior)](https://discourse.julialang.org/t/help-with-appending-row-in-read-in-dataframe-weird-behavior/87734)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 6\
**Last updated:** [September 24, 2022, 5:29pm UTC](https://discourse.julialang.org/t/help-with-appending-row-in-read-in-dataframe-weird-behavior/87734 "2022-09-24T17:29:22Z")

</div>

If I directly define a dataframe as GMM\_data = DataFrame(ror = \[\], rev\_C = \[\], rev\_NG = \[\], uu\_1\_C = \[\], uu\_2\_C = \[\], uu\_3\_C = \[\], uu\_4\_C = \[\], uu\_1\_NG = \[\], uu\_2\_NG = \[\], uu\_3\_NG = \[\], uu\_4\_NG = \[\], ramp\_C = \[\]…

---

## [Duplicated keyword arguments and splats](https://discourse.julialang.org/t/duplicated-keyword-arguments-and-splats/87745)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 0\
**Last updated:** [September 24, 2022, 3:12pm UTC](https://discourse.julialang.org/t/duplicated-keyword-arguments-and-splats/87745 "2022-09-24T15:12:41Z")

</div>

Is this expected? Keyword arguments get de-duplicated with splatting, but not when written explicitely. julia\> function foo(; a) 1 end foo (generic function with 1 method) julia\> foo(; (a=1,)...) 1 j…

---

## [Javis get\_position doesn't work](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723)

<div class="topic-metadata">

**Author:** [@Feed\_Back](https://discourse.julialang.org/u/Feed_Back)\
**Replies:** 7\
**Last updated:** [September 24, 2022, 2:42pm UTC](https://discourse.julialang.org/t/javis-get-position-doesnt-work/87723 "2022-09-24T14:42:35Z")

</div>

if i type: triangle = Object( JPoly(ngon(vertices\_square\[1\], 10, 3, -π / 2, vertices = true); action = :fill, color = "black"))) and use this object inside some functions, ill get this error:( using pos(triangle) ) E…

---

## [Reducing allocations in a stencil function](https://discourse.julialang.org/t/reducing-allocations-in-a-stencil-function/87733)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 6\
**Last updated:** [September 24, 2022, 12:20pm UTC](https://discourse.julialang.org/t/reducing-allocations-in-a-stencil-function/87733 "2022-09-24T12:20:38Z")

</div>

I’m writing a function that takes a matrix X and returns a matrix Y of the same dimensions such that Y\[i, j\] is the sum of the values in the eight cells surrounding X\[i, j\]. This function is the “number of neighbors” fun…

---

## [Multithreaded LAPACK function in a Threads.@threads loop](https://discourse.julialang.org/t/multithreaded-lapack-function-in-a-threads-threads-loop/45205)

<div class="topic-metadata">

**Author:** [@migarstka](https://discourse.julialang.org/u/migarstka)\
**Replies:** 2\
**Last updated:** [September 24, 2022, 6:42am UTC](https://discourse.julialang.org/t/multithreaded-lapack-function-in-a-threads-threads-loop/45205 "2022-09-24T06:42:31Z")

</div>

Hi everyone, Problem I am trying to understand how to optimally set the number of BLAS threads when I am using a multithreaded LAPACK function in a Threads.@threads loop. More specifically I want to compute the eigende…

---

## [Valid number](https://discourse.julialang.org/t/valid-number/87727)

<div class="topic-metadata">

**Author:** [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Replies:** 2\
**Last updated:** [September 24, 2022, 1:07am UTC](https://discourse.julialang.org/t/valid-number/87727 "2022-09-24T01:07:00Z")

</div>

What checks should I do to know if the result of a mathematical operation is a valid number? (I can’t use isfinite with the struct I’m using) isnan(), == Inf, == -Inf Any other values?

---

## [The applicable method may be too new: running in world age 32331, while current world is 32332](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 11\
**Last updated:** [September 23, 2022, 8:10pm UTC](https://discourse.julialang.org/t/the-applicable-method-may-be-too-new-running-in-world-age-32331-while-current-world-is-32332/87706 "2022-09-23T20:10:04Z")

</div>

I want to change the field types of R to be of StaticArray. However, I am having the below error. Could you please help me to solve this issue? using LinearAlgebra, StaticArrays Base.@kwdef mutable struct Rs I::Vector…

---

## [Get vector of vectors of indice of appearances for every unique element of an array](https://discourse.julialang.org/t/get-vector-of-vectors-of-indice-of-appearances-for-every-unique-element-of-an-array/87671)

<div class="topic-metadata">

**Author:** [@elii17](https://discourse.julialang.org/u/elii17)\
**Replies:** 5\
**Last updated:** [September 23, 2022, 5:35pm UTC](https://discourse.julialang.org/t/get-vector-of-vectors-of-indice-of-appearances-for-every-unique-element-of-an-array/87671 "2022-09-23T17:35:44Z")

</div>

Hey, I am trying to get a vector of vectors containing the indices of the appearance of every unique element of an array. So far i have tried y = \[1,2,2,3,5,5,6,1\] unique\_elements = unique(y) unique\_elements = \[1,2,3…

---

## [Lexer for SQL statements](https://discourse.julialang.org/t/lexer-for-sql-statements/87695)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 3\
**Last updated:** [September 23, 2022, 5:16pm UTC](https://discourse.julialang.org/t/lexer-for-sql-statements/87695 "2022-09-23T17:16:56Z")

</div>

hi, First of, I prefer functions over everything else. But I am in a situation in which I only know the correct argument AFTER the SQL statement is tokenized. I won’t bother you with the details but just know that I ca…

---

## [Collect data from channels](https://discourse.julialang.org/t/collect-data-from-channels/87700)

<div class="topic-metadata">

**Author:** [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Replies:** 1\
**Last updated:** [September 23, 2022, 2:31pm UTC](https://discourse.julialang.org/t/collect-data-from-channels/87700 "2022-09-23T14:31:02Z")

</div>

I use a Pkg that uses threads and allows you to pass a function that does something at each iteration. I want to send strings to a Channel and put them in a vector. Is this code the best way to do this? Or are there si…

---

## [Use of tailing Clong arguments in ccall](https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 1\
**Last updated:** [September 23, 2022, 1:41pm UTC](https://discourse.julialang.org/t/use-of-tailing-clong-arguments-in-ccall/87682 "2022-09-23T13:41:45Z")

</div>

There seems to be sometimes tailing Clong arguments in ccall in stdlib. Take LinearAlgebra/src/lapack.jl for example, there are functions like: function gebak!(job::AbstractChar, side::AbstractChar, ilo:…

---

## [REPL crashes with custom pretty printing and Dictionaries](https://discourse.julialang.org/t/repl-crashes-with-custom-pretty-printing-and-dictionaries/87622)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 8\
**Last updated:** [September 23, 2022, 1:02pm UTC](https://discourse.julialang.org/t/repl-crashes-with-custom-pretty-printing-and-dictionaries/87622 "2022-09-23T13:02:07Z")

</div>

The REPL crashes when I run the following code twice, the first time giving the expected StackOverflowError: using Dictionaries: dictionary struct Bcode code::Int end Base.convert(::Type{String}, b::Bcode) = dicti…

---

## [Problem with GUI ask\_dialog](https://discourse.julialang.org/t/problem-with-gui-ask-dialog/73224)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 18\
**Last updated:** [September 23, 2022, 8:44am UTC](https://discourse.julialang.org/t/problem-with-gui-ask-dialog/73224 "2022-09-23T08:44:46Z")

</div>

Julia is freezing when I use ask\_dialog() in julia file. I added extra code as suggested to let it work, however, the problem is still existing. Any solution? using Gtk win = GtkWindow("gtkwait") if !isinteractive() …

---

## [A limit to free operations of my own type](https://discourse.julialang.org/t/a-limit-to-free-operations-of-my-own-type/87690)

<div class="topic-metadata">

**Author:** [@mongi](https://discourse.julialang.org/u/mongi)\
**Replies:** 0\
**Last updated:** [September 23, 2022, 8:33am UTC](https://discourse.julialang.org/t/a-limit-to-free-operations-of-my-own-type/87690 "2022-09-23T08:33:38Z")

</div>

Hi, I have my own type (fields Vector and Int) and implemented (+,-,\*,/) for it “mulT(args…), addT, subT, divT”, and it works without allocations until length(args)\>7 for multiplication and 9 for addition. For each oper…

---

## [Optimization.jl: Method error while using AutoReverseDiff](https://discourse.julialang.org/t/optimization-jl-method-error-while-using-autoreversediff/87657)

<div class="topic-metadata">

**Author:** [@Luis\_Calderon](https://discourse.julialang.org/u/Luis_Calderon)\
**Replies:** 2\
**Last updated:** [September 23, 2022, 8:09am UTC](https://discourse.julialang.org/t/optimization-jl-method-error-while-using-autoreversediff/87657 "2022-09-23T08:09:59Z")

</div>

Dear all, I’ve been wrestling with this optimization setup all day. I feel like I was close to finishing, but I’ve seem to hit another speed bump. Here is the part of the code that generates the method error. The code w…

---

## [Plotting patches of constant values using Makie](https://discourse.julialang.org/t/plotting-patches-of-constant-values-using-makie/87687)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 3\
**Last updated:** [September 23, 2022, 7:31am UTC](https://discourse.julialang.org/t/plotting-patches-of-constant-values-using-makie/87687 "2022-09-23T07:31:10Z")

</div>

Dear all, I have an issue when plotting patches with Makie when the field has no spatial variations. I provide a MWE below. The returned error is ArgumentError: range step cannot be zero if v=zeros(nel) (constant data…

---

## [Code becomes really slow when I combine StaticArrays and DoubleFloats](https://discourse.julialang.org/t/code-becomes-really-slow-when-i-combine-staticarrays-and-doublefloats/87661)

<div class="topic-metadata">

**Author:** [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Replies:** 18\
**Last updated:** [September 23, 2022, 4:19am UTC](https://discourse.julialang.org/t/code-becomes-really-slow-when-i-combine-staticarrays-and-doublefloats/87661 "2022-09-23T04:19:50Z")

</div>

Hi: I have some code to frequently generate haar random matrices and I want it to run fast. I use the suggestion in https://discourse.julialang.org/t/code-speed-decreases-when-loop-number-increases/78920 that I can use S…

---

## [Dispatch on Type](https://discourse.julialang.org/t/dispatch-on-type/87680)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [September 23, 2022, 1:38am UTC](https://discourse.julialang.org/t/dispatch-on-type/87680 "2022-09-23T01:38:25Z")

</div>

I am hoping to create a function that will dispatch on the type I put in. Basically the function will look at the fields of the structure and do things based on the number of fields and the fieldnames. As a MWE I would…

---

## [Can dicts be threadsafe?](https://discourse.julialang.org/t/can-dicts-be-threadsafe/27172)

<div class="topic-metadata">

**Author:** [@subunit](https://discourse.julialang.org/u/subunit)\
**Replies:** 17\
**Last updated:** [September 22, 2022, 10:58pm UTC](https://discourse.julialang.org/t/can-dicts-be-threadsafe/27172 "2022-09-22T22:58:45Z")

</div>

dict = Dict{Int64,Vector{Float64}}() nentries = 5e5 Threads.@threads for n in 1:nentries dict\[n\] = \[rand() for i in 1:100\] end @assert length(dict) == nentries The assertion fails for me in Julia 1.1.0, as the dic…

---

## [How to use my CPU's](https://discourse.julialang.org/t/how-to-use-my-cpus/87390)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 13\
**Last updated:** [September 22, 2022, 10:50pm UTC](https://discourse.julialang.org/t/how-to-use-my-cpus/87390 "2022-09-22T22:50:32Z")

</div>

I instantiated an environment and watched for 533 seconds as it compiled over 100 packages. During this time julia cpu useage maxed at 12%, i.e., one of the 8 cores I have. What is the best way to use more of my cores?…

---

## [Allocations due to Boolean keyword arguments - how to avoid them?](https://discourse.julialang.org/t/allocations-due-to-boolean-keyword-arguments-how-to-avoid-them/87654)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 9\
**Last updated:** [September 22, 2022, 6:00pm UTC](https://discourse.julialang.org/t/allocations-due-to-boolean-keyword-arguments-how-to-avoid-them/87654 "2022-09-22T18:00:08Z")

</div>

Deep in one of my projects I have a function that slightly changes behavior depending on a boolean keyword. It seems if the keyword is Val{Bool} there are no allocations but if it is Bool, then it allocates. Here is a co…

---

## [Two types of blocked updates/upgrades of packages in 1.8](https://discourse.julialang.org/t/two-types-of-blocked-updates-upgrades-of-packages-in-1-8/85474)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 7\
**Last updated:** [September 22, 2022, 2:31pm UTC](https://discourse.julialang.org/t/two-types-of-blocked-updates-upgrades-of-packages-in-1-8/85474 "2022-09-22T14:31:54Z")

</div>

In the latest release candidate (v1.8.0-rc3) I can notice a new feature of the package manager, namely, after listing all packages in the given environment with status, I get this as the final line: Info Packages marked…

---

## [Pmap suddenly after running for some time gives Load Error](https://discourse.julialang.org/t/pmap-suddenly-after-running-for-some-time-gives-load-error/87646)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 0\
**Last updated:** [September 22, 2022, 2:08pm UTC](https://discourse.julialang.org/t/pmap-suddenly-after-running-for-some-time-gives-load-error/87646 "2022-09-22T14:08:46Z")

</div>

I am paralellizing, with the library Distributed (pmap method), calling the JuMP solver Ipopt across different agents (“utilities”). The results for each agent are then vertically concatenated into a DataFrame. The code …

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

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