# General Usage

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

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

**Page:** 712

---

## [Variable scope/function usage](https://discourse.julialang.org/t/variable-scope-function-usage/45226)

<div class="topic-metadata">

**Author:** [@trathi](https://discourse.julialang.org/u/trathi)\
**Replies:** 2\
**Last updated:** [August 19, 2020, 7:54pm UTC](https://discourse.julialang.org/t/variable-scope-function-usage/45226 "2020-08-19T19:54:05Z")

</div>

A variable declared outside a function is recognized inside a function without actually passing it as an argument to it. For e.g. the script below runs perfectly. const y = 3 function operate(x) println(x^2+y) end o…

---

## [Running several versions of Julia](https://discourse.julialang.org/t/running-several-versions-of-julia/45221)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 3\
**Last updated:** [August 19, 2020, 6:56pm UTC](https://discourse.julialang.org/t/running-several-versions-of-julia/45221 "2020-08-19T18:56:52Z")

</div>

Hi, tl;dr What’s the best way to easily switch back and forth between multiple Julia versions? System Config First, my setup… I have a Linux machine with a julia directory containing chad@boondoggle:~/julia ➤ tree -L …

---

## [Understanding distributed computing taxonomy](https://discourse.julialang.org/t/understanding-distributed-computing-taxonomy/45210)

<div class="topic-metadata">

**Author:** [@Joao\_Barata](https://discourse.julialang.org/u/Joao_Barata)\
**Replies:** 1\
**Last updated:** [August 19, 2020, 4:15pm UTC](https://discourse.julialang.org/t/understanding-distributed-computing-taxonomy/45210 "2020-08-19T16:15:23Z")

</div>

Hi, I’m doing my first steps in terms of distributed computing and I was going through the distributed computing page in the julia documentation. I’ve also done a bit of research into parallel computing in general. The…

---

## [Unable to access the homepage of Plots](https://discourse.julialang.org/t/unable-to-access-the-homepage-of-plots/45200)

<div class="topic-metadata">

**Author:** [@heniancheng](https://discourse.julialang.org/u/heniancheng)\
**Replies:** 3\
**Last updated:** [August 19, 2020, 1:20pm UTC](https://discourse.julialang.org/t/unable-to-access-the-homepage-of-plots/45200 "2020-08-19T13:20:57Z")

</div>

Unable to access this site “docs.juliaplots.org”

---

## [Larger than memory table format with lazy reads?](https://discourse.julialang.org/t/larger-than-memory-table-format-with-lazy-reads/45123)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 5\
**Last updated:** [August 19, 2020, 12:33pm UTC](https://discourse.julialang.org/t/larger-than-memory-table-format-with-lazy-reads/45123 "2020-08-19T12:33:09Z")

</div>

Let’s say, I have some storage with a table-like data in it. For example, it is a single big binary file with serialized array of StoredRow structures: struct StoredRow a::Float64 b::Float64 c::UInt16 end A…

---

## [How to make animated bar chart in julia?](https://discourse.julialang.org/t/how-to-make-animated-bar-chart-in-julia/45168)

<div class="topic-metadata">

**Author:** [@hafez\_ahmad](https://discourse.julialang.org/u/hafez_ahmad)\
**Replies:** 2\
**Last updated:** [August 19, 2020, 12:03pm UTC](https://discourse.julialang.org/t/how-to-make-animated-bar-chart-in-julia/45168 "2020-08-19T12:03:21Z")

</div>

I like to make an animated (gif) bar plot year wise. I have attached the gdp per capita.csv. I can make it using python Matplollib but how I can make it in Julia plot makie ? thanks in advance :blush: :blush: :blush: …

---

## [Why is reduce with concatenation type unstable?](https://discourse.julialang.org/t/why-is-reduce-with-concatenation-type-unstable/45023)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [August 19, 2020, 10:22am UTC](https://discourse.julialang.org/t/why-is-reduce-with-concatenation-type-unstable/45023 "2020-08-19T10:22:45Z")

</div>

reduce(vcat, arr) returns a scalar or an array depending on the length of the array. julia\> reduce(vcat, \[1\]) 1 julia\> reduce(vcat, \[1,2\]) 2-element Array{Int64,1}: 1 2 julia\> @code\_warntype reduce(vcat, \[1,2\]) Vari…

---

## [Change Gtk.jl button icon](https://discourse.julialang.org/t/change-gtk-jl-button-icon/45195)

<div class="topic-metadata">

**Author:** [@kobied](https://discourse.julialang.org/u/kobied)\
**Replies:** 0\
**Last updated:** [August 19, 2020, 6:37am UTC](https://discourse.julialang.org/t/change-gtk-jl-button-icon/45195 "2020-08-19T06:37:38Z")

</div>

hello, i’m building a GUI using Gtk.jl and i need to change a button icon once pressed. To create the button with an icon i use: rec\_icon = load(img\_path) rec\_btn = Button(Image(Pixbuf(data=rec\_icon, has\_alpha=false))…

---

## [Colormap with an alpha channel](https://discourse.julialang.org/t/colormap-with-an-alpha-channel/45122)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 1\
**Last updated:** [August 19, 2020, 12:46am UTC](https://discourse.julialang.org/t/colormap-with-an-alpha-channel/45122 "2020-08-19T00:46:11Z")

</div>

does anyone knows how to get a colormap, i.e. viridis with an alpha channel ? (with transparencies).

---

## [Flux gpu gradient failing](https://discourse.julialang.org/t/flux-gpu-gradient-failing/45127)

<div class="topic-metadata">

**Author:** [@victorialena](https://discourse.julialang.org/u/victorialena)\
**Replies:** 5\
**Last updated:** [August 18, 2020, 7:48pm UTC](https://discourse.julialang.org/t/flux-gpu-gradient-failing/45127 "2020-08-18T19:48:16Z")

</div>

Hi, I have been using Flux for about 2 months now and my NN got to the point where GPU usage would be great to speed things up however I am running onto some weird issues: I get an error of CuArray only supports bits t…

---

## [Question about findmax](https://discourse.julialang.org/t/question-about-findmax/45149)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 14\
**Last updated:** [August 18, 2020, 7:36pm UTC](https://discourse.julialang.org/t/question-about-findmax/45149 "2020-08-18T19:36:59Z")

</div>

this is my code: using StatsBase,DelimitedFiles #function Characteristics(Data,) global max\_index\_mean\_var=Matrix{Matrix{Float64}}(undef,4\*size(Data,1),size(Data,2)) # global mean\_var=Matrix{Matrix{Float64}}(unde…

---

## [Speed up parallel maximum across columns](https://discourse.julialang.org/t/speed-up-parallel-maximum-across-columns/45006)

<div class="topic-metadata">

**Author:** [@fyang](https://discourse.julialang.org/u/fyang)\
**Replies:** 1\
**Last updated:** [August 18, 2020, 7:06pm UTC](https://discourse.julialang.org/t/speed-up-parallel-maximum-across-columns/45006 "2020-08-18T19:06:42Z")

</div>

Hi Julia community! I need help on speeding up a function with parallelization. Here’s a MWE. using Distributed; n\_cores = 3; addprocs(n\_cores) @everywhere using SharedArrays, BenchmarkTools M = 10000; N = 10000; k = 2…

---

## [For loop in 2D array](https://discourse.julialang.org/t/for-loop-in-2d-array/45175)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 2\
**Last updated:** [August 18, 2020, 7:05pm UTC](https://discourse.julialang.org/t/for-loop-in-2d-array/45175 "2020-08-18T19:05:02Z")

</div>

How do I use a for loop to iterate in a 2D array only in a specific row or column? pseudo code a = \[1 2; 3 4\] for x in a only row\[1\] println(x) end output 1 2 Thanks!

---

## [Changing order in the legend](https://discourse.julialang.org/t/changing-order-in-the-legend/45158)

<div class="topic-metadata">

**Author:** [@morkip](https://discourse.julialang.org/u/morkip)\
**Replies:** 2\
**Last updated:** [August 18, 2020, 3:40pm UTC](https://discourse.julialang.org/t/changing-order-in-the-legend/45158 "2020-08-18T15:40:36Z")

</div>

I am creating a plot with multiple lines for comparison using plot!(..) for each new line. The line I plot first, appears at the very bottom of all the lines but at the first line of the legend. Obviously, it is very eas…

---

## [Fortran modules and Julia modules](https://discourse.julialang.org/t/fortran-modules-and-julia-modules/45053)

<div class="topic-metadata">

**Author:** [@Adelson\_Oliveira](https://discourse.julialang.org/u/Adelson_Oliveira)\
**Replies:** 8\
**Last updated:** [August 18, 2020, 3:13pm UTC](https://discourse.julialang.org/t/fortran-modules-and-julia-modules/45053 "2020-08-18T15:13:46Z")

</div>

Hi, Is already possible to plainly use FORTRAN modules in Julia? If not, are there plans to allow for Julia using FORTRAN modules ( .o and .mod)? Thanks in advance

---

## [Exact sqrt in Julia?](https://discourse.julialang.org/t/exact-sqrt-in-julia/45140)

<div class="topic-metadata">

**Author:** [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Replies:** 13\
**Last updated:** [August 18, 2020, 2:52pm UTC](https://discourse.julialang.org/t/exact-sqrt-in-julia/45140 "2020-08-18T14:52:09Z")

</div>

I want to check if an expression evaluates to Integer result. I know this is never the best solution, but I ran out of ideas and not able to come up with an algorithm to solve the problem in a reasonable time. The only w…

---

## [ApproxFun and Mobius Transforms](https://discourse.julialang.org/t/approxfun-and-mobius-transforms/45161)

<div class="topic-metadata">

**Author:** [@white-c](https://discourse.julialang.org/u/white-c)\
**Replies:** 0\
**Last updated:** [August 18, 2020, 2:48pm UTC](https://discourse.julialang.org/t/approxfun-and-mobius-transforms/45161 "2020-08-18T14:48:32Z")

</div>

I am just starting to learn how to work with ApproxFun. I have worked through a few examples. Now, I want to use it for Mobius transformations. However, I am not sure the best basis to use. Any suggestions on how to work…

---

## [\[Beginner\] How do I see the methods on a type I'm extending?](https://discourse.julialang.org/t/beginner-how-do-i-see-the-methods-on-a-type-im-extending/45155)

<div class="topic-metadata">

**Author:** [@haydenjones](https://discourse.julialang.org/u/haydenjones)\
**Replies:** 3\
**Last updated:** [August 18, 2020, 2:46pm UTC](https://discourse.julialang.org/t/beginner-how-do-i-see-the-methods-on-a-type-im-extending/45155 "2020-08-18T14:46:11Z")

</div>

struct Thing name::AbstractString) end struct ThingHolder holding::Thing end function sayer(t) println(x.name) end function sayer(t\_h) print(t\_h.holding.name) end my\_holder = ThingHolder(Thing("hayden")) say…

---

## [Adding command line scripts to path when installing packages?](https://discourse.julialang.org/t/adding-command-line-scripts-to-path-when-installing-packages/43414)

<div class="topic-metadata">

**Author:** [@onetonfoot](https://discourse.julialang.org/u/onetonfoot)\
**Replies:** 6\
**Last updated:** [August 18, 2020, 12:40pm UTC](https://discourse.julialang.org/t/adding-command-line-scripts-to-path-when-installing-packages/43414 "2020-08-18T12:40:21Z")

</div>

What’s the easiest way to add a julia script to a users path when they install a package? I’m wondering if there is a equivalent to entry\_points in pythons setup.py

---

## [Zygote.gradient(): Mutating arrays is not supported](https://discourse.julialang.org/t/zygote-gradient-mutating-arrays-is-not-supported/45148)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [August 18, 2020, 10:01am UTC](https://discourse.julialang.org/t/zygote-gradient-mutating-arrays-is-not-supported/45148 "2020-08-18T10:01:42Z")

</div>

When I do a gradient calculation with Zygote, it throw an error: Mutating arrays is not supported. I don’t know why it went wrong, how should I correct it, or how should I debug it so that I would know where it went wron…

---

## [Collecting results in proper order using Multi-threading](https://discourse.julialang.org/t/collecting-results-in-proper-order-using-multi-threading/44889)

<div class="topic-metadata">

**Author:** [@mors](https://discourse.julialang.org/u/mors)\
**Replies:** 7\
**Last updated:** [August 18, 2020, 10:01am UTC](https://discourse.julialang.org/t/collecting-results-in-proper-order-using-multi-threading/44889 "2020-08-18T10:01:16Z")

</div>

Hi, I am performing Montecarlo type method and I would like to perform the Multi-Treding. Unfortunately, I am a beginner in Multi-threading for operations of the form n\_{i}/n\_{i-1}. Usually, I perform multiple cores t…

---

## [Does multithreading require a new process?](https://discourse.julialang.org/t/does-multithreading-require-a-new-process/45056)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 11\
**Last updated:** [August 18, 2020, 8:14am UTC](https://discourse.julialang.org/t/does-multithreading-require-a-new-process/45056 "2020-08-18T08:14:02Z")

</div>

I’m looking at the new multithreading features (vs. multiprocess). Based on the documentation, it looks like currently you cannot generate new threads in a running Julia process? That is, they need to be specified as a s…

---

## [Zygote : Can't differentiate gc\_preserve\_end expression](https://discourse.julialang.org/t/zygote-cant-differentiate-gc-preserve-end-expression/44973)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 9\
**Last updated:** [August 18, 2020, 2:25am UTC](https://discourse.julialang.org/t/zygote-cant-differentiate-gc-preserve-end-expression/44973 "2020-08-18T02:25:57Z")

</div>

An error was reported when I called Zygote.gradient, with the following error message. What should I do to resolve it?

---

## [Literate to generate markdown programmatically](https://discourse.julialang.org/t/literate-to-generate-markdown-programmatically/44888)

<div class="topic-metadata">

**Author:** [@jdlara-berkeley](https://discourse.julialang.org/u/jdlara-berkeley)\
**Replies:** 5\
**Last updated:** [August 17, 2020, 7:44pm UTC](https://discourse.julialang.org/t/literate-to-generate-markdown-programmatically/44888 "2020-08-17T19:44:14Z")

</div>

I want to generate Markdown entries programmatically and I am using Literate.jl (maybe that is not the best tool for that, recommendations are also welcome). This is a MWE of what I am trying to do. # # Test import M…

---

## [Column-wise reduction on a CUDA.CuArray matrix](https://discourse.julialang.org/t/column-wise-reduction-on-a-cuda-cuarray-matrix/45069)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 0\
**Last updated:** [August 16, 2020, 10:33pm UTC](https://discourse.julialang.org/t/column-wise-reduction-on-a-cuda-cuarray-matrix/45069 "2020-08-16T22:33:44Z")

</div>

As suggested here, I am trying to create a version of this findfirst kernel that operates over dimension 2 of input matrix xs and returns the first match for each vector along dimension 1. I think a good approach is a c…

---

## [How to weight a normalized histogram in Plots](https://discourse.julialang.org/t/how-to-weight-a-normalized-histogram-in-plots/45111)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [August 17, 2020, 4:12pm UTC](https://discourse.julialang.org/t/how-to-weight-a-normalized-histogram-in-plots/45111 "2020-08-17T16:12:36Z")

</div>

I would like to plot a joint distribution as two normalized histograms. One distribution has a weight w and the other has a weight 1-w. Unfortunately, I cannot figure out how to apply the weight to a normalized histogram…

---

## [Reinterpret zero-dimensional view](https://discourse.julialang.org/t/reinterpret-zero-dimensional-view/45047)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 5\
**Last updated:** [August 17, 2020, 4:11pm UTC](https://discourse.julialang.org/t/reinterpret-zero-dimensional-view/45047 "2020-08-17T16:11:24Z")

</div>

Reinterpreting a zero-dimensional view: a = \[1; 2; 3\] b = view(a, 2) c = reinterpret(UInt8, b) # ERROR: ArgumentError: cannot reinterpret a zero-dimensional \`Int64\` array to \`UInt8\` which is of a different size The wor…

---

## [JuliaDB: select columns from 2 tables and join based on 2 keys](https://discourse.julialang.org/t/juliadb-select-columns-from-2-tables-and-join-based-on-2-keys/45076)

<div class="topic-metadata">

**Author:** [@DShiu](https://discourse.julialang.org/u/DShiu)\
**Replies:** 3\
**Last updated:** [August 17, 2020, 3:47pm UTC](https://discourse.julialang.org/t/juliadb-select-columns-from-2-tables-and-join-based-on-2-keys/45076 "2020-08-17T15:47:42Z")

</div>

Suppose that we have 2 tables, each contains multiple columns. The first table has (id, date, x1, x2, x3) and the second has (id, date, y1, y2, y3). Is it possible to create a new table by selecting columns (id, date, x1…

---

## [Looking for feedback on PRs in YAML.jl](https://discourse.julialang.org/t/looking-for-feedback-on-prs-in-yaml-jl/45116)

<div class="topic-metadata">

**Author:** [@mirkobunse](https://discourse.julialang.org/u/mirkobunse)\
**Replies:** 0\
**Last updated:** [August 17, 2020, 3:36pm UTC](https://discourse.julialang.org/t/looking-for-feedback-on-prs-in-yaml-jl/45116 "2020-08-17T15:36:11Z")

</div>

The maintainers of YAML.jl are looking for users of the package to provide feedback on pull requests and open issues. In particular, some discussion is needed regarding the API of the package. To which degree should the…

---

## [Add field to standard JSON serialization](https://discourse.julialang.org/t/add-field-to-standard-json-serialization/45112)

<div class="topic-metadata">

**Author:** [@Amval](https://discourse.julialang.org/u/Amval)\
**Replies:** 1\
**Last updated:** [August 17, 2020, 3:21pm UTC](https://discourse.julialang.org/t/add-field-to-standard-json-serialization/45112 "2020-08-17T15:21:24Z")

</div>

Hello, I basically want to achieve what is explained in this post: When calling JSON.json on an object, add a Pair type =\> string(typeof(t)) for child types of a certain abstract type. A cpuple restrictions: I need t…

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

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