# General Usage

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

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

**Page:** 796

---

## [Minor style question: promotion inside constructor and new](https://discourse.julialang.org/t/minor-style-question-promotion-inside-constructor-and-new/33615)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [January 21, 2020, 12:31pm UTC](https://discourse.julialang.org/t/minor-style-question-promotion-inside-constructor-and-new/33615 "2020-01-21T12:31:03Z")

</div>

This is a minor style question: I have a solution but it is a bit convoluted, and I wonder how others do it. Suppose I want to cache something precomputed in a struct in the constructor (this is the only constructor, an…

---

## [Fix domain of von Mises distribution (Distributions.jl) to -π ~ + π](https://discourse.julialang.org/t/fix-domain-of-von-mises-distribution-distributions-jl-to/33613)

<div class="topic-metadata">

**Author:** [@SSU](https://discourse.julialang.org/u/SSU)\
**Replies:** 0\
**Last updated:** [January 21, 2020, 9:52am UTC](https://discourse.julialang.org/t/fix-domain-of-von-mises-distribution-distributions-jl-to/33613 "2020-01-21T09:52:49Z")

</div>

I am analyzing circular mixture time series data which the domain is \\pm \\pi. I am planning to use von Mises distribution in HMMBase.jl ( or Turing.jl) to estimate the parameters(e.g. \\mu, \\kappa) of my data. In Distri…

---

## [Why \`Tuple{Vararg{T, 2} where T} == Tuple{Any, Any}\`?](https://discourse.julialang.org/t/why-tuple-vararg-t-2-where-t-tuple-any-any/33511)

<div class="topic-metadata">

**Author:** [@Wenjie](https://discourse.julialang.org/u/Wenjie)\
**Replies:** 2\
**Last updated:** [January 21, 2020, 1:39am UTC](https://discourse.julialang.org/t/why-tuple-vararg-t-2-where-t-tuple-any-any/33511 "2020-01-21T01:39:20Z")

</div>

Why this is the case, instead of being a UnionAll like Arrays?

---

## [Error missing about side-effect on immutable type](https://discourse.julialang.org/t/error-missing-about-side-effect-on-immutable-type/33588)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 11\
**Last updated:** [January 20, 2020, 4:46pm UTC](https://discourse.julialang.org/t/error-missing-about-side-effect-on-immutable-type/33588 "2020-01-20T16:46:48Z")

</div>

docs mentioned that: Julia function arguments follow a convention sometimes called “pass-by-sharing”… Modifications to mutable values (such as Array s) made within a function will be visible to the caller. I think i…

---

## [How to convert an svg file to png with fixed pixel size/resolution](https://discourse.julialang.org/t/how-to-convert-an-svg-file-to-png-with-fixed-pixel-size-resolution/33561)

<div class="topic-metadata">

**Author:** [@hhaensel](https://discourse.julialang.org/u/hhaensel)\
**Replies:** 1\
**Last updated:** [January 20, 2020, 4:06pm UTC](https://discourse.julialang.org/t/how-to-convert-an-svg-file-to-png-with-fixed-pixel-size-resolution/33561 "2020-01-20T16:06:13Z")

</div>

I wonder how to fix the size of a png when converting svg to png with Rsvg.jl Currently I am using the demo code using Rsvg using Cairo filename\_in = "a4.svg" filename\_out = "a4.png" r = Rsvg.handle\_new\_from\_file(fil…

---

## [What is typeof(fun)?](https://discourse.julialang.org/t/what-is-typeof-fun/33523)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 5\
**Last updated:** [January 20, 2020, 1:57pm UTC](https://discourse.julialang.org/t/what-is-typeof-fun/33523 "2020-01-20T13:57:09Z")

</div>

when I methods(Base.map), I see something like: \[1\] map(::typeof(zero), A::BitArray) in Base at bitarray.jl:1659 what is typeof(zero)? indeed, I found that: julia\> f(x) = 2x f (generic function with 1 method) julia\> …

---

## [Automatically disconnect idle workers](https://discourse.julialang.org/t/automatically-disconnect-idle-workers/33579)

<div class="topic-metadata">

**Author:** [@pfarndt](https://discourse.julialang.org/u/pfarndt)\
**Replies:** 0\
**Last updated:** [January 20, 2020, 12:47pm UTC](https://discourse.julialang.org/t/automatically-disconnect-idle-workers/33579 "2020-01-20T12:47:12Z")

</div>

While doing some interactive data analysis (in a Jupyter notebook) I often use a ClusterManagers.ElasticManager in the master process and then connect a couple of remote workers using Distributed.start\_worker(...). Some…

---

## [Translate images by subpixel amounts](https://discourse.julialang.org/t/translate-images-by-subpixel-amounts/30248)

<div class="topic-metadata">

**Author:** [@johnheyer](https://discourse.julialang.org/u/johnheyer)\
**Replies:** 5\
**Last updated:** [January 20, 2020, 11:11am UTC](https://discourse.julialang.org/t/translate-images-by-subpixel-amounts/30248 "2020-01-20T11:11:21Z")

</div>

Hello, I’m trying to translate an image by arbitrary amounts, and am currently doing translations via JuliaImages and CoordinateTransformation packages as such: t = Translation(y\_shift, x\_shift) img = warp(img, t, indi…

---

## [Schematic Way to resolve dependency issues in a package development](https://discourse.julialang.org/t/schematic-way-to-resolve-dependency-issues-in-a-package-development/33512)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 3\
**Last updated:** [January 20, 2020, 9:16am UTC](https://discourse.julialang.org/t/schematic-way-to-resolve-dependency-issues-in-a-package-development/33512 "2020-01-20T09:16:59Z")

</div>

Yesterday I ran into a not-so nice situation with packages and their dependencies. I added a package or updated a package (after \] activate MyPackage an \] update) to my current development status and while locally on my …

---

## [Creating one's own Matrix type](https://discourse.julialang.org/t/creating-ones-own-matrix-type/33553)

<div class="topic-metadata">

**Author:** [@timueh](https://discourse.julialang.org/u/timueh)\
**Replies:** 6\
**Last updated:** [January 20, 2020, 7:05am UTC](https://discourse.julialang.org/t/creating-ones-own-matrix-type/33553 "2020-01-20T07:05:26Z")

</div>

I have a question related to 13:45 in Alan Edelman’s recent award presentation: In the following two code snippets, is there a deeper difference other than MyMatrix being more descriptive, i.e. the type tells me the typ…

---

## [How do i know my package is reading the correct \`Project.toml\` files?](https://discourse.julialang.org/t/how-do-i-know-my-package-is-reading-the-correct-project-toml-files/33499)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 8\
**Last updated:** [January 19, 2020, 10:14pm UTC](https://discourse.julialang.org/t/how-do-i-know-my-package-is-reading-the-correct-project-toml-files/33499 "2020-01-19T22:14:46Z")

</div>

I have developed a package MyPackage that has it’s own Project.toml and Manifest.toml files. I’ve dev this from my main environment so that my v1.2 Project.toml file looks like this: (v1.2) pkg\> st Status \`~/.julia/…

---

## [Keyword Arguments vs Dict](https://discourse.julialang.org/t/keyword-arguments-vs-dict/33500)

<div class="topic-metadata">

**Author:** [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Replies:** 10\
**Last updated:** [January 19, 2020, 9:19pm UTC](https://discourse.julialang.org/t/keyword-arguments-vs-dict/33500 "2020-01-19T21:19:05Z")

</div>

I would like to know if it is a problem to use a Dict parameter for passing options to a method instead of using the keyword arguments mechanism already present in Julia. Basically, I have a method that takes a ten or m…

---

## [BaseBenchmarks.jl not in registry?](https://discourse.julialang.org/t/basebenchmarks-jl-not-in-registry/33557)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 1\
**Last updated:** [January 19, 2020, 7:59pm UTC](https://discourse.julialang.org/t/basebenchmarks-jl-not-in-registry/33557 "2020-01-19T19:59:11Z")

</div>

When I try to add this package, I get the following error: (v1.3) pkg\> add BaseBenchmarks ERROR: The following package names could not be resolved: \* BaseBenchmarks (not found in project, manifest or registry) Please s…

---

## [How to define matrix objectives in JuMP models](https://discourse.julialang.org/t/how-to-define-matrix-objectives-in-jump-models/33556)

<div class="topic-metadata">

**Author:** [@tdp](https://discourse.julialang.org/u/tdp)\
**Replies:** 1\
**Last updated:** [January 19, 2020, 7:45pm UTC](https://discourse.julialang.org/t/how-to-define-matrix-objectives-in-jump-models/33556 "2020-01-19T19:45:34Z")

</div>

Hi, How do I declare a matrix objective in JuMP? That is, how do I declare @objective(m, Min, ⋅ ) with ⋅ a matrix? Thank you for any help. Details I am trying to translate the Python code below to Julia. However, the …

---

## [Confusing results when searching documentation, 1.3.1](https://discourse.julialang.org/t/confusing-results-when-searching-documentation-1-3-1/33542)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 4\
**Last updated:** [January 19, 2020, 6:44pm UTC](https://discourse.julialang.org/t/confusing-results-when-searching-documentation-1-3-1/33542 "2020-01-19T18:44:35Z")

</div>

Searching the 1.3.1 documentation for “closure” yields 16 results, one of which is the “Closures” section. Searching for “closures” or “Closures” gives 14 results, which do not contain the section. If desired, I can make…

---

## [What function (display?) does IJulia call at the end of each cell?](https://discourse.julialang.org/t/what-function-display-does-ijulia-call-at-the-end-of-each-cell/33554)

<div class="topic-metadata">

**Author:** [@JeffFessler](https://discourse.julialang.org/u/JeffFessler)\
**Replies:** 2\
**Last updated:** [January 19, 2020, 6:39pm UTC](https://discourse.julialang.org/t/what-function-display-does-ijulia-call-at-the-end-of-each-cell/33554 "2020-01-19T18:39:47Z")

</div>

I have an AbstractArray type with its own display method that gets called correctly in the REPL but in Jupyter/IJulia whatever function is called to display the last argument in each cell is apparently calling a default …

---

## [Mutating closure?](https://discourse.julialang.org/t/mutating-closure/33544)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 2\
**Last updated:** [January 19, 2020, 3:15pm UTC](https://discourse.julialang.org/t/mutating-closure/33544 "2020-01-19T15:15:18Z")

</div>

I am trying to define a closure which mutates its argument, without luck. Is there a way to define a closure which is mutating? Here’s an example of what I’m trying to achieve: Thanks! function a!(x) for i = 1:size…

---

## [Saving julia dataframes efficiently (in terms of size on the disk)](https://discourse.julialang.org/t/saving-julia-dataframes-efficiently-in-terms-of-size-on-the-disk/32151)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 13\
**Last updated:** [January 19, 2020, 2:41am UTC](https://discourse.julialang.org/t/saving-julia-dataframes-efficiently-in-terms-of-size-on-the-disk/32151 "2020-01-19T02:41:46Z")

</div>

What is a good format to store Julia DataFrames efficiently (in terms of size on the disk)? I have a dataset that is about 2.1GB as a Feather file. It is almost 1.9GB in Stata .dta format. But if I open it in R and save…

---

## [Error when rebuilding sysimage after building MKL; Julia 1.3.1, Windows 10](https://discourse.julialang.org/t/error-when-rebuilding-sysimage-after-building-mkl-julia-1-3-1-windows-10/33199)

<div class="topic-metadata">

**Author:** [@razvangheorghe](https://discourse.julialang.org/u/razvangheorghe)\
**Replies:** 2\
**Last updated:** [January 19, 2020, 12:00am UTC](https://discourse.julialang.org/t/error-when-rebuilding-sysimage-after-building-mkl-julia-1-3-1-windows-10/33199 "2020-01-19T00:00:32Z")

</div>

Hello. I’m trying to build Julia against MKL. Julia Version 1.3.1 Commit 2d5741174c (2019-12-30 21:36 UTC) Platform Info: OS: Windows (x86\_64-w64-mingw32) CPU: Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz WORD\_SIZE: 64…

---

## [Parallel worlds ages don't match](https://discourse.julialang.org/t/parallel-worlds-ages-dont-match/33496)

<div class="topic-metadata">

**Author:** [@pbayer](https://discourse.julialang.org/u/pbayer)\
**Replies:** 5\
**Last updated:** [January 18, 2020, 2:01pm UTC](https://discourse.julialang.org/t/parallel-worlds-ages-dont-match/33496 "2020-01-18T14:01:42Z")

</div>

Im currently developing the multithreading in Simulate.jl. Now – with the current development version – I create a master clock and setup three parallel clocks: using Simulate clk = Clock() multiply!(clk) got 3 threads…

---

## [New Artifact System, Data, and OneDrive](https://discourse.julialang.org/t/new-artifact-system-data-and-onedrive/33250)

<div class="topic-metadata">

**Author:** [@Crown421](https://discourse.julialang.org/u/Crown421)\
**Replies:** 12\
**Last updated:** [January 18, 2020, 2:11pm UTC](https://discourse.julialang.org/t/new-artifact-system-data-and-onedrive/33250 "2020-01-18T14:11:18Z")

</div>

Dear all, today instead of doing my work, I learned about the new artifact system, and I am absolutely fascinated. I am currently working on a project that uses some data files, which I store in my Onedrive for Busines…

---

## [Performance advice needed](https://discourse.julialang.org/t/performance-advice-needed/33467)

<div class="topic-metadata">

**Author:** [@Jakub\_Wronowski](https://discourse.julialang.org/u/Jakub_Wronowski)\
**Replies:** 17\
**Last updated:** [January 17, 2020, 5:55pm UTC](https://discourse.julialang.org/t/performance-advice-needed/33467 "2020-01-17T17:55:02Z")

</div>

Hi, I am working on a function with calculation that have structure similar to FFT. I’m a bit disappointed, cause I hoped it will be 10x slower than FFTW but benchmarks show its 100x slower. i tried to put @simd and @in…

---

## [In Cxx, how to supply compiler flags like -O2 or --std==c++17](https://discourse.julialang.org/t/in-cxx-how-to-supply-compiler-flags-like-o2-or-std-c-17/33435)

<div class="topic-metadata">

**Author:** [@JJB](https://discourse.julialang.org/u/JJB)\
**Replies:** 4\
**Last updated:** [January 18, 2020, 8:59am UTC](https://discourse.julialang.org/t/in-cxx-how-to-supply-compiler-flags-like-o2-or-std-c-17/33435 "2020-01-18T08:59:39Z")

</div>

When using the Cxx package, how can I supply flags to Clang like -O2 or --std==c++17?

---

## [Question about optimal thread allocation for vector of problems of differing sizes](https://discourse.julialang.org/t/question-about-optimal-thread-allocation-for-vector-of-problems-of-differing-sizes/33464)

<div class="topic-metadata">

**Author:** [@Sean\_Matthews](https://discourse.julialang.org/u/Sean_Matthews)\
**Replies:** 7\
**Last updated:** [January 17, 2020, 11:09pm UTC](https://discourse.julialang.org/t/question-about-optimal-thread-allocation-for-vector-of-problems-of-differing-sizes/33464 "2020-01-17T23:09:15Z")

</div>

I have a question about multithreading. I have a vector of pairwise thread safe problems v, say of length 16, and I have four threads. As I understand it, if I write Threads.@theads for i in 1:16 do\_problem(v\[i\]) en…

---

## [Core.tuple() warntype](https://discourse.julialang.org/t/core-tuple-warntype/33375)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 22\
**Last updated:** [January 17, 2020, 7:33pm UTC](https://discourse.julialang.org/t/core-tuple-warntype/33375 "2020-01-17T19:33:29Z")

</div>

I’m studying Tuples and find that (in base/tuple.jl) a lot of methods to create them (e.g. map(), NTuple{}(), etc.) at the end would return something like (x..., ), which calls Core.tuple(). However, I found that this c…

---

## [Using Turing as a replacement of Klara](https://discourse.julialang.org/t/using-turing-as-a-replacement-of-klara/32152)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 26\
**Last updated:** [January 17, 2020, 3:14pm UTC](https://discourse.julialang.org/t/using-turing-as-a-replacement-of-klara/32152 "2020-01-17T15:14:16Z")

</div>

i used to use Klara for MCMC sampler where i just call back the log density of the target function and it was working the way i wanted and now when i want to go back where i’m using it i found problems since i can’t use K…

---

## [Expression interpolation](https://discourse.julialang.org/t/expression-interpolation/33472)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 7\
**Last updated:** [January 17, 2020, 2:46pm UTC](https://discourse.julialang.org/t/expression-interpolation/33472 "2020-01-17T14:46:00Z")

</div>

in doc, the following example is given: julia\> ex = :(a in $:((1, 2, 3) ) ) :(a in (1, 2, 3)) I don’t get the meaning of “expression interpolation”, as: julia\> ex2 = :(a in (1, 2, 3) ) :(a in (1, 2, 3)) julia\> ex == …

---

## [Commands in package](https://discourse.julialang.org/t/commands-in-package/33426)

<div class="topic-metadata">

**Author:** [@amind3211](https://discourse.julialang.org/u/amind3211)\
**Replies:** 2\
**Last updated:** [January 17, 2020, 2:34pm UTC](https://discourse.julialang.org/t/commands-in-package/33426 "2020-01-17T14:34:50Z")

</div>

1.how can i find or show the items , command or everything you call it in a package ? like SpeedOfLightInVacuum in PhysicalConstants.jl (by the way what do you call them ?)

---

## [Deserealize from/to JSON](https://discourse.julialang.org/t/deserealize-from-to-json/33486)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 1\
**Last updated:** [January 17, 2020, 1:14pm UTC](https://discourse.julialang.org/t/deserealize-from-to-json/33486 "2020-01-17T13:14:36Z")

</div>

I would like to have a quick and dirty way to load/save custom julia structs to a human readable format, say JSON. Goals Human readable Works out of the box for user defined structs Should be simple to implement Should…

---

## [Package undefvarerror: top level scope at none:0](https://discourse.julialang.org/t/package-undefvarerror-top-level-scope-at-none-0/33482)

<div class="topic-metadata">

**Author:** [@diepreye\_ayabina](https://discourse.julialang.org/u/diepreye_ayabina)\
**Replies:** 2\
**Last updated:** [January 17, 2020, 12:49pm UTC](https://discourse.julialang.org/t/package-undefvarerror-top-level-scope-at-none-0/33482 "2020-01-17T12:49:37Z")

</div>

So I just started learning Julia. I installed the Julia 1.0.5 64 bit windows version. Installation went smoothly. However I have not been able to add IJulia package. Each time I type Pkg.add(“IJulia”) , I get the error m…

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

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