# General Usage

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

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

**Page:** 939

---

## [Creating a system image with a new package](https://discourse.julialang.org/t/creating-a-system-image-with-a-new-package/15193)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 3\
**Last updated:** [September 19, 2018, 7:19pm UTC](https://discourse.julialang.org/t/creating-a-system-image-with-a-new-package/15193 "2018-09-19T19:19:13Z")

</div>

Hi guys, I want to create a new system image with a package inside. I am doing it by: julia build\_sysimg.jl /tmp/test core2 userimg.jl in which userimg.jl has only using SatelliteToolbox. After the end of the proces…

---

## [Make \`cat\` (on a fixed dimension) type-stable](https://discourse.julialang.org/t/make-cat-on-a-fixed-dimension-type-stable/15183)

<div class="topic-metadata">

**Author:** [@kli6891](https://discourse.julialang.org/u/kli6891)\
**Replies:** 4\
**Last updated:** [September 19, 2018, 7:11pm UTC](https://discourse.julialang.org/t/make-cat-on-a-fixed-dimension-type-stable/15183 "2018-09-19T19:11:25Z")

</div>

I posted on Slack but wasn’t able to get a resolution (my fault since I posted at 4AM EST and Slack is so fast moving). Anyhow, is there a way to make cat type stable? I see the following: A = Array{Float64, 3}(reshap…

---

## [Destroying type stabiliy by creating "chaining" closures of functions](https://discourse.julialang.org/t/destroying-type-stabiliy-by-creating-chaining-closures-of-functions/14990)

<div class="topic-metadata">

**Author:** [@jcook](https://discourse.julialang.org/u/jcook)\
**Replies:** 17\
**Last updated:** [September 19, 2018, 5:48pm UTC](https://discourse.julialang.org/t/destroying-type-stabiliy-by-creating-chaining-closures-of-functions/14990 "2018-09-19T17:48:53Z")

</div>

I’ve found myself doing things like the below out of convenience. I’ve noticed that type stability is destroyed however. Is there a better way of achieving the same thing? julia\> struct Foo{T} a::T end ju…

---

## [Curl error while building Julia](https://discourse.julialang.org/t/curl-error-while-building-julia/15182)

<div class="topic-metadata">

**Author:** [@adamslc](https://discourse.julialang.org/u/adamslc)\
**Replies:** 0\
**Last updated:** [September 19, 2018, 4:24pm UTC](https://discourse.julialang.org/t/curl-error-while-building-julia/15182 "2018-09-19T16:24:27Z")

</div>

I’m trying to build Julia on a cluster which has very outdated versions of most tools. I’ve compiled current versions of curl, gcc, cmake, etc., but now Julia’s make is failing to download dependencies (it was able to do…

---

## [Should I use parametric types with parameters of type Symbol or not?](https://discourse.julialang.org/t/should-i-use-parametric-types-with-parameters-of-type-symbol-or-not/15178)

<div class="topic-metadata">

**Author:** [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Replies:** 2\
**Last updated:** [September 19, 2018, 2:52pm UTC](https://discourse.julialang.org/t/should-i-use-parametric-types-with-parameters-of-type-symbol-or-not/15178 "2018-09-19T14:52:03Z")

</div>

This may be a silly design question, but I had it often enough to feel like asking it here. In the following example, would you recommend version 1, where name is a parameter or version 2, where name is a field? What ar…

---

## [Does mod() work? Or am I high?](https://discourse.julialang.org/t/does-mod-work-or-am-i-high/15093)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 25\
**Last updated:** [September 19, 2018, 2:04pm UTC](https://discourse.julialang.org/t/does-mod-work-or-am-i-high/15093 "2018-09-19T14:04:28Z")

</div>

julia\> mod(1.0, 0.1) 0.09999999999999995 Shouldn’t this be exactly zero, or at least pretty close to zero? julia\> mod(1.1, 0.1) 2.7755575615628914e-17 Like this, for instance?

---

## [Define a type on the fly](https://discourse.julialang.org/t/define-a-type-on-the-fly/15148)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 14\
**Last updated:** [September 19, 2018, 12:43pm UTC](https://discourse.julialang.org/t/define-a-type-on-the-fly/15148 "2018-09-19T12:43:30Z")

</div>

Meta programming gurus, how can I create a struct from two Symbols? So say I have two arrays of symbols, and I want to create types (and set their abstract type) from all their possible combinations, it would look kind …

---

## [ANN: SimpleQuery](https://discourse.julialang.org/t/ann-simplequery/15172)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 0\
**Last updated:** [September 19, 2018, 11:14am UTC](https://discourse.julialang.org/t/ann-simplequery/15172 "2018-09-19T11:14:08Z")

</div>

An all-purpose front-end to query packages TADA

---

## [Cell output in Jupyter notebook](https://discourse.julialang.org/t/cell-output-in-jupyter-notebook/15158)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 3\
**Last updated:** [September 19, 2018, 10:52am UTC](https://discourse.julialang.org/t/cell-output-in-jupyter-notebook/15158 "2018-09-19T10:52:03Z")

</div>

I am using Julia with Jupyter notebook. See the code below. #ScikitLearn.CrossValidation.KFold(10, n\_folds=3) cross\_val\_score(model, X\_tst, y\_tst, cv=3) Output : 3-element Array{Float64,1}: 0.9961161079313164 0.99644…

---

## [variable type passed in call](https://discourse.julialang.org/t/variable-type-passed-in-call/15160)

<div class="topic-metadata">

**Author:** [@einzigsue](https://discourse.julialang.org/u/einzigsue)\
**Replies:** 2\
**Last updated:** [September 19, 2018, 8:20am UTC](https://discourse.julialang.org/t/variable-type-passed-in-call/15160 "2018-09-19T08:20:56Z")

</div>

I want to get the task ID from the syscall function defined in libc as the function gettid() cannot be directly called in the same manner as getpid(). In C, it should be called from syscall function as tid = syscall(SYS…

---

## [What's correct way to write a module separate in multiple files to maximum ide auto complete support?](https://discourse.julialang.org/t/whats-correct-way-to-write-a-module-separate-in-multiple-files-to-maximum-ide-auto-complete-support/15108)

<div class="topic-metadata">

**Author:** [@xiang0x48](https://discourse.julialang.org/u/xiang0x48)\
**Replies:** 2\
**Last updated:** [September 19, 2018, 6:43am UTC](https://discourse.julialang.org/t/whats-correct-way-to-write-a-module-separate-in-multiple-files-to-maximum-ide-auto-complete-support/15108 "2018-09-19T06:43:08Z")

</div>

As said in doc Modules and files, modules can be separated into multiple files like module Foo include("file1.jl") include("file2.jl") end However there would be one problem, suppose we are developing a module, and wou…

---

## [Incorrect compute for rounding function round(x)](https://discourse.julialang.org/t/incorrect-compute-for-rounding-function-round-x/15051)

<div class="topic-metadata">

**Author:** [@Andy-xu](https://discourse.julialang.org/u/Andy-xu)\
**Replies:** 12\
**Last updated:** [September 19, 2018, 4:02am UTC](https://discourse.julialang.org/t/incorrect-compute-for-rounding-function-round-x/15051 "2018-09-19T04:02:09Z")

</div>

I’m a Julia learner, and now i have a confuse question about the rounding function round(x), i’m not sure if it is bug, my compute system is window 64-bit, the version of Julia is 1.0, i have a problem while test the fun…

---

## [Pkg.gc error](https://discourse.julialang.org/t/pkg-gc-error/15111)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 2\
**Last updated:** [September 19, 2018, 12:54am UTC](https://discourse.julialang.org/t/pkg-gc-error/15111 "2018-09-19T00:54:30Z")

</div>

With Pkg.gc, I often get errors regarding .directory file in the directory of a package. I guess the .directory file was generated by the system automatically. I have to manually remove the file for gc to continue. (v1…

---

## [Feature or bug? using SymPy; Sym(-1)^(1//4)](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135)

<div class="topic-metadata">

**Author:** [@loisel](https://discourse.julialang.org/u/loisel)\
**Replies:** 9\
**Last updated:** [September 19, 2018, 12:30am UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135 "2018-09-19T00:30:27Z")

</div>

In Jupyter, I get some sort of broken output: \[Album\] imgur.com …

---

## [Backslash (left divided) of two sparse matrices A\\B return a dense matrix](https://discourse.julialang.org/t/backslash-left-divided-of-two-sparse-matrices-a-b-return-a-dense-matrix/15102)

<div class="topic-metadata">

**Author:** [@yuguophys](https://discourse.julialang.org/u/yuguophys)\
**Replies:** 3\
**Last updated:** [September 18, 2018, 9:40pm UTC](https://discourse.julialang.org/t/backslash-left-divided-of-two-sparse-matrices-a-b-return-a-dense-matrix/15102 "2018-09-18T21:40:58Z")

</div>

On Julia-0.6.4, I find that speye(200) \\ speye(200) returns 200×200 SparseMatrixCSC{Float64,Int64} with 40000 stored entries \[1 , 1\] = 1.0 \[2 , 1\] = 0.0 \[3 , 1\] = 0.0 … which is of sparse matrix ty…

---

## [Inhibit same type parameters](https://discourse.julialang.org/t/inhibit-same-type-parameters/15147)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 9:40pm UTC](https://discourse.julialang.org/t/inhibit-same-type-parameters/15147 "2018-09-18T21:40:33Z")

</div>

For example, I have 4 types A, B, C and D, which can be filled in a parametric type P. const U = Union{A, B, C, D} struct P{F \<: U, S \<: U} a::Vector b::Vector function P{F, S}(a, b) where {F, S} F …

---

## [Two Questions About Multithreading](https://discourse.julialang.org/t/two-questions-about-multithreading/14564)

<div class="topic-metadata">

**Author:** [@Juser](https://discourse.julialang.org/u/Juser)\
**Replies:** 5\
**Last updated:** [September 18, 2018, 9:13pm UTC](https://discourse.julialang.org/t/two-questions-about-multithreading/14564 "2018-09-18T21:13:24Z")

</div>

(1) There is some discussion in this old thread about building arrays in a thread-safe way. The solution proposed there is to allocate Threads.nthreads() separate arrays and allow each thread to freely use push! on its o…

---

## [Syntax: extra token "i" after end of expression](https://discourse.julialang.org/t/syntax-extra-token-i-after-end-of-expression/15143)

<div class="topic-metadata">

**Author:** [@marcelord12](https://discourse.julialang.org/u/marcelord12)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 7:48pm UTC](https://discourse.julialang.org/t/syntax-extra-token-i-after-end-of-expression/15143 "2018-09-18T19:48:16Z")

</div>

Could somebody help to solve this error? #================================================================= Function to sample ==================================================================# i=1 …

---

## [Distributions.jl Truncate with Dual?](https://discourse.julialang.org/t/distributions-jl-truncate-with-dual/15141)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 0\
**Last updated:** [September 18, 2018, 6:57pm UTC](https://discourse.julialang.org/t/distributions-jl-truncate-with-dual/15141 "2018-09-18T18:57:41Z")

</div>

Trying to make use a truncated distribution that has parameters that are Dual numbers but I get an error. using Distributions using ForwardDiff Truncated(Normal(ForwardDiff.Dual(0.0), ForwardDiff.Dual(1.0)), -10, 10) B…

---

## [Reinterpret 3D array into array of SMatrices](https://discourse.julialang.org/t/reinterpret-3d-array-into-array-of-smatrices/6957)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 4\
**Last updated:** [September 18, 2018, 4:14pm UTC](https://discourse.julialang.org/t/reinterpret-3d-array-into-array-of-smatrices/6957 "2018-09-18T16:14:48Z")

</div>

I don’t understand why I can’t reinterpret a 3D array of float as an array of static matrices. i’m trying to do this: A = rand(2,3,5) # can do julia\> reinterpret(SVector{3,Float64},A\[1,:,:\],(5,)) 5-element Array{SVector…

---

## [Minimal set of methods for integer primitive type](https://discourse.julialang.org/t/minimal-set-of-methods-for-integer-primitive-type/14540)

<div class="topic-metadata">

**Author:** [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Replies:** 3\
**Last updated:** [September 18, 2018, 3:07pm UTC](https://discourse.julialang.org/t/minimal-set-of-methods-for-integer-primitive-type/14540 "2018-09-18T15:07:25Z")

</div>

I am trying to have custom Integer-types I can use for dispatch on getindex. So far I tried the following: abstract type CustomIndex \<: Unsigned end primitive type VertexIndex \<: CustomIndex 16 end primitive type EdgeI…

---

## [Latest Makie / Julia v1.0.0, scene debugging?](https://discourse.julialang.org/t/latest-makie-julia-v1-0-0-scene-debugging/14885)

<div class="topic-metadata">

**Author:** [@jac299792458](https://discourse.julialang.org/u/jac299792458)\
**Replies:** 2\
**Last updated:** [September 18, 2018, 2:21pm UTC](https://discourse.julialang.org/t/latest-makie-julia-v1-0-0-scene-debugging/14885 "2018-09-18T14:21:34Z")

</div>

All, I’ve been able to run the Makie examples in Julia-1.0.0 on OSX without trouble. :slight\_smile: Currently, I’m attempting to visualize a DAG in 3D. I import the data into Dictionaries, and then process them into …

---

## [How to implement \`CartesianCoordinates\` using \`NamedTuple\`?](https://discourse.julialang.org/t/how-to-implement-cartesiancoordinates-using-namedtuple/15109)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 12:46pm UTC](https://discourse.julialang.org/t/how-to-implement-cartesiancoordinates-using-namedtuple/15109 "2018-09-18T12:46:51Z")

</div>

Say I have the following code axisnames = (:first, :second, :third, :fourth, :fifth, :sixth) function CartesianCoordinates(t::Vararg{T, N}) where {N, T \<: Real} NamedTuple{tuple(axisnames\[1:N\]...), NTuple{N, T}}((t…

---

## [Conversion and formatting of Dates.TimePeriod](https://discourse.julialang.org/t/conversion-and-formatting-of-dates-timeperiod/15063)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 3\
**Last updated:** [September 18, 2018, 10:29am UTC](https://discourse.julialang.org/t/conversion-and-formatting-of-dates-timeperiod/15063 "2018-09-18T10:29:45Z")

</div>

Let’s say I have a TimePeriod object x = Minute(62). What I’m looking for is basically julia\> Dates.format(x, "HH:MM") # not actually working! 01:02 However, this is currently not working. 1) Why can’t I format x sim…

---

## [Fieldnames function does not work for GLM output](https://discourse.julialang.org/t/fieldnames-function-does-not-work-for-glm-output/15105)

<div class="topic-metadata">

**Author:** [@mwsohn](https://discourse.julialang.org/u/mwsohn)\
**Replies:** 3\
**Last updated:** [September 18, 2018, 10:27am UTC](https://discourse.julialang.org/t/fieldnames-function-does-not-work-for-glm-output/15105 "2018-09-18T10:27:31Z")

</div>

To my horror, fieldnames function does not work any more for me to inspect the GLM returned object. glmout = glm(@formula(low ~ age + lwt + race),df,Binomial()) Previously fieldnames(glmout) worked find but it now gene…

---

## [SubArray x Matrix multipliciation of different eltype fails](https://discourse.julialang.org/t/subarray-x-matrix-multipliciation-of-different-eltype-fails/14950)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 7:53am UTC](https://discourse.julialang.org/t/subarray-x-matrix-multipliciation-of-different-eltype-fails/14950 "2018-09-18T07:53:56Z")

</div>

I have a subarray that I want to multiply with a matrix. They have different eltypes: julia\> A=randn(ComplexF64,3,3); julia\> Aview=view(A,1:2,1:2); julia\> C=randn(2,2); julia\> Aview\*C ERROR: MethodError: no method matc…

---

## [How to get the path to module dir?](https://discourse.julialang.org/t/how-to-get-the-path-to-module-dir/15110)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 1\
**Last updated:** [September 18, 2018, 5:50am UTC](https://discourse.julialang.org/t/how-to-get-the-path-to-module-dir/15110 "2018-09-18T05:50:20Z")

</div>

In the module I need to open a file located in the same directory, so I do fd = open("foo.txt") But when I use the module from another directory, it complains that “foo.txt” does not exist. So, how can I specify a pat…

---

## [Error building PyCall in v0.7 / Conda.jl did not install Python?](https://discourse.julialang.org/t/error-building-pycall-in-v0-7-conda-jl-did-not-install-python/15104)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 10\
**Last updated:** [September 18, 2018, 5:40am UTC](https://discourse.julialang.org/t/error-building-pycall-in-v0-7-conda-jl-did-not-install-python/15104 "2018-09-18T05:40:24Z")

</div>

Hello, I’m trying to move to Julia 0.7 on Ubuntu. I installed Conda.jl without errors but I’m having trouble with PyCall: julia\> Pkg.build("PyCall") Building Conda ─→ \`~/.julia/packages/Conda/m7vem/deps/build.log\` …

---

## [rand(1:10) vs Int(round(10\*rand())](https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339)

<div class="topic-metadata">

**Author:** [@mbeach42](https://discourse.julialang.org/u/mbeach42)\
**Replies:** 17\
**Last updated:** [September 18, 2018, 12:32am UTC](https://discourse.julialang.org/t/rand-1-10-vs-int-round-10-rand/14339 "2018-09-18T00:32:07Z")

</div>

Why should I use rand(1:N) for an integer N, instead of Int.(round.(rand()\*N?)) On my computer, it seems that Int.(round.(rand()\*N?)) is about 3 times faster than rand(1:10).

---

## [Plotting on Windows and Linux](https://discourse.julialang.org/t/plotting-on-windows-and-linux/13676)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [September 17, 2018, 11:23pm UTC](https://discourse.julialang.org/t/plotting-on-windows-and-linux/13676 "2018-09-17T23:23:40Z")

</div>

So far, PGFPlotsX appears to be the lonely package that actually produces plots for Windows and Linux on Julia 0.7.0. All the other packages either don’t install, or crash when plotting is attempted. Is it only me, or i…

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

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