# General Usage

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

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

**Page:** 505

---

## [Basic plot function in NetworkLayout.jl not working](https://discourse.julialang.org/t/basic-plot-function-in-networklayout-jl-not-working/73515)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 1\
**Last updated:** [December 23, 2021, 7:57am UTC](https://discourse.julialang.org/t/basic-plot-function-in-networklayout-jl-not-working/73515 "2021-12-23T07:57:15Z")

</div>

I am having trouble executing even the most basic commands in the NetworkLayout package. The following code is verbatim from the package’s documentation page. using CairoMakie using NetworkLayout using GraphMakie, Light…

---

## [Add a package of low version](https://discourse.julialang.org/t/add-a-package-of-low-version/73514)

<div class="topic-metadata">

**Author:** [@19801208812](https://discourse.julialang.org/u/19801208812)\
**Replies:** 2\
**Last updated:** [December 23, 2021, 3:10am UTC](https://discourse.julialang.org/t/add-a-package-of-low-version/73514 "2021-12-23T03:10:40Z")

</div>

I asked about downloading a low-version package yesterday, that is, I want to add a package Pkg.add(Pkg.PackageSpec(url=“GitHub - jbmuir/EnsembleKalmanInversion.jl: Ensemble Kalman Inversion in Julia”)) The error is as s…

---

## [How can I adjust the resolution of PyPlot.jl in Pluto?](https://discourse.julialang.org/t/how-can-i-adjust-the-resolution-of-pyplot-jl-in-pluto/73495)

<div class="topic-metadata">

**Author:** [@Minghao\_Du](https://discourse.julialang.org/u/Minghao_Du)\
**Replies:** 3\
**Last updated:** [December 23, 2021, 1:41am UTC](https://discourse.julialang.org/t/how-can-i-adjust-the-resolution-of-pyplot-jl-in-pluto/73495 "2021-12-23T01:41:35Z")

</div>

How to adjust the resolution of PyPlot in Pluto? import PyPlot as plt let X=collect(0:0.01:10) plt.clf() plt.plot(X,sin.(exp.(X/3))) figure=plt.gcf() end

---

## [Task not runnable error](https://discourse.julialang.org/t/task-not-runnable-error/73506)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 3\
**Last updated:** [December 23, 2021, 1:38am UTC](https://discourse.julialang.org/t/task-not-runnable-error/73506 "2021-12-23T01:38:37Z")

</div>

Hi folks, I have a task that says it’s runnable, but I get a task not runnable error: julia\> task = @task readline(stdin) Task (runnable) @0x000000010f798010 julia\> yield(task) julia\> task Task (runnable) @0x000000010…

---

## [How to use PyPlot.jl to draw the graph of DifferentialEquations](https://discourse.julialang.org/t/how-to-use-pyplot-jl-to-draw-the-graph-of-differentialequations/73487)

<div class="topic-metadata">

**Author:** [@Minghao\_Du](https://discourse.julialang.org/u/Minghao_Du)\
**Replies:** 3\
**Last updated:** [December 22, 2021, 2:59pm UTC](https://discourse.julialang.org/t/how-to-use-pyplot-jl-to-draw-the-graph-of-differentialequations/73487 "2021-12-22T14:59:13Z")

</div>

The sol of the “DifferentialEquations.jl” package can be nicely drawn with Plots, like the following But if you use the “PyPlot.jl” package, how do you draw the sol curve? The IDE I use is Pluto using DifferentialE…

---

## [Current upsampling layers](https://discourse.julialang.org/t/current-upsampling-layers/73286)

<div class="topic-metadata">

**Author:** [@Avec](https://discourse.julialang.org/u/Avec)\
**Replies:** 4\
**Last updated:** [December 22, 2021, 2:18pm UTC](https://discourse.julialang.org/t/current-upsampling-layers/73286 "2021-12-22T14:18:22Z")

</div>

Hi, what are the current options for upsampling layers in Flux that run on GPU? I am using ConvTranspose, but I would like to try out something else. I found Upsample(scale, mode) in documentation but it is extremely sl…

---

## [How to perform ongoing background work with a real time ui](https://discourse.julialang.org/t/how-to-perform-ongoing-background-work-with-a-real-time-ui/73400)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 5\
**Last updated:** [December 22, 2021, 1:27am UTC](https://discourse.julialang.org/t/how-to-perform-ongoing-background-work-with-a-real-time-ui/73400 "2021-12-22T01:27:17Z")

</div>

I’m trying to perform a long running analysis with a real time user interface. Ideally I can do this with or without multiple threads (obviously it could be more efficient with multiple threads) and an ability to easily …

---

## [Is Arpack really slow on Windows?](https://discourse.julialang.org/t/is-arpack-really-slow-on-windows/73467)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 0\
**Last updated:** [December 22, 2021, 3:56am UTC](https://discourse.julialang.org/t/is-arpack-really-slow-on-windows/73467 "2021-12-22T03:56:38Z")

</div>

The same example is run with 1.7, once in Windows 10, and once in WSL2 (on the same machine, of course). The curious thing is the simulation takes roughly the same time, BUT WSL2 is worse running julia code (about a fact…

---

## [Appending a vector to a vector of vectors](https://discourse.julialang.org/t/appending-a-vector-to-a-vector-of-vectors/73461)

<div class="topic-metadata">

**Author:** [@alan](https://discourse.julialang.org/u/alan)\
**Replies:** 7\
**Last updated:** [December 22, 2021, 3:14am UTC](https://discourse.julialang.org/t/appending-a-vector-to-a-vector-of-vectors/73461 "2021-12-22T03:14:13Z")

</div>

I’m trying to create an empty vector of vectors and then append vectors to it so that I end up with a ragged array. What is wrong with this code? julia\> a = Vector{Vector{Int}}\[\] Vector{Vector{Int64}}\[\] julia\> x = \[1,2…

---

## [When is a fold over a fixed-length tuple unrolled?](https://discourse.julialang.org/t/when-is-a-fold-over-a-fixed-length-tuple-unrolled/73410)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 6\
**Last updated:** [December 22, 2021, 1:35am UTC](https://discourse.julialang.org/t/when-is-a-fold-over-a-fixed-length-tuple-unrolled/73410 "2021-12-22T01:35:05Z")

</div>

@code\_typed tells me that the statement foldl(+, (1,2,3); init = 0) is unrolled into three additions. On the other hand, if I say struct A x::Int; y::Int; z::Int end f(a::A) = foldl((1,2,3); init = UInt(0)) do h, i …

---

## [\\mscr unicode character display in REPL with Windows](https://discourse.julialang.org/t/mscr-unicode-character-display-in-repl-with-windows/10290)

<div class="topic-metadata">

**Author:** [@waldoc](https://discourse.julialang.org/u/waldoc)\
**Replies:** 18\
**Last updated:** [December 22, 2021, 1:54am UTC](https://discourse.julialang.org/t/mscr-unicode-character-display-in-repl-with-windows/10290 "2021-12-22T01:54:14Z")

</div>

Hi, I have been enjoying some of the many Unicode characters available in Julia (https://docs.julialang.org/en/stable/manual/unicode-input/), however, found that some of them do not display in the REPL in Windows. Specif…

---

## [Rand! + MvNormal = StackOverflowError](https://discourse.julialang.org/t/rand-mvnormal-stackoverflowerror/73462)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 0\
**Last updated:** [December 21, 2021, 11:45pm UTC](https://discourse.julialang.org/t/rand-mvnormal-stackoverflowerror/73462 "2021-12-21T23:45:23Z")

</div>

Hello! Is it expected behavior with rand!(zeros(4), MvNormal(Diagonal(\[1,2,3,4\])))? Starting Julia... \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_…

---

## [Documenter deploy failure](https://discourse.julialang.org/t/documenter-deploy-failure/73458)

<div class="topic-metadata">

**Author:** [@jdlara-berkeley](https://discourse.julialang.org/u/jdlara-berkeley)\
**Replies:** 3\
**Last updated:** [December 21, 2021, 11:27pm UTC](https://discourse.julialang.org/t/documenter-deploy-failure/73458 "2021-12-21T23:27:04Z")

</div>

Github actions has been failing at the deploy stage with a Failed to add the RSA host key for IP address '140.82.113.3' to the list of known hosts (/home/runner/.ssh/known\_hosts). message but it isn’t clear what the issu…

---

## [Problem with searchsortedfirst](https://discourse.julialang.org/t/problem-with-searchsortedfirst/73332)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 30\
**Last updated:** [December 21, 2021, 11:04pm UTC](https://discourse.julialang.org/t/problem-with-searchsortedfirst/73332 "2021-12-21T23:04:32Z")

</div>

I have a problem with searchsortedfirst. I want to search a list of Pair{Symbol,Int} which is sorted by the Symbol. julia\> a=\[:a=\>1,:b=\>2\] 2-element Vector{Pair{Symbol, Int64}}: :a =\> 1 :b =\> 2 julia\> searchsortedfi…

---

## [Allocation when assigning to a slice](https://discourse.julialang.org/t/allocation-when-assigning-to-a-slice/73381)

<div class="topic-metadata">

**Author:** [@etienne\_dg](https://discourse.julialang.org/u/etienne_dg)\
**Replies:** 13\
**Last updated:** [December 21, 2021, 9:23pm UTC](https://discourse.julialang.org/t/allocation-when-assigning-to-a-slice/73381 "2021-12-21T21:23:06Z")

</div>

Hi, Why does the second version allocate ? Is there a clean way to do that without allocating ? z = collect(1:10000) function test1(z) z .-= 1 end 4.898 μs (0 allocations: 0 bytes) function test2(z) z\[56:end\]…

---

## [How to display a Julia vector in Pluto markdown](https://discourse.julialang.org/t/how-to-display-a-julia-vector-in-pluto-markdown/73449)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [December 21, 2021, 7:00pm UTC](https://discourse.julialang.org/t/how-to-display-a-julia-vector-in-pluto-markdown/73449 "2021-12-21T19:00:30Z")

</div>

Hi all, I want to display some latex equations and a Julia vector. Here is a minimum working example: md" \\lambda = $(round.(\[1/3,2/3\], digits = 3)) " Is there a way to improve the display of the vector? As you can…

---

## [Dependency without dependency](https://discourse.julialang.org/t/dependency-without-dependency/73432)

<div class="topic-metadata">

**Author:** [@davibarreira](https://discourse.julialang.org/u/davibarreira)\
**Replies:** 4\
**Last updated:** [December 21, 2021, 6:03pm UTC](https://discourse.julialang.org/t/dependency-without-dependency/73432 "2021-12-21T18:03:31Z")

</div>

Hey everyone, I have the following situation in my hands, and I’d like to get some perspective from the community: Suppose I’m developing a package and I wish to provide the user with a function that requires a package …

---

## [Generic and flexible array-of-struct to struct-of-array conversions](https://discourse.julialang.org/t/generic-and-flexible-array-of-struct-to-struct-of-array-conversions/73420)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 6\
**Last updated:** [December 21, 2021, 2:39pm UTC](https://discourse.julialang.org/t/generic-and-flexible-array-of-struct-to-struct-of-array-conversions/73420 "2021-12-21T14:39:09Z")

</div>

I have a problem that comes up fairly often that I do not really have a satisfying solution to at the moment. Say I have a container type like the one below, representing many “versions” of a real number struct Baz{T} \<…

---

## [How to (efficiently) find the set of maxima of an array?](https://discourse.julialang.org/t/how-to-efficiently-find-the-set-of-maxima-of-an-array/73423)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 6\
**Last updated:** [December 21, 2021, 11:55am UTC](https://discourse.julialang.org/t/how-to-efficiently-find-the-set-of-maxima-of-an-array/73423 "2021-12-21T11:55:56Z")

</div>

I want to find the set of maxima of an array. More precisely, I want the set of their indices. For example, from A = \[1 2 3 4 1 2 3 4 1 2 3 4\] I want to obtain something similar to 3-element Vector{Int64}: 4 8 1…

---

## [How to know what LLVM version is using Julia?](https://discourse.julialang.org/t/how-to-know-what-llvm-version-is-using-julia/73430)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 1\
**Last updated:** [December 21, 2021, 11:53am UTC](https://discourse.julialang.org/t/how-to-know-what-llvm-version-is-using-julia/73430 "2021-12-21T11:53:43Z")

</div>

Hello. What command do I need to execute from Julia to show the LLVM version?

---

## [Passing pointers to workers process results in null pointers](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418)

<div class="topic-metadata">

**Author:** [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Replies:** 4\
**Last updated:** [December 21, 2021, 8:26am UTC](https://discourse.julialang.org/t/passing-pointers-to-workers-process-results-in-null-pointers/73418 "2021-12-21T08:26:05Z")

</div>

Hi all, I am writing a code to spawn an image acquisition routine on a worker process by passing a pointer pointing to a camera device. This pointer is used by C APIs to execute camera operations via ccall. The problem …

---

## [Task serialization error: Running a Task on a remote process fails with "cannot serialize a running Task"](https://discourse.julialang.org/t/task-serialization-error-running-a-task-on-a-remote-process-fails-with-cannot-serialize-a-running-task/72812)

<div class="topic-metadata">

**Author:** [@Bossax](https://discourse.julialang.org/u/Bossax)\
**Replies:** 2\
**Last updated:** [December 21, 2021, 4:59am UTC](https://discourse.julialang.org/t/task-serialization-error-running-a-task-on-a-remote-process-fails-with-cannot-serialize-a-running-task/72812 "2021-12-21T04:59:16Z")

</div>

Hi all, I have written a routine to do image acquisition. This routine calls camera C APIs to take and save images. I tested it by running the routine on a local process and it works fine; I can send SIGINT to interrupt…

---

## [Problem with mutation and copying of Matrices/Vectors](https://discourse.julialang.org/t/problem-with-mutation-and-copying-of-matrices-vectors/73221)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 22\
**Last updated:** [December 21, 2021, 12:23am UTC](https://discourse.julialang.org/t/problem-with-mutation-and-copying-of-matrices-vectors/73221 "2021-12-21T00:23:34Z")

</div>

I have the below MWE of my code. Here, R.I\_prev = R.I; is working as copy but I found that it works as mutation in my code, so any change of R.I will change directly R.I\_prev. I faced this issue many times. Can any body…

---

## [Optional field in struct](https://discourse.julialang.org/t/optional-field-in-struct/73338)

<div class="topic-metadata">

**Author:** [@Handam](https://discourse.julialang.org/u/Handam)\
**Replies:** 3\
**Last updated:** [December 20, 2021, 11:33pm UTC](https://discourse.julialang.org/t/optional-field-in-struct/73338 "2021-12-20T23:33:14Z")

</div>

Hi, if I have defined a struct, e.g. mutable struct A a::Tuple end and then saved an object of this struct with BSON o = A((1,2)) BSON.@save "o.bson" o is it then possible to add “optional” fields to the struct …

---

## [DFbetas for identifying influential participants - linear mixed models](https://discourse.julialang.org/t/dfbetas-for-identifying-influential-participants-linear-mixed-models/73399)

<div class="topic-metadata">

**Author:** [@CatOliveira](https://discourse.julialang.org/u/CatOliveira)\
**Replies:** 1\
**Last updated:** [December 20, 2021, 11:23pm UTC](https://discourse.julialang.org/t/dfbetas-for-identifying-influential-participants-linear-mixed-models/73399 "2021-12-20T23:23:10Z")

</div>

Hello everyone, I have used the package influence.me to determine whether I had influential participants using dfbetas. Yet, this package takes forever to run and I just can’t wait another month for it to run. I tried t…

---

## [Why does VSCode say there is a problem in this code?](https://discourse.julialang.org/t/why-does-vscode-say-there-is-a-problem-in-this-code/73280)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 11\
**Last updated:** [December 20, 2021, 11:18pm UTC](https://discourse.julialang.org/t/why-does-vscode-say-there-is-a-problem-in-this-code/73280 "2021-12-20T23:18:30Z")

</div>

I created a file with the exact contents below. It runs fine, but VSCode keeps listing the file and the line with the select statement in the Problems tab. Three questions: What is the problem? My guess is that it i…

---

## [Defining a custom hash function](https://discourse.julialang.org/t/defining-a-custom-hash-function/73395)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 7\
**Last updated:** [December 20, 2021, 9:40pm UTC](https://discourse.julialang.org/t/defining-a-custom-hash-function/73395 "2021-12-20T21:40:59Z")

</div>

I have a type BezierPath that contains a vector of commands. I want two bezier paths with the same commands stored in different vectors to have the same hash value, by default they don’t. Is it fine to just overload hash …

---

## [What makes Julia loops so fast?](https://discourse.julialang.org/t/what-makes-julia-loops-so-fast/73389)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 8\
**Last updated:** [December 20, 2021, 7:48pm UTC](https://discourse.julialang.org/t/what-makes-julia-loops-so-fast/73389 "2021-12-20T19:48:54Z")

</div>

I did some test myself as below, it turns out the loop version of my code is close to 15 times faster. Why? What made Julia so fast when going through a loop? My code: A = rand(1:100, 10^5,1); @time Ind1 = A .\> 35; …

---

## ["ask\_dialog()" is not working proberly](https://discourse.julialang.org/t/ask-dialog-is-not-working-proberly/72685)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 1\
**Last updated:** [December 6, 2021, 11:30pm UTC](https://discourse.julialang.org/t/ask-dialog-is-not-working-proberly/72685 "2021-12-06T23:30:08Z")

</div>

I am using ask\_dialog() in my code (Myfile.jl) and when I run it, a popup window is appeared. However, after clicking any of the two options nothing is happening (it do nothing). While using the below command in REPL it …

---

## [Inference problem with @spawn](https://discourse.julialang.org/t/inference-problem-with-spawn/73379)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 5\
**Last updated:** [December 20, 2021, 5:39pm UTC](https://discourse.julialang.org/t/inference-problem-with-spawn/73379 "2021-12-20T17:39:00Z")

</div>

This is a toy example of the problem. I want to sum a bunch of number is parallel, using a lock to reduce. Disconsidering the fact that the lock here is of course detrimental to performance (the actual use case is diffe…

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

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