# General Usage

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

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

**Page:** 886

---

## [StaticRanges](https://discourse.julialang.org/t/staticranges/20919)

<div class="topic-metadata">

**Author:** [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Replies:** 6\
**Last updated:** [March 14, 2019, 12:40am UTC](https://discourse.julialang.org/t/staticranges/20919 "2019-03-14T00:40:20Z")

</div>

I’m working on what may turn into a package. https://github.com/Tokazama/StaticRanges.jl Conceptually it’s fairly simple. It has a one type StaticRange and a convenient interface through srange (which is meant to act l…

---

## [Passing functions as arguments: confusion with constructors](https://discourse.julialang.org/t/passing-functions-as-arguments-confusion-with-constructors/21832)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 5\
**Last updated:** [March 13, 2019, 8:48pm UTC](https://discourse.julialang.org/t/passing-functions-as-arguments-confusion-with-constructors/21832 "2019-03-13T20:48:40Z")

</div>

Let’s say I have a type Foo, and I would like to pass its constructor as an argument to another function, bar, that only takes functions as arguments. How can I distinguish between the type, Foo, from its constructor whe…

---

## [Julia REPL and Emojis](https://discourse.julialang.org/t/julia-repl-and-emojis/21830)

<div class="topic-metadata">

**Author:** [@HBaghdadi1995](https://discourse.julialang.org/u/HBaghdadi1995)\
**Replies:** 4\
**Last updated:** [March 13, 2019, 6:23pm UTC](https://discourse.julialang.org/t/julia-repl-and-emojis/21830 "2019-03-13T18:23:09Z")

</div>

Hi, some Julia modules print out emojis to give the user some information such as this, but in the REPL, they just come out as �, I was wondering if this is the intended result or if the REPL has emoji printing capabilit…

---

## [Replacing multiple strings errors](https://discourse.julialang.org/t/replacing-multiple-strings-errors/13654)

<div class="topic-metadata">

**Author:** [@DNF](https://discourse.julialang.org/u/DNF)\
**Replies:** 11\
**Last updated:** [March 13, 2019, 5:22pm UTC](https://discourse.julialang.org/t/replacing-multiple-strings-errors/13654 "2019-03-13T17:22:24Z")

</div>

Am I having a stroke or something? Is this not supposed to work (version 1.0): julia\> replace("ABC", "A"=\>"a", "B"=\>"b") ERROR: MethodError: no method matching replace(::String, ::Pair{String,String}, ::Pair{String,Stri…

---

## [Using CUDA fft](https://discourse.julialang.org/t/using-cuda-fft/21829)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [March 13, 2019, 4:40pm UTC](https://discourse.julialang.org/t/using-cuda-fft/21829 "2019-03-13T16:40:18Z")

</div>

Hi folks, just starting to use CuArrays, there is something I do not understand and that probably somebody can help me understand. I just try to test fft using CUDA and I run into ‘out of memory’ issues, but only the s…

---

## [Example use of \`sparse!\`](https://discourse.julialang.org/t/example-use-of-sparse/21808)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [March 13, 2019, 4:34pm UTC](https://discourse.julialang.org/t/example-use-of-sparse/21808 "2019-03-13T16:34:38Z")

</div>

Hi, I am building sparse matrices with the same sparsity pattern. The function sparse(...) represent 90% of the computation time, the rest being a linear solve. I am wondering if sparse! could help this but I did not f…

---

## [How to install packages which are needed only for development](https://discourse.julialang.org/t/how-to-install-packages-which-are-needed-only-for-development/21815)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 3\
**Last updated:** [March 13, 2019, 3:36pm UTC](https://discourse.julialang.org/t/how-to-install-packages-which-are-needed-only-for-development/21815 "2019-03-13T15:36:49Z")

</div>

I’m currently preparing a training session, and this process triggers again some questions that I had when initially discovering Julia and which haven’t really disappeared since then. Here is the current situation: I’m …

---

## [How to track a memory leak](https://discourse.julialang.org/t/how-to-track-a-memory-leak/21817)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 0\
**Last updated:** [March 13, 2019, 1:18pm UTC](https://discourse.julialang.org/t/how-to-track-a-memory-leak/21817 "2019-03-13T13:18:21Z")

</div>

I have this function, f(). It performs some computation (always the same), then sends the result to another machine via HTTP.jl, then returns nothing. There’s no global, no mutation of structure. If I run it a thousand t…

---

## [UnitfulAngles Error with Julia 1.0.3?](https://discourse.julialang.org/t/unitfulangles-error-with-julia-1-0-3/21760)

<div class="topic-metadata">

**Author:** [@astrowanders](https://discourse.julialang.org/u/astrowanders)\
**Replies:** 13\
**Last updated:** [March 13, 2019, 10:52am UTC](https://discourse.julialang.org/t/unitfulangles-error-with-julia-1-0-3/21760 "2019-03-13T10:52:36Z")

</div>

I recently upgraded from Julia 1.0.2 to 1.0.3. I can use UnitfulAngles.jl with 1.0.2, but receive the following error with 1.0.3 It appears that this is an issue with the UnitfulAngles package? Is there a way to amel…

---

## [PosDefException, increasing loss of precision](https://discourse.julialang.org/t/posdefexception-increasing-loss-of-precision/21809)

<div class="topic-metadata">

**Author:** [@krenova](https://discourse.julialang.org/u/krenova)\
**Replies:** 4\
**Last updated:** [March 13, 2019, 8:42am UTC](https://discourse.julialang.org/t/posdefexception-increasing-loss-of-precision/21809 "2019-03-13T08:42:37Z")

</div>

I’m trying to construct an mcmc sampler for a HMM model which has a Bayesian Linear Regression component. However, as the mcmc iteration progresses, i quickly run into PosDefException errors when trying to simulate a mul…

---

## [I'm confused with types names](https://discourse.julialang.org/t/im-confused-with-types-names/21795)

<div class="topic-metadata">

**Author:** [@Jomtek](https://discourse.julialang.org/u/Jomtek)\
**Replies:** 5\
**Last updated:** [March 13, 2019, 12:03am UTC](https://discourse.julialang.org/t/im-confused-with-types-names/21795 "2019-03-13T00:03:09Z")

</div>

Imagine I have three files. file1.jl module myFirstModule struct MyStruct attribute :: String end end file2.jl module mySecondModule include("file1.jl") include("file3.jl") myThirdModule.h…

---

## [How to write subscripts in docs?](https://discourse.julialang.org/t/how-to-write-subscripts-in-docs/21799)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 8\
**Last updated:** [March 12, 2019, 11:18pm UTC](https://discourse.julialang.org/t/how-to-write-subscripts-in-docs/21799 "2019-03-12T23:18:08Z")

</div>

If I try to write this (there are double back ticks around the latex expressions but can make it show here) Select map projection. lon\\\_0 \\yen The following character determines det I get. Note that the yen symbol …

---

## [Wrong results in calculation](https://discourse.julialang.org/t/wrong-results-in-calculation/21567)

<div class="topic-metadata">

**Author:** [@ancu](https://discourse.julialang.org/u/ancu)\
**Replies:** 21\
**Last updated:** [March 12, 2019, 8:21pm UTC](https://discourse.julialang.org/t/wrong-results-in-calculation/21567 "2019-03-12T20:21:12Z")

</div>

I’m a newbie for Julia. I just test the simple code as follows: for i in range(10,30) println(“10^$i=”,10^i) end but I get the results: 10^10=10000000000 10^11=100000000000 10^12=1000000000000 10^13=1000000000000…

---

## [General registry T&Cs and a warning to noobs (like me)](https://discourse.julialang.org/t/general-registry-t-cs-and-a-warning-to-noobs-like-me/21766)

<div class="topic-metadata">

**Author:** [@anon67531922](https://discourse.julialang.org/u/anon67531922)\
**Replies:** 21\
**Last updated:** [March 12, 2019, 4:03pm UTC](https://discourse.julialang.org/t/general-registry-t-cs-and-a-warning-to-noobs-like-me/21766 "2019-03-12T16:03:09Z")

</div>

First, a disclaimer… I :heart: Julia lang. Personally, I am heavily invested in Julia and have been for the past 5 years. As an entrepreneur, that is not a small thing. I am also a Julia evangelist. I promote Julia any …

---

## [Usage of parentmodule()](https://discourse.julialang.org/t/usage-of-parentmodule/21625)

<div class="topic-metadata">

**Author:** [@AndreHat](https://discourse.julialang.org/u/AndreHat)\
**Replies:** 4\
**Last updated:** [March 12, 2019, 2:37pm UTC](https://discourse.julialang.org/t/usage-of-parentmodule/21625 "2019-03-12T14:37:02Z")

</div>

I’m having some trouble with the new parentmodule() function in Julia 1.0. According to the Julia 0.7.0 release notes module\_parent() is depreciated in favor of parentmodule(), however parentmodule() in Julia 1.0 returns…

---

## [Convert symbolic SymPy expression to native Julia code?](https://discourse.julialang.org/t/convert-symbolic-sympy-expression-to-native-julia-code/21757)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 2\
**Last updated:** [March 12, 2019, 8:13am UTC](https://discourse.julialang.org/t/convert-symbolic-sympy-expression-to-native-julia-code/21757 "2019-03-12T08:13:50Z")

</div>

I believe it is possible and might be done already but I have not found. It would gain an infinite factor in the evaluation speed as in the example below:

---

## [Pre-allocating Arrays for intermediate calculations](https://discourse.julialang.org/t/pre-allocating-arrays-for-intermediate-calculations/21725)

<div class="topic-metadata">

**Author:** [@krenova](https://discourse.julialang.org/u/krenova)\
**Replies:** 10\
**Last updated:** [March 12, 2019, 8:07am UTC](https://discourse.julialang.org/t/pre-allocating-arrays-for-intermediate-calculations/21725 "2019-03-12T08:07:43Z")

</div>

To save on computation time for a function i often use, i created a preallocated array that i pass to the function to store intermediate calculations. As an example, albeit a contrived one, i have this function test() th…

---

## [Julia equivalent of C compiler intrinsics?](https://discourse.julialang.org/t/julia-equivalent-of-c-compiler-intrinsics/17278)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 23\
**Last updated:** [November 8, 2018, 8:31pm UTC](https://discourse.julialang.org/t/julia-equivalent-of-c-compiler-intrinsics/17278 "2018-11-08T20:31:25Z")

</div>

I just learned about @code\_native, and it’s really cool that you can see the assembly instructions for code easily. So, C has “compiler intrinsics” that provide C-like functions that map to particular CPU instructions. …

---

## [Is it possible to define custom shared type for multiprocessing?](https://discourse.julialang.org/t/is-it-possible-to-define-custom-shared-type-for-multiprocessing/21763)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 0\
**Last updated:** [March 12, 2019, 2:44am UTC](https://discourse.julialang.org/t/is-it-possible-to-define-custom-shared-type-for-multiprocessing/21763 "2019-03-12T02:44:07Z")

</div>

I have a type looking like struct TBModel norbits::Int64 lat::SMatrix{3,3,Float64,9} hoppings::Dict{SVector{3,Int64},Matrix{Float64}} overlaps::Dict{SVector{3,Int64},Matrix{Float64}} positions::Dict{…

---

## ["code reflection cannot be used from generated functions"](https://discourse.julialang.org/t/code-reflection-cannot-be-used-from-generated-functions/21678)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [March 12, 2019, 2:26am UTC](https://discourse.julialang.org/t/code-reflection-cannot-be-used-from-generated-functions/21678 "2019-03-12T02:26:34Z")

</div>

I just got to love code\_typed as it can compile-infer whether a function will fail because of MethodNotFound Error However my usecase requires this as part of a generated function… which is why I run into the following …

---

## [Confusing benchmark time results and memory allocation depending on number of calls for function with zip](https://discourse.julialang.org/t/confusing-benchmark-time-results-and-memory-allocation-depending-on-number-of-calls-for-function-with-zip/21627)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 12\
**Last updated:** [March 12, 2019, 12:37am UTC](https://discourse.julialang.org/t/confusing-benchmark-time-results-and-memory-allocation-depending-on-number-of-calls-for-function-with-zip/21627 "2019-03-12T00:37:40Z")

</div>

Hello, I recently discovered a very strange behavior which I cannot understand and I would like to ask you for help on this. I have simplified the original code as much as possible to reproduce this behavior. Consider t…

---

## [How to make the histogram of an image in Julia](https://discourse.julialang.org/t/how-to-make-the-histogram-of-an-image-in-julia/21745)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 4\
**Last updated:** [March 11, 2019, 8:26pm UTC](https://discourse.julialang.org/t/how-to-make-the-histogram-of-an-image-in-julia/21745 "2019-03-11T20:26:19Z")

</div>

How to make the histogram of an image in julia? I’m working with images in julia, but I have problems taking the histogram of an image using ImageView, Images, TestImages img\_gld = imread("...path to some color jpg..."…

---

## [Access a remote server to work with julia](https://discourse.julialang.org/t/access-a-remote-server-to-work-with-julia/21754)

<div class="topic-metadata">

**Author:** [@eagles051387](https://discourse.julialang.org/u/eagles051387)\
**Replies:** 1\
**Last updated:** [March 11, 2019, 8:17pm UTC](https://discourse.julialang.org/t/access-a-remote-server-to-work-with-julia/21754 "2019-03-11T20:17:44Z")

</div>

Evening Guys I am looking to have Juno connect to a remote test server for testing purposes. is there a way in Juno to specify easily or a package to install that you have to fill in just a few parameters and you are goo…

---

## [Using project environments, possible bug](https://discourse.julialang.org/t/using-project-environments-possible-bug/21744)

<div class="topic-metadata">

**Author:** [@lwabeke](https://discourse.julialang.org/u/lwabeke)\
**Replies:** 2\
**Last updated:** [March 11, 2019, 3:09pm UTC](https://discourse.julialang.org/t/using-project-environments-possible-bug/21744 "2019-03-11T15:09:04Z")

</div>

I am trying to create a new project environment, however it seems that when I activate that environment, I cause Julia to segfault. Am I doing anything wrong, or is this a bug? I’m happy to log a bug somewhere, but not …

---

## [Plots - how to add padding between subplots](https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 1\
**Last updated:** [March 11, 2019, 2:39pm UTC](https://discourse.julialang.org/t/plots-how-to-add-padding-between-subplots/21037 "2019-03-11T14:39:53Z")

</div>

The obvious choice is to specify margin attribute but it actually controls the margin space around the subplots but not including the labels. That means a wider margin would make the labels farther apart from the graph.…

---

## [No syntax highlighting using OhMyREPL](https://discourse.julialang.org/t/no-syntax-highlighting-using-ohmyrepl/21731)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 3\
**Last updated:** [March 11, 2019, 12:10pm UTC](https://discourse.julialang.org/t/no-syntax-highlighting-using-ohmyrepl/21731 "2019-03-11T12:10:30Z")

</div>

For some time I am using OhMyREPL in order get better readability. Today, starting Julia from scratch without using any Package except OhMyREPL no syntax highlighting occurs anymore. I am using Julia version 1.1 and Atom…

---

## [Double for loop using filtered ranges](https://discourse.julialang.org/t/double-for-loop-using-filtered-ranges/21722)

<div class="topic-metadata">

**Author:** [@MrRobot](https://discourse.julialang.org/u/MrRobot)\
**Replies:** 5\
**Last updated:** [March 11, 2019, 9:31am UTC](https://discourse.julialang.org/t/double-for-loop-using-filtered-ranges/21722 "2019-03-11T09:31:21Z")

</div>

I have some MWE below. What I want is to have a subsection of a range, interact with the rest of the range, but not itself. Also, I posted this on stackoverflow … I should have put it here first I think… For instance i…

---

## [Using export keyword](https://discourse.julialang.org/t/using-export-keyword/21723)

<div class="topic-metadata">

**Author:** [@yash](https://discourse.julialang.org/u/yash)\
**Replies:** 4\
**Last updated:** [March 11, 2019, 5:00am UTC](https://discourse.julialang.org/t/using-export-keyword/21723 "2019-03-11T05:00:49Z")

</div>

I am confused for the use of export in modules. In documentation I read that we use export to make functions available to user of that module . But I made a module(say A) ,which contains some functions and used export fo…

---

## [Fast type indexing](https://discourse.julialang.org/t/fast-type-indexing/21702)

<div class="topic-metadata">

**Author:** [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Replies:** 6\
**Last updated:** [March 10, 2019, 11:11pm UTC](https://discourse.julialang.org/t/fast-type-indexing/21702 "2019-03-10T23:11:40Z")

</div>

tldr: I’m trying to find the most performant method for indexing Tuple.parameters in a struct similar to SArray{S\<:Tuple} where I want f(::SArray{S}, i::Int) where S = S.parameters\[i\]. All my current solutions require a …

---

## [Anybody can show me the grammer for dict's dict in julia](https://discourse.julialang.org/t/anybody-can-show-me-the-grammer-for-dicts-dict-in-julia/21616)

<div class="topic-metadata">

**Author:** [@biofuture](https://discourse.julialang.org/u/biofuture)\
**Replies:** 8\
**Last updated:** [March 10, 2019, 9:53pm UTC](https://discourse.julialang.org/t/anybody-can-show-me-the-grammer-for-dicts-dict-in-julia/21616 "2019-03-10T21:53:22Z")

</div>

Hi, as I would like to use dict’s dict to storage and visiting data, but I can not find the correct grammar to stat the dict’s dict, initiate it and visiting it. Can anybody give some examples about how to do it in juli…

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

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