# General Usage

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

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

**Page:** 648

---

## [Package Manager Bug? - different behaviour in different Jupyter notbooks](https://discourse.julialang.org/t/package-manager-bug-different-behaviour-in-different-jupyter-notbooks/54698)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 0\
**Last updated:** [February 5, 2021, 5:24pm UTC](https://discourse.julialang.org/t/package-manager-bug-different-behaviour-in-different-jupyter-notbooks/54698 "2021-02-05T17:24:54Z")

</div>

Hi. I loaded LIBSVM in a Jupyter window and it loaded and ran fine. I opened another notebook in the same session (same environment) and imported LIBSVM ok but kept on getting the error could not load library "/Users…

---

## [Preallocate an array of tuples](https://discourse.julialang.org/t/preallocate-an-array-of-tuples/54699)

<div class="topic-metadata">

**Author:** [@nelsonah](https://discourse.julialang.org/u/nelsonah)\
**Replies:** 7\
**Last updated:** [February 5, 2021, 8:38pm UTC](https://discourse.julialang.org/t/preallocate-an-array-of-tuples/54699 "2021-02-05T20:38:14Z")

</div>

This should be trivial but I’m stumped. Simple code snippet: # points = Array{(UInt8, UInt8, UInt8)}(undef, x\_size, y\_size) points = Array{undef,(6, 4)} # compiles, but not valid val = (100, 225, 255) points\[2\]\[3\] …

---

## [How to use generic constructors in interface modules?](https://discourse.julialang.org/t/how-to-use-generic-constructors-in-interface-modules/54619)

<div class="topic-metadata">

**Author:** [@marty0801](https://discourse.julialang.org/u/marty0801)\
**Replies:** 6\
**Last updated:** [February 5, 2021, 4:56pm UTC](https://discourse.julialang.org/t/how-to-use-generic-constructors-in-interface-modules/54619 "2021-02-05T16:56:43Z")

</div>

I’m writing an interface module that contains a function that transforms any subtype of a given user-defined abstract type. I’m unclear how to write this in an interface module, since the constructor of the concrete coll…

---

## [Logging error, close file](https://discourse.julialang.org/t/logging-error-close-file/54640)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 4:41pm UTC](https://discourse.julialang.org/t/logging-error-close-file/54640 "2021-02-05T16:41:55Z")

</div>

I defined a file Logger in a Module and close the logger file in the test file. Error occurs as follows. Is this the proper way to use Logger in a user-defined module? Thanks! module SomeModule const g\_pkg\_dir = dir…

---

## [Hi, I created a new package recently, https://github.com/AlexisRenchon/DAMMmodel.j](https://discourse.julialang.org/t/hi-i-created-a-new-package-recently-https-github-com-alexisrenchon-dammmodel-j/54693)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 5, 2021, 4:00pm UTC](https://discourse.julialang.org/t/hi-i-created-a-new-package-recently-https-github-com-alexisrenchon-dammmodel-j/54693 "2021-02-05T16:00:38Z")

</div>

Hi, I created a new package recently, https://github.com/AlexisRenchon/DAMMmodel.jl and I noticed that the first time I could use its function directly like: using DAMMmodel DAMM\_Makie() but then I released a new ver…

---

## [HTTP.setheaders for file download](https://discourse.julialang.org/t/http-setheaders-for-file-download/54680)

<div class="topic-metadata">

**Author:** [@Laco\_Kovac](https://discourse.julialang.org/u/Laco_Kovac)\
**Replies:** 1\
**Last updated:** [February 5, 2021, 3:09pm UTC](https://discourse.julialang.org/t/http-setheaders-for-file-download/54680 "2021-02-05T15:09:07Z")

</div>

This is the code of web server. In this rest api response, I want the text to be downloaded in the file named results.csv (i.e. user should get the file “results.csv” in the Downloads folder). Here is the code: if last…

---

## [What are the functionality restrictions when compiling Julia with \`USE\_GPL\_LIBS=0\`?](https://discourse.julialang.org/t/what-are-the-functionality-restrictions-when-compiling-julia-with-use-gpl-libs-0/54674)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 5, 2021, 1:53pm UTC](https://discourse.julialang.org/t/what-are-the-functionality-restrictions-when-compiling-julia-with-use-gpl-libs-0/54674 "2021-02-05T13:53:16Z")

</div>

What are the functionality restrictions when compiling Julia with USE\_GPL\_LIBS=0 ? Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to …

---

## [Workflow when Debugger is too slow, module not exporting everything](https://discourse.julialang.org/t/workflow-when-debugger-is-too-slow-module-not-exporting-everything/54683)

<div class="topic-metadata">

**Author:** [@vsaase](https://discourse.julialang.org/u/vsaase)\
**Replies:** 1\
**Last updated:** [February 5, 2021, 12:47pm UTC](https://discourse.julialang.org/t/workflow-when-debugger-is-too-slow-module-not-exporting-everything/54683 "2021-02-05T12:47:00Z")

</div>

Hi, I am trying to debug a package I am writing and find myself often manually stepping through the functions in the REPL. It worked before I put everything into a module, but now I cannot copy paste the source from ins…

---

## [Eval scoping in macros, or removing eval completely](https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 7\
**Last updated:** [February 5, 2021, 11:42am UTC](https://discourse.julialang.org/t/eval-scoping-in-macros-or-removing-eval-completely/54602 "2021-02-05T11:42:46Z")

</div>

Hi all, Took a stroll into marco coding and got totally lost. Trying to solve this issue. Breakdown: We have a simple enough macro helper @agent, which generates a few different types of struct depending on input. @a…

---

## [Revise post-compilation hooks](https://discourse.julialang.org/t/revise-post-compilation-hooks/54629)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 9:50am UTC](https://discourse.julialang.org/t/revise-post-compilation-hooks/54629 "2021-02-05T09:50:20Z")

</div>

I was wondering if there is any way to hook into Revise’s compilation cycle. I’m aware of entr which is great when watching files - and basically what I’m looking for is similar behavior but for code changes that are not…

---

## [No method matching ::Type{A{\<:Real}}, only ::Type{A{T}} where {T\<:Real}](https://discourse.julialang.org/t/no-method-matching-type-a-real-only-type-a-t-where-t-real/54673)

<div class="topic-metadata">

**Author:** [@ikirill](https://discourse.julialang.org/u/ikirill)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 8:40am UTC](https://discourse.julialang.org/t/no-method-matching-type-a-real-only-type-a-t-where-t-real/54673 "2021-02-05T08:40:44Z")

</div>

I can’t find this in the julia manual right now, but I’d always assumed that using \<:Real inside a type on the left-hand side of a function definition f(x::A{\<:Real}) is just an alias to f(x::A{T}) where {T\<:Real}. But w…

---

## [I don't see any caveats in \`Setfield.jl / Accessors.jl\`, but I'm getting a method](https://discourse.julialang.org/t/i-dont-see-any-caveats-in-setfield-jl-accessors-jl-but-im-getting-a-method/54657)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 5, 2021, 7:59am UTC](https://discourse.julialang.org/t/i-dont-see-any-caveats-in-setfield-jl-accessors-jl-but-im-getting-a-method/54657 "2021-02-05T07:59:25Z")

</div>

I don’t see any caveats in Setfield.jl / Accessors.jl, but I’m getting a method error (ERROR: LoadError: MethodError: no method matching) for the constructor that I’m trying to mutate. Are limitations outlined anywhere? …

---

## [MethodError: no method matching (::GeometricFlux.var"#adjacency\_matrix#76")](https://discourse.julialang.org/t/methoderror-no-method-matching-geometricflux-var-adjacency-matrix-76/54668)

<div class="topic-metadata">

**Author:** [@rezabayani](https://discourse.julialang.org/u/rezabayani)\
**Replies:** 0\
**Last updated:** [February 5, 2021, 2:59am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-geometricflux-var-adjacency-matrix-76/54668 "2021-02-05T02:59:33Z")

</div>

Hi. This issue is basically the same as the one in GeoemtricFlux.jl issues at Method error when training GCNConv with FeaturedGraph input · Issue #76 · FluxML/GeometricFlux.jl · GitHub. I tried replying there but did not…

---

## [Turn off interactive plotting in GR](https://discourse.julialang.org/t/turn-off-interactive-plotting-in-gr/54650)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 10:52pm UTC](https://discourse.julialang.org/t/turn-off-interactive-plotting-in-gr/54650 "2021-02-04T22:52:23Z")

</div>

How do I just save to pdf without showing the plot? Running on on hpc, I call eg plot(stuff); savefig() but I have to suppress these previews somehow to avoid errors from non-existent qt5: connect: Connection refused G…

---

## [Ambiguity with Vararg outer constructor and inner constructor](https://discourse.julialang.org/t/ambiguity-with-vararg-outer-constructor-and-inner-constructor/54622)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 8\
**Last updated:** [February 4, 2021, 10:00pm UTC](https://discourse.julialang.org/t/ambiguity-with-vararg-outer-constructor-and-inner-constructor/54622 "2021-02-04T22:00:18Z")

</div>

I have a working Point type that works smoothly in 2D and 3D with various outer constructors: using StaticArrays struct Point{Dim,T} coords::SVector{Dim,T} end # convenience constructors Point{Dim,T}(coords::NTuple{…

---

## [Running server with HTTP.jl in async mode?](https://discourse.julialang.org/t/running-server-with-http-jl-in-async-mode/54560)

<div class="topic-metadata">

**Author:** [@DataPsycho](https://discourse.julialang.org/u/DataPsycho)\
**Replies:** 5\
**Last updated:** [February 4, 2021, 6:55pm UTC](https://discourse.julialang.org/t/running-server-with-http-jl-in-async-mode/54560 "2021-02-04T18:55:29Z")

</div>

Hi, I have created a http web service, the concept is taken from the presentation of Quinnj’s MusicAlbum project. 1 thing I am not sure about. If I want to initiate the server with @async mode from the terminal it initi…

---

## [(X-Post from Zulip)Hi all! I have a list of Polygons and would like to plot all](https://discourse.julialang.org/t/x-post-from-zulip-hi-all-i-have-a-list-of-polygons-and-would-like-to-plot-all/54625)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 5:37pm UTC](https://discourse.julialang.org/t/x-post-from-zulip-hi-all-i-have-a-list-of-polygons-and-would-like-to-plot-all/54625 "2021-02-04T17:37:22Z")

</div>

(X-Post from Zulip) Hi all! I have a list of Polygons and would like to plot all the shapes on the same plot where each shape has a different color. What I have been doing is something like this: using Plots .... fo…

---

## [How to increase BigFloat precision](https://discourse.julialang.org/t/how-to-increase-bigfloat-precision/54634)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 5:32pm UTC](https://discourse.julialang.org/t/how-to-increase-bigfloat-precision/54634 "2021-02-04T17:32:59Z")

</div>

I need more decimal places with a BigFloat type variable. How to? Thanks!

---

## [Create dataframe with n columns of strings](https://discourse.julialang.org/t/create-dataframe-with-n-columns-of-strings/36693)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 6\
**Last updated:** [February 4, 2021, 4:33pm UTC](https://discourse.julialang.org/t/create-dataframe-with-n-columns-of-strings/36693 "2021-02-04T16:33:54Z")

</div>

I’m sure there is a simple way to do this, but I cannot figure this out. Is there a simple way to create a dataFrame of n columns of all String type? I know I can do this DataFrame(\[String,String,String\],\[:x1, :x2, :x…

---

## [Enumeratezip](https://discourse.julialang.org/t/enumeratezip/54617)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 9\
**Last updated:** [February 4, 2021, 4:23pm UTC](https://discourse.julialang.org/t/enumeratezip/54617 "2021-02-04T16:23:59Z")

</div>

I often would like to use something like enumerate(a,b,c) and get the functionality: a,b,c = rand(10),rand(10),rand(10) for (i,ai,bi,ci) in enumerate(a,b,c) @show i ai bi ci end something that could emulate this is e…

---

## [How to start two (or more) instances of Julia on different CPU cores?](https://discourse.julialang.org/t/how-to-start-two-or-more-instances-of-julia-on-different-cpu-cores/54610)

<div class="topic-metadata">

**Author:** [@Martin](https://discourse.julialang.org/u/Martin)\
**Replies:** 2\
**Last updated:** [February 4, 2021, 2:12pm UTC](https://discourse.julialang.org/t/how-to-start-two-or-more-instances-of-julia-on-different-cpu-cores/54610 "2021-02-04T14:12:48Z")

</div>

I want to start several instances of Julia and run some pretty time consuming (different) simulations. The underlying hardware has several CPU cores and I would like to make sure that each instance uses a different core,…

---

## [Yota.jl getindex error](https://discourse.julialang.org/t/yota-jl-getindex-error/54595)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 3\
**Last updated:** [February 4, 2021, 11:36am UTC](https://discourse.julialang.org/t/yota-jl-getindex-error/54595 "2021-02-04T11:36:42Z")

</div>

I am trying to calculate the gradient of this function: using Yota f(x) = sum(getindex(x, \[1 3; 4 2\])) s = rand(2,2) val, g = Yota.grad(f, s) If s = rand(2) my code works but the above code returns this error: \> Fa…

---

## [What do I need to do to a struct to use it in a boolean context?](https://discourse.julialang.org/t/what-do-i-need-to-do-to-a-struct-to-use-it-in-a-boolean-context/54545)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 4, 2021, 10:48am UTC](https://discourse.julialang.org/t/what-do-i-need-to-do-to-a-struct-to-use-it-in-a-boolean-context/54545 "2021-02-04T10:48:26Z")

</div>

What do I need to do to a struct to use it in a boolean context? julia&gt; struct Foo bool::Bool end julia&gt; if Foo(true) println("How do I make this work?") end ERROR: TypeError: non-bool…

---

## [Surprising @fastmath behavior](https://discourse.julialang.org/t/surprising-fastmath-behavior/54600)

<div class="topic-metadata">

**Author:** [@Christian\_Rorvik](https://discourse.julialang.org/u/Christian_Rorvik)\
**Replies:** 3\
**Last updated:** [February 4, 2021, 10:45am UTC](https://discourse.julialang.org/t/surprising-fastmath-behavior/54600 "2021-02-04T10:45:54Z")

</div>

Here’s something that caught me off guard. Example is reduced to trivial code, but I caught this in a much more complex context. function foo(a, b, c) @fastmath x = a \* b + c isnan(x) ? 0.0 : x end code\_native(f…

---

## [How do you invoke a method (like a specific method, not a function)?\`\`\`julia&gt;](https://discourse.julialang.org/t/how-do-you-invoke-a-method-like-a-specific-method-not-a-function-julia-gt/54605)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 4, 2021, 10:45am UTC](https://discourse.julialang.org/t/how-do-you-invoke-a-method-like-a-specific-method-not-a-function-julia-gt/54605 "2021-02-04T10:45:12Z")

</div>

How do you invoke a method (like a specific method, not a function)? julia&gt; func(a) =5 func (generic function with 1 method) julia&gt; meth = first(methods(func)) func(a) in Main at REPL\[83\]:1 julia&gt; meth(1) ERR…

---

## [Boundary conditions](https://discourse.julialang.org/t/boundary-conditions/54609)

<div class="topic-metadata">

**Author:** [@Rony](https://discourse.julialang.org/u/Rony)\
**Replies:** 0\
**Last updated:** [February 4, 2021, 10:39am UTC](https://discourse.julialang.org/t/boundary-conditions/54609 "2021-02-04T10:39:41Z")

</div>

I want to select particular nodes in my 2D mesh to apply boundary conditions and traction. I saw the examples where the entire left face have been selected. My mesh looks like this. I want to apply constraint in node 1 …

---

## [Performance of structs with incompletely parameterized fields](https://discourse.julialang.org/t/performance-of-structs-with-incompletely-parameterized-fields/54580)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 3\
**Last updated:** [February 4, 2021, 9:29am UTC](https://discourse.julialang.org/t/performance-of-structs-with-incompletely-parameterized-fields/54580 "2021-02-04T09:29:08Z")

</div>

Hello, I the performance section, it was stated that we should avoid fields with abstract types struct MyAmbiguousStruct val::AbstractFloat end But what about incompletely parameterized types? How bad is something …

---

## [Pkg protocol - delay in updating GeneralRegistry](https://discourse.julialang.org/t/pkg-protocol-delay-in-updating-generalregistry/54521)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 6\
**Last updated:** [February 4, 2021, 8:09am UTC](https://discourse.julialang.org/t/pkg-protocol-delay-in-updating-generalregistry/54521 "2021-02-04T08:09:34Z")

</div>

I have recently registered new versions of some of my packages. These versions became available immediately on julia-1.3, but are invisible on julia-1.5. I removed the registries subdir of the .julia dir and indeed, whe…

---

## [Embedding julia in C, Segmentation fault when call hcat to concatenate two arrays](https://discourse.julialang.org/t/embedding-julia-in-c-segmentation-fault-when-call-hcat-to-concatenate-two-arrays/54597)

<div class="topic-metadata">

**Author:** [@fanxp](https://discourse.julialang.org/u/fanxp)\
**Replies:** 2\
**Last updated:** [February 4, 2021, 8:07am UTC](https://discourse.julialang.org/t/embedding-julia-in-c-segmentation-fault-when-call-hcat-to-concatenate-two-arrays/54597 "2021-02-04T08:07:47Z")

</div>

Hi, I need to call some julia function in C, but meet some problem. For example, I want to use hcat to concatenate two arrays, but segmentation fault occurs. Below is my source code. #include \<stdlib.h\> #include \<julia…

---

## [Unexpected type instability with getproperty but not setproperty!](https://discourse.julialang.org/t/unexpected-type-instability-with-getproperty-but-not-setproperty/26975)

<div class="topic-metadata">

**Author:** [@cshenton](https://discourse.julialang.org/u/cshenton)\
**Replies:** 17\
**Last updated:** [February 4, 2021, 6:34am UTC](https://discourse.julialang.org/t/unexpected-type-instability-with-getproperty-but-not-setproperty/26975 "2021-02-04T06:34:02Z")

</div>

Julia 1.1.0 on macOS mojave In the following example, I’d expect branch elimination to make both of the following type stable, however getproperty isn’t type stable and is allocating. Could someone shed some light on wh…

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

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