# General Usage

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

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

**Page:** 415

---

## [Why does a macro fail if passed constructed symbols as arguments?](https://discourse.julialang.org/t/why-does-a-macro-fail-if-passed-constructed-symbols-as-arguments/85221)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 0\
**Last updated:** [August 3, 2022, 11:26am UTC](https://discourse.julialang.org/t/why-does-a-macro-fail-if-passed-constructed-symbols-as-arguments/85221 "2022-08-03T11:26:56Z")

</div>

This code works produces a nice chart: using DataFrames, StatsPlots df = DataFrame(A = rand(20), C = repeat(\[1,2,3, 4\], inner = 5)) plt\_dens1 = @df df density( :A, group = :C, title = "This works" ) If th…

---

## [How to represent mixture state with cgrad in plots.jl](https://discourse.julialang.org/t/how-to-represent-mixture-state-with-cgrad-in-plots-jl/84706)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 16\
**Last updated:** [August 3, 2022, 11:21am UTC](https://discourse.julialang.org/t/how-to-represent-mixture-state-with-cgrad-in-plots-jl/84706 "2022-08-03T11:21:32Z")

</div>

Hi all, I am working with a model that could be classified as a hidden semi-Markov model. The hidden state is not observable, but it could be estimated from the model and displayed graphically. I am interested in repre…

---

## [Problem with precompiling HTTP and LiveServer](https://discourse.julialang.org/t/problem-with-precompiling-http-and-liveserver/85184)

<div class="topic-metadata">

**Author:** [@paniash](https://discourse.julialang.org/u/paniash)\
**Replies:** 4\
**Last updated:** [August 3, 2022, 8:11am UTC](https://discourse.julialang.org/t/problem-with-precompiling-http-and-liveserver/85184 "2022-08-03T08:11:41Z")

</div>

Hi everyone! I’m trying to install HTTP and LiveServer in my default environment but I seem to be getting the following error message: (@v1.7) pkg\> add HTTP Installing known registries into \`~/.julia\` Updating re…

---

## [Memory on array element assignment](https://discourse.julialang.org/t/memory-on-array-element-assignment/85069)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 10\
**Last updated:** [August 3, 2022, 6:53am UTC](https://discourse.julialang.org/t/memory-on-array-element-assignment/85069 "2022-08-03T06:53:40Z")

</div>

I am writing some sort of histogramming function and am having trouble with bad performance due to dynamic allocations in each assignment. It boils down to the following simple problem: julia\> a=zeros(UInt16,1000000); …

---

## [Vectors Addition only work with initial (0,0)?](https://discourse.julialang.org/t/vectors-addition-only-work-with-initial-0-0/85144)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [August 3, 2022, 5:51am UTC](https://discourse.julialang.org/t/vectors-addition-only-work-with-initial-0-0/85144 "2022-08-03T05:51:33Z")

</div>

Hi all, I have been learning from this site: https://docs.juliahub.com/CalculusWithJulia/AZHbv/0.0.5/differentiable\_vector\_calculus/vectors.html# then I change the initial point and see the second vector is not in the…

---

## [Generating all string possibilities with wildcard characters? (code golf-based)](https://discourse.julialang.org/t/generating-all-string-possibilities-with-wildcard-characters-code-golf-based/85209)

<div class="topic-metadata">

**Author:** [@mostol](https://discourse.julialang.org/u/mostol)\
**Replies:** 1\
**Last updated:** [August 3, 2022, 12:22am UTC](https://discourse.julialang.org/t/generating-all-string-possibilities-with-wildcard-characters-code-golf-based/85209 "2022-08-03T00:22:11Z")

</div>

I ran into this code golf problem on StackExchange. The premise is that you take in a short string with some wildcard characters (\*) and return all of the possible variations of that string, replacing the wildcards with …

---

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

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 10\
**Last updated:** [August 2, 2022, 11:30pm UTC](https://discourse.julialang.org/t/appending-a-matrix-to-a-vector-of-matrices/85191 "2022-08-02T23:30:43Z")

</div>

I have a long list (vector) of matrices. They are size 3xn where n is typically 1 \< n \< 7. My long list typically varies between 100K and 1 million. My task is to reduce this list using a rather complicated and expensive…

---

## [How to export this type of vector](https://discourse.julialang.org/t/how-to-export-this-type-of-vector/85139)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 13\
**Last updated:** [August 2, 2022, 10:04pm UTC](https://discourse.julialang.org/t/how-to-export-this-type-of-vector/85139 "2022-08-02T22:04:37Z")

</div>

how to export this type of vector locally, so i can call this vector as when i want, please tell me asap. thank YOU.

---

## [Numerical inaccuracies when constructing correlation matrices](https://discourse.julialang.org/t/numerical-inaccuracies-when-constructing-correlation-matrices/85177)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 6\
**Last updated:** [August 2, 2022, 9:59pm UTC](https://discourse.julialang.org/t/numerical-inaccuracies-when-constructing-correlation-matrices/85177 "2022-08-02T21:59:56Z")

</div>

I’m trying to sample correlation matrices using the vine method explained here: How to generate a large full-rank random correlation matrix with some strong correlations present? - Cross Validated (which is based on the…

---

## [How to output selective elements from Matrix?](https://discourse.julialang.org/t/how-to-output-selective-elements-from-matrix/85110)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 11\
**Last updated:** [August 2, 2022, 7:29pm UTC](https://discourse.julialang.org/t/how-to-output-selective-elements-from-matrix/85110 "2022-08-02T19:29:36Z")

</div>

I have the below configuration. I am trying to output selective elements from matrix L.sl based on values of L.Seg. More specifically, I want to write syntax such as L.sl\[L.Seg\] to give me the same results as S. Any simp…

---

## [Precompile statements files vs Precompile excecution files](https://discourse.julialang.org/t/precompile-statements-files-vs-precompile-excecution-files/77741)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 4:57pm UTC](https://discourse.julialang.org/t/precompile-statements-files-vs-precompile-excecution-files/77741 "2022-08-02T16:57:35Z")

</div>

On the VSCode page on sysimages, one can find the following example content of ./.vscode/JuliaSysimage.toml \[sysimage\] exclude=\[\] # Additional packages to be exlucded in the system image statements\_files=\[\] # Precomp…

---

## [Primitive type with 2 bits](https://discourse.julialang.org/t/primitive-type-with-2-bits/85095)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 4\
**Last updated:** [August 2, 2022, 2:49pm UTC](https://discourse.julialang.org/t/primitive-type-with-2-bits/85095 "2022-08-02T14:49:55Z")

</div>

I have a very large matrix (with millions of rows) which obviously uses a lot of memory. Each of its entry it is either 0, 1 or 2. At the moment, the matrix has type Array{Int8,2} but 2 bits per entry would suffice, and …

---

## [Custom broadcasting for static, immutable type](https://discourse.julialang.org/t/custom-broadcasting-for-static-immutable-type/69426)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [August 2, 2022, 2:35pm UTC](https://discourse.julialang.org/t/custom-broadcasting-for-static-immutable-type/69426 "2022-08-02T14:35:45Z")

</div>

Consider the following type with two fields, using StaticArrays struct Foo{T,N} x::T y::SVector{N,T} end The objective is to make broadcasting work for matching dimension N and scalars, error for everything …

---

## [In \`StatsBase.jl\`, is it possible for \`sample\` to not return vectors?](https://discourse.julialang.org/t/in-statsbase-jl-is-it-possible-for-sample-to-not-return-vectors/85164)

<div class="topic-metadata">

**Author:** [@drelatgithub](https://discourse.julialang.org/u/drelatgithub)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 2:34pm UTC](https://discourse.julialang.org/t/in-statsbase-jl-is-it-possible-for-sample-to-not-return-vectors/85164 "2022-08-02T14:34:28Z")

</div>

In StatsBase.jl, using sample function with many samples returns a vector with all the sample results. I might be overlooking the documents, but I’m looking for a way to “consume” each sample result in-place without buil…

---

## [Gradient Descent, each datapoint is an array, in Flux](https://discourse.julialang.org/t/gradient-descent-each-datapoint-is-an-array-in-flux/85158)

<div class="topic-metadata">

**Author:** [@Rohan\_Rajagopal](https://discourse.julialang.org/u/Rohan_Rajagopal)\
**Replies:** 0\
**Last updated:** [August 2, 2022, 12:10pm UTC](https://discourse.julialang.org/t/gradient-descent-each-datapoint-is-an-array-in-flux/85158 "2022-08-02T12:10:01Z")

</div>

I have been trying to use Flux.jl library for simple Machine learning. But in my case, my each data point is an array of some fixed length greater than 1000. And so I haven’t been able to convert the following basic grad…

---

## [Advice on smart multi-threading to minimize calling an expensive function](https://discourse.julialang.org/t/advice-on-smart-multi-threading-to-minimize-calling-an-expensive-function/85152)

<div class="topic-metadata">

**Author:** [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)\
**Replies:** 0\
**Last updated:** [August 2, 2022, 9:31am UTC](https://discourse.julialang.org/t/advice-on-smart-multi-threading-to-minimize-calling-an-expensive-function/85152 "2022-08-02T09:31:53Z")

</div>

Hey all! :slight\_smile: I have been struggling a few days now on how to approach this. I have a set of query arrays and a set of reference arrays and I want to compare them. I do this via an index, which is expensive to…

---

## [How to plot quiver plot over heatmap](https://discourse.julialang.org/t/how-to-plot-quiver-plot-over-heatmap/66000)

<div class="topic-metadata">

**Author:** [@meck](https://discourse.julialang.org/u/meck)\
**Replies:** 3\
**Last updated:** [August 2, 2022, 11:23am UTC](https://discourse.julialang.org/t/how-to-plot-quiver-plot-over-heatmap/66000 "2022-08-02T11:23:40Z")

</div>

I am trying to plot a quiver plot (a vector field) over a heatmap. My only reference after one day of research is this old notebook: https://github.com/JuliaPlots/ExamplePlots.jl/blob/master/notebooks/quiver.ipynb My fu…

---

## [Different performance between reduce(map()) and mapreduce()](https://discourse.julialang.org/t/different-performance-between-reduce-map-and-mapreduce/85149)

<div class="topic-metadata">

**Author:** [@gwlagerweij](https://discourse.julialang.org/u/gwlagerweij)\
**Replies:** 7\
**Last updated:** [August 2, 2022, 10:55am UTC](https://discourse.julialang.org/t/different-performance-between-reduce-map-and-mapreduce/85149 "2022-08-02T10:55:01Z")

</div>

Hi all, I want to create an array of indices (for creation of a sparse matrix in a later stage) based on a list of element connectivity as follows: N = 10000; # Number of elements ele…

---

## [How to open graph in new window in vs code](https://discourse.julialang.org/t/how-to-open-graph-in-new-window-in-vs-code/85155)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 1\
**Last updated:** [August 2, 2022, 10:54am UTC](https://discourse.julialang.org/t/how-to-open-graph-in-new-window-in-vs-code/85155 "2022-08-02T10:54:14Z")

</div>

how to open graph in new window in vs code

---

## [Cylinder contact detection](https://discourse.julialang.org/t/cylinder-contact-detection/85145)

<div class="topic-metadata">

**Author:** [@frogdog](https://discourse.julialang.org/u/frogdog)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 9:37am UTC](https://discourse.julialang.org/t/cylinder-contact-detection/85145 "2022-08-02T09:37:33Z")

</div>

Is there a package that deals with contact search/contact detection? I want to check for collision between two 3D cylinders, and there are a bunch of edge cases that are a bit tricky to code, so I was hoping there exist…

---

## [Call graph generator for Julia](https://discourse.julialang.org/t/call-graph-generator-for-julia/5822)

<div class="topic-metadata">

**Author:** [@Marek\_Kukan](https://discourse.julialang.org/u/Marek_Kukan)\
**Replies:** 7\
**Last updated:** [August 2, 2022, 8:52am UTC](https://discourse.julialang.org/t/call-graph-generator-for-julia/5822 "2022-08-02T08:52:31Z")

</div>

Is there a tool for generating call graph from Julia source code files? Something like this:

---

## [Plot Vectors with CalculusWithJulia Package is not Working in JupyterNotebook](https://discourse.julialang.org/t/plot-vectors-with-calculuswithjulia-package-is-not-working-in-jupyternotebook/85053)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 13\
**Last updated:** [August 2, 2022, 7:33am UTC](https://discourse.julialang.org/t/plot-vectors-with-calculuswithjulia-package-is-not-working-in-jupyternotebook/85053 "2022-08-02T07:33:10Z")

</div>

Hi all, I am using CalculusWithJulia, it works and showing the plot of vectors addition when I use the REPL. But when I use Jupyter Notebook, it does not work. I install the sympy by pip install sympy but it is not rec…

---

## [Is there a package to list memory consumption of selected data objects?](https://discourse.julialang.org/t/is-there-a-package-to-list-memory-consumption-of-selected-data-objects/85019)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 14\
**Last updated:** [August 2, 2022, 6:16am UTC](https://discourse.julialang.org/t/is-there-a-package-to-list-memory-consumption-of-selected-data-objects/85019 "2022-08-02T06:16:27Z")

</div>

I could use a package that could look at a variable and compute the true memory used by the pointed-to data object. Is there anything like this?

---

## [TensorsOperations, lookups and functions](https://discourse.julialang.org/t/tensorsoperations-lookups-and-functions/85140)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 6:00am UTC](https://discourse.julialang.org/t/tensorsoperations-lookups-and-functions/85140 "2022-08-02T06:00:17Z")

</div>

is there functionality like TensorOperations that supports functions and named lookups? I have an array of deals. Each specifies a curve, and needs to be valued over many simulated iterations of the curve. I’d like to w…

---

## [How to Draw Pie Chart in this Subplots with PyplotJS?](https://discourse.julialang.org/t/how-to-draw-pie-chart-in-this-subplots-with-pyplotjs/85033)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 5:16am UTC](https://discourse.julialang.org/t/how-to-draw-pie-chart-in-this-subplots-with-pyplotjs/85033 "2022-08-02T05:16:24Z")

</div>

Hi all, I see this source https://plotly.com/julia/mixed-subplots/ This is my code (the pie chart is not working): using PlotlyJS, CSV, DataFrames, HTTP df = CSV.read("/home/browni/LasthrimProjection/csv/countrieshi…

---

## [How do I find if a variable is defined when I know the corresponding symbol, but not the name?](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 2\
**Last updated:** [August 2, 2022, 1:37am UTC](https://discourse.julialang.org/t/how-do-i-find-if-a-variable-is-defined-when-i-know-the-corresponding-symbol-but-not-the-name/85132 "2022-08-02T01:37:42Z")

</div>

I have a variable a that is defined: a = 1 I can check whether a is defined @isdefined a # true Some other variables may or not be defined at this point in the program: @isdefined b # false However, I only have ava…

---

## [Is this a bug](https://discourse.julialang.org/t/is-this-a-bug/85130)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 1\
**Last updated:** [August 1, 2022, 11:45pm UTC](https://discourse.julialang.org/t/is-this-a-bug/85130 "2022-08-01T23:45:30Z")

</div>

a=1 for i in range(1,5) a=i\*a^i end now result is zero is this kind of bug

---

## [Record audio without data loss between save files | PortAudio.jl](https://discourse.julialang.org/t/record-audio-without-data-loss-between-save-files-portaudio-jl/85007)

<div class="topic-metadata">

**Author:** [@frsalarcon](https://discourse.julialang.org/u/frsalarcon)\
**Replies:** 1\
**Last updated:** [August 1, 2022, 10:09pm UTC](https://discourse.julialang.org/t/record-audio-without-data-loss-between-save-files-portaudio-jl/85007 "2022-08-01T22:09:05Z")

</div>

Hello everyone! I have a question, is there a way to record audio for example one minute through the following script using portaudio: import LibSndFile using PortAudio: PortAudioStream using SampledSignals: s using Fi…

---

## [Check how the documentation of package will be affected by a PR on GitHub](https://discourse.julialang.org/t/check-how-the-documentation-of-package-will-be-affected-by-a-pr-on-github/85118)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 2\
**Last updated:** [August 1, 2022, 9:22pm UTC](https://discourse.julialang.org/t/check-how-the-documentation-of-package-will-be-affected-by-a-pr-on-github/85118 "2022-08-01T21:22:34Z")

</div>

I have a PR to a Julia package (Update with BifurcationKit by TorkelE · Pull Request #539 · SciML/Catalyst.jl · GitHub) that will change the documentation (Home · Catalyst.jl). Is there some good way to check how the do…

---

## [\--track-allocation and @threads](https://discourse.julialang.org/t/track-allocation-and-threads/84729)

<div class="topic-metadata">

**Author:** [@jwake](https://discourse.julialang.org/u/jwake)\
**Replies:** 10\
**Last updated:** [August 1, 2022, 7:57pm UTC](https://discourse.julialang.org/t/track-allocation-and-threads/84729 "2022-08-01T19:57:54Z")

</div>

Essentially, I call a function within nested loops. In serial, no heap allocations occur within the function. When run on multiple threads via @threads, allocations are reported within the function. Because the thread…

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

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