# General Usage

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

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

**Page:** 829

---

## [Simulate Nested Array Without Allocating New Memory Every Loop?](https://discourse.julialang.org/t/simulate-nested-array-without-allocating-new-memory-every-loop/29215)

<div class="topic-metadata">

**Author:** [@dylanjm](https://discourse.julialang.org/u/dylanjm)\
**Replies:** 13\
**Last updated:** [September 28, 2019, 10:50am UTC](https://discourse.julialang.org/t/simulate-nested-array-without-allocating-new-memory-every-loop/29215 "2019-09-28T10:50:51Z")

</div>

To start off, here is some necessary information julia\> versioninfo() Julia Version 1.2.0 Commit c6da87ff4b (2019-08-20 00:03 UTC) Platform Info: OS: macOS (x86\_64-apple-darwin18.6.0) CPU: Intel(R) Core(TM) i7-9750H…

---

## [Pkg3: Multiple packages per .git repository](https://discourse.julialang.org/t/pkg3-multiple-packages-per-git-repository/15492)

<div class="topic-metadata">

**Author:** [@MA\_Laforge](https://discourse.julialang.org/u/MA_Laforge)\
**Replies:** 3\
**Last updated:** [September 28, 2019, 5:32am UTC](https://discourse.julialang.org/t/pkg3-multiple-packages-per-git-repository/15492 "2019-09-28T05:32:26Z")

</div>

I have a graphical package that I would like to distribute as a single .git repository, that actually contains two separate modules. Problem On some systems, Cairo.jl will work fine, whereas Gtk.jl might not (ex: Julia…

---

## [Why is the negation of a Boolean array a BitArray](https://discourse.julialang.org/t/why-is-the-negation-of-a-boolean-array-a-bitarray/29211)

<div class="topic-metadata">

**Author:** [@SEA](https://discourse.julialang.org/u/SEA)\
**Replies:** 3\
**Last updated:** [September 28, 2019, 4:44am UTC](https://discourse.julialang.org/t/why-is-the-negation-of-a-boolean-array-a-bitarray/29211 "2019-09-28T04:44:56Z")

</div>

If b = rand(Bool, 3) then all of .!b .~b xor.(true, b) return a BitArray{1} type. Given that the input types are always Array{Bool, 1}, I find that curious. Is this behavior wanted, and if so, why?

---

## [String(array) destroys the array Bug or Feature?](https://discourse.julialang.org/t/string-array-destroys-the-array-bug-or-feature/29243)

<div class="topic-metadata">

**Author:** [@fp4code](https://discourse.julialang.org/u/fp4code)\
**Replies:** 5\
**Last updated:** [September 27, 2019, 9:14pm UTC](https://discourse.julialang.org/t/string-array-destroys-the-array-bug-or-feature/29243 "2019-09-27T21:14:12Z")

</div>

a = Array{UInt8,1}(\['a','b','c'\]) length(a) # 3 s = String(a) # "abc" length(a) # 0 Bug or feature ? Same behaviour with julia-1.0.5, -1.2, -1.4.0-DEV.152

---

## [Re-installing Julia w/ v. 1.2.0 -- Plots doesn't compile](https://discourse.julialang.org/t/re-installing-julia-w-v-1-2-0-plots-doesnt-compile/29236)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 4\
**Last updated:** [September 27, 2019, 3:03pm UTC](https://discourse.julialang.org/t/re-installing-julia-w-v-1-2-0-plots-doesnt-compile/29236 "2019-09-27T15:03:35Z")

</div>

After some problem with Julia vs. Python in Jypyter notebooks, I’m removing every trace of Python and Julia on my computers, and re-installing first Julia v. 1.2.0 with packages, and then Anaconda. \[I mainly use Julia, b…

---

## [What is the recommended way to decorate an IO stream with a filter in Julia](https://discourse.julialang.org/t/what-is-the-recommended-way-to-decorate-an-io-stream-with-a-filter-in-julia/29226)

<div class="topic-metadata">

**Author:** [@pszufe](https://discourse.julialang.org/u/pszufe)\
**Replies:** 1\
**Last updated:** [September 27, 2019, 1:34pm UTC](https://discourse.julialang.org/t/what-is-the-recommended-way-to-decorate-an-io-stream-with-a-filter-in-julia/29226 "2019-09-27T13:34:40Z")

</div>

What is the recommended way to decorate a IO stream with a filter? One great example of stream decorators is CodecZlib.jl that provides compression and decompression decorators for output and input streams respectively. …

---

## [Web Socket Issue - halt with no error after write(TCPSocket)](https://discourse.julialang.org/t/web-socket-issue-halt-with-no-error-after-write-tcpsocket/29220)

<div class="topic-metadata">

**Author:** [@Wednesday](https://discourse.julialang.org/u/Wednesday)\
**Replies:** 0\
**Last updated:** [September 27, 2019, 8:43am UTC](https://discourse.julialang.org/t/web-socket-issue-halt-with-no-error-after-write-tcpsocket/29220 "2019-09-27T08:43:55Z")

</div>

Okay as a prerequisite I am new to the language and am likely doing something incorrectly. I am using the Sockets module from the standard library. I am writing a client side julia program that needs to read two Float6…

---

## [Non-intuitive perf diff between \`matrix \* vector\`, \`matrix' \* vector\` and \`copy(matrix') \* vector\`](https://discourse.julialang.org/t/non-intuitive-perf-diff-between-matrix-vector-matrix-vector-and-copy-matrix-vector/29207)

<div class="topic-metadata">

**Author:** [@jeremejevs](https://discourse.julialang.org/u/jeremejevs)\
**Replies:** 2\
**Last updated:** [September 27, 2019, 7:09am UTC](https://discourse.julialang.org/t/non-intuitive-perf-diff-between-matrix-vector-matrix-vector-and-copy-matrix-vector/29207 "2019-09-27T07:09:25Z")

</div>

I’m using Julia 1.2. This is my test: a = rand(1000, 1000) b = a' c = copy(b) @btime a \* x setup=(x=rand(1000)) # 114.757 μs @btime b \* x setup=(x=rand(1000)) # 94.179 μs @btime c \* x setup=(x=rand(1000)) # 110.325 μs …

---

## [Correctly generate function from user input](https://discourse.julialang.org/t/correctly-generate-function-from-user-input/29214)

<div class="topic-metadata">

**Author:** [@ry-dgel](https://discourse.julialang.org/u/ry-dgel)\
**Replies:** 1\
**Last updated:** [September 27, 2019, 3:07am UTC](https://discourse.julialang.org/t/correctly-generate-function-from-user-input/29214 "2019-09-27T03:07:54Z")

</div>

Hello, I’m trying to put together a module for rapid fitting of data. I work in an experimental physics lab and want to make a tool that my collegues and I can use to bang out fits of large data sets efficiently. Ideal…

---

## [Avoiding unnecessary mallocs while building then solving a linear system inside a loop can only be achieved by routines that modify in-place?](https://discourse.julialang.org/t/avoiding-unnecessary-mallocs-while-building-then-solving-a-linear-system-inside-a-loop-can-only-be-achieved-by-routines-that-modify-in-place/29210)

<div class="topic-metadata">

**Author:** [@pedrohnv](https://discourse.julialang.org/u/pedrohnv)\
**Replies:** 2\
**Last updated:** [September 27, 2019, 2:50am UTC](https://discourse.julialang.org/t/avoiding-unnecessary-mallocs-while-building-then-solving-a-linear-system-inside-a-loop-can-only-be-achieved-by-routines-that-modify-in-place/29210 "2019-09-27T02:50:19Z")

</div>

Hello, I have some functions that build a linear system. I then want to build and solve the system in a loop, while modifying a parameter. My first, straightforward, approach resulted in many allocations being done unne…

---

## [Designating the axes for broadcasting](https://discourse.julialang.org/t/designating-the-axes-for-broadcasting/29203)

<div class="topic-metadata">

**Author:** [@crinders](https://discourse.julialang.org/u/crinders)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 5:11pm UTC](https://discourse.julialang.org/t/designating-the-axes-for-broadcasting/29203 "2019-09-26T17:11:00Z")

</div>

I can’t find a way to designate the axes over which to broadcast. I looked at broadcast.jl and combine\_axes and I can’t make heads or tails of it. I just want to do julia\> T = randn((3,2,4)) 3×2×4 Array{Float64,3}: \[:,…

---

## [Using PackageCompiler in windows](https://discourse.julialang.org/t/using-packagecompiler-in-windows/29199)

<div class="topic-metadata">

**Author:** [@HBaghdadi1995](https://discourse.julialang.org/u/HBaghdadi1995)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 4:14pm UTC](https://discourse.julialang.org/t/using-packagecompiler-in-windows/29199 "2019-09-26T16:14:17Z")

</div>

Hi, I tried building a shared library based on hello.jl found here. It created the following files: - 7z.dll - libccalltest.dll - libgfortran-4.dll - libmpfr.dll - libssh2.dll - libwinpthread-1.dll - BugpointPasses.dll…

---

## [Fatal error with freshly installed Julia 1.2 on MacOS](https://discourse.julialang.org/t/fatal-error-with-freshly-installed-julia-1-2-on-macos/29178)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 5\
**Last updated:** [September 26, 2019, 3:17pm UTC](https://discourse.julialang.org/t/fatal-error-with-freshly-installed-julia-1-2-on-macos/29178 "2019-09-26T15:17:43Z")

</div>

I just installed Julia 1.2 on my MacBook Pro, but it keeps crashing: cbieganek@spmacpro90:~$ julia \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ \_…

---

## [Gadfly: adding line-styles to the plot legend](https://discourse.julialang.org/t/gadfly-adding-line-styles-to-the-plot-legend/29188)

<div class="topic-metadata">

**Author:** [@mike\_k](https://discourse.julialang.org/u/mike_k)\
**Replies:** 4\
**Last updated:** [September 26, 2019, 2:36pm UTC](https://discourse.julialang.org/t/gadfly-adding-line-styles-to-the-plot-legend/29188 "2019-09-26T14:36:14Z")

</div>

Dear community, I want to create a plot with several lines that have different line-styles (e.g., solid, dashed, dotted,…), and to add these styles to the legend of the plot (to fit for a black-white publication). Is th…

---

## [IJulia... after removing Python](https://discourse.julialang.org/t/ijulia-after-removing-python/29111)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 12\
**Last updated:** [September 26, 2019, 2:04pm UTC](https://discourse.julialang.org/t/ijulia-after-removing-python/29111 "2019-09-26T14:04:18Z")

</div>

I recently had problems with running some Python code (Spyder didn’t find the kernel, etc. – maybe because I had several Python versions installed). So in the end, I deleted every Python version on my computer, and re-in…

---

## [Array by reference](https://discourse.julialang.org/t/array-by-reference/29187)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 12:14pm UTC](https://discourse.julialang.org/t/array-by-reference/29187 "2019-09-26T12:14:30Z")

</div>

Assigning a new type out of function prevents the compiler to assign the returned-type properly. In the example I show it just ends up returning ::Any. In my broader example it messes up within the function itself and t…

---

## [Passing parameters and performances](https://discourse.julialang.org/t/passing-parameters-and-performances/29175)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 3\
**Last updated:** [September 26, 2019, 12:11pm UTC](https://discourse.julialang.org/t/passing-parameters-and-performances/29175 "2019-09-26T12:11:00Z")

</div>

Hi, I am writing a simulator for spiking neural network. In the simulator I would like to use a loop like the one in the code Params = Dict{String,Union{Int,Bool}} function sim\_loop!(synapse\_params::Dict{String,Floa…

---

## [@code\_warntype but for allocations?](https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190)

<div class="topic-metadata">

**Author:** [@cshenton](https://discourse.julialang.org/u/cshenton)\
**Replies:** 1\
**Last updated:** [September 26, 2019, 11:27am UTC](https://discourse.julialang.org/t/code-warntype-but-for-allocations/29190 "2019-09-26T11:27:36Z")

</div>

Is there a similar macro to @code\_warntype for allocations? As in, given a function call (or function and tuple of input types), highlights any calls in the function that allocate, just as code\_warntype highlights sub ex…

---

## [How to input path in run() and joinpath() on Windows](https://discourse.julialang.org/t/how-to-input-path-in-run-and-joinpath-on-windows/29183)

<div class="topic-metadata">

**Author:** [@leejm516](https://discourse.julialang.org/u/leejm516)\
**Replies:** 4\
**Last updated:** [September 26, 2019, 9:46am UTC](https://discourse.julialang.org/t/how-to-input-path-in-run-and-joinpath-on-windows/29183 "2019-09-26T09:46:08Z")

</div>

Hello, everybody! Today I have got in trouble with run() for putting the path from a string variable. It seems ok with … julia\> test = joinpath("~") "~" julia\> run(\`dir $test\`) %APPDATA% 3D\\ Objects AppData Applicati…

---

## [Float64 comparison operator performance](https://discourse.julialang.org/t/float64-comparison-operator-performance/29179)

<div class="topic-metadata">

**Author:** [@milesf](https://discourse.julialang.org/u/milesf)\
**Replies:** 8\
**Last updated:** [September 26, 2019, 8:39am UTC](https://discourse.julialang.org/t/float64-comparison-operator-performance/29179 "2019-09-26T08:39:38Z")

</div>

I expect the performance of a \< b to be the same as Base.lt(Base.Forward, a, b) if all type information is known at compile time, but I’m observing a 2.5x difference with Float64. using BenchmarkTools using Random Rand…

---

## [Standard library or original for TerminalMenus](https://discourse.julialang.org/t/standard-library-or-original-for-terminalmenus/23160)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 8\
**Last updated:** [September 26, 2019, 8:15am UTC](https://discourse.julialang.org/t/standard-library-or-original-for-terminalmenus/23160 "2019-09-26T08:15:17Z")

</div>

I want to use TerminalMenus in some minimal GUI app I’m developing. I can either use the original author’s version, or the one included in Julia’s standard libraries (documented here). I think they’re both really simila…

---

## [ERROR: Unsatisfiable requirements detected for package LinQuadOptInterface \[f8899e07\]:](https://discourse.julialang.org/t/error-unsatisfiable-requirements-detected-for-package-linquadoptinterface-f8899e07/29182)

<div class="topic-metadata">

**Author:** [@wain229](https://discourse.julialang.org/u/wain229)\
**Replies:** 1\
**Last updated:** [September 26, 2019, 3:54am UTC](https://discourse.julialang.org/t/error-unsatisfiable-requirements-detected-for-package-linquadoptinterface-f8899e07/29182 "2019-09-26T03:54:27Z")

</div>

I was trying to add the Clp package today, but the below error happened. I was using the Julia version 1.0.4. Any one can help me? Thanks julia\> import Pkg julia\> Pkg.add(“Clp”) Updating registry at C:\\Users\\pqwa001\\.…

---

## [Argument type for tuples of same length](https://discourse.julialang.org/t/argument-type-for-tuples-of-same-length/29174)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 2\
**Last updated:** [September 25, 2019, 8:51pm UTC](https://discourse.julialang.org/t/argument-type-for-tuples-of-same-length/29174 "2019-09-25T20:51:35Z")

</div>

I would like to create a function taking two tuples t1 and t2 as arguments. The two tuples need to have the same length, but their elements can be of any type, and each tuple doesn’t need to be composed of the entries o…

---

## [Cool Case of Faster than C++ performance](https://discourse.julialang.org/t/cool-case-of-faster-than-c-performance/29165)

<div class="topic-metadata">

**Author:** [@dataDiver](https://discourse.julialang.org/u/dataDiver)\
**Replies:** 3\
**Last updated:** [September 25, 2019, 3:47pm UTC](https://discourse.julialang.org/t/cool-case-of-faster-than-c-performance/29165 "2019-09-25T15:47:34Z")

</div>

This query was originally going to be me complaining about why I was getting inconsistent performance over some benchmark times, it turns out that it was at some kind of cache threshold and modifying the size of the vect…

---

## ["@everywhere using" ERROR for worker 2](https://discourse.julialang.org/t/everywhere-using-error-for-worker-2/16520)

<div class="topic-metadata">

**Author:** [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)\
**Replies:** 3\
**Last updated:** [September 25, 2019, 1:48pm UTC](https://discourse.julialang.org/t/everywhere-using-error-for-worker-2/16520 "2019-09-25T13:48:21Z")

</div>

Hi, I’m trying to use parallel processing on Julia 1.0.1 and found the following issue: the new worker is not able to find packages I already installed. Please help me do this in the right way. In the example below, I …

---

## [Coexisting Markdown and RST documentation](https://discourse.julialang.org/t/coexisting-markdown-and-rst-documentation/29161)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 0\
**Last updated:** [September 25, 2019, 1:40pm UTC](https://discourse.julialang.org/t/coexisting-markdown-and-rst-documentation/29161 "2019-09-25T13:40:37Z")

</div>

Julia docstrings are expected to be written in Markdown, but there are situations where it it may be useful to use other formats. E.g. the package GR is part of a larger project whose documentation seems to be made with …

---

## [Permute Multidimensional Array without allocation](https://discourse.julialang.org/t/permute-multidimensional-array-without-allocation/29153)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 9\
**Last updated:** [September 25, 2019, 1:26pm UTC](https://discourse.julialang.org/t/permute-multidimensional-array-without-allocation/29153 "2019-09-25T13:26:58Z")

</div>

Hi guys, I am trying to permute/shuffle columns of a multidimensional array, an example is here: using BenchmarkTools const arra = zeros(Int, 4, 3, 2) arra\[:,:, 1\] = 1:12 arra\[:,:, 2\] = 13:24 shuffle\_col = \[3, 1, 1\] …

---

## [Creating C structs with pointers to other structs](https://discourse.julialang.org/t/creating-c-structs-with-pointers-to-other-structs/29121)

<div class="topic-metadata">

**Author:** [@cshenton](https://discourse.julialang.org/u/cshenton)\
**Replies:** 9\
**Last updated:** [September 25, 2019, 12:48pm UTC](https://discourse.julialang.org/t/creating-c-structs-with-pointers-to-other-structs/29121 "2019-09-25T12:48:38Z")

</div>

Suppose we have the following structs matching some structs in a C header: struct Foo a::UInt32 b::Cstring end struct Bar a::UInt32 b::Ptr{Foo} end And we have a function that takes a ptr to Bar. ccall …

---

## [Management of Packages in Julia](https://discourse.julialang.org/t/management-of-packages-in-julia/29098)

<div class="topic-metadata">

**Author:** [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Replies:** 16\
**Last updated:** [September 25, 2019, 12:25pm UTC](https://discourse.julialang.org/t/management-of-packages-in-julia/29098 "2019-09-25T12:25:39Z")

</div>

Hi All, I’m using PkgTemplates to create new custom Pkgs for my own use, and as per PkgTemplate defaults, they save to the .julia/dev/ directory. I was able to call my first package, SatPrecip, with “using SatPrecip”. …

---

## [Build Executable using PackageCompiler](https://discourse.julialang.org/t/build-executable-using-packagecompiler/29156)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 0\
**Last updated:** [September 25, 2019, 12:18pm UTC](https://discourse.julialang.org/t/build-executable-using-packagecompiler/29156 "2019-09-25T12:18:14Z")

</div>

I am trying to build an executable of hello.jl script following the guidance given in PackageCompiler help on this page https://github.com/JuliaLang/PackageCompiler.jl. I have tried both the options but the process fails…

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

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