# General Usage

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

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

**Page:** 703

---

## [How do I publish documenter.jl-generated docs to a subdirectory of a custom subddomain?](https://discourse.julialang.org/t/how-do-i-publish-documenter-jl-generated-docs-to-a-subdirectory-of-a-custom-subddomain/46602)

<div class="topic-metadata">

**Author:** [@vlandau](https://discourse.julialang.org/u/vlandau)\
**Replies:** 1\
**Last updated:** [September 14, 2020, 8:46pm UTC](https://discourse.julialang.org/t/how-do-i-publish-documenter-jl-generated-docs-to-a-subdirectory-of-a-custom-subddomain/46602 "2020-09-14T20:46:47Z")

</div>

My github organization is hoping to serve docs for two Julia packages on a subdomain, docs.circuitscape.org. If you visit that page, you’ll see that currently it just shows the docs for one package, Omniscape.jl, but we …

---

## [Passing strings from Matlab to Julia and back using Sockets](https://discourse.julialang.org/t/passing-strings-from-matlab-to-julia-and-back-using-sockets/46589)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 4\
**Last updated:** [September 14, 2020, 8:09pm UTC](https://discourse.julialang.org/t/passing-strings-from-matlab-to-julia-and-back-using-sockets/46589 "2020-09-14T20:09:02Z")

</div>

I needed a simple communication channel between Matlab and Julia. Maybe this will help someone, so here’s the code (spoiler alert, everything is an ascii character): ## Matlab to Julia TCPIP communication example # Jul…

---

## [Low-cost abstractions for C library wrappers](https://discourse.julialang.org/t/low-cost-abstractions-for-c-library-wrappers/46592)

<div class="topic-metadata">

**Author:** [@serenity4](https://discourse.julialang.org/u/serenity4)\
**Replies:** 5\
**Last updated:** [September 14, 2020, 7:23pm UTC](https://discourse.julialang.org/t/low-cost-abstractions-for-c-library-wrappers/46592 "2020-09-14T19:23:48Z")

</div>

Hi, As I am experimenting several ways to abstract over C libraries wrapped with Clang with minimal overhead, I am starting to wonder whether Julia is a good fit for this kind of thing if one wants to preserve performan…

---

## [Numerical optimization function does not get cached](https://discourse.julialang.org/t/numerical-optimization-function-does-not-get-cached/46373)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 4\
**Last updated:** [September 14, 2020, 6:19pm UTC](https://discourse.julialang.org/t/numerical-optimization-function-does-not-get-cached/46373 "2020-09-14T18:19:06Z")

</div>

I have an application with a number of image analysis functions based on LeastSquaresOptim.jl. The application has to be re-started often, unfortunately — maybe a topic for another post. Every time the application is ran…

---

## [Question about comprehensions](https://discourse.julialang.org/t/question-about-comprehensions/46595)

<div class="topic-metadata">

**Author:** [@EmadMasroor](https://discourse.julialang.org/u/EmadMasroor)\
**Replies:** 6\
**Last updated:** [September 14, 2020, 5:22pm UTC](https://discourse.julialang.org/t/question-about-comprehensions/46595 "2020-09-14T17:22:45Z")

</div>

I have found Julia’s comprehensions to be one of its most useful features, but I am running into a problem which I hope someone can help me out with. Let’s say I have an array of size N x 10 in a variable named data, wh…

---

## [PackageCompiler uses no paralelism](https://discourse.julialang.org/t/packagecompiler-uses-no-paralelism/46590)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [September 14, 2020, 3:22pm UTC](https://discourse.julialang.org/t/packagecompiler-uses-no-paralelism/46590 "2020-09-14T15:22:12Z")

</div>

I’m finally learning to use PackageCompiler, things seem to be working great so far. I just noticed that at the “creating system image object file” step building an app for my project there seems to be no parallelism. I …

---

## [Several packages won't precompile after update](https://discourse.julialang.org/t/several-packages-wont-precompile-after-update/46580)

<div class="topic-metadata">

**Author:** [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Replies:** 1\
**Last updated:** [September 14, 2020, 12:44pm UTC](https://discourse.julialang.org/t/several-packages-wont-precompile-after-update/46580 "2020-09-14T12:44:23Z")

</div>

Hi all, After I updated all packages this morning, several packages (e.g., Gadfly, Optim, KernelDensity) refuse to pre-compile, all giving the following error: LoadError: UndefVarError: @printf not defined I deleted t…

---

## [Is slurpping typed keyword args invalid?](https://discourse.julialang.org/t/is-slurpping-typed-keyword-args-invalid/46568)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 3\
**Last updated:** [September 14, 2020, 7:32am UTC](https://discourse.julialang.org/t/is-slurpping-typed-keyword-args-invalid/46568 "2020-09-14T07:32:39Z")

</div>

Slurrping keyword args is a fairly common usage: julia\> foo(; x...) = 1 foo (generic function with 1 method) julia\> foo() 1 But, if I annotate with type, then this function becomes non-callable… julia\> bar(; x::Int..…

---

## [Using Threads@threads loop with my own rng](https://discourse.julialang.org/t/using-threads-threads-loop-with-my-own-rng/46567)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 1\
**Last updated:** [September 14, 2020, 4:06am UTC](https://discourse.julialang.org/t/using-threads-threads-loop-with-my-own-rng/46567 "2020-09-14T04:06:10Z")

</div>

How do I create and pass rng’s to a multi-threaded loop safely? For example, the following code will fail with large K. function thread\_samples(K) rng = MersenneTwister(1) samples = zeros(Int64, K) Threads.@…

---

## [VS Code Julia -- inline detail is not shown after execution](https://discourse.julialang.org/t/vs-code-julia-inline-detail-is-not-shown-after-execution/46284)

<div class="topic-metadata">

**Author:** [@psabela](https://discourse.julialang.org/u/psabela)\
**Replies:** 3\
**Last updated:** [September 14, 2020, 4:01am UTC](https://discourse.julialang.org/t/vs-code-julia-inline-detail-is-not-shown-after-execution/46284 "2020-09-14T04:01:35Z")

</div>

How do I get the extra inline detail to the right of the following statement after execution: cars = dataset(“cars”) |406x9 Vega dataset

---

## [Performance improvements for simple molecular surface caclulation](https://discourse.julialang.org/t/performance-improvements-for-simple-molecular-surface-caclulation/46514)

<div class="topic-metadata">

**Author:** [@v-a-s-a](https://discourse.julialang.org/u/v-a-s-a)\
**Replies:** 15\
**Last updated:** [September 14, 2020, 12:29am UTC](https://discourse.julialang.org/t/performance-improvements-for-simple-molecular-surface-caclulation/46514 "2020-09-14T00:29:08Z")

</div>

I have a fairly straightforward calculation I’ve been playing around with, and it seems like a good opportunity to learn a little more about typical optimizations people reach for, as well as coding style. At the core, …

---

## [Is there any overhead through too many threads?](https://discourse.julialang.org/t/is-there-any-overhead-through-too-many-threads/46559)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 7\
**Last updated:** [September 13, 2020, 9:42pm UTC](https://discourse.julialang.org/t/is-there-any-overhead-through-too-many-threads/46559 "2020-09-13T21:42:39Z")

</div>

Hi everyone, sorry if this has already been answered somewhere, but my quick search didn’t really give me an answer. I was wondering if there is any possible performance regression when setting JULIA\_NUM\_THREADS larger…

---

## [Julia-1.5.1 build error on ubuntu-mate](https://discourse.julialang.org/t/julia-1-5-1-build-error-on-ubuntu-mate/46542)

<div class="topic-metadata">

**Author:** [@vadrer](https://discourse.julialang.org/u/vadrer)\
**Replies:** 3\
**Last updated:** [September 13, 2020, 7:29pm UTC](https://discourse.julialang.org/t/julia-1-5-1-build-error-on-ubuntu-mate/46542 "2020-09-13T19:29:02Z")

</div>

I have build error when trying to build latest 1.5.1 on ubuntu Linux vad-1025C 5.3.0-61-generic #55~18.04.1-Ubuntu SMP Mon Jun 22 16:40:46 UTC 2020 i686 i686 i686 GNU/Linux vad@vad-1025C:~/julia/julia-1.5.1$ make Warnin…

---

## [How to find out why packages are downgraded](https://discourse.julialang.org/t/how-to-find-out-why-packages-are-downgraded/46513)

<div class="topic-metadata">

**Author:** [@grahamstark](https://discourse.julialang.org/u/grahamstark)\
**Replies:** 2\
**Last updated:** [September 13, 2020, 6:23pm UTC](https://discourse.julialang.org/t/how-to-find-out-why-packages-are-downgraded/46513 "2020-09-13T18:23:38Z")

</div>

Hi, I’ve just run \]up and found some large downgrades to packages I care about, for example: \[70588ee8\] ↓ CSSUtil v0.1.1 ⇒ v0.1.0 \[336ed68f\] ↓ CSV v0.7.7 ⇒ v0.6.1 \[5d742f6a\] ↓ CSVFiles v1.0.0 ⇒ v0.16.1 \[324d7…

---

## [CartesianIndices overhead](https://discourse.julialang.org/t/cartesianindices-overhead/46461)

<div class="topic-metadata">

**Author:** [@Benjia](https://discourse.julialang.org/u/Benjia)\
**Replies:** 9\
**Last updated:** [September 13, 2020, 4:29pm UTC](https://discourse.julialang.org/t/cartesianindices-overhead/46461 "2020-09-13T16:29:19Z")

</div>

I’ve been experimenting with the techniques described here Multidimensional algorithms and iteration for writing some generic multi-dimensional operations. Let’s look at a nan-skipping sum: function nansum!(B, A) #…

---

## [Frequency counts on a square lattice](https://discourse.julialang.org/t/frequency-counts-on-a-square-lattice/46533)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 6\
**Last updated:** [September 13, 2020, 3:29pm UTC](https://discourse.julialang.org/t/frequency-counts-on-a-square-lattice/46533 "2020-09-13T15:29:31Z")

</div>

I have a square array, c, with integer entries that I expect to repeat. I would like to get frequency counts on the different indices, as they represent categorical data. I was wondering what might be the most efficien…

---

## [Allocation on ForwardDiff + DiffResults + StaticArrays](https://discourse.julialang.org/t/allocation-on-forwarddiff-diffresults-staticarrays/46534)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 2\
**Last updated:** [September 13, 2020, 2:09pm UTC](https://discourse.julialang.org/t/allocation-on-forwarddiff-diffresults-staticarrays/46534 "2020-09-13T14:09:12Z")

</div>

Im hunting down an allocation on DiffResults + ForwardDiff + StaticArrays. this is the MWE: using ForwardDiff, DiffResults, StaticArrays, BenchmarkTools fff(v1,v2) = sin(v1)+cos(v2)+exp(v1+log(v2+cos(v1))) function ∂tes…

---

## [Why won't Julia let me put a module import within a function?](https://discourse.julialang.org/t/why-wont-julia-let-me-put-a-module-import-within-a-function/46504)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 7\
**Last updated:** [September 13, 2020, 11:33am UTC](https://discourse.julialang.org/t/why-wont-julia-let-me-put-a-module-import-within-a-function/46504 "2020-09-13T11:33:06Z")

</div>

I just created the function: function operats() using GLPK using Clp using JuMP using Hungarian end and to my surprise this gave me the error: ERROR: syntax: "using" expression not at top level The re…

---

## [Speed of plotting using PlotlyJS](https://discourse.julialang.org/t/speed-of-plotting-using-plotlyjs/45937)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 6\
**Last updated:** [September 13, 2020, 10:03am UTC](https://discourse.julialang.org/t/speed-of-plotting-using-plotlyjs/45937 "2020-09-13T10:03:09Z")

</div>

Is it normal that plotting using PlotlyJS takes 2-5 sec? using PlotlyJS plot(heatmap(z = rand(2000, 1000)))

---

## [Save variables to .mat file or .jld2 file by metaprogramming](https://discourse.julialang.org/t/save-variables-to-mat-file-or-jld2-file-by-metaprogramming/46471)

<div class="topic-metadata">

**Author:** [@Logic\_Logical](https://discourse.julialang.org/u/Logic_Logical)\
**Replies:** 4\
**Last updated:** [September 13, 2020, 1:24am UTC](https://discourse.julialang.org/t/save-variables-to-mat-file-or-jld2-file-by-metaprogramming/46471 "2020-09-13T01:24:23Z")

</div>

Here is a normal code to save variables to mat file (no variable name modification) using FileIO, MAT a = 1 b = 2 c = 3 matwrite("savemat.mat", Dict("a" =\> a,"b" =\> b, "c" =\> c)) The question is: How can I write a func…

---

## [Does Julia have "unlikely" hint similar to in C++ or a way to fix code generation here](https://discourse.julialang.org/t/does-julia-have-unlikely-hint-similar-to-in-c-or-a-way-to-fix-code-generation-here/46528)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 6\
**Last updated:** [September 13, 2020, 1:19am UTC](https://discourse.julialang.org/t/does-julia-have-unlikely-hint-similar-to-in-c-or-a-way-to-fix-code-generation-here/46528 "2020-09-13T01:19:21Z")

</div>

https://en.cppreference.com/w/cpp/language/attributes/likely I’m trying to get the division first, but the Julia code generation puts vdivsd %xmm0, %xmm1, %xmm1 very late: \_sinc\_threshold(::Type{Float64}) = 0.001 @inl…

---

## [Help with simplified StaticArrays implementation](https://discourse.julialang.org/t/help-with-simplified-staticarrays-implementation/45522)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 16\
**Last updated:** [September 12, 2020, 9:25pm UTC](https://discourse.julialang.org/t/help-with-simplified-staticarrays-implementation/45522 "2020-09-12T21:25:02Z")

</div>

Poblem: StaticArrays.jl is too large of a dependency and has too many extra features. To simplify my dependencies, I need a simplified variant of SVector, MVector, and SizedVector. Solution: In AbstractTensors.jl they…

---

## [Rand() vs rand(rng)](https://discourse.julialang.org/t/rand-vs-rand-rng/46517)

<div class="topic-metadata">

**Author:** [@steve1313](https://discourse.julialang.org/u/steve1313)\
**Replies:** 4\
**Last updated:** [September 12, 2020, 7:20pm UTC](https://discourse.julialang.org/t/rand-vs-rand-rng/46517 "2020-09-12T19:20:22Z")

</div>

Hello. Why is rand(rng) ten times slower than rand() ? See code below: julia\> using Random julia\> rng = MersenneTwister(12345); julia\> function test() t0=time() x=0.0; for k=1:100000000 x+=rand(rng) end x,time…

---

## [New array from a sum of N values in array A?](https://discourse.julialang.org/t/new-array-from-a-sum-of-n-values-in-array-a/46496)

<div class="topic-metadata">

**Author:** [@SEnergy](https://discourse.julialang.org/u/SEnergy)\
**Replies:** 8\
**Last updated:** [September 12, 2020, 2:24pm UTC](https://discourse.julialang.org/t/new-array-from-a-sum-of-n-values-in-array-a/46496 "2020-09-12T14:24:58Z")

</div>

I’m sorry if the title is a little bit misleading, but I’m having trouble explaining it in one sentence Assume I have an array A A = \[1, 2, 3, 4, 5\]; What I want is to create an array B that will contain sums of every…

---

## [Garbage collecting SharedArrays](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510)

<div class="topic-metadata">

**Author:** [@atteson](https://discourse.julialang.org/u/atteson)\
**Replies:** 1\
**Last updated:** [September 12, 2020, 3:33pm UTC](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510 "2020-09-12T15:33:43Z")

</div>

I’ve been using some very large SharedArrays. Occasionally, my code allocates one which it wants only for the duration of a function call. However, they don’t seem to be freed and the machine eventually runs out of mem…

---

## [How to get axis rotations from UnitQuaternion in Rotations.jl](https://discourse.julialang.org/t/how-to-get-axis-rotations-from-unitquaternion-in-rotations-jl/46490)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 2\
**Last updated:** [September 12, 2020, 3:12pm UTC](https://discourse.julialang.org/t/how-to-get-axis-rotations-from-unitquaternion-in-rotations-jl/46490 "2020-09-12T15:12:46Z")

</div>

How do I get axis (X, Y, Z) rotations from UnitQuaternion? julia\> RotXYZ(UnitQuaternion(RotX(1))) 3×3 RotXYZ{Float64} with indices SOneTo(3)×SOneTo(3)(1.0, 0.0, 0.0): 1.0 -0.0 0.0 0.0 0.540302 -0.841471 0.…

---

## [Can't install Any new package](https://discourse.julialang.org/t/cant-install-any-new-package/46509)

<div class="topic-metadata">

**Author:** [@Nitish\_Dubey](https://discourse.julialang.org/u/Nitish_Dubey)\
**Replies:** 2\
**Last updated:** [September 12, 2020, 2:48pm UTC](https://discourse.julialang.org/t/cant-install-any-new-package/46509 "2020-09-12T14:48:32Z")

</div>

I am unable to install any new package whenever I’m trying to install one getting the following error. \` Resolving package versions... ERROR: Unsatisfiable requirements detected for package LightXML \[9c8b4983\]: LightXM…

---

## [Downgraded packages](https://discourse.julialang.org/t/downgraded-packages/46508)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 2\
**Last updated:** [September 12, 2020, 2:32pm UTC](https://discourse.julialang.org/t/downgraded-packages/46508 "2020-09-12T14:32:49Z")

</div>

So I did an update to my packages, and something else I have installed caused Plots.jl to go way back to version v0.28.4. I was wondering if there’s a way I can figure out what other packages I have installed that’s cau…

---

## [How to default to empty string if variable unspecified to a function](https://discourse.julialang.org/t/how-to-default-to-empty-string-if-variable-unspecified-to-a-function/46500)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 6\
**Last updated:** [September 12, 2020, 9:59am UTC](https://discourse.julialang.org/t/how-to-default-to-empty-string-if-variable-unspecified-to-a-function/46500 "2020-09-12T09:59:51Z")

</div>

I’d love to use Julia as a replacement for my Unix shell at least some of the time so that I can become more familiar and comfortable with the language. One function I’m having trouble defining is: function vjus(path) …

---

## [Is there a GPU optimized \`Distances\` package?](https://discourse.julialang.org/t/is-there-a-gpu-optimized-distances-package/46434)

<div class="topic-metadata">

**Author:** [@yiyuezhuo](https://discourse.julialang.org/u/yiyuezhuo)\
**Replies:** 4\
**Last updated:** [September 12, 2020, 1:49am UTC](https://discourse.julialang.org/t/is-there-a-gpu-optimized-distances-package/46434 "2020-09-12T01:49:21Z")

</div>

I wonder if there is a package which implements Distances.jl’s interface with CUDA.AbstractGPUArray type to leverage GPU acceleration. I found those issues: https://github.com/JuliaStats/Distances.jl/issues/143 https:/…

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

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