# General Usage

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

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

**Page:** 121

---

## [Download and read MNIST images](https://discourse.julialang.org/t/download-and-read-mnist-images/40549)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [October 22, 2024, 3:01pm UTC](https://discourse.julialang.org/t/download-and-read-mnist-images/40549 "2024-10-22T15:01:08Z")

</div>

I am trying to access MNIST images from MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burges. This works, but it looks a bit cumbersome. Is there a better way? Perhaps chaining everything witho…

---

## [CUDA nested structs not isbits \[solved\]](https://discourse.julialang.org/t/cuda-nested-structs-not-isbits-solved/121592)

<div class="topic-metadata">

**Author:** [@moukle](https://discourse.julialang.org/u/moukle)\
**Replies:** 0\
**Last updated:** [October 22, 2024, 2:07pm UTC](https://discourse.julialang.org/t/cuda-nested-structs-not-isbits-solved/121592 "2024-10-22T14:07:11Z")

</div>

Hi, can I somehow use nested structs inside CUDA kernels? Here is an example inspired by the custom structs section from the get started. using CUDA using Adapt struct Interpolate{A} xs::A ys::A end struct N…

---

## [Performance hacking \`(&)(a::BitArray, b::BitArray)\`](https://discourse.julialang.org/t/performance-hacking-a-bitarray-b-bitarray/121548)

<div class="topic-metadata">

**Author:** [@AJahraus](https://discourse.julialang.org/u/AJahraus)\
**Replies:** 14\
**Last updated:** [October 22, 2024, 2:44pm UTC](https://discourse.julialang.org/t/performance-hacking-a-bitarray-b-bitarray/121548 "2024-10-22T14:44:09Z")

</div>

I’m trying my hand at performance hacking the bitwise AND function, and although what I have is fairly good, it seems to me like it’s allocating much memory even though it seems as though it’s always just 2 allocations r…

---

## [How do I stop Julia optimising out a variable? (or how to use \`MPI.Ibarrier()\`?)](https://discourse.julialang.org/t/how-do-i-stop-julia-optimising-out-a-variable-or-how-to-use-mpi-ibarrier/121579)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 2\
**Last updated:** [October 22, 2024, 1:37pm UTC](https://discourse.julialang.org/t/how-do-i-stop-julia-optimising-out-a-variable-or-how-to-use-mpi-ibarrier/121579 "2024-10-22T13:37:48Z")

</div>

I want to use MPI.Ibarrier() to synchronize some processes where one needs to complete some work before the others can start, so that the first process does not need to wait at the barrier. Pseudo-code: using MPI comm …

---

## [Strange performance of literal array constructor](https://discourse.julialang.org/t/strange-performance-of-literal-array-constructor/121575)

<div class="topic-metadata">

**Author:** [@DNF](https://discourse.julialang.org/u/DNF)\
**Replies:** 5\
**Last updated:** [October 22, 2024, 1:21pm UTC](https://discourse.julialang.org/t/strange-performance-of-literal-array-constructor/121575 "2024-10-22T13:21:53Z")

</div>

I was surprised by this performance measurement (v.1.11.1): julia\> foo() = Int8\[1 2 3; 4 5 6; 7 8 9\] foo (generic function with 1 method) julia\> bar() = Matrix{Int8}(\[1 2 3; 4 5 6; 7 8 9\]) bar (generic function with 1 …

---

## [Execution of active file in REPL does not work anymore](https://discourse.julialang.org/t/execution-of-active-file-in-repl-does-not-work-anymore/121586)

<div class="topic-metadata">

**Author:** [@mariie](https://discourse.julialang.org/u/mariie)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 1:13pm UTC](https://discourse.julialang.org/t/execution-of-active-file-in-repl-does-not-work-anymore/121586 "2024-10-22T13:13:01Z")

</div>

Hello! I’ve been using julia since 2 months and really enjoyed it. But now I’m facing the problem that I cannot execute code in-line in files anymore, cannot execute an active file in the REPL unless I copy the code fr…

---

## [Send file with HTTP.post](https://discourse.julialang.org/t/send-file-with-http-post/91932)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 4\
**Last updated:** [October 22, 2024, 12:39pm UTC](https://discourse.julialang.org/t/send-file-with-http-post/91932 "2024-10-22T12:39:13Z")

</div>

Hi everyone, I’m looking to upload files via an API using Julia with the HTTP.jl package. Unfortunately, the API can’t retrieve my file, and I get an error: {“code”:500,“message”:“Unable to retrieve file from request.…

---

## [Full energy optimization error in LEAP-NEMO](https://discourse.julialang.org/t/full-energy-optimization-error-in-leap-nemo/121577)

<div class="topic-metadata">

**Author:** [@2024](https://discourse.julialang.org/u/2024)\
**Replies:** 0\
**Last updated:** [October 22, 2024, 9:33am UTC](https://discourse.julialang.org/t/full-energy-optimization-error-in-leap-nemo/121577 "2024-10-22T09:33:19Z")

</div>

When i am running my LEAP-NEMO optimization, it says no LP invertible representation for getDualRay, solver status infeasible

---

## [Arrange bar plot by frequency in AlgebraofGraphics.jl](https://discourse.julialang.org/t/arrange-bar-plot-by-frequency-in-algebraofgraphics-jl/121506)

<div class="topic-metadata">

**Author:** [@Nithin\_M](https://discourse.julialang.org/u/Nithin_M)\
**Replies:** 3\
**Last updated:** [October 22, 2024, 5:32am UTC](https://discourse.julialang.org/t/arrange-bar-plot-by-frequency-in-algebraofgraphics-jl/121506 "2024-10-22T05:32:22Z")

</div>

I want to have a bar plot ordered by species frequency using AlgebraOfGraphics.jl. using PalmerPenguins, DataFrames, AlgebraOfGraphics, CairoMakie, CategoricalArrays, Chain # Load and clean the data penguins = @chain P…

---

## [Documenting a struct](https://discourse.julialang.org/t/documenting-a-struct/106773)

<div class="topic-metadata">

**Author:** [@rmfritz](https://discourse.julialang.org/u/rmfritz)\
**Replies:** 2\
**Last updated:** [November 26, 2023, 11:28pm UTC](https://discourse.julialang.org/t/documenting-a-struct/106773 "2023-11-26T23:28:30Z")

</div>

I was surprised to find that the Julia documentation style guide says nothing about documenting structs. Is this something just not done? If it is done, does anyone have advice about best practices?

---

## [How to efficiently parse null as NaN in JSON?](https://discourse.julialang.org/t/how-to-efficiently-parse-null-as-nan-in-json/121561)

<div class="topic-metadata">

**Author:** [@berjine](https://discourse.julialang.org/u/berjine)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 12:00am UTC](https://discourse.julialang.org/t/how-to-efficiently-parse-null-as-nan-in-json/121561 "2024-10-22T00:00:10Z")

</div>

Hi I want to parse lines of JSON containing among other things a vector of signed ints with some values being “null”, like that : {"data":\[98,null,-51,null\]} The way I do it currently is by using a conversion function…

---

## [Count of diff eq callbacks](https://discourse.julialang.org/t/count-of-diff-eq-callbacks/121546)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 5:39pm UTC](https://discourse.julialang.org/t/count-of-diff-eq-callbacks/121546 "2024-10-21T17:39:18Z")

</div>

using DiscreteCallback, is there a built-in way to know the number of times the affect! function is called both inside the affect! function and after solve/step! call is completed? current;y, i’m using a ref value in the…

---

## [Obtaining field values over an array of composite types](https://discourse.julialang.org/t/obtaining-field-values-over-an-array-of-composite-types/121518)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 11\
**Last updated:** [October 21, 2024, 8:32pm UTC](https://discourse.julialang.org/t/obtaining-field-values-over-an-array-of-composite-types/121518 "2024-10-21T20:32:50Z")

</div>

Hi there, I defined a composite type Product tho store relevant characteristics of a set of products. I then construct an array of Product and I am ultimately interested in accessing the field values of this array as ef…

---

## [Performance hit of allocation regardless of size](https://discourse.julialang.org/t/performance-hit-of-allocation-regardless-of-size/119937)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 7\
**Last updated:** [October 21, 2024, 5:05pm UTC](https://discourse.julialang.org/t/performance-hit-of-allocation-regardless-of-size/119937 "2024-10-21T17:05:29Z")

</div>

Hi there performance fanatics! @amontoison and I are working on our matrix coloring code, and in one of our algorithms we need to split a vector into groups, one for each color. Semantically, this is what we want to ach…

---

## [How to run two scripts independantly from the REPL?](https://discourse.julialang.org/t/how-to-run-two-scripts-independantly-from-the-repl/121541)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 4:59pm UTC](https://discourse.julialang.org/t/how-to-run-two-scripts-independantly-from-the-repl/121541 "2024-10-21T16:59:14Z")

</div>

I have two scripts, named autopilot.jl and parking\_wind\_dir.jl. You can find them online: KiteControllers.jl/examples at old\_stable · aenarete/KiteControllers.jl · GitHub I can run the first script, I can run the second…

---

## [How to calculate roll, pitch and yaw?](https://discourse.julialang.org/t/how-to-calculate-roll-pitch-and-yaw/121183)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 20\
**Last updated:** [October 21, 2024, 4:41pm UTC](https://discourse.julialang.org/t/how-to-calculate-roll-pitch-and-yaw/121183 "2024-10-21T16:41:43Z")

</div>

I am trying to calculate the orientation of a wing, expressed as roll, pitch and yaw angle based on the three unit vectors, that form the kite reference frame. All coordinates are in ENU (East, North, Up) reference fram…

---

## [Status of BenchmarkCI](https://discourse.julialang.org/t/status-of-benchmarkci/121530)

<div class="topic-metadata">

**Author:** [@SamBrand](https://discourse.julialang.org/u/SamBrand)\
**Replies:** 1\
**Last updated:** [October 21, 2024, 4:21pm UTC](https://discourse.julialang.org/t/status-of-benchmarkci/121530 "2024-10-21T16:21:19Z")

</div>

Hi everyone, I’m using BenchmarkCI.jl as part of my suite of CI in a project. I’ve noticed that its been unmaintained for a while, and now I have a problem with \[compat\] (BenchmarkCI can’t be used with DiffEqBase.jl du…

---

## [Is the triple \`@inbounds @fastmath @simd\` necessary for absolute peak performance?](https://discourse.julialang.org/t/is-the-triple-inbounds-fastmath-simd-necessary-for-absolute-peak-performance/121499)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 7\
**Last updated:** [October 21, 2024, 3:45pm UTC](https://discourse.julialang.org/t/is-the-triple-inbounds-fastmath-simd-necessary-for-absolute-peak-performance/121499 "2024-10-21T15:45:58Z")

</div>

using BenchmarkTools using LoopVectorization function a1(x) y = zero(eltype(x)) for i in eachindex(x) y += x\[i\] end y end function a2(x) y = zero(eltype(x)) @simd for i in eachindex(x) …

---

## [Using EarlyStopping.jl](https://discourse.julialang.org/t/using-earlystopping-jl/121537)

<div class="topic-metadata">

**Author:** [@onedeeper](https://discourse.julialang.org/u/onedeeper)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 3:38pm UTC](https://discourse.julialang.org/t/using-earlystopping-jl/121537 "2024-10-21T15:38:52Z")

</div>

Hi all, I’m trying to use EarlyStopping.jl. If I understood the documentation, the following should work, though it doesn’t seem to: #add early stopping call back from EarlyStopping.jl function callback!(p,l,early\_sto…

---

## [Some thoughts on improving basic function documentation](https://discourse.julialang.org/t/some-thoughts-on-improving-basic-function-documentation/103546)

<div class="topic-metadata">

**Author:** [@opera\_malenky](https://discourse.julialang.org/u/opera_malenky)\
**Replies:** 51\
**Last updated:** [October 21, 2024, 2:08pm UTC](https://discourse.julialang.org/t/some-thoughts-on-improving-basic-function-documentation/103546 "2024-10-21T14:08:36Z")

</div>

In the recent giant thread on Julia popularity, and in the recent user/developer survey, the topic of documentation often comes up. Usually when people bring it up, they focus on things for brand new users – guides, blo…

---

## [Building an Empty Document](https://discourse.julialang.org/t/building-an-empty-document/110858)

<div class="topic-metadata">

**Author:** [@Heng\_Zhang](https://discourse.julialang.org/u/Heng_Zhang)\
**Replies:** 3\
**Last updated:** [October 21, 2024, 1:49pm UTC](https://discourse.julialang.org/t/building-an-empty-document/110858 "2024-10-21T13:49:53Z")

</div>

Following the guide here: Guide · Documenter.jl I can not run successfully. Could someone help to confirm the setting problems or Git issue? How to fix this issue? Also I ran below code, error popped out: using Docume…

---

## [Saving only after discrete callback](https://discourse.julialang.org/t/saving-only-after-discrete-callback/120790)

<div class="topic-metadata">

**Author:** [@pulk\_jain](https://discourse.julialang.org/u/pulk_jain)\
**Replies:** 4\
**Last updated:** [October 21, 2024, 12:05pm UTC](https://discourse.julialang.org/t/saving-only-after-discrete-callback/120790 "2024-10-21T12:05:26Z")

</div>

Discrete callback is saving both before and after the callback even when save\_positions = (false,true). For example: function dynamics(u,p,t) du = \[2.0,3.0,1.0\] return du end prob = ODEProblem(dynamics, \[0.0,…

---

## [Increase size of precompilation cache](https://discourse.julialang.org/t/increase-size-of-precompilation-cache/121444)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 2\
**Last updated:** [October 18, 2024, 8:02am UTC](https://discourse.julialang.org/t/increase-size-of-precompilation-cache/121444 "2024-10-18T08:02:01Z")

</div>

I’m running a number of Pluto notebooks with heavy dependencies. I noticed that opening a not-so-old notebook almost always involves precompilation, suggesting that the package manager has somehow deleted the precompiled…

---

## [How to display .jmd (Julia markdown) documentation from REPL?](https://discourse.julialang.org/t/how-to-display-jmd-julia-markdown-documentation-from-repl/121515)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 6\
**Last updated:** [October 21, 2024, 10:18am UTC](https://discourse.julialang.org/t/how-to-display-jmd-julia-markdown-documentation-from-repl/121515 "2024-10-21T10:18:43Z")

</div>

I’m interested in using Julia markdown to document the data in a .csv file used in a health care application. After writing a simple .jmd file, I tried to display it using the REPL’s help?\> mode, which replied that it co…

---

## [@autodocs create broken links for aliases](https://discourse.julialang.org/t/autodocs-create-broken-links-for-aliases/121522)

<div class="topic-metadata">

**Author:** [@marteaua](https://discourse.julialang.org/u/marteaua)\
**Replies:** 0\
**Last updated:** [October 21, 2024, 6:17am UTC](https://discourse.julialang.org/t/autodocs-create-broken-links-for-aliases/121522 "2024-10-21T06:17:24Z")

</div>

Hi, I wonder what is the good practice for documenting aliases and using Documenter.@autodocs. Let say I export both outer and ⊗ such that const ⊗ = outer I don’t want to add a docstring to ⊗ because I want users to ge…

---

## [Autodiff using custom Structs](https://discourse.julialang.org/t/autodiff-using-custom-structs/121143)

<div class="topic-metadata">

**Author:** [@thealanjason](https://discourse.julialang.org/u/thealanjason)\
**Replies:** 1\
**Last updated:** [October 20, 2024, 11:30pm UTC](https://discourse.julialang.org/t/autodiff-using-custom-structs/121143 "2024-10-20T23:30:10Z")

</div>

Hello everyone, I want to be able to use Enzyme to differentiate a scalar-valued function with respect to only part of the fields of an arbitrary struct. As an example, in my MWE below, I would like to differentiate th…

---

## [All the ways to do one-hot encoding](https://discourse.julialang.org/t/all-the-ways-to-do-one-hot-encoding/64807)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 30\
**Last updated:** [October 20, 2024, 4:24pm UTC](https://discourse.julialang.org/t/all-the-ways-to-do-one-hot-encoding/64807 "2024-10-20T16:24:16Z")

</div>

There are many ways to do one hot encoding in Julia. I want to list down some ways Method Comment Roll your own It’s not too hard Flux.onehot & Flux.onehotbatch pretty heavy to depend on Flux so normally avoid…

---

## [Diff between two Manifest.toml files](https://discourse.julialang.org/t/diff-between-two-manifest-toml-files/121503)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 0\
**Last updated:** [October 20, 2024, 2:01pm UTC](https://discourse.julialang.org/t/diff-between-two-manifest-toml-files/121503 "2024-10-20T14:01:16Z")

</div>

What’s a recommended way to compare and find all the differences between two Manifest.toml files ? I have used plain text diff (e.g. as implemented in vscode) and it seems to work fine. But I think the success of this a…

---

## [What the parameter in PerturbedAdditive means](https://discourse.julialang.org/t/what-the-parameter-in-perturbedadditive-means/121446)

<div class="topic-metadata">

**Author:** [@Yaozhong\_Liu](https://discourse.julialang.org/u/Yaozhong_Liu)\
**Replies:** 6\
**Last updated:** [October 20, 2024, 11:53am UTC](https://discourse.julialang.org/t/what-the-parameter-in-perturbedadditive-means/121446 "2024-10-20T11:53:14Z")

</div>

Hi. There’s a function in InferOpt package named PerturbedAdditive. I’m curious about a parameter. co\_layer = PerturbedAdditive(knapsack\_maximizer; ε=10.0, nb\_samples=10) For codes above, what does “ε=10.0” mean? An…

---

## [Sum of squares programming](https://discourse.julialang.org/t/sum-of-squares-programming/121500)

<div class="topic-metadata">

**Author:** [@Banan\_alkafri](https://discourse.julialang.org/u/Banan_alkafri)\
**Replies:** 0\
**Last updated:** [October 20, 2024, 11:52am UTC](https://discourse.julialang.org/t/sum-of-squares-programming/121500 "2024-10-20T11:52:10Z")

</div>

I’m using Mosek and sum of squares tools but with matrices to solve an optimization problem with constraints. I’ve noticed that when I try to optimize for higher polynomial degrees like 25 or more, Mosek is taking a lot …

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

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