# General Usage

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

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

**Page:** 319

---

## [PolyOpt() Functionality](https://discourse.julialang.org/t/polyopt-functionality/95734)

<div class="topic-metadata">

**Author:** [@JuliaQ123](https://discourse.julialang.org/u/JuliaQ123)\
**Replies:** 1\
**Last updated:** [March 8, 2023, 1:48pm UTC](https://discourse.julialang.org/t/polyopt-functionality/95734 "2023-03-08T13:48:07Z")

</div>

Hi, I have been setting up a universal differential equation model with multiple shooting, following the example, and it works great. I am just confused as to what the OptimizationPolyalgorithms.PolyOpt() optimizer is a…

---

## [How to unfold a set of tuples?](https://discourse.julialang.org/t/how-to-unfold-a-set-of-tuples/95696)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 9\
**Last updated:** [March 8, 2023, 12:33pm UTC](https://discourse.julialang.org/t/how-to-unfold-a-set-of-tuples/95696 "2023-03-08T12:33:01Z")

</div>

I have a set of tuples something like A = \[(1,2),(,7,10),(3,2),(9,8),(5,1)\] and wanted to unwrap them into a set. So, for “A” output would be like B = {1,2,3,5,7,8,9,10} Is there any way to do this (without using for lo…

---

## [Calling a macro inside of a macro](https://discourse.julialang.org/t/calling-a-macro-inside-of-a-macro/95729)

<div class="topic-metadata">

**Author:** [@brunbjerg](https://discourse.julialang.org/u/brunbjerg)\
**Replies:** 2\
**Last updated:** [March 8, 2023, 11:42am UTC](https://discourse.julialang.org/t/calling-a-macro-inside-of-a-macro/95729 "2023-03-08T11:42:23Z")

</div>

Hello I am finding myself debugging at large Julia codebase and for some reason I still debug like a 2nd year undergraduate. For that reason I would like to make a macro that looks some thing like this: macro pp(input)…

---

## [What is faster than channel to synchronize between threads?](https://discourse.julialang.org/t/what-is-faster-than-channel-to-synchronize-between-threads/95511)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 7\
**Last updated:** [March 8, 2023, 11:54am UTC](https://discourse.julialang.org/t/what-is-faster-than-channel-to-synchronize-between-threads/95511 "2023-03-08T11:54:41Z")

</div>

I have MWE as below, in which I am manipulating Do Some Works on parallel using threads that are synchronized between via channel. However, this channel seems to be not fast and I am wondering if there is another synchro…

---

## [PSA for SnoopPrecompile: turning off extra workload for specific packages](https://discourse.julialang.org/t/psa-for-snoopprecompile-turning-off-extra-workload-for-specific-packages/92865)

<div class="topic-metadata">

**Author:** [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Replies:** 4\
**Last updated:** [March 8, 2023, 11:48am UTC](https://discourse.julialang.org/t/psa-for-snoopprecompile-turning-off-extra-workload-for-specific-packages/92865 "2023-03-08T11:48:47Z")

</div>

EDIT: SnoopPrecompile has been replaced by PrecompileTools. It also has a different mechanism for disabling precompile workloads, see its documentation. The latest version of SnoopPrecompile has added the ability to red…

---

## [Delete rows in matrix A that are in matrix B](https://discourse.julialang.org/t/delete-rows-in-matrix-a-that-are-in-matrix-b/95687)

<div class="topic-metadata">

**Author:** [@Bozaga\_Murat](https://discourse.julialang.org/u/Bozaga_Murat)\
**Replies:** 9\
**Last updated:** [March 8, 2023, 9:16am UTC](https://discourse.julialang.org/t/delete-rows-in-matrix-a-that-are-in-matrix-b/95687 "2023-03-08T09:16:53Z")

</div>

I search for function, what is equal to Matlab with setdiff. \[C,ia\] = setdiff(A,B,‘rows’); Thanks, for every help!

---

## [How to turn a plot into pixels?](https://discourse.julialang.org/t/how-to-turn-a-plot-into-pixels/22061)

<div class="topic-metadata">

**Author:** [@Per](https://discourse.julialang.org/u/Per)\
**Replies:** 19\
**Last updated:** [March 8, 2023, 9:15am UTC](https://discourse.julialang.org/t/how-to-turn-a-plot-into-pixels/22061 "2023-03-08T09:15:27Z")

</div>

Is there a fast way to turn a plot (from either Plots.jl or Makie) into an array of pixel values? Basically, I would like to be able to draw a few lines, and then turn that drawing into an Array of UInt8 or similar, tha…

---

## [Way to check the list of python functions defined by PyCall's py""" """ in workspace?](https://discourse.julialang.org/t/way-to-check-the-list-of-python-functions-defined-by-pycalls-py-in-workspace/95721)

<div class="topic-metadata">

**Author:** [@YH\_Ko](https://discourse.julialang.org/u/YH_Ko)\
**Replies:** 0\
**Last updated:** [March 8, 2023, 8:31am UTC](https://discourse.julialang.org/t/way-to-check-the-list-of-python-functions-defined-by-pycalls-py-in-workspace/95721 "2023-03-08T08:31:01Z")

</div>

I’m using visual studio code for my IDE. I can check list of functions defined by Julia language in vscode’s workspace. However, I can’t see the list of functions defined by PyCall + py"““def fun ~””". For example, ad…

---

## [Supertype operator \<:](https://discourse.julialang.org/t/supertype-operator/95706)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [March 8, 2023, 7:10am UTC](https://discourse.julialang.org/t/supertype-operator/95706 "2023-03-08T07:10:13Z")

</div>

Math operators can be used in three forms #all equivalent 1\<2 \<(1,2) \<(2)(1) The supertype operator doesn’t seem to allow the 3rd form. myType \<: mySuperType \<:(myType,mySuperType) \<:(mySuperType)(myType) #doesn't …

---

## [Missing from the variable map error](https://discourse.julialang.org/t/missing-from-the-variable-map-error/63172)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 4\
**Last updated:** [March 8, 2023, 7:57am UTC](https://discourse.julialang.org/t/missing-from-the-variable-map-error/63172 "2023-03-08T07:57:53Z")

</div>

I’m trying to construct an ODEProblem from a ODESystem with the following code. I can’t seem to debug this error. using ModelingToolkit using LinearAlgebra using StaticArrays @parameters t μ @variables x(t) y(t) z(t) …

---

## [Significant difference in execution speed between similar functions with nested loops](https://discourse.julialang.org/t/significant-difference-in-execution-speed-between-similar-functions-with-nested-loops/95710)

<div class="topic-metadata">

**Author:** [@aomidro](https://discourse.julialang.org/u/aomidro)\
**Replies:** 4\
**Last updated:** [March 8, 2023, 5:26am UTC](https://discourse.julialang.org/t/significant-difference-in-execution-speed-between-similar-functions-with-nested-loops/95710 "2023-03-08T05:26:28Z")

</div>

I compared the execution speed of two similar functions, f1 and f2, with f1 taking almost 1000 times longer than f2. Both functions include nested loops. Can anyone explain why there is such a significant difference in e…

---

## [Is it possible to catch a syntax error within the same file or REPL?](https://discourse.julialang.org/t/is-it-possible-to-catch-a-syntax-error-within-the-same-file-or-repl/95701)

<div class="topic-metadata">

**Author:** [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)\
**Replies:** 0\
**Last updated:** [March 7, 2023, 10:41pm UTC](https://discourse.julialang.org/t/is-it-possible-to-catch-a-syntax-error-within-the-same-file-or-repl/95701 "2023-03-07T22:41:29Z")

</div>

Given the two files test.jl: f(; kwargs...) = dump(kwargs) try f(a=1, b=2, a=7) catch ex println("Caught exception!") dump(ex) end and testincl.jl: try include("test.jl") catch ex println("Caught exception!") …

---

## [Computed type annotations for struct fields](https://discourse.julialang.org/t/computed-type-annotations-for-struct-fields/95692)

<div class="topic-metadata">

**Author:** [@habemus-papadum](https://discourse.julialang.org/u/habemus-papadum)\
**Replies:** 3\
**Last updated:** [March 7, 2023, 10:36pm UTC](https://discourse.julialang.org/t/computed-type-annotations-for-struct-fields/95692 "2023-03-07T22:36:04Z")

</div>

Is there a way to make this work in Julia: ## function relative(t::Type{Int64}) Float64 end function relative(t::Type{Int32}) Float32 end struct Foo{T} a::relative(T) b::T end x = Foo{Int64}(2.0, 1) This…

---

## [Struggling to train a UDE with DiffEqGPU](https://discourse.julialang.org/t/struggling-to-train-a-ude-with-diffeqgpu/94938)

<div class="topic-metadata">

**Author:** [@JuliaQ123](https://discourse.julialang.org/u/JuliaQ123)\
**Replies:** 9\
**Last updated:** [March 7, 2023, 10:29pm UTC](https://discourse.julialang.org/t/struggling-to-train-a-ude-with-diffeqgpu/94938 "2023-03-07T22:29:59Z")

</div>

Hi, I’ve been trying to train a UDE model on a set of time series in parallel using DiffEqGPU and EnsembleProblem, with different stored u0 and p values. The goal is to compute the losses simultaneously for each batch, …

---

## [Displaysize limit not respected for multi-dimensional arrays](https://discourse.julialang.org/t/displaysize-limit-not-respected-for-multi-dimensional-arrays/95698)

<div class="topic-metadata">

**Author:** [@fredcallaway](https://discourse.julialang.org/u/fredcallaway)\
**Replies:** 0\
**Last updated:** [March 7, 2023, 10:20pm UTC](https://discourse.julialang.org/t/displaysize-limit-not-respected-for-multi-dimensional-arrays/95698 "2023-03-07T22:20:13Z")

</div>

Displaying a multi-dimensional array will often create a huge amount of stdout, clearing scroll back history and causing the session to hang (especially when over ssh). For a matrix, you can limit the size of the display…

---

## [Parsing date column when reading in CSV](https://discourse.julialang.org/t/parsing-date-column-when-reading-in-csv/95641)

<div class="topic-metadata">

**Author:** [@mbah](https://discourse.julialang.org/u/mbah)\
**Replies:** 6\
**Last updated:** [March 7, 2023, 9:52pm UTC](https://discourse.julialang.org/t/parsing-date-column-when-reading-in-csv/95641 "2023-03-07T21:52:40Z")

</div>

Hello all, I have a CSV file with a date column that I am trying to parse when reading it in. I have tried several options but they don’t work. df = DataFrame(CSV.File(joinpath(data\_path, "PJM\_2018.csv"))) 8751×8 Dat…

---

## [GC time issues when parallelizing tyalorinteg?](https://discourse.julialang.org/t/gc-time-issues-when-parallelizing-tyalorinteg/80481)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 7\
**Last updated:** [March 7, 2023, 5:07pm UTC](https://discourse.julialang.org/t/gc-time-issues-when-parallelizing-tyalorinteg/80481 "2023-03-07T17:07:04Z")

</div>

Hi all, I was messing around with Threads.@thread as I am trying to parallelize a for loop : I want to compute taylorinteg from TaylorIntegration.jl several times, independently, for different initial conditions. To do …

---

## [Running Julia and Juno from behind corporate firewall and proxy - A simple working setup](https://discourse.julialang.org/t/running-julia-and-juno-from-behind-corporate-firewall-and-proxy-a-simple-working-setup/32380)

<div class="topic-metadata">

**Author:** [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)\
**Replies:** 5\
**Last updated:** [March 7, 2023, 4:55pm UTC](https://discourse.julialang.org/t/running-julia-and-juno-from-behind-corporate-firewall-and-proxy-a-simple-working-setup/32380 "2023-03-07T16:55:07Z")

</div>

This has been asked a few times and I promised to post my setup. We run Julia on a daily basis from behind a corporate firewall. The proxy server setup uses an automatic configuration script. The script distributes traff…

---

## [Why isn't there a \`!in\` or \`!∈\` function/operator?](https://discourse.julialang.org/t/why-isnt-there-a-in-or-function-operator/95654)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 7\
**Last updated:** [March 7, 2023, 4:51pm UTC](https://discourse.julialang.org/t/why-isnt-there-a-in-or-function-operator/95654 "2023-03-07T16:51:46Z")

</div>

I have encountered the absence of an !∈ or !in operator many times now and my muscle memory insists on telling me that it should exist: if a !in (b, c, d) ... end Why isn’t there an analogous operator/function for th…

---

## [Open XLSX from Zip Archive in Memory](https://discourse.julialang.org/t/open-xlsx-from-zip-archive-in-memory/95664)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 4\
**Last updated:** [March 7, 2023, 3:16pm UTC](https://discourse.julialang.org/t/open-xlsx-from-zip-archive-in-memory/95664 "2023-03-07T15:16:30Z")

</div>

I want to download this url, get the file named “ZIP5\_DEC2022\_FINAL.xlsx”, and read the table in as a DataFrame. But I can’t quite work out how to compose Zipfiles.jl with XLSX.jl. Here is my code currently: using Data…

---

## [How to make Julia functions pure mathematical functions?](https://discourse.julialang.org/t/how-to-make-julia-functions-pure-mathematical-functions/95657)

<div class="topic-metadata">

**Author:** [@PToTheK](https://discourse.julialang.org/u/PToTheK)\
**Replies:** 14\
**Last updated:** [March 7, 2023, 2:05pm UTC](https://discourse.julialang.org/t/how-to-make-julia-functions-pure-mathematical-functions/95657 "2023-03-07T14:05:47Z")

</div>

Hi Julia community, Problem: I would like to define a function which has only access to the arguments passed to that function. The problem is illustrated in the following minimal working example. I would like that the…

---

## [How to reflect plot function toward $y=x$ with Plots?](https://discourse.julialang.org/t/how-to-reflect-plot-function-toward-y-x-with-plots/95647)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [March 7, 2023, 12:21pm UTC](https://discourse.julialang.org/t/how-to-reflect-plot-function-toward-y-x-with-plots/95647 "2023-03-07T12:21:02Z")

</div>

Hi all, I have the code from previous forum I made, that reflect a graph toward y axis. Now I want to reflect it toward y=x , I can’t just do yreflection = y -\> x it prompts a lot of errors This code works on y axis re…

---

## [SpinControl.jl package is not found in project julia version 1.6](https://discourse.julialang.org/t/spincontrol-jl-package-is-not-found-in-project-julia-version-1-6/95604)

<div class="topic-metadata">

**Author:** [@arpan\_chatterjee](https://discourse.julialang.org/u/arpan_chatterjee)\
**Replies:** 2\
**Last updated:** [March 7, 2023, 11:40am UTC](https://discourse.julialang.org/t/spincontrol-jl-package-is-not-found-in-project-julia-version-1-6/95604 "2023-03-07T11:40:05Z")

</div>

What julia version is required to get the package SpinControl.jl?

---

## [Surprising type instability in apply\_type](https://discourse.julialang.org/t/surprising-type-instability-in-apply-type/95655)

<div class="topic-metadata">

**Author:** [@tverho](https://discourse.julialang.org/u/tverho)\
**Replies:** 2\
**Last updated:** [March 7, 2023, 11:31am UTC](https://discourse.julialang.org/t/surprising-type-instability-in-apply-type/95655 "2023-03-07T11:31:22Z")

</div>

It seems suprising that type inferrence doesn’t work here: f(Tp) = Tp{Int, Int} julia\> f(Tuple) Tuple{Int64, Int64} julia\> @code\_warntype f(Tuple) MethodInstance for f(::Type{Tuple}) from f(Tp) in Main at REPL\[5\]:1 …

---

## [Missing Relocatability of Tulip](https://discourse.julialang.org/t/missing-relocatability-of-tulip/94886)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 17\
**Last updated:** [March 7, 2023, 10:58am UTC](https://discourse.julialang.org/t/missing-relocatability-of-tulip/94886 "2023-03-07T10:58:35Z")

</div>

Relocatability I try to compile a project into an application that depends on Tulip.jl, but the resulting App is not portable, see: https://github.com/ds4dm/Tulip.jl/issues/131 Has someone managed a similar situation a…

---

## [On Developing Common Interfaces for the Julia Ecosystem](https://discourse.julialang.org/t/on-developing-common-interfaces-for-the-julia-ecosystem/95642)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 0\
**Last updated:** [March 7, 2023, 1:02am UTC](https://discourse.julialang.org/t/on-developing-common-interfaces-for-the-julia-ecosystem/95642 "2023-03-07T01:02:22Z")

</div>

Hi folks, I have spent much time ruminating on the idea of interfaces within the Julia ecosystem. Before I start a discussion about interfaces, let me first share my understandings of interfaces. Background Working Def…

---

## [Error on load DataFrame with BSON](https://discourse.julialang.org/t/error-on-load-dataframe-with-bson/95634)

<div class="topic-metadata">

**Author:** [@rodolforbcoutinho](https://discourse.julialang.org/u/rodolforbcoutinho)\
**Replies:** 1\
**Last updated:** [March 6, 2023, 8:29pm UTC](https://discourse.julialang.org/t/error-on-load-dataframe-with-bson/95634 "2023-03-06T20:29:11Z")

</div>

Hello all! I’m getting an odd erro when loading a file with BSON. This file was created by other project/enviroment. I’m using and outdated enviroment now because I want to use SOM.jl ERROR: BoundsError: attempt to acc…

---

## [Convert Vector{SVector} to Matrix](https://discourse.julialang.org/t/convert-vector-svector-to-matrix/27939)

<div class="topic-metadata">

**Author:** [@benzwick](https://discourse.julialang.org/u/benzwick)\
**Replies:** 20\
**Last updated:** [March 6, 2023, 8:05pm UTC](https://discourse.julialang.org/t/convert-vector-svector-to-matrix/27939 "2023-03-06T20:05:58Z")

</div>

I have some code where I need to store coordinates x of a mesh. I’m using a vector of points (static vectors), i.e. using StaticArrays Point{dim} = SVector{dim, Float64} x = rand(Point{3}, 10) but some parts of the cod…

---

## [Best way to select implementation based on runtime argument? (dispatch vs. control flow)](https://discourse.julialang.org/t/best-way-to-select-implementation-based-on-runtime-argument-dispatch-vs-control-flow/95479)

<div class="topic-metadata">

**Author:** [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)\
**Replies:** 10\
**Last updated:** [March 6, 2023, 7:40pm UTC](https://discourse.julialang.org/t/best-way-to-select-implementation-based-on-runtime-argument-dispatch-vs-control-flow/95479 "2023-03-06T19:40:31Z")

</div>

I’ve been running into the following question: What is the most “sensible” or idiomatic way to select a function implementation based on a runtime argument (by which I mean, it could potentially be passed e. g. as a comm…

---

## [How to use compat to force the use of given julia version](https://discourse.julialang.org/t/how-to-use-compat-to-force-the-use-of-given-julia-version/95623)

<div class="topic-metadata">

**Author:** [@tencnivel](https://discourse.julialang.org/u/tencnivel)\
**Replies:** 0\
**Last updated:** [March 6, 2023, 5:50pm UTC](https://discourse.julialang.org/t/how-to-use-compat-to-force-the-use-of-given-julia-version/95623 "2023-03-06T17:50:35Z")

</div>

I try to tell that my project is compatible with julia 1.8.5 only I added the following \[compat\] julia="~1.8.5" and I was expecting to get an error when trying to load the module with a different julia version than th…

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

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