# General Usage

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

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

**Page:** 180

---

## [Vector operation to vector of structures](https://discourse.julialang.org/t/vector-operation-to-vector-of-structures/112927)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 1\
**Last updated:** [April 14, 2024, 5:47pm UTC](https://discourse.julialang.org/t/vector-operation-to-vector-of-structures/112927 "2024-04-14T17:47:13Z")

</div>

Good morning, If I have a vector of structs say s, I know I can set and get a field for all elements at once by using setfield!. and getfield. . Is there a convenient way of ensuring that I can use s.x . I guess th…

---

## [Combining multi-processing and multi-threading](https://discourse.julialang.org/t/combining-multi-processing-and-multi-threading/112695)

<div class="topic-metadata">

**Author:** [@sschlenkrich](https://discourse.julialang.org/u/sschlenkrich)\
**Replies:** 8\
**Last updated:** [April 14, 2024, 8:57am UTC](https://discourse.julialang.org/t/combining-multi-processing-and-multi-threading/112695 "2024-04-14T08:57:02Z")

</div>

I have a complex numerical simulation which I want to parallelise on large machines. I struggle a bit with the optimal parallelisation strategy. And I am hoping to get some hints what to try/avoid from the community. To…

---

## [Is there a faster way to perform this reduction?](https://discourse.julialang.org/t/is-there-a-faster-way-to-perform-this-reduction/112915)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 4\
**Last updated:** [April 13, 2024, 11:39pm UTC](https://discourse.julialang.org/t/is-there-a-faster-way-to-perform-this-reduction/112915 "2024-04-13T23:39:36Z")

</div>

Hello! I’ve wondered if there is faster/straight-forward way to improve the speed of this way of performing reduction? using BenchmarkTools using Random # Define the function reduce\_sum! function reduce\_sum!(target\_ar…

---

## [Franklin.jl — automatically evaluate \`.jl\` file on change](https://discourse.julialang.org/t/franklin-jl-automatically-evaluate-jl-file-on-change/92580)

<div class="topic-metadata">

**Author:** [@mpf01](https://discourse.julialang.org/u/mpf01)\
**Replies:** 8\
**Last updated:** [April 13, 2024, 7:39pm UTC](https://discourse.julialang.org/t/franklin-jl-automatically-evaluate-jl-file-on-change/92580 "2024-04-13T19:39:08Z")

</div>

I understand that Franklin’s offline evaluation is meant to manually and outside of the live-evaluation workflow. Is there a way, however, to make Franklin watch for changes in a directory, and execute generate\_results.j…

---

## [\[ANN\] Asynchronous Workflow Using Julia Tutorial](https://discourse.julialang.org/t/ann-asynchronous-workflow-using-julia-tutorial/92756)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 1\
**Last updated:** [April 13, 2024, 7:36pm UTC](https://discourse.julialang.org/t/ann-asynchronous-workflow-using-julia-tutorial/92756 "2024-04-13T19:36:58Z")

</div>

Hi folks :wave: I recently wrote a blog post on an asynchronous workflow within Julia that can be used for data science, literate programming, and other sorts of work flows. I was inspired by a discussion here: Franklin…

---

## [UnicodePlots.jl not working when running scripts from the command line](https://discourse.julialang.org/t/unicodeplots-jl-not-working-when-running-scripts-from-the-command-line/112912)

<div class="topic-metadata">

**Author:** [@Justin\_Booth](https://discourse.julialang.org/u/Justin_Booth)\
**Replies:** 1\
**Last updated:** [April 13, 2024, 6:48pm UTC](https://discourse.julialang.org/t/unicodeplots-jl-not-working-when-running-scripts-from-the-command-line/112912 "2024-04-13T18:48:16Z")

</div>

I’ve been running into some issues with UnicodePlots.jl and have isolated a test case: When I run this script from the command line (I’ve tried PowerShell, windows cmd, and the integrated terminal in VSCode), nothing…

---

## [Reading EDFs in Julia preserving floating point values](https://discourse.julialang.org/t/reading-edfs-in-julia-preserving-floating-point-values/112911)

<div class="topic-metadata">

**Author:** [@Santiago\_Lopez](https://discourse.julialang.org/u/Santiago_Lopez)\
**Replies:** 5\
**Last updated:** [April 13, 2024, 5:49pm UTC](https://discourse.julialang.org/t/reading-edfs-in-julia-preserving-floating-point-values/112911 "2024-04-13T17:49:17Z")

</div>

The EDF.jl currently has a limitation; namely, that it automatically converts signals into integers. This is exlicitly stated in the \[official documentation:\] (API · EDF.jl) under EDF.file. I’m interested in reading EDF…

---

## [Regex assistance converting from R to Julia](https://discourse.julialang.org/t/regex-assistance-converting-from-r-to-julia/112852)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 12\
**Last updated:** [April 13, 2024, 3:12pm UTC](https://discourse.julialang.org/t/regex-assistance-converting-from-r-to-julia/112852 "2024-04-13T15:12:23Z")

</div>

I am working on converting a regular expression from the R format to Julia format. I have made a fair bit of progress, but I am kinda stuck. I was hoping that someone with greater regex mojo might be able to help out. I…

---

## [Task scheduling puzzle](https://discourse.julialang.org/t/task-scheduling-puzzle/112876)

<div class="topic-metadata">

**Author:** [@sgaure](https://discourse.julialang.org/u/sgaure)\
**Replies:** 0\
**Last updated:** [April 12, 2024, 12:58pm UTC](https://discourse.julialang.org/t/task-scheduling-puzzle/112876 "2024-04-12T12:58:41Z")

</div>

I have a somewhat puzzling behaviour with task scheduling. I’ve this example: using BenchmarkTools using Base.Threads function work(n) x = pi/4 for i in 1:n x \*= 4\*(1-x) (i & 0x3ff == 0) && yiel…

---

## [Fitting a 1D distribution using Gaussian Mixtures](https://discourse.julialang.org/t/fitting-a-1d-distribution-using-gaussian-mixtures/28113)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 18\
**Last updated:** [April 12, 2024, 3:51pm UTC](https://discourse.julialang.org/t/fitting-a-1d-distribution-using-gaussian-mixtures/28113 "2024-04-12T15:51:21Z")

</div>

I struggle to fit my data using Gaussian mixtures with Julia. I found the package GitHub - davidavdav/GaussianMixtures.jl: Large scale Gaussian Mixture Models which seems to work similarly to the scikit-stuff I used befo…

---

## [Basic guide on making things that dominate in Julia](https://discourse.julialang.org/t/basic-guide-on-making-things-that-dominate-in-julia/112873)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 1\
**Last updated:** [April 12, 2024, 12:06pm UTC](https://discourse.julialang.org/t/basic-guide-on-making-things-that-dominate-in-julia/112873 "2024-04-12T12:06:18Z")

</div>

Here is my analysis on making your product in Julia that’s the best. Julia’s promise has been two solve two cultures problem. However, while that is a broad guideline, that alone does NOT make a competitive product with…

---

## [What is the design and proper usage of functions in Base that starts with underscore?](https://discourse.julialang.org/t/what-is-the-design-and-proper-usage-of-functions-in-base-that-starts-with-underscore/112868)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 2\
**Last updated:** [April 12, 2024, 11:03am UTC](https://discourse.julialang.org/t/what-is-the-design-and-proper-usage-of-functions-in-base-that-starts-with-underscore/112868 "2024-04-12T11:03:19Z")

</div>

I’ve found HDF5.jl breaks for Vector of String in 1.10.2 (not really, see below). The reason is, Base.\_memcpy! is removed from julia/base/reinterpretarray.jl, which is used in \_type\_load in HDF5.jl. I’ve checked Base.\_m…

---

## [Example of Clang.jl wrapping C interface using GMP mpq\_t (also arrays of mpq\_t)](https://discourse.julialang.org/t/example-of-clang-jl-wrapping-c-interface-using-gmp-mpq-t-also-arrays-of-mpq-t/112864)

<div class="topic-metadata">

**Author:** [@JonT](https://discourse.julialang.org/u/JonT)\
**Replies:** 0\
**Last updated:** [April 12, 2024, 9:12am UTC](https://discourse.julialang.org/t/example-of-clang-jl-wrapping-c-interface-using-gmp-mpq-t-also-arrays-of-mpq-t/112864 "2024-04-12T09:12:22Z")

</div>

I’m stumbling through wrapping an interface to a C library using Clang.jl. Im hoping someone can. give me some hints about the best way to wrap methods passing and returning GMP mpq\_t types, or arrays of them. I found …

---

## [Blind destructuring of a tuple/NamedTuple?](https://discourse.julialang.org/t/blind-destructuring-of-a-tuple-namedtuple/112861)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [April 12, 2024, 8:49am UTC](https://discourse.julialang.org/t/blind-destructuring-of-a-tuple-namedtuple/112861 "2024-04-12T08:49:52Z")

</div>

Hello! Could someone show me a way to achieve this: v = (x=1, y=2) @destructure v println("x = $x, y = $y") Basically I want through a macro or some other way, to be able to take all the pairs/values in a tuple and…

---

## [Displaying numbers in Julia](https://discourse.julialang.org/t/displaying-numbers-in-julia/112807)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 15\
**Last updated:** [April 11, 2024, 11:04pm UTC](https://discourse.julialang.org/t/displaying-numbers-in-julia/112807 "2024-04-11T23:04:27Z")

</div>

I want to make a very simple calculation: julia\> 6500 \* ( (1.10)^58 ) 1.6356451710902702e6 But, the format I’m hoping to for is 1,635,645.17 or 1635645.17. I spent 10 minutes searching the internet & Julia built in h…

---

## [Elegant way to vcat vectors and remove nothing elements?](https://discourse.julialang.org/t/elegant-way-to-vcat-vectors-and-remove-nothing-elements/112835)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 5\
**Last updated:** [April 11, 2024, 10:10pm UTC](https://discourse.julialang.org/t/elegant-way-to-vcat-vectors-and-remove-nothing-elements/112835 "2024-04-11T22:10:16Z")

</div>

Suppose I have: a = \[1;2;3\] b = \[4;5;6\] c = nothing d = \[7;8;9\] In my code, somtimes c will have values, other times it will not. I can guarantee that the type of all variables is the same. What I want is then a functi…

---

## [How to update multiple interactive plots with Interact.jl?](https://discourse.julialang.org/t/how-to-update-multiple-interactive-plots-with-interact-jl/112848)

<div class="topic-metadata">

**Author:** [@kirklong](https://discourse.julialang.org/u/kirklong)\
**Replies:** 0\
**Last updated:** [April 11, 2024, 9:36pm UTC](https://discourse.julialang.org/t/how-to-update-multiple-interactive-plots-with-interact-jl/112848 "2024-04-11T21:36:32Z")

</div>

I am trying to create a simple GUI to visualize a model, and turned to Interact.jl. Consider the following minimal working example of a simple interactive sine wave: function appTest(;θ0) f,shift,A = θ0 f = spin…

---

## [Package keeps precompiling after starting Julia every single time](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843)

<div class="topic-metadata">

**Author:** [@claud10c](https://discourse.julialang.org/u/claud10c)\
**Replies:** 2\
**Last updated:** [April 11, 2024, 9:14pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843 "2024-04-11T21:14:22Z")

</div>

I have created a package for computing maximum independent sets. The package uses two JLL wrappers built by me as well. The package is registered and you can load it using \] add MaximumIndependentSet. The source code is…

---

## [Best Practices for converting a Mathematica expression to Julia](https://discourse.julialang.org/t/best-practices-for-converting-a-mathematica-expression-to-julia/18335)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 33\
**Last updated:** [April 11, 2024, 8:24pm UTC](https://discourse.julialang.org/t/best-practices-for-converting-a-mathematica-expression-to-julia/18335 "2024-04-11T20:24:36Z")

</div>

Are there suggestions how to convert a rather long Mathematica expression to Julia? With Matlab I use http://library.wolfram.com/infocenter/MathSource/577/ I also would appreciate suggestions for the same problem with …

---

## [DataFrames: conditional probabilities](https://discourse.julialang.org/t/dataframes-conditional-probabilities/112805)

<div class="topic-metadata">

**Author:** [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Replies:** 11\
**Last updated:** [April 11, 2024, 7:19pm UTC](https://discourse.julialang.org/t/dataframes-conditional-probabilities/112805 "2024-04-11T19:19:30Z")

</div>

I have two DataFrames. One gives Prob(Z | Y), the other Prob(Y | X). I would like to compute Prob(Z | X). How? M(non)WE: using DataFrames, Random dfZY = DataFrame( z = repeat(\[1,2\]; outer = 3), y = repeat(\[1,…

---

## [Broadcasting behavior of @. with functions?](https://discourse.julialang.org/t/broadcasting-behavior-of-with-functions/112833)

<div class="topic-metadata">

**Author:** [@hatmatrix](https://discourse.julialang.org/u/hatmatrix)\
**Replies:** 4\
**Last updated:** [April 11, 2024, 7:03pm UTC](https://discourse.julialang.org/t/broadcasting-behavior-of-with-functions/112833 "2024-04-11T19:03:33Z")

</div>

I have a question regarding the use of the @. macro as it does not work when used to broadcast the result of an anonymous function. Here is an example below which works. x = 1. z = \[1., 1.\] @. (z - x) Now I replace z …

---

## [Dict of NamedTuple](https://discourse.julialang.org/t/dict-of-namedtuple/112836)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 4\
**Last updated:** [April 11, 2024, 5:34pm UTC](https://discourse.julialang.org/t/dict-of-namedtuple/112836 "2024-04-11T17:34:56Z")

</div>

Hello ! :grinning: I have a question about a behavior I don’t understand when I try to make a dictionary composed of NamedTuple. Each of these NamedTuple corresponds to a parameter set of a simulation. For example: ju…

---

## [What's the feature in quarto that are missing in Literate/Documenter/Wave?](https://discourse.julialang.org/t/whats-the-feature-in-quarto-that-are-missing-in-literate-documenter-wave/112804)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [April 11, 2024, 4:37pm UTC](https://discourse.julialang.org/t/whats-the-feature-in-quarto-that-are-missing-in-literate-documenter-wave/112804 "2024-04-11T16:37:26Z")

</div>

Out of curiosity, which are the features in quarto that are missing in Literate/Documenter/Wave? Which are the advantasges of quarto? What could I get “more” (or more easily) in Quarto?

---

## [How to use \`jl\_ptr\_to\_array\`?](https://discourse.julialang.org/t/how-to-use-jl-ptr-to-array/112834)

<div class="topic-metadata">

**Author:** [@dmitry-kabanov](https://discourse.julialang.org/u/dmitry-kabanov)\
**Replies:** 0\
**Last updated:** [April 11, 2024, 3:40pm UTC](https://discourse.julialang.org/t/how-to-use-jl-ptr-to-array/112834 "2024-04-11T15:40:28Z")

</div>

Hi, I have difficulties with the correct usage of the function jl\_ptr\_to\_array. Particularly, there is no explanation in the documentation on embedding, neighter in the source code on how to construct the third argument …

---

## [DiscreteCallback takes a break: discrete callback shows counterintuitive behaviour in DifferentialEquations.jl](https://discourse.julialang.org/t/discretecallback-takes-a-break-discrete-callback-shows-counterintuitive-behaviour-in-differentialequations-jl/112768)

<div class="topic-metadata">

**Author:** [@flmuk](https://discourse.julialang.org/u/flmuk)\
**Replies:** 2\
**Last updated:** [April 11, 2024, 3:36pm UTC](https://discourse.julialang.org/t/discretecallback-takes-a-break-discrete-callback-shows-counterintuitive-behaviour-in-differentialequations-jl/112768 "2024-04-11T15:36:34Z")

</div>

Hello, I have a question about the behaviour of callbacks using DifferentialEquations.jl, because I find the behaviour of DiscreteCallbacks counterintuitive. Consider the following code, i.e. an adaptation of this: us…

---

## [How to enforce constraints with SymbolicRegression.jl](https://discourse.julialang.org/t/how-to-enforce-constraints-with-symbolicregression-jl/112832)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 1\
**Last updated:** [April 11, 2024, 2:53pm UTC](https://discourse.julialang.org/t/how-to-enforce-constraints-with-symbolicregression-jl/112832 "2024-04-11T14:53:11Z")

</div>

Hello, I am interested in whether symbolic regression could be used to learn or approximate likelihood functions of simulation-based models. One approach might be approximate the pdf from simulated data using kernel den…

---

## [Understanding Meshes and GeoTables visualisation capabilities](https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 13\
**Last updated:** [April 11, 2024, 12:47pm UTC](https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353 "2024-04-11T12:47:35Z")

</div>

I’m currently testing Meshes.jl and GeoTables to see if they can be useful for my finite element analyses. Part of the logic still feels a bit weird to me (attaching data to a topology feels a bit restrictive, but that i…

---

## [Difference between project.toml and required package versions](https://discourse.julialang.org/t/difference-between-project-toml-and-required-package-versions/112818)

<div class="topic-metadata">

**Author:** [@ovanvincq](https://discourse.julialang.org/u/ovanvincq)\
**Replies:** 3\
**Last updated:** [April 11, 2024, 11:15am UTC](https://discourse.julialang.org/t/difference-between-project-toml-and-required-package-versions/112818 "2024-04-11T11:15:16Z")

</div>

Can anyone explain to me why the package MMG\_jll.jl cannot be installed with version 7 of SCOTCH\_jll.jl ? When installing MMG\_jll.jl, Pkg installs the version 6 of SCOTCH\_jll.jl and I cannot upgrade it to version 7 with…

---

## [Running Julia in a SLURM Cluster](https://discourse.julialang.org/t/running-julia-in-a-slurm-cluster/67614)

<div class="topic-metadata">

**Author:** [@Noah\_Guzman](https://discourse.julialang.org/u/Noah_Guzman)\
**Replies:** 6\
**Last updated:** [April 11, 2024, 11:11am UTC](https://discourse.julialang.org/t/running-julia-in-a-slurm-cluster/67614 "2024-04-11T11:11:15Z")

</div>

I’m looking to provide an explicit explanation of the simplest way to get a Julia program running in parallel across multiple nodes in a SLURM cluster (basically a minimal working example that illustrates the logic). My…

---

## [Understanding Distributed Programming in Julia](https://discourse.julialang.org/t/understanding-distributed-programming-in-julia/112801)

<div class="topic-metadata">

**Author:** [@Utkarsh\_Sharma](https://discourse.julialang.org/u/Utkarsh_Sharma)\
**Replies:** 3\
**Last updated:** [April 11, 2024, 10:16am UTC](https://discourse.julialang.org/t/understanding-distributed-programming-in-julia/112801 "2024-04-11T10:16:35Z")

</div>

According to the documentation, fetch() will - Wait for a \[\`Task’\] (Tasks · The Julia Language) to finish, then return its result value. For the code and its output given below, I have the following questions - How d…

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

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