# General Usage

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

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

**Page:** 882

---

## [Knet and JLD question](https://discourse.julialang.org/t/knet-and-jld-question/22383)

<div class="topic-metadata">

**Author:** [@omalled](https://discourse.julialang.org/u/omalled)\
**Replies:** 2\
**Last updated:** [March 27, 2019, 4:52pm UTC](https://discourse.julialang.org/t/knet-and-jld-question/22383 "2019-03-27T16:52:22Z")

</div>

I have been playing around with Knet, and it is great! However, I have run into a bit of trouble trying to move results from a machine with a GPU to another machine without an (NVIDIA) GPU. Essentially, what I have done…

---

## [VSCode automatically links to Julia](https://discourse.julialang.org/t/vscode-automatically-links-to-julia/22388)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 1\
**Last updated:** [March 27, 2019, 3:10pm UTC](https://discourse.julialang.org/t/vscode-automatically-links-to-julia/22388 "2019-03-27T15:10:10Z")

</div>

I was wondering why Juno can directly find my installed Julia both in Windows and Linux, but the VSCode Julia extension needs manual input of path of Julia. Is it possible for VSCode to link to Julia automatically? I gue…

---

## [Neat way to return a single row with Query.jl pipes](https://discourse.julialang.org/t/neat-way-to-return-a-single-row-with-query-jl-pipes/22401)

<div class="topic-metadata">

**Author:** [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Replies:** 1\
**Last updated:** [March 27, 2019, 12:14pm UTC](https://discourse.julialang.org/t/neat-way-to-return-a-single-row-with-query-jl-pipes/22401 "2019-03-27T12:14:21Z")

</div>

Hello, This is more of a code style thing, but I often need to construct a Query.jl pipeline (|\>) that returns a single row, not a query result with multiple rows. Is there a neat way of doing this? Currently, I use col…

---

## [Strategy to manage two similar macros which define functions](https://discourse.julialang.org/t/strategy-to-manage-two-similar-macros-which-define-functions/22380)

<div class="topic-metadata">

**Author:** [@giordano](https://discourse.julialang.org/u/giordano)\
**Replies:** 9\
**Last updated:** [March 27, 2019, 10:36am UTC](https://discourse.julialang.org/t/strategy-to-manage-two-similar-macros-which-define-functions/22380 "2019-03-27T10:36:34Z")

</div>

I have two long macros that are almost equal, apart from a few lines: macro m1(#= args of m1... =#) # set some variables in m1 and m2 before returning the expression... # define some other variables only in m1..…

---

## [Rebugger stymied](https://discourse.julialang.org/t/rebugger-stymied/22228)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 4\
**Last updated:** [March 27, 2019, 8:45am UTC](https://discourse.julialang.org/t/rebugger-stymied/22228 "2019-03-27T08:45:14Z")

</div>

Sometimes the most basic things stymy me. I can’t get Rebugger to run. I have added JuliaInterpreter and Rebugger. I try: using Rebugger then, per the documentation I try: a = \[4,3,1,2\] sort(a) -i On MacOS, I set…

---

## [Regex escape chars](https://discourse.julialang.org/t/regex-escape-chars/22363)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 3\
**Last updated:** [March 27, 2019, 4:47am UTC](https://discourse.julialang.org/t/regex-escape-chars/22363 "2019-03-27T04:47:26Z")

</div>

I’m currently trying to use ArgParse so that a user can change a regex pattern in the code. I encountered the following issue with Regex during that. Why is Regex("\\.git") not valid? The error is invalid escape sequen…

---

## [Include mystery](https://discourse.julialang.org/t/include-mystery/22360)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 11\
**Last updated:** [March 27, 2019, 4:41am UTC](https://discourse.julialang.org/t/include-mystery/22360 "2019-03-27T04:41:58Z")

</div>

I have two files. The first includes the second. The compiler complains about the variable var not being defined in the second file. Why? First file: function a() var = 1; include("b.jl") end a() Second file: @show…

---

## [What's up with UnitRange?](https://discourse.julialang.org/t/whats-up-with-unitrange/22321)

<div class="topic-metadata">

**Author:** [@mosiman](https://discourse.julialang.org/u/mosiman)\
**Replies:** 17\
**Last updated:** [March 27, 2019, 3:01am UTC](https://discourse.julialang.org/t/whats-up-with-unitrange/22321 "2019-03-27T03:01:57Z")

</div>

Consider in matlab: \>\> 1.12\*100:0.02\*100:1.2\*100 ans = 112 114 116 118 120 In julia I get julia\> 1.12\*100:0.02\*100:1.2\*100 112.00000000000001:2.0:118.00000000000001 whi…

---

## [Using \* as a wildcard in backtick commands](https://discourse.julialang.org/t/using-as-a-wildcard-in-backtick-commands/6094)

<div class="topic-metadata">

**Author:** [@dehann](https://discourse.julialang.org/u/dehann)\
**Replies:** 5\
**Last updated:** [March 27, 2019, 12:45am UTC](https://discourse.julialang.org/t/using-as-a-wildcard-in-backtick-commands/6094 "2019-03-27T00:45:01Z")

</div>

Hi, I have seem to have a more intricate issue with backticks and string interpolation, and not sure what you mean by ‘command syntax’? To compile several java .class files into one .jar files, I need to do: run(\`jar c…

---

## [Treat UInt8 as a Bool in certain contexts?](https://discourse.julialang.org/t/treat-uint8-as-a-bool-in-certain-contexts/22366)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 3\
**Last updated:** [March 26, 2019, 7:10pm UTC](https://discourse.julialang.org/t/treat-uint8-as-a-bool-in-certain-contexts/22366 "2019-03-26T19:10:25Z")

</div>

I am writing some software that deals with parity check error correcting codes. I need to do a lot of matrix products for matrices over the field GF(2) (i.e. my matrices are binary matrices where 1+1=0). Because dot prod…

---

## [Package installation -- doesn't work](https://discourse.julialang.org/t/package-installation-doesnt-work/22354)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 4\
**Last updated:** [March 26, 2019, 5:44pm UTC](https://discourse.julialang.org/t/package-installation-doesnt-work/22354 "2019-03-26T17:44:17Z")

</div>

I’m trying to install an update of a package that used to work, by cloning it from GitHub. I get a weird error message: julia\> using Pkg julia\> Pkg.clone("https://github.com/OpenModelica/OMJulia.jl") ┌ Warning: Pkg.clo…

---

## [Having a little trouble with recursively defined structs](https://discourse.julialang.org/t/having-a-little-trouble-with-recursively-defined-structs/22285)

<div class="topic-metadata">

**Author:** [@ninjaaron](https://discourse.julialang.org/u/ninjaaron)\
**Replies:** 6\
**Last updated:** [March 26, 2019, 5:39pm UTC](https://discourse.julialang.org/t/having-a-little-trouble-with-recursively-defined-structs/22285 "2019-03-26T17:39:22Z")

</div>

I’m trying to build something that looks like a linked list but ain’t. That isn’t really the important part. InnerVector optionally contains a FakeList and FakeList contains an InnerVector. Opt = Union{T,Nothing} where …

---

## [The correct use of findfirst](https://discourse.julialang.org/t/the-correct-use-of-findfirst/22351)

<div class="topic-metadata">

**Author:** [@leiteiro](https://discourse.julialang.org/u/leiteiro)\
**Replies:** 4\
**Last updated:** [March 26, 2019, 3:01pm UTC](https://discourse.julialang.org/t/the-correct-use-of-findfirst/22351 "2019-03-26T15:01:57Z")

</div>

DOCS\> “You can search for the index of a particular character using the findfirst and findlast functions.” julia\> findfirst(isequal('('), "André(m, n)") 7 julia\> findfirst(isequal('('), "Andre(m, n)") 6 It seems clea…

---

## [Problem with atom using julia](https://discourse.julialang.org/t/problem-with-atom-using-julia/22163)

<div class="topic-metadata">

**Author:** [@danielcas](https://discourse.julialang.org/u/danielcas)\
**Replies:** 2\
**Last updated:** [March 26, 2019, 1:50pm UTC](https://discourse.julialang.org/t/problem-with-atom-using-julia/22163 "2019-03-26T13:50:17Z")

</div>

I’m using julia in atom, and I’m trying to open an excel file using ExcelReaders package. There is no problems when I run julia directly, but through atom gives me the following error message: "ERROR: LoadError: PyError…

---

## [Help with poor LinearInterpolation performance](https://discourse.julialang.org/t/help-with-poor-linearinterpolation-performance/22325)

<div class="topic-metadata">

**Author:** [@angelv](https://discourse.julialang.org/u/angelv)\
**Replies:** 10\
**Last updated:** [March 26, 2019, 2:10pm UTC](https://discourse.julialang.org/t/help-with-poor-linearinterpolation-performance/22325 "2019-03-26T14:10:38Z")

</div>

Hi, I’m trying to use the function LinearInterpolation from Interpolations.jl for the first time, but I guess I’m doing many things wrong, since I get very bad performance when compared with a similar IDL routine. The …

---

## [Allocating a space for a 1d array of matrices](https://discourse.julialang.org/t/allocating-a-space-for-a-1d-array-of-matrices/22342)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 2\
**Last updated:** [March 26, 2019, 10:18am UTC](https://discourse.julialang.org/t/allocating-a-space-for-a-1d-array-of-matrices/22342 "2019-03-26T10:18:22Z")

</div>

What is the right way to allocate space for a 1d array of matrices? In particular, I know that that in my algorithm I will have to determine a sequence matrices, each of size n x m with Float64 entries. The length N of…

---

## [Creating an iterator by wrapping another one](https://discourse.julialang.org/t/creating-an-iterator-by-wrapping-another-one/22280)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 9\
**Last updated:** [March 26, 2019, 7:00am UTC](https://discourse.julialang.org/t/creating-an-iterator-by-wrapping-another-one/22280 "2019-03-26T07:00:43Z")

</div>

I am trying to create an iterator that wraps another one. Let us assume that we have this iterator that returns l times the array a : struct Foo a::Array{Float64,1} l::Int end Base.iterate(foo::Foo) = iterate(f…

---

## [Correct distribution of packages to allow external definitions?](https://discourse.julialang.org/t/correct-distribution-of-packages-to-allow-external-definitions/22334)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 0\
**Last updated:** [March 26, 2019, 5:24am UTC](https://discourse.julialang.org/t/correct-distribution-of-packages-to-allow-external-definitions/22334 "2019-03-26T05:24:58Z")

</div>

I’m developing a helmholtz solver for thermodynamic properties so the idea. The idea is to define the Helmholtz function once and then other functions should be automatically defined for the type. for example: abstract …

---

## [Creating lots of anonymous functions in a loop](https://discourse.julialang.org/t/creating-lots-of-anonymous-functions-in-a-loop/22330)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 4\
**Last updated:** [March 26, 2019, 3:42am UTC](https://discourse.julialang.org/t/creating-lots-of-anonymous-functions-in-a-loop/22330 "2019-03-26T03:42:30Z")

</div>

This is probably a silly question, but… I often have a code pattern like the following: for n = 1:something\_large anon\_func = x -\> some\_func(x, n) #Example anon func that needs to be defined within loop i = fi…

---

## [JuliaDB - Importing](https://discourse.julialang.org/t/juliadb-importing/22322)

<div class="topic-metadata">

**Author:** [@alphasig329](https://discourse.julialang.org/u/alphasig329)\
**Replies:** 3\
**Last updated:** [March 26, 2019, 2:01am UTC](https://discourse.julialang.org/t/juliadb-importing/22322 "2019-03-26T02:01:35Z")

</div>

I am trying to load a CSV file using JuliaDB, but keep getting this error. Is there something that I am missing?

---

## [Function on array](https://discourse.julialang.org/t/function-on-array/22323)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 8\
**Last updated:** [March 26, 2019, 12:17am UTC](https://discourse.julialang.org/t/function-on-array/22323 "2019-03-26T00:17:31Z")

</div>

Hello Julia’s users, I have a little question: If I have a Mathematical function of 3 variações, let f(x) = x(1) + 3 sin(x(2)) + 1/x(3) And a array, let a = \[1,2,3\] of length 3. How can I availble this function along…

---

## [Suggestions to make Weave work with PyPlot?](https://discourse.julialang.org/t/suggestions-to-make-weave-work-with-pyplot/22314)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 1\
**Last updated:** [March 25, 2019, 10:04pm UTC](https://discourse.julialang.org/t/suggestions-to-make-weave-work-with-pyplot/22314 "2019-03-25T22:04:50Z")

</div>

I’m trying to make Weave work with PyPlot natively. It already works with the PyPlot backend in Plots.jl, but I’ve got some somewhat tricky plotting code that was easier to do natively than via the Plots.jl interface (pl…

---

## [Installing JuMP on JuliaBox](https://discourse.julialang.org/t/installing-jump-on-juliabox/22324)

<div class="topic-metadata">

**Author:** [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Replies:** 0\
**Last updated:** [March 25, 2019, 9:55pm UTC](https://discourse.julialang.org/t/installing-jump-on-juliabox/22324 "2019-03-25T21:55:39Z")

</div>

Is it possible to install JuMP 0.19 on JuliaBox? Currently when I try to do it on Julia 1.0.3 I get the message that the maximum allowed version is 0.18.5.

---

## [Libdl.find\_library does not find library in current directory](https://discourse.julialang.org/t/libdl-find-library-does-not-find-library-in-current-directory/22310)

<div class="topic-metadata">

**Author:** [@pedrohnv](https://discourse.julialang.org/u/pedrohnv)\
**Replies:** 2\
**Last updated:** [March 25, 2019, 8:57pm UTC](https://discourse.julialang.org/t/libdl-find-library-does-not-find-library-in-current-directory/22310 "2019-03-25T20:57:29Z")

</div>

For some reason Julia 1.1.0 can no longer find my shared library (written in C, compiled with MinGW gcc) on Windows 10 (64-bit). The commands I use are cd("mydir") run(\`ls mylib.dll\`) # is the lib in my current folder?…

---

## [Multidimensional array partial slice based on condition](https://discourse.julialang.org/t/multidimensional-array-partial-slice-based-on-condition/22320)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [March 25, 2019, 8:24pm UTC](https://discourse.julialang.org/t/multidimensional-array-partial-slice-based-on-condition/22320 "2019-03-25T20:24:13Z")

</div>

I have a multidimensional array X that I would like to filter by some condition Y defining a mask m as follows: X = randn(3,5,10) Y = randn(1,5,10) m = Y .\> 0.0 X\[mask\] Does X\[mask\] not make sense because the resulting…

---

## ["Functional State" Iterators & Why isn't this loop as fast as entitlement?](https://discourse.julialang.org/t/functional-state-iterators-why-isnt-this-loop-as-fast-as-entitlement/22282)

<div class="topic-metadata">

**Author:** [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Replies:** 5\
**Last updated:** [March 25, 2019, 12:05pm UTC](https://discourse.julialang.org/t/functional-state-iterators-why-isnt-this-loop-as-fast-as-entitlement/22282 "2019-03-25T12:05:09Z")

</div>

TLDR High level iterators (values(dict), etc.) are potentially \>3x slower than they could be… Why and how could they be improved? Let me lead with the real near term question: Why is the “ideal” iterator \>3x slower t…

---

## [How to write Array to file.xlsx?](https://discourse.julialang.org/t/how-to-write-array-to-file-xlsx/22317)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 0\
**Last updated:** [March 25, 2019, 6:24pm UTC](https://discourse.julialang.org/t/how-to-write-array-to-file-xlsx/22317 "2019-03-25T18:24:18Z")

</div>

How to write Array to XLSX? Big Array (10^5,10^2) 2 Many small arrays to many Sheets in one file.xlsx ? Thanks Paul

---

## [Is it possible to integrate Revise.jl into the Base library of Julia?](https://discourse.julialang.org/t/is-it-possible-to-integrate-revise-jl-into-the-base-library-of-julia/22291)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 9\
**Last updated:** [March 25, 2019, 10:01am UTC](https://discourse.julialang.org/t/is-it-possible-to-integrate-revise-jl-into-the-base-library-of-julia/22291 "2019-03-25T10:01:32Z")

</div>

When the source file is revised, users want it be known by Julia immediately, which is a quite natural idea. Is it possible to integrate Revise.jl into Julia Base library and let it track the source files whenever Julia…

---

## [Strange error in CI when tagging my package](https://discourse.julialang.org/t/strange-error-in-ci-when-tagging-my-package/22288)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 1\
**Last updated:** [March 24, 2019, 11:09pm UTC](https://discourse.julialang.org/t/strange-error-in-ci-when-tagging-my-package/22288 "2019-03-24T23:09:51Z")

</div>

Hi guys, I am trying to tag my package but I saw this strange error in CI and only in Julia 0.7: Any ideas? Here is the error: INFO: Verifying METADATA... ERROR: LoadError: packages with unsatisfiable requirements …

---

## [Args... in macros](https://discourse.julialang.org/t/args-in-macros/22256)

<div class="topic-metadata">

**Author:** [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Replies:** 6\
**Last updated:** [March 24, 2019, 8:49pm UTC](https://discourse.julialang.org/t/args-in-macros/22256 "2019-03-24T20:49:03Z")

</div>

I have a macro: @m1 which takes args... as argument as in: macro m1(args...) ... end I wanted to create e new macro @m2 which calls @m1 with an extra parameter. That is, I want @m2(a\[1:3\] = 3, key = :b) to be equivale…

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

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