# General Usage

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

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

**Page:** 601

---

## [Sampling using Turing and a customized distribution](https://discourse.julialang.org/t/sampling-using-turing-and-a-customized-distribution/61031)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 0\
**Last updated:** [May 12, 2021, 4:35pm UTC](https://discourse.julialang.org/t/sampling-using-turing-and-a-customized-distribution/61031 "2021-05-12T16:35:20Z")

</div>

I have this customized distribution below: using Distributions struct OrthoNNDist \<: DiscreteMultivariateDistribution x0::Vector{Int64} oc::Array{Int64,2} x1s::Array prob::Float64 #return a new uniform distribut…

---

## [Using modules causes isa() to return the incorrect result](https://discourse.julialang.org/t/using-modules-causes-isa-to-return-the-incorrect-result/61028)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 3\
**Last updated:** [May 12, 2021, 4:04pm UTC](https://discourse.julialang.org/t/using-modules-causes-isa-to-return-the-incorrect-result/61028 "2021-05-12T16:04:16Z")

</div>

\# GameObj.jl module GameObj export GameObject abstract type GameObject end end # WeaponObj.jl module WeaponObj export Weapon include("GameObj.jl") using .GameObj abstract type Weapon \<: GameObject end end # ChargeGunOb…

---

## [Persistant arrays (or parameters) to avoid re-allocation](https://discourse.julialang.org/t/persistant-arrays-or-parameters-to-avoid-re-allocation/60889)

<div class="topic-metadata">

**Author:** [@RGerzaguet](https://discourse.julialang.org/u/RGerzaguet)\
**Replies:** 4\
**Last updated:** [May 12, 2021, 11:59am UTC](https://discourse.julialang.org/t/persistant-arrays-or-parameters-to-avoid-re-allocation/60889 "2021-05-12T11:59:48Z")

</div>

Hello there I have a question on how we can avoid array re-allocation (without changing the API of a function) by making variables (and especially array) persistent from one function call to another, specialized on the …

---

## [Proper way to access large matrix in a matrix list](https://discourse.julialang.org/t/proper-way-to-access-large-matrix-in-a-matrix-list/60965)

<div class="topic-metadata">

**Author:** [@ZhiyuanYao](https://discourse.julialang.org/u/ZhiyuanYao)\
**Replies:** 12\
**Last updated:** [May 12, 2021, 11:42am UTC](https://discourse.julialang.org/t/proper-way-to-access-large-matrix-in-a-matrix-list/60965 "2021-05-12T11:42:37Z")

</div>

I have the following code snippet where eigvecs\_k is a global variable, of type Vector{Matrix{ComplexF64}} and consists two matrix of size 4300\*4300. basisN = 4300 function constructPsi!(coeffs\_k::Vector{Vector{ComplexF…

---

## [Set global markersize in Makie](https://discourse.julialang.org/t/set-global-markersize-in-makie/61007)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 9:31am UTC](https://discourse.julialang.org/t/set-global-markersize-in-makie/61007 "2021-05-12T09:31:47Z")

</div>

Is it possible to set an attribute like markersize globally? If yes, how so? I have tried activating a theme my\_theme = Theme(markersize=50) set\_theme!(my\_theme) but this does not change the marker size of my scatterp…

---

## [Abstract Types and StructTypes - error reading AbstractTypes into concrete with JSON3](https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897)

<div class="topic-metadata">

**Author:** [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Replies:** 14\
**Last updated:** [May 12, 2021, 9:30am UTC](https://discourse.julialang.org/t/abstract-types-and-structtypes-error-reading-abstracttypes-into-concrete-with-json3/60897 "2021-05-12T09:30:07Z")

</div>

Hi, Believe I am running into a bit of a bug / unexpected behaviour that I can’t seem to work around when extracting an interface into a concrete type having defined more than one in a module. e.g.: this works: using…

---

## [Set axis-label size in Makie](https://discourse.julialang.org/t/set-axis-label-size-in-makie/61006)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 1\
**Last updated:** [May 12, 2021, 8:24am UTC](https://discourse.julialang.org/t/set-axis-label-size-in-makie/61006 "2021-05-12T08:24:42Z")

</div>

How does one set the size of the xlabel and ylabel in Makie? That is, change the font-size that makes up the label. Can a size be set globally, or would one have to do it for each plot?

---

## [Gradient of latent space variable in Turing?](https://discourse.julialang.org/t/gradient-of-latent-space-variable-in-turing/60941)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 1\
**Last updated:** [May 12, 2021, 7:10am UTC](https://discourse.julialang.org/t/gradient-of-latent-space-variable-in-turing/60941 "2021-05-12T07:10:58Z")

</div>

I just started playing with Turing so this is probably a stupid question, is there an easy way (say for the purposes of inspecting my model) to get a posterior gradient of a latent space variable at fixed data? Here’s m…

---

## [Dispatch on plot recipe](https://discourse.julialang.org/t/dispatch-on-plot-recipe/60944)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 5:26am UTC](https://discourse.julialang.org/t/dispatch-on-plot-recipe/60944 "2021-05-12T05:26:08Z")

</div>

Hi, I have a problem with Plot recipe in Plots.jl. I have a plot for an abstracttype that I want to use for a concrete type. How can I do this? RecipesBase.@recipe function Plots(contres::AbstractBranchResult) # do…

---

## [Gridap.jl solution at mesh nodes?](https://discourse.julialang.org/t/gridap-jl-solution-at-mesh-nodes/60993)

<div class="topic-metadata">

**Author:** [@kc104](https://discourse.julialang.org/u/kc104)\
**Replies:** 0\
**Last updated:** [May 12, 2021, 2:41am UTC](https://discourse.julialang.org/t/gridap-jl-solution-at-mesh-nodes/60993 "2021-05-12T02:41:03Z")

</div>

I’m using Gridap.jl for some PDE work and would like to access the solution at the mesh nodes + the mesh coordinates in the form of a standard julia array (the end goal is to interpolate the solution at a new set of coor…

---

## [Usage of MbedTLS with TCP sockets](https://discourse.julialang.org/t/usage-of-mbedtls-with-tcp-sockets/60811)

<div class="topic-metadata">

**Author:** [@ligert123](https://discourse.julialang.org/u/ligert123)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 7:06am UTC](https://discourse.julialang.org/t/usage-of-mbedtls-with-tcp-sockets/60811 "2021-05-11T07:06:56Z")

</div>

Hello, i have been trying to setup an encrypted TCP server connection using MbedTLS and i have been having trouble getting it working. I keep receiving: MbedTLS error code -31104: SSL - Processing of the ServerHello han…

---

## [Testing RCall in CI](https://discourse.julialang.org/t/testing-rcall-in-ci/16832)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 1:44am UTC](https://discourse.julialang.org/t/testing-rcall-in-ci/16832 "2021-05-12T01:44:27Z")

</div>

I’m attempting to get CI working on a package that depends on RCall. I copied the initialization code in the RCall repo, but I’m still running into issues. As far as I can tell, there are two things: Pkg.build("Rcall"…

---

## [Literate programming style macros in Literate.jl or Weave.jl](https://discourse.julialang.org/t/literate-programming-style-macros-in-literate-jl-or-weave-jl/60967)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [May 11, 2021, 7:24pm UTC](https://discourse.julialang.org/t/literate-programming-style-macros-in-literate-jl-or-weave-jl/60967 "2021-05-11T19:24:35Z")

</div>

Dear All, Is there any way of implementing “literate programming style macro” in Literate.jl or Weave.jl? My goal is to write a tutorial-style literate program in a logical order for the human reader. For example: # He…

---

## [Thread-parallel reduce(vcat, ...) performance issues when providing init](https://discourse.julialang.org/t/thread-parallel-reduce-vcat-performance-issues-when-providing-init/60955)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 2\
**Last updated:** [May 11, 2021, 7:15pm UTC](https://discourse.julialang.org/t/thread-parallel-reduce-vcat-performance-issues-when-providing-init/60955 "2021-05-11T19:15:11Z")

</div>

Hey all— I’ve got a problem where I have a vec\_of\_vecs::Vector{Vector{T}} where the length is long and the length of each element is long. I’d love to use multithreading to do reduce(vcat, vec\_of\_vecs) more efficiently.…

---

## [Varargs function](https://discourse.julialang.org/t/varargs-function/60969)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 5:30pm UTC](https://discourse.julialang.org/t/varargs-function/60969 "2021-05-11T17:30:06Z")

</div>

Hi, I have a function that takes a variable number of arguments like the following: function view(vargs...) out = DataFrame(vargs) out end I want the ouput of view to be the same as if I was using DataFrame, examp…

---

## [Using the Sockets Library](https://discourse.julialang.org/t/using-the-sockets-library/60448)

<div class="topic-metadata">

**Author:** [@ligert123](https://discourse.julialang.org/u/ligert123)\
**Replies:** 13\
**Last updated:** [May 11, 2021, 4:32pm UTC](https://discourse.julialang.org/t/using-the-sockets-library/60448 "2021-05-11T16:32:58Z")

</div>

Hello, i have been having trouble with the sockets library. For some reason when i write to a connection it doesnt succeed and instead hangs. I have no idea why this is happening, would anyone else have a clue? functio…

---

## [Checking condition on matrix/array element-wise modulo an integer](https://discourse.julialang.org/t/checking-condition-on-matrix-array-element-wise-modulo-an-integer/60954)

<div class="topic-metadata">

**Author:** [@scipham](https://discourse.julialang.org/u/scipham)\
**Replies:** 0\
**Last updated:** [May 11, 2021, 2:05pm UTC](https://discourse.julialang.org/t/checking-condition-on-matrix-array-element-wise-modulo-an-integer/60954 "2021-05-11T14:05:47Z")

</div>

My aim is to check whether a matrix (i.e. a 2D array) modulo d is Symplectic (see condition on wikipedia: Symplectic matrix - Wikipedia). That is, whether there is any Symplectic matrix in the set of matrices that are el…

---

## [Julian way of writing a constructor](https://discourse.julialang.org/t/julian-way-of-writing-a-constructor/60943)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 2:18pm UTC](https://discourse.julialang.org/t/julian-way-of-writing-a-constructor/60943 "2021-05-11T14:18:12Z")

</div>

I have the following code: using StaticArrays # Type definitions const MyFloat = Float32 const Vec3 = MVector{3, MyFloat} mutable struct State v\_wind::Vec3 # wind vector at the height of the kite v\_w…

---

## [Why do we need to prefix module name with Julia function sometimes to make it work?](https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949)

<div class="topic-metadata">

**Author:** [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Replies:** 1\
**Last updated:** [May 11, 2021, 1:19pm UTC](https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949 "2021-05-11T13:19:21Z")

</div>

As example, here is a DateTime object declared below using Dates module: julia\> using Dates julia\> dt = DateTime(2021, 05, 11, 18, 21, 50) 2021-05-11T18:21:50 We can find the Hour value of dt simply using hour() funct…

---

## [Broadcast type mismatch](https://discourse.julialang.org/t/broadcast-type-mismatch/60848)

<div class="topic-metadata">

**Author:** [@cepheid](https://discourse.julialang.org/u/cepheid)\
**Replies:** 3\
**Last updated:** [May 10, 2021, 6:22am UTC](https://discourse.julialang.org/t/broadcast-type-mismatch/60848 "2021-05-10T06:22:15Z")

</div>

In the following code import Base: ^ struct cccbbb v::Matrix{Float64} end ^(cb::cccbbb, p::Int) = cb.v^p Base.Broadcast.broadcastable(cb::cccbbb) = Ref(cb) n = 5 r = LinRange(0.0, 10.0, 5) cb = cccbbb(rand(n,n)) …

---

## [DataFrames output is Latex when using in a notebook](https://discourse.julialang.org/t/dataframes-output-is-latex-when-using-in-a-notebook/60900)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 4\
**Last updated:** [May 10, 2021, 9:59pm UTC](https://discourse.julialang.org/t/dataframes-output-is-latex-when-using-in-a-notebook/60900 "2021-05-10T21:59:49Z")

</div>

Running a notebook within VSCode and seeing some problems with DataFrames. Might be a quick PR to detect the display? I am not entirely sure how the display stack works. Happy to help debug with someone.

---

## [\`touch\`ing package sources only works on Windows?](https://discourse.julialang.org/t/touch-ing-package-sources-only-works-on-windows/60903)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 16\
**Last updated:** [May 10, 2021, 9:56pm UTC](https://discourse.julialang.org/t/touch-ing-package-sources-only-works-on-windows/60903 "2021-05-10T21:56:51Z")

</div>

Win julia\> touch(pathof(GMT)) "C:\\\\Users\\\\joaqu\\\\.julia\\\\dev\\\\GMT\\\\src\\\\GMT.jl" Linux || Mac julia\> touch(pathof(GMT)) ERROR: IOError: open: permission denied (EACCES) but like this it does run(\`touch $(pathof(GMT))…

---

## [How to use TableView.jl in VSCode?](https://discourse.julialang.org/t/how-to-use-tableview-jl-in-vscode/44912)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 11\
**Last updated:** [May 10, 2021, 9:41pm UTC](https://discourse.julialang.org/t/how-to-use-tableview-jl-in-vscode/44912 "2021-05-10T21:41:24Z")

</div>

I can use TableView on Juno as just using TableView showtable((a=1:3, b =4:5)) But for VSCode this doesn’t work. I can’t use vscodedisplay as its performance is not as good as TableView’s for large datasets. Ideally,…

---

## [Make tab-explorable structure from nested Dict](https://discourse.julialang.org/t/make-tab-explorable-structure-from-nested-dict/57979)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 5\
**Last updated:** [May 10, 2021, 8:43pm UTC](https://discourse.julialang.org/t/make-tab-explorable-structure-from-nested-dict/57979 "2021-05-10T20:43:55Z")

</div>

For nothing but the sake of my own and potential users convenience when REPL:ing around, I’d like to turn a nested Dict with symbol keys into something which can be tab-completed all the way down to the leaves. I have m…

---

## [Relaunch the task bound to channel](https://discourse.julialang.org/t/relaunch-the-task-bound-to-channel/60777)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 2\
**Last updated:** [May 10, 2021, 7:46pm UTC](https://discourse.julialang.org/t/relaunch-the-task-bound-to-channel/60777 "2021-05-10T19:46:29Z")

</div>

Is it possible to relaunch a task bound to a channel so that the data can be recollected from the channel?. Here is a MWE: julia\> ch = Channel(0) do ch for i in 1 : 5 put!(ch, i) end end C…

---

## [Quantiles Dirichlet distribution](https://discourse.julialang.org/t/quantiles-dirichlet-distribution/60908)

<div class="topic-metadata">

**Author:** [@Dan.phi](https://discourse.julialang.org/u/Dan.phi)\
**Replies:** 1\
**Last updated:** [May 10, 2021, 6:50pm UTC](https://discourse.julialang.org/t/quantiles-dirichlet-distribution/60908 "2021-05-10T18:50:10Z")

</div>

I am trying to compute quantiles of the Dirichlet distribution using Distributions, but I am getting this error: julia\> quantile(Dirichlet(\[1,1,1\]), 0.5) ERROR: MethodError: no method matching iterate(::Dirichlet{Float6…

---

## [Can you use a module inside another module?](https://discourse.julialang.org/t/can-you-use-a-module-inside-another-module/60899)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 2\
**Last updated:** [May 10, 2021, 5:51pm UTC](https://discourse.julialang.org/t/can-you-use-a-module-inside-another-module/60899 "2021-05-10T17:51:35Z")

</div>

I have a file structure like this code - Folder -- GameObjects.jl -- Characters.jl I want to use GameObjects inside Characters.jl but I get GameObjects not defined when I do: # Characters.jl module Characters using .G…

---

## [Installing packages from github runs forever on Windows, is it possible to change the source to pkg.julialang?](https://discourse.julialang.org/t/installing-packages-from-github-runs-forever-on-windows-is-it-possible-to-change-the-source-to-pkg-julialang/60836)

<div class="topic-metadata">

**Author:** [@ramdhanhdy](https://discourse.julialang.org/u/ramdhanhdy)\
**Replies:** 1\
**Last updated:** [May 10, 2021, 5:48pm UTC](https://discourse.julialang.org/t/installing-packages-from-github-runs-forever-on-windows-is-it-possible-to-change-the-source-to-pkg-julialang/60836 "2021-05-10T17:48:10Z")

</div>

I have been having a hard time intalling packages from my Windows 10 laptop. The install process is not really reliable. I have turned off the windows defender firewall and the installation still stuck. I read somewh…

---

## [Loops with arrays of arbitrary dimensions](https://discourse.julialang.org/t/loops-with-arrays-of-arbitrary-dimensions/60890)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 10\
**Last updated:** [May 10, 2021, 3:51pm UTC](https://discourse.julialang.org/t/loops-with-arrays-of-arbitrary-dimensions/60890 "2021-05-10T15:51:15Z")

</div>

Assume that I have a 2D array A and I want to do something like this N1, N2 = 4, 3 A = ones((N1, N2)) x = zeros(N1) for i2=1:N2 for i1=1:N1 x\[i1\] = 2 \* A\[i1, i2\] end end x = zeros(N2) for i1=1:N1 f…

---

## [PlotlyJS: how to change the default labels of variables](https://discourse.julialang.org/t/plotlyjs-how-to-change-the-default-labels-of-variables/60798)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 7\
**Last updated:** [May 10, 2021, 2:57pm UTC](https://discourse.julialang.org/t/plotlyjs-how-to-change-the-default-labels-of-variables/60798 "2021-05-10T14:57:25Z")

</div>

I have a kind of stupid question: how can we change the automatic labels of variables under PlotlyJS.jl? In the figure below, the names given by default are trace 0, trace 1 ,... , when instead I want GDP, INV, CONS and E…

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

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