# General Usage

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

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

**Page:** 1063

---

## [Segmentation fault when a try to catch a InterruptException](https://discourse.julialang.org/t/segmentation-fault-when-a-try-to-catch-a-interruptexception/2285)

<div class="topic-metadata">

**Author:** [@Alvaro\_M](https://discourse.julialang.org/u/Alvaro_M)\
**Replies:** 9\
**Last updated:** [February 24, 2017, 10:48pm UTC](https://discourse.julialang.org/t/segmentation-fault-when-a-try-to-catch-a-interruptexception/2285 "2017-02-24T22:48:08Z")

</div>

Hi, I have this code, I’m trying to catch a keyboard interrupt, but what a get it a segmentation fault try for i in 1:10 println(i) sleep(0.5) end catch err if isa(err, InterruptException) exit() …

---

## [1-based indexing not used consistently?](https://discourse.julialang.org/t/1-based-indexing-not-used-consistently/2284)

<div class="topic-metadata">

**Author:** [@ndbecker](https://discourse.julialang.org/u/ndbecker)\
**Replies:** 2\
**Last updated:** [February 24, 2017, 8:41pm UTC](https://discourse.julialang.org/t/1-based-indexing-not-used-consistently/2284 "2017-02-24T20:41:18Z")

</div>

I’m not a fan of 1-based index, but that’s not my question/comment. I just noticed the docstring for diagm(v, k::Integer=0) Isn’t this inconsistent? (why isn’t the value of k corresponding to the first diagonal k=1?)

---

## [ERROR: type UnionAll has no field name](https://discourse.julialang.org/t/error-type-unionall-has-no-field-name/2269)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 4\
**Last updated:** [February 24, 2017, 8:07pm UTC](https://discourse.julialang.org/t/error-type-unionall-has-no-field-name/2269 "2017-02-24T20:07:16Z")

</div>

The following code is taken from DiffEqBase.jl, and I am trying to update it to v0.6. However, I get the following error: julia\> type ODESolution{uType,tType,rateType,P,A,IType} u::uType t::tType …

---

## [Exact square root aretmetic](https://discourse.julialang.org/t/exact-square-root-aretmetic/2279)

<div class="topic-metadata">

**Author:** [@titzi](https://discourse.julialang.org/u/titzi)\
**Replies:** 3\
**Last updated:** [February 24, 2017, 7:15pm UTC](https://discourse.julialang.org/t/exact-square-root-aretmetic/2279 "2017-02-24T19:15:41Z")

</div>

Hi, is it possible to use square root of something that is not possible to evaluate exactly as a symbol and to not evaluate it. For example square root of 2 times square root of 2 is not 2: julia\> √2^2 == √2\*√2 false…

---

## [Equality of two \`AbstractArray\`s](https://discourse.julialang.org/t/equality-of-two-abstractarray-s/2256)

<div class="topic-metadata">

**Author:** [@gasagna](https://discourse.julialang.org/u/gasagna)\
**Replies:** 3\
**Last updated:** [February 24, 2017, 4:26pm UTC](https://discourse.julialang.org/t/equality-of-two-abstractarray-s/2256 "2017-02-24T16:26:42Z")

</div>

Hi, Quick question: for x= \[1, 2, 3\], why is that julia\> x == 1:3 false but julia\> x == collect(1:3) true ? This is on Julia Version 0.5.1-pre+33 Commit 20d401c (2017-01-29 21:00 UTC) Platform Info: System: Darw…

---

## [Finalizers not running](https://discourse.julialang.org/t/finalizers-not-running/2266)

<div class="topic-metadata">

**Author:** [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Replies:** 6\
**Last updated:** [February 24, 2017, 4:03pm UTC](https://discourse.julialang.org/t/finalizers-not-running/2266 "2017-02-24T16:03:16Z")

</div>

I’m having some trouble getting finalizers to run, it seems that in some cases finalizers are only run atexit, and not when the object seems unreachable and I’ve called gc() a couple of times. For example, the following…

---

## [Review: schur-pade matrix powers speedup?](https://discourse.julialang.org/t/review-schur-pade-matrix-powers-speedup/1650)

<div class="topic-metadata">

**Author:** [@felix](https://discourse.julialang.org/u/felix)\
**Replies:** 19\
**Last updated:** [February 24, 2017, 4:01pm UTC](https://discourse.julialang.org/t/review-schur-pade-matrix-powers-speedup/1650 "2017-02-24T16:01:21Z")

</div>

Hello, tldr can anyone compare the below algorithm to its Matlab equivalent, or suggest improvements to the \\ bottleneck? I tried to re-implement the Higham-Lin algorithm for fractional matrix powers, code here. The…

---

## [Replacement for WORD\_SIZE in v0.6](https://discourse.julialang.org/t/replacement-for-word-size-in-v0-6/2268)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 3\
**Last updated:** [February 24, 2017, 2:50pm UTC](https://discourse.julialang.org/t/replacement-for-word-size-in-v0-6/2268 "2017-02-24T14:50:03Z")

</div>

I see a section in News.md for what has changed here, but I have scripts failing since WORD\_SIZE is no longer defined. What is the replacement we should be using? Thanks.

---

## [Semantics for shared structure](https://discourse.julialang.org/t/semantics-for-shared-structure/2271)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [February 24, 2017, 2:48pm UTC](https://discourse.julialang.org/t/semantics-for-shared-structure/2271 "2017-02-24T14:48:00Z")

</div>

I have no formal background in CS, so I am not even sure I am framing this question right, but this comes up a lot in designing APIs for me. Consider a simple type immutable UsesNodes nodes somevalue functi…

---

## [Custom \`showerror\` doesn't always trigger](https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937)

<div class="topic-metadata">

**Author:** [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Replies:** 1\
**Last updated:** [February 24, 2017, 7:49am UTC](https://discourse.julialang.org/t/custom-showerror-doesnt-always-trigger/1937 "2017-02-24T07:49:48Z")

</div>

I’m having some trouble implementing a custom exception: the showerror only works in the REPL. type Bad \<: Exception end Base.showerror(io::IO, e::Bad) = print(io, "Good") throw(Bad()) Doing this in the REPL calls in…

---

## [MArray or SizedArray in StaticArrays package](https://discourse.julialang.org/t/marray-or-sizedarray-in-staticarrays-package/2160)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 5\
**Last updated:** [February 24, 2017, 1:12am UTC](https://discourse.julialang.org/t/marray-or-sizedarray-in-staticarrays-package/2160 "2017-02-24T01:12:58Z")

</div>

I am a bit confused about the distinction between a mutable array and a sized array in the StaticArrays package. My application is block diagonal matrices with all of the blocks having the same, usually small, size, k ×…

---

## [Setting members of structs in Cxx.jl](https://discourse.julialang.org/t/setting-members-of-structs-in-cxx-jl/2260)

<div class="topic-metadata">

**Author:** [@rcnlee](https://discourse.julialang.org/u/rcnlee)\
**Replies:** 2\
**Last updated:** [February 23, 2017, 11:54pm UTC](https://discourse.julialang.org/t/setting-members-of-structs-in-cxx-jl/2260 "2017-02-23T23:54:33Z")

</div>

Hello, In Cxx.jl, I can create structs and read values of members, but is there a way to set the value of a member directly, i.e., without creating a setter function? obj = @cxxnew MyStruct() #create instance xval = @…

---

## [Segmentation fault on cluster with julia 0.5.0](https://discourse.julialang.org/t/segmentation-fault-on-cluster-with-julia-0-5-0/2250)

<div class="topic-metadata">

**Author:** [@Raef13](https://discourse.julialang.org/u/Raef13)\
**Replies:** 2\
**Last updated:** [February 23, 2017, 3:50pm UTC](https://discourse.julialang.org/t/segmentation-fault-on-cluster-with-julia-0-5-0/2250 "2017-02-23T15:50:31Z")

</div>

I want to use Julia 0.5.0 on a Linux cluster. Running a very simple test script (below) directly onto the terminal is always successful: sss=repmat(\[0.0\],25); for i in 1:25 sss\[i\]=i\*2 end filename="sss.csv" writecsv(fi…

---

## [Strange error message when trying to initialise field of type SVector](https://discourse.julialang.org/t/strange-error-message-when-trying-to-initialise-field-of-type-svector/2222)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 4\
**Last updated:** [February 23, 2017, 7:58am UTC](https://discourse.julialang.org/t/strange-error-message-when-trying-to-initialise-field-of-type-svector/2222 "2017-02-23T07:58:41Z")

</div>

I was hoping someone could talk me through why this throws: using StaticArrays type Polly{N,T} data::SVector{N,T} end p = Polly{2,Float64}((1.0, 0.0)) and adds insult to injury with this curious error message: L…

---

## [What properties must a custom type have, to work with the new vectorised syntax?](https://discourse.julialang.org/t/what-properties-must-a-custom-type-have-to-work-with-the-new-vectorised-syntax/2244)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 2\
**Last updated:** [February 23, 2017, 2:53am UTC](https://discourse.julialang.org/t/what-properties-must-a-custom-type-have-to-work-with-the-new-vectorised-syntax/2244 "2017-02-23T02:53:41Z")

</div>

I was reading up on the new vectorized function syntax, and I wanted to try it out with BioSequence from the package Bio.jl and a toy example (below). BioSequences behave like a vector/array{1} of various subtypes of Nuc…

---

## [Can I use LibGit2 to create an orphan branch?](https://discourse.julialang.org/t/can-i-use-libgit2-to-create-an-orphan-branch/2242)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 0\
**Last updated:** [February 22, 2017, 9:44pm UTC](https://discourse.julialang.org/t/can-i-use-libgit2-to-create-an-orphan-branch/2242 "2017-02-22T21:44:44Z")

</div>

I’ve got LibGit2.branch! figures out and also git checkout --orphan but is there a way to create specifically an orphan branch?

---

## [Newly defined getindex() behaves differently in REPL and a function](https://discourse.julialang.org/t/newly-defined-getindex-behaves-differently-in-repl-and-a-function/2225)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 3\
**Last updated:** [February 22, 2017, 2:05pm UTC](https://discourse.julialang.org/t/newly-defined-getindex-behaves-differently-in-repl-and-a-function/2225 "2017-02-22T14:05:00Z")

</div>

I need to deal with tuples of tuples a lot. They are specifically of type NTuple{3,NTuple{2,Int}}; in other words, each inner tuple has two integers and the outer tuple has three such tuples, like t = ((3,4), (5,6), (7,…

---

## [Where to submit Github syntax highlighting error?](https://discourse.julialang.org/t/where-to-submit-github-syntax-highlighting-error/2233)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 4\
**Last updated:** [February 22, 2017, 1:48pm UTC](https://discourse.julialang.org/t/where-to-submit-github-syntax-highlighting-error/2233 "2017-02-22T13:48:03Z")

</div>

I found a problem with the Github syntax highlighting (basically ' is incorrectly parsed as the beginning of a character string, rather than as the transpose operator), but I cannot for the life of me figure out which is…

---

## [How to set juno to auto-save on run?](https://discourse.julialang.org/t/how-to-set-juno-to-auto-save-on-run/2232)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 0\
**Last updated:** [February 22, 2017, 8:47am UTC](https://discourse.julialang.org/t/how-to-set-juno-to-auto-save-on-run/2232 "2017-02-22T08:47:13Z")

</div>

Hello, would it be possible to set the (default) option to auto-save when you run the file ?

---

## [Scheduling jobs](https://discourse.julialang.org/t/scheduling-jobs/2224)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 2\
**Last updated:** [February 22, 2017, 4:11am UTC](https://discourse.julialang.org/t/scheduling-jobs/2224 "2017-02-22T04:11:57Z")

</div>

The function case in my application runs a bash script (using run) and takes as input the gpu id to run the function on. Now I have many cases with different parameters in the X vector. What I want is to schedule the jo…

---

## [Difference between output from "versioninfo()" and "versioninfo(true::Bool)](https://discourse.julialang.org/t/difference-between-output-from-versioninfo-and-versioninfo-true-bool/2201)

<div class="topic-metadata">

**Author:** [@anon51122801](https://discourse.julialang.org/u/anon51122801)\
**Replies:** 4\
**Last updated:** [February 22, 2017, 12:15am UTC](https://discourse.julialang.org/t/difference-between-output-from-versioninfo-and-versioninfo-true-bool/2201 "2017-02-22T00:15:00Z")

</div>

Using Ubuntu 16.04/AMD64 with Julia Version 0.6.0-dev.2836 via Github. I am writing a script that executes a super versioninfo and formats it for pasting to a Gist or sending via email and I just noticed a slight differ…

---

## [Interrupting external processes](https://discourse.julialang.org/t/interrupting-external-processes/2223)

<div class="topic-metadata">

**Author:** [@malmaud](https://discourse.julialang.org/u/malmaud)\
**Replies:** 2\
**Last updated:** [February 21, 2017, 8:07pm UTC](https://discourse.julialang.org/t/interrupting-external-processes/2223 "2017-02-21T20:07:27Z")

</div>

How do I send an interrupt to an external process started with open? eg \_, process = open(\`something\`)

---

## [Add new procs from Autoscaling group in aws](https://discourse.julialang.org/t/add-new-procs-from-autoscaling-group-in-aws/2221)

<div class="topic-metadata">

**Author:** [@Mikewl](https://discourse.julialang.org/u/Mikewl)\
**Replies:** 0\
**Last updated:** [February 21, 2017, 6:40pm UTC](https://discourse.julialang.org/t/add-new-procs-from-autoscaling-group-in-aws/2221 "2017-02-21T18:40:11Z")

</div>

I will need to test some variable combinations in a month or so and wanted to use aws to give me a whole bunch of cores to run multiple instances. I normally just run everything using addprocs and then sending each comb…

---

## [Function definition (unexpected functionality)](https://discourse.julialang.org/t/function-definition-unexpected-functionality/2202)

<div class="topic-metadata">

**Author:** [@vitalishe](https://discourse.julialang.org/u/vitalishe)\
**Replies:** 10\
**Last updated:** [February 21, 2017, 6:06pm UTC](https://discourse.julialang.org/t/function-definition-unexpected-functionality/2202 "2017-02-21T18:06:46Z")

</div>

Consider the following simple example. This behavior seams rather strange to me. I would have expected the output of myF(1) stay the same regardless of redefinition of ‘a’, or at the very least not be impacted by the las…

---

## [Reassigning value of an element in a tuple](https://discourse.julialang.org/t/reassigning-value-of-an-element-in-a-tuple/2205)

<div class="topic-metadata">

**Author:** [@Nikhil\_Anand](https://discourse.julialang.org/u/Nikhil_Anand)\
**Replies:** 4\
**Last updated:** [February 21, 2017, 4:34pm UTC](https://discourse.julialang.org/t/reassigning-value-of-an-element-in-a-tuple/2205 "2017-02-21T16:34:16Z")

</div>

Hi, I am facing an issue with using tuples in Julia. Here’s what I am doing temp = \[1 2 3\] A = tuple(temp, temp) B = tuple(A,A,A) B returns this : (( \[1 2 3\], \[1 2 3\]),( \[1 2 3\], \[1 2 3\]),( \[1 2 3\], \[1 2 3\])) …

---

## [Is order well-defined for multiple iterations over \`Dict\`?](https://discourse.julialang.org/t/is-order-well-defined-for-multiple-iterations-over-dict/2180)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [February 21, 2017, 9:00am UTC](https://discourse.julialang.org/t/is-order-well-defined-for-multiple-iterations-over-dict/2180 "2017-02-21T09:00:26Z")

</div>

If I iterate over (key,value) pairs in Dict, or keys(dict), or values(dict), using multiple iterations, but not modifying the dict between iterations, is it guaranteed that I get the objects in the same order? (which is …

---

## [Use of global variables](https://discourse.julialang.org/t/use-of-global-variables/2194)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 6\
**Last updated:** [February 21, 2017, 8:36am UTC](https://discourse.julialang.org/t/use-of-global-variables/2194 "2017-02-21T08:36:54Z")

</div>

Hi, I’m writing a Monte Carlo code in Julia that involves several functions that, in the end, have to deal with some variables that are transversal tomall the parts of the code, such as the density, temperature etc. My …

---

## [Using CartesianRange, flattening before collect](https://discourse.julialang.org/t/using-cartesianrange-flattening-before-collect/2150)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [February 19, 2017, 8:13pm UTC](https://discourse.julialang.org/t/using-cartesianrange-flattening-before-collect/2150 "2017-02-19T20:13:04Z")

</div>

I need to iterate through all possible indices of an array for a unit test, without constructing the array, ie just from the indices. Is constructing a CartesianRange, then iterating through it and extracting the I slo…

---

## [Way to view package's download/clone/add count](https://discourse.julialang.org/t/way-to-view-packages-download-clone-add-count/1014)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [February 19, 2017, 4:17pm UTC](https://discourse.julialang.org/t/way-to-view-packages-download-clone-add-count/1014 "2017-02-19T16:17:10Z")

</div>

Because Pkg.add doesn’t hit github, you can’t really collect some important data from the github api. Is there a way to do something like Pkg.stats("Gadfly") to get information about download counts, etc. // for refere…

---

## [Parametric types: complex use of multiple parameters](https://discourse.julialang.org/t/parametric-types-complex-use-of-multiple-parameters/2152)

<div class="topic-metadata">

**Author:** [@mobius-eng](https://discourse.julialang.org/u/mobius-eng)\
**Replies:** 6\
**Last updated:** [February 18, 2017, 6:00pm UTC](https://discourse.julialang.org/t/parametric-types-complex-use-of-multiple-parameters/2152 "2017-02-18T18:00:14Z")

</div>

I have a bit of contrived example of where I have parametric type on parametric type. I have the following types expressing unbound and bound distributions: abstract Distribution{T} abstract UnboundDistribution{T} \<: D…

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

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