# General Usage

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

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

**Page:** 889

---

## [Output a plot with makie without opening a separate window](https://discourse.julialang.org/t/output-a-plot-with-makie-without-opening-a-separate-window/21395)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 4\
**Last updated:** [March 3, 2019, 12:37am UTC](https://discourse.julialang.org/t/output-a-plot-with-makie-without-opening-a-separate-window/21395 "2019-03-03T00:37:51Z")

</div>

When I run this and send the output to a web app (Blink) I get the plot in the webapp, but also a separate window opening! Is there a way of not opening the actual plot window? Makie.lines(x) In Plots.jl the window onl…

---

## [How do I convert a binary string to a floating point number?](https://discourse.julialang.org/t/how-do-i-convert-a-binary-string-to-a-floating-point-number/21380)

<div class="topic-metadata">

**Author:** [@Alejandro](https://discourse.julialang.org/u/Alejandro)\
**Replies:** 3\
**Last updated:** [March 2, 2019, 4:03pm UTC](https://discourse.julialang.org/t/how-do-i-convert-a-binary-string-to-a-floating-point-number/21380 "2019-03-02T16:03:12Z")

</div>

Hello. I’ve been sort of away from Julia for a while and am wanting to get back into things, using version 1.01 (some things changed since 0.6, I see). Figured writing a simple genetic algorithm implementation for myself…

---

## [Documenter didn't deploy docs after CI](https://discourse.julialang.org/t/documenter-didnt-deploy-docs-after-ci/21388)

<div class="topic-metadata">

**Author:** [@thautwarm](https://discourse.julialang.org/u/thautwarm)\
**Replies:** 5\
**Last updated:** [March 2, 2019, 12:33pm UTC](https://discourse.julialang.org/t/documenter-didnt-deploy-docs-after-ci/21388 "2019-03-02T12:33:48Z")

</div>

It seems that my docs have been broken for a long time(since another contributor’s commit about 10 days ago). The lastest log is here: Why did this get should\_deploy=false, and what should I do to deploy my docs agai…

---

## [How to benchmark distributed function calls?](https://discourse.julialang.org/t/how-to-benchmark-distributed-function-calls/21319)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 1\
**Last updated:** [March 2, 2019, 10:42am UTC](https://discourse.julialang.org/t/how-to-benchmark-distributed-function-calls/21319 "2019-03-02T10:42:27Z")

</div>

Hello Julia community, I used pmap for some cross validation routine. Upon benchmarking on 4 cores, I noticed ~4 times speedup compared to single core. Then I wanted to know how much overhead is associated with running …

---

## [Dot(x, inv.(y)) vs non-allocating one, the former is faster?](https://discourse.julialang.org/t/dot-x-inv-y-vs-non-allocating-one-the-former-is-faster/21338)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 5\
**Last updated:** [March 2, 2019, 12:01am UTC](https://discourse.julialang.org/t/dot-x-inv-y-vs-non-allocating-one-the-former-is-faster/21338 "2019-03-02T00:01:19Z")

</div>

In looking at some recent updates in Distributions I saw code like this dot(w, inv.(x)) and thought that better could be done to avoid allocating inv.(x) however what I came up with was always slower and I’m not sure why…

---

## [Allocations in Comprehensions](https://discourse.julialang.org/t/allocations-in-comprehensions/21309)

<div class="topic-metadata">

**Author:** [@kwild](https://discourse.julialang.org/u/kwild)\
**Replies:** 2\
**Last updated:** [March 1, 2019, 10:55pm UTC](https://discourse.julialang.org/t/allocations-in-comprehensions/21309 "2019-03-01T22:55:37Z")

</div>

Hi, I wonder if there is a simple way to construct a container (Array or Tuple) with comprehensions or similar but with the performance of a hand-written container: julia\> @time \[fill(1, 1000), fill(1, 1000), fill(1, 1…

---

## [Memory leak in Browser when using WebIO + Interact (+ VegaLite)?](https://discourse.julialang.org/t/memory-leak-in-browser-when-using-webio-interact-vegalite/21332)

<div class="topic-metadata">

**Author:** [@cnliao](https://discourse.julialang.org/u/cnliao)\
**Replies:** 2\
**Last updated:** [March 1, 2019, 10:17pm UTC](https://discourse.julialang.org/t/memory-leak-in-browser-when-using-webio-interact-vegalite/21332 "2019-03-01T22:17:27Z")

</div>

My browser tab consumes unlimited amount of memory after I evaluated the following snippet in a Jupyter notebook and dragged the slider back and forth quickly for a dozen of times. Throttling the slider observable allev…

---

## [Adding to sparse matrix efficiently and IterativeSolvers.gmres speed vs MATLAB](https://discourse.julialang.org/t/adding-to-sparse-matrix-efficiently-and-iterativesolvers-gmres-speed-vs-matlab/21355)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 3\
**Last updated:** [March 1, 2019, 8:37pm UTC](https://discourse.julialang.org/t/adding-to-sparse-matrix-efficiently-and-iterativesolvers-gmres-speed-vs-matlab/21355 "2019-03-01T20:37:44Z")

</div>

I am trying to convert one of my MATLAB scripts to Julia. I can get it to the same speed but not faster at the moment. I know where the bottlenecks are, filling my sparse matrix with new entries and zeroing this in a lo…

---

## [Precompilation failure: could not load from cache file](https://discourse.julialang.org/t/precompilation-failure-could-not-load-from-cache-file/20951)

<div class="topic-metadata">

**Author:** [@dhazeghi](https://discourse.julialang.org/u/dhazeghi)\
**Replies:** 1\
**Last updated:** [March 1, 2019, 7:01pm UTC](https://discourse.julialang.org/t/precompilation-failure-could-not-load-from-cache-file/20951 "2019-03-01T19:01:35Z")

</div>

Hi folks, I’m seeing odd precompilation errors when running my application using Julia 1.1. I’m wondering what the right approach is to debug these. If I do a minimal example, I don’t see this issue, but I’m sort of s…

---

## [Insert values in multiple tables SQLite in a single for loop](https://discourse.julialang.org/t/insert-values-in-multiple-tables-sqlite-in-a-single-for-loop/21357)

<div class="topic-metadata">

**Author:** [@Santiago\_Cuervo](https://discourse.julialang.org/u/Santiago_Cuervo)\
**Replies:** 2\
**Last updated:** [March 1, 2019, 6:54pm UTC](https://discourse.julialang.org/t/insert-values-in-multiple-tables-sqlite-in-a-single-for-loop/21357 "2019-03-01T18:54:02Z")

</div>

Is there a way to insert all those values in a SQLite data base in a single loop? I’ve wrote as much loops as tables I have with the same structure. How do I call variables in a loop?. Thank you blocks=readlines(“block…

---

## [Self-referential struct and invalid redefinition error](https://discourse.julialang.org/t/self-referential-struct-and-invalid-redefinition-error/21340)

<div class="topic-metadata">

**Author:** [@HiroIshida](https://discourse.julialang.org/u/HiroIshida)\
**Replies:** 3\
**Last updated:** [March 1, 2019, 3:43pm UTC](https://discourse.julialang.org/t/self-referential-struct-and-invalid-redefinition-error/21340 "2019-03-01T15:43:03Z")

</div>

Let’s consider a file named test.jl that includes the following self-referential struct: mutable struct Node ID::Int child::Union{Node, Nothing} end Somehow, even if I don’t change the file at all, hitting twic…

---

## [Why Julia and linear algebra module are incredibly slow, compare to C++ and Eigen](https://discourse.julialang.org/t/why-julia-and-linear-algebra-module-are-incredibly-slow-compare-to-c-and-eigen/21304)

<div class="topic-metadata">

**Author:** [@Amin\_Abouee](https://discourse.julialang.org/u/Amin_Abouee)\
**Replies:** 14\
**Last updated:** [March 1, 2019, 3:37pm UTC](https://discourse.julialang.org/t/why-julia-and-linear-algebra-module-are-incredibly-slow-compare-to-c-and-eigen/21304 "2019-03-01T15:37:29Z")

</div>

Hi, I developed a julia file to compare its performance with C++. I implemented the homography estimation based on DLT algortihm. In brief, I created a 8\*9 matrix A from two bundle of four 3D points and solve Ah=0. So…

---

## [Is there a way to import modules with a string?](https://discourse.julialang.org/t/is-there-a-way-to-import-modules-with-a-string/15723)

<div class="topic-metadata">

**Author:** [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Replies:** 8\
**Last updated:** [March 1, 2019, 3:15pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-import-modules-with-a-string/15723 "2019-03-01T15:15:05Z")

</div>

moduleName = "Name" # Is there a possibility to import a module based on that variable? something like import ."$moduleName" # This is invalid but is there a possibility to do such a thing WITHOUT using include?

---

## [Base.return\_types](https://discourse.julialang.org/t/base-return-types/21346)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [March 1, 2019, 2:11pm UTC](https://discourse.julialang.org/t/base-return-types/21346 "2019-03-01T14:11:12Z")

</div>

Why Base.return\_types returns an array instead of a single type? julia\> Base.return\_types(sqrt, (Float16,)) 1-element Array{Any,1}: Float16

---

## [Does \`GC.@preserve\` also prevent instruction re-ordering?](https://discourse.julialang.org/t/does-gc-preserve-also-prevent-instruction-re-ordering/21313)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 7\
**Last updated:** [March 1, 2019, 1:41pm UTC](https://discourse.julialang.org/t/does-gc-preserve-also-prevent-instruction-re-ordering/21313 "2019-03-01T13:41:31Z")

</div>

does GC.@preserve also prevent the compiler re-ordering instructions? e.g. I have a C wrapper right now that is more or less: obj = MyObjWithStorage() client = getstorage(obj) usedata(client) where getstorage puts som…

---

## [Module with one function of same name as the module?](https://discourse.julialang.org/t/module-with-one-function-of-same-name-as-the-module/21305)

<div class="topic-metadata">

**Author:** [@mvdh7](https://discourse.julialang.org/u/mvdh7)\
**Replies:** 8\
**Last updated:** [March 1, 2019, 1:16pm UTC](https://discourse.julialang.org/t/module-with-one-function-of-same-name-as-the-module/21305 "2019-03-01T13:16:41Z")

</div>

I have a module that contains precisely one exported function. Is it possible to give the module and the function the same name and use them with the syntax below? e.g. for the module: module myfunc export myfunc fun…

---

## [Base.parent for wrappers](https://discourse.julialang.org/t/base-parent-for-wrappers/21335)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [March 1, 2019, 9:01am UTC](https://discourse.julialang.org/t/base-parent-for-wrappers/21335 "2019-03-01T09:01:48Z")

</div>

I am pondering over a minor style question: whenever I have a type which just wraps a value and forwards some methods, I feel that making Base.parent return the wrapped value would be natural. I have also seen some pack…

---

## [How to define a parametric struct variable which could be an array or a scalar?](https://discourse.julialang.org/t/how-to-define-a-parametric-struct-variable-which-could-be-an-array-or-a-scalar/21301)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 1\
**Last updated:** [February 28, 2019, 1:31pm UTC](https://discourse.julialang.org/t/how-to-define-a-parametric-struct-variable-which-could-be-an-array-or-a-scalar/21301 "2019-02-28T13:31:45Z")

</div>

Depending on the inputs x, P, F of a function test the output can be of type array or scalar: struct Results{A \<: Union{Float64, \<: AbstractVector{Float64}}, B \<: Union{Float64, \<: AbstractMatrix{Float64}}} a::A …

---

## [Is it safe to compare rounded float values for equality?](https://discourse.julialang.org/t/is-it-safe-to-compare-rounded-float-values-for-equality/21278)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 11\
**Last updated:** [February 28, 2019, 6:32am UTC](https://discourse.julialang.org/t/is-it-safe-to-compare-rounded-float-values-for-equality/21278 "2019-02-28T06:32:40Z")

</div>

I know that comparing two floats for equality using == is not a good idea, as it can yield unexpected results. For example, 0.1 + 0.2 == 0.3 returns false. I understand that there is an isapprox function to deal with thi…

---

## [How to load a "jld" file at julia 1.0.3?](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261)

<div class="topic-metadata">

**Author:** [@in\_sight](https://discourse.julialang.org/u/in_sight)\
**Replies:** 3\
**Last updated:** [February 28, 2019, 5:29am UTC](https://discourse.julialang.org/t/how-to-load-a-jld-file-at-julia-1-0-3/21261 "2019-02-28T05:29:58Z")

</div>

Hi there, I have a program which can work normally at julia 0.6.4, however, after I updated from julia 0.6.4 to 1.0.3, something went wrong. When I using “load” function to load a weights file of a Nertural network, it …

---

## [\`PyPlot\`: imported in module vs imported in REPL](https://discourse.julialang.org/t/pyplot-imported-in-module-vs-imported-in-repl/21283)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 2\
**Last updated:** [February 28, 2019, 1:53am UTC](https://discourse.julialang.org/t/pyplot-imported-in-module-vs-imported-in-repl/21283 "2019-02-28T01:53:15Z")

</div>

I am hoping to use PyPlot functions in a module MyTest. I create the MyTest project/package, add PyCall, PyPlot, and Conda to MyTest’s Project.toml, and compare what happens when I try using the module vs using PyPlot in…

---

## [What is easiest way to share code (like emailing matlab files)?](https://discourse.julialang.org/t/what-is-easiest-way-to-share-code-like-emailing-matlab-files/21250)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 4\
**Last updated:** [February 27, 2019, 11:22pm UTC](https://discourse.julialang.org/t/what-is-easiest-way-to-share-code-like-emailing-matlab-files/21250 "2019-02-27T23:22:56Z")

</div>

I’m currently working on a project with a lot of Matlab users. As such, I’ve reverted to writing Matlab and sending these documents around. What have people found to be the easiest way to replicate the ease and simplici…

---

## [JuMP Opt field names](https://discourse.julialang.org/t/jump-opt-field-names/21267)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 8\
**Last updated:** [February 27, 2019, 9:41pm UTC](https://discourse.julialang.org/t/jump-opt-field-names/21267 "2019-02-27T21:41:25Z")

</div>

How to access the model colVal field under the new version of JuMP?

---

## [Filter of skipmissing fails](https://discourse.julialang.org/t/filter-of-skipmissing-fails/21249)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 7\
**Last updated:** [February 27, 2019, 7:44pm UTC](https://discourse.julialang.org/t/filter-of-skipmissing-fails/21249 "2019-02-27T19:44:42Z")

</div>

MWE: julia\> x = \[missing, 1, 2, -1, -2\]; julia\> filter(e-\>(e\>0), skipmissing(x)) ERROR: MethodError: no method matching filter(::getfield(Main, Symbol("##23#24")), ::Base.SkipMissing{Array{Union{Missing, Int64},1}}) jul…

---

## [Drawing with color on Grayscale images](https://discourse.julialang.org/t/drawing-with-color-on-grayscale-images/21217)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 2\
**Last updated:** [February 27, 2019, 1:26pm UTC](https://discourse.julialang.org/t/drawing-with-color-on-grayscale-images/21217 "2019-02-27T13:26:48Z")

</div>

I have a grayscale image and I’d like to be able to draw a colored polygon on it with ImageDraw but am running into an error. Here is a MWE: using TestImages, ImageDraw, Colors img = testimage("cameraman") draw(img,Poly…

---

## [Is the first key of a NamedTuple special?](https://discourse.julialang.org/t/is-the-first-key-of-a-namedtuple-special/21256)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 3\
**Last updated:** [February 27, 2019, 1:22pm UTC](https://discourse.julialang.org/t/is-the-first-key-of-a-namedtuple-special/21256 "2019-02-27T13:22:51Z")

</div>

I would appreciate it if someone could explain this to me: x = (somekey=123, someotherkey="test") y = (someotherkey="test", somekey=123) # same as x but reversed order h(x::NamedTuple{K,V}) where {K,V} = :somekey in K …

---

## [Installing binaries behind zscaler](https://discourse.julialang.org/t/installing-binaries-behind-zscaler/21198)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 4\
**Last updated:** [February 27, 2019, 1:10pm UTC](https://discourse.julialang.org/t/installing-binaries-behind-zscaler/21198 "2019-02-27T13:10:37Z")

</div>

When trying install package Julia tries to download packages. e.g when installing DataFrames.jl it tries this But it fails with (v1.0) pkg\> build CodecZlib Building CodecZlib → C:\\Users\\L098905\\.julia\\packages\\Codec…

---

## [How to debug non-determinstic behavior involving ccall](https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186)

<div class="topic-metadata">

**Author:** [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Replies:** 9\
**Last updated:** [February 27, 2019, 8:07am UTC](https://discourse.julialang.org/t/how-to-debug-non-determinstic-behavior-involving-ccall/21186 "2019-02-27T08:07:15Z")

</div>

I’m involved with a package that provides a Julia wrapper (SCIP.jl) to a C library (https://scip.zib.de/). In a current pull request (#100), I found that our tests pass most of the time, but not always. This non-determi…

---

## [Renaming unregistered package](https://discourse.julialang.org/t/renaming-unregistered-package/21231)

<div class="topic-metadata">

**Author:** [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Replies:** 1\
**Last updated:** [February 27, 2019, 12:49am UTC](https://discourse.julialang.org/t/renaming-unregistered-package/21231 "2019-02-27T00:49:02Z")

</div>

I’m trying to rename an unregistered package. I changed the name in my git repository (Github) as appropriate, including within the Project.toml. I removed the old package with \] rm OLDNAME and then \] add NEWPACKAGE\_G…

---

## [Multidimensional array with different size](https://discourse.julialang.org/t/multidimensional-array-with-different-size/21240)

<div class="topic-metadata">

**Author:** [@Suraj\_Pawar](https://discourse.julialang.org/u/Suraj_Pawar)\
**Replies:** 1\
**Last updated:** [February 27, 2019, 12:38am UTC](https://discourse.julialang.org/t/multidimensional-array-with-different-size/21240 "2019-02-27T00:38:30Z")

</div>

Is it possible to declare a multidimensional array with different size in one direction? For example, I want to declare a three-dimensional array. A\[:,:,1\] should have dimension 64 X 64. A\[:,:,2\] should have dimension 32…

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

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