# General Usage

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

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

**Page:** 262

---

## [Cannot Precompile Plots.jl due to GR](https://discourse.julialang.org/t/cannot-precompile-plots-jl-due-to-gr/88230)

<div class="topic-metadata">

**Author:** [@SpinolaHours](https://discourse.julialang.org/u/SpinolaHours)\
**Replies:** 16\
**Last updated:** [August 3, 2023, 3:05pm UTC](https://discourse.julialang.org/t/cannot-precompile-plots-jl-due-to-gr/88230 "2023-08-03T15:05:25Z")

</div>

Hi there, I recently upgraded to 1.8.0. At some point I lost the ability to precompile plots due to a GR\_jll error. I see other people have had similar issues and have tried the following with no luck: Removing .julia …

---

## [How to Fix Failed to Precompile Plots: Required dependency Xorg\_xcb\_util\_jll \[2def613f-5ad1-5310-b15b-b15d46f528f5\] failed to load from a cache file](https://discourse.julialang.org/t/how-to-fix-failed-to-precompile-plots-required-dependency-xorg-xcb-util-jll-2def613f-5ad1-5310-b15b-b15d46f528f5-failed-to-load-from-a-cache-file/98909)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [May 16, 2023, 9:05am UTC](https://discourse.julialang.org/t/how-to-fix-failed-to-precompile-plots-required-dependency-xorg-xcb-util-jll-2def613f-5ad1-5310-b15b-b15d46f528f5-failed-to-load-from-a-cache-file/98909 "2023-05-16T09:05:52Z")

</div>

I add FresnelIntegrals yesterday and then suddenly Plots can’t be compiled. (can’t believe this FresnelIntegrals package can cause so many damages) I tried this but still not working: ERROR: The following 1 direct d…

---

## [Why stringfy an array of UInt8s empties it?](https://discourse.julialang.org/t/why-stringfy-an-array-of-uint8s-empties-it/102389)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 10\
**Last updated:** [August 3, 2023, 10:57am UTC](https://discourse.julialang.org/t/why-stringfy-an-array-of-uint8s-empties-it/102389 "2023-08-03T10:57:22Z")

</div>

Is this result documented? What is the reason why v is emptied? julia\> v=\[0x41,0x42\] 2-element Vector{UInt8}: 0x41 0x42 julia\> String(v) "AB" julia\> v UInt8\[\] PS Is there a more efficient and side-effect free way…

---

## [Best way to take trace of matrix product in Julia?](https://discourse.julialang.org/t/best-way-to-take-trace-of-matrix-product-in-julia/102380)

<div class="topic-metadata">

**Author:** [@hshackle](https://discourse.julialang.org/u/hshackle)\
**Replies:** 17\
**Last updated:** [August 3, 2023, 10:55am UTC](https://discourse.julialang.org/t/best-way-to-take-trace-of-matrix-product-in-julia/102380 "2023-08-03T10:55:33Z")

</div>

My question is essentially a rehash of the Python question posted here. Given two matrices A and B, I would like to compute the trace of A\*B, which does not require evaluating the full matrix multiplication. I’ve include…

---

## [Documentation explaining function supplied to \`count\` in Julia Docs?](https://discourse.julialang.org/t/documentation-explaining-function-supplied-to-count-in-julia-docs/102428)

<div class="topic-metadata">

**Author:** [@bojohnson02](https://discourse.julialang.org/u/bojohnson02)\
**Replies:** 1\
**Last updated:** [August 3, 2023, 3:15am UTC](https://discourse.julialang.org/t/documentation-explaining-function-supplied-to-count-in-julia-docs/102428 "2023-08-03T03:15:46Z")

</div>

I came across a particular function supplied to count in the documentation I wasn’t aware of previously. The \>(3) in count(\>(3), 1:7, init=0x03) is something I’ve been looking to replicate but didn’t know existed. Is the…

---

## [Is Pkg's dependency resolution order-dependent?](https://discourse.julialang.org/t/is-pkgs-dependency-resolution-order-dependent/30899)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 3\
**Last updated:** [August 2, 2023, 8:33pm UTC](https://discourse.julialang.org/t/is-pkgs-dependency-resolution-order-dependent/30899 "2023-08-02T20:33:04Z")

</div>

Here is an example where Pkg.adding first Cairo, then ImageView fails, whereas adding ImageView first works flawlessly. Is it expected that the dependency resolution depends on the order in which packages are added? In…

---

## [Getting performance information from testsets](https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 1\
**Last updated:** [August 2, 2023, 8:20pm UTC](https://discourse.julialang.org/t/getting-performance-information-from-testsets/102417 "2023-08-02T20:20:39Z")

</div>

Testsets know already how much time they took to execute: using Test ts = @testset "outer" begin sleep(0.1) end # ts.time\_end - ts.time\_start = 0.10119009017944336 However, I would like to also know some other in…

---

## [Get location and variable name from UndefVarError](https://discourse.julialang.org/t/get-location-and-variable-name-from-undefvarerror/102299)

<div class="topic-metadata">

**Author:** [@t-anton](https://discourse.julialang.org/u/t-anton)\
**Replies:** 2\
**Last updated:** [August 2, 2023, 8:14pm UTC](https://discourse.julialang.org/t/get-location-and-variable-name-from-undefvarerror/102299 "2023-08-02T20:14:09Z")

</div>

Hi All, How can I get an undefined variable name and its location? For example, in the code below x = a +1 The output is: UndefVarError: \`a\` not defined Stacktrace: \[1\] top-level scope @ In\[1\]:1 How do I get o…

---

## [Undefined variable Error in a quote block](https://discourse.julialang.org/t/undefined-variable-error-in-a-quote-block/102404)

<div class="topic-metadata">

**Author:** [@shawn\_T](https://discourse.julialang.org/u/shawn_T)\
**Replies:** 1\
**Last updated:** [August 2, 2023, 8:09pm UTC](https://discourse.julialang.org/t/undefined-variable-error-in-a-quote-block/102404 "2023-08-02T20:09:33Z")

</div>

Hi all, I was designing a macro and the code below is the return line of the macro, but it reports “i not defined”, I think it happens at $(result\[i\]) because once I replace it with other expr it is fine, so is there a …

---

## [Julia Natural Language Processing (NLP) Package for Small Text Topic Modeling](https://discourse.julialang.org/t/julia-natural-language-processing-nlp-package-for-small-text-topic-modeling/102370)

<div class="topic-metadata">

**Author:** [@BR2106](https://discourse.julialang.org/u/BR2106)\
**Replies:** 0\
**Last updated:** [August 1, 2023, 7:32pm UTC](https://discourse.julialang.org/t/julia-natural-language-processing-nlp-package-for-small-text-topic-modeling/102370 "2023-08-01T19:32:46Z")

</div>

Hi all, I was wondering what package people use for small text topic modeling (STTM)? I have looked through the standard Julia NLP packages but I haven’t seen any reference to STTM, only generic topic modeling. Maybe I …

---

## [Julia, ODBC connection to a remote MS SQL Server](https://discourse.julialang.org/t/julia-odbc-connection-to-a-remote-ms-sql-server/75374)

<div class="topic-metadata">

**Author:** [@jamaas](https://discourse.julialang.org/u/jamaas)\
**Replies:** 10\
**Last updated:** [August 2, 2023, 3:54pm UTC](https://discourse.julialang.org/t/julia-odbc-connection-to-a-remote-ms-sql-server/75374 "2023-08-02T15:54:57Z")

</div>

I have been using R to connect to a remote MS SQL Server database, from Ubuntu Linux 21.10 and it works quite well. I’d like to do the same thing from Julia but can not make the connection using the ODBC package. Does …

---

## [Unnormalized sinc](https://discourse.julialang.org/t/unnormalized-sinc/25015)

<div class="topic-metadata">

**Author:** [@adamnemecek](https://discourse.julialang.org/u/adamnemecek)\
**Replies:** 17\
**Last updated:** [August 2, 2023, 3:40pm UTC](https://discourse.julialang.org/t/unnormalized-sinc/25015 "2023-08-02T15:40:46Z")

</div>

The current implementation of sinc is the normalized one. I think it’s a good idea to also have the unnormalized one. I’m not sure what name to pick. Would there be any interest in this function?

---

## [Get qualified name expression from value](https://discourse.julialang.org/t/get-qualified-name-expression-from-value/102330)

<div class="topic-metadata">

**Author:** [@iago-lito](https://discourse.julialang.org/u/iago-lito)\
**Replies:** 0\
**Last updated:** [July 31, 2023, 6:50pm UTC](https://discourse.julialang.org/t/get-qualified-name-expression-from-value/102330 "2023-07-31T18:50:03Z")

</div>

Given an “item” value, say v::Union{Type,Function,Module}. I can easily get its name as a symbolic expression, like: julia\> nameof(v) :Item I can also get a string representation with its full-qualified name in the cur…

---

## [Multithreaded mapreduce / collect](https://discourse.julialang.org/t/multithreaded-mapreduce-collect/102393)

<div class="topic-metadata">

**Author:** [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Replies:** 0\
**Last updated:** [August 2, 2023, 12:16pm UTC](https://discourse.julialang.org/t/multithreaded-mapreduce-collect/102393 "2023-08-02T12:16:36Z")

</div>

Hi, I wanted to ask about an analogue to (multi-threaded) java stream collect Stream (Java Platform SE 8 ) In other words: I define functions instantiateAccumulator(), consume!(accumulator, item) and merge!(leftAccumul…

---

## [Survey on how you use Julia](https://discourse.julialang.org/t/survey-on-how-you-use-julia/99807)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 15\
**Last updated:** [August 2, 2023, 9:11am UTC](https://discourse.julialang.org/t/survey-on-how-you-use-julia/99807 "2023-08-02T09:11:40Z")

</div>

Hi all, I’m making a video on how to make Julia feel nice to use, and I make a few claims about what is and isn’t “standard”. I’m curious to see how other people use Julia to get some statistics on what the community vi…

---

## [Function as Type Parameter](https://discourse.julialang.org/t/function-as-type-parameter/102378)

<div class="topic-metadata">

**Author:** [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)\
**Replies:** 5\
**Last updated:** [August 2, 2023, 8:27am UTC](https://discourse.julialang.org/t/function-as-type-parameter/102378 "2023-08-02T08:27:54Z")

</div>

Consider a struct, that takes a function as a type parameter: struct Foo{F} end function call(foo::Foo{F}, x) where {F} F(x) end Seems great at first, as can be seen by # This works r = Base.RefValue(3) foo = Foo…

---

## [Memory allocation - identical objects](https://discourse.julialang.org/t/memory-allocation-identical-objects/102095)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [August 2, 2023, 5:09am UTC](https://discourse.julialang.org/t/memory-allocation-identical-objects/102095 "2023-08-02T05:09:31Z")

</div>

@with\_kw struct Currency\_Pair c1::String3 c2::String3 id = c1 \* c2 #other fields derived from c1 and c2 (not involving arrays) end x1 = Currency\_Pair(c1="AUD",c2="USD") x2 = Currency\_Pair(c1="AUD",c2="US…

---

## [How do I use FastGaussQuadrature.jl to compute the integral of a 2d triangle element and 3d tetrahedron element](https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 2\
**Last updated:** [August 2, 2023, 5:09am UTC](https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376 "2023-08-02T05:09:05Z")

</div>

I am learning about finite element methods, and was trying to implement some examples in Julia. So one of the common steps in FEM is implementing Gauss Quadrature for approximating the integral of each element in the me…

---

## [Best way to specify a relative path in a relocatable way?](https://discourse.julialang.org/t/best-way-to-specify-a-relative-path-in-a-relocatable-way/102338)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 2\
**Last updated:** [August 2, 2023, 12:40am UTC](https://discourse.julialang.org/t/best-way-to-specify-a-relative-path-in-a-relocatable-way/102338 "2023-08-02T00:40:14Z")

</div>

I’d like to specify a relative path in my code. My code is to be compiled by PackageCompiler and be used by many others, so it must be relocatable. There are mainly two points: it should behave the same wherever it is …

---

## [Partial Differential Equation visualisation / animation for Heat Equation in Julia / Alternatives](https://discourse.julialang.org/t/partial-differential-equation-visualisation-animation-for-heat-equation-in-julia-alternatives/102145)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 8\
**Last updated:** [August 1, 2023, 8:50pm UTC](https://discourse.julialang.org/t/partial-differential-equation-visualisation-animation-for-heat-equation-in-julia-alternatives/102145 "2023-08-01T20:50:13Z")

</div>

Hi all, After I read this page and see the animation I wonder, to those who might have created something like this, which Julia packages can be used to create animation…

---

## [Instability of perpetual manifolds of coupled oscillators, problem relevant to numerical integration algorithms](https://discourse.julialang.org/t/instability-of-perpetual-manifolds-of-coupled-oscillators-problem-relevant-to-numerical-integration-algorithms/102328)

<div class="topic-metadata">

**Author:** [@Prof\_FG](https://discourse.julialang.org/u/Prof_FG)\
**Replies:** 6\
**Last updated:** [August 1, 2023, 7:10pm UTC](https://discourse.julialang.org/t/instability-of-perpetual-manifolds-of-coupled-oscillators-problem-relevant-to-numerical-integration-algorithms/102328 "2023-08-01T19:10:24Z")

</div>

Dear all, I downloaded Julia to try solving numerically a system of nonlinear differential equations, which is based on my article about perpetual points/manifolds, in Journal of Mechanical Science https://doi.org/10.…

---

## [How to use many (non-sticky) tasks while maximizing local storage reuse?](https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 9\
**Last updated:** [August 1, 2023, 12:53pm UTC](https://discourse.julialang.org/t/how-to-use-many-non-sticky-tasks-while-maximizing-local-storage-reuse/100279 "2023-08-01T12:53:08Z")

</div>

After reading the WIP blogpost https://github.com/JuliaLang/www.julialang.org/pull/1904, I’m trying to adapt to the new recommended approach to multithreading, now that tasks can migrate between threads. I would like to …

---

## [Speeding up matrix exponential and matrix multiplication](https://discourse.julialang.org/t/speeding-up-matrix-exponential-and-matrix-multiplication/102272)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 58\
**Last updated:** [August 1, 2023, 4:21pm UTC](https://discourse.julialang.org/t/speeding-up-matrix-exponential-and-matrix-multiplication/102272 "2023-08-01T16:21:04Z")

</div>

I am very new to Julia and trying to convert my python codes to Julia to speed up my work. However, the present Julia version, pasted below, still runs slower than my python version. I see two bottlenecks: (1) the matr…

---

## [How to create a birth/death system with ModelingToolkit.jl?](https://discourse.julialang.org/t/how-to-create-a-birth-death-system-with-modelingtoolkit-jl/102324)

<div class="topic-metadata">

**Author:** [@70Gage70](https://discourse.julialang.org/u/70Gage70)\
**Replies:** 3\
**Last updated:** [August 1, 2023, 3:15pm UTC](https://discourse.julialang.org/t/how-to-create-a-birth-death-system-with-modelingtoolkit-jl/102324 "2023-08-01T15:15:40Z")

</div>

This gist of this question is to determine what the canonical workflow is for defining systems with changing numbers of components e.g. growth/death of biological organisms. This issue is discussed is the callback sectio…

---

## [My Windows Julia terminal doesn't show the symbols properly](https://discourse.julialang.org/t/my-windows-julia-terminal-doesnt-show-the-symbols-properly/102352)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 1\
**Last updated:** [August 1, 2023, 1:25pm UTC](https://discourse.julialang.org/t/my-windows-julia-terminal-doesnt-show-the-symbols-properly/102352 "2023-08-01T13:25:13Z")

</div>

When I open the Julia terminal from the icon installed on the toolbar when, I see these ? question mark symbol. I think they should be up arrow symbols. What do I do to get the terminal to display the right symbols?

---

## [From multithreading to distributed](https://discourse.julialang.org/t/from-multithreading-to-distributed/101984)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [August 1, 2023, 12:51pm UTC](https://discourse.julialang.org/t/from-multithreading-to-distributed/101984 "2023-08-01T12:51:44Z")

</div>

I have the following code, that works well: # Dummy function, the real code makes heavy use of ModelingToolkit and DifferentialEquations function rel\_sigma(;λ\_nom) sleep(1) rand() end λ\_noms = sort(unique(vcat(…

---

## [Deep copy of Array in Struct in NamedTuple](https://discourse.julialang.org/t/deep-copy-of-array-in-struct-in-namedtuple/102349)

<div class="topic-metadata">

**Author:** [@DanDoe](https://discourse.julialang.org/u/DanDoe)\
**Replies:** 3\
**Last updated:** [August 1, 2023, 12:17pm UTC](https://discourse.julialang.org/t/deep-copy-of-array-in-struct-in-namedtuple/102349 "2023-08-01T12:17:47Z")

</div>

I am creating and returning a NamedTuple cache mystruct = MyStruct{Float64}(42, 42, 42) cache = (; foo, bar, mystruct) return cache where mystruct is an object of the mutable struct MyStruct which contains an array mu…

---

## [Simple debugging: @testset, @debug, @assert](https://discourse.julialang.org/t/simple-debugging-testset-debug-assert/102346)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 1\
**Last updated:** [August 1, 2023, 11:25am UTC](https://discourse.julialang.org/t/simple-debugging-testset-debug-assert/102346 "2023-08-01T11:25:50Z")

</div>

I want to insert simple test code here and there into my small programs and am wondering what the best practice is. \[What I write below likely includes some error due to my misunderstanding. I’m struggling to understand…

---

## [LlaMa2 architecture in Julia: llama2.jl (300 lines?)](https://discourse.julialang.org/t/llama2-architecture-in-julia-llama2-jl-300-lines/102006)

<div class="topic-metadata">

**Author:** [@Jose\_Diaz](https://discourse.julialang.org/u/Jose_Diaz)\
**Replies:** 2\
**Last updated:** [August 1, 2023, 5:59am UTC](https://discourse.julialang.org/t/llama2-architecture-in-julia-llama2-jl-300-lines/102006 "2023-08-01T05:59:58Z")

</div>

Hello! I’m currently porting karpathy/llama2.c to Julia Managed to import all the weights and the config. Created structs with the appropiate types and implemented some of the math too. Now I’m implementing the archite…

---

## [Array/vector comprehension and AbstractTrees Leaves iterator](https://discourse.julialang.org/t/array-vector-comprehension-and-abstracttrees-leaves-iterator/102337)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 0\
**Last updated:** [August 1, 2023, 1:18am UTC](https://discourse.julialang.org/t/array-vector-comprehension-and-abstracttrees-leaves-iterator/102337 "2023-08-01T01:18:45Z")

</div>

Why the array comprehension behaves differently with the AbstractTrees.Leaves iterator? In the following replacing Leaves(t) with say, range(1,3,3), I do get the 2D array. julia\> using AbstractTrees julia\> t = \[\[1, 2\]…

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

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