# General Usage

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

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

**Page:** 470

---

## [Genetic Algorithm with solutions over a discrete set of values](https://discourse.julialang.org/t/genetic-algorithm-with-solutions-over-a-discrete-set-of-values/78256)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.julialang.org/u/Jack)\
**Replies:** 0\
**Last updated:** [March 22, 2022, 7:32am UTC](https://discourse.julialang.org/t/genetic-algorithm-with-solutions-over-a-discrete-set-of-values/78256 "2022-03-22T07:32:10Z")

</div>

I checked out the genetic algorithm package Evolutionary.jl and find it doesn’t support that user specifying possible solutions over a discrete set of values, or solutions only take on integer values. I noticed that the g…

---

## [Calling julia functions from python](https://discourse.julialang.org/t/calling-julia-functions-from-python/6885)

<div class="topic-metadata">

**Author:** [@villageidiot](https://discourse.julialang.org/u/villageidiot)\
**Replies:** 17\
**Last updated:** [March 23, 2022, 4:49am UTC](https://discourse.julialang.org/t/calling-julia-functions-from-python/6885 "2022-03-23T04:49:42Z")

</div>

I’m interested in using Julia to speed up parts of a python program I’m writing. It seems pyjulia GitHub - JuliaPy/pyjulia: python interface to julia is the standard package to do this with? As it uses pycall I guess it…

---

## [Asof merge in Julia](https://discourse.julialang.org/t/asof-merge-in-julia/76948)

<div class="topic-metadata">

**Author:** [@ameresv](https://discourse.julialang.org/u/ameresv)\
**Replies:** 12\
**Last updated:** [March 23, 2022, 4:38am UTC](https://discourse.julialang.org/t/asof-merge-in-julia/76948 "2022-03-23T04:38:48Z")

</div>

Hi, I am trying to do an ‘as of’ merge in Julia with two large Dataframes, based on the time and the equipment\_id provided. As a manner of example, let me introduce the two df.head() using DataFrames df1 = DataFrame( …

---

## [Rowwise compuation in \`InMemoryDatasets.jl\` vs \`DataFrames.jl\`](https://discourse.julialang.org/t/rowwise-compuation-in-inmemorydatasets-jl-vs-dataframes-jl/78314)

<div class="topic-metadata">

**Author:** [@monopolynomial](https://discourse.julialang.org/u/monopolynomial)\
**Replies:** 2\
**Last updated:** [March 23, 2022, 4:31am UTC](https://discourse.julialang.org/t/rowwise-compuation-in-inmemorydatasets-jl-vs-dataframes-jl/78314 "2022-03-23T04:31:05Z")

</div>

byrow function in InMemoryDatasets is fantastic :+1: , I have done a small benchmark to compare its performance against DataFrames.jl for relatively wide tables. argmax in DataFrames.jl takes long! InMemoryDatasets jul…

---

## [Updating registry takes half an hour](https://discourse.julialang.org/t/updating-registry-takes-half-an-hour/78300)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 6\
**Last updated:** [March 22, 2022, 8:33pm UTC](https://discourse.julialang.org/t/updating-registry-takes-half-an-hour/78300 "2022-03-22T20:33:11Z")

</div>

I am running julia 1.6.2 on SMP Debian 4.9.189-3 with kernel version 4.9.0-11-amd64. Whenever I try to add a package, updating registry takes half an hour. I have tried to delete ~/.julia/registries folder, but the upda…

---

## [StructArrays (for Complex arrays) and DifferentialEquations not working together](https://discourse.julialang.org/t/structarrays-for-complex-arrays-and-differentialequations-not-working-together/78274)

<div class="topic-metadata">

**Author:** [@Elyco](https://discourse.julialang.org/u/Elyco)\
**Replies:** 4\
**Last updated:** [March 22, 2022, 7:12pm UTC](https://discourse.julialang.org/t/structarrays-for-complex-arrays-and-differentialequations-not-working-together/78274 "2022-03-22T19:12:01Z")

</div>

Hi everyone, I’m trying to solve some differential equations. But I can’t make it works together with StructArrays.jl :frowning: From the stacktrace I understand that when the differential equation package tries to se…

---

## ["connection refused (ECONNREFUSED)" when trying to mpirun julia on multiple nodes](https://discourse.julialang.org/t/connection-refused-econnrefused-when-trying-to-mpirun-julia-on-multiple-nodes/78253)

<div class="topic-metadata">

**Author:** [@knkn1711](https://discourse.julialang.org/u/knkn1711)\
**Replies:** 2\
**Last updated:** [March 22, 2022, 5:54pm UTC](https://discourse.julialang.org/t/connection-refused-econnrefused-when-trying-to-mpirun-julia-on-multiple-nodes/78253 "2022-03-22T17:54:50Z")

</div>

I am trying to run my julia code on multiple nodes of a cluster, which uses Moab and Torque for the scheduler and resource manager. In an interactive session I run the following: qsub -A open -l walltime=1:00:00 -l node…

---

## [IJulia kernel - JULIA\_LOAD\_PATH &| JULIA\_DEPOT\_PATH ignored/irrelevant -?](https://discourse.julialang.org/t/ijulia-kernel-julia-load-path-julia-depot-path-ignored-irrelevant/78289)

<div class="topic-metadata">

**Author:** [@lejeczek](https://discourse.julialang.org/u/lejeczek)\
**Replies:** 0\
**Last updated:** [March 22, 2022, 5:04pm UTC](https://discourse.julialang.org/t/ijulia-kernel-julia-load-path-julia-depot-path-ignored-irrelevant/78289 "2022-03-22T17:04:29Z")

</div>

Hi guys. Only have just started looking at Julia and ain’t a programmer and have this, most likely trivial, question. I set those envs: export JULIA\_LOAD\_PATH=“/opt/share/julia/extralib:$JULIA\_LOAD\_PATH” export JULIA…

---

## [Scope in multithreading](https://discourse.julialang.org/t/scope-in-multithreading/78276)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 9\
**Last updated:** [March 22, 2022, 3:14pm UTC](https://discourse.julialang.org/t/scope-in-multithreading/78276 "2022-03-22T15:14:12Z")

</div>

a rather basic question about scope in multithreading: a = 0.0 Threads.@threads for i in 1:10 b = fun(i) a += b end in the above code: is a global and shared by all threads? is b local to each thread? i.e. a …

---

## [Specializing on keyword arguments](https://discourse.julialang.org/t/specializing-on-keyword-arguments/78263)

<div class="topic-metadata">

**Author:** [@etienne\_dg](https://discourse.julialang.org/u/etienne_dg)\
**Replies:** 7\
**Last updated:** [March 22, 2022, 2:44pm UTC](https://discourse.julialang.org/t/specializing-on-keyword-arguments/78263 "2022-03-22T14:44:37Z")

</div>

I have a function f(a; b=default\_b, c=default\_c), and want to implement a method f(a) = f(a, b=default\_b, c=c\_specialized\_for\_default\_b), which should override f when neither b and c are provided. If I implement it lik…

---

## [Old question: How to clear the custom function in Julia REPL?](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 5\
**Last updated:** [March 22, 2022, 2:39pm UTC](https://discourse.julialang.org/t/old-question-how-to-clear-the-custom-function-in-julia-repl/77848 "2022-03-22T14:39:44Z")

</div>

How do you remove a function you have created when working in the Julia REPL? Can this be done without restarting the session? This is an old question several years ago. I just want to check if there is new updates in J…

---

## [Large allocations for imported text files](https://discourse.julialang.org/t/large-allocations-for-imported-text-files/78239)

<div class="topic-metadata">

**Author:** [@Jdbeck66](https://discourse.julialang.org/u/Jdbeck66)\
**Replies:** 2\
**Last updated:** [March 22, 2022, 12:17pm UTC](https://discourse.julialang.org/t/large-allocations-for-imported-text-files/78239 "2022-03-22T12:17:46Z")

</div>

I’m importing 6 text files that are each between 5 and 8 GB each using BioJulia’s FASTX. I’m using the code below to read in the data I want to an array for further analysis and processing. function getsequences(file,W…

---

## [Numerical differentiation with bump size](https://discourse.julialang.org/t/numerical-differentiation-with-bump-size/78254)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [March 22, 2022, 9:30am UTC](https://discourse.julialang.org/t/numerical-differentiation-with-bump-size/78254 "2022-03-22T09:30:16Z")

</div>

Is there a numerical differentiation package that allows you to specify the size of the bump ? I’d like to do f(x + d) - f(x) and specify the d (e.g. 0.001) FiniteDifferences seems to focus on approxim…

---

## [Using Julia to install system wide CUDA stack?](https://discourse.julialang.org/t/using-julia-to-install-system-wide-cuda-stack/78257)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 0\
**Last updated:** [March 22, 2022, 8:18am UTC](https://discourse.julialang.org/t/using-julia-to-install-system-wide-cuda-stack/78257 "2022-03-22T08:18:10Z")

</div>

It is amazing how a single \]add CUDA automatically installs a private CUDA stack in a pain-free way. Sometimes however I need a CUDA installation for non-julia applications, like pytorch etc. Is there a way to get a “glo…

---

## [@threads fails when interating over a dictionary](https://discourse.julialang.org/t/threads-fails-when-interating-over-a-dictionary/78249)

<div class="topic-metadata">

**Author:** [@evan-wehi](https://discourse.julialang.org/u/evan-wehi)\
**Replies:** 1\
**Last updated:** [March 22, 2022, 3:04am UTC](https://discourse.julialang.org/t/threads-fails-when-interating-over-a-dictionary/78249 "2022-03-22T03:04:36Z")

</div>

Trying to parallelise over a dictionary iterator fails. using Base.Threads d = Dict("a" =\> 1, "b" =\> 2) @threads for (k, v) in d println("$(k) =\> $(v)") end produces ERROR: TaskFailedException Stacktrace: \[1\] wai…

---

## [Large Garbage Collection in for loop if slicing vector](https://discourse.julialang.org/t/large-garbage-collection-in-for-loop-if-slicing-vector/78229)

<div class="topic-metadata">

**Author:** [@junder873](https://discourse.julialang.org/u/junder873)\
**Replies:** 10\
**Last updated:** [March 22, 2022, 1:00am UTC](https://discourse.julialang.org/t/large-garbage-collection-in-for-loop-if-slicing-vector/78229 "2022-03-22T01:00:13Z")

</div>

When creating a slice of a vector in a for loop, it seems like Julia creates a new vector each time which then needs to be dealt with by the garbage collector. In my setting, sometimes the GC can significantly slow down …

---

## [Julia running in an M1 Asahi Linux](https://discourse.julialang.org/t/julia-running-in-an-m1-asahi-linux/78242)

<div class="topic-metadata">

**Author:** [@AlanAylmer](https://discourse.julialang.org/u/AlanAylmer)\
**Replies:** 0\
**Last updated:** [March 21, 2022, 9:05pm UTC](https://discourse.julialang.org/t/julia-running-in-an-m1-asahi-linux/78242 "2022-03-21T21:05:39Z")

</div>

Use the Linux ARM (not the AUR or DMG) Just needs a reboot

---

## [Doing crazy stuff with generics](https://discourse.julialang.org/t/doing-crazy-stuff-with-generics/78225)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 4:32pm UTC](https://discourse.julialang.org/t/doing-crazy-stuff-with-generics/78225 "2022-03-21T16:32:46Z")

</div>

Hi all :slight\_smile: Why can’t I do the following: julia\> function crazy(T) if T == Int String elseif T == String Int else error("use Int o…

---

## [Nested for loop in generator](https://discourse.julialang.org/t/nested-for-loop-in-generator/78222)

<div class="topic-metadata">

**Author:** [@joh](https://discourse.julialang.org/u/joh)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 3:47pm UTC](https://discourse.julialang.org/t/nested-for-loop-in-generator/78222 "2022-03-21T15:47:00Z")

</div>

I’ve just stumbled across something odd when using a nested for statement in a generator expression. I would have expected collect((n,k) for n in 1:5, k in 1:n) to be equivalent to collect((n,k) for n in 1:5 for k in 1:n…

---

## [Structs: Able to change members of type Vector{Float64}, but not of type Float64](https://discourse.julialang.org/t/structs-able-to-change-members-of-type-vector-float64-but-not-of-type-float64/78221)

<div class="topic-metadata">

**Author:** [@Christian\_Brunbjerg](https://discourse.julialang.org/u/Christian_Brunbjerg)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 3:21pm UTC](https://discourse.julialang.org/t/structs-able-to-change-members-of-type-vector-float64-but-not-of-type-float64/78221 "2022-03-21T15:21:10Z")

</div>

Hello! :slight\_smile: When using an struct I am able to change the values inside members that are of type Vector, but I cannot not do it for members of type Float64. Do I need to change my struct to an immutable struct …

---

## [Problem Generating executable](https://discourse.julialang.org/t/problem-generating-executable/77716)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 5\
**Last updated:** [March 18, 2022, 1:07pm UTC](https://discourse.julialang.org/t/problem-generating-executable/77716 "2022-03-18T13:07:02Z")

</div>

When I run the below code, it gives the below error. How can I solve the problem? using PackageCompiler: PackageCompiler, create\_sysimage, create\_app, create\_library using Pkg ENV\["JULIA\_DEBUG"\] = "PackageCompiler" mkpa…

---

## [How to slice with start stop step](https://discourse.julialang.org/t/how-to-slice-with-start-stop-step/78217)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 2:48pm UTC](https://discourse.julialang.org/t/how-to-slice-with-start-stop-step/78217 "2022-03-21T14:48:12Z")

</div>

In Python I can do \>\>\> a = \[1, 2, 3, 4, 5, 6, 7, 8\] \>\>\> a\[3:7:2\] \[4,6\] Here I am selecting the indices between 3 and 7 with a step size of two. However in Julia I get julia\> a = \[1, 2, 3, 4, 5, 6, 7, 8\] julia\> a\[3:7:2…

---

## [Julia Flux, how to build a simple multilayer perception to solve xor problem](https://discourse.julialang.org/t/julia-flux-how-to-build-a-simple-multilayer-perception-to-solve-xor-problem/48901)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 6\
**Last updated:** [March 21, 2022, 1:42pm UTC](https://discourse.julialang.org/t/julia-flux-how-to-build-a-simple-multilayer-perception-to-solve-xor-problem/48901 "2022-03-21T13:42:03Z")

</div>

Hello. Someone knows how to build a simple multilayer perceptron with flux to solve a xor problem? The examples are very complex to start with flux. May someone help?

---

## [Problem with PackageCompiler](https://discourse.julialang.org/t/problem-with-packagecompiler/78130)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 3\
**Last updated:** [March 21, 2022, 9:47am UTC](https://discourse.julialang.org/t/problem-with-packagecompiler/78130 "2022-03-21T09:47:08Z")

</div>

We have the following MWE. Project structure: package1.jl module package1 Base.@ccallable function julia\_main()::Cint try testApp() catch Base.invokelatest(Base.display\_error, Base.catch\_stac…

---

## [Looping over each index in varargs](https://discourse.julialang.org/t/looping-over-each-index-in-varargs/78200)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 1\
**Last updated:** [March 21, 2022, 8:43am UTC](https://discourse.julialang.org/t/looping-over-each-index-in-varargs/78200 "2022-03-21T08:43:57Z")

</div>

I have a function that takes in any number of vectors, not necessarily of equal length: function exfnc(x::Vector{Float64}...) sizes = length.(x) ## compute some function over all combinations (x1\[i\], x2\[j\], ...,…

---

## [Using mutable struct constructor](https://discourse.julialang.org/t/using-mutable-struct-constructor/78179)

<div class="topic-metadata">

**Author:** [@tgautam03](https://discourse.julialang.org/u/tgautam03)\
**Replies:** 2\
**Last updated:** [March 21, 2022, 5:41am UTC](https://discourse.julialang.org/t/using-mutable-struct-constructor/78179 "2022-03-21T05:41:34Z")

</div>

Hi I’ve defined a mutable struct with constructor that initialises the first field as follows mutable struct Dummy val1::Array val2::Array function Dummy(val1::Array) new(val) end end Is there a way I can defin…

---

## [How to programmatically generate different functions?](https://discourse.julialang.org/t/how-to-programmatically-generate-different-functions/78152)

<div class="topic-metadata">

**Author:** [@DenisTitov](https://discourse.julialang.org/u/DenisTitov)\
**Replies:** 9\
**Last updated:** [March 21, 2022, 3:17am UTC](https://discourse.julialang.org/t/how-to-programmatically-generate-different-functions/78152 "2022-03-21T03:17:59Z")

</div>

Hi all, I want to figure out how to generate different version of a function programmatically. I beleive metaprogramming is what I need but wanted to ask for advice before implementing it. Apologies if below is a bit …

---

## [Order of minimum and average when configuring \`samples\` and \`evals\` in BenchmarkTools](https://discourse.julialang.org/t/order-of-minimum-and-average-when-configuring-samples-and-evals-in-benchmarktools/78184)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 0\
**Last updated:** [March 21, 2022, 1:44am UTC](https://discourse.julialang.org/t/order-of-minimum-and-average-when-configuring-samples-and-evals-in-benchmarktools/78184 "2022-03-21T01:44:33Z")

</div>

Apparently I am not the first one to be confused about the difference between the samples and evals parameters in BenchmarkTools.jl: BenchmarkTools (I know that setup is called newly for each of the samples but not for …

---

## [Issue adding a row record of a DataFrame with \`String\` name to itself](https://discourse.julialang.org/t/issue-adding-a-row-record-of-a-dataframe-with-string-name-to-itself/78177)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 5\
**Last updated:** [March 20, 2022, 9:54pm UTC](https://discourse.julialang.org/t/issue-adding-a-row-record-of-a-dataframe-with-string-name-to-itself/78177 "2022-03-20T21:54:52Z")

</div>

I have a kind of complicated dataframe df, and I want to append one of its rows to the end, i.e., append!(df, df\[1,:\]). When I try this, I get an error julia\> append!(df, DataFrame(df\[1,:\])) ┌ Error: Error adding value …

---

## ["unable to find the specified executable file" when trying to use mpirun on julia](https://discourse.julialang.org/t/unable-to-find-the-specified-executable-file-when-trying-to-use-mpirun-on-julia/78172)

<div class="topic-metadata">

**Author:** [@knkn1711](https://discourse.julialang.org/u/knkn1711)\
**Replies:** 0\
**Last updated:** [March 20, 2022, 7:27pm UTC](https://discourse.julialang.org/t/unable-to-find-the-specified-executable-file-when-trying-to-use-mpirun-on-julia/78172 "2022-03-20T19:27:50Z")

</div>

I am trying to run my julia code on multiple nodes of a cluster, which uses Moab and Torque for the scheduler and resource manager. In an interactive session where I requested 3 nodes, I load julia and openmpi modules a…

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

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