# General Usage

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

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

**Page:** 435

---

## [Plotting on remote server](https://discourse.julialang.org/t/plotting-on-remote-server/82968)

<div class="topic-metadata">

**Author:** [@Mahmoud](https://discourse.julialang.org/u/Mahmoud)\
**Replies:** 0\
**Last updated:** [June 18, 2022, 12:47pm UTC](https://discourse.julialang.org/t/plotting-on-remote-server/82968 "2022-06-18T12:47:04Z")

</div>

I am runnging my code on supercomputer server and I always receive this error Connection refused GKS: can't connect to GKS socket application GKS: Open failed in routine OPEN\_WS GKS: GKS not in proper state. GKS must b…

---

## [Discussion on improving Julia REPL for beginners](https://discourse.julialang.org/t/discussion-on-improving-julia-repl-for-beginners/82933)

<div class="topic-metadata">

**Author:** [@kdheepak](https://discourse.julialang.org/u/kdheepak)\
**Replies:** 12\
**Last updated:** [June 18, 2022, 12:39pm UTC](https://discourse.julialang.org/t/discussion-on-improving-julia-repl-for-beginners/82933 "2022-06-18T12:39:26Z")

</div>

I wanted to start a discussion on some features that I think it would be nice to have in the Julia REPL by default, and some features that exist in ipython already. Convey difference visually between input prompt, expr…

---

## [Two Language Problem. What is it?](https://discourse.julialang.org/t/two-language-problem-what-is-it/82925)

<div class="topic-metadata">

**Author:** [@ReneganRonin](https://discourse.julialang.org/u/ReneganRonin)\
**Replies:** 7\
**Last updated:** [June 18, 2022, 11:59am UTC](https://discourse.julialang.org/t/two-language-problem-what-is-it/82925 "2022-06-18T11:59:08Z")

</div>

It has been in my mind for a while ever since I was new to the language in late 2020, and I always see the “two-language problem” in many Julia blogs and articles. With my lack of experience in software development and p…

---

## [How to make this graph more beautiful?](https://discourse.julialang.org/t/how-to-make-this-graph-more-beautiful/82912)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 7\
**Last updated:** [June 18, 2022, 6:40am UTC](https://discourse.julialang.org/t/how-to-make-this-graph-more-beautiful/82912 "2022-06-18T06:40:55Z")

</div>

Dear all, I want to add annotations in scatter plot. But the annotations are very large, how to make it smaller and beautiful? julia\> using DataFrames, RDatasets, Plots julia\> df = dataset("datasets", "iris"); julia\> …

---

## [Restrict dispatch domain](https://discourse.julialang.org/t/restrict-dispatch-domain/82953)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 0\
**Last updated:** [June 18, 2022, 5:57am UTC](https://discourse.julialang.org/t/restrict-dispatch-domain/82953 "2022-06-18T05:57:35Z")

</div>

formsumf(x :: Array{T,2}, A::Array{NTuple{3,T}} ) where T\<: Number = sum(x\*mapreduce(Base.splat(Base.vect),hcat, A)) julia\> A=\[(1,2,4),(3,5,4),(3,2,1),(9,2,6),(1,1,2)\] 5-element Vector{Tuple{Int64, Int64, Int64}}: (…

---

## [What is the difference between \`using Plots; gr()\` and "using GR"?](https://discourse.julialang.org/t/what-is-the-difference-between-using-plots-gr-and-using-gr/82947)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 2\
**Last updated:** [June 18, 2022, 5:44am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-using-plots-gr-and-using-gr/82947 "2022-06-18T05:44:16Z")

</div>

Dear all, we can use GR backend, using Plots gr() we can also directly use using GR So what is the difference between two kinds of code?

---

## [Extract a field from an array of structures](https://discourse.julialang.org/t/extract-a-field-from-an-array-of-structures/82916)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 7\
**Last updated:** [June 17, 2022, 11:50pm UTC](https://discourse.julialang.org/t/extract-a-field-from-an-array-of-structures/82916 "2022-06-17T23:50:03Z")

</div>

I was wondering if there is a more elegent way to extract a field from an array of structures. An example follows: julia\> struct Foo i::Int v::Vector{Int} end julia\> foo = Vector{Foo}(und…

---

## [Close Channels when the Last Task Finishes](https://discourse.julialang.org/t/close-channels-when-the-last-task-finishes/82943)

<div class="topic-metadata">

**Author:** [@juliafriend](https://discourse.julialang.org/u/juliafriend)\
**Replies:** 0\
**Last updated:** [June 17, 2022, 9:12pm UTC](https://discourse.julialang.org/t/close-channels-when-the-last-task-finishes/82943 "2022-06-17T21:12:37Z")

</div>

Hi, (This maybe should be in the Julia newbies category?) I know from documentation that if you bind a channel to multiple tasks, bind(c, t1) bind(c, t2) the channel will close when any one of the tasks finishes an…

---

## [Relationship between WeakRef and finalizer (building a cache)](https://discourse.julialang.org/t/relationship-between-weakref-and-finalizer-building-a-cache/82935)

<div class="topic-metadata">

**Author:** [@herzfeldd](https://discourse.julialang.org/u/herzfeldd)\
**Replies:** 0\
**Last updated:** [June 17, 2022, 7:31pm UTC](https://discourse.julialang.org/t/relationship-between-weakref-and-finalizer-building-a-cache/82935 "2022-06-17T19:31:00Z")

</div>

I am hoping someone can tell me what I am doing wrong. Long story short, I am working on a program that does some caching in Julia. My goal is to allow my “cache” structure to be garbage collected as necessary, but any …

---

## [How to create a custom circle plot with arrow and a perpendicular sign for certain point?](https://discourse.julialang.org/t/how-to-create-a-custom-circle-plot-with-arrow-and-a-perpendicular-sign-for-certain-point/82867)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 10\
**Last updated:** [June 17, 2022, 1:28pm UTC](https://discourse.julialang.org/t/how-to-create-a-custom-circle-plot-with-arrow-and-a-perpendicular-sign-for-certain-point/82867 "2022-06-17T13:28:42Z")

</div>

Hi all, I want to create an arrow that can show how many radians a certain point has been rotated, another one is a perpendicular sign from right side triangle, I do not know how to create that symbol in Julia. Picture…

---

## [Reasons that trigger precompilation?](https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 1\
**Last updated:** [June 17, 2022, 9:33am UTC](https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625 "2022-06-17T09:33:34Z")

</div>

I’m using Julia 1.7.2 mostly through Jupyter notebooks and I’m running into a weird thing. Often (but not always), restarting the kernel triggers a recompilations of some key packages (GLM, Flux, CUDA, PyCall, among othe…

---

## [Can I persuade vscode NOT to autocomplete keywords?](https://discourse.julialang.org/t/can-i-persuade-vscode-not-to-autocomplete-keywords/82883)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [June 17, 2022, 7:33am UTC](https://discourse.julialang.org/t/can-i-persuade-vscode-not-to-autocomplete-keywords/82883 "2022-06-17T07:33:39Z")

</div>

It insists on completing for instance end. Very annoying. I cannot find any setting to control this. But, perhaps there is a trick?

---

## [Communication error between local processes and remote processes](https://discourse.julialang.org/t/communication-error-between-local-processes-and-remote-processes/82903)

<div class="topic-metadata">

**Author:** [@Isaia\_Nisoli](https://discourse.julialang.org/u/Isaia_Nisoli)\
**Replies:** 1\
**Last updated:** [June 17, 2022, 5:02am UTC](https://discourse.julialang.org/t/communication-error-between-local-processes-and-remote-processes/82903 "2022-06-17T05:02:14Z")

</div>

Hi, I’m experimenting with a setup and I’m getting a strange behavior. using Distributed loc\_proc = addprocs(4) # this adds processes 2 to 5 on the local machine rem\_proc = addprocs(\[("foo@remote\_machine", :auto)\]) # …

---

## [Creating a corpus with a custom tokenizer](https://discourse.julialang.org/t/creating-a-corpus-with-a-custom-tokenizer/82902)

<div class="topic-metadata">

**Author:** [@Jack\_N](https://discourse.julialang.org/u/Jack_N)\
**Replies:** 1\
**Last updated:** [June 17, 2022, 4:05am UTC](https://discourse.julialang.org/t/creating-a-corpus-with-a-custom-tokenizer/82902 "2022-06-17T04:05:09Z")

</div>

I am trying to build a corpus with a custom tokenizer in Julia but I cannot figure out how to do it. I tried using TextAnalysis.jl’s Corpus function in order to create the corpus, but it does not allow me to specify a to…

---

## [Recommended way to test for precompilation warnings and errors?](https://discourse.julialang.org/t/recommended-way-to-test-for-precompilation-warnings-and-errors/82896)

<div class="topic-metadata">

**Author:** [@Xuan](https://discourse.julialang.org/u/Xuan)\
**Replies:** 1\
**Last updated:** [June 17, 2022, 1:37am UTC](https://discourse.julialang.org/t/recommended-way-to-test-for-precompilation-warnings-and-errors/82896 "2022-06-17T01:37:13Z")

</div>

Several times recently while developing Julia packages, I have found myself needing to test that a particular package feature does not result in precompilation warnings or errors when used by other packages. Often this i…

---

## [Blend pmap with dynamic addprocs() rmprocs() on shared High Performance Computing Cluster](https://discourse.julialang.org/t/blend-pmap-with-dynamic-addprocs-rmprocs-on-shared-high-performance-computing-cluster/82702)

<div class="topic-metadata">

**Author:** [@philip](https://discourse.julialang.org/u/philip)\
**Replies:** 7\
**Last updated:** [June 17, 2022, 12:47am UTC](https://discourse.julialang.org/t/blend-pmap-with-dynamic-addprocs-rmprocs-on-shared-high-performance-computing-cluster/82702 "2022-06-17T00:47:45Z")

</div>

I have a “trivially parallel” computation to run. The function is loosely like this: function process\_one\_iteration(i::Int64, input\_directory::String) x = read\_input\_from\_directory(i, input\_directory::String) …

---

## [Base.modules\_warned\_for silently removed in 1.8](https://discourse.julialang.org/t/base-modules-warned-for-silently-removed-in-1-8/79035)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 133\
**Last updated:** [June 16, 2022, 8:10pm UTC](https://discourse.julialang.org/t/base-modules-warned-for-silently-removed-in-1-8/79035 "2022-06-16T20:10:30Z")

</div>

Looks like Base.modules\_warned\_for no longer exists in 1.8? I can’t find it mentioned in the news. What’s the status please and what’s the recommended way for replacing it?

---

## [Nested Parametric Types and Collections](https://discourse.julialang.org/t/nested-parametric-types-and-collections/82777)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 10\
**Last updated:** [June 16, 2022, 6:49pm UTC](https://discourse.julialang.org/t/nested-parametric-types-and-collections/82777 "2022-06-16T18:49:44Z")

</div>

I’m having trouble understand parametric types and mixing parameters in collections. For example, struct Foo{T, S} a::T b::S end If I have this definition I can do the following: a = Foo(1, 2) b = Foo(1., 2) c…

---

## [Why \`count\` is slower than my code?](https://discourse.julialang.org/t/why-count-is-slower-than-my-code/82856)

<div class="topic-metadata">

**Author:** [@aerdely](https://discourse.julialang.org/u/aerdely)\
**Replies:** 7\
**Last updated:** [June 16, 2022, 1:13pm UTC](https://discourse.julialang.org/t/why-count-is-slower-than-my-code/82856 "2022-06-16T13:13:30Z")

</div>

I was expecting count to be highly optimized, but it seems like it is 10x slower than the following code, why? using BenchmarkTools function contar() c = 0 for i in "?#?##?#?#???####??##" c += i == '#' …

---

## [Include files on (remote) worker processes](https://discourse.julialang.org/t/include-files-on-remote-worker-processes/82807)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 5\
**Last updated:** [June 16, 2022, 10:22am UTC](https://discourse.julialang.org/t/include-files-on-remote-worker-processes/82807 "2022-06-16T10:22:35Z")

</div>

I have pretty much the same setup as described here, that is, I have a local run file that should start parallel computations on remote machines. These computations require functions defined in several files. Simply incl…

---

## [When should we use passmissing?](https://discourse.julialang.org/t/when-should-we-use-passmissing/82844)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 4\
**Last updated:** [June 16, 2022, 8:07am UTC](https://discourse.julialang.org/t/when-should-we-use-passmissing/82844 "2022-06-16T08:07:37Z")

</div>

Dear all, I find that whether or not use passmissing, the results are the same. So when should we use passmissing?Here are some examples. julia\> sqrt(missing) missing julia\> passmissing(sqrt)(missing) missing julia\> …

---

## [How to specify multiple return types of a function](https://discourse.julialang.org/t/how-to-specify-multiple-return-types-of-a-function/82861)

<div class="topic-metadata">

**Author:** [@Fred](https://discourse.julialang.org/u/Fred)\
**Replies:** 2\
**Last updated:** [June 16, 2022, 8:02am UTC](https://discourse.julialang.org/t/how-to-specify-multiple-return-types-of-a-function/82861 "2022-06-16T08:02:22Z")

</div>

Hi, Specifying the return type of a function in Julia does not improve the code speed, but it can improve the clarity of the code. In Julia documentation it is not explain how to give more than one return type to a fun…

---

## [Cast \`Real\` to the closest representable value by default (or excess)](https://discourse.julialang.org/t/cast-real-to-the-closest-representable-value-by-default-or-excess/82811)

<div class="topic-metadata">

**Author:** [@etienne\_dg](https://discourse.julialang.org/u/etienne_dg)\
**Replies:** 3\
**Last updated:** [June 16, 2022, 7:33am UTC](https://discourse.julialang.org/t/cast-real-to-the-closest-representable-value-by-default-or-excess/82811 "2022-06-16T07:33:35Z")

</div>

I want to get the closest representation by default of a value x of type U\<:Real by a value y of type T\<:Real. If T\<:Integer, I can do y = floor(T, x) If T is a Float, I can do T(x). But none of these methods cover b…

---

## [Best practice setting up docs environment for an unregistered package](https://discourse.julialang.org/t/best-practice-setting-up-docs-environment-for-an-unregistered-package/82773)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 7\
**Last updated:** [June 15, 2022, 11:31pm UTC](https://discourse.julialang.org/t/best-practice-setting-up-docs-environment-for-an-unregistered-package/82773 "2022-06-15T23:31:35Z")

</div>

I’m trying to use Documenter.jl to generate documentation for an unregistered package. What is the best practice for setting up the docs directory environment for this? The AnotherParser project (GitHub - MarkNahabedia…

---

## [GDAL/ogr2ogr File Conversion](https://discourse.julialang.org/t/gdal-ogr2ogr-file-conversion/82835)

<div class="topic-metadata">

**Author:** [@hexjulia](https://discourse.julialang.org/u/hexjulia)\
**Replies:** 4\
**Last updated:** [June 15, 2022, 10:29pm UTC](https://discourse.julialang.org/t/gdal-ogr2ogr-file-conversion/82835 "2022-06-15T22:29:10Z")

</div>

Hi all, I’m trying to complete what I thought would be a relatively simple task (although I am new to Julia and coding in general) with GDAL, specifically converting a .shp to a GeoPackage using ogr2ogr. I’ve followed …

---

## [What is the problem with this Julia code?](https://discourse.julialang.org/t/what-is-the-problem-with-this-julia-code/82827)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 8\
**Last updated:** [June 15, 2022, 10:23pm UTC](https://discourse.julialang.org/t/what-is-the-problem-with-this-julia-code/82827 "2022-06-15T22:23:57Z")

</div>

I wrote a function that plots several boxplots, ordered by the orders of a factor (categorical variable). It works, but VSCode keeps telling me there is a problem in one of the lines. Would someone know the reason? Here…

---

## [Serializing nested Dicts (or DataFrames) so that they can (easily) be loaded in Python as well?](https://discourse.julialang.org/t/serializing-nested-dicts-or-dataframes-so-that-they-can-easily-be-loaded-in-python-as-well/82809)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 3\
**Last updated:** [June 15, 2022, 10:21pm UTC](https://discourse.julialang.org/t/serializing-nested-dicts-or-dataframes-so-that-they-can-easily-be-loaded-in-python-as-well/82809 "2022-06-15T22:21:06Z")

</div>

From my simulations, I typically end up with (somewhat convoluted) Dicts and/or DataFrames made from these dicts that contain my input parameters as well as my results. Depending on the complexity of the results, they mi…

---

## [Incomplete description of type vector of pairs](https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 6\
**Last updated:** [June 15, 2022, 9:41pm UTC](https://discourse.julialang.org/t/incomplete-description-of-type-vector-of-pairs/82706 "2022-06-15T21:41:55Z")

</div>

Why does Julia not fully describe the type of the elements of the pair vector? shouldn’t it be the union of the types of the individual elements of the vector? Pair{Tuple{Char, Int64, Int64}, Float64} #and Pair{Tuple{C…

---

## [Yield() not behaving as expected](https://discourse.julialang.org/t/yield-not-behaving-as-expected/82784)

<div class="topic-metadata">

**Author:** [@mjg](https://discourse.julialang.org/u/mjg)\
**Replies:** 2\
**Last updated:** [June 15, 2022, 9:02pm UTC](https://discourse.julialang.org/t/yield-not-behaving-as-expected/82784 "2022-06-15T21:02:11Z")

</div>

I’m trying to make a producer-consumer threaded program, but can’t figure out why yield seems not to be ceding control to worker tasks most of the time. Simplified Example I’ve created a much simpler example that replic…

---

## [Zygote very slow relative to ForwardDiff?](https://discourse.julialang.org/t/zygote-very-slow-relative-to-forwarddiff/82837)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 1\
**Last updated:** [June 15, 2022, 8:56pm UTC](https://discourse.julialang.org/t/zygote-very-slow-relative-to-forwarddiff/82837 "2022-06-15T20:56:59Z")

</div>

I’m trying to speed up fitting a model with DynamicHMC.jl, so I was experimenting with different autodiff packages. I’ve seen Zygote mentioned quite a bit as a promising autodiff package, but the performance seems to be…

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

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