# General Usage

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

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

**Page:** 865

---

## [Base Method for isless on arrays or matrices](https://discourse.julialang.org/t/base-method-for-isless-on-arrays-or-matrices/24424)

<div class="topic-metadata">

**Author:** [@Volker](https://discourse.julialang.org/u/Volker)\
**Replies:** 4\
**Last updated:** [May 21, 2019, 12:55pm UTC](https://discourse.julialang.org/t/base-method-for-isless-on-arrays-or-matrices/24424 "2019-05-21T12:55:43Z")

</div>

Hello, I was wondering if there is a method which compares each element of an array or matrix with another array or matrix or constant. I searched in methods(\<), but I didn´t find anything. Best regards, Volker

---

## [Why is this code slow?](https://discourse.julialang.org/t/why-is-this-code-slow/24403)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 9\
**Last updated:** [May 21, 2019, 8:42am UTC](https://discourse.julialang.org/t/why-is-this-code-slow/24403 "2019-05-21T08:42:47Z")

</div>

I am trying to draw a random index from a vector of probabilities. Here is my code: import Random using Random: AbstractRNG struct FastCategorical \_cdf::Vector{Float64} function FastCategorical(pdf) cdf…

---

## [Running the same function with multiple inputs using pmap](https://discourse.julialang.org/t/running-the-same-function-with-multiple-inputs-using-pmap/24381)

<div class="topic-metadata">

**Author:** [@magzpavz](https://discourse.julialang.org/u/magzpavz)\
**Replies:** 2\
**Last updated:** [May 21, 2019, 1:00am UTC](https://discourse.julialang.org/t/running-the-same-function-with-multiple-inputs-using-pmap/24381 "2019-05-21T01:00:45Z")

</div>

I have a function which takes about 10 minutes to run. It is primarily in calling two external commands. I previously was using a bash script to run it. I need to run this function on several different inputs and would l…

---

## [DataFrames: display in a Jupyter notebook](https://discourse.julialang.org/t/dataframes-display-in-a-jupyter-notebook/24411)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 4\
**Last updated:** [May 21, 2019, 12:28am UTC](https://discourse.julialang.org/t/dataframes-display-in-a-jupyter-notebook/24411 "2019-05-21T00:28:48Z")

</div>

I’d like to display all 9 columns of a DataFrame in Jupyter notebook, but the system decides to omit the 2 rightmost columns because it thinks there is a lack of space. I know I can show all columns with the show(datafr…

---

## [Julia vs. Chapel performance](https://discourse.julialang.org/t/julia-vs-chapel-performance/24098)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 2\
**Last updated:** [May 20, 2019, 7:41pm UTC](https://discourse.julialang.org/t/julia-vs-chapel-performance/24098 "2019-05-20T19:41:24Z")

</div>

I saw this Julia vs. Chapel performance comparison in the benchmarksgame website. It seems that for all the programs, Chapel is very close to or much faster than Julia. In addition, the Chapel codes are as easy to unders…

---

## [Pinned dependency ignored when adding my package to a fresh install of Julia](https://discourse.julialang.org/t/pinned-dependency-ignored-when-adding-my-package-to-a-fresh-install-of-julia/24410)

<div class="topic-metadata">

**Author:** [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Replies:** 5\
**Last updated:** [May 20, 2019, 6:35pm UTC](https://discourse.julialang.org/t/pinned-dependency-ignored-when-adding-my-package-to-a-fresh-install-of-julia/24410 "2019-05-20T18:35:59Z")

</div>

I’m developing a package with an energy system model (working name “Supergrid”). It’s in a private repo on Github for now but will soon be open sourced. I wanted to test if my package worked on a different machine with a…

---

## [Local filtering of nonuniform points](https://discourse.julialang.org/t/local-filtering-of-nonuniform-points/24407)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 2\
**Last updated:** [May 20, 2019, 5:09pm UTC](https://discourse.julialang.org/t/local-filtering-of-nonuniform-points/24407 "2019-05-20T17:09:28Z")

</div>

Hi! There are packages like LocalFilters and ImageFiltering that can apply a function, e.g. mean, to a rolling window across an array. However, I could not find any package which supports a rolling window defined not by …

---

## [Finding the number of arguments of an anonymous function](https://discourse.julialang.org/t/finding-the-number-of-arguments-of-an-anonymous-function/24394)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 31\
**Last updated:** [May 20, 2019, 4:14pm UTC](https://discourse.julialang.org/t/finding-the-number-of-arguments-of-an-anonymous-function/24394 "2019-05-20T16:14:51Z")

</div>

I have an API wherein a kwarg is a function. function apifunc(; f::Function = identity) ... end I would like to do something different depending on the number of arguments of f, so that apifunc(f = x -\> 2) calls \_apifu…

---

## [Png resolution](https://discourse.julialang.org/t/png-resolution/24330)

<div class="topic-metadata">

**Author:** [@pistacliffcho](https://discourse.julialang.org/u/pistacliffcho)\
**Replies:** 7\
**Last updated:** [May 20, 2019, 2:32pm UTC](https://discourse.julialang.org/t/png-resolution/24330 "2019-05-20T14:32:12Z")

</div>

How can I increase the resolution in a plot saved by png?

---

## [Bunch-Kaufman with rook pivoting](https://discourse.julialang.org/t/bunch-kaufman-with-rook-pivoting/24379)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 5\
**Last updated:** [May 20, 2019, 2:30pm UTC](https://discourse.julialang.org/t/bunch-kaufman-with-rook-pivoting/24379 "2019-05-20T14:30:32Z")

</div>

I asked this question on Slack but didn’t get an answer. Could someone explain how to use the Bunch-Kaufman factorization with rook pivoting? julia\> A = \[0.271242 0.657867 1.14586; 0.657867 1.20111 1.13588; 1.14586 1.13…

---

## [@btime println("someText")?](https://discourse.julialang.org/t/btime-println-sometext/24401)

<div class="topic-metadata">

**Author:** [@mwolff](https://discourse.julialang.org/u/mwolff)\
**Replies:** 2\
**Last updated:** [May 20, 2019, 2:18pm UTC](https://discourse.julialang.org/t/btime-println-sometext/24401 "2019-05-20T14:18:25Z")

</div>

Hello, what’s wrong with the @btime macro when measuring the println function? Runs zig passes until it stops. Is this normal or is there a parameter that it will stop after a run. With @time there is no problem. bes…

---

## [JuMP - variable constraint depending on variable](https://discourse.julialang.org/t/jump-variable-constraint-depending-on-variable/24313)

<div class="topic-metadata">

**Author:** [@Ulrich](https://discourse.julialang.org/u/Ulrich)\
**Replies:** 5\
**Last updated:** [May 20, 2019, 1:59pm UTC](https://discourse.julialang.org/t/jump-variable-constraint-depending-on-variable/24313 "2019-05-20T13:59:13Z")

</div>

Hey, I need some help with JuMP. I am trying to modell Liquid-Liquid Equilirum. @variable(l, xp1\[1:n\_komp\]) @constraint(l, gammap1 == GAMMAP1(n\_komp, t, xp1)) To do this, I need an activity coeff., which is dependent…

---

## [Compile time exponentiation](https://discourse.julialang.org/t/compile-time-exponentiation/24390)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 6\
**Last updated:** [May 20, 2019, 10:09am UTC](https://discourse.julialang.org/t/compile-time-exponentiation/24390 "2019-05-20T10:09:28Z")

</div>

I want to evaluate x^y at compile time. The reason is to facilitate efficient construction of NTuple using ntuple(f, Val(N)) method. Compare bar1 and bar2 functions below: struct Foo end getX(::Foo) = 5 function bar…

---

## [Pkg.instantiate() error](https://discourse.julialang.org/t/pkg-instantiate-error/24386)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 2\
**Last updated:** [May 20, 2019, 6:33am UTC](https://discourse.julialang.org/t/pkg-instantiate-error/24386 "2019-05-20T06:33:12Z")

</div>

Hi, When I start Julia and load packages - e.g. I type using Calculus - I get an error that says it cannot find the package and that I need to use Pkg.instantiate(). After I do that, the package loads. It is annoying as…

---

## [Running in world age ... while current world is](https://discourse.julialang.org/t/running-in-world-age-while-current-world-is/23113)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 9\
**Last updated:** [May 20, 2019, 3:56am UTC](https://discourse.julialang.org/t/running-in-world-age-while-current-world-is/23113 "2019-05-20T03:56:15Z")

</div>

Hi, When I run some functions in Julia I obtain this error: The applicable method may be too new: running in world age 26887, while current world is 26894. If I run the code again, there is no error. This is a systemat…

---

## [How to call and get var to/from file.exe](https://discourse.julialang.org/t/how-to-call-and-get-var-to-from-file-exe/24359)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 4\
**Last updated:** [May 19, 2019, 6:42am UTC](https://discourse.julialang.org/t/how-to-call-and-get-var-to-from-file-exe/24359 "2019-05-19T06:42:37Z")

</div>

in C++ int main() { return 70; } compiled program zwrot.exe julia\> cmd = Cmd(\`zwrot.exe\`) \`zwrot.exe\` julia\> run(cmd) ERROR: failed process: Process(\`zwrot.exe\`, ProcessExited(70)) \[70\] Stacktrace: \[1\] error(::S…

---

## [Unexpected output for @which with keyword constructor](https://discourse.julialang.org/t/unexpected-output-for-which-with-keyword-constructor/24373)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 2\
**Last updated:** [May 19, 2019, 10:31am UTC](https://discourse.julialang.org/t/unexpected-output-for-which-with-keyword-constructor/24373 "2019-05-19T10:31:15Z")

</div>

The output for @which Hammer(weight = 25) is not what I expected, nor is it consistent with the other invocations. Not sure if bug, known issue, or by design: abstract type Product end abstract type Tool \<: Product end…

---

## [Type annotation for one-line parametric methods](https://discourse.julialang.org/t/type-annotation-for-one-line-parametric-methods/21446)

<div class="topic-metadata">

**Author:** [@pnalysz](https://discourse.julialang.org/u/pnalysz)\
**Replies:** 2\
**Last updated:** [May 19, 2019, 1:50am UTC](https://discourse.julialang.org/t/type-annotation-for-one-line-parametric-methods/21446 "2019-05-19T01:50:00Z")

</div>

Hi, Why do I get error for f3 while both f1 and f2 are correct? Is there any special syntax for type annotation of one-line parametric methods? function f1(v::Base.Vector{T})::Core.Bool where {T} return true end f…

---

## [Changing default package installation directory](https://discourse.julialang.org/t/changing-default-package-installation-directory/24363)

<div class="topic-metadata">

**Author:** [@devlwkyan](https://discourse.julialang.org/u/devlwkyan)\
**Replies:** 1\
**Last updated:** [May 18, 2019, 10:06pm UTC](https://discourse.julialang.org/t/changing-default-package-installation-directory/24363 "2019-05-18T22:06:30Z")

</div>

Is there are way to change the default Julia package installation directory from /home/user/./julia to some other location on linux?

---

## [Help me out with this syntax, please!](https://discourse.julialang.org/t/help-me-out-with-this-syntax-please/24287)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 12\
**Last updated:** [May 18, 2019, 3:47pm UTC](https://discourse.julialang.org/t/help-me-out-with-this-syntax-please/24287 "2019-05-18T15:47:28Z")

</div>

I’m attempting to learn a new package and there is an operation being performed on two arrays in the example code that I don’t understand: +(yth\[3:end\], ysh...) yth is of type Array{Float64,1} and ysh is of type Array{…

---

## [Fixing aspect ratio and viewing angle of 3D plots using Plots.jl](https://discourse.julialang.org/t/fixing-aspect-ratio-and-viewing-angle-of-3d-plots-using-plots-jl/1556)

<div class="topic-metadata">

**Author:** [@sonicsmooth](https://discourse.julialang.org/u/sonicsmooth)\
**Replies:** 8\
**Last updated:** [May 18, 2019, 1:17pm UTC](https://discourse.julialang.org/t/fixing-aspect-ratio-and-viewing-angle-of-3d-plots-using-plots-jl/1556 "2019-05-18T13:17:42Z")

</div>

Hi, I’m trying out the various backends available for Plots.jl. I’m looking for the functions to set the viewing angle and aspect ratios for plot3d() plots. With gr and pyplot, the plots come out sqashed. With glvisua…

---

## [Group as variable in statsplots](https://discourse.julialang.org/t/group-as-variable-in-statsplots/24352)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [May 18, 2019, 12:58pm UTC](https://discourse.julialang.org/t/group-as-variable-in-statsplots/24352 "2019-05-18T12:58:15Z")

</div>

Hi- I would like to pass a variable to the keyword group in StatsPlots, but I receive an error. Here is a simple example: using DataFrames,StatsPlots df = DataFrame(a=rand(100),b=rand(100),c=rand(1:2,100),d=rand(1:2,10…

---

## [PyCall imports anaconda package but fails to import package module](https://discourse.julialang.org/t/pycall-imports-anaconda-package-but-fails-to-import-package-module/24349)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 2\
**Last updated:** [May 18, 2019, 12:49pm UTC](https://discourse.julialang.org/t/pycall-imports-anaconda-package-but-fails-to-import-package-module/24349 "2019-05-18T12:49:05Z")

</div>

I have built PyCall with anaconda python. I can import python packages, but cannot import submodules of the package. Here is the console output. julia\> versioninfo() Julia Version 1.1.0 Commit 80516ca202\* (2019-01-21 2…

---

## [IJulia problem](https://discourse.julialang.org/t/ijulia-problem/24319)

<div class="topic-metadata">

**Author:** [@Peter\_Waweru](https://discourse.julialang.org/u/Peter_Waweru)\
**Replies:** 12\
**Last updated:** [May 18, 2019, 10:36am UTC](https://discourse.julialang.org/t/ijulia-problem/24319 "2019-05-18T10:36:55Z")

</div>

Every time i try to open a new Ijulia notebook i keep getting the following message: notebook() \[ Info: running setenv('C:\\Users\\admin\\.julia\\conda\\3\\Scripts\\jupyter.exe' notebook,\[“=::=::\\”, “USERDOMAIN\_ROAMINGPROFILE…

---

## [Intent of \`Base.dump\` function](https://discourse.julialang.org/t/intent-of-base-dump-function/24321)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 5\
**Last updated:** [May 17, 2019, 6:55pm UTC](https://discourse.julialang.org/t/intent-of-base-dump-function/24321 "2019-05-17T18:55:50Z")

</div>

As someone making custom data structures, I’m curious, how is dump meant to be used? Are there specific formatting constraints implied? What would constitute expected extension of this function to a user-defined type? …

---

## [Itent of \`Base.summary\` function](https://discourse.julialang.org/t/itent-of-base-summary-function/24323)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 1\
**Last updated:** [May 17, 2019, 4:51pm UTC](https://discourse.julialang.org/t/itent-of-base-summary-function/24323 "2019-05-17T16:51:02Z")

</div>

I’m curious, how is summary meant to be used? From the description, I get that summary should parrot the type information and the size of the object, but not the actual data. This seems quite useful, as a complement to d…

---

## [Methodswith question regarding methods from other modules](https://discourse.julialang.org/t/methodswith-question-regarding-methods-from-other-modules/24292)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 2\
**Last updated:** [May 17, 2019, 10:39am UTC](https://discourse.julialang.org/t/methodswith-question-regarding-methods-from-other-modules/24292 "2019-05-17T10:39:32Z")

</div>

I have a question why methods with doesn’t return functions from other modules? module EE export identify identify(x::T) where T = x end module DD export f export…

---

## [How use break in loop if ? ERROR: syntax: break or continue outside loop](https://discourse.julialang.org/t/how-use-break-in-loop-if-error-syntax-break-or-continue-outside-loop/24307)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 6\
**Last updated:** [May 17, 2019, 10:18am UTC](https://discourse.julialang.org/t/how-use-break-in-loop-if-error-syntax-break-or-continue-outside-loop/24307 "2019-05-17T10:18:34Z")

</div>

julia\> if 1\>0 println("Stop") ;break else println("Go") end ERROR: syntax: break or continue outside loop Thanks Paul

---

## [Disable global RNG](https://discourse.julialang.org/t/disable-global-rng/20690)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 6\
**Last updated:** [May 17, 2019, 8:52am UTC](https://discourse.julialang.org/t/disable-global-rng/20690 "2019-05-17T08:52:43Z")

</div>

In my simulation, I make frequent use of random numbers. I want everything to be reproducible, so I explicitly seed a single RNG and pass it around as needed. A few times now I’ve made the mistake of calling rand(n) ra…

---

## [Problem calling string parse + eval from C++](https://discourse.julialang.org/t/problem-calling-string-parse-eval-from-c/23701)

<div class="topic-metadata">

**Author:** [@alligatorme](https://discourse.julialang.org/u/alligatorme)\
**Replies:** 13\
**Last updated:** [May 17, 2019, 5:18am UTC](https://discourse.julialang.org/t/problem-calling-string-parse-eval-from-c/23701 "2019-05-17T05:18:56Z")

</div>

s::String|\>Meta.parse|\>eval seems good in REPL,but not works when calling julia from C++. I have no idea why? but the following works in both: getproperty(Main,s::String|\>Symbol) return DataType define.jl: #!/usr/…

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

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