# General Usage

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

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

**Page:** 1058

---

## [ERROR: LoadError: MethodError: no method matching ./(::#sigma2#1, ::Array{Float64,2})](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-sigma2-1-array-float64-2/2839)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 11\
**Last updated:** [March 25, 2017, 5:03pm UTC](https://discourse.julialang.org/t/error-loaderror-methoderror-no-method-matching-sigma2-1-array-float64-2/2839 "2017-03-25T17:03:38Z")

</div>

What is wrong with the following code? for i=1:length(m) # loop over the various cluster sizes for k=1:N-2\*m\[i\] # implements the summation in the Allan Variance equation (eqn. 8 in ref 1. sigma2(i,:) = sigma2(i,:…

---

## [How to compare two types of Julia for unit testing?](https://discourse.julialang.org/t/how-to-compare-two-types-of-julia-for-unit-testing/2853)

<div class="topic-metadata">

**Author:** [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)\
**Replies:** 6\
**Last updated:** [March 25, 2017, 8:04am UTC](https://discourse.julialang.org/t/how-to-compare-two-types-of-julia-for-unit-testing/2853 "2017-03-25T08:04:47Z")

</div>

e.g. I have my type type Foo version::String id::String samplingRate::Int timeBuilt::String equations::Vector{Equation} exam::Vector{Exam} end

---

## [Problem with string interpolation (needs parens)](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [March 24, 2017, 4:37pm UTC](https://discourse.julialang.org/t/problem-with-string-interpolation-needs-parens/2841 "2017-03-24T16:37:43Z")

</div>

What wrong below ? julia\> eval(parse("$i = readcsv(\\"dane\_waluty/chfxau\_d.csv.txt\\")")) 7023×5 Array{Any,2}: "Date" "Open" "High" "Low" "Close" "1984-01-09" 12.15 12.15 12.15 12.15 "19…

---

## [ANN: Cards.jl](https://discourse.julialang.org/t/ann-cards-jl/2523)

<div class="topic-metadata">

**Author:** [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Replies:** 16\
**Last updated:** [March 24, 2017, 10:09am UTC](https://discourse.julialang.org/t/ann-cards-jl/2523 "2017-03-24T10:09:51Z")

</div>

The topic of special types for cards inspired me, so I created a Cards package: https://github.com/StefanKarpinski/Cards.jl/blob/master/src/Cards.jl This code uses 2 bits to represent suits, 6 bits to represent each ca…

---

## [Importing constant definition from a module file](https://discourse.julialang.org/t/importing-constant-definition-from-a-module-file/2850)

<div class="topic-metadata">

**Author:** [@Snir\_Gazit](https://discourse.julialang.org/u/Snir_Gazit)\
**Replies:** 1\
**Last updated:** [March 24, 2017, 3:29am UTC](https://discourse.julialang.org/t/importing-constant-definition-from-a-module-file/2850 "2017-03-24T03:29:45Z")

</div>

I would like to create a module file “defs.jl” that contains definitions of several constants such a grid size, dimensionality etc. To do so I have created the following module file: defs.jl module defs export D const…

---

## [Common pattern for long list of configuration arguments](https://discourse.julialang.org/t/common-pattern-for-long-list-of-configuration-arguments/2570)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 5\
**Last updated:** [March 10, 2017, 1:27pm UTC](https://discourse.julialang.org/t/common-pattern-for-long-list-of-configuration-arguments/2570 "2017-03-10T13:27:34Z")

</div>

I have multiple functions with a long list of configuration arguments. Calling those functions makes a lot clutter visually: filteredValue = function1(someValue, cfg1, cfg2, cfg3) finalValue = function2(filteredValue, …

---

## [Type Instability between 0.5 and 0.6 - Type Definition](https://discourse.julialang.org/t/type-instability-between-0-5-and-0-6-type-definition/2837)

<div class="topic-metadata">

**Author:** [@pazzo83](https://discourse.julialang.org/u/pazzo83)\
**Replies:** 6\
**Last updated:** [March 23, 2017, 7:48pm UTC](https://discourse.julialang.org/t/type-instability-between-0-5-and-0-6-type-definition/2837 "2017-03-23T19:48:28Z")

</div>

Hi all, I have begun to migrate my package from 0.5 to 0.6, and I’ve noticed something interesting regarding type instability between the two. Best to show with code: 0.5 abstract ABC type A \<: ABC a::Float64 end …

---

## [How to prepare data for using in Images](https://discourse.julialang.org/t/how-to-prepare-data-for-using-in-images/2830)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 4\
**Last updated:** [March 23, 2017, 5:26pm UTC](https://discourse.julialang.org/t/how-to-prepare-data-for-using-in-images/2830 "2017-03-23T17:26:41Z")

</div>

With GMT.jl we can read or produce high quality images (like the one here) but the output is a MxNx2 uint8 array. And I would like to display them with Images.jl but can’t find a way to reformat the data. I did try thin…

---

## [Drawing graph in repl ubuntu](https://discourse.julialang.org/t/drawing-graph-in-repl-ubuntu/2833)

<div class="topic-metadata">

**Author:** [@usefulhyun](https://discourse.julialang.org/u/usefulhyun)\
**Replies:** 2\
**Last updated:** [March 23, 2017, 2:50pm UTC](https://discourse.julialang.org/t/drawing-graph-in-repl-ubuntu/2833 "2017-03-23T14:50:35Z")

</div>

Hello. I’d like to draw graph of LightGraphs in REPL mode. However, I found only text message when I run drawgraph or gplot. Is there any method draw a graph using command mode in ubuntu1404?

---

## [Julia in streaming - best practises?](https://discourse.julialang.org/t/julia-in-streaming-best-practises/2813)

<div class="topic-metadata">

**Author:** [@Oliwia\_Wojtkowska](https://discourse.julialang.org/u/Oliwia_Wojtkowska)\
**Replies:** 3\
**Last updated:** [March 23, 2017, 8:18am UTC](https://discourse.julialang.org/t/julia-in-streaming-best-practises/2813 "2017-03-23T08:18:30Z")

</div>

Hi everyone ! My team is thinking about using Julia in streaming on production - we are curious what do you think about it - are there any best practises or examples of other companies using it in streaming? We want to p…

---

## [0.6: how do you broadcast \`call\` over a vector of functions?](https://discourse.julialang.org/t/0-6-how-do-you-broadcast-call-over-a-vector-of-functions/2772)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 26\
**Last updated:** [March 23, 2017, 5:07am UTC](https://discourse.julialang.org/t/0-6-how-do-you-broadcast-call-over-a-vector-of-functions/2772 "2017-03-23T05:07:41Z")

</div>

I’m trying to broadcast a function call over a vector of functions, but call.(f,0.1) is deprecated. I tried f.(0.1) but it doesn’t work: julia\> f=\[x-\>x,x-\>x^2\] 2-element Array{Function,1}: #5 #6 julia\> f.(0.1) ERRO…

---

## [Preferred syntax for parametric type aliases in 0.6](https://discourse.julialang.org/t/preferred-syntax-for-parametric-type-aliases-in-0-6/2832)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 1\
**Last updated:** [March 23, 2017, 4:04am UTC](https://discourse.julialang.org/t/preferred-syntax-for-parametric-type-aliases-in-0-6/2832 "2017-03-23T04:04:42Z")

</div>

When using type aliases to fix some type parameters, is there a difference between: const MyVec1{T} = Array{T, 1} const MyVec2{T} = Array{T, 1} where T const MyVec3 = Array{T, 1} where T Or if they’re functionally equi…

---

## [Revealing the definition of an anonymous function](https://discourse.julialang.org/t/revealing-the-definition-of-an-anonymous-function/2831)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 2\
**Last updated:** [March 23, 2017, 3:14am UTC](https://discourse.julialang.org/t/revealing-the-definition-of-an-anonymous-function/2831 "2017-03-23T03:14:12Z")

</div>

When an anonymous function is assigned to a variable, I wonder if there is a way to retrieve the definition of the anonymous function from the variable. Consider the following scenario. Let’s say I have an array of ano…

---

## [Converting between type and immutable with the same layout](https://discourse.julialang.org/t/converting-between-type-and-immutable-with-the-same-layout/2784)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 5\
**Last updated:** [March 22, 2017, 10:22pm UTC](https://discourse.julialang.org/t/converting-between-type-and-immutable-with-the-same-layout/2784 "2017-03-22T22:22:24Z")

</div>

I want to convert a mutable type to an immutable type with the same layout, with the immutable type not having a constructor. Is the code below a safe way to do so? type MutableFoo ptr::Ptr{Void} end immutable Immuta…

---

## [Can't run local command on Windows](https://discourse.julialang.org/t/cant-run-local-command-on-windows/2731)

<div class="topic-metadata">

**Author:** [@pfack](https://discourse.julialang.org/u/pfack)\
**Replies:** 8\
**Last updated:** [March 22, 2017, 9:18pm UTC](https://discourse.julialang.org/t/cant-run-local-command-on-windows/2731 "2017-03-22T21:18:37Z")

</div>

Something in the PATH works (e.g.): run(\`git submodule update --init --recursive $smName\`) where smName is a string defined previously. But, when I want to run a script in a directory, something like run(\`./bootstrap…

---

## [Is juliabox.com failing on 0.6 kernel for anyone else?](https://discourse.julialang.org/t/is-juliabox-com-failing-on-0-6-kernel-for-anyone-else/2664)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 4\
**Last updated:** [March 22, 2017, 5:23pm UTC](https://discourse.julialang.org/t/is-juliabox-com-failing-on-0-6-kernel-for-anyone-else/2664 "2017-03-22T17:23:10Z")

</div>

I’m trying to start a 0.6-dev kernel on juliabox and the kernel keeps dying on the first statement (5 + 7). It never recovers. Is this a known issue?

---

## [Linear JUMP model violates constraint](https://discourse.julialang.org/t/linear-jump-model-violates-constraint/2749)

<div class="topic-metadata">

**Author:** [@ozgutr](https://discourse.julialang.org/u/ozgutr)\
**Replies:** 4\
**Last updated:** [March 19, 2017, 1:23am UTC](https://discourse.julialang.org/t/linear-jump-model-violates-constraint/2749 "2017-03-19T01:23:26Z")

</div>

Hi, I have JuMP model which violates following set of constraints(from .lp output) Line 35: c32: 1 Weeks\_1\_1\_3\_2\_1 - 0.03898471331421523 ThputM\_1\_1\_3\_2\_1 = 0 Line 107: c104: 1 Weeks\_1\_1\_3\_2\_1 \<= 28.3 Line 179: c176:…

---

## [Singleton types vs. instances as type parameters](https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 10\
**Last updated:** [March 22, 2017, 7:20am UTC](https://discourse.julialang.org/t/singleton-types-vs-instances-as-type-parameters/2802 "2017-03-22T07:20:21Z")

</div>

Let’s say I want to create a family of singleton types, and additional types that might use them as type parameters. The particular example I’m thinking of is a named Variable type, and a type to hold powers of that vari…

---

## [Array of type Any vs Union](https://discourse.julialang.org/t/array-of-type-any-vs-union/2788)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 5\
**Last updated:** [March 22, 2017, 5:38am UTC](https://discourse.julialang.org/t/array-of-type-any-vs-union/2788 "2017-03-22T05:38:59Z")

</div>

julia\> \[ "s", 1\] 2-element Array{Any,1}: "s" 1 julia\> \[ "s", 1\] :: Array{Union{String, Int},1} ERROR: TypeError: typeassert: expected Array{Union{Int64,String},1}, got Array{Any,1} Im thinking at this point that …

---

## [Scope of submodules](https://discourse.julialang.org/t/scope-of-submodules/2806)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 2\
**Last updated:** [March 22, 2017, 4:17am UTC](https://discourse.julialang.org/t/scope-of-submodules/2806 "2017-03-22T04:17:55Z")

</div>

Say I have a module A, in which I define a constant. I would like to be able to use that constant in submodules of that module: module A a = 2 module B f(x) = x\*a end module C g(x) = x\*a end end This does not work: A.…

---

## [Distributed/out-of-memory/GPU calculations on sparse matrices](https://discourse.julialang.org/t/distributed-out-of-memory-gpu-calculations-on-sparse-matrices/2792)

<div class="topic-metadata">

**Author:** [@Axel\_Gagge](https://discourse.julialang.org/u/Axel_Gagge)\
**Replies:** 2\
**Last updated:** [March 22, 2017, 2:58am UTC](https://discourse.julialang.org/t/distributed-out-of-memory-gpu-calculations-on-sparse-matrices/2792 "2017-03-22T02:58:50Z")

</div>

Hello, I am a junior PhD student in theoretical physics. I am working on a DMRG (Density matrix renormalization group - Wikipedia) algorithm in Julia. A key part of the algorithm is singular value decomposition (SVD) an…

---

## [Juno, modules and keyword \`end\`](https://discourse.julialang.org/t/juno-modules-and-keyword-end/2797)

<div class="topic-metadata">

**Author:** [@j2b2](https://discourse.julialang.org/u/j2b2)\
**Replies:** 2\
**Last updated:** [March 21, 2017, 6:51pm UTC](https://discourse.julialang.org/t/juno-modules-and-keyword-end/2797 "2017-03-21T18:51:40Z")

</div>

I much appreciate workflow made available by Juno while developing a module (see atom-julia-client/workflow.md at master · JunoLab/atom-julia-client · GitHub). But I encountered this silly situation: module abc function…

---

## [@generated function type inference failure](https://discourse.julialang.org/t/generated-function-type-inference-failure/2796)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 3\
**Last updated:** [March 21, 2017, 5:20pm UTC](https://discourse.julialang.org/t/generated-function-type-inference-failure/2796 "2017-03-21T17:20:46Z")

</div>

I noticed that type inference on the following fairly simple code fails, but works if you just remove the @generated. I’m wondering if this is a known issue? It appears present both on 0.5 and master. If its a bug, does …

---

## [How can I help Julia better allocate memory on sparse matrix operations?](https://discourse.julialang.org/t/how-can-i-help-julia-better-allocate-memory-on-sparse-matrix-operations/2770)

<div class="topic-metadata">

**Author:** [@mcovalt](https://discourse.julialang.org/u/mcovalt)\
**Replies:** 4\
**Last updated:** [March 20, 2017, 8:54pm UTC](https://discourse.julialang.org/t/how-can-i-help-julia-better-allocate-memory-on-sparse-matrix-operations/2770 "2017-03-20T20:54:26Z")

</div>

I have a function in a for loop along the lines of this: function spmat\_ops!(B, C, D, E, F, G, b, x) # Upper case vars are SparseMatrixCSC and lower case are Vectors A = B\*C + D\*E\*F + G x = somefastsolver(A,…

---

## [Howmebrew update to v"0.5.4" gives error on both 0.5 and 0.6](https://discourse.julialang.org/t/howmebrew-update-to-v-0-5-4-gives-error-on-both-0-5-and-0-6/2775)

<div class="topic-metadata">

**Author:** [@goedman](https://discourse.julialang.org/u/goedman)\
**Replies:** 4\
**Last updated:** [March 20, 2017, 4:45pm UTC](https://discourse.julialang.org/t/howmebrew-update-to-v-0-5-4-gives-error-on-both-0-5-and-0-6/2775 "2017-03-20T16:45:24Z")

</div>

Hi, Since this morning I’m getting below error. Both on Julia 0.5 and 0.6 (nightly). In both cases after a Homebrew update: INFO: Upgrading Homebrew: v0.5.1 =\> v0.5.4 Any suggestion what I should try? I’m on OS X 10.…

---

## [Best way to separate method to multiple lines](https://discourse.julialang.org/t/best-way-to-separate-method-to-multiple-lines/2765)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 4\
**Last updated:** [March 20, 2017, 8:03am UTC](https://discourse.julialang.org/t/best-way-to-separate-method-to-multiple-lines/2765 "2017-03-20T08:03:32Z")

</div>

How do you keep method lines from going over 80 characters?

---

## [Broadcasting like a Matrix](https://discourse.julialang.org/t/broadcasting-like-a-matrix/2767)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 1\
**Last updated:** [March 20, 2017, 2:09am UTC](https://discourse.julialang.org/t/broadcasting-like-a-matrix/2767 "2017-03-20T02:09:37Z")

</div>

I have a custom type that behaves like an AbstractMatrix but cannot be \<: AbstractMatrix. Is it possible in 0.6 to have it broadcast like a matrix? Right now I get an error: julia\> immutable MyMatrix end julia\> Base.…

---

## [\`ccall\` and Type Parameters in 0.6](https://discourse.julialang.org/t/ccall-and-type-parameters-in-0-6/2766)

<div class="topic-metadata">

**Author:** [@fcard](https://discourse.julialang.org/u/fcard)\
**Replies:** 2\
**Last updated:** [March 20, 2017, 1:11am UTC](https://discourse.julialang.org/t/ccall-and-type-parameters-in-0-6/2766 "2017-03-20T01:11:01Z")

</div>

This worked before (0.5): julia\> f{T}(::Type{T}) = ccall(:strlen, T, (Ptr{UInt8},), "abc") f (generic function with 1 method) julia\> f(Int) 3 julia\> f(UInt) 0x0000000000000003 But now: julia\> f{T}(::Type{T}) = ccall…

---

## [Best practice for functions which print debugging info?](https://discourse.julialang.org/t/best-practice-for-functions-which-print-debugging-info/1522)

<div class="topic-metadata">

**Author:** [@jarvist](https://discourse.julialang.org/u/jarvist)\
**Replies:** 13\
**Last updated:** [March 19, 2017, 6:19pm UTC](https://discourse.julialang.org/t/best-practice-for-functions-which-print-debugging-info/1522 "2017-03-19T18:19:34Z")

</div>

I write physics simulations in Julia. Quite often when building the functions that run these, I effectively ‘debug with printf’. These introspections are useful to keep around after the initial effort to get the code wo…

---

## [Promote\_type of nested tuple elements](https://discourse.julialang.org/t/promote-type-of-nested-tuple-elements/2761)

<div class="topic-metadata">

**Author:** [@gasagna](https://discourse.julialang.org/u/gasagna)\
**Replies:** 3\
**Last updated:** [March 19, 2017, 3:45pm UTC](https://discourse.julialang.org/t/promote-type-of-nested-tuple-elements/2761 "2017-03-19T15:45:14Z")

</div>

I have nested tuples like tup = Tuple{Tuple{Int64,Int8},Tuple{Int128,Int32}} and I need to find the largest eltype of the elements, i.e. Int128 in the above case. I feel I need to use promote\_type in a recursive fashio…

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

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