# General Usage

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

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

**Page:** 403

---

## [Container of mutable structs without 100x slowdown?](https://discourse.julialang.org/t/container-of-mutable-structs-without-100x-slowdown/86629)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 7\
**Last updated:** [September 1, 2022, 12:03pm UTC](https://discourse.julialang.org/t/container-of-mutable-structs-without-100x-slowdown/86629 "2022-09-01T12:03:08Z")

</div>

It seems like when mutable structs are stored in any kind of container, Julia is unable to optimize them onto the stack or even to a packed buffer on the heap. It always allocates new memory on the heap for each individ…

---

## [What makes a function interruptible with ctrl+c?](https://discourse.julialang.org/t/what-makes-a-function-interruptible-with-ctrl-c/86625)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 5\
**Last updated:** [September 1, 2022, 10:50am UTC](https://discourse.julialang.org/t/what-makes-a-function-interruptible-with-ctrl-c/86625 "2022-09-01T10:50:26Z")

</div>

Ctrl+c fails to interrupt many functions. What makes a function interruptible?

---

## [Package for lazy hcat/vcat of a large number of vectors](https://discourse.julialang.org/t/package-for-lazy-hcat-vcat-of-a-large-number-of-vectors/86590)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [September 1, 2022, 10:11am UTC](https://discourse.julialang.org/t/package-for-lazy-hcat-vcat-of-a-large-number-of-vectors/86590 "2022-09-01T10:11:13Z")

</div>

I am looking for the lazy equivalent of v = \[rand(500) for \_ in 1:5000\]; mapreduce(permutedims, vcat, v) where both dimensions may be large (up 10⁵). This is trivial to code up but I want to avoid duplication. Is ther…

---

## [Julia vs (R/STATA/Matlab/SAS/Python) for common data analysis tasks (2022 edition)](https://discourse.julialang.org/t/julia-vs-r-stata-matlab-sas-python-for-common-data-analysis-tasks-2022-edition/85801)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 6\
**Last updated:** [September 1, 2022, 10:01am UTC](https://discourse.julialang.org/t/julia-vs-r-stata-matlab-sas-python-for-common-data-analysis-tasks-2022-edition/85801 "2022-09-01T10:01:22Z")

</div>

From a previous discussion So I’m starting this thread with the idea that people could come here with some example data analysis problems and Julia users can reproduce something like them here to give people a sense o…

---

## [Maximum with \`by\` keyword](https://discourse.julialang.org/t/maximum-with-by-keyword/86627)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 1\
**Last updated:** [September 1, 2022, 6:53am UTC](https://discourse.julialang.org/t/maximum-with-by-keyword/86627 "2022-09-01T06:53:06Z")

</div>

I have a vector of Tuples v for which I want to find the maximum based on, say, the first element of the Tuple. sort has the by keyword: to sort the vector I would do sort(v; by=x-\>x\[1\]). What is the equivalent way for m…

---

## [Directly modify compiled method without recompilation](https://discourse.julialang.org/t/directly-modify-compiled-method-without-recompilation/86564)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 25\
**Last updated:** [August 31, 2022, 9:05pm UTC](https://discourse.julialang.org/t/directly-modify-compiled-method-without-recompilation/86564 "2022-08-31T21:05:45Z")

</div>

Question – how can I evaluate an expression into a method, compile it, and then directly manipulate the compiled version (lower than AST) to create another slightly modified method faster than re-compilation? I need to …

---

## [Is it possible to precompile a function in Julia?](https://discourse.julialang.org/t/is-it-possible-to-precompile-a-function-in-julia/86578)

<div class="topic-metadata">

**Author:** [@valperez](https://discourse.julialang.org/u/valperez)\
**Replies:** 2\
**Last updated:** [August 31, 2022, 10:02pm UTC](https://discourse.julialang.org/t/is-it-possible-to-precompile-a-function-in-julia/86578 "2022-08-31T22:02:05Z")

</div>

Hi there, I’m trying to make my Julia code as fast as possible and a friend of mine recommended using precompile. I have read about it but I’m not sure how to proceed, do I precompile the package I’m using o the functio…

---

## [Retarded Gravitation problem (delay differential equations with variable delay)](https://discourse.julialang.org/t/retarded-gravitation-problem-delay-differential-equations-with-variable-delay/86479)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 16\
**Last updated:** [August 31, 2022, 6:45pm UTC](https://discourse.julialang.org/t/retarded-gravitation-problem-delay-differential-equations-with-variable-delay/86479 "2022-08-31T18:45:05Z")

</div>

A friend and I were discussing gravity including retarded potentials from the finite speed of light. This is not general relativity but more like special relativity applied to gravity. We had the idea to simulate some “…

---

## [@pyimport numpy throwing an error when precompiling a module](https://discourse.julialang.org/t/pyimport-numpy-throwing-an-error-when-precompiling-a-module/86599)

<div class="topic-metadata">

**Author:** [@jcrismer](https://discourse.julialang.org/u/jcrismer)\
**Replies:** 5\
**Last updated:** [August 31, 2022, 6:43pm UTC](https://discourse.julialang.org/t/pyimport-numpy-throwing-an-error-when-precompiling-a-module/86599 "2022-08-31T18:43:49Z")

</div>

Hi everyone ! I am running on a Mac (with M1 chip) and I am quite new to Julia. I am currently modifying an existing Julia package. I want to call/write some python code requiring importing numpy. However when precompil…

---

## [Why doesn't islowercase work on String?](https://discourse.julialang.org/t/why-doesnt-islowercase-work-on-string/86173)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 14\
**Last updated:** [August 31, 2022, 3:51pm UTC](https://discourse.julialang.org/t/why-doesnt-islowercase-work-on-string/86173 "2022-08-31T15:51:14Z")

</div>

Why doesn’t islowercase work on String? It only works on characters.

---

## [JuliaFormatter whitespace in keyword arguments](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596)

<div class="topic-metadata">

**Author:** [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Replies:** 8\
**Last updated:** [August 31, 2022, 2:49pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596 "2022-08-31T14:49:47Z")

</div>

I was using JuliaFormatter through the Julia VSCode extension and I noticed that the default behaviour seems to be to remove the whitespaces. However, in the README file in Github it says that the default behaviour is t…

---

## [OrdinaryDiffEq fails to precompile in julia 1.7.2](https://discourse.julialang.org/t/ordinarydiffeq-fails-to-precompile-in-julia-1-7-2/77337)

<div class="topic-metadata">

**Author:** [@jackblyle](https://discourse.julialang.org/u/jackblyle)\
**Replies:** 11\
**Last updated:** [August 31, 2022, 1:39pm UTC](https://discourse.julialang.org/t/ordinarydiffeq-fails-to-precompile-in-julia-1-7-2/77337 "2022-08-31T13:39:44Z")

</div>

I am suddenly getting an error when precompiling the OrdinaryDiffEq package. I originally ran into it in a jupyter-lab notebook (ipynb) that worked a few days ago. I then tried creating a new environment and I still ge…

---

## [Plotting with independent series](https://discourse.julialang.org/t/plotting-with-independent-series/86576)

<div class="topic-metadata">

**Author:** [@catzilla](https://discourse.julialang.org/u/catzilla)\
**Replies:** 3\
**Last updated:** [August 31, 2022, 9:46am UTC](https://discourse.julialang.org/t/plotting-with-independent-series/86576 "2022-08-31T09:46:06Z")

</div>

How do you modify series attributes independently? For example, to plot data \[x,y, color, shape\], I would like to plot in 2D, with each data point given its corresponding color and shape. I have tried @df df scatter(:…

---

## [Add colum to dataframe with values based on various conditions](https://discourse.julialang.org/t/add-colum-to-dataframe-with-values-based-on-various-conditions/86565)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 5\
**Last updated:** [August 31, 2022, 9:19am UTC](https://discourse.julialang.org/t/add-colum-to-dataframe-with-values-based-on-various-conditions/86565 "2022-08-31T09:19:13Z")

</div>

I have the following structure: A DataFrame containing parameters and results from numeric simulations. A Vector{Dict} object. Each Dict contains keys equivalent to some of the columns of the DataFrame and the correspo…

---

## [Response to Pkg.jl and Julia Environments for Beginners by Jules](https://discourse.julialang.org/t/response-to-pkg-jl-and-julia-environments-for-beginners-by-jules/86552)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 10\
**Last updated:** [August 31, 2022, 7:36am UTC](https://discourse.julialang.org/t/response-to-pkg-jl-and-julia-environments-for-beginners-by-jules/86552 "2022-08-31T07:36:24Z")

</div>

jkrumbiegel.com - Pkg.jl and Julia Environments for Beginners Thank you so much @jules for the great writeup. That clarified a lot for me. Consider adding this as a tutorial to the Pkg documentation. The existing docum…

---

## [Using push! to add a new row of data](https://discourse.julialang.org/t/using-push-to-add-a-new-row-of-data/86519)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 13\
**Last updated:** [August 31, 2022, 7:18am UTC](https://discourse.julialang.org/t/using-push-to-add-a-new-row-of-data/86519 "2022-08-31T07:18:30Z")

</div>

What is the proper way of using push to add rows to an existing matrix? I keep getting errors for the below code: LL = fill(NaN, (0,2)); for j ∈ 1:n #180 for i ∈ 1:m #360 push!(LL, \[X\[i,j\], Y\[i,j\]\]); end…

---

## [HTTP.request closewrite](https://discourse.julialang.org/t/http-request-closewrite/86583)

<div class="topic-metadata">

**Author:** [@sransome](https://discourse.julialang.org/u/sransome)\
**Replies:** 6\
**Last updated:** [August 31, 2022, 5:50am UTC](https://discourse.julialang.org/t/http-request-closewrite/86583 "2022-08-31T05:50:31Z")

</div>

Hi, I have an application that makes hundreds of HTTP requests every day for the last 12 months. Today, after upgrading to 1.8.0 I have different behavior that results in a fail. This code is in a loop that call it hu…

---

## [Find the position of a single non-matching character between two strings](https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 27\
**Last updated:** [August 30, 2022, 9:47pm UTC](https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560 "2022-08-30T21:47:40Z")

</div>

To find the position of a single non-matching character between two strings: s1 = "part1\_Z\_part2.txt" s2 = "part1\_Y\_part2.txt" ix = findfirst(\[!=(c\[1\],c\[2\]) for c in zip(s1,s2)\]) Is there a simpler way to write findfi…

---

## [Generically create an instance of \`AA \<: AbstractArray\` with contents 1,2,3](https://discourse.julialang.org/t/generically-create-an-instance-of-aa-abstractarray-with-contents-1-2-3/86570)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 3\
**Last updated:** [August 30, 2022, 8:45pm UTC](https://discourse.julialang.org/t/generically-create-an-instance-of-aa-abstractarray-with-contents-1-2-3/86570 "2022-08-30T20:45:05Z")

</div>

This is a fairly concrete question: the user passes in a type AA \<: AbstractArray and I want to make a concrete instantiation of this type which contains some specified data, e.g. \[1,2,3\]. Here is the best I’ve come up w…

---

## [XML syntax highlighting when printing to terminal?](https://discourse.julialang.org/t/xml-syntax-highlighting-when-printing-to-terminal/86414)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [August 30, 2022, 8:36pm UTC](https://discourse.julialang.org/t/xml-syntax-highlighting-when-printing-to-terminal/86414 "2022-08-30T20:36:05Z")

</div>

I was curious about whether or not there is a way to automatically color format XML statements such as (all grey in terminal): \<simulationdomain\> \<posmin x="default" y="default" z="default"/\> \<posmax x="default" y="…

---

## [How to get correct formatting using EzXML?](https://discourse.julialang.org/t/how-to-get-correct-formatting-using-ezxml/66428)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [August 30, 2022, 8:32pm UTC](https://discourse.julialang.org/t/how-to-get-correct-formatting-using-ezxml/66428 "2022-08-30T20:32:58Z")

</div>

Hi! I am using EzXML trying to make my own custom XML file through julia. I want something that looks like: \<?xml version="1.0" encoding="UTF-8" ?\> \<case\> \<casedef\> \<constantsdef\> \<g…

---

## [Resource usage in versions 1.7.2 and 1.8.0](https://discourse.julialang.org/t/resource-usage-in-versions-1-7-2-and-1-8-0/86111)

<div class="topic-metadata">

**Author:** [@marllos](https://discourse.julialang.org/u/marllos)\
**Replies:** 19\
**Last updated:** [August 30, 2022, 7:58pm UTC](https://discourse.julialang.org/t/resource-usage-in-versions-1-7-2-and-1-8-0/86111 "2022-08-30T19:58:54Z")

</div>

Hello everyone. I updated Julia from version 1.7.2 to 1.8.0 and had a surprise: a code that used 2 GB of RAM, now uses 10 GB, and the number of subprocesses (htop) also increased from 8 to 64! Is this normal? I was a bit…

---

## [Are julia -p x and addprocs(x) equivalent?](https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 1\
**Last updated:** [August 30, 2022, 7:08pm UTC](https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554 "2022-08-30T19:08:52Z")

</div>

I want to use multiple threads on multiple workers. Will the two sets of commands produce equivalent results? export JULIA\_NUM\_THREADS=20 julia addprocs(12) export JULIA\_NUM\_THREADS=20 julia -p 12

---

## [Common zscale for contour subplots](https://discourse.julialang.org/t/common-zscale-for-contour-subplots/86543)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [August 30, 2022, 4:36pm UTC](https://discourse.julialang.org/t/common-zscale-for-contour-subplots/86543 "2022-08-30T16:36:11Z")

</div>

Hi all, I have a group of contour subplots (see below). I would like to reduce the scales to one, rather than have redundant scales. I am trying to figure out how to (1) remove white space in color scale for missing val…

---

## [Julia 1.8: ChainRules does not have Adapt in its dependencies](https://discourse.julialang.org/t/julia-1-8-chainrules-does-not-have-adapt-in-its-dependencies/86474)

<div class="topic-metadata">

**Author:** [@Xavier\_Gonzalez](https://discourse.julialang.org/u/Xavier_Gonzalez)\
**Replies:** 4\
**Last updated:** [August 30, 2022, 2:57pm UTC](https://discourse.julialang.org/t/julia-1-8-chainrules-does-not-have-adapt-in-its-dependencies/86474 "2022-08-30T14:57:21Z")

</div>

I’m working on a codebase I’ve inherited. It runs completely fine in Julia 1.7 However, if I run identical code in Julia 1.8, I get the following error message ERROR: LoadError: ArgumentError: Package ChainRules does n…

---

## [How to use JuliaCall?](https://discourse.julialang.org/t/how-to-use-juliacall/86549)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 4\
**Last updated:** [August 30, 2022, 2:49pm UTC](https://discourse.julialang.org/t/how-to-use-juliacall/86549 "2022-08-30T14:49:55Z")

</div>

Hi, I want to try JuliaCall but I’m finding the instructions extremely difficult to understand. This is my second attempt so I don’t remember well what I did in the first time. This time I managed to reach the point whe…

---

## [How to use 3d annotations](https://discourse.julialang.org/t/how-to-use-3d-annotations/86551)

<div class="topic-metadata">

**Author:** [@Starpower\_Power](https://discourse.julialang.org/u/Starpower_Power)\
**Replies:** 1\
**Last updated:** [August 30, 2022, 2:28pm UTC](https://discourse.julialang.org/t/how-to-use-3d-annotations/86551 "2022-08-30T14:28:33Z")

</div>

as of now we can only use 2d annotations, how to use 3d annotations. thanks

---

## [Swap two cells in Pluto](https://discourse.julialang.org/t/swap-two-cells-in-pluto/86525)

<div class="topic-metadata">

**Author:** [@Xavier\_Gonzalez](https://discourse.julialang.org/u/Xavier_Gonzalez)\
**Replies:** 5\
**Last updated:** [August 30, 2022, 12:09pm UTC](https://discourse.julialang.org/t/swap-two-cells-in-pluto/86525 "2022-08-30T12:09:34Z")

</div>

In colab, I can switch the location of two cells by pressing up or down arrows. Is there an equivalent way to do so in Pluto? I would really like to do so in order to restructure the order of my notebook.

---

## [Plotting timeseries](https://discourse.julialang.org/t/plotting-timeseries/86539)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 1\
**Last updated:** [August 30, 2022, 9:22am UTC](https://discourse.julialang.org/t/plotting-timeseries/86539 "2022-08-30T09:22:44Z")

</div>

I have 96 samples at 15 minute intervals. I’d like to plot this with a marker for each sample and the x axis to be appropriate for my sample times (00:00, 00:15,…) although not comprehensive. using Dates using Plots y =…

---

## [Does eig() which need Arpack.jl not support zygote?](https://discourse.julialang.org/t/does-eig-which-need-arpack-jl-not-support-zygote/86538)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 0\
**Last updated:** [August 30, 2022, 7:28am UTC](https://discourse.julialang.org/t/does-eig-which-need-arpack-jl-not-support-zygote/86538 "2022-08-30T07:28:26Z")

</div>

julia\> using Arpack julia\> function f(x) val, vec = eigs( x; nev = 1, which = :LM, maxiter = 300 ) return log(real(val\[1\])) end f (generic function with 1 method) julia\> x0 = rand(4,4) 4×4 Matr…

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

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