# General Usage

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

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

**Page:** 410

---

## [Storing functions for usage across files](https://discourse.julialang.org/t/storing-functions-for-usage-across-files/85723)

<div class="topic-metadata">

**Author:** [@Nash](https://discourse.julialang.org/u/Nash)\
**Replies:** 8\
**Last updated:** [August 14, 2022, 2:00pm UTC](https://discourse.julialang.org/t/storing-functions-for-usage-across-files/85723 "2022-08-14T14:00:51Z")

</div>

I came from MATLAB and have enjoyed the migration to Julia. However, one thing that I liked about MATLAB was the ability to create a function and save that function in a directory, so that I could use it later in a poten…

---

## [Gtk window appears in the background](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [August 14, 2022, 12:39pm UTC](https://discourse.julialang.org/t/gtk-window-appears-in-the-background/85725 "2022-08-14T12:39:43Z")

</div>

I want to ccall the following Gtk function: Gtk.Window.set\_keep\_above void gtk\_window\_set\_keep\_above ( GtkWindow\* window, gboolean setting ) I looked at Gtk.jl/windows.jl at master · JuliaGraphics/Gtk.jl · GitHub f…

---

## [Make Base.unique work with user-defined types](https://discourse.julialang.org/t/make-base-unique-work-with-user-defined-types/85716)

<div class="topic-metadata">

**Author:** [@Lewis\_Hein](https://discourse.julialang.org/u/Lewis_Hein)\
**Replies:** 1\
**Last updated:** [August 13, 2022, 8:30pm UTC](https://discourse.julialang.org/t/make-base-unique-work-with-user-defined-types/85716 "2022-08-13T20:30:47Z")

</div>

I am trying to make Base.unique work with an array of a custom type. A really trivial example might look like this import Base.isequal struct TestStruct x::String end Base.isequal(t1::TestStruct, t2::TestStruct) = len…

---

## [How to compute a conditional sum of a vector efficiently](https://discourse.julialang.org/t/how-to-compute-a-conditional-sum-of-a-vector-efficiently/85699)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 2\
**Last updated:** [August 13, 2022, 11:53am UTC](https://discourse.julialang.org/t/how-to-compute-a-conditional-sum-of-a-vector-efficiently/85699 "2022-08-13T11:53:35Z")

</div>

I have three vectors x, a, b. I need a new vector Y which has as its k^{th} element the following sum: Y^{}\_k = \\sum\_{i=1}^N x\_i \\ \\mathbb{1}(a\_i=a\_k, b\_i=b\_k) i.e., the sum of x from all rows with the same values of a,…

---

## [Custom Venn Diagram in Julia](https://discourse.julialang.org/t/custom-venn-diagram-in-julia/85696)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [August 13, 2022, 2:07pm UTC](https://discourse.julialang.org/t/custom-venn-diagram-in-julia/85696 "2022-08-13T14:07:40Z")

</div>

Hi all, I saw this topic: But I want to plot a custom venn diagram in Julia, which can show :slight\_smile: 𝐴∩𝐵 𝐴∖𝐵 𝐴△𝐵 (symmetric difference of sets A and B which you can imagine like two blocks and the sets is not…

---

## [PkgTemplates without git](https://discourse.julialang.org/t/pkgtemplates-without-git/85703)

<div class="topic-metadata">

**Author:** [@ay\_m](https://discourse.julialang.org/u/ay_m)\
**Replies:** 1\
**Last updated:** [August 13, 2022, 1:53pm UTC](https://discourse.julialang.org/t/pkgtemplates-without-git/85703 "2022-08-13T13:53:08Z")

</div>

hello, I am trying to create a module using PkgTemplates.jl tpl = Template(user="a", dir=".") tpl("Package") The issue is this command creates a .git file, and I don’t need it, since I already have a repository created…

---

## [Reusing an optimization problem](https://discourse.julialang.org/t/reusing-an-optimization-problem/85694)

<div class="topic-metadata">

**Author:** [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Replies:** 3\
**Last updated:** [August 13, 2022, 1:14pm UTC](https://discourse.julialang.org/t/reusing-an-optimization-problem/85694 "2022-08-13T13:14:09Z")

</div>

In Optimization.jl, we make an OptimizationProblem and solve it using an optimizer – is there any way to reuse the OptimizationProblem, like remake! in DifferentialEquations.jl? The idea would be to seamlessly chain mult…

---

## [Type issue with captured variables -\> let workaround failed](https://discourse.julialang.org/t/type-issue-with-captured-variables-let-workaround-failed/85661)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 3\
**Last updated:** [August 13, 2022, 6:59am UTC](https://discourse.julialang.org/t/type-issue-with-captured-variables-let-workaround-failed/85661 "2022-08-13T06:59:30Z")

</div>

Hi! I’m aware of #15276 but today I encountered an issue in the proposed workaround. using FFTW function f(x) p = plan\_fft(x) x\_ft = p \* x # given workaround in performance tips g = let p = p …

---

## [Import/using double dot in IntervalArithmetic?](https://discourse.julialang.org/t/import-using-double-dot-in-intervalarithmetic/85677)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 1\
**Last updated:** [August 12, 2022, 10:54pm UTC](https://discourse.julialang.org/t/import-using-double-dot-in-intervalarithmetic/85677 "2022-08-12T22:54:22Z")

</div>

My code currently uses both Makie/CairoMakie and the IntervalArithmetic package, and I used the a..b quite a lot in the calculation part of the code to define intervals. Problem is, on a fresh start of julia, using Cair…

---

## [Is it possible to define a macro in one line (one-liner macros)?](https://discourse.julialang.org/t/is-it-possible-to-define-a-macro-in-one-line-one-liner-macros/85649)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 8\
**Last updated:** [August 12, 2022, 10:45pm UTC](https://discourse.julialang.org/t/is-it-possible-to-define-a-macro-in-one-line-one-liner-macros/85649 "2022-08-12T22:45:49Z")

</div>

We have one-liner functions, can we define macros in one line? Like @my(x) = :(println($(esc(x)))) which is equivalent to macro my(x) :(println($(esc(x)))) end I guess not, because sometimes = is part of the macr…

---

## [Reveal all of the attributes of a current plot](https://discourse.julialang.org/t/reveal-all-of-the-attributes-of-a-current-plot/85670)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 1\
**Last updated:** [August 12, 2022, 9:24pm UTC](https://discourse.julialang.org/t/reveal-all-of-the-attributes-of-a-current-plot/85670 "2022-08-12T21:24:14Z")

</div>

How can I reveal the values of all of the attributes of a current plot? plotattr() shows me the attributes that a plot may have, but I can’t figure out if it can tell me the attributes of a current plot. I have a plot, …

---

## [Update input argument in each Optim.jl iteration](https://discourse.julialang.org/t/update-input-argument-in-each-optim-jl-iteration/85641)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 7\
**Last updated:** [August 12, 2022, 3:45pm UTC](https://discourse.julialang.org/t/update-input-argument-in-each-optim-jl-iteration/85641 "2022-08-12T15:45:15Z")

</div>

How can I update the input argument such that in each iteration step n\>1, the value of b equals the value of b\_sol from the n-1th iteration? I present here the optimization call I am making. I was hoping that b would up…

---

## [A error happened when using command-line options, such as "--version"](https://discourse.julialang.org/t/a-error-happened-when-using-command-line-options-such-as-version/85663)

<div class="topic-metadata">

**Author:** [@Aesth\_Estheticism](https://discourse.julialang.org/u/Aesth_Estheticism)\
**Replies:** 2\
**Last updated:** [August 12, 2022, 3:34pm UTC](https://discourse.julialang.org/t/a-error-happened-when-using-command-line-options-such-as-version/85663 "2022-08-12T15:34:29Z")

</div>

How to use Julia command-line options, for example, I wanted to check the version of Julia using --version, however, it was not worked.

---

## [What is "JRUN\_CLUSTER\_COOKIE" error from initialisecluster() (JuliaRunClient)](https://discourse.julialang.org/t/what-is-jrun-cluster-cookie-error-from-initialisecluster-juliarunclient/85651)

<div class="topic-metadata">

**Author:** [@le\_ackerman](https://discourse.julialang.org/u/le_ackerman)\
**Replies:** 7\
**Last updated:** [August 12, 2022, 2:33pm UTC](https://discourse.julialang.org/t/what-is-jrun-cluster-cookie-error-from-initialisecluster-juliarunclient/85651 "2022-08-12T14:33:08Z")

</div>

I was going through tutorial notebooks on parallelisations and encountered this. What does this mean? the same error is for initParallel() also.

---

## [Can we use Openslide or do we have a tool to open MRXS files from microscope?](https://discourse.julialang.org/t/can-we-use-openslide-or-do-we-have-a-tool-to-open-mrxs-files-from-microscope/79936)

<div class="topic-metadata">

**Author:** [@YitaoCai](https://discourse.julialang.org/u/YitaoCai)\
**Replies:** 17\
**Last updated:** [August 12, 2022, 2:16pm UTC](https://discourse.julialang.org/t/can-we-use-openslide-or-do-we-have-a-tool-to-open-mrxs-files-from-microscope/79936 "2022-08-12T14:16:23Z")

</div>

I was thinking if there is a way we can open MRXS file in Julia, like Openslide in Python? I tried to install openslide using CondaPkg.jl, but when using PythonCall.jl to import openslide, it does not work. (it works f…

---

## [A prototype of \`pkgimage\` binary cache system for reducing latency](https://discourse.julialang.org/t/a-prototype-of-pkgimage-binary-cache-system-for-reducing-latency/85610)

<div class="topic-metadata">

**Author:** [@anon56330260](https://discourse.julialang.org/u/anon56330260)\
**Replies:** 3\
**Last updated:** [August 12, 2022, 1:30pm UTC](https://discourse.julialang.org/t/a-prototype-of-pkgimage-binary-cache-system-for-reducing-latency/85610 "2022-08-12T13:30:25Z")

</div>

This is a repost from the slack. Slack doesn’t work quite well for long articles, so I decide to repost it here. Recently we (Tongyuan) have investigated into binary compilation using LLVM’s new JIT linking architecture…

---

## [Difficulty compiling in Atom](https://discourse.julialang.org/t/difficulty-compiling-in-atom/85626)

<div class="topic-metadata">

**Author:** [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Replies:** 11\
**Last updated:** [August 12, 2022, 1:29pm UTC](https://discourse.julialang.org/t/difficulty-compiling-in-atom/85626 "2022-08-12T13:29:11Z")

</div>

Hello everybody I installed julia and it’s working, but I can’t compile anything, it’s like the IDE (Atom) isn’t seeing any commands I give. Has it ever happened to anyone? What should I do? Thanks

---

## [VSCode REPL hanging after a while](https://discourse.julialang.org/t/vscode-repl-hanging-after-a-while/85585)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 12\
**Last updated:** [August 12, 2022, 11:29am UTC](https://discourse.julialang.org/t/vscode-repl-hanging-after-a-while/85585 "2022-08-12T11:29:53Z")

</div>

This just started happening recently. After I use the integrated VSCode repl for a while, it increasingly hangs with this error: “The connection to the terminal’s pty host process is unresponsive, the terminals may stop…

---

## [Can you define variables inside a comprehension?](https://discourse.julialang.org/t/can-you-define-variables-inside-a-comprehension/85642)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 3\
**Last updated:** [August 12, 2022, 10:27am UTC](https://discourse.julialang.org/t/can-you-define-variables-inside-a-comprehension/85642 "2022-08-12T10:27:55Z")

</div>

julia\> M = \[1 2; 3 4\] 2×2 Matrix{Int64}: 1 2 3 4 julia\> M = (M + M') ./ 2.0 2×2 Matrix{Float64}: 1.0 2.5 2.5 4.0 julia\> M = \[1 2; 3 4\] 2×2 Matrix{Int64}: 1 2 3 4 julia\> \[ x = (x + x') ./ 2.0 for x in \[M\] \]…

---

## [Difficulties putting code in module (on an M1 machine) (pre-compilation, cfunctions, global variables)](https://discourse.julialang.org/t/difficulties-putting-code-in-module-on-an-m1-machine-pre-compilation-cfunctions-global-variables/84726)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 4\
**Last updated:** [August 12, 2022, 10:12am UTC](https://discourse.julialang.org/t/difficulties-putting-code-in-module-on-an-m1-machine-pre-compilation-cfunctions-global-variables/84726 "2022-08-12T10:12:42Z")

</div>

I’m building an interactive simulation of a Spin Ising model and I’ve been experiencing some difficulties. I’m using QML to build an interface. Before, I had everything in a large script with a lot of global variables, a…

---

## [Call macro inside a macro with external variables escaped](https://discourse.julialang.org/t/call-macro-inside-a-macro-with-external-variables-escaped/85650)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 3\
**Last updated:** [August 12, 2022, 9:43am UTC](https://discourse.julialang.org/t/call-macro-inside-a-macro-with-external-variables-escaped/85650 "2022-08-12T09:43:33Z")

</div>

I have a problem making the following example work, it tells me @option & VectorOption are not defined: module MWE using Configurations: @option export @vopt, vopt abstract type VectorOption end macro vopt(type, ali…

---

## [Input for multiheaded dense layers in Flux](https://discourse.julialang.org/t/input-for-multiheaded-dense-layers-in-flux/85659)

<div class="topic-metadata">

**Author:** [@Marius\_123](https://discourse.julialang.org/u/Marius_123)\
**Replies:** 0\
**Last updated:** [August 12, 2022, 9:43am UTC](https://discourse.julialang.org/t/input-for-multiheaded-dense-layers-in-flux/85659 "2022-08-12T09:43:23Z")

</div>

Hello, i have as a input for my neural network basically an array of arrays. Each of these arrays should have seperate input neurons associated to them. A small example can be found below, where my training set has size…

---

## [Isfile returns false on symlink (Windows)](https://discourse.julialang.org/t/isfile-returns-false-on-symlink-windows/85654)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 1\
**Last updated:** [August 12, 2022, 7:34am UTC](https://discourse.julialang.org/t/isfile-returns-false-on-symlink-windows/85654 "2022-08-12T07:34:10Z")

</div>

See title. Is this expected? I am on Windows 10 If there is already a symlink and I want to overwrite it, symlink errors. But isfile returns false on the symlink. Is there any way I can determine if it exists?

---

## [Why for-loop of vector multiplication is slower that dot product?](https://discourse.julialang.org/t/why-for-loop-of-vector-multiplication-is-slower-that-dot-product/85631)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 11\
**Last updated:** [August 11, 2022, 7:56pm UTC](https://discourse.julialang.org/t/why-for-loop-of-vector-multiplication-is-slower-that-dot-product/85631 "2022-08-11T19:56:11Z")

</div>

I just want to know why the .\* below is faster that for-loop product? using BenchmarkTools, LinearAlgebra S1 = rand(10000); S2 = rand(10000); S = zeros(10000); S3 = zeros(10000); n =size(S1,1) function mm!(S, S1, S2, n)…

---

## [How can be expressed a sum of a few products, vector.\*Ref(matrix)](https://discourse.julialang.org/t/how-can-be-expressed-a-sum-of-a-few-products-vector-ref-matrix/85632)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 2\
**Last updated:** [August 11, 2022, 7:35pm UTC](https://discourse.julialang.org/t/how-can-be-expressed-a-sum-of-a-few-products-vector-ref-matrix/85632 "2022-08-11T19:35:43Z")

</div>

If v is a vector, and A a matrix, then v .\*Ref(A) is a Length(v)-vector of size(A)-matrices. I want to get the matrices x,y defined here as follows: v =\[1.2, -3.1\] A =3\*rand(3,4) w= \[-4.3, 0.7\] B = rand(3,4) x, y = \[(v…

---

## [Help to analyze SnoopCompile results. What happens during \`boot.jl\`?](https://discourse.julialang.org/t/help-to-analyze-snoopcompile-results-what-happens-during-boot-jl/85633)

<div class="topic-metadata">

**Author:** [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Replies:** 2\
**Last updated:** [August 11, 2022, 7:15pm UTC](https://discourse.julialang.org/t/help-to-analyze-snoopcompile-results-what-happens-during-boot-jl/85633 "2022-08-11T19:15:41Z")

</div>

Hello all! I have followed the tutorials on SnoopCompile about invalidation and inference and I still have a big question, in my case I have some parts of the code that trigger type inferences and I am working on fixing…

---

## [Broadcast over matrix dimension for multiple arguments](https://discourse.julialang.org/t/broadcast-over-matrix-dimension-for-multiple-arguments/85629)

<div class="topic-metadata">

**Author:** [@b-fg](https://discourse.julialang.org/u/b-fg)\
**Replies:** 7\
**Last updated:** [August 11, 2022, 5:16pm UTC](https://discourse.julialang.org/t/broadcast-over-matrix-dimension-for-multiple-arguments/85629 "2022-08-11T17:16:21Z")

</div>

Say I have 2 matrices, a and b. How can I call a function that expects 2 vectors by broadcasting over their (eg) rows. For example: function foo(a :: Vector, b :: Vector, c :: Float64) return (sum(a) + sum(b)) / c e…

---

## [Juliaup (v1.6.12) on windows, doesnt update, and doesnt see 1.8rc4](https://discourse.julialang.org/t/juliaup-v1-6-12-on-windows-doesnt-update-and-doesnt-see-1-8rc4/85568)

<div class="topic-metadata">

**Author:** [@jdad](https://discourse.julialang.org/u/jdad)\
**Replies:** 3\
**Last updated:** [August 11, 2022, 4:09pm UTC](https://discourse.julialang.org/t/juliaup-v1-6-12-on-windows-doesnt-update-and-doesnt-see-1-8rc4/85568 "2022-08-11T16:09:23Z")

</div>

As 1.8rc4 just came out, I was trying to update my rc channel on both Linux and Windows. On Linux, it did work (after I had to do “juliaup self update” to get it to 1.7.20). But on Windows “juliaup 1.6.12” does not see …

---

## [Accessing arguments of a symbolic expression using SymbolicUtils.jl](https://discourse.julialang.org/t/accessing-arguments-of-a-symbolic-expression-using-symbolicutils-jl/85600)

<div class="topic-metadata">

**Author:** [@hpieper14](https://discourse.julialang.org/u/hpieper14)\
**Replies:** 3\
**Last updated:** [August 11, 2022, 1:48pm UTC](https://discourse.julialang.org/t/accessing-arguments-of-a-symbolic-expression-using-symbolicutils-jl/85600 "2022-08-11T13:48:10Z")

</div>

Hi everyone, I have a question about the arguments of a symbolic expression in the case it is constructed from array variables. Suppose I have an symbolic array and I use it to construct a symbolic expression: @paramet…

---

## [Parallelize nested loop in v1.72](https://discourse.julialang.org/t/parallelize-nested-loop-in-v1-72/85612)

<div class="topic-metadata">

**Author:** [@bast](https://discourse.julialang.org/u/bast)\
**Replies:** 5\
**Last updated:** [August 11, 2022, 1:19pm UTC](https://discourse.julialang.org/t/parallelize-nested-loop-in-v1-72/85612 "2022-08-11T13:19:28Z")

</div>

Hi, I didn’t find any recent thread on this topic and from the documentation it seemed like development in this area was very active so I was wondering if there is some updated information. I run a simulation model tha…

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

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