# General Usage

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

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

**Page:** 1038

---

## [How to get all methods using certain type as their first parameter](https://discourse.julialang.org/t/how-to-get-all-methods-using-certain-type-as-their-first-parameter/4869)

<div class="topic-metadata">

**Author:** [@wrgr](https://discourse.julialang.org/u/wrgr)\
**Replies:** 2\
**Last updated:** [July 15, 2017, 12:56pm UTC](https://discourse.julialang.org/t/how-to-get-all-methods-using-certain-type-as-their-first-parameter/4869 "2017-07-15T12:56:48Z")

</div>

How to get all methods using certain type as their first parameter: type A ... end function get\_property(a::A) ... end function process(a::A, ...) ... end function make(a::A, ...) ... end So it would be possible to …

---

## [ParallelAccelerator.jl vs Devectorize.jl vs other](https://discourse.julialang.org/t/parallelaccelerator-jl-vs-devectorize-jl-vs-other/4864)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 7\
**Last updated:** [July 14, 2017, 10:25pm UTC](https://discourse.julialang.org/t/parallelaccelerator-jl-vs-devectorize-jl-vs-other/4864 "2017-07-14T22:25:48Z")

</div>

What’s the difference between ParallelAccelerator.jl and Devectorize.jl? I’ve seen there are some sparse threads speaking about this two packages and about how to do Julia faster… But how do they compare in terms of me…

---

## [Confusing type inference from chained assignment](https://discourse.julialang.org/t/confusing-type-inference-from-chained-assignment/4861)

<div class="topic-metadata">

**Author:** [@jamii](https://discourse.julialang.org/u/jamii)\
**Replies:** 3\
**Last updated:** [July 14, 2017, 8:50pm UTC](https://discourse.julialang.org/t/confusing-type-inference-from-chained-assignment/4861 "2017-07-14T20:50:57Z")

</div>

I ran into this weird behavior from code\_warntype today. It claims not to know the type of x, but it generates code as if it does. function f() d = Dict{Int64, Vector{Int64}}() x = d\[1\] = Vector{Int64}() push!(x, …

---

## [Is there a package that automatically runs tests when files get updated?](https://discourse.julialang.org/t/is-there-a-package-that-automatically-runs-tests-when-files-get-updated/4847)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 2\
**Last updated:** [July 14, 2017, 7:27pm UTC](https://discourse.julialang.org/t/is-there-a-package-that-automatically-runs-tests-when-files-get-updated/4847 "2017-07-14T19:27:07Z")

</div>

I started using Revise.jl recently and it got me thinking: is there a package that automatically runs tests every time a file gets saved? This would be similar in nature to: ruby’s guard-rspec javascript’s grunt wa…

---

## [Custom flags to Jupyter](https://discourse.julialang.org/t/custom-flags-to-jupyter/4852)

<div class="topic-metadata">

**Author:** [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Replies:** 4\
**Last updated:** [July 14, 2017, 5:57pm UTC](https://discourse.julialang.org/t/custom-flags-to-jupyter/4852 "2017-07-14T17:57:12Z")

</div>

Is there a way to launch the notebook with custom flags to the Julia instance? I.e. without changing the kernel.json file. In particular, I’d like to pass --compilecache=no.

---

## [Explicit "return" in anonymous functions](https://discourse.julialang.org/t/explicit-return-in-anonymous-functions/4857)

<div class="topic-metadata">

**Author:** [@alyst](https://discourse.julialang.org/u/alyst)\
**Replies:** 2\
**Last updated:** [July 14, 2017, 5:12pm UTC](https://discourse.julialang.org/t/explicit-return-in-anonymous-functions/4857 "2017-07-14T17:12:22Z")

</div>

I’m not sure whether it’s a bug or a feature, so posting it here. The following constructs generate identical code (tested with both v0.5.2 and v0.6.0): julia\> map(x -\> x, \[1,2,3\]) 3-element Array{Int64,1}: 1 2 3 j…

---

## [Human-readable but precise printing of data](https://discourse.julialang.org/t/human-readable-but-precise-printing-of-data/2212)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [July 14, 2017, 8:56am UTC](https://discourse.julialang.org/t/human-readable-but-precise-printing-of-data/2212 "2017-07-14T08:56:16Z")

</div>

How should I print data in Julia so that the output contains all the information (full precision for floats, type information for literals, etc), the output is plain text. Eg with show, type information and precision …

---

## ["Scalarizing" an element in broadcast or dot fused calls](https://discourse.julialang.org/t/scalarizing-an-element-in-broadcast-or-dot-fused-calls/4805)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 6\
**Last updated:** [July 14, 2017, 7:46am UTC](https://discourse.julialang.org/t/scalarizing-an-element-in-broadcast-or-dot-fused-calls/4805 "2017-07-14T07:46:54Z")

</div>

Just thought I might share this … even if its probably trivial for most of you. Let assume you have a 3x3 matrix and vector of n length 3 vectors K = rand(3,3) V = \[rand(3) for i=1:1000\] and you want to multiply K wit…

---

## [Least squares example?](https://discourse.julialang.org/t/least-squares-example/4845)

<div class="topic-metadata">

**Author:** [@hpoit](https://discourse.julialang.org/u/hpoit)\
**Replies:** 1\
**Last updated:** [July 14, 2017, 5:59am UTC](https://discourse.julialang.org/t/least-squares-example/4845 "2017-07-14T05:59:07Z")

</div>

How does this work? julia\> r = \[1, 2\] 2-element Array{Int64,1}: 1 2 julia\> \[1 2; 3 4\] 2×2 Array{Int64,2}: 1 2 3 4 julia\> r \\ \[1 2; 3 4\] 1×2 Array{Float64,2}: 1.4 2.0 If A is a rectangular m-by-n matrix with m…

---

## [Resolving a custom REQUIRE when calling julia](https://discourse.julialang.org/t/resolving-a-custom-require-when-calling-julia/4844)

<div class="topic-metadata">

**Author:** [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Replies:** 1\
**Last updated:** [July 13, 2017, 11:49pm UTC](https://discourse.julialang.org/t/resolving-a-custom-require-when-calling-julia/4844 "2017-07-13T23:49:15Z")

</div>

I am wondering if there’s a standard-ish way of having a custom REQUIRE file when calling a script. The behaviour I’m after is how Pkg.test() handles test/REQUIRE. The use case I have in mind is when using Documenter to…

---

## [Launching examples from a Julia package](https://discourse.julialang.org/t/launching-examples-from-a-julia-package/4814)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 17\
**Last updated:** [July 13, 2017, 6:08pm UTC](https://discourse.julialang.org/t/launching-examples-from-a-julia-package/4814 "2017-07-13T18:08:00Z")

</div>

I am trying to provide a convenience function for the users of my package that launchs Jupyter notebook examples from the command line without depending on IJulia: module Foo # ... function examples() using IJulia …

---

## [Difference between two forms of inner constructors](https://discourse.julialang.org/t/difference-between-two-forms-of-inner-constructors/4829)

<div class="topic-metadata">

**Author:** [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Replies:** 10\
**Last updated:** [July 13, 2017, 5:59pm UTC](https://discourse.julialang.org/t/difference-between-two-forms-of-inner-constructors/4829 "2017-07-13T17:59:51Z")

</div>

I’m defining my own type like below: type KOM{T} model::Trie{T,Int64} context::Vector{T} cxt\_length::Int64 # Constructor 1 # KOM{T}( \_c::Int ) where{T} = new( Trie{T,Int64}(), Vector{T}(), \_c ) …

---

## [Memory allocation changes when redefining a function](https://discourse.julialang.org/t/memory-allocation-changes-when-redefining-a-function/4803)

<div class="topic-metadata">

**Author:** [@jmgnve](https://discourse.julialang.org/u/jmgnve)\
**Replies:** 1\
**Last updated:** [July 13, 2017, 2:23pm UTC](https://discourse.julialang.org/t/memory-allocation-changes-when-redefining-a-function/4803 "2017-07-13T14:23:17Z")

</div>

Hi. I have made a piece of test code, that you find here with an explanation of how I ran my test. In summary: If I run the code, and benchmark the results it shows more memory allocation than I expect. If I then copy a…

---

## [Error loading a package](https://discourse.julialang.org/t/error-loading-a-package/4834)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 3\
**Last updated:** [July 13, 2017, 1:08pm UTC](https://discourse.julialang.org/t/error-loading-a-package/4834 "2017-07-13T13:08:17Z")

</div>

hello. Today I’ve installed the package https://github.com/weijianzhang/EvolvingGraphs.jl The installation didn’t generate any error message. But When I try to load it I get this error: using EvolvingGraphs WARNING…

---

## [Images and the new color representation](https://discourse.julialang.org/t/images-and-the-new-color-representation/4793)

<div class="topic-metadata">

**Author:** [@harven](https://discourse.julialang.org/u/harven)\
**Replies:** 6\
**Last updated:** [July 13, 2017, 1:06pm UTC](https://discourse.julialang.org/t/images-and-the-new-color-representation/4793 "2017-07-13T13:06:25Z")

</div>

I can see that there are quite a few changes concerning Images. I have a two dimensional array with triples of UInt8 as entries. How do I make it work with ImageView.imshow? As far as I understand, I must convert the U…

---

## [When function shouldn't return anything](https://discourse.julialang.org/t/when-function-shouldnt-return-anything/4836)

<div class="topic-metadata">

**Author:** [@Saran\_S](https://discourse.julialang.org/u/Saran_S)\
**Replies:** 3\
**Last updated:** [July 13, 2017, 1:00pm UTC](https://discourse.julialang.org/t/when-function-shouldnt-return-anything/4836 "2017-07-13T13:00:56Z")

</div>

Below is the code which I am working on. I have a Composite type called NearestNeighbor which has arrays to be passed on to processing. type NearestNeighbor Xrows::Array{Float64,2} Yrows::Vector{Float64} function…

---

## [Lazy evaluation on a large scale, is it the right thing to do?](https://discourse.julialang.org/t/lazy-evaluation-on-a-large-scale-is-it-the-right-thing-to-do/4815)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 2\
**Last updated:** [July 13, 2017, 11:46am UTC](https://discourse.julialang.org/t/lazy-evaluation-on-a-large-scale-is-it-the-right-thing-to-do/4815 "2017-07-13T11:46:59Z")

</div>

First a quick description of my usecase: I have an array of 81x81x81 complex values which represent a wavefunction in real space. I have 200 values of vector k, for which I need to calculate various things using these 8…

---

## [Throwaway types in tests](https://discourse.julialang.org/t/throwaway-types-in-tests/4831)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [July 13, 2017, 8:58am UTC](https://discourse.julialang.org/t/throwaway-types-in-tests/4831 "2017-07-13T08:58:42Z")

</div>

For some unit tests, I find it advantageous to define various types which mimic some interface I want to test, and possibly provide additional functionality useful for debugging (eg a callable struct in place of a functi…

---

## [Test with\_handler() in 0.6.0](https://discourse.julialang.org/t/test-with-handler-in-0-6-0/4822)

<div class="topic-metadata">

**Author:** [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Replies:** 2\
**Last updated:** [July 13, 2017, 7:59am UTC](https://discourse.julialang.org/t/test-with-handler-in-0-6-0/4822 "2017-07-13T07:59:37Z")

</div>

I’m using Julia 0.6.0 and would like to know the equivalent of this code in 0.4.x (taken from https://docs.julialang.org/en/release-0.4/stdlib/test/#handlers) julia\> using Base.Test julia\> custom\_handler(r::Test.Succes…

---

## [Preallocating the result of getindex(...)](https://discourse.julialang.org/t/preallocating-the-result-of-getindex/4820)

<div class="topic-metadata">

**Author:** [@mihirparadkar](https://discourse.julialang.org/u/mihirparadkar)\
**Replies:** 8\
**Last updated:** [July 13, 2017, 5:57am UTC](https://discourse.julialang.org/t/preallocating-the-result-of-getindex/4820 "2017-07-13T05:57:09Z")

</div>

Let’s say I have an array such as x = randn(1000), and a pre-allocated destination like xtmp = Array{Float64}(800) I know that creating a slice like x\[1:800\] has to copy the data somewhere, but how do I specify that…

---

## [Visnetwork or networkd3 library for Julia?](https://discourse.julialang.org/t/visnetwork-or-networkd3-library-for-julia/4823)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 0\
**Last updated:** [July 12, 2017, 9:03pm UTC](https://discourse.julialang.org/t/visnetwork-or-networkd3-library-for-julia/4823 "2017-07-12T21:03:13Z")

</div>

Is there any library like visnetwork or networkd3 in Julia? I mean I library able to create intereactive graph networks with a large number of nodes.

---

## [@inbounds like mechanism?](https://discourse.julialang.org/t/inbounds-like-mechanism/4818)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 3\
**Last updated:** [July 12, 2017, 8:52pm UTC](https://discourse.julialang.org/t/inbounds-like-mechanism/4818 "2017-07-12T20:52:19Z")

</div>

In the ArgCheck package, there is the @argcheck macro that can be used to check function arguments: julia\> using ArgCheck julia\> f(x) = (@argcheck x \>= 0; x) f (generic function with 1 method) julia\> f(1) 1 julia\> f(…

---

## [Runtime detection of inlining](https://discourse.julialang.org/t/runtime-detection-of-inlining/4816)

<div class="topic-metadata">

**Author:** [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Replies:** 1\
**Last updated:** [July 12, 2017, 6:38pm UTC](https://discourse.julialang.org/t/runtime-detection-of-inlining/4816 "2017-07-12T18:38:38Z")

</div>

Is there a way to find out of inlining is enabled at runtime (ie. was julia launched with --inline=no)? I want to test that a certain operation is non-allocating, but it doesn’t pass Travis tests because they run with i…

---

## [Segfault in ccall](https://discourse.julialang.org/t/segfault-in-ccall/4809)

<div class="topic-metadata">

**Author:** [@wenting-zhao](https://discourse.julialang.org/u/wenting-zhao)\
**Replies:** 5\
**Last updated:** [July 12, 2017, 5:26pm UTC](https://discourse.julialang.org/t/segfault-in-ccall/4809 "2017-07-12T17:26:25Z")

</div>

Here’s a minimal example: julia\> mutable struct FILE end julia\> outfile = ccall((:open, "libc"), Ptr{FILE}, (Cstring, Cstring), "test", "w+") Ptr{FILE} @0xffffffffffffffff julia\> ccall((:fprintf, "libc"), Cuint…

---

## [Plots with Julia-0.6](https://discourse.julialang.org/t/plots-with-julia-0-6/4798)

<div class="topic-metadata">

**Author:** [@ptoche](https://discourse.julialang.org/u/ptoche)\
**Replies:** 3\
**Last updated:** [July 12, 2017, 5:18pm UTC](https://discourse.julialang.org/t/plots-with-julia-0-6/4798 "2017-07-12T17:18:18Z")

</div>

I simultaneously upgraded to MacOS Sierra (the latest) and Julia 0.6, on a clean install. I’m trying to get my atom-juno-julia system to run as before, but am encountering problems plotting. Let’s say, I run Chris’s cod…

---

## [Problems installing Julia on Windows, respositories](https://discourse.julialang.org/t/problems-installing-julia-on-windows-respositories/4801)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 2\
**Last updated:** [July 12, 2017, 2:37pm UTC](https://discourse.julialang.org/t/problems-installing-julia-on-windows-respositories/4801 "2017-07-12T14:37:56Z")

</div>

Hi. This morning I’ve been trying to install Julia 0.6 with Jupyter on Windows 10. I did use Julia two years ago and decided to give it another chance. Things weren’t working well. I was getting these kind of message…

---

## [Should I use mutable or immutable types for parameters when writing parallel code?](https://discourse.julialang.org/t/should-i-use-mutable-or-immutable-types-for-parameters-when-writing-parallel-code/4792)

<div class="topic-metadata">

**Author:** [@thudso](https://discourse.julialang.org/u/thudso)\
**Replies:** 2\
**Last updated:** [July 11, 2017, 3:35pm UTC](https://discourse.julialang.org/t/should-i-use-mutable-or-immutable-types-for-parameters-when-writing-parallel-code/4792 "2017-07-11T15:35:22Z")

</div>

Hi there, I’m a newbie to both Julia and parallel computing, trying to parallelise some code which runs a sampling algorithm. I have a master and multiple workers, all of which need access to some global parameters. I h…

---

## [How to handle a DataFrame deprecation of \`&\` in v0.6](https://discourse.julialang.org/t/how-to-handle-a-dataframe-deprecation-of-in-v0-6/4787)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 2\
**Last updated:** [July 11, 2017, 10:34am UTC](https://discourse.julialang.org/t/how-to-handle-a-dataframe-deprecation-of-in-v0-6/4787 "2017-07-11T10:34:23Z")

</div>

In v0.5 I did this: using DataFrames df = DataFrame(A = rand(5), B = rand(1:10, 5), C = \["a", "e", "i", "o", "u"\]) df\[(df\[:A\] .\> 0.2) & (df\[:B\] .\< 3), :\] 1×3 DataFrames.DataFrame │ Row │ A │ B…

---

## [Efficient data access of wrapped C libraries and structs](https://discourse.julialang.org/t/efficient-data-access-of-wrapped-c-libraries-and-structs/4716)

<div class="topic-metadata">

**Author:** [@klowrey](https://discourse.julialang.org/u/klowrey)\
**Replies:** 6\
**Last updated:** [July 10, 2017, 8:16pm UTC](https://discourse.julialang.org/t/efficient-data-access-of-wrapped-c-libraries-and-structs/4716 "2017-07-10T20:16:52Z")

</div>

I’ve been doing RL research recently using the Mujoco physics engine as my robotics simulator. Up until now I’ve just written my own library that exposed just the functionality I needed as a subset of all that Mujoco can…

---

## [Spawn() documentation update request](https://discourse.julialang.org/t/spawn-documentation-update-request/4668)

<div class="topic-metadata">

**Author:** [@ahogen](https://discourse.julialang.org/u/ahogen)\
**Replies:** 4\
**Last updated:** [July 10, 2017, 7:15pm UTC](https://discourse.julialang.org/t/spawn-documentation-update-request/4668 "2017-07-10T19:15:24Z")

</div>

Hi all. I’m new to the community so pardon me if I’m not posting in the right area or am asking a dumb question. This looked like the best place to start. My question/request is simple: Could documentation for the spawn…

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

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