# General Usage

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

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

**Page:** 1033

---

## [Why are calls to this function slow, compared to Python+Numpy?](https://discourse.julialang.org/t/why-are-calls-to-this-function-slow-compared-to-python-numpy/5346)

<div class="topic-metadata">

**Author:** [@vgdev](https://discourse.julialang.org/u/vgdev)\
**Replies:** 14\
**Last updated:** [August 13, 2017, 9:47am UTC](https://discourse.julialang.org/t/why-are-calls-to-this-function-slow-compared-to-python-numpy/5346 "2017-08-13T09:47:48Z")

</div>

I have simple question. I have a function b, below which i make multiple calls too. But I am experiencing that it is about x3 slower than a Numpy implementaion in Python. Any idea on how to speed this up? function b(a, …

---

## [World age issue due to code generation inside an inner constructor in Julia v0.6](https://discourse.julialang.org/t/world-age-issue-due-to-code-generation-inside-an-inner-constructor-in-julia-v0-6/5124)

<div class="topic-metadata">

**Author:** [@scidom](https://discourse.julialang.org/u/scidom)\
**Replies:** 13\
**Last updated:** [August 13, 2017, 5:59am UTC](https://discourse.julialang.org/t/world-age-issue-due-to-code-generation-inside-an-inner-constructor-in-julia-v0-6/5124 "2017-08-13T05:59:26Z")

</div>

I get a world age error in Julia v0.6 related to the fact that I code-generate two functions from inside an inner constructor here. The code-generated functions can not be called anymore in Julia v0.6, although this used…

---

## [Speed of sampling with replacement](https://discourse.julialang.org/t/speed-of-sampling-with-replacement/5349)

<div class="topic-metadata">

**Author:** [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Replies:** 0\
**Last updated:** [August 12, 2017, 9:19pm UTC](https://discourse.julialang.org/t/speed-of-sampling-with-replacement/5349 "2017-08-12T21:19:19Z")

</div>

Currently sampling with replacement in Julia seems to be significantly slower than in R (tested on Julia 0.6.0, 64bit). See e.g.: \> x \<- runif(10^7) \> system.time(sample(x, replace=T)) user system elapsed 0.38 …

---

## [WARNING: deprecated syntax "\_ as an rvalue around docs/Docs.jl:522"](https://discourse.julialang.org/t/warning-deprecated-syntax---as-an-rvalue-around-docs-docs-jl-522/5347)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 1\
**Last updated:** [August 12, 2017, 3:12pm UTC](https://discourse.julialang.org/t/warning-deprecated-syntax---as-an-rvalue-around-docs-docs-jl-522/5347 "2017-08-12T15:12:19Z")

</div>

This warning is hanging around for months. Where is it coming from? One online example in the Luxor docs: https://juliagraphics.github.io/Luxor.jl/stable/moreexamples.html#Strange-1

---

## [Have I been pwned?](https://discourse.julialang.org/t/have-i-been-pwned/5309)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 3\
**Last updated:** [August 12, 2017, 1:15am UTC](https://discourse.julialang.org/t/have-i-been-pwned/5309 "2017-08-12T01:15:36Z")

</div>

Hi, I wanted to write a Julia password checker following the news about a list of hacked passwords, posted here as a list of SHA1 hashes: The code I came up with is this: (requires 6.2 GB RAM on the real password list…

---

## [Catching signals, or other ways of branching within a loop?](https://discourse.julialang.org/t/catching-signals-or-other-ways-of-branching-within-a-loop/5336)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 1\
**Last updated:** [August 11, 2017, 7:59pm UTC](https://discourse.julialang.org/t/catching-signals-or-other-ways-of-branching-within-a-loop/5336 "2017-08-11T19:59:54Z")

</div>

With some common UNIX utilities, it is possible to send a signal to the process that will cause it to take some instantaneous action (like print out progress): If dd receives a SIGINFO (see the status argument for stty…

---

## [@parallel vcat throws TypeError but @parallel hcat does not](https://discourse.julialang.org/t/parallel-vcat-throws-typeerror-but-parallel-hcat-does-not/5334)

<div class="topic-metadata">

**Author:** [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Replies:** 0\
**Last updated:** [August 11, 2017, 4:02pm UTC](https://discourse.julialang.org/t/parallel-vcat-throws-typeerror-but-parallel-hcat-does-not/5334 "2017-08-11T16:02:15Z")

</div>

I think I’m having the same issue as this post: I get an error when I use @parallel vcat where each iteration returns a Dict{Symbol, Array{Float64}} , but not when I use @parallel hcat. Suppose I define the following fu…

---

## [Bug in representation of arrays?](https://discourse.julialang.org/t/bug-in-representation-of-arrays/5333)

<div class="topic-metadata">

**Author:** [@giordano](https://discourse.julialang.org/u/giordano)\
**Replies:** 1\
**Last updated:** [August 11, 2017, 3:31pm UTC](https://discourse.julialang.org/t/bug-in-representation-of-arrays/5333 "2017-08-11T15:31:52Z")

</div>

Julia 0.6: julia\> rand(Complex128, 2) 2-element Array{Complex{Float64},1}: 0.548883+0.127059im 0.331562+0.484864im Julia master: julia\> rand(Complex128, 2) 2-element Array{Complex{Float64},1}: 0.018193872615607898 …

---

## [How to use julia for implementing machine learning algorithms in parallel](https://discourse.julialang.org/t/how-to-use-julia-for-implementing-machine-learning-algorithms-in-parallel/5328)

<div class="topic-metadata">

**Author:** [@Devi\_Sree](https://discourse.julialang.org/u/Devi_Sree)\
**Replies:** 9\
**Last updated:** [August 11, 2017, 3:03pm UTC](https://discourse.julialang.org/t/how-to-use-julia-for-implementing-machine-learning-algorithms-in-parallel/5328 "2017-08-11T15:03:02Z")

</div>

Can someone demonstrate julia’s efficiency by explaining how to write code for machine learning algorithm and then run them in parallel ? Can it break the efficiency of spark-scala.

---

## [Showing function calls (like in stacktrace)](https://discourse.julialang.org/t/showing-function-calls-like-in-stacktrace/5307)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 3\
**Last updated:** [August 11, 2017, 2:07pm UTC](https://discourse.julialang.org/t/showing-function-calls-like-in-stacktrace/5307 "2017-08-11T14:07:29Z")

</div>

Is there a way to show the functions called inside a function like in the stacktrace of error messages, even if the function returns successfully? In other words, I would like to see something like \[1\]–\[6\] in the follow…

---

## [Cannot save Gadfy plot, requires Cairo+Fontconfig although its installed](https://discourse.julialang.org/t/cannot-save-gadfy-plot-requires-cairo-fontconfig-although-its-installed/5322)

<div class="topic-metadata">

**Author:** [@vgdev](https://discourse.julialang.org/u/vgdev)\
**Replies:** 2\
**Last updated:** [August 11, 2017, 8:48am UTC](https://discourse.julialang.org/t/cannot-save-gadfy-plot-requires-cairo-fontconfig-although-its-installed/5322 "2017-08-11T08:48:58Z")

</div>

I am struggling with saving a simple Gadfly plot in PNG format. using Cairo using Fontconfig using Gadfly myplot =plot(x=rand(10), y=rand(10), Geom.point, Geom.line) draw(PNG("myplot.png", 4inch, 3inch), myplot) The c…

---

## [Overriding display of composite type](https://discourse.julialang.org/t/overriding-display-of-composite-type/5325)

<div class="topic-metadata">

**Author:** [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Replies:** 1\
**Last updated:** [August 11, 2017, 7:08am UTC](https://discourse.julialang.org/t/overriding-display-of-composite-type/5325 "2017-08-11T07:08:15Z")

</div>

I’m trying to do something like this on Atom environment. using Juno struct Foo a b end function Base.show(io::IO, x::Foo) display(Juno.Tree("this is...", \[x.a, x.b, "some extra info"\])) end which displa…

---

## [Atom / Juno Crashes](https://discourse.julialang.org/t/atom-juno-crashes/5318)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 8\
**Last updated:** [August 10, 2017, 11:21pm UTC](https://discourse.julialang.org/t/atom-juno-crashes/5318 "2017-08-10T23:21:25Z")

</div>

Since yesterday, when I use Atom + Juno (inline evaluation, plotting from Atom etc) my laptop completely freezes every 20 minutes or so - this is causing all sort of havoc with my system (e.g. I had to completely reset d…

---

## [Stan.jl warning](https://discourse.julialang.org/t/stan-jl-warning/5311)

<div class="topic-metadata">

**Author:** [@EricChameroy](https://discourse.julialang.org/u/EricChameroy)\
**Replies:** 5\
**Last updated:** [August 10, 2017, 7:18pm UTC](https://discourse.julialang.org/t/stan-jl-warning/5311 "2017-08-10T19:18:16Z")

</div>

Hi everyone, When I load Stan.jl, I receive the following message: WARNING: using Stan.CMDSTAN\_HOME in module Main conflicts with an existing identifier. I had created a .juliarc.jl file containing the statement: CMD…

---

## [GtkReactive widgets that elicit a self push!](https://discourse.julialang.org/t/gtkreactive-widgets-that-elicit-a-self-push/5316)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 0\
**Last updated:** [August 10, 2017, 8:32am UTC](https://discourse.julialang.org/t/gtkreactive-widgets-that-elicit-a-self-push/5316 "2017-08-10T08:32:36Z")

</div>

Hi all, I need some help figuring this out. The goal is to have a cool time-widget for the GtkReactive.jl package: with say 3 fields: hours, minutes, and seconds always shows a valid time (e.g. no 63 seconds) allows f…

---

## [How is macro arguments resolved?](https://discourse.julialang.org/t/how-is-macro-arguments-resolved/5293)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 10\
**Last updated:** [August 10, 2017, 2:30am UTC](https://discourse.julialang.org/t/how-is-macro-arguments-resolved/5293 "2017-08-10T02:30:51Z")

</div>

In the official documentary, a macro example is provided: macro time(ex) return quote local t0 = time() local val = $ex local t1 = time() println("elapsed time: ", t1-t0, " seconds") …

---

## [Alternatives to \`Base.promote\_op(op, ::Type...)\` for \`op::Type\`?](https://discourse.julialang.org/t/alternatives-to-base-promote-op-op-type-for-op-type/5289)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 7\
**Last updated:** [August 9, 2017, 12:29am UTC](https://discourse.julialang.org/t/alternatives-to-base-promote-op-op-type-for-op-type/5289 "2017-08-09T00:29:46Z")

</div>

In the package I am contributing to, I would like to use Base.promote\_op to infer the return type of an arbitrary function given by users. For example, if I want to know the return type of sin(x) for x::Int64, I can do …

---

## [Assign values to \`slicedim\`](https://discourse.julialang.org/t/assign-values-to-slicedim/5264)

<div class="topic-metadata">

**Author:** [@jacobcvt12](https://discourse.julialang.org/u/jacobcvt12)\
**Replies:** 2\
**Last updated:** [August 8, 2017, 8:33pm UTC](https://discourse.julialang.org/t/assign-values-to-slicedim/5264 "2017-08-08T20:33:06Z")

</div>

Is there anyway to assign values to a section of an array? For example using Distributions, StatsFuns # generate an array y = rand(Normal(), 4, 3, 2) # section of y to modified modify = slicedim(y, 3, 2) # modify se…

---

## [Installing python dependencies offline](https://discourse.julialang.org/t/installing-python-dependencies-offline/5263)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 2\
**Last updated:** [August 8, 2017, 12:45pm UTC](https://discourse.julialang.org/t/installing-python-dependencies-offline/5263 "2017-08-08T12:45:53Z")

</div>

I’m installing julia on a (Windows) machine with no network access. One of my modules has a python package as a dependency. The only python installation on the machine is the one that is installed via JuliaPro (I assume …

---

## [Parallel Computing in Julia](https://discourse.julialang.org/t/parallel-computing-in-julia/5275)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 1\
**Last updated:** [August 8, 2017, 10:10am UTC](https://discourse.julialang.org/t/parallel-computing-in-julia/5275 "2017-08-08T10:10:21Z")

</div>

Hello, I am new in this area. I am using the following approach for parallel processing: I have few modules. In starting file I mentioned addprocs(2). From the starting file I called a function of another m…

---

## [AbstractMyType or just MyType for abstract types?](https://discourse.julialang.org/t/abstractmytype-or-just-mytype-for-abstract-types/5247)

<div class="topic-metadata">

**Author:** [@smldis](https://discourse.julialang.org/u/smldis)\
**Replies:** 2\
**Last updated:** [August 8, 2017, 5:27am UTC](https://discourse.julialang.org/t/abstractmytype-or-just-mytype-for-abstract-types/5247 "2017-08-08T05:27:48Z")

</div>

Hello, For the naming of an abstract type (MyType), should I use AbstractMyType or just MyType for abstract types? Base is using the former, some packages are using the latter. I remember someone telling that once it w…

---

## [Endian of reinterpret(T, array)](https://discourse.julialang.org/t/endian-of-reinterpret-t-array/5272)

<div class="topic-metadata">

**Author:** [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Replies:** 2\
**Last updated:** [August 8, 2017, 4:07am UTC](https://discourse.julialang.org/t/endian-of-reinterpret-t-array/5272 "2017-08-08T04:07:55Z")

</div>

Hi All, I was received an array from a file as: julia\> a1 = UInt8\[0x0, 0x32, 0, 0x33, 0, 0x34, 0, 0x35,0,0\] 10-element Array{UInt8,1}: 0x00 0x32 0x00 0x33 0x00 0x34 0x00 0x35 0x00 0x00 julia\> a2 = reinterpre…

---

## [Solving a nonlinear system of equations in Julia](https://discourse.julialang.org/t/solving-a-nonlinear-system-of-equations-in-julia/5261)

<div class="topic-metadata">

**Author:** [@Petre\_C](https://discourse.julialang.org/u/Petre_C)\
**Replies:** 4\
**Last updated:** [August 7, 2017, 7:48pm UTC](https://discourse.julialang.org/t/solving-a-nonlinear-system-of-equations-in-julia/5261 "2017-08-07T19:48:46Z")

</div>

I can write in function in Matlab in this way: function res=resid(theta,alpha,beta); RHS=; LHS=; RHS= theta-alpha; LHS= theta\*beta; res = (LHS-RHS); We set the parameters, call the function: alpha=0.3;beta=0.95; …

---

## [How does a variable get copied to another process?](https://discourse.julialang.org/t/how-does-a-variable-get-copied-to-another-process/5186)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 4\
**Last updated:** [August 7, 2017, 5:04pm UTC](https://discourse.julialang.org/t/how-does-a-variable-get-copied-to-another-process/5186 "2017-08-07T17:04:19Z")

</div>

In parallel computing with julia, I know that variables defined outside of a @spawn code block, but referenced in said block are copied over to the process, but is this a shallow copy or a deep copy? Say I have a type, …

---

## [Strange timing issue with code](https://discourse.julialang.org/t/strange-timing-issue-with-code/5230)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 5\
**Last updated:** [August 7, 2017, 2:06pm UTC](https://discourse.julialang.org/t/strange-timing-issue-with-code/5230 "2017-08-07T14:06:00Z")

</div>

julia\> @btime p = LightGraphs.dfs\_parents(g, 2); 210.919 ms (3670024 allocations: 216.13 MiB) julia\> @btime LightGraphs.tree(p); 270.824 ms (5767200 allocations: 410.00 MiB) julia\> @btime LightGraphs.tree(LightGrap…

---

## [Running a mapreduce job in Julia](https://discourse.julialang.org/t/running-a-mapreduce-job-in-julia/5255)

<div class="topic-metadata">

**Author:** [@Devi\_Sree](https://discourse.julialang.org/u/Devi_Sree)\
**Replies:** 0\
**Last updated:** [August 7, 2017, 9:33am UTC](https://discourse.julialang.org/t/running-a-mapreduce-job-in-julia/5255 "2017-08-07T09:33:52Z")

</div>

I have used Docker Hub site for installing and using hadoop. Everything got installed successfully. Using the jps command I could see the working nodes root@c584ec74aae3:/# jps 986 NodeManager 791 ResourceManager 396 Da…

---

## [Need for a Method hex2bytes(Vector{UInt8})](https://discourse.julialang.org/t/need-for-a-method-hex2bytes-vector-uint8/5209)

<div class="topic-metadata">

**Author:** [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Replies:** 5\
**Last updated:** [August 7, 2017, 5:56am UTC](https://discourse.julialang.org/t/need-for-a-method-hex2bytes-vector-uint8/5209 "2017-08-07T05:56:52Z")

</div>

Hi All, Many a times hex encoded bytes are received as part of IO or network operations. And that will need to be converted to bytes for further processing. Current method expects a conversion to a form of AbstractStrin…

---

## [Question regarding @inbounds usage](https://discourse.julialang.org/t/question-regarding-inbounds-usage/5241)

<div class="topic-metadata">

**Author:** [@CodeLenz](https://discourse.julialang.org/u/CodeLenz)\
**Replies:** 2\
**Last updated:** [August 6, 2017, 11:59pm UTC](https://discourse.julialang.org/t/question-regarding-inbounds-usage/5241 "2017-08-06T23:59:25Z")

</div>

Hi there. Consider an Array of integers and a vector a = \[1 3 5 6 ; 4 7 9 2 ; 3 5 7 4\]; T = rand(10); and the operations r1 = T\[a\[1,:\]\] r2 = @inbounds T\[a\[1,:\]\] Observe that r1 would return T in positions 1, 3…

---

## [Optim.jl and Fminbox errors](https://discourse.julialang.org/t/optim-jl-and-fminbox-errors/5242)

<div class="topic-metadata">

**Author:** [@improbable22](https://discourse.julialang.org/u/improbable22)\
**Replies:** 2\
**Last updated:** [August 5, 2017, 7:16pm UTC](https://discourse.julialang.org/t/optim-jl-and-fminbox-errors/5242 "2017-08-05T19:16:32Z")

</div>

I’m having trouble getting Optim.jl’s box minimization to work. From the example in the docs the error I get is here: julia\> od = OnceDifferentiable(f, g!, initial\_x) ERROR: MethodError: Cannot \`convert\` an object of ty…

---

## [Julia Execution get out of memory error](https://discourse.julialang.org/t/julia-execution-get-out-of-memory-error/5238)

<div class="topic-metadata">

**Author:** [@Anu\_Mol](https://discourse.julialang.org/u/Anu_Mol)\
**Replies:** 3\
**Last updated:** [August 5, 2017, 2:56pm UTC](https://discourse.julialang.org/t/julia-execution-get-out-of-memory-error/5238 "2017-08-05T14:56:59Z")

</div>

I have running julia through terminal in my system. When am try to run machine learning algorithms got out of memory exception.My system have Ram size 16gb.Please explain me about julia memory allocation concept.I have e…

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

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