# General Usage

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

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

**Page:** 924

---

## [Troubles with Documenter](https://discourse.julialang.org/t/troubles-with-documenter/17006)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 0\
**Last updated:** [October 31, 2018, 2:39pm UTC](https://discourse.julialang.org/t/troubles-with-documenter/17006 "2018-10-31T14:39:44Z")

</div>

Hi, I’ve been fighting with Documenter for a while but can’t understand why it does what it does. The problem starts, and this is probably a good symptom of the root issue, with the fact that in my index.mb file the ins…

---

## [Which sorting algorithm should I use?](https://discourse.julialang.org/t/which-sorting-algorithm-should-i-use/16999)

<div class="topic-metadata">

**Author:** [@Sam](https://discourse.julialang.org/u/Sam)\
**Replies:** 2\
**Last updated:** [October 31, 2018, 12:19pm UTC](https://discourse.julialang.org/t/which-sorting-algorithm-should-i-use/16999 "2018-10-31T12:19:09Z")

</div>

I am currently writing an algorithm where I have to use sortperm multiple times. After reading about this issue https://github.com/JuliaLang/julia/issues/939#issuecomment-288758163 I realized that there seem to be some p…

---

## [Better ways of passing functions around?](https://discourse.julialang.org/t/better-ways-of-passing-functions-around/16971)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 17\
**Last updated:** [October 31, 2018, 11:23am UTC](https://discourse.julialang.org/t/better-ways-of-passing-functions-around/16971 "2018-10-31T11:23:31Z")

</div>

When I pass function around, it causes a huge memory allocation. Like the following: - function f1(x::Float64) 16000000 x = x+3. - end - - mutable struct MyType - x::Float64…

---

## [Any chance to use AWSS3 to read from google cloud storage](https://discourse.julialang.org/t/any-chance-to-use-awss3-to-read-from-google-cloud-storage/16983)

<div class="topic-metadata">

**Author:** [@jwu](https://discourse.julialang.org/u/jwu)\
**Replies:** 2\
**Last updated:** [October 31, 2018, 2:59am UTC](https://discourse.julialang.org/t/any-chance-to-use-awss3-to-read-from-google-cloud-storage/16983 "2018-10-31T02:59:19Z")

</div>

@samoconnor If AWSS3.jl is similar with python boto3, is there any chance to change the protocol and perform IO to Google Cloud Storage?

---

## [Precompiling ClusterManagers](https://discourse.julialang.org/t/precompiling-clustermanagers/16991)

<div class="topic-metadata">

**Author:** [@tims](https://discourse.julialang.org/u/tims)\
**Replies:** 0\
**Last updated:** [October 31, 2018, 12:45am UTC](https://discourse.julialang.org/t/precompiling-clustermanagers/16991 "2018-10-31T00:45:30Z")

</div>

What’s a good fix for this? julia\> using ClusterManagers INFO: Recompiling stale cache file /share/apps/Julia/julia-903644385b/share/julia/site/lib/v0.6/ClusterManagers.ji for module ClusterManagers. WARNING: The call…

---

## [Concatenate empty list of arrays](https://discourse.julialang.org/t/concatenate-empty-list-of-arrays/16974)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 1\
**Last updated:** [October 30, 2018, 3:11pm UTC](https://discourse.julialang.org/t/concatenate-empty-list-of-arrays/16974 "2018-10-30T15:11:36Z")

</div>

I was suprised by julia\> x = Array{Float64, 4}\[\] 0-element Array{Array{Float64,4},1} julia\> cat(x..., dims=4) 0-element Array{Any,1} I guess I expected this to be type stable even in the empty x case, i.e. a result li…

---

## [Pkg: Using ENV paths](https://discourse.julialang.org/t/pkg-using-env-paths/16927)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 4\
**Last updated:** [October 30, 2018, 1:19pm UTC](https://discourse.julialang.org/t/pkg-using-env-paths/16927 "2018-10-30T13:19:44Z")

</div>

Hello all, this is related to my other post in which I’m trying desperately to get together an automated deployment of a dockerized program that pulls from a private git repo. I have pretty much given up on trying to cl…

---

## [Resource pooling - to avoid dynamic allocation](https://discourse.julialang.org/t/resource-pooling-to-avoid-dynamic-allocation/16921)

<div class="topic-metadata">

**Author:** [@stemann](https://discourse.julialang.org/u/stemann)\
**Replies:** 2\
**Last updated:** [October 30, 2018, 8:47am UTC](https://discourse.julialang.org/t/resource-pooling-to-avoid-dynamic-allocation/16921 "2018-10-30T08:47:05Z")

</div>

Hi, I have been looking for a package that implements resource pooling? I.e. a package that implements a pool of (reference counted) resources to avoid dynamic allocation of “expensive” resources such as large arrays, i…

---

## [Can OffsetArrays be concatenated without losing the offsets?](https://discourse.julialang.org/t/can-offsetarrays-be-concatenated-without-losing-the-offsets/16950)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [October 30, 2018, 8:07am UTC](https://discourse.julialang.org/t/can-offsetarrays-be-concatenated-without-losing-the-offsets/16950 "2018-10-30T08:07:24Z")

</div>

Here is what I am trying to do: julia\> y = OffsetArray{ComplexF64}(undef,-1:1,1:2); julia\> axes(cat(y,y,dims=2)) (Base.OneTo(3), Base.OneTo(4)) julia\> typeof(cat(y,y,dims=2)) Array{Complex{Float64},2} In this example…

---

## [QR Decomposition Extremely Slow](https://discourse.julialang.org/t/qr-decomposition-extremely-slow/16946)

<div class="topic-metadata">

**Author:** [@clinton](https://discourse.julialang.org/u/clinton)\
**Replies:** 4\
**Last updated:** [October 30, 2018, 3:18am UTC](https://discourse.julialang.org/t/qr-decomposition-extremely-slow/16946 "2018-10-30T03:18:17Z")

</div>

It seems converting a Q matrix to a Float Matrix takes high-degree polynomial time at best. Is this a bug? If so, is there any way to work around it? I don’t remember having this problem on earlier versions (I am using …

---

## [How do I determine the memory offset of a type's field?](https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 1\
**Last updated:** [October 30, 2018, 2:54am UTC](https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948 "2018-10-30T02:54:40Z")

</div>

Let’s say I have a custom composite type: struct Foo bar::Int biz::Float64 end While in this simple case, I can easily calculate the offset of biz myself (8 bytes), is there a function that will do this for me …

---

## [JLD.jl vs JLD2.jl](https://discourse.julialang.org/t/jld-jl-vs-jld2-jl/15287)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 23\
**Last updated:** [October 30, 2018, 2:18am UTC](https://discourse.julialang.org/t/jld-jl-vs-jld2-jl/15287 "2018-10-30T02:18:41Z")

</div>

What is the suggested way of saving a bunch of variables to a file at this point, JLD or JLD2? The last thread comparing the two packages was JLD2’s announcement a year ago, and people seemed split over which to use. It …

---

## [Abstract Types Convertion](https://discourse.julialang.org/t/abstract-types-convertion/16928)

<div class="topic-metadata">

**Author:** [@PauloXavier](https://discourse.julialang.org/u/PauloXavier)\
**Replies:** 5\
**Last updated:** [October 30, 2018, 12:17am UTC](https://discourse.julialang.org/t/abstract-types-convertion/16928 "2018-10-30T00:17:43Z")

</div>

I am extending a current framework (Persa), and adding some new functionality. As a matter of fact, i need to use the same types to benefit from the framework. This is my current structure: struct ContextRating{T \<: Nu…

---

## [Local x,y makes both x and y local?](https://discourse.julialang.org/t/local-x-y-makes-both-x-and-y-local/16932)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [October 29, 2018, 9:24pm UTC](https://discourse.julialang.org/t/local-x-y-makes-both-x-and-y-local/16932 "2018-10-29T21:24:45Z")

</div>

When I write local x,y = ..., this means that both x and y are local? Can someone confirm this? Ideally pointing to somewhere in the documentation where this is clarified. Thanks.

---

## [Generic function for getting next item from stateful iterator](https://discourse.julialang.org/t/generic-function-for-getting-next-item-from-stateful-iterator/16546)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 2\
**Last updated:** [October 29, 2018, 8:41pm UTC](https://discourse.julialang.org/t/generic-function-for-getting-next-item-from-stateful-iterator/16546 "2018-10-29T20:41:02Z")

</div>

Say I have a type that satisfies the iterator interface. It’s a stateful iterator that behaves similarly to StatefulIterator, so every time it generates an item the state changes internally. What’s the right generic fun…

---

## [Style question for functions with in place transforms and return types](https://discourse.julialang.org/t/style-question-for-functions-with-in-place-transforms-and-return-types/16882)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 8\
**Last updated:** [October 29, 2018, 1:18pm UTC](https://discourse.julialang.org/t/style-question-for-functions-with-in-place-transforms-and-return-types/16882 "2018-10-29T13:18:19Z")

</div>

If I have a function which performs an in place transformation on an argument and also returns a result, what is the appropriate style? The following works as I intend, but I’m wondering if this will get me into trouble…

---

## [InitError for a combination of ImageMagick and MATLAB](https://discourse.julialang.org/t/initerror-for-a-combination-of-imagemagick-and-matlab/16869)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 3\
**Last updated:** [October 29, 2018, 8:47am UTC](https://discourse.julialang.org/t/initerror-for-a-combination-of-imagemagick-and-matlab/16869 "2018-10-29T08:47:11Z")

</div>

I’d appreciate any help with this cryptic issue: Building a package with just two dependencies, ImageMagick and MATLAB, will result in this: \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) …

---

## [Broadcasting and single characters](https://discourse.julialang.org/t/broadcasting-and-single-characters/16836)

<div class="topic-metadata">

**Author:** [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Replies:** 9\
**Last updated:** [October 29, 2018, 7:00am UTC](https://discourse.julialang.org/t/broadcasting-and-single-characters/16836 "2018-10-29T07:00:57Z")

</div>

I just came across this surprising (to me) behaviour, that a single character is not considered as a scalar: julia\> myfun(a) = a myfun (generic function with 1 method) julia\> myfun.(1) 1 julia\> myfun.('a') 1-element A…

---

## [Function that constructs NamedTuple with function argument field names, and correctly infer return type](https://discourse.julialang.org/t/function-that-constructs-namedtuple-with-function-argument-field-names-and-correctly-infer-return-type/16904)

<div class="topic-metadata">

**Author:** [@jackf](https://discourse.julialang.org/u/jackf)\
**Replies:** 5\
**Last updated:** [October 29, 2018, 5:28am UTC](https://discourse.julialang.org/t/function-that-constructs-namedtuple-with-function-argument-field-names-and-correctly-infer-return-type/16904 "2018-10-29T05:28:58Z")

</div>

The problem I’m trying to solve is to have a function f that: takes as as one of its arugments a Tuple of Symbols (of variable length), called fields for each field in fields, looks up the type of that field in a cons…

---

## [Codecov/Coveralls reports wrongly showing 100% coverage](https://discourse.julialang.org/t/codecov-coveralls-reports-wrongly-showing-100-coverage/14831)

<div class="topic-metadata">

**Author:** [@harryscholes](https://discourse.julialang.org/u/harryscholes)\
**Replies:** 1\
**Last updated:** [October 29, 2018, 4:28am UTC](https://discourse.julialang.org/t/codecov-coveralls-reports-wrongly-showing-100-coverage/14831 "2018-10-29T04:28:23Z")

</div>

Although it would be great, I definitely don’t have 100% test coverage. See an example commit report here and the git repo at that commit here. Any idea what may be going wrong here?

---

## [Recreate PyPlot's color maps in native Julia?](https://discourse.julialang.org/t/recreate-pyplots-color-maps-in-native-julia/16906)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 3\
**Last updated:** [October 29, 2018, 3:22am UTC](https://discourse.julialang.org/t/recreate-pyplots-color-maps-in-native-julia/16906 "2018-10-29T03:22:59Z")

</div>

Is it possible to recreate the same color maps that PyPlot comes with in native Julia, for use with e.g Images.jl https://matplotlib.org/users/colormaps.html I really like the color maps PyPlot comes with, but I don’t …

---

## [Performance problem of count?](https://discourse.julialang.org/t/performance-problem-of-count/16873)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 21\
**Last updated:** [October 28, 2018, 7:05pm UTC](https://discourse.julialang.org/t/performance-problem-of-count/16873 "2018-10-28T19:05:10Z")

</div>

Writing code to count the number of inversions of a permutation, I was surprised that it allocates. Thus I wrote what I thought equivalent code with a for loop, and it does not allocate. Here is the code; why is count so…

---

## [Getting Error while building ImageMagick](https://discourse.julialang.org/t/getting-error-while-building-imagemagick/16902)

<div class="topic-metadata">

**Author:** [@sandeep\_reddy\_Guduru](https://discourse.julialang.org/u/sandeep_reddy_Guduru)\
**Replies:** 0\
**Last updated:** [October 28, 2018, 5:48pm UTC](https://discourse.julialang.org/t/getting-error-while-building-imagemagick/16902 "2018-10-28T17:48:13Z")

</div>

┌ Error: Error building ImageMagick: │ ┌ Warning: On Windows, creating file symlinks requires Administrator privileges │ └ @ Base.Filesystem file.jl:789 │ ┌ Warning: platform\_key() is deprecated, use platform\_key\_abi(…

---

## [Are \`jl\_value\_t\*\*\` compatible with \`jl\_array\_t\*\`? If not, how do I manage \`Any\[\]\` in C?](https://discourse.julialang.org/t/are-jl-value-t-compatible-with-jl-array-t-if-not-how-do-i-manage-any-in-c/16390)

<div class="topic-metadata">

**Author:** [@kim366](https://discourse.julialang.org/u/kim366)\
**Replies:** 6\
**Last updated:** [October 28, 2018, 2:39pm UTC](https://discourse.julialang.org/t/are-jl-value-t-compatible-with-jl-array-t-if-not-how-do-i-manage-any-in-c/16390 "2018-10-28T14:39:27Z")

</div>

The Docs show the following: double \*existingArray = (double\*)malloc(sizeof(double)\*10); jl\_array\_t \*x = jl\_ptr\_to\_array\_1d(array\_type, existingArray, 10, 0); I thought I could use jl\_value\_t\*\* instead of double\* in th…

---

## [reproducible crash related to DataFrames, parametric types, method dispatching?](https://discourse.julialang.org/t/reproducible-crash-related-to-dataframes-parametric-types-method-dispatching/16740)

<div class="topic-metadata">

**Author:** [@Christoph\_Staub](https://discourse.julialang.org/u/Christoph_Staub)\
**Replies:** 4\
**Last updated:** [October 28, 2018, 12:59pm UTC](https://discourse.julialang.org/t/reproducible-crash-related-to-dataframes-parametric-types-method-dispatching/16740 "2018-10-28T12:59:11Z")

</div>

The code listed below reproducibly crashes Julia 1.0 and 0.7 (but not 0.6.2) The crash does not occur in Julia 1.0 and 0.7 if one of the following modifications is applied to the code the DataFrame is replaced by an A…

---

## [Unexpectedly high memory allocation when running n-body simulation](https://discourse.julialang.org/t/unexpectedly-high-memory-allocation-when-running-n-body-simulation/16876)

<div class="topic-metadata">

**Author:** [@novoselrok](https://discourse.julialang.org/u/novoselrok)\
**Replies:** 3\
**Last updated:** [October 28, 2018, 7:19am UTC](https://discourse.julialang.org/t/unexpectedly-high-memory-allocation-when-running-n-body-simulation/16876 "2018-10-28T07:19:25Z")

</div>

I wrote the n-body simulation in Julia, but I’m experiencing unexpectedly high memory allocation (according to the @time macro) when running the simulation for 10.000 bodies (the input file I’m using test1e4.julia.txt · …

---

## [Same function name in multiple modules?](https://discourse.julialang.org/t/same-function-name-in-multiple-modules/16881)

<div class="topic-metadata">

**Author:** [@scheinerman](https://discourse.julialang.org/u/scheinerman)\
**Replies:** 5\
**Last updated:** [October 28, 2018, 1:37am UTC](https://discourse.julialang.org/t/same-function-name-in-multiple-modules/16881 "2018-10-28T01:37:00Z")

</div>

I would like to name a function draw in multiple modules. (My graph theory module would have a draw from drawing graphs, my hyperbolic geometry module would have a draw for drawing things in the hyperbolic plane, and so …

---

## [UndefVarError for global var (from Main) \[julia 0.7\]](https://discourse.julialang.org/t/undefvarerror-for-global-var-from-main-julia-0-7/16884)

<div class="topic-metadata">

**Author:** [@kimran](https://discourse.julialang.org/u/kimran)\
**Replies:** 0\
**Last updated:** [October 27, 2018, 11:51pm UTC](https://discourse.julialang.org/t/undefvarerror-for-global-var-from-main-julia-0-7/16884 "2018-10-27T23:51:24Z")

</div>

\## A.jl module A f(a) = Main.X g = Main.X end ## init\_working.jl X = 1 include("A.jl") ## init\_failing.jl X = 1 using A I get an UndefVarError if I do using A and A contains g = Main.X No error if I exclude g = Main…

---

## [Flags for distribution of custom Julia build](https://discourse.julialang.org/t/flags-for-distribution-of-custom-julia-build/16871)

<div class="topic-metadata">

**Author:** [@vitreo12](https://discourse.julialang.org/u/vitreo12)\
**Replies:** 0\
**Last updated:** [October 27, 2018, 7:32pm UTC](https://discourse.julialang.org/t/flags-for-distribution-of-custom-julia-build/16871 "2018-10-27T19:32:18Z")

</div>

Hello everyone, I am currently developing an open-source software that relies on C and a custom build of Julia with JULIA\_THREADS=0 set in Make.user. I would need to provide my end user with a complete package with a co…

---

## [Overriding \<: function for subtype checking](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 4\
**Last updated:** [October 27, 2018, 6:08pm UTC](https://discourse.julialang.org/t/overriding-function-for-subtype-checking/16867 "2018-10-27T18:08:20Z")

</div>

ERROR: cannot add methods to a builtin function Why can’t I do that? And is there a way to dispatch based on the defined \<: function in a polymorphic way? Thanks

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

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