# General Usage

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

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

**Page:** 892

---

## [MPI with srun, mpd error](https://discourse.julialang.org/t/mpi-with-srun-mpd-error/20999)

<div class="topic-metadata">

**Author:** [@Tims\_Corbett](https://discourse.julialang.org/u/Tims_Corbett)\
**Replies:** 0\
**Last updated:** [February 20, 2019, 2:24am UTC](https://discourse.julialang.org/t/mpi-with-srun-mpd-error/20999 "2019-02-20T02:24:32Z")

</div>

With intelmpi, srun results in the following error. What is the fix (other than using sbatch & mpirun)? srun -p slurm -n 3 -t 00:10:00 /julia-0.7.0/bin/julia ./mpitest.jl mpiexec\_backend-0-0.local: cannot connect to l…

---

## [Calling module and function form external file](https://discourse.julialang.org/t/calling-module-and-function-form-external-file/20982)

<div class="topic-metadata">

**Author:** [@Suraj\_Pawar](https://discourse.julialang.org/u/Suraj_Pawar)\
**Replies:** 1\
**Last updated:** [February 19, 2019, 10:04pm UTC](https://discourse.julialang.org/t/calling-module-and-function-form-external-file/20982 "2019-02-19T22:04:33Z")

</div>

I have a main.jl as below include(“hello.jl”) import hello hello.foo() and hello.jl is as below module hello function foo() println(“hello”) end end if I run main.jl, I get an error that package hello not foun…

---

## [Huge matrix declared as const in a package leading to StackOverflowError](https://discourse.julialang.org/t/huge-matrix-declared-as-const-in-a-package-leading-to-stackoverflowerror/20907)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 13\
**Last updated:** [February 19, 2019, 7:24pm UTC](https://discourse.julialang.org/t/huge-matrix-declared-as-const-in-a-package-leading-to-stackoverflowerror/20907 "2019-02-19T19:24:46Z")

</div>

Hi guys! I have some big matrices that are constants to compute Earth precession and nutation. They can be seen here. The problem is when I wrote the matrices without the Float64, the builds on Linux and Windows crashe…

---

## [Read from text file and ignore some part](https://discourse.julialang.org/t/read-from-text-file-and-ignore-some-part/20960)

<div class="topic-metadata">

**Author:** [@Suraj\_Pawar](https://discourse.julialang.org/u/Suraj_Pawar)\
**Replies:** 1\
**Last updated:** [February 19, 2019, 5:56pm UTC](https://discourse.julialang.org/t/read-from-text-file-and-ignore-some-part/20960 "2019-02-19T17:56:43Z")

</div>

I have a text file in which each row has the below format 2!ipr;\[1\]moin,\[2\]harmonic(16),\[3\]harmonic(1),\[4\]exp| 4 !ips;\[1\]AD(Jacobi),\[2\]GS(SOR/SUR),\[3\]SD,\[4\]CG,\[5\]BiCGSTAB|

---

## [Read from text file and skip some part of text](https://discourse.julialang.org/t/read-from-text-file-and-skip-some-part-of-text/20961)

<div class="topic-metadata">

**Author:** [@Suraj\_Pawar](https://discourse.julialang.org/u/Suraj_Pawar)\
**Replies:** 7\
**Last updated:** [February 19, 2019, 4:00pm UTC](https://discourse.julialang.org/t/read-from-text-file-and-skip-some-part-of-text/20961 "2019-02-19T16:00:19Z")

</div>

I have a text file which has below format 4 ! nx, ny 25 !x, y I want to read only the integer values and assign it to variables. I want to ignore the whitespace and the text after !. I tr…

---

## [How to access all field values for one field of a composite type array](https://discourse.julialang.org/t/how-to-access-all-field-values-for-one-field-of-a-composite-type-array/8287)

<div class="topic-metadata">

**Author:** [@LotteVictor](https://discourse.julialang.org/u/LotteVictor)\
**Replies:** 27\
**Last updated:** [February 19, 2019, 3:48pm UTC](https://discourse.julialang.org/t/how-to-access-all-field-values-for-one-field-of-a-composite-type-array/8287 "2019-02-19T15:48:46Z")

</div>

Hi there! I’ve created a composite type with: mutable struct TAdult id::Int64 strain::String hind::Float64 gind::Float64 tradeoff::Float64 end Then I create an array of that type with: function InitAdults(ft:…

---

## [Generate all words of a given size from a fixed alphabet](https://discourse.julialang.org/t/generate-all-words-of-a-given-size-from-a-fixed-alphabet/20949)

<div class="topic-metadata">

**Author:** [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Replies:** 5\
**Last updated:** [February 19, 2019, 2:46pm UTC](https://discourse.julialang.org/t/generate-all-words-of-a-given-size-from-a-fixed-alphabet/20949 "2019-02-19T14:46:58Z")

</div>

Hello, Say I have an alphabet of n symbols, and I want to generate all words of length k that can exist in that alphabet. What is the concise way to do that in Julia? I am expecting a list of n^k words. Writing k nested…

---

## [\[Solved\] Determinant and random matrix generation](https://discourse.julialang.org/t/solved-determinant-and-random-matrix-generation/20975)

<div class="topic-metadata">

**Author:** [@gdestouet](https://discourse.julialang.org/u/gdestouet)\
**Replies:** 6\
**Last updated:** [February 19, 2019, 2:45pm UTC](https://discourse.julialang.org/t/solved-determinant-and-random-matrix-generation/20975 "2019-02-19T14:45:48Z")

</div>

Hello, I was playing with random matrices when I noticed this strange behaviour : julia\> using LinearAlgebra julia\> a=randn(10,11); julia\> isposdef(a\*a') true julia\> isposdef(a'\*a) false I expected to have either w…

---

## [Functions with many arguments](https://discourse.julialang.org/t/functions-with-many-arguments/20974)

<div class="topic-metadata">

**Author:** [@milankl](https://discourse.julialang.org/u/milankl)\
**Replies:** 7\
**Last updated:** [February 19, 2019, 2:07pm UTC](https://discourse.julialang.org/t/functions-with-many-arguments/20974 "2019-02-19T14:07:20Z")

</div>

I’m currently running into a situation where my functions need to operate on many potentially huge matrices of slightly different sizes. I preallocate all memory first, such that all functions take elements from some of …

---

## [Setup and teardown in BenchmarkTools](https://discourse.julialang.org/t/setup-and-teardown-in-benchmarktools/20972)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 1\
**Last updated:** [February 19, 2019, 10:17am UTC](https://discourse.julialang.org/t/setup-and-teardown-in-benchmarktools/20972 "2019-02-19T10:17:17Z")

</div>

I really have the feeling that this is something trivial, since I am doing the same setup/teardown as I found here: https://github.com/Keno/StructIO.jl/issues/13 but that approach does not work to rewind the file before …

---

## [Interpolate pkg string a la pkg"status $x"](https://discourse.julialang.org/t/interpolate-pkg-string-a-la-pkg-status-x/20971)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 2\
**Last updated:** [February 19, 2019, 10:13am UTC](https://discourse.julialang.org/t/interpolate-pkg-string-a-la-pkg-status-x/20971 "2019-02-19T10:13:19Z")

</div>

x = "BenchmarkTools" # just an example pkg"status $x" # what I want but doesn't work Looking at the definition of @pkg\_str I figured I can do x = "BenchmarkTools" s = "status $x" Pkg.REPLMode.do\_cmd(Pkg.REPLMode.minire…

---

## [Pyplot axis tick marks no labels](https://discourse.julialang.org/t/pyplot-axis-tick-marks-no-labels/20927)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [February 19, 2019, 8:17am UTC](https://discourse.julialang.org/t/pyplot-axis-tick-marks-no-labels/20927 "2019-02-19T08:17:30Z")

</div>

Hi, I’m struggling to make pyplot do what I want, which I guess is not that difficult anyway… The fact is that I’m building a plot (in a subplot), and I need to have the y-axis tick marks in both the left and right y y-…

---

## [Can I make my code faster with parallelism, or just plain better coding?](https://discourse.julialang.org/t/can-i-make-my-code-faster-with-parallelism-or-just-plain-better-coding/20613)

<div class="topic-metadata">

**Author:** [@MrRobot](https://discourse.julialang.org/u/MrRobot)\
**Replies:** 33\
**Last updated:** [February 19, 2019, 7:00am UTC](https://discourse.julialang.org/t/can-i-make-my-code-faster-with-parallelism-or-just-plain-better-coding/20613 "2019-02-19T07:00:12Z")

</div>

I am trying to optimize a lennard-jones force calculation. When I first wrote it, It used millions of allocations and over 1 giB of memory, and these both increased if I looped over the algorithm. I have gotten it down t…

---

## [Metaprogramming: create function which takes arguments (vector and expression) to evaluate](https://discourse.julialang.org/t/metaprogramming-create-function-which-takes-arguments-vector-and-expression-to-evaluate/20965)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [February 19, 2019, 6:53am UTC](https://discourse.julialang.org/t/metaprogramming-create-function-which-takes-arguments-vector-and-expression-to-evaluate/20965 "2019-02-19T06:53:01Z")

</div>

I have an expression e = :(x\[3\] ^ 2.0) that I hope to turn into a function which will evaluate e at x given arguments e and x. I tried the below but am messing something up. function f(ex::Array{Float64,1}, expr::Expr)…

---

## [Deep copy a \`mutable struct\` defined with an inner constructor](https://discourse.julialang.org/t/deep-copy-a-mutable-struct-defined-with-an-inner-constructor/20954)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 2\
**Last updated:** [February 18, 2019, 10:41pm UTC](https://discourse.julialang.org/t/deep-copy-a-mutable-struct-defined-with-an-inner-constructor/20954 "2019-02-18T22:41:30Z")

</div>

I’m in Julia 1.0.3, and I have a mutable struct mutable struct MyStruct ID::Int64 VAL::Float64 function MyStruct(ID) b = new(ID) b.VAL = 0.0 end end defined through an inner constructor.…

---

## [Slim docker image with Julia + IJulia](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 5\
**Last updated:** [February 18, 2019, 5:07pm UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894 "2019-02-18T17:07:49Z")

</div>

I am searching for a Julia 1.0/1.1 + IJulia docker image not too big to distribute to my students (after adding to the image just a few more packages). The one from jupyter/datascience-notebook unfortunatelly is over 6.2…

---

## [Question about Revise.jl and its alternatives (if any)](https://discourse.julialang.org/t/question-about-revise-jl-and-its-alternatives-if-any/20858)

<div class="topic-metadata">

**Author:** [@simon](https://discourse.julialang.org/u/simon)\
**Replies:** 6\
**Last updated:** [February 18, 2019, 5:26pm UTC](https://discourse.julialang.org/t/question-about-revise-jl-and-its-alternatives-if-any/20858 "2019-02-18T17:26:30Z")

</div>

I tried to use Revise.jl to make some parameter tuning faster. However, it sometimes doesn’t work well for me, because it would not recompile the code after the modified line. Even when these code may use the variable(e.…

---

## [Julia very, very slow in cygwin shell](https://discourse.julialang.org/t/julia-very-very-slow-in-cygwin-shell/20943)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 0\
**Last updated:** [February 18, 2019, 4:41pm UTC](https://discourse.julialang.org/t/julia-very-very-slow-in-cygwin-shell/20943 "2019-02-18T16:41:16Z")

</div>

I ran into a very strange problem (after upgrading cygwin, of course), where julia started from within a cygwin shell was literally unusable. it took about 1-2 minutes to get a prompt and it seemed to be frozen once the…

---

## [Install package dependence from specific repository](https://discourse.julialang.org/t/install-package-dependence-from-specific-repository/20930)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 14\
**Last updated:** [February 18, 2019, 1:52pm UTC](https://discourse.julialang.org/t/install-package-dependence-from-specific-repository/20930 "2019-02-18T13:52:17Z")

</div>

Recently the package Keys.jl became unavailable for installation from its registered location https://github.com/bramtayl/Keys.jl, so it’s impossible to easily install packages dependent on it, e.g. JuliennedArrays. Fort…

---

## [Julia has exited. Press Enter to start a new session.](https://discourse.julialang.org/t/julia-has-exited-press-enter-to-start-a-new-session/20933)

<div class="topic-metadata">

**Author:** [@Rj\_Hu](https://discourse.julialang.org/u/Rj_Hu)\
**Replies:** 1\
**Last updated:** [February 18, 2019, 1:51pm UTC](https://discourse.julialang.org/t/julia-has-exited-press-enter-to-start-a-new-session/20933 "2019-02-18T13:51:15Z")

</div>

I am using Julia 1.1.0 via juno. I can’t start julia REPL through Juno. Each time I press run botton it just sending me a duplicate of “Julia has exited. Press Enter to start a new session.” notification. But I have no p…

---

## [Julia has exited. Press Enter to start a new session.](https://discourse.julialang.org/t/julia-has-exited-press-enter-to-start-a-new-session/16006)

<div class="topic-metadata">

**Author:** [@itfanr](https://discourse.julialang.org/u/itfanr)\
**Replies:** 4\
**Last updated:** [February 18, 2019, 1:19pm UTC](https://discourse.julialang.org/t/julia-has-exited-press-enter-to-start-a-new-session/16006 "2019-02-18T13:19:45Z")

</div>

I installed JuliaPro-0.6.4.1 on a new ubuntu 16.04 machine and start Juno but cannot start Julia REPL. The error is : Press Enter to start Julia. execvp(3) failed.: 没有那个文件或目录 Julia has exited. Press Enter to start a…

---

## [Metaprogramming for sorting networks](https://discourse.julialang.org/t/metaprogramming-for-sorting-networks/20862)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 6\
**Last updated:** [February 18, 2019, 9:52am UTC](https://discourse.julialang.org/t/metaprogramming-for-sorting-networks/20862 "2019-02-18T09:52:38Z")

</div>

I’m continuing my efforts to implement SIMD-friendly sorting in Julia, and I am trying to implement the basic sorting network steps. This is looking like a possible good use-case for metaprogramming (again), but it seems…

---

## [How to measure cache misses in Julia?](https://discourse.julialang.org/t/how-to-measure-cache-misses-in-julia/20875)

<div class="topic-metadata">

**Author:** [@phrmoy](https://discourse.julialang.org/u/phrmoy)\
**Replies:** 11\
**Last updated:** [February 18, 2019, 5:03am UTC](https://discourse.julialang.org/t/how-to-measure-cache-misses-in-julia/20875 "2019-02-18T05:03:05Z")

</div>

Hi there! Do we have a tool or the means for measuring cache misses in Julia? If we had a macro for this would really set Julia apart in the HPC world. I did search around here but did not find anything, thank you. Ped…

---

## [Pkg.update does not update RandomNumbers in Julia v1.1.0](https://discourse.julialang.org/t/pkg-update-does-not-update-randomnumbers-in-julia-v1-1-0/20922)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 2\
**Last updated:** [February 18, 2019, 3:03am UTC](https://discourse.julialang.org/t/pkg-update-does-not-update-randomnumbers-in-julia-v1-1-0/20922 "2019-02-18T03:03:46Z")

</div>

On Julia v1.1.0, Pkg.update() does not upgrade the package RandomNumbers to the latest version. There is no error, but RandomNumbers remains at v1.0.3. On Julia v0.7.0 and v1.0.3, RandomNumbers is successfully upgraded…

---

## [BinDeps help for windows](https://discourse.julialang.org/t/bindeps-help-for-windows/20886)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 2\
**Last updated:** [February 17, 2019, 10:58pm UTC](https://discourse.julialang.org/t/bindeps-help-for-windows/20886 "2019-02-17T22:58:37Z")

</div>

To install PATHSolver.jl in Windows, I used to use the following build.jl script: # Windows 32/64 provides(BuildProcess, (@build\_steps begin CreateDirectory(lib\_dir, true) CreateDirectory(src\_dir, tr…

---

## [How to show all columns with DataFrameRow?](https://discourse.julialang.org/t/how-to-show-all-columns-with-dataframerow/20883)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 1\
**Last updated:** [February 17, 2019, 9:08pm UTC](https://discourse.julialang.org/t/how-to-show-all-columns-with-dataframerow/20883 "2019-02-17T21:08:47Z")

</div>

The trick for DataFrame doesn’t work with DataFrameRow… julia\> show(df\[143639,:\], true) ERROR: MethodError: no method matching show(::DataFrameRow{DataFrame,DataFrames.Index}, ::Bool) Closest candidates are: show(::IO…

---

## [How do I stash the current Pkg environment for future use?](https://discourse.julialang.org/t/how-do-i-stash-the-current-pkg-environment-for-future-use/20908)

<div class="topic-metadata">

**Author:** [@aaowens](https://discourse.julialang.org/u/aaowens)\
**Replies:** 3\
**Last updated:** [February 17, 2019, 9:06pm UTC](https://discourse.julialang.org/t/how-do-i-stash-the-current-pkg-environment-for-future-use/20908 "2019-02-17T21:06:59Z")

</div>

Assume I have a project using some packages which currently works, and I want to stash it away in case I need it again a year or so later. Is there an easy way to stash the current package environment, kind of like git s…

---

## [Copying Project.toml doesn't install pakages (and throws error)](https://discourse.julialang.org/t/copying-project-toml-doesnt-install-pakages-and-throws-error/20897)

<div class="topic-metadata">

**Author:** [@shivchawla](https://discourse.julialang.org/u/shivchawla)\
**Replies:** 3\
**Last updated:** [February 17, 2019, 8:53pm UTC](https://discourse.julialang.org/t/copying-project-toml-doesnt-install-pakages-and-throws-error/20897 "2019-02-17T20:53:37Z")

</div>

I have a Project.toml file that I copy to new machine’s environment/v1.1 folder and run Pkg.resolve() to install all packages and dependencies. Is this the right way in Julia v1.1? In case it’s the right way, it break …

---

## [A question about defining a function inside another using metaprogramming](https://discourse.julialang.org/t/a-question-about-defining-a-function-inside-another-using-metaprogramming/20905)

<div class="topic-metadata">

**Author:** [@pdenapo](https://discourse.julialang.org/u/pdenapo)\
**Replies:** 1\
**Last updated:** [February 17, 2019, 4:22pm UTC](https://discourse.julialang.org/t/a-question-about-defining-a-function-inside-another-using-metaprogramming/20905 "2019-02-17T16:22:44Z")

</div>

Consider the following code for defining a function from a symbolic expression, using the metaprogramming facilities of Julia: expression\_G = :(x^3) G = eval(:(x-\>$expression\_G)) println(G(3)) it works as expected an…

---

## [Is any way to install multiple versions of same package?](https://discourse.julialang.org/t/is-any-way-to-install-multiple-versions-of-same-package/20898)

<div class="topic-metadata">

**Author:** [@rssdev10](https://discourse.julialang.org/u/rssdev10)\
**Replies:** 4\
**Last updated:** [February 17, 2019, 4:00pm UTC](https://discourse.julialang.org/t/is-any-way-to-install-multiple-versions-of-same-package/20898 "2019-02-17T16:00:43Z")

</div>

The issue is breaking compatibility of new versions of some packages. E.g. HTTP@0.8.0 might be installed by default without version declaring. But it is not compatible with Mux, Atom, WebSockets packages which are requir…

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

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