# General Usage

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

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

**Page:** 1045

---

## [Bizarre Possible "Piracy Bug" Stalls Julia](https://discourse.julialang.org/t/bizarre-possible-piracy-bug-stalls-julia/4103)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 1\
**Last updated:** [June 11, 2017, 10:49pm UTC](https://discourse.julialang.org/t/bizarre-possible-piracy-bug-stalls-julia/4103 "2017-06-11T22:49:01Z")

</div>

I have been tracking down this bizarre bug all night. I think it could be a Julia bug, but I am not certain. The funny thing is I know the solution: use the latest master for StaticArrays (which will be tagged soon). How…

---

## [Shifted ldlfact and cholfact](https://discourse.julialang.org/t/shifted-ldlfact-and-cholfact/4206)

<div class="topic-metadata">

**Author:** [@lostella](https://discourse.julialang.org/u/lostella)\
**Replies:** 7\
**Last updated:** [June 11, 2017, 5:36pm UTC](https://discourse.julialang.org/t/shifted-ldlfact-and-cholfact/4206 "2017-06-11T17:36:51Z")

</div>

Hi all, The calls to ldlfact and cholfact, in the case of SparseMatrixCSC arguments, call the appropriate functions in SuiteSparse and return CHOLMOD.Factor objects. These calls also support a named argument shift, whic…

---

## [Way to cache output from immutable input?](https://discourse.julialang.org/t/way-to-cache-output-from-immutable-input/4204)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 2\
**Last updated:** [June 11, 2017, 3:45am UTC](https://discourse.julialang.org/t/way-to-cache-output-from-immutable-input/4204 "2017-06-11T03:45:05Z")

</div>

Lets say you have code like: function foo(x::Float64, scaling::Number=2) x \* scaling end foo(4.0, 1) # unique call foo(4.0, 1) # repeat call foo(4.0, 1) # repeat call foo(4.0, 1) # repeat call foo(4.0) …

---

## [Possible bug: return inside an array comprehension](https://discourse.julialang.org/t/possible-bug-return-inside-an-array-comprehension/4193)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 10\
**Last updated:** [June 10, 2017, 11:28pm UTC](https://discourse.julialang.org/t/possible-bug-return-inside-an-array-comprehension/4193 "2017-06-10T23:28:45Z")

</div>

I wonder if the behaviour below is the intended behaviour for return inside an array comprehension. It seems to me that f1 and f2 should behave in the same way, terminating the function as soon as return is reached once.…

---

## [Understanding finalizers](https://discourse.julialang.org/t/understanding-finalizers/4201)

<div class="topic-metadata">

**Author:** [@LewisHein](https://discourse.julialang.org/u/LewisHein)\
**Replies:** 0\
**Last updated:** [June 10, 2017, 8:22pm UTC](https://discourse.julialang.org/t/understanding-finalizers/4201 "2017-06-10T20:22:53Z")

</div>

Hi all, I am trying to understand how Julia decides when to call finalizers. I am using MathGL.jl for some plotting, and Julia doesn’t run the required finalizers for MGLGraphs until the end of the script, which makes i…

---

## [Plots crashes](https://discourse.julialang.org/t/plots-crashes/4189)

<div class="topic-metadata">

**Author:** [@ptoche](https://discourse.julialang.org/u/ptoche)\
**Replies:** 17\
**Last updated:** [June 10, 2017, 6:46pm UTC](https://discourse.julialang.org/t/plots-crashes/4189 "2017-06-10T18:46:58Z")

</div>

I’m having all kinds of problems with Plots and PyPlot. At this time, the following happens: Pkg.rm("Plots") Pkg.add("Plots") Pkg.update() restart workspace() using Plots plot() Julia has stopped: null, SIGSEGV PyPl…

---

## [How to create module and call it from another file?](https://discourse.julialang.org/t/how-to-create-module-and-call-it-from-another-file/4186)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 2\
**Last updated:** [June 10, 2017, 1:42pm UTC](https://discourse.julialang.org/t/how-to-create-module-and-call-it-from-another-file/4186 "2017-06-10T13:42:41Z")

</div>

Hi, I want to write a module and want to call some of its members such as type,function etc from another file by using the following command: using ModuleName Problem is to specify path of the module to julia. How to …

---

## [Adding remote workers on windows](https://discourse.julialang.org/t/adding-remote-workers-on-windows/1226)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 11\
**Last updated:** [June 9, 2017, 11:21pm UTC](https://discourse.julialang.org/t/adding-remote-workers-on-windows/1226 "2017-06-09T23:21:53Z")

</div>

On Julia v0.4 I was able to add remote workers on a Windows network using ssh (Bitvise). I customised the startup command to connect using the specific ssh. However, it no longer works on Julia v0.5. I do not expect a…

---

## [Cannot use size(::Array{Int, 2}): ERROR: LoadError: UndefRefError: access to undefined reference](https://discourse.julialang.org/t/cannot-use-size-array-int-2-error-loaderror-undefreferror-access-to-undefined-reference/4138)

<div class="topic-metadata">

**Author:** [@fufjvnvnf](https://discourse.julialang.org/u/fufjvnvnf)\
**Replies:** 33\
**Last updated:** [June 9, 2017, 10:34pm UTC](https://discourse.julialang.org/t/cannot-use-size-array-int-2-error-loaderror-undefreferror-access-to-undefined-reference/4138 "2017-06-09T22:34:16Z")

</div>

I keep getting undefreferror whenever I call function size. Here is my code. The error is at the first if in function forward. Full error message is: ERROR: LoadError: UndefRefError: access to undefined reference in #f…

---

## [What does \`foo\` in the Parallel Computing docs refer to?](https://discourse.julialang.org/t/what-does-foo-in-the-parallel-computing-docs-refer-to/4182)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 8\
**Last updated:** [June 9, 2017, 10:18pm UTC](https://discourse.julialang.org/t/what-does-foo-in-the-parallel-computing-docs-refer-to/4182 "2017-06-09T22:18:59Z")

</div>

On this page: https://docs.julialang.org/en/latest/manual/parallel-computing.html#Global-variables-1 we have the following code snippet: A = rand(10,10) remotecall\_fetch(()-\>foo(A), 2) This function foo is repeated se…

---

## [Behavior of floor(), ceiling(), etc](https://discourse.julialang.org/t/behavior-of-floor-ceiling-etc/4179)

<div class="topic-metadata">

**Author:** [@ko56](https://discourse.julialang.org/u/ko56)\
**Replies:** 10\
**Last updated:** [June 9, 2017, 8:57pm UTC](https://discourse.julialang.org/t/behavior-of-floor-ceiling-etc/4179 "2017-06-09T20:57:23Z")

</div>

Is there a reason for the unusual behavior of floor(x), ceiling(x), etc., when x is a float type? I mean the fact that they return another float, not an integer. Unless you explicitly specify Int as the result type. I…

---

## [Dummy Encoding(One hot encoding) from PooledDataArray](https://discourse.julialang.org/t/dummy-encoding-one-hot-encoding-from-pooleddataarray/4167)

<div class="topic-metadata">

**Author:** [@Saran\_S](https://discourse.julialang.org/u/Saran_S)\
**Replies:** 10\
**Last updated:** [June 9, 2017, 5:10pm UTC](https://discourse.julialang.org/t/dummy-encoding-one-hot-encoding-from-pooleddataarray/4167 "2017-06-09T17:10:13Z")

</div>

I would like to know how to convert Pooled Data array into 0/1 columns similar to Sklearn OneHotEncoder in python. Following is the data frame which i am working with in which Country and Purchased are pooled data array. …

---

## [How to define a function on all worker processes?](https://discourse.julialang.org/t/how-to-define-a-function-on-all-worker-processes/4117)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 11\
**Last updated:** [June 9, 2017, 4:21pm UTC](https://discourse.julialang.org/t/how-to-define-a-function-on-all-worker-processes/4117 "2017-06-09T16:21:56Z")

</div>

I’m trying to run the following code on Julia 0.4.5 via Jupyter (so I can’t load files): function foo() return rand() end np = nprocs() ap = 0 if np \< CPU\_CORES ap = addprocs(CPU\_CORES - np) end @everywhere ba…

---

## [How am I supposed to use pmap?](https://discourse.julialang.org/t/how-am-i-supposed-to-use-pmap/3943)

<div class="topic-metadata">

**Author:** [@aaowens](https://discourse.julialang.org/u/aaowens)\
**Replies:** 14\
**Last updated:** [June 9, 2017, 3:03pm UTC](https://discourse.julialang.org/t/how-am-i-supposed-to-use-pmap/3943 "2017-06-09T15:03:19Z")

</div>

I have a large project where one function includes a pmap call, and I’m not sure the right way to get the code in scope on all the workers. @everywhere include("code.jl") where code.jl uses all the packages and includ…

---

## [Linearindexing, LinearFast and LinearSlow](https://discourse.julialang.org/t/linearindexing-linearfast-and-linearslow/4172)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 2\
**Last updated:** [June 9, 2017, 12:24pm UTC](https://discourse.julialang.org/t/linearindexing-linearfast-and-linearslow/4172 "2017-06-09T12:24:30Z")

</div>

I have been trying to figure out when exactly is it clearly stupid not to define linearindexing(::Type{T}) = Base.LinearFast() for some (1D) indexable type T? So could someone please explain when to use Base.LinearFast a…

---

## [TwicePrecision vs DoubleDouble](https://discourse.julialang.org/t/twiceprecision-vs-doubledouble/4149)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 6\
**Last updated:** [June 9, 2017, 6:06am UTC](https://discourse.julialang.org/t/twiceprecision-vs-doubledouble/4149 "2017-06-09T06:06:51Z")

</div>

I’ve seen Base.TwicePrecision in Julia v0.6 How does this compare to package DoubleDouble?

---

## [Efficient file hashing](https://discourse.julialang.org/t/efficient-file-hashing/2859)

<div class="topic-metadata">

**Author:** [@cjb](https://discourse.julialang.org/u/cjb)\
**Replies:** 9\
**Last updated:** [June 8, 2017, 6:31pm UTC](https://discourse.julialang.org/t/efficient-file-hashing/2859 "2017-06-08T18:31:10Z")

</div>

Hi all, I am wondering what is a fast way to compute the hash of a file in Julia. I know it’s possible to do hash(readstring(fileName)) but that would load the whole file in Julia, while it would be possible to process…

---

## [Precise use of FFTW](https://discourse.julialang.org/t/precise-use-of-fftw/3931)

<div class="topic-metadata">

**Author:** [@MikaelSlevinsky](https://discourse.julialang.org/u/MikaelSlevinsky)\
**Replies:** 1\
**Last updated:** [June 8, 2017, 5:01pm UTC](https://discourse.julialang.org/t/precise-use-of-fftw/3931 "2017-06-08T17:01:11Z")

</div>

How can I call FFTW to map rows of an m x (2n+1) matrix whose column basis is: { 1, sinθ, cosθ, sin2θ, cos2θ,…, sin nθ, cos nθ } to values of the sum (over the matrix entries in the row times the column basis) at equis…

---

## [Evaluate and capture expression result into function/closure body](https://discourse.julialang.org/t/evaluate-and-capture-expression-result-into-function-closure-body/4150)

<div class="topic-metadata">

**Author:** [@cdsousa](https://discourse.julialang.org/u/cdsousa)\
**Replies:** 6\
**Last updated:** [June 8, 2017, 12:48pm UTC](https://discourse.julialang.org/t/evaluate-and-capture-expression-result-into-function-closure-body/4150 "2017-06-08T12:48:25Z")

</div>

Hi all, I suddenly had a “metaphysical” doubt when learning about the @static macro. I imagined that such macro could be used to completly evaluate a given expression and replace it by its result at compile time. It ca…

---

## [How do I create vectors from matrix columns?](https://discourse.julialang.org/t/how-do-i-create-vectors-from-matrix-columns/4139)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 13\
**Last updated:** [June 7, 2017, 10:57pm UTC](https://discourse.julialang.org/t/how-do-i-create-vectors-from-matrix-columns/4139 "2017-06-07T22:57:47Z")

</div>

What is the most simple syntax for extracting a matrix columns into separate vectors? My matrix is in a text file (with the name data.dat) with 19 columns and 30000 rows , where each row ends with a line feed \\n In pri…

---

## [How to match at least one type in vararg list for method?](https://discourse.julialang.org/t/how-to-match-at-least-one-type-in-vararg-list-for-method/4087)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 3\
**Last updated:** [June 7, 2017, 9:41pm UTC](https://discourse.julialang.org/t/how-to-match-at-least-one-type-in-vararg-list-for-method/4087 "2017-06-07T21:41:56Z")

</div>

Let’s say for example, you have: Base.min(ex::Sym, exs...) = reduce((x,y)-\>sympy\_meth(:Min, x, y), ex, exs) This will not catch anything where the Sym comes in the exs array. For example, Base.min(Sym(x), 123) …

---

## [Libfortran not found](https://discourse.julialang.org/t/libfortran-not-found/4142)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 2\
**Last updated:** [June 7, 2017, 5:21pm UTC](https://discourse.julialang.org/t/libfortran-not-found/4142 "2017-06-07T17:21:52Z")

</div>

Compiling master on a Mac, I get the following error. I guess this is to do with the Fortran version that is installed. LoadError("sysimg.jl", 406, LoadError("sparse/sparse.jl", 41, LoadError("sparse/umfpack.jl", 61, Er…

---

## [Write nonlinear model in separate file?](https://discourse.julialang.org/t/write-nonlinear-model-in-separate-file/4054)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 9\
**Last updated:** [June 7, 2017, 5:17pm UTC](https://discourse.julialang.org/t/write-nonlinear-model-in-separate-file/4054 "2017-06-07T17:17:27Z")

</div>

For linear model we can use writeLP(m::Model, filename::String). What macro we can use for nonlinear model? .LP file format won’t support.

---

## [Locking properties of AbstractArrays](https://discourse.julialang.org/t/locking-properties-of-abstractarrays/4141)

<div class="topic-metadata">

**Author:** [@shivin9](https://discourse.julialang.org/u/shivin9)\
**Replies:** 1\
**Last updated:** [June 7, 2017, 3:44pm UTC](https://discourse.julialang.org/t/locking-properties-of-abstractarrays/4141 "2017-06-07T15:44:30Z")

</div>

Are AbstractArrays thread safe? I am trying to parallelize a code by using threads and am currently getting some performance gain by using Thread.@threads which shouldn’t come ideally if they were thread-safe. Threa…

---

## [Package Distributions gives different resullt for standard deviation](https://discourse.julialang.org/t/package-distributions-gives-different-resullt-for-standard-deviation/4135)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 3\
**Last updated:** [June 7, 2017, 1:46pm UTC](https://discourse.julialang.org/t/package-distributions-gives-different-resullt-for-standard-deviation/4135 "2017-06-07T13:46:25Z")

</div>

I am using two methods for computing the standard deviation of a dataset, which gives different results. Why is that so? With the package Distributions function fit() and with the ordinary function std() # Computing…

---

## [Defining in(a,b)](https://discourse.julialang.org/t/defining-in-a-b/4134)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 3\
**Last updated:** [June 7, 2017, 12:32pm UTC](https://discourse.julialang.org/t/defining-in-a-b/4134 "2017-06-07T12:32:14Z")

</div>

Is in(a,b) defined automatically by making b iterable and defining ==(a1::T, a2::T) where T is typeof(a) and typeof(b\[i\])?

---

## [Should I use type parameters or abstract arguments in a function?](https://discourse.julialang.org/t/should-i-use-type-parameters-or-abstract-arguments-in-a-function/4133)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 2\
**Last updated:** [June 7, 2017, 11:02am UTC](https://discourse.julialang.org/t/should-i-use-type-parameters-or-abstract-arguments-in-a-function/4133 "2017-06-07T11:02:21Z")

</div>

I find myself faced with a decision quite often to either use f{T\<:Real}(a::T) or f(a::Real), using Real as an example. Is there any performance difference between the 2? Which one is more preferred?

---

## [Installation Problem of Ipopt](https://discourse.julialang.org/t/installation-problem-of-ipopt/4105)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 4\
**Last updated:** [June 7, 2017, 7:46am UTC](https://discourse.julialang.org/t/installation-problem-of-ipopt/4105 "2017-06-07T07:46:53Z")

</div>

If I use Julia installer 32 Bit I can install Ipopt by using command at Julia command prompt - Pkg.add(“Ipopt”) and it passes through Pkg.test(“Ipopt”). If I use Julia 64 bit I can’t install. Pkg.test(“Ipopt”) failed and…

---

## [Array of structs](https://discourse.julialang.org/t/array-of-structs/3281)

<div class="topic-metadata">

**Author:** [@jilani](https://discourse.julialang.org/u/jilani)\
**Replies:** 7\
**Last updated:** [June 7, 2017, 6:13am UTC](https://discourse.julialang.org/t/array-of-structs/3281 "2017-06-07T06:13:14Z")

</div>

Hi All, I have some problems using Julia arrays with structs. I need some examples I tried to translate this Free Pascal code in Julia to compare their performance but I have had a lot of errors in Julia code: const M…

---

## [What Julia type maps to a C type containing nested structs?](https://discourse.julialang.org/t/what-julia-type-maps-to-a-c-type-containing-nested-structs/4116)

<div class="topic-metadata">

**Author:** [@DemiMarie](https://discourse.julialang.org/u/DemiMarie)\
**Replies:** 2\
**Last updated:** [June 6, 2017, 9:56pm UTC](https://discourse.julialang.org/t/what-julia-type-maps-to-a-c-type-containing-nested-structs/4116 "2017-06-06T21:56:02Z")

</div>

Suppose I have a C type like this: struct foo { int x; char y; }; struct bar { struct foo q; int y; }; and I need to be able to modify bar.q.x in-place, or it is modified by a C function that I pass the str…

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

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