# General Usage

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

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

**Page:** 546

---

## [Interactive plotting via web](https://discourse.julialang.org/t/interactive-plotting-via-web/68304)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 5\
**Last updated:** [September 17, 2021, 1:10pm UTC](https://discourse.julialang.org/t/interactive-plotting-via-web/68304 "2021-09-17T13:10:31Z")

</div>

Hi, I’m looking for a way of interactively plot some figures through a website. A representative example might be PlutoUI.jl but it requires Pluto. I wanna do this from my terminal. Other package I found is Interact.…

---

## [@distributed is not sharing the work as I would expect](https://discourse.julialang.org/t/distributed-is-not-sharing-the-work-as-i-would-expect/68325)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 1\
**Last updated:** [September 17, 2021, 12:52pm UTC](https://discourse.julialang.org/t/distributed-is-not-sharing-the-work-as-i-would-expect/68325 "2021-09-17T12:52:54Z")

</div>

Hi I have a monte carlo simulation which I run with 289 different parameter sets. I now realize that @distributed is not as smart as I thought (at least that is my current understanding). The issue is that not every i…

---

## [Fast hash for custom type](https://discourse.julialang.org/t/fast-hash-for-custom-type/68135)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 10\
**Last updated:** [September 17, 2021, 12:45pm UTC](https://discourse.julialang.org/t/fast-hash-for-custom-type/68135 "2021-09-17T12:45:34Z")

</div>

We have a custom type and we are not satisfied with the Base.hash performance. See here for the real world example. What are the best practice for defining a custom hash? This is what we did: julia\> struct S{T}; value…

---

## [Can I disable overloaded Base.show() and print the raw form of an object?](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 4\
**Last updated:** [September 17, 2021, 12:37am UTC](https://discourse.julialang.org/t/can-i-disable-overloaded-base-show-and-print-the-raw-form-of-an-object/68286 "2021-09-17T00:37:37Z")

</div>

Sometimes I’d like to see the “raw” form of a custom struct. Can I print it using the default Base.show(), ignoring my own custom definitions which print prettier results but may hide details useful for debugging?

---

## [Julia Performance - Help Needed](https://discourse.julialang.org/t/julia-performance-help-needed/68004)

<div class="topic-metadata">

**Author:** [@way2toronto](https://discourse.julialang.org/u/way2toronto)\
**Replies:** 40\
**Last updated:** [September 17, 2021, 11:37am UTC](https://discourse.julialang.org/t/julia-performance-help-needed/68004 "2021-09-17T11:37:59Z")

</div>

Hello. Given the promises of performance, I’ve started my Julia work with a translation of a simple deep learning algo to Julia. My Julia code is below and the original Python code network.py is from the book by Michael …

---

## [Sort an array according other array](https://discourse.julialang.org/t/sort-an-array-according-other-array/68295)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 6\
**Last updated:** [September 17, 2021, 10:13am UTC](https://discourse.julialang.org/t/sort-an-array-according-other-array/68295 "2021-09-17T10:13:06Z")

</div>

I am trying to sort an array according other array. More specifically, sort ε\_ according Z. NN = 6 Z = rand(NN) ε\_= rand(NN) teste = \[ Z\[sortperm(Z)\] ε\_\[sortperm(ε\_)\] \] test\_f(Z) = teste\[teste\[:,1\] .== Z , 2\] ε\_ …

---

## [Unexpected behavior of similar](https://discourse.julialang.org/t/unexpected-behavior-of-similar/68318)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 3\
**Last updated:** [September 17, 2021, 8:40am UTC](https://discourse.julialang.org/t/unexpected-behavior-of-similar/68318 "2021-09-17T08:40:32Z")

</div>

I find this behavior of similar unexpected: julia\> r = \[rand(2, 2) for i in 1:3\] julia\> x = similar(r) 3-element Vector{Matrix{Float64}}: #undef #undef #undef julia\> x\[1\] ERROR: UndefRefError: access to undefined r…

---

## [Can I use pkg protocol to download artifacts manually?](https://discourse.julialang.org/t/can-i-use-pkg-protocol-to-download-artifacts-manually/68311)

<div class="topic-metadata">

**Author:** [@melonedo](https://discourse.julialang.org/u/melonedo)\
**Replies:** 0\
**Last updated:** [September 17, 2021, 6:28am UTC](https://discourse.julialang.org/t/can-i-use-pkg-protocol-to-download-artifacts-manually/68311 "2021-09-17T06:28:04Z")

</div>

Julia now installs artifacts very quickly, with the help of pkg protocol. But if I want to install artifacts manually instead of intalling JLL wrappers, e.g. install an artifact as a build dependency (Clang.jl uses this …

---

## [Named Array from DataFrame?](https://discourse.julialang.org/t/named-array-from-dataframe/68303)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [September 17, 2021, 4:48am UTC](https://discourse.julialang.org/t/named-array-from-dataframe/68303 "2021-09-17T04:48:17Z")

</div>

Is it possible to convert a DataFrame to NamedArray ? Similar to DataFrame unstack ? Something like x = NamedArray( DataFrame=df, dimensions=\[:D1, :D2\], value = :v) Full example. Current code: df = DataFrame( \[ …

---

## [Faster sorting of DataFrames.jl via background ordering](https://discourse.julialang.org/t/faster-sorting-of-dataframes-jl-via-background-ordering/45084)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 0\
**Last updated:** [August 17, 2020, 8:18am UTC](https://discourse.julialang.org/t/faster-sorting-of-dataframes-jl-via-background-ordering/45084 "2020-08-17T08:18:08Z")

</div>

I have had this idea for a long time, now I finally gave it a go and the results are amazing. So here’s the idea. Here sorting a large dataframe the algorithm roughly goes like this Perform a sortperm on the columns t…

---

## [How can I arrange to only use @threads if the number of iteration is higher than minimum?](https://discourse.julialang.org/t/how-can-i-arrange-to-only-use-threads-if-the-number-of-iteration-is-higher-than-minimum/68177)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 17\
**Last updated:** [September 16, 2021, 11:02pm UTC](https://discourse.julialang.org/t/how-can-i-arrange-to-only-use-threads-if-the-number-of-iteration-is-higher-than-minimum/68177 "2021-09-16T23:02:23Z")

</div>

I need to run @threads before “for loop” only if the number of iteration is bigger than a predetermined value (called min\_iter here ), such as @threads min\_iter for i in ..., Any idea?

---

## [How to avoid using global variable in "for loop" inside a function?](https://discourse.julialang.org/t/how-to-avoid-using-global-variable-in-for-loop-inside-a-function/68288)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 9\
**Last updated:** [September 16, 2021, 10:40pm UTC](https://discourse.julialang.org/t/how-to-avoid-using-global-variable-in-for-loop-inside-a-function/68288 "2021-09-16T22:40:37Z")

</div>

I have two questions please: 1- Are r, s global or local variables in the below main code? function ss(r, s) u =r+s; a =r\*s; return u, a end #main code r=5; s=9; q,w = ss(r, s) 2- How to get ride of defining iter as …

---

## [Why with @threads, the execution time is worse?](https://discourse.julialang.org/t/why-with-threads-the-execution-time-is-worse/68160)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 19\
**Last updated:** [September 16, 2021, 9:44pm UTC](https://discourse.julialang.org/t/why-with-threads-the-execution-time-is-worse/68160 "2021-09-16T21:44:37Z")

</div>

I am running the below code on 6 physical core computer: using SparseArrays; using LinearAlgebra; using .Threads using BenchmarkTools dt = 0.001; tmin = 0; tmax = 5; timeSim = tmin:dt:tmax; NodeVoltage = zeros(…

---

## [Matrix factorization with Symbolics.jl](https://discourse.julialang.org/t/matrix-factorization-with-symbolics-jl/68266)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 3\
**Last updated:** [September 16, 2021, 7:51pm UTC](https://discourse.julialang.org/t/matrix-factorization-with-symbolics-jl/68266 "2021-09-16T19:51:56Z")

</div>

I want to factorize a small matrix of integers symbolically with Symbols.jl. For examble A = \[0 1; 1 0\] How do I get symbolically the spectral decomposition? I could not find a way to specify a symbolic 1 with Symbolic…

---

## [Matrix division \\ for sparse and singular matrices](https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253)

<div class="topic-metadata">

**Author:** [@blob](https://discourse.julialang.org/u/blob)\
**Replies:** 7\
**Last updated:** [September 16, 2021, 3:26pm UTC](https://discourse.julialang.org/t/matrix-division-for-sparse-and-singular-matrices/68253 "2021-09-16T15:26:30Z")

</div>

It seems that the behaviour of matrix division \\ is inconsistent if sparse matrices are used: using LinearAlgebra, SparseArrays A1=\[1 1 ;0 0.0\] B1=\[4; 0.0\] x1=A1\\B1 #Error: LAPACKException(2) x2=sparse(A1)\\sparse(B1…

---

## [Capture the stdout output of a ccall?](https://discourse.julialang.org/t/capture-the-stdout-output-of-a-ccall/68262)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 4\
**Last updated:** [September 16, 2021, 2:41pm UTC](https://discourse.julialang.org/t/capture-the-stdout-output-of-a-ccall/68262 "2021-09-16T14:41:31Z")

</div>

I’m ccalling a function in a shared lib which writes something to stdout (i.e. it appears it the terminal). Is it possible to capture this text output? Among other things, I tried mktemp() do path, io redirect\_stdou…

---

## [Multiple Outputs (Tuple) from IfElse with VectorizationBase](https://discourse.julialang.org/t/multiple-outputs-tuple-from-ifelse-with-vectorizationbase/68255)

<div class="topic-metadata">

**Author:** [@disberd](https://discourse.julialang.org/u/disberd)\
**Replies:** 3\
**Last updated:** [September 16, 2021, 2:36pm UTC](https://discourse.julialang.org/t/multiple-outputs-tuple-from-ifelse-with-vectorizationbase/68255 "2021-09-16T14:36:08Z")

</div>

Hi there, I am trying to experiment a bit with VectorizationBase to create functions that can be used inside the @turbo macro from LoopVectorization. I have a use case where my computation can be significantly sped up …

---

## [Notebook in vscode: what is the status now?](https://discourse.julialang.org/t/notebook-in-vscode-what-is-the-status-now/68243)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 0\
**Last updated:** [September 16, 2021, 5:15am UTC](https://discourse.julialang.org/t/notebook-in-vscode-what-is-the-status-now/68243 "2021-09-16T05:15:27Z")

</div>

In vscode notebooks, the autocompletion seldom works for me. There are several situations: Jupyter extension, Julia extension not installed. Jupyter extension, Julia extension installed. Kernel handled by jupyte…

---

## [Plotting by multiple factors](https://discourse.julialang.org/t/plotting-by-multiple-factors/68237)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [September 16, 2021, 11:42am UTC](https://discourse.julialang.org/t/plotting-by-multiple-factors/68237 "2021-09-16T11:42:25Z")

</div>

Hi all, I have a dataset with three factors and one dependent variable. In the example below, how do I get all of the linear data in the top plot and all of the exponential data in the bottom plot. I tried changing the …

---

## [How to nest \`@auto\_hash\_equals\` & \`@with\_kw\`?](https://discourse.julialang.org/t/how-to-nest-auto-hash-equals-with-kw/33121)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [September 16, 2021, 7:12am UTC](https://discourse.julialang.org/t/how-to-nest-auto-hash-equals-with-kw/33121 "2021-09-16T07:12:09Z")

</div>

How to nest the 2 macros? If I have both AutoHashEquals.@auto\_hash\_equals & Parameters.@with\_kw applied onto a type definition. Either @auto\_hash\_equals @with\_kw or @with\_kw @auto\_hash\_equals is not working: julia\> @aut…

---

## [Best practice for the conversion from a vector of dictionaries to a dataframe](https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [September 16, 2021, 5:54am UTC](https://discourse.julialang.org/t/best-practice-for-the-conversion-from-a-vector-of-dictionaries-to-a-dataframe/68244 "2021-09-16T05:54:55Z")

</div>

I’d like to know whether there is a convenient way of converting from a vector of dictionaries to a dataframe. For example, julia\> my\_dict = Dict("a" =\> \[1, 2, 3\], "b" =\> \[4\]) my\_dictDict{String, Vector{Int64}} with 2 e…

---

## [Kemp and Kemp (1991) Poisson random variates implementation](https://discourse.julialang.org/t/kemp-and-kemp-1991-poisson-random-variates-implementation/68233)

<div class="topic-metadata">

**Author:** [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Replies:** 0\
**Last updated:** [September 15, 2021, 10:20pm UTC](https://discourse.julialang.org/t/kemp-and-kemp-1991-poisson-random-variates-implementation/68233 "2021-09-15T22:20:51Z")

</div>

Currently, the sampler in Distributions.jl for poisson random variates is PoissonADSampler, which implements the algorithm from J.H. Ahrens, U. Dieter (1982). I found the paper, “Poisson Random Variate Generation” from …

---

## [Memory usage with mmap file](https://discourse.julialang.org/t/memory-usage-with-mmap-file/59883)

<div class="topic-metadata">

**Author:** [@KKesgin](https://discourse.julialang.org/u/KKesgin)\
**Replies:** 17\
**Last updated:** [September 16, 2021, 3:38am UTC](https://discourse.julialang.org/t/memory-usage-with-mmap-file/59883 "2021-09-16T03:38:55Z")

</div>

Hi All I’m accessing a very large binary file randomly on windows. I don’t dare to put in all the code but I managed to replicate the behavior with a small loop. Could someone please explain to me why this is causing in…

---

## [Chose what browser to launch Pluto in](https://discourse.julialang.org/t/chose-what-browser-to-launch-pluto-in/58488)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 5\
**Last updated:** [September 15, 2021, 11:48pm UTC](https://discourse.julialang.org/t/chose-what-browser-to-launch-pluto-in/58488 "2021-09-15T23:48:50Z")

</div>

I believe that I can add a kwarg in my Pluto.run() command to chose the browser to launch the notebook in. I can however not find anything about it over at github, and because there is no comprehensive documentations I d…

---

## [How load date on SQLite](https://discourse.julialang.org/t/how-load-date-on-sqlite/68231)

<div class="topic-metadata">

**Author:** [@Rafael\_Brus](https://discourse.julialang.org/u/Rafael_Brus)\
**Replies:** 1\
**Last updated:** [September 15, 2021, 11:35pm UTC](https://discourse.julialang.org/t/how-load-date-on-sqlite/68231 "2021-09-15T23:35:10Z")

</div>

How load date on SQLite? using SQLite, Dates, DataFrames df = DataFrame(Column1 = \[1,2,3\], Column2 = \[today(),today()- Dates.Day(10),today()- Dates.Day(20)\]) SQLite.load!(df, db, "Test", temp=false) Thi…

---

## [Import numerical data from text file, sort and retain only Floats](https://discourse.julialang.org/t/import-numerical-data-from-text-file-sort-and-retain-only-floats/68216)

<div class="topic-metadata">

**Author:** [@dalarev](https://discourse.julialang.org/u/dalarev)\
**Replies:** 7\
**Last updated:** [September 15, 2021, 10:09pm UTC](https://discourse.julialang.org/t/import-numerical-data-from-text-file-sort-and-retain-only-floats/68216 "2021-09-15T22:09:15Z")

</div>

MWE: readdlm interprets data imported form a .dat text file as: julia\> A 2×4 Matrix{Any}: 1 2 "" 3 4 5 6 "" I would like to ignore the "" SubString{String} and raster by row to obtain the following final …

---

## [RK4 stages interpolation](https://discourse.julialang.org/t/rk4-stages-interpolation/68205)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 4\
**Last updated:** [September 15, 2021, 10:02pm UTC](https://discourse.julialang.org/t/rk4-stages-interpolation/68205 "2021-09-15T22:02:16Z")

</div>

Hello, I have an ODE which I solve using the RK4 time integration with a resolution of dt. Now, I want to do interpolation of my generated trajectory (solution) at intermediate points so that the time step becomes dt/2.…

---

## [Can the SDE in DifferentialEquations.jl add two or more different/independent noise terms?](https://discourse.julialang.org/t/can-the-sde-in-differentialequations-jl-add-two-or-more-different-independent-noise-terms/68227)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 3\
**Last updated:** [September 15, 2021, 9:57pm UTC](https://discourse.julialang.org/t/can-the-sde-in-differentialequations-jl-add-two-or-more-different-independent-noise-terms/68227 "2021-09-15T21:57:25Z")

</div>

I have looked at the noise terms in SDE in DifferentialEquations.jl https://diffeq.sciml.ai/stable/features/noise\_process/ I am not expert in SDE, and perhaps what I said is wrong and even stupid. I see all those equa…

---

## [Integral saturation limits w/ DifferentialEquations.jl](https://discourse.julialang.org/t/integral-saturation-limits-w-differentialequations-jl/22143)

<div class="topic-metadata">

**Author:** [@DrPapa](https://discourse.julialang.org/u/DrPapa)\
**Replies:** 23\
**Last updated:** [September 15, 2021, 9:28pm UTC](https://discourse.julialang.org/t/integral-saturation-limits-w-differentialequations-jl/22143 "2021-09-15T21:28:02Z")

</div>

I need to simulate an ODE w/ saturation limits on the integrators to prevent integral wind-up, e.g. see link. My initial thought is to implement this via ContinuousCallback where the offending state’s dynamics are set to…

---

## [Adding packages + pre-compilation vs. (docker pull) pre-built sysimage](https://discourse.julialang.org/t/adding-packages-pre-compilation-vs-docker-pull-pre-built-sysimage/55445)

<div class="topic-metadata">

**Author:** [@StatisticalMouse](https://discourse.julialang.org/u/StatisticalMouse)\
**Replies:** 1\
**Last updated:** [September 15, 2021, 8:15pm UTC](https://discourse.julialang.org/t/adding-packages-pre-compilation-vs-docker-pull-pre-built-sysimage/55445 "2021-09-15T20:15:00Z")

</div>

I made an observation, which might be useful. I have a base julia docker image with jupyterlab installed. I then added another layer that does RUN julia -e "using Pkg; Pkg.add(\["Plots","StatsPlots","DataFrames"\]); Pkg.p…

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

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