# General Usage

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

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

**Page:** 68

---

## [JSON3 fails to precompile due to embedded NULs in C strings](https://discourse.julialang.org/t/json3-fails-to-precompile-due-to-embedded-nuls-in-c-strings/128482)

<div class="topic-metadata">

**Author:** [@0samuraiE](https://discourse.julialang.org/u/0samuraiE)\
**Replies:** 10\
**Last updated:** [April 30, 2025, 1:50pm UTC](https://discourse.julialang.org/t/json3-fails-to-precompile-due-to-embedded-nuls-in-c-strings/128482 "2025-04-30T13:50:33Z")

</div>

Hi all, When trying to precompile JSON3.jl on Julia 1.11.4, the following error occurs: Is there a known fix for this problem? Thank you for your support and guidance. ERROR: LoadError: ArgumentError: embedded NULs a…

---

## [How to make scrool zoom in a single axis in Makie](https://discourse.julialang.org/t/how-to-make-scrool-zoom-in-a-single-axis-in-makie/128570)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 2\
**Last updated:** [April 30, 2025, 1:23pm UTC](https://discourse.julialang.org/t/how-to-make-scrool-zoom-in-a-single-axis-in-makie/128570 "2025-04-30T13:23:22Z")

</div>

I would like to modify the default behavior in Makie so that scrolling onty changes the vertical axis scale, and shift-scroll changes the horizontal scale. How can I change the behavior of the event based on modifier key…

---

## [Optimizing chess engines with Julia... is it possible?](https://discourse.julialang.org/t/optimizing-chess-engines-with-julia-is-it-possible/128529)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 2\
**Last updated:** [April 30, 2025, 1:06pm UTC](https://discourse.julialang.org/t/optimizing-chess-engines-with-julia-is-it-possible/128529 "2025-04-30T13:06:33Z")

</div>

Time has long passed. I’ve expressed interest in a chess engine in Julia, then the interest died down, and then some other idea, and then lost motivation due to the core code I need to write before I could get to the sea…

---

## [VSCode debugger breaks on unknown command](https://discourse.julialang.org/t/vscode-debugger-breaks-on-unknown-command/128571)

<div class="topic-metadata">

**Author:** [@bellon-tiobe](https://discourse.julialang.org/u/bellon-tiobe)\
**Replies:** 1\
**Last updated:** [April 30, 2025, 12:51pm UTC](https://discourse.julialang.org/t/vscode-debugger-breaks-on-unknown-command/128571 "2025-04-30T12:51:59Z")

</div>

For reasons unknown to me, the VSCode Julia debugger stopped working, and now it gives this error message every time I try to debug: Activating project at \`~/Julia/JuliaCheck\` ┌ Error: Some Julia code in the VS Code e…

---

## [Add a UpperHessenberg row in LinearAlgebra.factorize?](https://discourse.julialang.org/t/add-a-upperhessenberg-row-in-linearalgebra-factorize/128530)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 8\
**Last updated:** [April 30, 2025, 12:19pm UTC](https://discourse.julialang.org/t/add-a-upperhessenberg-row-in-linearalgebra-factorize/128530 "2025-04-30T12:19:32Z")

</div>

My intuition is that there should also be a row about UpperHessenberg in this table (and what should be a proper factorization for it). Does my idea make sense?

---

## [Understanding \`\*Bindings\` in \`JuliaLowering.jl\`](https://discourse.julialang.org/t/understanding-bindings-in-julialowering-jl/126941)

<div class="topic-metadata">

**Author:** [@iuliadmtru](https://discourse.julialang.org/u/iuliadmtru)\
**Replies:** 7\
**Last updated:** [April 30, 2025, 8:39am UTC](https://discourse.julialang.org/t/understanding-bindings-in-julialowering-jl/126941 "2025-04-30T08:39:31Z")

</div>

Hi everyone! I am trying to understand the building pieces of JuliaLowering.jl. I am very new to compilers so I apologise in advance if my questions have very obvious answers. I don’t understand the behaviour of Binding…

---

## [.== and .\<= inside Zygote.gradient() are inaccurate on GPU](https://discourse.julialang.org/t/and-inside-zygote-gradient-are-inaccurate-on-gpu/128269)

<div class="topic-metadata">

**Author:** [@ivanightingale](https://discourse.julialang.org/u/ivanightingale)\
**Replies:** 10\
**Last updated:** [April 30, 2025, 3:07am UTC](https://discourse.julialang.org/t/and-inside-zygote-gradient-are-inaccurate-on-gpu/128269 "2025-04-30T03:07:05Z")

</div>

Hello, I’ve encountered some very bizzare behaviors with equality .== and inequality .\<= when using Flux.jl on GPU. Below is a small example: using CUDA using Flux device = gpu\_device() # device = cpu\_device() y = \[0,…

---

## [Incrementally pretty print a table, one row at a time](https://discourse.julialang.org/t/incrementally-pretty-print-a-table-one-row-at-a-time/128544)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 1\
**Last updated:** [April 30, 2025, 1:55am UTC](https://discourse.julialang.org/t/incrementally-pretty-print-a-table-one-row-at-a-time/128544 "2025-04-30T01:55:38Z")

</div>

I’m comparing some Newton’s method-type iterative solvers. I’d like to pretty print the progress of the iterative method, so I can tell if the search is making good progress. If I didn’t care about performance, I’d just …

---

## [Function compiles twice but is called just once](https://discourse.julialang.org/t/function-compiles-twice-but-is-called-just-once/128536)

<div class="topic-metadata">

**Author:** [@StevenWhitaker](https://discourse.julialang.org/u/StevenWhitaker)\
**Replies:** 4\
**Last updated:** [April 29, 2025, 10:09pm UTC](https://discourse.julialang.org/t/function-compiles-twice-but-is-called-just-once/128536 "2025-04-29T22:09:48Z")

</div>

Consider the following code: julia\> @generated function f(x) @info "Compiling f" return :(x + 1) end f (generic function with 1 method) julia\> function type\_unstable(y::Vector{Number}) …

---

## [How to simplify Array type w/o mem alloc](https://discourse.julialang.org/t/how-to-simplify-array-type-w-o-mem-alloc/128535)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 5\
**Last updated:** [April 29, 2025, 7:57pm UTC](https://discourse.julialang.org/t/how-to-simplify-array-type-w-o-mem-alloc/128535 "2025-04-29T19:57:37Z")

</div>

after reinterpreting and dropdimsing on an Array, the result is a complicated type which nominally is equivalent to just an Array. i can use collect to simplify it, but it allocates memory. is there a way to simplify i…

---

## [Personal package precompiles everytime I restart Julia (running on HPC)](https://discourse.julialang.org/t/personal-package-precompiles-everytime-i-restart-julia-running-on-hpc/128534)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 1\
**Last updated:** [April 29, 2025, 5:10pm UTC](https://discourse.julialang.org/t/personal-package-precompiles-everytime-i-restart-julia-running-on-hpc/128534 "2025-04-29T17:10:59Z")

</div>

Basically, I have a personal package (let’s call it MyPackage.jl). It is located in the same folder as I run my scripts. I have added it to the environment using Pkg.develop("MyPackage/") Every time I start a Julia pro…

---

## [Strange performance results about function mul! with views](https://discourse.julialang.org/t/strange-performance-results-about-function-mul-with-views/128532)

<div class="topic-metadata">

**Author:** [@TongTongYee](https://discourse.julialang.org/u/TongTongYee)\
**Replies:** 1\
**Last updated:** [April 29, 2025, 4:10pm UTC](https://discourse.julialang.org/t/strange-performance-results-about-function-mul-with-views/128532 "2025-04-29T16:10:06Z")

</div>

aaaa = zeros(1000,1000) bbbb = ones(1,10000) cccc = ones(10000,1000) range = \[1\] @btime mul!(@view(aaaa\[range,:\]),bbbb,cccc); → BLAS.get\_num\_threads() → 1 27.416 ms (3 allocations: 112 bytes) BLAS.get\_num\_threads()…

---

## [Does importing a submodule do anything?](https://discourse.julialang.org/t/does-importing-a-submodule-do-anything/86689)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 5\
**Last updated:** [April 29, 2025, 2:28pm UTC](https://discourse.julialang.org/t/does-importing-a-submodule-do-anything/86689 "2025-04-29T14:28:48Z")

</div>

The following codes do the same thing: module A x = 3 end @show A.x # 3 and module A x = 3 end import .A @show A.x # 3 Does import .A do anything at all in the second example? If not, why is it allowed?

---

## [Problems with stacked environments](https://discourse.julialang.org/t/problems-with-stacked-environments/128518)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 11\
**Last updated:** [April 29, 2025, 2:16pm UTC](https://discourse.julialang.org/t/problems-with-stacked-environments/128518 "2025-04-29T14:16:38Z")

</div>

I often see this: Why? WARNING: redefinition of constant OpenSSL\_jll.PATH. This may fail, cause incorrect answers, or produce other errors. WARNING: redefinition of constant OpenSSL\_jll.LIBPATH. This may fail, cause inc…

---

## [Redistribute workload from in-homogeneous local workers to BLAS threads](https://discourse.julialang.org/t/redistribute-workload-from-in-homogeneous-local-workers-to-blas-threads/128515)

<div class="topic-metadata">

**Author:** [@VinceNeede](https://discourse.julialang.org/u/VinceNeede)\
**Replies:** 0\
**Last updated:** [April 29, 2025, 8:56am UTC](https://discourse.julialang.org/t/redistribute-workload-from-in-homogeneous-local-workers-to-blas-threads/128515 "2025-04-29T08:56:21Z")

</div>

I have some expensive function that I’m executing on local workers, something like: @everywhere begin using LinearAlgebra BLAS.set\_num\_threads(1) function expensive\_fun() #some in-homogeneous task …

---

## [How to force a small allocation?](https://discourse.julialang.org/t/how-to-force-a-small-allocation/128487)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 18\
**Last updated:** [April 29, 2025, 3:49am UTC](https://discourse.julialang.org/t/how-to-force-a-small-allocation/128487 "2025-04-29T03:49:21Z")

</div>

A MWE: function test() Bool\[\] return nothing end @time test() results in 0.000007 seconds (1 allocation: 64 bytes) as desired in Julia 1.7.3. But this method doesn’t work in 1.10.9, resulting in no allocat…

---

## [Getting MATLAB.jl on Windows to work](https://discourse.julialang.org/t/getting-matlab-jl-on-windows-to-work/124575)

<div class="topic-metadata">

**Author:** [@hatmatrix](https://discourse.julialang.org/u/hatmatrix)\
**Replies:** 5\
**Last updated:** [April 28, 2025, 8:41pm UTC](https://discourse.julialang.org/t/getting-matlab-jl-on-windows-to-work/124575 "2025-04-28T20:41:10Z")

</div>

Hello everyone, I raised an issue on the GitHub repo but looks like it’s not very active so just wanted to see if anyone else had this problem and a fix. I’ve added MATLAB in Julia v1.11 through the package manager. I a…

---

## [Correct way to set MKL threads at runtime](https://discourse.julialang.org/t/correct-way-to-set-mkl-threads-at-runtime/128470)

<div class="topic-metadata">

**Author:** [@VinceNeede](https://discourse.julialang.org/u/VinceNeede)\
**Replies:** 4\
**Last updated:** [April 28, 2025, 6:50pm UTC](https://discourse.julialang.org/t/correct-way-to-set-mkl-threads-at-runtime/128470 "2025-04-28T18:50:01Z")

</div>

What is the correct way to set MKL threads at runtime? Documentation seems to be misleading, it says to use BLAS.set\_num\_threads(1) to be single threaded, but it does not work. The only way I have found to actually make …

---

## [How to catch TestResult on failures?](https://discourse.julialang.org/t/how-to-catch-testresult-on-failures/128492)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 0\
**Last updated:** [April 28, 2025, 3:06pm UTC](https://discourse.julialang.org/t/how-to-catch-testresult-on-failures/128492 "2025-04-28T15:06:41Z")

</div>

I’m trying to grab the results after running tests, so I can send emails or slack messages based on the results. However, if there are any failures, @testset does not return the test set: julia\> using OhMyREPL; using T…

---

## [Built-in binary search for sorted collections](https://discourse.julialang.org/t/built-in-binary-search-for-sorted-collections/128374)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 15\
**Last updated:** [April 28, 2025, 2:26pm UTC](https://discourse.julialang.org/t/built-in-binary-search-for-sorted-collections/128374 "2025-04-28T14:26:43Z")

</div>

Given integers N and k, I’d like to elegantly find the largest integer n for which binomial(n,k) \<= N. A way to do this is function max\_n\_binom\_leq(N::Integer, k::Integer) return maximum(n for n=k:N if binomial(big…

---

## [Enzyme custom rule alloactions](https://discourse.julialang.org/t/enzyme-custom-rule-alloactions/128491)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 0\
**Last updated:** [April 28, 2025, 2:11pm UTC](https://discourse.julialang.org/t/enzyme-custom-rule-alloactions/128491 "2025-04-28T14:11:20Z")

</div>

Hello, I got a problem with allocations when using custom rules in Enzyme. The example below is just a toy example but the same problem arises there. In total I get 4 alloactions. 2 by the line primal = func.val(y.va…

---

## [Network socket appears open, but then immediately closes](https://discourse.julialang.org/t/network-socket-appears-open-but-then-immediately-closes/128481)

<div class="topic-metadata">

**Author:** [@phma](https://discourse.julialang.org/u/phma)\
**Replies:** 1\
**Last updated:** [April 28, 2025, 9:08am UTC](https://discourse.julialang.org/t/network-socket-appears-open-but-then-immediately-closes/128481 "2025-04-28T09:08:24Z")

</div>

I’m writing a program which connects to a similar program on another computer; right now my desktop connects to my laptop. Both have IPv4 and IPv6 addresses; the IPv4 address is local-only, while the IPv6 address is glob…

---

## [How to make a variable available on all processes (when using Distributed)](https://discourse.julialang.org/t/how-to-make-a-variable-available-on-all-processes-when-using-distributed/128460)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 21\
**Last updated:** [April 28, 2025, 8:43am UTC](https://discourse.julialang.org/t/how-to-make-a-variable-available-on-all-processes-when-using-distributed/128460 "2025-04-28T08:43:21Z")

</div>

I have a workflow which first does some preparations. Next, it does a heavy bit of computing which I would like to carry out in parallel. In practise it looks something like: # Fetch packages. @everwhere using Distribut…

---

## [Troubles using sparse autodifferentiation](https://discourse.julialang.org/t/troubles-using-sparse-autodifferentiation/128337)

<div class="topic-metadata">

**Author:** [@slwu89](https://discourse.julialang.org/u/slwu89)\
**Replies:** 11\
**Last updated:** [April 28, 2025, 7:12am UTC](https://discourse.julialang.org/t/troubles-using-sparse-autodifferentiation/128337 "2025-04-28T07:12:32Z")

</div>

Hi all, I am following Advanced tutorial · DifferentiationInterface.jl and to try out some of the modern AD features it provides. My test case is here FunWithSplines/workspace/MLE/core-5\_4\_1.jl at main · slwu89/FunWithSp…

---

## [MPI.jl tasks in multiple nodes](https://discourse.julialang.org/t/mpi-jl-tasks-in-multiple-nodes/128462)

<div class="topic-metadata">

**Author:** [@kongdd](https://discourse.julialang.org/u/kongdd)\
**Replies:** 1\
**Last updated:** [April 27, 2025, 2:26pm UTC](https://discourse.julialang.org/t/mpi-jl-tasks-in-multiple-nodes/128462 "2025-04-27T14:26:12Z")

</div>

I want to submit tasks in 4 nodes, with each node 10 process. However the following script only runs on 1 node: bsub -J kongdd\_m01 \\ -o log\_all.out \\ -e log\_all.err \\ -n 40 \\ -R "span\[ptile=10\]" \\ …

---

## [A Brief Study of Memory Bound Application Performance on M3 Ultra and M4 Max in Julia](https://discourse.julialang.org/t/a-brief-study-of-memory-bound-application-performance-on-m3-ultra-and-m4-max-in-julia/128459)

<div class="topic-metadata">

**Author:** [@PetarM](https://discourse.julialang.org/u/PetarM)\
**Replies:** 2\
**Last updated:** [April 27, 2025, 12:07pm UTC](https://discourse.julialang.org/t/a-brief-study-of-memory-bound-application-performance-on-m3-ultra-and-m4-max-in-julia/128459 "2025-04-27T12:07:10Z")

</div>

Hello everybody! I wanted to share my Linear Algebra performance findings in Julia on the M4 Max and M3 Ultra in double precision floating point. As a Julia novice, I was hugely impressed how easy it was for me to brain…

---

## [Struggling to understand how to use PrecompileTools](https://discourse.julialang.org/t/struggling-to-understand-how-to-use-precompiletools/128419)

<div class="topic-metadata">

**Author:** [@freeman](https://discourse.julialang.org/u/freeman)\
**Replies:** 25\
**Last updated:** [April 26, 2025, 10:49pm UTC](https://discourse.julialang.org/t/struggling-to-understand-how-to-use-precompiletools/128419 "2025-04-26T22:49:58Z")

</div>

Hello! I wrote a bunch of libs in Julia that all work together. One lib in particular exists just to read and stream a certain data from HDF5 files. One of the functions in this lib has the job of, given one of these HD…

---

## [Julia TestItemRunner](https://discourse.julialang.org/t/julia-testitemrunner/127072)

<div class="topic-metadata">

**Author:** [@feribg](https://discourse.julialang.org/u/feribg)\
**Replies:** 1\
**Last updated:** [April 26, 2025, 8:26pm UTC](https://discourse.julialang.org/t/julia-testitemrunner/127072 "2025-04-26T20:26:48Z")

</div>

Currently there’s no way to specify or even run the testitemrunner tests outside of vscode in any meaningful repl way. Package structure is: MainPackage: Package.toml test/ Package.toml runtests.jl runtests.jl con…

---

## [Good practices for numerical array constants in tests](https://discourse.julialang.org/t/good-practices-for-numerical-array-constants-in-tests/127443)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [April 26, 2025, 8:21pm UTC](https://discourse.julialang.org/t/good-practices-for-numerical-array-constants-in-tests/127443 "2025-04-26T20:21:41Z")

</div>

I have isolated a tricky numerical corner case for a package using randomly generated values. I tracked down the problem and fixed it, but want to add it to the tests too so that it does not happen again even if I refact…

---

## [QML.jl makie-plot example gives multiple errors](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 10\
**Last updated:** [April 26, 2025, 8:12pm UTC](https://discourse.julialang.org/t/qml-jl-makie-plot-example-gives-multiple-errors/128444 "2025-04-26T20:12:57Z")

</div>

I’m trying to run this (pasting in the REPL): First error occurs on using GLMakie: ▶ Summary However, if I run using GLMakie again it seems to work. Second error occurs on figscene = fig.scene. Fixed: this is due t…

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

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