# General Usage

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

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

**Page:** 394

---

## [Pmap suddenly after running for some time gives Load Error](https://discourse.julialang.org/t/pmap-suddenly-after-running-for-some-time-gives-load-error/87646)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 0\
**Last updated:** [September 22, 2022, 2:08pm UTC](https://discourse.julialang.org/t/pmap-suddenly-after-running-for-some-time-gives-load-error/87646 "2022-09-22T14:08:46Z")

</div>

I am paralellizing, with the library Distributed (pmap method), calling the JuMP solver Ipopt across different agents (“utilities”). The results for each agent are then vertically concatenated into a DataFrame. The code …

---

## [How best to debug a Pluto notebook?](https://discourse.julialang.org/t/how-best-to-debug-a-pluto-notebook/87643)

<div class="topic-metadata">

**Author:** [@Xavier\_Gonzalez](https://discourse.julialang.org/u/Xavier_Gonzalez)\
**Replies:** 0\
**Last updated:** [September 22, 2022, 1:31pm UTC](https://discourse.julialang.org/t/how-best-to-debug-a-pluto-notebook/87643 "2022-09-22T13:31:46Z")

</div>

A lot of times when I write julia in a Pluto notebook, I run into the following problem. Let’s say I’m trying to change the name of variable. When I first change it, everything breaks. Because Pluto is reactive, I woul…

---

## [How to run two tasks on parallel?](https://discourse.julialang.org/t/how-to-run-two-tasks-on-parallel/86902)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 30\
**Last updated:** [September 22, 2022, 1:29pm UTC](https://discourse.julialang.org/t/how-to-run-two-tasks-on-parallel/86902 "2022-09-22T13:29:07Z")

</div>

if I have two tasks and I need to them on parallel. What is the organization to do that in Julia? For example the following using LinearAlgebra, SparseArrays, n = 1000; d = 10; A1 = sprand(n,n,d/n); x1 = rand(n); A2 = s…

---

## [TeeLogger and stdout/stderr redirection](https://discourse.julialang.org/t/teelogger-and-stdout-stderr-redirection/87641)

<div class="topic-metadata">

**Author:** [@dapz](https://discourse.julialang.org/u/dapz)\
**Replies:** 0\
**Last updated:** [September 22, 2022, 12:59pm UTC](https://discourse.julialang.org/t/teelogger-and-stdout-stderr-redirection/87641 "2022-09-22T12:59:17Z")

</div>

Hi, I would like to run some code and get all the outputs: (1) either on the console or (2) redirected to a file or (3) both at the same time. I have been using Logging utilities and LoggingExtras to define a TeeLogger t…

---

## [Raylib language bindings](https://discourse.julialang.org/t/raylib-language-bindings/75478)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 5\
**Last updated:** [September 22, 2022, 1:03pm UTC](https://discourse.julialang.org/t/raylib-language-bindings/75478 "2022-09-22T13:03:17Z")

</div>

The thread below was about raylib, but it was really meant to be questions about Clang vs CBindingGen with raylib as the concrete example. I thought it might be useful to start a raylib binding specific thread, that w…

---

## [Zygote @adjoint usage for covariance matrix calculation](https://discourse.julialang.org/t/zygote-adjoint-usage-for-covariance-matrix-calculation/87352)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 4\
**Last updated:** [September 22, 2022, 10:01am UTC](https://discourse.julialang.org/t/zygote-adjoint-usage-for-covariance-matrix-calculation/87352 "2022-09-22T10:01:46Z")

</div>

Hello, I implemented Fréchet distance for using it as a loss function in Flux. But Zygote is not happy because it does not recognize the covariance calculation. The documentation of Zygote package has a custom adjoint …

---

## [Is it possible to display html in vscode?](https://discourse.julialang.org/t/is-it-possible-to-display-html-in-vscode/87571)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [September 22, 2022, 9:06am UTC](https://discourse.julialang.org/t/is-it-possible-to-display-html-in-vscode/87571 "2022-09-22T09:06:46Z")

</div>

I have the following code: julia\> show(stdout, "text/html", res) \<p\> \<h3\>Charger log(s):\</h3\> \<span style="font-family: monospace; color: #270"\>Message: "No buffer space" not found!\</span\>\<br\> \<span style="f…

---

## [How to write a macro to export all instances of an enum type](https://discourse.julialang.org/t/how-to-write-a-macro-to-export-all-instances-of-an-enum-type/73137)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 2\
**Last updated:** [September 22, 2022, 8:45am UTC](https://discourse.julialang.org/t/how-to-write-a-macro-to-export-all-instances-of-an-enum-type/73137 "2022-09-22T08:45:58Z")

</div>

A module has an enum type A and I want to export all its instances instances(A). I want to write a macro @export\_instances like module MyModule export A @enum A a b c @export\_instances A # \`export a, b, c\` end # module…

---

## [Is there a way to easily identify useless import, export and using statements](https://discourse.julialang.org/t/is-there-a-way-to-easily-identify-useless-import-export-and-using-statements/87580)

<div class="topic-metadata">

**Author:** [@Atiyah](https://discourse.julialang.org/u/Atiyah)\
**Replies:** 6\
**Last updated:** [September 22, 2022, 8:16am UTC](https://discourse.julialang.org/t/is-there-a-way-to-easily-identify-useless-import-export-and-using-statements/87580 "2022-09-22T08:16:08Z")

</div>

I was wondering if there is a way (probably a tool or a package) that could show whether an import, an export or a using statement is useless in a particular source file. Particularly, using X: Type1, Type2, foo1, foo2…

---

## [ReverseDiff and GalacticOptim: Issues with dependencies](https://discourse.julialang.org/t/reversediff-and-galacticoptim-issues-with-dependencies/87608)

<div class="topic-metadata">

**Author:** [@Luis\_Calderon](https://discourse.julialang.org/u/Luis_Calderon)\
**Replies:** 5\
**Last updated:** [September 22, 2022, 7:44am UTC](https://discourse.julialang.org/t/reversediff-and-galacticoptim-issues-with-dependencies/87608 "2022-09-22T07:44:13Z")

</div>

Dear all, I’m running a maximum likelihood estimation of 1000+ parameters and thought to use ReverseDiff. I found a video online (1:47) that said to run something similar to the following if interested in using ReverseD…

---

## [REPL and Source Code Question](https://discourse.julialang.org/t/repl-and-source-code-question/87613)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 1\
**Last updated:** [September 22, 2022, 3:22am UTC](https://discourse.julialang.org/t/repl-and-source-code-question/87613 "2022-09-22T03:22:38Z")

</div>

Hello, Often times when I am exploring and building things with a new package I am frequently checking what methods are available in the REPL by doing ? SomeFunc. It will return something like # 3 methods for generic fu…

---

## [Initializing BVP](https://discourse.julialang.org/t/initializing-bvp/87598)

<div class="topic-metadata">

**Author:** [@Jojo](https://discourse.julialang.org/u/Jojo)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 9:06pm UTC](https://discourse.julialang.org/t/initializing-bvp/87598 "2022-09-21T21:06:26Z")

</div>

Hello, I’m new to the BoundaryValueDiffEq package and I’ve seen some examples of its use for solving second order differential equations. However, I was wondering whether it’s posible to solve first order BVPs too. I t…

---

## [Dataframes combine over 100s of columns](https://discourse.julialang.org/t/dataframes-combine-over-100s-of-columns/87446)

<div class="topic-metadata">

**Author:** [@bicepjai](https://discourse.julialang.org/u/bicepjai)\
**Replies:** 22\
**Last updated:** [September 21, 2022, 8:36pm UTC](https://discourse.julialang.org/t/dataframes-combine-over-100s-of-columns/87446 "2022-09-21T20:36:52Z")

</div>

Trying to perform combine over one columns logged over multiple days and get delta (max - min) for 300 columns in a dataset with 10 million rows. How can i do this efficiently ? I also notice if i combine over 10 co…

---

## [Makie xlims!](https://discourse.julialang.org/t/makie-xlims/56417)

<div class="topic-metadata">

**Author:** [@mschauer](https://discourse.julialang.org/u/mschauer)\
**Replies:** 7\
**Last updated:** [September 21, 2022, 8:20pm UTC](https://discourse.julialang.org/t/makie-xlims/56417 "2022-09-21T20:20:42Z")

</div>

How do I make this work… I have essentially tried everything for the last twenty minutes ?? = lines(x, y, z, linewidth=0.5, show\_axis=false) xlims!(??, 1.05,1.95) ylims!(??, 1.05,1.95)

---

## [Write from julia in excel](https://discourse.julialang.org/t/write-from-julia-in-excel/87582)

<div class="topic-metadata">

**Author:** [@Zizilabg](https://discourse.julialang.org/u/Zizilabg)\
**Replies:** 7\
**Last updated:** [September 21, 2022, 7:13pm UTC](https://discourse.julialang.org/t/write-from-julia-in-excel/87582 "2022-09-21T19:13:28Z")

</div>

Hello, Here is my code: using XLSX using JuMP using Gurobi using DataFrames # change working directory to the one containing this file cd(@\_\_DIR\_\_) fichierDonnees=XLSX.readxlsx("choix élèves julia.xlsx") ws=fichier…

---

## [Convert float matrix to abstract float](https://discourse.julialang.org/t/convert-float-matrix-to-abstract-float/87599)

<div class="topic-metadata">

**Author:** [@JosieG](https://discourse.julialang.org/u/JosieG)\
**Replies:** 3\
**Last updated:** [September 21, 2022, 7:07pm UTC](https://discourse.julialang.org/t/convert-float-matrix-to-abstract-float/87599 "2022-09-21T19:07:37Z")

</div>

I have a 2\*85 float matrix. And I need to pass it to a function function func( Y::Matrix{T}, )::Matrix{T} where {T\<:AbstractFloat} So I think I have to convert the matrix from float type to Abstractfloat. I have a …

---

## [Sum of rationals](https://discourse.julialang.org/t/sum-of-rationals/87581)

<div class="topic-metadata">

**Author:** [@fa-bien](https://discourse.julialang.org/u/fa-bien)\
**Replies:** 1\
**Last updated:** [September 21, 2022, 3:51pm UTC](https://discourse.julialang.org/t/sum-of-rationals/87581 "2022-09-21T15:51:06Z")

</div>

I wrote the following function to calculate the sum of a vector of rational numbers: function rationalsum(numbers::Vector{T} where T\<:Rational) den = lcm(\[x.den for x in numbers\]) nums = (x.num \* div(den, x.den)…

---

## [Simple SciML case - core dumped after switching from julia 1.7 to 1.8](https://discourse.julialang.org/t/simple-sciml-case-core-dumped-after-switching-from-julia-1-7-to-1-8/87549)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 7\
**Last updated:** [September 21, 2022, 3:08pm UTC](https://discourse.julialang.org/t/simple-sciml-case-core-dumped-after-switching-from-julia-1-7-to-1-8/87549 "2022-09-21T15:08:45Z")

</div>

Hi there, I am starting with SciML and getting a core dumped when switching from julia 1.7.2 to julia 1.8.1 It is a simple combination of ODEProblem and Optimization, worked before, now fails dramatically. import Diffe…

---

## [Where Can I find documentation regarding TTY raw mode?](https://discourse.julialang.org/t/where-can-i-find-documentation-regarding-tty-raw-mode/87569)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 3\
**Last updated:** [September 21, 2022, 2:54pm UTC](https://discourse.julialang.org/t/where-can-i-find-documentation-regarding-tty-raw-mode/87569 "2022-09-21T14:54:37Z")

</div>

I have been working on a project that utilises a bit of low level terminal manipulation code to manage its flow and interface. I have encountered again and again and again and again mentions to this superhero raw mode t…

---

## [How do I make the julia code efficient?](https://discourse.julialang.org/t/how-do-i-make-the-julia-code-efficient/87560)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 3\
**Last updated:** [September 21, 2022, 2:45pm UTC](https://discourse.julialang.org/t/how-do-i-make-the-julia-code-efficient/87560 "2022-09-21T14:45:06Z")

</div>

function conver(ind, str) ls = length(str) ls \< ind + 2 && return nothing s = SubString(str, ind+1, ind+2) if 'N' in s return missing else return s=="CG" end end function classify\_…

---

## [Using selenium By syntax in Julia](https://discourse.julialang.org/t/using-selenium-by-syntax-in-julia/87577)

<div class="topic-metadata">

**Author:** [@rajmac](https://discourse.julialang.org/u/rajmac)\
**Replies:** 0\
**Last updated:** [September 21, 2022, 2:31pm UTC](https://discourse.julialang.org/t/using-selenium-by-syntax-in-julia/87577 "2022-09-21T14:31:51Z")

</div>

Hi, I have been using PyCall and selenium to scrape some sites. Whist I have managed to acheive my ends I have hit a snag which may be due to my being new to Julia. This is that I cannot get the new selenium locator synt…

---

## [@sync doesn't synchronize @distributed unless called as @sync @distributed](https://discourse.julialang.org/t/sync-doesnt-synchronize-distributed-unless-called-as-sync-distributed/87574)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 0\
**Last updated:** [September 21, 2022, 2:07pm UTC](https://discourse.julialang.org/t/sync-doesnt-synchronize-distributed-unless-called-as-sync-distributed/87574 "2022-09-21T14:07:29Z")

</div>

I want to assemble a sparse matrix using Distributed. I use DistributedArrays for the nonzero elements. The code calls some functions (assemble\_synced! or assemble\_not\_synced!) which assemble submatrices of the whole mat…

---

## [Tables in Literate.jl](https://discourse.julialang.org/t/tables-in-literate-jl/87564)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [September 21, 2022, 2:01pm UTC](https://discourse.julialang.org/t/tables-in-literate-jl/87564 "2022-09-21T14:01:18Z")

</div>

I would like to display a computed table in a file marked up with Literate.jl. I managed to do it with using Tables, PrettyTables, DisplayAs tab = \[(a = 1, b = 2), (a = 3, b = 4)\]; pretty\_table(String, tab; tf = tf\_mar…

---

## [Allocations with BlockArrays multiplication](https://discourse.julialang.org/t/allocations-with-blockarrays-multiplication/87331)

<div class="topic-metadata">

**Author:** [@moataz-sabry](https://discourse.julialang.org/u/moataz-sabry)\
**Replies:** 1\
**Last updated:** [September 21, 2022, 1:39pm UTC](https://discourse.julialang.org/t/allocations-with-blockarrays-multiplication/87331 "2022-09-21T13:39:14Z")

</div>

I’m trying to do a vector matrix multiplication and store the result in a block vector from the BlockArrays package. But I ended up with a lot of allocations. Any ideas why? using BlockArrays, BenchmarkTools, LinearAlge…

---

## [Plot step function \[x+1/2\]](https://discourse.julialang.org/t/plot-step-function-x-1-2/87114)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 8\
**Last updated:** [September 21, 2022, 12:45pm UTC](https://discourse.julialang.org/t/plot-step-function-x-1-2/87114 "2022-09-21T12:45:23Z")

</div>

Hi all, I have been trying to plot \[x+1/2\] learning from the codes at my old thread: But it returns not the plot that I want. I change 1 into 1.5 it still not working. Maybe it takes more than just that.

---

## [How to Plot Step Functions \[x\] Correctly in Julia?](https://discourse.julialang.org/t/how-to-plot-step-functions-x-correctly-in-julia/84087)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 15\
**Last updated:** [September 21, 2022, 12:39pm UTC](https://discourse.julialang.org/t/how-to-plot-step-functions-x-correctly-in-julia/84087 "2022-09-21T12:39:29Z")

</div>

Hi all, I have this code: using Plots, LaTeXStrings gr() f(x)=floor(x) plot(f,0,10,ylim=(-12,12)) Since \[ x \] denotes the gretest integer less than or equal to x, I want to plot it like this: Anyone know how?

---

## [How to draw Stationary Solution for functions 1/4 t^{2} and - 1/4 t^{2} from y' = \\sqrt{|y|}](https://discourse.julialang.org/t/how-to-draw-stationary-solution-for-functions-1-4-t-2-and-1-4-t-2-from-y-sqrt-y/87561)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [September 21, 2022, 9:50am UTC](https://discourse.julialang.org/t/how-to-draw-stationary-solution-for-functions-1-4-t-2-and-1-4-t-2-from-y-sqrt-y/87561 "2022-09-21T09:50:27Z")

</div>

Hi all, this is a simple question, I wonder how to plot the stationary solution with y' = \\sqrt{|y|} y(0) = 0 The lecturer draws this, and I want to know how to plot it with Julia

---

## [Ocassional precompile error on a cluster using julia1.8](https://discourse.julialang.org/t/ocassional-precompile-error-on-a-cluster-using-julia1-8/82050)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 9\
**Last updated:** [September 21, 2022, 9:22am UTC](https://discourse.julialang.org/t/ocassional-precompile-error-on-a-cluster-using-julia1-8/82050 "2022-09-21T09:22:47Z")

</div>

I’ve just started using julia 1.8 on a cluster, and I have faced the following error while instantiating (or adding packages to) an environment: ┌ Error: Pkg.precompile error │ exception = │ IOError: could not spaw…

---

## [A unified type of \`Tuple\` and \`Vector\`](https://discourse.julialang.org/t/a-unified-type-of-tuple-and-vector/22552)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 4\
**Last updated:** [September 21, 2022, 9:12am UTC](https://discourse.julialang.org/t/a-unified-type-of-tuple-and-vector/22552 "2022-09-21T09:12:30Z")

</div>

Sometimes I want my functions to work with both Tuples and Vectors. Those functions are pure and are iterating through each element of the Tuples and Vectors. Is there a unified type representing Tuples and Vectors? Or I…

---

## [Need help for Julia -struct - Global variable](https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540)

<div class="topic-metadata">

**Author:** [@B\_Linkoon](https://discourse.julialang.org/u/B_Linkoon)\
**Replies:** 1\
**Last updated:** [September 21, 2022, 9:09am UTC](https://discourse.julialang.org/t/need-help-for-julia-struct-global-variable/87540 "2022-09-21T09:09:14Z")

</div>

Hi, I am new to Julia. Could you please help me to understand the following line of codes. and how to define and access values @ Mesh struct. Thank you in advance. using StaticArrays struct Mesh{I \<: Integer, F \<: Rea…

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

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