# General Usage

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

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

**Page:** 920

---

## [Lossless type promotion](https://discourse.julialang.org/t/lossless-type-promotion/17465)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [November 13, 2018, 11:53am UTC](https://discourse.julialang.org/t/lossless-type-promotion/17465 "2018-11-13T11:53:01Z")

</div>

What is the correct, generic way to figure out if values of a type T can be converted into another type S without loss of precision? Base.typejoin cannot be used for this (eg for (Int8, Int16), it returns Signed). promo…

---

## [GR plots not shown in own GUI when using Atom](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 13\
**Last updated:** [November 13, 2018, 10:35am UTC](https://discourse.julialang.org/t/gr-plots-not-shown-in-own-gui-when-using-atom/13551 "2018-11-13T10:35:54Z")

</div>

When using julia v0.7 and plotting using Plots/gr() from Atom, plots refuse to show in the GR gui. If I have plot pane enabled, they show up in the plot pane, when I deselect plot pane, they never show up. In julia 0.6 I…

---

## [Show latest tagged version in github repository instead of master](https://discourse.julialang.org/t/show-latest-tagged-version-in-github-repository-instead-of-master/17464)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 0\
**Last updated:** [November 13, 2018, 8:50am UTC](https://discourse.julialang.org/t/show-latest-tagged-version-in-github-repository-instead-of-master/17464 "2018-11-13T08:50:06Z")

</div>

Would it make sense to display the latest released version of a package in the Github repository, especially if the only documentation for that package is in the README.md file? For the newcomer, it is confusing to try …

---

## [Arpack.jl install error with MKL](https://discourse.julialang.org/t/arpack-jl-install-error-with-mkl/12254)

<div class="topic-metadata">

**Author:** [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Replies:** 9\
**Last updated:** [November 13, 2018, 8:36am UTC](https://discourse.julialang.org/t/arpack-jl-install-error-with-mkl/12254 "2018-11-13T08:36:29Z")

</div>

I can’t test, because Distributions doesn’t work for me on 0.7, due to this error building Arpack: (v0.7) pkg\> build Arpack Building Arpack → \`~/.julia/packages/Arpack/OpIo/deps/build.log\` ┌ Error: Error building \`Arp…

---

## [Wrapping typedef enum with Clang.jl](https://discourse.julialang.org/t/wrapping-typedef-enum-with-clang-jl/17425)

<div class="topic-metadata">

**Author:** [@samuelpowell](https://discourse.julialang.org/u/samuelpowell)\
**Replies:** 11\
**Last updated:** [November 13, 2018, 8:17am UTC](https://discourse.julialang.org/t/wrapping-typedef-enum-with-clang-jl/17425 "2018-11-13T08:17:52Z")

</div>

If I try to wrap the following header: typedef enum \_foo { BAR, BAZ } foo; using the following Clang.jl script: using Clang.wrap\_c const context = wrap\_c.init( headers = \[joinpath(@\_\_DIR\_\_, "header.h")\], …

---

## [Why doesn't this code work? I can't figure out](https://discourse.julialang.org/t/why-doesnt-this-code-work-i-cant-figure-out/17461)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [November 13, 2018, 7:17am UTC](https://discourse.julialang.org/t/why-doesnt-this-code-work-i-cant-figure-out/17461 "2018-11-13T07:17:37Z")

</div>

Thanks, I am sorry that I didn’t know how to format, I choose to remove the post, cause I figured it out! Thanks

---

## [Multivariate OLS](https://discourse.julialang.org/t/multivariate-ols/9150)

<div class="topic-metadata">

**Author:** [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)\
**Replies:** 17\
**Last updated:** [November 13, 2018, 5:48am UTC](https://discourse.julialang.org/t/multivariate-ols/9150 "2018-11-13T05:48:21Z")

</div>

GLM.jl seems more like an addon package for DataFrames (which are not even blessed as a basic julia building block, so they could go away) than a standalone linear regression package. Or am I mistaken? Can it operate…

---

## [Could the usage of \`haskey\` be unidiomatic/inefficient?](https://discourse.julialang.org/t/could-the-usage-of-haskey-be-unidiomatic-inefficient/17442)

<div class="topic-metadata">

**Author:** [@SZJX](https://discourse.julialang.org/u/SZJX)\
**Replies:** 6\
**Last updated:** [November 13, 2018, 1:45am UTC](https://discourse.julialang.org/t/could-the-usage-of-haskey-be-unidiomatic-inefficient/17442 "2018-11-13T01:45:01Z")

</div>

It seems to be a common pattern to me that something like this needs to be done: if !haskey(dict, key) ... else item = dict\[key\] ... end Would this lead to two lookups and thus cause extra overhead? I considered…

---

## [Replacement for get() in Query](https://discourse.julialang.org/t/replacement-for-get-in-query/17098)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 6\
**Last updated:** [November 12, 2018, 7:05pm UTC](https://discourse.julialang.org/t/replacement-for-get-in-query/17098 "2018-11-12T19:05:21Z")

</div>

@davidanthoff The previous version of Query had get which was used to unwrap the value within the DataValue. Not sure what is the new workflow, but this query no longer works as occursin needs the actual string value. @…

---

## [Including generated gif files in the documentation](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363)

<div class="topic-metadata">

**Author:** [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Replies:** 5\
**Last updated:** [November 12, 2018, 5:31pm UTC](https://discourse.julialang.org/t/including-generated-gif-files-in-the-documentation/17363 "2018-11-12T17:31:14Z")

</div>

Hi, We are having problems to include in the documentation of TaylorIntegration.j some .gif files that are generated by the documentation (using Plots.jl); see https://perezhz.github.io/TaylorIntegration.jl/latest/root\_…

---

## [Does GC overhead scale with memory consumption?](https://discourse.julialang.org/t/does-gc-overhead-scale-with-memory-consumption/17175)

<div class="topic-metadata">

**Author:** [@jwu](https://discourse.julialang.org/u/jwu)\
**Replies:** 4\
**Last updated:** [November 12, 2018, 2:39pm UTC](https://discourse.julialang.org/t/does-gc-overhead-scale-with-memory-consumption/17175 "2018-11-12T14:39:40Z")

</div>

Does the GC overhead scale with memory consumption, since GC have to scan the heap? this is some tests with Julia 0.7.0 julia\> @time GC.gc() 0.429078 seconds (4 allocations…

---

## [Type stability of different for loops](https://discourse.julialang.org/t/type-stability-of-different-for-loops/17431)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [November 12, 2018, 1:44pm UTC](https://discourse.julialang.org/t/type-stability-of-different-for-loops/17431 "2018-11-12T13:44:28Z")

</div>

Hi all- I am experiencing a type instability problem with my code. I was able to narrow down the problem and find a solution, but it doesn’t make sense to me. It seems that iterating over objects rather than indices is …

---

## [Guide for contributing to julia package on Github](https://discourse.julialang.org/t/guide-for-contributing-to-julia-package-on-github/17401)

<div class="topic-metadata">

**Author:** [@kkmann](https://discourse.julialang.org/u/kkmann)\
**Replies:** 3\
**Last updated:** [November 12, 2018, 1:06pm UTC](https://discourse.julialang.org/t/guide-for-contributing-to-julia-package-on-github/17401 "2018-11-12T13:06:57Z")

</div>

Hey, so, since 1.0 I am really confused about the recommended workflow for contributing to julia packages which are being developed on GitHub.com. Is there any documentation on the entire process? I forked and cloned t…

---

## [Help defining a parametric type](https://discourse.julialang.org/t/help-defining-a-parametric-type/17419)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 3\
**Last updated:** [November 12, 2018, 10:17am UTC](https://discourse.julialang.org/t/help-defining-a-parametric-type/17419 "2018-11-12T10:17:47Z")

</div>

I want to define a mutable struct: mutable struct W{T \<: Real} a::T b::T c::T W(a, b, c) = begin # some checks on a, b, c new{T}(a, b, c) end end When I go to cr…

---

## [Function callback in function converge, what's the meaning?. And how to use it](https://discourse.julialang.org/t/function-callback-in-function-converge-whats-the-meaning-and-how-to-use-it/17426)

<div class="topic-metadata">

**Author:** [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Replies:** 0\
**Last updated:** [November 12, 2018, 8:56am UTC](https://discourse.julialang.org/t/function-callback-in-function-converge-whats-the-meaning-and-how-to-use-it/17426 "2018-11-12T08:56:18Z")

</div>

\# We assume a model is just a callable object (https://docs.julialang.org/en/v1/manual/methods/#Function-like-objects-1) # model(x) will give us a prediction, and params(model) will iterate over the parameters. """ …

---

## [Allocations when manipulating an iterator](https://discourse.julialang.org/t/allocations-when-manipulating-an-iterator/17405)

<div class="topic-metadata">

**Author:** [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Replies:** 5\
**Last updated:** [November 12, 2018, 8:53am UTC](https://discourse.julialang.org/t/allocations-when-manipulating-an-iterator/17405 "2018-11-12T08:53:52Z")

</div>

I distilled a significant performance issue in JuMP 0.19-alpha (https://github.com/JuliaOpt/JuMP.jl/issues/1403#issuecomment-437630140) to the following standalone example: using BenchmarkTools struct FlippedDictIterat…

---

## [function vs. getfield](https://discourse.julialang.org/t/function-vs-getfield/17418)

<div class="topic-metadata">

**Author:** [@unhandyandy](https://discourse.julialang.org/u/unhandyandy)\
**Replies:** 6\
**Last updated:** [November 12, 2018, 4:28am UTC](https://discourse.julialang.org/t/function-vs-getfield/17418 "2018-11-12T04:28:27Z")

</div>

Why doesn’t typeof return “function”? julia\> testint #104 (generic function with 1 method) julia\> typeof(testint) getfield(Main, Symbol("##104#113")){Array{getfield(Main, Symbol("##89#90")){getfield(Main, Symbol("##67#…

---

## [Loading a csvfile using CSVFiles](https://discourse.julialang.org/t/loading-a-csvfile-using-csvfiles/17305)

<div class="topic-metadata">

**Author:** [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Replies:** 3\
**Last updated:** [November 12, 2018, 1:32am UTC](https://discourse.julialang.org/t/loading-a-csvfile-using-csvfiles/17305 "2018-11-12T01:32:05Z")

</div>

I have a file with a date in the form mm/dd/yy and my guess is that it is interpreting it in dd/mm/yy format. I’ve been using CSVFiles to do this with the load command and have tried the following: load("test.csv",colp…

---

## [Using macros from Query with pipes](https://discourse.julialang.org/t/using-macros-from-query-with-pipes/17137)

<div class="topic-metadata">

**Author:** [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Replies:** 6\
**Last updated:** [November 12, 2018, 12:32am UTC](https://discourse.julialang.org/t/using-macros-from-query-with-pipes/17137 "2018-11-12T00:32:36Z")

</div>

I’m been using the macros from Query with the pipe |\>. If I do (with the Query and Statistics packages) collect(1:10) |\> @map(\_^2) |\> @filter(\_%2==0) |\> a-\>mean(a) everything works as expected (finding the mean of the …

---

## [String builder in Julia?](https://discourse.julialang.org/t/string-builder-in-julia/17225)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 7\
**Last updated:** [November 11, 2018, 8:39pm UTC](https://discourse.julialang.org/t/string-builder-in-julia/17225 "2018-11-11T20:39:11Z")

</div>

Is there anything like a string builder in Julia? What is the recommended approach to build a string by iteratively concatenating parts to it?

---

## [SymEngine: dropping terms in a polynomial with near-zero coefficients](https://discourse.julialang.org/t/symengine-dropping-terms-in-a-polynomial-with-near-zero-coefficients/17391)

<div class="topic-metadata">

**Author:** [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Replies:** 5\
**Last updated:** [November 11, 2018, 7:14pm UTC](https://discourse.julialang.org/t/symengine-dropping-terms-in-a-polynomial-with-near-zero-coefficients/17391 "2018-11-11T19:14:57Z")

</div>

I’ve been using SymEngine to get a symbolic polynomial representation of a function and have been impressed by its speed and amazed that it even works seemlessly with BigFloat. However, at least partially because the fun…

---

## [Allowing integers to overflow to 0](https://discourse.julialang.org/t/allowing-integers-to-overflow-to-0/17394)

<div class="topic-metadata">

**Author:** [@wherrera](https://discourse.julialang.org/u/wherrera)\
**Replies:** 3\
**Last updated:** [November 11, 2018, 4:24am UTC](https://discourse.julialang.org/t/allowing-integers-to-overflow-to-0/17394 "2018-11-11T04:24:08Z")

</div>

I’ve come across a place where allowing a UInt8 to overflow to 0 on adding 1 is the proper behavior. Is there something like a decorator macro to allow the overflow and not get the overflow error with adding 1 to 255::U…

---

## [Call overhead of keyword args](https://discourse.julialang.org/t/call-overhead-of-keyword-args/17380)

<div class="topic-metadata">

**Author:** [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Replies:** 2\
**Last updated:** [November 10, 2018, 8:13pm UTC](https://discourse.julialang.org/t/call-overhead-of-keyword-args/17380 "2018-11-10T20:13:15Z")

</div>

I was reading https://docs.julialang.org/en/v1/manual/performance-tips/index.html#Declare-types-of-keyword-arguments-1 I could not really follow what is said there (“Functions with keyword arguments have near-zero over…

---

## [Plot 3d vector field](https://discourse.julialang.org/t/plot-3d-vector-field/2117)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 9\
**Last updated:** [November 10, 2018, 5:52pm UTC](https://discourse.julialang.org/t/plot-3d-vector-field/2117 "2018-11-10T17:52:02Z")

</div>

I would like to plot a 3d vector field (e.g. a couple of points with arrows attached), with some basic interactivity (rotatate, zoom, pan). What are my options to do this in julia? Are there some example codes with 3d ve…

---

## [Elemental doesn't Build in Julia 1.0](https://discourse.julialang.org/t/elemental-doesnt-build-in-julia-1-0/17384)

<div class="topic-metadata">

**Author:** [@Michael\_Ronen](https://discourse.julialang.org/u/Michael_Ronen)\
**Replies:** 0\
**Last updated:** [November 10, 2018, 1:17pm UTC](https://discourse.julialang.org/t/elemental-doesnt-build-in-julia-1-0/17384 "2018-11-10T13:17:56Z")

</div>

(v1.0) pkg\> build Elemental Building Elemental → \`~/.julia/packages/Elemental/RjtN9/deps/build.log\` ┌ Error: Error building \`Elemental\`: │ ERROR: LoadError: GitError(Code:ENOTFOUND, Class:Odb, object not found - no m…

---

## [Struggling to read a grayscale video in](https://discourse.julialang.org/t/struggling-to-read-a-grayscale-video-in/17373)

<div class="topic-metadata">

**Author:** [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Replies:** 4\
**Last updated:** [November 10, 2018, 4:05pm UTC](https://discourse.julialang.org/t/struggling-to-read-a-grayscale-video-in/17373 "2018-11-10T16:05:26Z")

</div>

I’m struggling to figure out how to read in a UInt8 grayscale video. read(open(videofilename)) isn’t working on this video format. I just get a 1D array of UInt8 that’s about 20k elements longer than the video should …

---

## [Relative \`eval\`](https://discourse.julialang.org/t/relative-eval/17382)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 4\
**Last updated:** [November 10, 2018, 1:11pm UTC](https://discourse.julialang.org/t/relative-eval/17382 "2018-11-10T13:11:38Z")

</div>

Is it possible to use eval of the enclosing module? So if I have: module A @eval x = 1 end module B using ..A end I would like to get a handle for B inside A and pass that as the first argument to @eval. Is su…

---

## [Allocation free alternative to typeof(similar(...)](https://discourse.julialang.org/t/allocation-free-alternative-to-typeof-similar/17372)

<div class="topic-metadata">

**Author:** [@juthohaegeman](https://discourse.julialang.org/u/juthohaegeman)\
**Replies:** 3\
**Last updated:** [November 10, 2018, 10:54am UTC](https://discourse.julialang.org/t/allocation-free-alternative-to-typeof-similar/17372 "2018-11-10T10:54:42Z")

</div>

I would like to know the return type of similar(A, T, sz) in a type-stable way, without any allocations. For example, the following method does what I want: function similartype(A, T, sz::Dims) B = similar(A, T, …

---

## [Help with optimizing GC time with large objects in memory](https://discourse.julialang.org/t/help-with-optimizing-gc-time-with-large-objects-in-memory/17327)

<div class="topic-metadata">

**Author:** [@jthomasnull](https://discourse.julialang.org/u/jthomasnull)\
**Replies:** 3\
**Last updated:** [November 10, 2018, 3:32am UTC](https://discourse.julialang.org/t/help-with-optimizing-gc-time-with-large-objects-in-memory/17327 "2018-11-10T03:32:53Z")

</div>

I need to keep a large object (a DataFrame, like 20GB large) in memory, and as a result I’m seeing very large GC times. An example: function t1(indexes::Vector{Int64},ranges::Vector{UnitRange{Int64}})::Vector{Vector{Int…

---

## [Julia program "Kllled" - Need better error message](https://discourse.julialang.org/t/julia-program-kllled-need-better-error-message/17378)

<div class="topic-metadata">

**Author:** [@James\_Norton](https://discourse.julialang.org/u/James_Norton)\
**Replies:** 1\
**Last updated:** [November 10, 2018, 2:51am UTC](https://discourse.julialang.org/t/julia-program-kllled-need-better-error-message/17378 "2018-11-10T02:51:27Z")

</div>

I’m attempting to run some code on an Ubuntu 18.04 machine (Google Cloud) and my program simply dies shortly after startup after printing “Killed”. Is there some way to get a more meaningful error message to diagnose the…

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

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