# General Usage

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

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

**Page:** 483

---

## [How to mutate static arrays?](https://discourse.julialang.org/t/how-to-mutate-static-arrays/7870)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 13\
**Last updated:** [February 17, 2022, 12:05pm UTC](https://discourse.julialang.org/t/how-to-mutate-static-arrays/7870 "2022-02-17T12:05:45Z")

</div>

From the README: The package provides a range of different useful built-in StaticArray types, which include mutable and immutable arrays based upon tuples, arrays based upon structs, and wrappers of Array. There is a r…

---

## [How to get empty markers, Plots, gr() backend](https://discourse.julialang.org/t/how-to-get-empty-markers-plots-gr-backend/20069)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 14\
**Last updated:** [February 17, 2022, 10:56am UTC](https://discourse.julialang.org/t/how-to-get-empty-markers-plots-gr-backend/20069 "2022-02-17T10:56:39Z")

</div>

If I have something like this plot(x, y, shape = :rect, m = (5, :black, stroke(1, :red)) the second option in m fills my marker with that color. But what I want is an empty marker, not white. Empty! Is this possible he…

---

## [Calculating 2-point correlation of a large 3D array: \`view\` seems to make it worse?](https://discourse.julialang.org/t/calculating-2-point-correlation-of-a-large-3d-array-view-seems-to-make-it-worse/76493)

<div class="topic-metadata">

**Author:** [@Ickaser](https://discourse.julialang.org/u/Ickaser)\
**Replies:** 2\
**Last updated:** [February 17, 2022, 2:46am UTC](https://discourse.julialang.org/t/calculating-2-point-correlation-of-a-large-3d-array-view-seems-to-make-it-worse/76493 "2022-02-17T02:46:53Z")

</div>

I am trying to calculate the 2-point correlation of a large 3D BitArray (the data comes from a micro-CT scan of a porous structure, which I have already thresholded, hence each voxel is either 1 or 0). At the moment, I a…

---

## [LibPQ, missing to nothing in query result](https://discourse.julialang.org/t/libpq-missing-to-nothing-in-query-result/76591)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 0\
**Last updated:** [February 16, 2022, 9:39pm UTC](https://discourse.julialang.org/t/libpq-missing-to-nothing-in-query-result/76591 "2022-02-16T21:39:55Z")

</div>

Hello LibPQ users! Is there a simple way to replace missing on nothing in the query result?

---

## [How to organize loop with long prologue and epilogue that switches depending on task](https://discourse.julialang.org/t/how-to-organize-loop-with-long-prologue-and-epilogue-that-switches-depending-on-task/76566)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 12\
**Last updated:** [February 16, 2022, 8:35pm UTC](https://discourse.julialang.org/t/how-to-organize-loop-with-long-prologue-and-epilogue-that-switches-depending-on-task/76566 "2022-02-16T20:35:16Z")

</div>

imagine the main loop boils down to this: function main(table) # prologue: 30 lines to set up result for r in table # 400 lines to filter and make composite variable # epilogue: 30 lines to fill variable …

---

## [How to do arithmetic in the type system?](https://discourse.julialang.org/t/how-to-do-arithmetic-in-the-type-system/76565)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 11\
**Last updated:** [February 16, 2022, 6:43pm UTC](https://discourse.julialang.org/t/how-to-do-arithmetic-in-the-type-system/76565 "2022-02-16T18:43:47Z")

</div>

I want to declare a struct with: struct MyStruct{L,P} a::SVector{L,Other1} b::SVector{P,Other2} c::SVector{L+P,Float64} end The third field gives error: MethodError: no method matching +(::TypeVar, ::TypeVa…

---

## [Plot size from subplots sizes](https://discourse.julialang.org/t/plot-size-from-subplots-sizes/76542)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 4\
**Last updated:** [February 16, 2022, 3:13pm UTC](https://discourse.julialang.org/t/plot-size-from-subplots-sizes/76542 "2022-02-16T15:13:47Z")

</div>

Hello I am creating multiple plots in this generic way: plot(p1,p2,p3, layout=grid(1,3, widths=(4/9,4/9,1/9)), size=(900,350)) My problem is that all of the plots p1,p2,p3 have already been given good sizes. When plo…

---

## [Can I pass MPI.jl communicator to the Fortran side?](https://discourse.julialang.org/t/can-i-pass-mpi-jl-communicator-to-the-fortran-side/76547)

<div class="topic-metadata">

**Author:** [@lucifer1004](https://discourse.julialang.org/u/lucifer1004)\
**Replies:** 4\
**Last updated:** [February 16, 2022, 1:36pm UTC](https://discourse.julialang.org/t/can-i-pass-mpi-jl-communicator-to-the-fortran-side/76547 "2022-02-16T13:36:43Z")

</div>

I have a Fortran program that uses File I/O, which I want to modify to a subroutine so that I can directly call it from Julia without writing to / reading from files. The problem is that the program depends heavily on M…

---

## [Adding a build step for CmdStan inside a Julia package](https://discourse.julialang.org/t/adding-a-build-step-for-cmdstan-inside-a-julia-package/51844)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 22\
**Last updated:** [February 16, 2022, 1:23pm UTC](https://discourse.julialang.org/t/adding-a-build-step-for-cmdstan-inside-a-julia-package/51844 "2022-02-16T13:23:13Z")

</div>

I’m looking for a way to ship a working CmdStan with a Julia project. Building it via BinaryBuilder seems to be off the table (see https://github.com/JuliaPackaging/Yggdrasil/issues/1023), but for my use-case it would b…

---

## [Why doesn't \`^\` promote its arguments?](https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444)

<div class="topic-metadata">

**Author:** [@Federico\_Marotta](https://discourse.julialang.org/u/Federico_Marotta)\
**Replies:** 20\
**Last updated:** [February 16, 2022, 1:14pm UTC](https://discourse.julialang.org/t/why-doesnt-promote-its-arguments/76444 "2022-02-16T13:14:51Z")

</div>

In Julia, if I write Int8(127) + 1 I get 128 as an answer (and not an overflow), because the two numbers are promoted to Int before performing the addition. The same promotion occurs for other operations like -, \*, and /,…

---

## [Argmax() -\> vector of index result](https://discourse.julialang.org/t/argmax-vector-of-index-result/76532)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 5\
**Last updated:** [February 16, 2022, 8:24am UTC](https://discourse.julialang.org/t/argmax-vector-of-index-result/76532 "2022-02-16T08:24:08Z")

</div>

What is the elegant solution for argmax? I was expecting that argmax just return indexes of maximum value, but it returns … … … (As it works in MATLAB for instance). am=argmax(randn(100,100,dims=2) mi=map(x-\>x\[2\],am) I…

---

## ["sum(\[1.0, 1e100, 1.0, -1e100\])" fails](https://discourse.julialang.org/t/sum-1-0-1e100-1-0-1e100-fails/76502)

<div class="topic-metadata">

**Author:** [@runjaj](https://discourse.julialang.org/u/runjaj)\
**Replies:** 13\
**Last updated:** [February 16, 2022, 12:03am UTC](https://discourse.julialang.org/t/sum-1-0-1e100-1-0-1e100-fails/76502 "2022-02-16T00:03:49Z")

</div>

I’ve seen a tweet from David Amos explaining this case where sum in Python fails miserably. The example is taken from BINARY FLOATING POINT SUMMATION ACCURATE TO FULL PRECISION (PYTHON RECIPE). Julia fails too: julia\> …

---

## [Using @printf to generate strings from format in Variable (maybe even in older Julia versions)](https://discourse.julialang.org/t/using-printf-to-generate-strings-from-format-in-variable-maybe-even-in-older-julia-versions/76337)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 4\
**Last updated:** [February 15, 2022, 9:06pm UTC](https://discourse.julialang.org/t/using-printf-to-generate-strings-from-format-in-variable-maybe-even-in-older-julia-versions/76337 "2022-02-15T21:06:51Z")

</div>

I am struggling a little bit with how to use @printf within my code (maybe even functioning in Julia 1.4). Consider the following minimal example, where I have a stream and the format given in some variables (in the con…

---

## [Breaking up long testset descriptions](https://discourse.julialang.org/t/breaking-up-long-testset-descriptions/76488)

<div class="topic-metadata">

**Author:** [@danielsoutar](https://discourse.julialang.org/u/danielsoutar)\
**Replies:** 5\
**Last updated:** [February 15, 2022, 4:28pm UTC](https://discourse.julialang.org/t/breaking-up-long-testset-descriptions/76488 "2022-02-15T16:28:47Z")

</div>

Very simple question - maybe even a feature request to open on JuliaLang repo. Basically, I would like to enforce a style guide where my code is at most 80 characters long, including tests. However, the @testset macro d…

---

## [Should julia libs adhere to a common Array & dataframe API?](https://discourse.julialang.org/t/should-julia-libs-adhere-to-a-common-array-dataframe-api/76491)

<div class="topic-metadata">

**Author:** [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)\
**Replies:** 2\
**Last updated:** [February 15, 2022, 4:01pm UTC](https://discourse.julialang.org/t/should-julia-libs-adhere-to-a-common-array-dataframe-api/76491 "2022-02-15T16:01:59Z")

</div>

Hi, I recently discovered this: Announcing the Consortium for Python Data API Standards. This is of course for Python but I wonder if a similar effort in julia would be opportune. I realise that in julia due to multipl…

---

## [How to check if date is summer time](https://discourse.julialang.org/t/how-to-check-if-date-is-summer-time/75950)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 4\
**Last updated:** [February 15, 2022, 3:44pm UTC](https://discourse.julialang.org/t/how-to-check-if-date-is-summer-time/75950 "2022-02-15T15:44:31Z")

</div>

Hi all, Didn’t find anything online and here on discourse. So here is my my question. How would I check if a date is summer or winter time? Cheers

---

## [RCall and Out of Memory Errors. Are there limits?](https://discourse.julialang.org/t/rcall-and-out-of-memory-errors-are-there-limits/76486)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 1\
**Last updated:** [February 15, 2022, 2:59pm UTC](https://discourse.julialang.org/t/rcall-and-out-of-memory-errors-are-there-limits/76486 "2022-02-15T14:59:17Z")

</div>

I am using RCall.jl to run some estimations of hidden markov models using the R package seqHMM. I have 64GB of RAM and task manager never shows me using above 20GB total, yet I am getting out of memory errors when estima…

---

## [How to capture an index in closure without allocating (or workaround)?](https://discourse.julialang.org/t/how-to-capture-an-index-in-closure-without-allocating-or-workaround/76334)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 4\
**Last updated:** [February 14, 2022, 9:20pm UTC](https://discourse.julialang.org/t/how-to-capture-an-index-in-closure-without-allocating-or-workaround/76334 "2022-02-14T21:20:36Z")

</div>

Sorry the code is a bit long but the middle testIt! function is where the question is. If I run run() as-is, there are ~160k allocations. However, if I comment out the code with i, then there are no allocations. I’m assu…

---

## [Open Python serialized object in julia](https://discourse.julialang.org/t/open-python-serialized-object-in-julia/76415)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 3\
**Last updated:** [February 14, 2022, 8:46pm UTC](https://discourse.julialang.org/t/open-python-serialized-object-in-julia/76415 "2022-02-14T20:46:51Z")

</div>

So I have a python script that produces a vector of float values. I wish to save this vector of values and then open it in Julia. Is there some serialization (for float vectors) which is both julia and python compatible…

---

## [Tullio 0.3.3 fails in Julia 1.7.2](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453)

<div class="topic-metadata">

**Author:** [@00shiv](https://discourse.julialang.org/u/00shiv)\
**Replies:** 13\
**Last updated:** [February 14, 2022, 8:44pm UTC](https://discourse.julialang.org/t/tullio-0-3-3-fails-in-julia-1-7-2/76453 "2022-02-14T20:44:41Z")

</div>

I have some Tullio 0.3.3.) code that works in 1.7.1 but not 1.7.2. I get a fairly large error message which I attach at the bottom. Before I try to produce a MWE I was wondering if someone knows something already. Thanks…

---

## [Behavior of \`Threads.@threads for\` loop](https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 30\
**Last updated:** [February 14, 2022, 4:28pm UTC](https://discourse.julialang.org/t/behavior-of-threads-threads-for-loop/76042 "2022-02-14T16:28:10Z")

</div>

I have code that assumes that each iteration of a Threads@threads for loop is run on a single thread. I.e., that one can use Threads.threadid() at the beginning of the loop to determine which thread is executing that lo…

---

## [Read HDF5 with variable number of keys](https://discourse.julialang.org/t/read-hdf5-with-variable-number-of-keys/35758)

<div class="topic-metadata">

**Author:** [@met-j](https://discourse.julialang.org/u/met-j)\
**Replies:** 3\
**Last updated:** [February 14, 2022, 4:20pm UTC](https://discourse.julialang.org/t/read-hdf5-with-variable-number-of-keys/35758 "2022-02-14T16:20:49Z")

</div>

I get HDF5 files of a measurement. These files are organized like \[key\_lvl1\]\[key\_lvl2\]\[...\]. The structure in the deeper levels is always the same. However, the first key level is a simple counter for the number of mea…

---

## [Using dot syntax and Symbols from Python](https://discourse.julialang.org/t/using-dot-syntax-and-symbols-from-python/76368)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 4\
**Last updated:** [February 14, 2022, 2:52pm UTC](https://discourse.julialang.org/t/using-dot-syntax-and-symbols-from-python/76368 "2022-02-14T14:52:56Z")

</div>

Is there a convenient way to use functions that make use of the dot syntax, as well as Symbols using juliacall (or alternatively pyjulia)? (Example code utilizing JuMP, after from juliacall import Main as jl) I know I c…

---

## [Allocation related problems](https://discourse.julialang.org/t/allocation-related-problems/76438)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 0\
**Last updated:** [February 14, 2022, 2:46pm UTC](https://discourse.julialang.org/t/allocation-related-problems/76438 "2022-02-14T14:46:01Z")

</div>

Hi, I have a question when I call python bayesian optimization from julia, but my problem is not about bayesian optimization, I think it should be related to memory allocation problems, here is an example that can show t…

---

## [Performance of large sparse discrete map problems in DifferentialEquations](https://discourse.julialang.org/t/performance-of-large-sparse-discrete-map-problems-in-differentialequations/76382)

<div class="topic-metadata">

**Author:** [@roryh](https://discourse.julialang.org/u/roryh)\
**Replies:** 8\
**Last updated:** [February 14, 2022, 2:12pm UTC](https://discourse.julialang.org/t/performance-of-large-sparse-discrete-map-problems-in-differentialequations/76382 "2022-02-14T14:12:55Z")

</div>

Hello, I normally deal with dynamics on networks, so I have giant sparse systems of coupled ODE’s. The problem I have at the moment is that for a simple discrete map, a naive implementation is significantly faster than …

---

## [Is it possible to pipe to a function of several variables?](https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 10\
**Last updated:** [February 14, 2022, 1:52pm UTC](https://discourse.julialang.org/t/is-it-possible-to-pipe-to-a-function-of-several-variables/76393 "2022-02-14T13:52:23Z")

</div>

In some other languages, like R, some package allows one to insert a call to a function of several variables into a sequence of pipes. This is done by specifying all arguments but one and inserting a . in the place of th…

---

## [How to sandbox Julia code](https://discourse.julialang.org/t/how-to-sandbox-julia-code/76388)

<div class="topic-metadata">

**Author:** [@David\_Sagan](https://discourse.julialang.org/u/David_Sagan)\
**Replies:** 11\
**Last updated:** [February 14, 2022, 1:47pm UTC](https://discourse.julialang.org/t/how-to-sandbox-julia-code/76388 "2022-02-14T13:47:20Z")

</div>

I need to come up with a system for sharing data between different laboratories located around the world. One possibility would be to use something like JSON but since I will be developing the data analysis code in Julia…

---

## [Pluto autosave failed and this pops when I \`cltr+C\`](https://discourse.julialang.org/t/pluto-autosave-failed-and-this-pops-when-i-cltr-c/76433)

<div class="topic-metadata">

**Author:** [@frydaydeep](https://discourse.julialang.org/u/frydaydeep)\
**Replies:** 0\
**Last updated:** [February 14, 2022, 1:44pm UTC](https://discourse.julialang.org/t/pluto-autosave-failed-and-this-pops-when-i-cltr-c/76433 "2022-02-14T13:44:29Z")

</div>

julia\> using Pluto julia\> Pluto.run() \[ Info: Loading... Opening http://localhost:1234/?secret=16szn87g in your default browser... ~ have fun! Press Ctrl+C in this terminal to stop Pluto Updating registry at \`C:\\…

---

## [Why won't \`savefig\` work with \`plotly\`?](https://discourse.julialang.org/t/why-wont-savefig-work-with-plotly/76410)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 0\
**Last updated:** [February 14, 2022, 10:25am UTC](https://discourse.julialang.org/t/why-wont-savefig-work-with-plotly/76410 "2022-02-14T10:25:16Z")

</div>

I have a program that runs without any problems. When I try to use the Plotly as a backend it generates an error (see at the bottom of this post). I can see 'Plotly and 'PlotlyBase in Project.toml. The command that cau…

---

## [RemoteREPL cannot connect on Windows over SSH](https://discourse.julialang.org/t/remoterepl-cannot-connect-on-windows-over-ssh/76338)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 1\
**Last updated:** [February 14, 2022, 9:20am UTC](https://discourse.julialang.org/t/remoterepl-cannot-connect-on-windows-over-ssh/76338 "2022-02-14T09:20:48Z")

</div>

I suspect that this is an ssh related problem: I am trying to connect my Windows Laptop to a Julia session on a Linux cloud server using the RemoteREPL package (which uses an ssh tunnel). I started the RemoteREPL server…

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

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