# General Usage

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

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

**Page:** 753

---

## [Reinterpret packed data which is already in memory?](https://discourse.julialang.org/t/reinterpret-packed-data-which-is-already-in-memory/39549)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 3\
**Last updated:** [May 15, 2020, 8:09pm UTC](https://discourse.julialang.org/t/reinterpret-packed-data-which-is-already-in-memory/39549 "2020-05-15T20:09:03Z")

</div>

I have a quite trivial question. I have read large arrays of bytes from different source into a single array (sometimes 2e9 bytes and more) and now I need to make it pretty for the user and thought utilising reinterpret …

---

## [Is this function type unstable?](https://discourse.julialang.org/t/is-this-function-type-unstable/39539)

<div class="topic-metadata">

**Author:** [@rvignolo](https://discourse.julialang.org/u/rvignolo)\
**Replies:** 0\
**Last updated:** [May 15, 2020, 5:18pm UTC](https://discourse.julialang.org/t/is-this-function-type-unstable/39539 "2020-05-15T17:18:48Z")

</div>

Hi, could you please try to help understand why this minimal working example does not return an object of concrete type? using DifferentialEquations function f(du,u,p,t) du\[1\] = p.a du\[2\] = p.b end function sol…

---

## [Zip and namedtuple](https://discourse.julialang.org/t/zip-and-namedtuple/39516)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 4:57pm UTC](https://discourse.julialang.org/t/zip-and-namedtuple/39516 "2020-05-15T16:57:32Z")

</div>

Hi all, I wonder why zip of named tuples does not take into the account names of variables. Is this a desired behavior? Is there an alternative I am not aware of, which does? julia\> x, y = (a = 1, b = 2), (b = 4, a = …

---

## [BlackBox Optimization: Multiple Cores (Workers) Rather than Threads](https://discourse.julialang.org/t/blackbox-optimization-multiple-cores-workers-rather-than-threads/39497)

<div class="topic-metadata">

**Author:** [@rpm](https://discourse.julialang.org/u/rpm)\
**Replies:** 4\
**Last updated:** [May 15, 2020, 4:14pm UTC](https://discourse.julialang.org/t/blackbox-optimization-multiple-cores-workers-rather-than-threads/39497 "2020-05-15T16:14:11Z")

</div>

The example for blackboxoptim in parallel uses multiple threads (BlackBoxOptim.jl/multithreaded\_optimization.jl at master · robertfeldt/BlackBoxOptim.jl · GitHub) I am interested in using the same approach but on a shar…

---

## [Logging performance](https://discourse.julialang.org/t/logging-performance/17389)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 6\
**Last updated:** [May 15, 2020, 3:37pm UTC](https://discourse.julialang.org/t/logging-performance/17389 "2020-05-15T15:37:16Z")

</div>

In order to turn verbosity on or off, I used to write functions in the old-fashioned style julia\> using Printf julia\> function do\_something(verbose=false) for i in 1:10000 verbose && @printf("print s…

---

## [Confusing MethodError: bad message or bad usage?](https://discourse.julialang.org/t/confusing-methoderror-bad-message-or-bad-usage/39528)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 0\
**Last updated:** [May 15, 2020, 2:46pm UTC](https://discourse.julialang.org/t/confusing-methoderror-bad-message-or-bad-usage/39528 "2020-05-15T14:46:52Z")

</div>

The MethodError message sometimes doesn’t make sense, and I’m not sure if it’s a problem with MethodError or the way it’s used. For example the following fails (as documented in Measurements.jl): julia\> using SpecialFu…

---

## [Latex typesetting in Plots with plotly backend?](https://discourse.julialang.org/t/latex-typesetting-in-plots-with-plotly-backend/35545)

<div class="topic-metadata">

**Author:** [@brunopjacob](https://discourse.julialang.org/u/brunopjacob)\
**Replies:** 2\
**Last updated:** [May 15, 2020, 8:12am UTC](https://discourse.julialang.org/t/latex-typesetting-in-plots-with-plotly-backend/35545 "2020-05-15T08:12:12Z")

</div>

I am using Plots.jl and plotly for making plots, but I would like to have my legend, title and labels typed in latex. Using LaTeXStrings and the syntax L"…" works for gr and pyplot backends, but not for plotly. Does anyo…

---

## [How to specify the element type of the vector that is returned](https://discourse.julialang.org/t/how-to-specify-the-element-type-of-the-vector-that-is-returned/39498)

<div class="topic-metadata">

**Author:** [@A.U.M](https://discourse.julialang.org/u/A.U.M)\
**Replies:** 11\
**Last updated:** [May 15, 2020, 11:15am UTC](https://discourse.julialang.org/t/how-to-specify-the-element-type-of-the-vector-that-is-returned/39498 "2020-05-15T11:15:48Z")

</div>

Hello, I want to Modify this macro @collect such that I can specify the element type of the vector that is returned. any ideas? macro collect(expr::Expr) quote let v = Vector() function $(esc…

---

## [Functions usage](https://discourse.julialang.org/t/functions-usage/39500)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 4\
**Last updated:** [May 15, 2020, 9:42am UTC](https://discourse.julialang.org/t/functions-usage/39500 "2020-05-15T09:42:19Z")

</div>

Hello, I am using functions to read data, apply a certain function and then use a function to write results. I have not been able to figure out the correct way of passing one function as an argument to another function, …

---

## [Can one make a constant with a parametric type?](https://discourse.julialang.org/t/can-one-make-a-constant-with-a-parametric-type/39444)

<div class="topic-metadata">

**Author:** [@nben](https://discourse.julialang.org/u/nben)\
**Replies:** 12\
**Last updated:** [May 15, 2020, 8:30am UTC](https://discourse.julialang.org/t/can-one-make-a-constant-with-a-parametric-type/39444 "2020-05-15T08:30:57Z")

</div>

Is it possible to make a type-parameterized constant? An example of when this is useful is with immutable containers. If you have an ImmutableVector{T} class, ideally ImmutableVector{T}() === ImmutableVector{T}()—that is…

---

## [Call to \`Distributed.remotecall\_fetch\` never returns?](https://discourse.julialang.org/t/call-to-distributed-remotecall-fetch-never-returns/39408)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 3\
**Last updated:** [May 15, 2020, 12:15am UTC](https://discourse.julialang.org/t/call-to-distributed-remotecall-fetch-never-returns/39408 "2020-05-15T00:15:40Z")

</div>

I am writing a Julia script for a scientific experiment and I want to put a time limit in calls made by the script. To solve this I tried to use this small package from @ararslan. The package works by creating a new work…

---

## [Non critical type-instability?](https://discourse.julialang.org/t/non-critical-type-instability/39486)

<div class="topic-metadata">

**Author:** [@Bigorneau](https://discourse.julialang.org/u/Bigorneau)\
**Replies:** 9\
**Last updated:** [May 14, 2020, 11:01pm UTC](https://discourse.julialang.org/t/non-critical-type-instability/39486 "2020-05-14T23:01:10Z")

</div>

Suppose the following struct A{T} v::Vector{T} end Base.convert(::Type{A{T}}, a::A{S}) where {T,S} = A(convert(Vector{T}, a.v)) Base.promote\_rule(::Type{A{T}}, ::Type{A{S}}) where {T,S} = A{promote\_type(T,S)} functi…

---

## [Truncated basis ApproxFun](https://discourse.julialang.org/t/truncated-basis-approxfun/39495)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 0\
**Last updated:** [May 14, 2020, 10:57pm UTC](https://discourse.julialang.org/t/truncated-basis-approxfun/39495 "2020-05-14T22:57:13Z")

</div>

Hello, I would like to use ApproxFun.jl for a truncated FFT. Is it possible to create direct and inverse Fourier transforms spanned by a sparse basis? This is what I have in mind: using ApproxFun S = Fourier() n = …

---

## [Creating struct to initialize array of arrays with function to push elements into that array](https://discourse.julialang.org/t/creating-struct-to-initialize-array-of-arrays-with-function-to-push-elements-into-that-array/39485)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 12\
**Last updated:** [May 14, 2020, 10:07pm UTC](https://discourse.julialang.org/t/creating-struct-to-initialize-array-of-arrays-with-function-to-push-elements-into-that-array/39485 "2020-05-14T22:07:35Z")

</div>

I want to create a function to push data into struct array. Here’s my code: mutable struct graph{T} data::AbstractArray{Array{T,1},1} # addEdge(x,y)=push!(data\[x\],y) that doesn't work end # Creating method to assig…

---

## [QR-like factorization preserving type?](https://discourse.julialang.org/t/qr-like-factorization-preserving-type/38129)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 12\
**Last updated:** [May 14, 2020, 9:17pm UTC](https://discourse.julialang.org/t/qr-like-factorization-preserving-type/38129 "2020-05-14T21:17:04Z")

</div>

Is there a factorization in the LinearAlgebra system which works similar to QR factorization in factoring A into A= T\*R where T is a square, full rank matrix while R is an upper triangular matrix? In particular, R shoul…

---

## [Editing axis labels in Makie recipe errors](https://discourse.julialang.org/t/editing-axis-labels-in-makie-recipe-errors/39490)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 0\
**Last updated:** [May 14, 2020, 8:40pm UTC](https://discourse.julialang.org/t/editing-axis-labels-in-makie-recipe-errors/39490 "2020-05-14T20:40:46Z")

</div>

Hi, I came up with the following process for plotting a type of plot I want to include in a new package as a recipe: heights = cumsum(KmerAnalysis.\_find\_plottable\_subset(spec); dims = 2) s = barplot(\[Point2f0(i - 1, j) …

---

## [Julia 1.4 fails to add local package](https://discourse.julialang.org/t/julia-1-4-fails-to-add-local-package/39326)

<div class="topic-metadata">

**Author:** [@alkoedl](https://discourse.julialang.org/u/alkoedl)\
**Replies:** 8\
**Last updated:** [May 14, 2020, 8:18pm UTC](https://discourse.julialang.org/t/julia-1-4-fails-to-add-local-package/39326 "2020-05-14T20:18:38Z")

</div>

With Julia 1.3.1 I can add a Julia package which is hosted on my local git server with IP 10.20.30.40 by doing pkg\> add "user@10.20.30.40:PackageName.jl" In Julia 1.4.0 and 1.4.1 the above throws the error ERROR: Path…

---

## [Loading only what you need](https://discourse.julialang.org/t/loading-only-what-you-need/39465)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 6\
**Last updated:** [May 14, 2020, 7:53pm UTC](https://discourse.julialang.org/t/loading-only-what-you-need/39465 "2020-05-14T19:53:00Z")

</div>

I was looking at SpecialFunctions.jl which contains a bunch of functions which are fairly independent and thinking: if I just want to only use one or two specific functions, what’s the overhead vs just copy-pasting that …

---

## [Some clarity on modules and incremental compilation/loading times](https://discourse.julialang.org/t/some-clarity-on-modules-and-incremental-compilation-loading-times/39449)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 6\
**Last updated:** [May 14, 2020, 12:20pm UTC](https://discourse.julialang.org/t/some-clarity-on-modules-and-incremental-compilation-loading-times/39449 "2020-05-14T12:20:52Z")

</div>

Hi all, I’ve read a bunch concerning modules and such, but haven’t managed to identify the best practice for my situation. My package currently has something like this: module Example include("file1.jl") # Some methods…

---

## [Is it possible for the MAT package to export multiple data sets using a single call of the \`write\` command?](https://discourse.julialang.org/t/is-it-possible-for-the-mat-package-to-export-multiple-data-sets-using-a-single-call-of-the-write-command/9716)

<div class="topic-metadata">

**Author:** [@chobbes](https://discourse.julialang.org/u/chobbes)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 11:04am UTC](https://discourse.julialang.org/t/is-it-possible-for-the-mat-package-to-export-multiple-data-sets-using-a-single-call-of-the-write-command/9716 "2020-05-14T11:04:02Z")

</div>

I was expecting to have something like: write(file, "varname1", variable1, "varname2", variable2) Or even export all the data in the workspace in one batch?

---

## [Incompatibitly with latest versions of DataFrames and CSV](https://discourse.julialang.org/t/incompatibitly-with-latest-versions-of-dataframes-and-csv/39443)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 5\
**Last updated:** [May 14, 2020, 7:31am UTC](https://discourse.julialang.org/t/incompatibitly-with-latest-versions-of-dataframes-and-csv/39443 "2020-05-14T07:31:41Z")

</div>

I seem to be stuck in a cycle, trying to install the latest versions of DataFrames and CSV. Can anyone suggest a way out, or how to further diagnose the issue? (v1.4) pkg\> add DataFrames@0.21 Resolving package versio…

---

## [How to enable type inference on own types similar to what julia supports for nothing and missing?](https://discourse.julialang.org/t/how-to-enable-type-inference-on-own-types-similar-to-what-julia-supports-for-nothing-and-missing/39418)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 5\
**Last updated:** [May 14, 2020, 4:44am UTC](https://discourse.julialang.org/t/how-to-enable-type-inference-on-own-types-similar-to-what-julia-supports-for-nothing-and-missing/39418 "2020-05-14T04:44:25Z")

</div>

I try to understand when to use Union types versus constructing custom type hierarchies. One peculiarity is how nothing / missing behave like you would hope for julia\> f(x) = isodd(x) ? nothing : Some(x) julia\> f.(\[1,2…

---

## [Having trouble parallelizing a system of ODEs](https://discourse.julialang.org/t/having-trouble-parallelizing-a-system-of-odes/39442)

<div class="topic-metadata">

**Author:** [@Lachlan-Bn](https://discourse.julialang.org/u/Lachlan-Bn)\
**Replies:** 1\
**Last updated:** [May 14, 2020, 3:28am UTC](https://discourse.julialang.org/t/having-trouble-parallelizing-a-system-of-odes/39442 "2020-05-14T03:28:32Z")

</div>

Allow me to preface this by saying I have limited programming experience beyond the relatively short time I’ve been using Julia, so if you see I’ve made some kind of coding faux pas, please point it out! I have a non-li…

---

## [Trying to better understand how Julia listens on a UNIX domain socket or named pipe](https://discourse.julialang.org/t/trying-to-better-understand-how-julia-listens-on-a-unix-domain-socket-or-named-pipe/39396)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 2\
**Last updated:** [May 14, 2020, 2:06am UTC](https://discourse.julialang.org/t/trying-to-better-understand-how-julia-listens-on-a-unix-domain-socket-or-named-pipe/39396 "2020-05-14T02:06:17Z")

</div>

Hi all, I copied the following code from this Discourse response about linking Julia and node.js. I’m very new to the idea of both tasks and sockets, and although I’ve got the code working perfectly for my use-case, I w…

---

## [Missing epsilon](https://discourse.julialang.org/t/missing-epsilon/39430)

<div class="topic-metadata">

**Author:** [@Jul](https://discourse.julialang.org/u/Jul)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 9:21pm UTC](https://discourse.julialang.org/t/missing-epsilon/39430 "2020-05-13T21:21:51Z")

</div>

Hello, I’m trying to write small epsilon in Julia 1.4.1 (\\ epsilon) but instead epsilon character I see small box (box character or something like that- small, empty rectangle). Anyone had similar problem?

---

## [Write() done but not writing the content in existing file](https://discourse.julialang.org/t/write-done-but-not-writing-the-content-in-existing-file/39412)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 5:27pm UTC](https://discourse.julialang.org/t/write-done-but-not-writing-the-content-in-existing-file/39412 "2020-05-13T17:27:06Z")

</div>

Hi, I’d like to write to an existing file. touch cmds #ran in linux to creat an empty file then in Julia I did: cmds=open("cmds", "w") for i in 1:5 cmd= "echo hello echo byebye" println(cmd) #write(cmds,…

---

## [Simple GUI elements on plot](https://discourse.julialang.org/t/simple-gui-elements-on-plot/39284)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 8\
**Last updated:** [May 13, 2020, 5:38pm UTC](https://discourse.julialang.org/t/simple-gui-elements-on-plot/39284 "2020-05-13T17:38:10Z")

</div>

Matlab provides tools to build simple GUI applications, i.e., plot with a slider or edit box to change a parameter and observe results. What would be the equivalent package for julia, not requiring installing electron or…

---

## [Benchmarks game](https://discourse.julialang.org/t/benchmarks-game/38544)

<div class="topic-metadata">

**Author:** [@apieum](https://discourse.julialang.org/u/apieum)\
**Replies:** 20\
**Last updated:** [May 13, 2020, 5:20pm UTC](https://discourse.julialang.org/t/benchmarks-game/38544 "2020-05-13T17:20:07Z")

</div>

Hi, this blog post shows bad results for julia in benchmarks game: Which programming language is fastest? In comments the author said “One problem with Julia benchmarks on the Benchmarks Game is that improved Julia prog…

---

## [BoundError in Flux.train! with DiffEqFlux](https://discourse.julialang.org/t/bounderror-in-flux-train-with-diffeqflux/39413)

<div class="topic-metadata">

**Author:** [@Geoffrey](https://discourse.julialang.org/u/Geoffrey)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 4:43pm UTC](https://discourse.julialang.org/t/bounderror-in-flux-train-with-diffeqflux/39413 "2020-05-13T16:43:16Z")

</div>

Hi, I’m trying to use DiffEqFlux to solve a scalar ode which looks like : du(t) = f(X(t)) - a \* u, where X(t) is a set of functions of time. I modeled f with a neural network and i’m trying to optimize the parameter of …

---

## [Heatmap Plots.jl](https://discourse.julialang.org/t/heatmap-plots-jl/39406)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 2\
**Last updated:** [May 13, 2020, 2:31pm UTC](https://discourse.julialang.org/t/heatmap-plots-jl/39406 "2020-05-13T14:31:49Z")

</div>

Good afternoon! I can not get the heatmap plot in the Plots.jl package to do what I would like. If I do: using Plots backend(:plotly) p = heatmap(\[1,2,3,1,2,3,1,2,3\],\[1,1,1,2,2,2,3,3,3\],\[1,1,1,1,1,1,1,1,1\]) gui(p) I …

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

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