# General Usage

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

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

**Page:** 935

---

## [Pin package seems not to be working](https://discourse.julialang.org/t/pin-package-seems-not-to-be-working/15615)

<div class="topic-metadata">

**Author:** [@getzze](https://discourse.julialang.org/u/getzze)\
**Replies:** 3\
**Last updated:** [September 29, 2018, 9:12am UTC](https://discourse.julialang.org/t/pin-package-seems-not-to-be-working/15615 "2018-09-29T09:12:01Z")

</div>

I want to pin CSV.jl to version 0.3.1 because version 0.4.1 cannot read my file. When I pin it, I cannot update it anymore, however, installing a new package makes it change the version. (v1.0) pkg\> add CSV@0.3.1 Reso…

---

## [Specializing a Unionall](https://discourse.julialang.org/t/specializing-a-unionall/15626)

<div class="topic-metadata">

**Author:** [@TimSheard](https://discourse.julialang.org/u/TimSheard)\
**Replies:** 4\
**Last updated:** [September 29, 2018, 9:10am UTC](https://discourse.julialang.org/t/specializing-a-unionall/15626 "2018-09-29T09:10:48Z")

</div>

I have two objects with similar type julia\> typeof(price) PArr{Int64,PArr{Int64,Float64}} julia\> typeof(flag) PArr{Int64,PArr{Int64,Char}} I want to put them both in an array, so I use a unionall qs = (PArr{Int,PAr…

---

## [I got a code that blocks the rest of the code , what can I do about it?](https://discourse.julialang.org/t/i-got-a-code-that-blocks-the-rest-of-the-code-what-can-i-do-about-it/15633)

<div class="topic-metadata">

**Author:** [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Replies:** 5\
**Last updated:** [September 29, 2018, 7:59am UTC](https://discourse.julialang.org/t/i-got-a-code-that-blocks-the-rest-of-the-code-what-can-i-do-about-it/15633 "2018-09-29T07:59:01Z")

</div>

I got this code Handler.jl module WSHandler include("Logger.jl") include("../Structs/User.jl") using Base using Dates import .WSLogger import .User import JSON function handleEvent(da…

---

## [Closure over a function with keyword arguments while keeping access to the keyword arguments](https://discourse.julialang.org/t/closure-over-a-function-with-keyword-arguments-while-keeping-access-to-the-keyword-arguments/15574)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 8\
**Last updated:** [September 29, 2018, 7:41am UTC](https://discourse.julialang.org/t/closure-over-a-function-with-keyword-arguments-while-keeping-access-to-the-keyword-arguments/15574 "2018-09-29T07:41:10Z")

</div>

Hi everyone, I have the following problem. I have a function foo(x; y = 1) and would like to obtain a function that calls foo while keeping x constant, but still allows me to specify different values for y. I would like…

---

## [Recursive Fibonacci Benchmark using top languages on Github](https://discourse.julialang.org/t/recursive-fibonacci-benchmark-using-top-languages-on-github/15602)

<div class="topic-metadata">

**Author:** [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Replies:** 11\
**Last updated:** [September 29, 2018, 1:38am UTC](https://discourse.julialang.org/t/recursive-fibonacci-benchmark-using-top-languages-on-github/15602 "2018-09-29T01:38:15Z")

</div>

Dear all, this popped up in the hacker news. It uses julia 0.6.3 version. https://github.com/drujensen/fib/blob/master/README.md

---

## [ERROR: LoadError: syntax: function argument names not unique](https://discourse.julialang.org/t/error-loaderror-syntax-function-argument-names-not-unique/15648)

<div class="topic-metadata">

**Author:** [@gregory](https://discourse.julialang.org/u/gregory)\
**Replies:** 1\
**Last updated:** [September 29, 2018, 1:29am UTC](https://discourse.julialang.org/t/error-loaderror-syntax-function-argument-names-not-unique/15648 "2018-09-29T01:29:01Z")

</div>

I am receiving this weird error. The code is: function absInt(array) newarray = array for n = 1 : length(array) if array\[n\] \< 0 array\[n\] = -array\[n\] end end return newarray end function CloneBinRepresentation…

---

## [Julia one third slower than ccall-ing \`@code\_native\` assembly compiled with gcc?](https://discourse.julialang.org/t/julia-one-third-slower-than-ccall-ing-code-native-assembly-compiled-with-gcc/12901)

<div class="topic-metadata">

**Author:** [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Replies:** 2\
**Last updated:** [September 29, 2018, 1:18am UTC](https://discourse.julialang.org/t/julia-one-third-slower-than-ccall-ing-code-native-assembly-compiled-with-gcc/12901 "2018-09-29T01:18:45Z")

</div>

I’m working on a series of blog posts about trying to optimize matrix multiplication in Julia. This is on: julia\> versioninfo() Julia Version 1.0.0-DEV.0 Commit ce2aa22d47 (2018-08-02 23:11 UTC) Platform Info: OS: Li…

---

## [Updating packages in 0.7 fails](https://discourse.julialang.org/t/updating-packages-in-0-7-fails/15646)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 0\
**Last updated:** [September 28, 2018, 9:42pm UTC](https://discourse.julialang.org/t/updating-packages-in-0-7-fails/15646 "2018-09-28T21:42:42Z")

</div>

Hello, I have the following error when I try to update my packages: ufechner@tuxedo:~$ julia7 \_ \_ \_ \_(\_)\_ | A fresh approach to technical computing (\_) | (\_) (\_) | Documentation: …

---

## [Is there a possibility to pass data between two modules?](https://discourse.julialang.org/t/is-there-a-possibility-to-pass-data-between-two-modules/15621)

<div class="topic-metadata">

**Author:** [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Replies:** 7\
**Last updated:** [September 28, 2018, 8:33pm UTC](https://discourse.julialang.org/t/is-there-a-possibility-to-pass-data-between-two-modules/15621 "2018-09-28T20:33:09Z")

</div>

Is there a possibility to pass data between two modules ? I got to modules with structs in them I want to pass data from module1 to module2 module moduleOne # how would I get the data from moduleTwo? end module modu…

---

## [Trying to require Modules in a circular way, program just crashes](https://discourse.julialang.org/t/trying-to-require-modules-in-a-circular-way-program-just-crashes/15596)

<div class="topic-metadata">

**Author:** [@TheOnlyArtz](https://discourse.julialang.org/u/TheOnlyArtz)\
**Replies:** 7\
**Last updated:** [September 28, 2018, 5:05pm UTC](https://discourse.julialang.org/t/trying-to-require-modules-in-a-circular-way-program-just-crashes/15596 "2018-09-28T17:05:40Z")

</div>

I got 2 files, and in each file I include\` the other file so it goes like When I run this code it just errors hard: Is there any way around it?

---

## [Anonymous functions in Dictionary with generator syntax](https://discourse.julialang.org/t/anonymous-functions-in-dictionary-with-generator-syntax/15260)

<div class="topic-metadata">

**Author:** [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Replies:** 3\
**Last updated:** [September 28, 2018, 2:50pm UTC](https://discourse.julialang.org/t/anonymous-functions-in-dictionary-with-generator-syntax/15260 "2018-09-28T14:50:49Z")

</div>

I am running julia 1.0 on Manjaro Linux and have created a Dictionary like this: d = Dict( i =\> ( s -\> somefunction(s,i) ) for i in \["a", "b"\]) where somefunction always returns a string. Now I want to add another ent…

---

## [Pin package seems not to be working](https://discourse.julialang.org/t/pin-package-seems-not-to-be-working/15613)

<div class="topic-metadata">

**Author:** [@getzze](https://discourse.julialang.org/u/getzze)\
**Replies:** 0\
**Last updated:** [September 28, 2018, 2:44pm UTC](https://discourse.julialang.org/t/pin-package-seems-not-to-be-working/15613 "2018-09-28T14:44:54Z")

</div>

I want to pin CSV.jl to version 0.3.1 because version 0.4.1 cannot read my file. If it is pinned, I cannot update it, as expected. However, installing another package changes the version. (v1.0) pkg\> add CSV@0.3.1 Res…

---

## [Split vector into two using a boolean test](https://discourse.julialang.org/t/split-vector-into-two-using-a-boolean-test/15600)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 1\
**Last updated:** [September 28, 2018, 1:02pm UTC](https://discourse.julialang.org/t/split-vector-into-two-using-a-boolean-test/15600 "2018-09-28T13:02:52Z")

</div>

Sorry, I couldn’t find where this has been asked before. Sometimes I need to split a vector into two vectors using some boolean test. Here’s my implementation: function Base.split(xs::T, isfirst::Function) where {T \<:…

---

## [Easier access to DataFrame's elements](https://discourse.julialang.org/t/easier-access-to-dataframes-elements/15589)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 6\
**Last updated:** [September 28, 2018, 11:30am UTC](https://discourse.julialang.org/t/easier-access-to-dataframes-elements/15589 "2018-09-28T11:30:29Z")

</div>

julia\> using DataFrames julia\> df = DataFrame(A = 1:4, B = \["M", "F", "F", "M"\]) 4×2 DataFrame │ Row │ A │ B │ │ │ Int64 │ String │ ├─────┼───────┼────────┤ │ 1 │ 1 │ M │ │ 2 │ 2 │ F │…

---

## [Memory usage with @benchmarkable](https://discourse.julialang.org/t/memory-usage-with-benchmarkable/15606)

<div class="topic-metadata">

**Author:** [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Replies:** 0\
**Last updated:** [September 28, 2018, 10:57am UTC](https://discourse.julialang.org/t/memory-usage-with-benchmarkable/15606 "2018-09-28T10:57:38Z")

</div>

julia\> A = randn(10000,10000); julia\> b = @benchmarkable println(size($A)) samples=1; julia\> A = \[\]; julia\> varinfo() A 40 bytes 0-element Array{Any,1} b 64 bytes BenchmarkTools.Benchmark{Symbol("##benchmark#363")}…

---

## [Generic way to write array stencils/kernels for CPUs and GPUs?](https://discourse.julialang.org/t/generic-way-to-write-array-stencils-kernels-for-cpus-and-gpus/15595)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 5\
**Last updated:** [September 28, 2018, 9:36am UTC](https://discourse.julialang.org/t/generic-way-to-write-array-stencils-kernels-for-cpus-and-gpus/15595 "2018-09-28T09:36:36Z")

</div>

Do we currently have an established way to write stencils for single-/multi-array operations, or kernels in general, in a way that’s compatible with both CPU and GPU array? Regarding kernels/stencils in general, I found…

---

## [What is the Interface of AbstractString?](https://discourse.julialang.org/t/what-is-the-interface-of-abstractstring/8937)

<div class="topic-metadata">

**Author:** [@samoconnor](https://discourse.julialang.org/u/samoconnor)\
**Replies:** 20\
**Last updated:** [September 28, 2018, 8:53am UTC](https://discourse.julialang.org/t/what-is-the-interface-of-abstractstring/8937 "2018-09-28T08:53:46Z")

</div>

The Interfaces documentation does not cover AbstractString: https://docs.julialang.org/en/latest/manual/interfaces What is the minimal set of methods that must be defined for a custom AbstractString type? Is there a go…

---

## [Failed to \`cd\` in Julia REPL's shell mode on fish shell](https://discourse.julialang.org/t/failed-to-cd-in-julia-repls-shell-mode-on-fish-shell/15593)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 2\
**Last updated:** [September 28, 2018, 8:40am UTC](https://discourse.julialang.org/t/failed-to-cd-in-julia-repls-shell-mode-on-fish-shell/15593 "2018-09-28T08:40:36Z")

</div>

Failed to chage directory in shell mode. ls or other commands work fine. \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ \_| |\_ \_\_ \_ | Type "?" f…

---

## [How to create a system administrator depot?](https://discourse.julialang.org/t/how-to-create-a-system-administrator-depot/14122)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 8\
**Last updated:** [September 28, 2018, 6:19am UTC](https://discourse.julialang.org/t/how-to-create-a-system-administrator-depot/14122 "2018-09-28T06:19:43Z")

</div>

This is from the Pkg section of the Julia doc about the DEPOT\_PATH: How do I set up such a system administrator depot? Basically, what I want is to install a couple of packages system wide such that users don’t have t…

---

## [Phase Unwrapping function question](https://discourse.julialang.org/t/phase-unwrapping-function-question/15448)

<div class="topic-metadata">

**Author:** [@Nakul\_Tiruviluamala](https://discourse.julialang.org/u/Nakul_Tiruviluamala)\
**Replies:** 10\
**Last updated:** [September 27, 2018, 2:46pm UTC](https://discourse.julialang.org/t/phase-unwrapping-function-question/15448 "2018-09-27T14:46:18Z")

</div>

Hello, I’m trying to make sense of this phase wrapping code I found by @ssfrr. What is the whole inplace business about? I couldn’t find anything about it in the documentation. In particular, the inplace ? yphase : cop…

---

## [Start-up performance, types and compiler's type inference](https://discourse.julialang.org/t/start-up-performance-types-and-compilers-type-inference/15254)

<div class="topic-metadata">

**Author:** [@davidm](https://discourse.julialang.org/u/davidm)\
**Replies:** 5\
**Last updated:** [September 27, 2018, 6:49pm UTC](https://discourse.julialang.org/t/start-up-performance-types-and-compilers-type-inference/15254 "2018-09-27T18:49:52Z")

</div>

I’ve been trying to reduce the start-up time to run a small OpenGL (Modern.jl and GLFW) program. I clearly saw that the compilation part was introducing significant overhead, much more than the actual computations. In f…

---

## [findlast(pattern::Regex, string::String) missing?](https://discourse.julialang.org/t/findlast-pattern-regex-string-string-missing/15562)

<div class="topic-metadata">

**Author:** [@jandehaan](https://discourse.julialang.org/u/jandehaan)\
**Replies:** 8\
**Last updated:** [September 27, 2018, 5:45pm UTC](https://discourse.julialang.org/t/findlast-pattern-regex-string-string-missing/15562 "2018-09-27T17:45:07Z")

</div>

In Julia 1.0 julia\> ?findlast shows that the following method should exist. findlast(pattern::Regex, string::String) But 'methods(findlast)\` shows no such method. What needs to be corrected? The code in Base or the …

---

## [\`eigs\` for sparse tridiagonal matrix: Arpack.jl vs scipy](https://discourse.julialang.org/t/eigs-for-sparse-tridiagonal-matrix-arpack-jl-vs-scipy/15566)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 3\
**Last updated:** [September 27, 2018, 4:04pm UTC](https://discourse.julialang.org/t/eigs-for-sparse-tridiagonal-matrix-arpack-jl-vs-scipy/15566 "2018-09-27T16:04:41Z")

</div>

MWE: using LinearAlgebra, SparseArrays, Arpack, PyCall, BenchmarkTools @pyimport scipy.sparse as pysparse @pyimport scipy.sparse.linalg as pylinalg N = 100\_000 X = sparse(Tridiagonal(1.0:N-1, 1.0:N, 1.0:N-1)) X = X + X…

---

## [Julia 0.7/1.0: How to test dev packages ](https://discourse.julialang.org/t/julia-0-7-1-0-how-to-test-dev-packages/15516)

<div class="topic-metadata">

**Author:** [@silviacaprioli](https://discourse.julialang.org/u/silviacaprioli)\
**Replies:** 5\
**Last updated:** [September 27, 2018, 3:33pm UTC](https://discourse.julialang.org/t/julia-0-7-1-0-how-to-test-dev-packages/15516 "2018-09-27T15:33:27Z")

</div>

Hello, I’m having some troubles in testing a package I’m developing. I have the current official version of the package taken from git repository (using “add” command), stored in \`.julia/packages/MyPackage. I also dow…

---

## [Test-specific dependencies](https://discourse.julialang.org/t/test-specific-dependencies/15550)

<div class="topic-metadata">

**Author:** [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Replies:** 7\
**Last updated:** [September 27, 2018, 3:09pm UTC](https://discourse.julialang.org/t/test-specific-dependencies/15550 "2018-09-27T15:09:25Z")

</div>

In our package, we have a number of dependencies used for testing only. For end users of our package, we don’t wish to enforce those dependencies. It seems that the suggested way of achieving this is using Test-specific …

---

## [How to debug a crash?](https://discourse.julialang.org/t/how-to-debug-a-crash/15544)

<div class="topic-metadata">

**Author:** [@pochoi](https://discourse.julialang.org/u/pochoi)\
**Replies:** 4\
**Last updated:** [September 27, 2018, 2:56pm UTC](https://discourse.julialang.org/t/how-to-debug-a-crash/15544 "2018-09-27T14:56:58Z")

</div>

Meet a crash like this when running certain part of my codes. Unreachable reached at 0x11a03de66 signal (4): Illegal instruction: 4 in expression starting at no file:0 top-level scope at ./REPL\[17\]:2 \[inlined\] top-leve…

---

## [Use scientific notation in z-scale of contour plot in plots.jl](https://discourse.julialang.org/t/use-scientific-notation-in-z-scale-of-contour-plot-in-plots-jl/15559)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [September 27, 2018, 1:43pm UTC](https://discourse.julialang.org/t/use-scientific-notation-in-z-scale-of-contour-plot-in-plots-jl/15559 "2018-09-27T13:43:16Z")

</div>

Hi all- I was wondering if there is a way to use scientific notation for the z-scale of a contour plot? I was hoping there would be an attribute that is analogous to yformatter=:scientific.

---

## [Error writing or reading HDF5 file](https://discourse.julialang.org/t/error-writing-or-reading-hdf5-file/15549)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 3\
**Last updated:** [September 27, 2018, 1:21pm UTC](https://discourse.julialang.org/t/error-writing-or-reading-hdf5-file/15549 "2018-09-27T13:21:11Z")

</div>

I am trying to write an hdf5 file in julia 1.0 and win 10. the code is given below The following code works A = collect(reshape(1:120, 15, 8)); h5write("test3.h5", "mygroup2", A) data = h5read("test3.h5", "mygroup2") …

---

## [Product of a scalar with Symmetric is not symmetric (while Symmetric times scalar is)](https://discourse.julialang.org/t/product-of-a-scalar-with-symmetric-is-not-symmetric-while-symmetric-times-scalar-is/15555)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 4\
**Last updated:** [September 27, 2018, 1:01pm UTC](https://discourse.julialang.org/t/product-of-a-scalar-with-symmetric-is-not-symmetric-while-symmetric-times-scalar-is/15555 "2018-09-27T13:01:26Z")

</div>

julia\> using LinearAlgebra julia\> A = Symmetric(rand(4,4)) 4×4 Symmetric{Float64,Array{Float64,2}}: 0.0410142 0.31574 0.0784682 0.649851 0.31574 0.315311 0.908595 0.376246 0.0784682 0.908595 0.758999 0.9…

---

## [\[ANN\] Embedding Rust Library in a Julia Package](https://discourse.julialang.org/t/ann-embedding-rust-library-in-a-julia-package/15470)

<div class="topic-metadata">

**Author:** [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Replies:** 3\
**Last updated:** [September 27, 2018, 12:52pm UTC](https://discourse.julialang.org/t/ann-embedding-rust-library-in-a-julia-package/15470 "2018-09-27T12:52:07Z")

</div>

I’m putting up a set of examples on how to embed a Rust Library in a Julia Package. Interfacing between Julia and Rust library is done using Rust’s FFI: the Rust library is exposed as a C dynamic library, and Julia will…

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

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