# General Usage

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

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

**Page:** 948

---

## [ArgParse not working with JUNO ARGS setting](https://discourse.julialang.org/t/argparse-not-working-with-juno-args-setting/14151)

<div class="topic-metadata">

**Author:** [@Le\_Hong](https://discourse.julialang.org/u/Le_Hong)\
**Replies:** 0\
**Last updated:** [August 27, 2018, 7:01pm UTC](https://discourse.julialang.org/t/argparse-not-working-with-juno-args-setting/14151 "2018-08-27T19:01:57Z")

</div>

Hi All I’m new to Julia and JUNO IDE. Writing a script using ArgParse package. The script works ok in batch mode. However when try to run the script in JUNO it behaves oddly. Example: function parse\_commandline() …

---

## [A string interpolation inconsistency](https://discourse.julialang.org/t/a-string-interpolation-inconsistency/14042)

<div class="topic-metadata">

**Author:** [@sswatson](https://discourse.julialang.org/u/sswatson)\
**Replies:** 10\
**Last updated:** [August 27, 2018, 7:34pm UTC](https://discourse.julialang.org/t/a-string-interpolation-inconsistency/14042 "2018-08-27T19:34:48Z")

</div>

It seems that string interpolation works differently depending on whether the string consists entirely of a single interpolation: struct Foo a::String end import Base.string string(F::Foo) = F.a F = Foo("bar") "$…

---

## [Huge performance improvement by separating function?](https://discourse.julialang.org/t/huge-performance-improvement-by-separating-function/14106)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 15\
**Last updated:** [August 27, 2018, 7:33pm UTC](https://discourse.julialang.org/t/huge-performance-improvement-by-separating-function/14106 "2018-08-27T19:33:53Z")

</div>

function testThread00() a = zeros(Int, 1000) for i=1:length(a) for j = 1:1000000 a\[i\] = j+i end end println(sum(a)) end function testThreada0() a = zeros(Int, 1000) testThread\_10(a) println(sum(a)) end …

---

## [How to test type equality](https://discourse.julialang.org/t/how-to-test-type-equality/14144)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [August 27, 2018, 4:41pm UTC](https://discourse.julialang.org/t/how-to-test-type-equality/14144 "2018-08-27T16:41:48Z")

</div>

So the documentation says: Be careful with type equality You generally want to use isa and \<: for testing types, not ==. Checking types for exact equality typically only makes sense when comparing to a known concrete t…

---

## [Exceptions in macros in Julia-0.7/1.0](https://discourse.julialang.org/t/exceptions-in-macros-in-julia-0-7-1-0/14145)

<div class="topic-metadata">

**Author:** [@traktofon](https://discourse.julialang.org/u/traktofon)\
**Replies:** 1\
**Last updated:** [August 27, 2018, 4:24pm UTC](https://discourse.julialang.org/t/exceptions-in-macros-in-julia-0-7-1-0/14145 "2018-08-27T16:24:08Z")

</div>

Consider a macro that throws an exception: macro aaa(); throw(ArgumentError("invalid")); end Calling this macro in Julia 0.6 results in julia\> @aaa ERROR: ArgumentError: invalid while in 0.7/1.0 it has changed to (wi…

---

## [ANN: BoundingSphere.jl](https://discourse.julialang.org/t/ann-boundingsphere-jl/14127)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 1\
**Last updated:** [August 27, 2018, 4:05pm UTC](https://discourse.julialang.org/t/ann-boundingsphere-jl/14127 "2018-08-27T16:05:48Z")

</div>

ANN: BoundingSphere.jl BoundingSphere.jl is a package, that allows to find smallest spheres that enclose a given set of points. Basic usage is as follows: using BoundingSphere pts = \[randn(3) for \_ in 1:10\] center, rad…

---

## [for loop consumes extreme amount of memory even though operation can be considered "pure"](https://discourse.julialang.org/t/for-loop-consumes-extreme-amount-of-memory-even-though-operation-can-be-considered-pure/14133)

<div class="topic-metadata">

**Author:** [@rongcuid](https://discourse.julialang.org/u/rongcuid)\
**Replies:** 4\
**Last updated:** [August 27, 2018, 3:23pm UTC](https://discourse.julialang.org/t/for-loop-consumes-extreme-amount-of-memory-even-though-operation-can-be-considered-pure/14133 "2018-08-27T15:23:01Z")

</div>

This was originally opened as a github issue #28909, though I was directed here for the question. The behaviour is that, even though the loop itself is pure(except for printing), and that results can be safely discarded…

---

## [How do I deprecate a package?](https://discourse.julialang.org/t/how-do-i-deprecate-a-package/14129)

<div class="topic-metadata">

**Author:** [@helgee](https://discourse.julialang.org/u/helgee)\
**Replies:** 5\
**Last updated:** [August 27, 2018, 2:47pm UTC](https://discourse.julialang.org/t/how-do-i-deprecate-a-package/14129 "2018-08-27T14:47:40Z")

</div>

I have decided that it does not make sense anymore to maintain Dopri.jl. All use cases are covered (much better) by the DifferentialEquations.jl ecosystem. How do I deprecate the package? So far I have: Put a notice o…

---

## [Parallel computing; show progress](https://discourse.julialang.org/t/parallel-computing-show-progress/14033)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 6\
**Last updated:** [August 27, 2018, 2:33pm UTC](https://discourse.julialang.org/t/parallel-computing-show-progress/14033 "2018-08-27T14:33:20Z")

</div>

I have a large number of files to process using pmap() to parallel the calculation. It takes hours to finish. How can I get the percentage of the job? # ... function process\_file(file\_path) ; #process the file en…

---

## [Offset when converting excel time to unix time (two whole days)](https://discourse.julialang.org/t/offset-when-converting-excel-time-to-unix-time-two-whole-days/14119)

<div class="topic-metadata">

**Author:** [@slowbrain](https://discourse.julialang.org/u/slowbrain)\
**Replies:** 5\
**Last updated:** [August 27, 2018, 12:13pm UTC](https://discourse.julialang.org/t/offset-when-converting-excel-time-to-unix-time-two-whole-days/14119 "2018-08-27T12:13:43Z")

</div>

I have data containing excel time stamps (days since 1900-01-01T00:00:00) and trying to convert it to DateTime type. Typically one can google that proper conversion is as follows: Unix Timestamp = (Excel Timestamp - 255…

---

## [Segmentation fault when cloning a sparse matrix](https://discourse.julialang.org/t/segmentation-fault-when-cloning-a-sparse-matrix/14121)

<div class="topic-metadata">

**Author:** [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Replies:** 2\
**Last updated:** [August 27, 2018, 11:21am UTC](https://discourse.julialang.org/t/segmentation-fault-when-cloning-a-sparse-matrix/14121 "2018-08-27T11:21:57Z")

</div>

The following program: using SparseArrays function go() A = sprandn(10, 10, 0.1) v = Vector(undef, 2) for i = 1:2 v\[i\] = SparseMatrixCSC(A.m, A.n, A.colptr, A.rowval, copy(A.nzval)) end end @ti…

---

## ["forwarding" of properties](https://discourse.julialang.org/t/forwarding-of-properties/14116)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [August 27, 2018, 9:18am UTC](https://discourse.julialang.org/t/forwarding-of-properties/14116 "2018-08-27T09:18:37Z")

</div>

I am very excited about getproperty & friends in 1.0, as it would make a particular package I am working on have a much simpler API. I could not find a lot of guidance about it though at the moment, so I am learning from…

---

## [Dependency injection in Julia](https://discourse.julialang.org/t/dependency-injection-in-julia/12026)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 9\
**Last updated:** [August 27, 2018, 9:16am UTC](https://discourse.julialang.org/t/dependency-injection-in-julia/12026 "2018-08-27T09:16:18Z")

</div>

Wondering if anybody found a good way to implement dependency injection in Julia. I have many situations where I use “adapters”: take for instance a Database module which uses various adapters (MySQL, SQLite, Postgres, e…

---

## [How is the output type determined in map and friends?](https://discourse.julialang.org/t/how-is-the-output-type-determined-in-map-and-friends/14096)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 6\
**Last updated:** [August 27, 2018, 6:07am UTC](https://discourse.julialang.org/t/how-is-the-output-type-determined-in-map-and-friends/14096 "2018-08-27T06:07:37Z")

</div>

Just curious, how is the container type determined for map? It seem pretty magical to me: julia\> @code\_warntype map(x -\> x/2, rand(Int, 5)) Body::Array{Float64,1} 1995 1 ─ %1 = %new(Base.Generator{Array{Int64,1},getfie…

---

## [How to improve the performance while do matrix operation](https://discourse.julialang.org/t/how-to-improve-the-performance-while-do-matrix-operation/14083)

<div class="topic-metadata">

**Author:** [@Duigi](https://discourse.julialang.org/u/Duigi)\
**Replies:** 13\
**Last updated:** [August 27, 2018, 12:45am UTC](https://discourse.julialang.org/t/how-to-improve-the-performance-while-do-matrix-operation/14083 "2018-08-27T00:45:30Z")

</div>

I am a new Julia user. When doing matrix operations, there is some confusion about the performance of the code. Format 1 C=0 A=\[2 4 1; 4 1 4; 4 2 3\] @time for i=1:10000000 global A=A/i A=A+A' global C=C+sum…

---

## [How do you get super() functionality in Julia?](https://discourse.julialang.org/t/how-do-you-get-super-functionality-in-julia/14055)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 10\
**Last updated:** [August 26, 2018, 11:12pm UTC](https://discourse.julialang.org/t/how-do-you-get-super-functionality-in-julia/14055 "2018-08-26T23:12:46Z")

</div>

For example, let’s say you have foo(x::Any) = 1 foo(x::Int) = 2 foo(x::Number) = 3 foo(x::String) = "Nu uh uh. You didn't say the magic word" so that foo is a generic function with 4 methods Let’s say I have x = 10. …

---

## [Failing to build Julia 1.0.0 with llvm 6.0.1](https://discourse.julialang.org/t/failing-to-build-julia-1-0-0-with-llvm-6-0-1/14094)

<div class="topic-metadata">

**Author:** [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Replies:** 4\
**Last updated:** [August 26, 2018, 9:08pm UTC](https://discourse.julialang.org/t/failing-to-build-julia-1-0-0-with-llvm-6-0-1/14094 "2018-08-26T21:08:50Z")

</div>

Not sure if “Usage” is the right category for this. Mods, feel free to move if there’s a better spot. I’ve been attempting to package Julia 1.0.0 for Void Linux, but I’m running into some issues that I’m assuming are ca…

---

## [Julia fails to execute shell commands - breaks download(), package installation etc](https://discourse.julialang.org/t/julia-fails-to-execute-shell-commands-breaks-download-package-installation-etc/6734)

<div class="topic-metadata">

**Author:** [@dulatf](https://discourse.julialang.org/u/dulatf)\
**Replies:** 3\
**Last updated:** [August 26, 2018, 6:17pm UTC](https://discourse.julialang.org/t/julia-fails-to-execute-shell-commands-breaks-download-package-installation-etc/6734 "2018-08-26T18:17:07Z")

</div>

I was trying to install some packages through the Julia package manager which seemed to fail because Julia was unable to locate curl (which is installed on my system). I was able to trace the problem to the download() …

---

## [Usage of loops for defining new variables](https://discourse.julialang.org/t/usage-of-loops-for-defining-new-variables/14056)

<div class="topic-metadata">

**Author:** [@Boris](https://discourse.julialang.org/u/Boris)\
**Replies:** 6\
**Last updated:** [August 26, 2018, 1:22pm UTC](https://discourse.julialang.org/t/usage-of-loops-for-defining-new-variables/14056 "2018-08-26T13:22:25Z")

</div>

Hi! I have a rather simple question, which probably boils down to my non-familiarity with the language. I am translating a code from Matlab and was getting a constant error about one variable not defined within a loop…

---

## [Passing environmental variables to library?](https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 1\
**Last updated:** [August 26, 2018, 1:02pm UTC](https://discourse.julialang.org/t/passing-environmental-variables-to-library/14079 "2018-08-26T13:02:08Z")

</div>

I’m calling a C library FastTransforms (GitHub - MikaelSlevinsky/FastTransforms: Fast orthogonal polynomial transforms) whose threads are controlled by two environmental variables: export OMP\_NUM\_THREADS=4 export VECLIB…

---

## [How to install non-registered dependencies in Julia 0.7/1.0](https://discourse.julialang.org/t/how-to-install-non-registered-dependencies-in-julia-0-7-1-0/13971)

<div class="topic-metadata">

**Author:** [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Replies:** 37\
**Last updated:** [August 26, 2018, 11:33am UTC](https://discourse.julialang.org/t/how-to-install-non-registered-dependencies-in-julia-0-7-1-0/13971 "2018-08-26T11:33:54Z")

</div>

In Julia 0.6 it was possible to install non-registered dependencies while loading a package using this trick: if !isdir(Pkg.dir("LinearSolver")) println("Installing LinearSolver...") Pkg.clone("https://github.com/tk…

---

## [How to test if a file is existing and 'closed'?](https://discourse.julialang.org/t/how-to-test-if-a-file-is-existing-and-closed/14045)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 10\
**Last updated:** [August 26, 2018, 11:33am UTC](https://discourse.julialang.org/t/how-to-test-if-a-file-is-existing-and-closed/14045 "2018-08-26T11:33:54Z")

</div>

I need this for testing, it looks like i have the situation that the OS is buffering the write operation to a file. So in the test for isfile this is true, but the content has not been fully written.

---

## [@distributed and type instability](https://discourse.julialang.org/t/distributed-and-type-instability/14077)

<div class="topic-metadata">

**Author:** [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Replies:** 0\
**Last updated:** [August 26, 2018, 10:21am UTC](https://discourse.julialang.org/t/distributed-and-type-instability/14077 "2018-08-26T10:21:18Z")

</div>

I have recently updated some code written for Julia 0.6.2 to Julia 1.0.0 and it actually got a bit slower. (Some context: The code is for updating probabilities partly on the basis of incoming information, partly on the …

---

## [How to indent types after where](https://discourse.julialang.org/t/how-to-indent-types-after-where/6157)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [August 26, 2018, 8:41am UTC](https://discourse.julialang.org/t/how-to-indent-types-after-where/6157 "2018-08-26T08:41:07Z")

</div>

Sometimes I find it logical to break lines after where in a method definition, like this (obviously for longer names/argument lists): function Foo(lotof::T, arguments::S) where {T, S} # \<- asking about this indentat…

---

## [Instance of a composite type](https://discourse.julialang.org/t/instance-of-a-composite-type/14067)

<div class="topic-metadata">

**Author:** [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Replies:** 2\
**Last updated:** [August 26, 2018, 6:46am UTC](https://discourse.julialang.org/t/instance-of-a-composite-type/14067 "2018-08-26T06:46:52Z")

</div>

Hi! So I am trying to create an instance of a structure: struct keypoint x y scale angle Vector{Any}(VecLength) end Now I know the values of all the fields except the last one. I need to initialize…

---

## [What is the bicubic interpolation function in Julia](https://discourse.julialang.org/t/what-is-the-bicubic-interpolation-function-in-julia/14060)

<div class="topic-metadata">

**Author:** [@complexfilter](https://discourse.julialang.org/u/complexfilter)\
**Replies:** 2\
**Last updated:** [August 26, 2018, 4:37am UTC](https://discourse.julialang.org/t/what-is-the-bicubic-interpolation-function-in-julia/14060 "2018-08-26T04:37:23Z")

</div>

I wish to interpolate an image by a factor of 2, both horizontally and vertically. What is the bicubic interpolation operator in Julia that is the counterpart of interp2 in Matlab?

---

## [Parametric type deprecation when upgrading to 0.7](https://discourse.julialang.org/t/parametric-type-deprecation-when-upgrading-to-0-7/13965)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 2\
**Last updated:** [August 26, 2018, 3:43am UTC](https://discourse.julialang.org/t/parametric-type-deprecation-when-upgrading-to-0-7/13965 "2018-08-26T03:43:06Z")

</div>

While upgrading a package I got the following message: ┌ Warning: convert(::Type{T}, x::Enum{T2}) where {T \<: Integer, T2 \<: Integer} is deprecated, use T(x) instead. │ caller = setproperty! at sysimg.jl:19 \[inlined…

---

## [Multiple dispatch causes warntype in closure?](https://discourse.julialang.org/t/multiple-dispatch-causes-warntype-in-closure/14029)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 1\
**Last updated:** [August 26, 2018, 12:31am UTC](https://discourse.julialang.org/t/multiple-dispatch-causes-warntype-in-closure/14029 "2018-08-26T00:31:21Z")

</div>

Hello, using 0.7.0. I’m trying to do some refactoring by using multiple-dispatch. In the example below, generator1() has a “better design” compared to generator2(). Unfortunately, generator1() causes some warntype … is…

---

## [\`Git error\` on Ubuntu](https://discourse.julialang.org/t/git-error-on-ubuntu/14049)

<div class="topic-metadata">

**Author:** [@Noel\_Araujo](https://discourse.julialang.org/u/Noel_Araujo)\
**Replies:** 5\
**Last updated:** [August 25, 2018, 7:05pm UTC](https://discourse.julialang.org/t/git-error-on-ubuntu/14049 "2018-08-25T19:05:32Z")

</div>

I have a new machine with ubuntu 18.04. I\`ve installed julia 1.0 via Ubuntu software, and when I try to add any package I get the message ERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error…

---

## [IJulia not working on 1.0.0](https://discourse.julialang.org/t/ijulia-not-working-on-1-0-0/13394)

<div class="topic-metadata">

**Author:** [@standarddeviant](https://discourse.julialang.org/u/standarddeviant)\
**Replies:** 10\
**Last updated:** [August 25, 2018, 4:52pm UTC](https://discourse.julialang.org/t/ijulia-not-working-on-1-0-0/13394 "2018-08-25T16:52:22Z")

</div>

Continuing the discussion from Julia 1.0 released: FYI IJulia isn’t working for me on 1.0.0. I always see this: The cell appears busy ( \* to the left of the cell ), but the kernel appears idle ( empty circle to the …

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

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