# General Usage

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

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

**Page:** 170

---

## [Function vs macro](https://discourse.julialang.org/t/function-vs-macro/110397)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 6\
**Last updated:** [May 15, 2024, 4:23am UTC](https://discourse.julialang.org/t/function-vs-macro/110397 "2024-05-15T04:23:12Z")

</div>

I saw codes like @warn("the number of particles must be positive") and @show a, b, c Becaue of the @, both are macros, right? The first contains the (), which makes it closer to a function; the second contains …

---

## [Unsure how to solve error message when applying unstack to DataFrame](https://discourse.julialang.org/t/unsure-how-to-solve-error-message-when-applying-unstack-to-dataframe/114214)

<div class="topic-metadata">

**Author:** [@Lee\_Phillips](https://discourse.julialang.org/u/Lee_Phillips)\
**Replies:** 6\
**Last updated:** [May 14, 2024, 10:33pm UTC](https://discourse.julialang.org/t/unsure-how-to-solve-error-message-when-applying-unstack-to-dataframe/114214 "2024-05-14T22:33:37Z")

</div>

Hello All I have a dataframe, the first 5 rows are shown below 5×4 DataFrame Row │ PointAID\_FK PointBID\_FK Distance Time │ Any Any Float64 Float64 ─────┼────────────────────────────────────…

---

## [Composition and inheritance: the Julian way](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231)

<div class="topic-metadata">

**Author:** [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Replies:** 133\
**Last updated:** [May 14, 2024, 5:41pm UTC](https://discourse.julialang.org/t/composition-and-inheritance-the-julian-way/11231 "2024-05-14T17:41:01Z")

</div>

I am a relatively newbie and I am wondering what is the most appropriate Julian way to reuse the code. I don’t want to trigger discussions on topics already discussed a million times. This post simply aims to lay down …

---

## [VSCode hanging when running Julia?](https://discourse.julialang.org/t/vscode-hanging-when-running-julia/114200)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [May 14, 2024, 4:20pm UTC](https://discourse.julialang.org/t/vscode-hanging-when-running-julia/114200 "2024-05-14T16:20:20Z")

</div>

Hello! I have an install which has been working fine for a few months. Today I want to run some code, but the VSCode is working fine, but the Julia terminal never executes a command. Any one seen this before? Running …

---

## [Plots: colorbar inside figure/axis](https://discourse.julialang.org/t/plots-colorbar-inside-figure-axis/114252)

<div class="topic-metadata">

**Author:** [@abehersan](https://discourse.julialang.org/u/abehersan)\
**Replies:** 5\
**Last updated:** [May 14, 2024, 4:06pm UTC](https://discourse.julialang.org/t/plots-colorbar-inside-figure-axis/114252 "2024-05-14T16:06:35Z")

</div>

Hi! Is there a way in the existing API to include a colorbar “inside” an existing axis. Like in the attached image? Source of uncropped image: using Plots function f(x, y) r = sqrt(x^2 + y^2) return cos(r) / …

---

## [Thread pinning interacts with OpenMP?](https://discourse.julialang.org/t/thread-pinning-interacts-with-openmp/114204)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [May 14, 2024, 3:18pm UTC](https://discourse.julialang.org/t/thread-pinning-interacts-with-openmp/114204 "2024-05-14T15:18:06Z")

</div>

This problem prevents me from using thread pinning. I wonder how Julia threads (implemented on top of pthreads, IIUC), mess with OpenMP threads?

---

## [Different behaviour when plotting one vs many ODE solutions](https://discourse.julialang.org/t/different-behaviour-when-plotting-one-vs-many-ode-solutions/114248)

<div class="topic-metadata">

**Author:** [@dbox](https://discourse.julialang.org/u/dbox)\
**Replies:** 1\
**Last updated:** [May 14, 2024, 1:32pm UTC](https://discourse.julialang.org/t/different-behaviour-when-plotting-one-vs-many-ode-solutions/114248 "2024-05-14T13:32:00Z")

</div>

When taking a slice of the result of solve(ODEProblem), slices with a range (e.g. sol\[1:3\] return the time series as well, whereas a single element sol\[1\] only returns the y-values. I want to be able to plot either one …

---

## [Inconsistency between Core.Compiler.return\_type and Test.@inferred](https://discourse.julialang.org/t/inconsistency-between-core-compiler-return-type-and-test-inferred/114246)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [May 14, 2024, 12:59pm UTC](https://discourse.julialang.org/t/inconsistency-between-core-compiler-return-type-and-test-inferred/114246 "2024-05-14T12:59:03Z")

</div>

The Any here indicates a total failure of the return type inference: julia\> f(op::Op, a, b) where {Op} = op(a, b) f (generic function with 1 method) julia\> Core.Compiler.return\_type(f, Tuple{typeof(=\>),Int,Int}) Any W…

---

## [Poor BigInt performance](https://discourse.julialang.org/t/poor-bigint-performance/106907)

<div class="topic-metadata">

**Author:** [@hlbnet](https://discourse.julialang.org/u/hlbnet)\
**Replies:** 32\
**Last updated:** [May 14, 2024, 11:36am UTC](https://discourse.julialang.org/t/poor-bigint-performance/106907 "2024-05-14T11:36:38Z")

</div>

Hi everybody, I wanted to quick benchmark the BigInt type. I wrote a simple function (with double reccursion just because I want to consume time :wink:). I then tested the same function in Python, and found that Python …

---

## [Understanding and optimizing compiler time (just a bit)](https://discourse.julialang.org/t/understanding-and-optimizing-compiler-time-just-a-bit/51759)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 20\
**Last updated:** [March 25, 2021, 12:15pm UTC](https://discourse.julialang.org/t/understanding-and-optimizing-compiler-time-just-a-bit/51759 "2021-03-25T12:15:12Z")

</div>

I have a very heavily optimized calculation that runs for weeks. It is making heavy use of SVectors, ForwardDiff.jl for AD, and various other things that tax the compiler, but in turn, it is very fast when compiled. I s…

---

## [Noise with gradient works!](https://discourse.julialang.org/t/noise-with-gradient-works/114178)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 26\
**Last updated:** [May 14, 2024, 10:16am UTC](https://discourse.julialang.org/t/noise-with-gradient-works/114178 "2024-05-14T10:16:38Z")

</div>

In this video, it was explained why the gradient of noise was needed. In most programming languages, you’re talking about either writing your own noise to add the gradient feature or diving deep into the li…

---

## [Debug precompile warnings](https://discourse.julialang.org/t/debug-precompile-warnings/114222)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 2\
**Last updated:** [May 14, 2024, 9:23am UTC](https://discourse.julialang.org/t/debug-precompile-warnings/114222 "2024-05-14T09:23:06Z")

</div>

I’m seeing lots of precompile warnings like this: Precompiling ComponentArraysAdaptExt 1 dependency successfully precompiled in 6 seconds. 61 already precompiled. \[ Info: Precompiling ComponentArraysAdaptExt \[79…

---

## [Error: Some registries failed to update](https://discourse.julialang.org/t/error-some-registries-failed-to-update/114192)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 15\
**Last updated:** [May 14, 2024, 4:03am UTC](https://discourse.julialang.org/t/error-some-registries-failed-to-update/114192 "2024-05-14T04:03:26Z")

</div>

Help! Why? ┌ Error: Some registries failed to update: │ — C:\\Users\\name\\.julia\\registries\\General.toml — failed to download from https://pkg.julialang.org/registry/23338594-aafe-5451-b93e-139f81909106/e8d546e7403e5b…

---

## [Oscar and Matlab both call nrows](https://discourse.julialang.org/t/oscar-and-matlab-both-call-nrows/114157)

<div class="topic-metadata">

**Author:** [@ilovemath](https://discourse.julialang.org/u/ilovemath)\
**Replies:** 9\
**Last updated:** [May 14, 2024, 3:42am UTC](https://discourse.julialang.org/t/oscar-and-matlab-both-call-nrows/114157 "2024-05-14T03:42:46Z")

</div>

Hi there, So, I am calling both Oscar and Matlab packages. Both call nrows in their subroutines under the hood in their often typical function calls. I was able to write the code so that I would not get the warning sa…

---

## ["Please submit a bug report" - How to proceed?](https://discourse.julialang.org/t/please-submit-a-bug-report-how-to-proceed/114175)

<div class="topic-metadata">

**Author:** [@MHaensel](https://discourse.julialang.org/u/MHaensel)\
**Replies:** 8\
**Last updated:** [May 13, 2024, 6:02pm UTC](https://discourse.julialang.org/t/please-submit-a-bug-report-how-to-proceed/114175 "2024-05-13T18:02:12Z")

</div>

Hi everyone, I was working on a project, during which eventually Julia crashed and asked me to “Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Tha…

---

## [What do allocations (triggering GC) depend on?](https://discourse.julialang.org/t/what-do-allocations-triggering-gc-depend-on/114202)

<div class="topic-metadata">

**Author:** [@Thomas008](https://discourse.julialang.org/u/Thomas008)\
**Replies:** 1\
**Last updated:** [May 13, 2024, 4:28pm UTC](https://discourse.julialang.org/t/what-do-allocations-triggering-gc-depend-on/114202 "2024-05-13T16:28:18Z")

</div>

I want to compile code with help of StaticCompiler. So I need to avoid GC allocations. I want to understand when GC allocations occur. In the following code 3 GC allocations happen: using StaticTools mutable struct D …

---

## [\>64 HW threads under windows](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124)

<div class="topic-metadata">

**Author:** [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Replies:** 8\
**Last updated:** [May 13, 2024, 1:48pm UTC](https://discourse.julialang.org/t/64-hw-threads-under-windows/114124 "2024-05-13T13:48:22Z")

</div>

I haven’t checked in a while but has Julia fixed the problem with only using 1/2 or 1/4 of the available cpu threads on high-end (either \>64 HW threads or multi-socket) windows systems? To be clear the issue isn’t with …

---

## [Code style: helper function used exclusively by one parent function](https://discourse.julialang.org/t/code-style-helper-function-used-exclusively-by-one-parent-function/114193)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [May 13, 2024, 1:26pm UTC](https://discourse.julialang.org/t/code-style-helper-function-used-exclusively-by-one-parent-function/114193 "2024-05-13T13:26:30Z")

</div>

Nested functions are not encouraged due to potential performance impacts of captured variables, so I usually define helper functions as standalone functions, which unfortunately makes the code less modular / structured. …

---

## [Weird behavior of for loop+copy syntax](https://discourse.julialang.org/t/weird-behavior-of-for-loop-copy-syntax/114185)

<div class="topic-metadata">

**Author:** [@ttx002000](https://discourse.julialang.org/u/ttx002000)\
**Replies:** 3\
**Last updated:** [May 13, 2024, 10:56am UTC](https://discourse.julialang.org/t/weird-behavior-of-for-loop-copy-syntax/114185 "2024-05-13T10:56:32Z")

</div>

Dear All Here is a minimum working example: function test\_func() A=\[zeros(Float64,2) for \_ in 1:2\] B=copy(A) for ja in 1:2, jb in 1:2 (B\[ja\]\[jb\],A\[ja\]\[jb\])=(1.0,2.0) end print(B) print(…

---

## [ForwardDiff.hessian! with StaticArrays, unexpected allocations and performance](https://discourse.julialang.org/t/forwarddiff-hessian-with-staticarrays-unexpected-allocations-and-performance/114082)

<div class="topic-metadata">

**Author:** [@DNF](https://discourse.julialang.org/u/DNF)\
**Replies:** 4\
**Last updated:** [May 13, 2024, 9:59am UTC](https://discourse.julialang.org/t/forwarddiff-hessian-with-staticarrays-unexpected-allocations-and-performance/114082 "2024-05-13T09:59:23Z")

</div>

I am struggling with allocations and performance when calculating Hessians with ForwardDiff.jl. Here’s an MWE using a clean REPL with Julia 1.10.3 julia\> using DiffResults, ForwardDiff, StaticArrays, BenchmarkTools jul…

---

## [Stack Overflow in Type Inference with Julia 1.10.3 - Seeking Solutions](https://discourse.julialang.org/t/stack-overflow-in-type-inference-with-julia-1-10-3-seeking-solutions/114107)

<div class="topic-metadata">

**Author:** [@Abdenour\_Yasser\_BRAH](https://discourse.julialang.org/u/Abdenour_Yasser_BRAH)\
**Replies:** 2\
**Last updated:** [May 13, 2024, 9:33am UTC](https://discourse.julialang.org/t/stack-overflow-in-type-inference-with-julia-1-10-3-seeking-solutions/114107 "2024-05-13T09:33:22Z")

</div>

Hello, I’m currently experiencing a problem with Julia version 1.10.3 on Linux (x86\_64). I have encountered an internal error related to stack overflow during type inference. The error message suggests that it might be …

---

## [Sound use of multiple dispatch?](https://discourse.julialang.org/t/sound-use-of-multiple-dispatch/114093)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 18\
**Last updated:** [May 13, 2024, 8:04am UTC](https://discourse.julialang.org/t/sound-use-of-multiple-dispatch/114093 "2024-05-13T08:04:20Z")

</div>

Is the code below a sound use of multiple dispatch? Are there cleaner or more sound ways to the same? using StaticArrays const Point1D = SVector{1,Float64} const Point2D = SVector{2,Float64} " Generates a one-dimensi…

---

## [Flux opt\_state question](https://discourse.julialang.org/t/flux-opt-state-question/114155)

<div class="topic-metadata">

**Author:** [@Daptine](https://discourse.julialang.org/u/Daptine)\
**Replies:** 2\
**Last updated:** [May 13, 2024, 2:53am UTC](https://discourse.julialang.org/t/flux-opt-state-question/114155 "2024-05-13T02:53:32Z")

</div>

According to the document, # Initialise the optimiser for this model: opt\_state = Flux.setup(rule, model) for data in train\_set # Unpack this element (for supervised training): input, label = data # Calculate th…

---

## [Zygote differentiation very slow](https://discourse.julialang.org/t/zygote-differentiation-very-slow/112751)

<div class="topic-metadata">

**Author:** [@KapilKhanal](https://discourse.julialang.org/u/KapilKhanal)\
**Replies:** 13\
**Last updated:** [May 12, 2024, 11:39pm UTC](https://discourse.julialang.org/t/zygote-differentiation-very-slow/112751 "2024-05-12T23:39:39Z")

</div>

I have an inner function I apply like this (a simple replicable example pasted here) . The input are chosen to be (5,5) but they are usually much larger. I did not do benchmark as this is not even close to acceptable. It…

---

## [Incorporating structural information into Neural ODE as a Differential Equation System](https://discourse.julialang.org/t/incorporating-structural-information-into-neural-ode-as-a-differential-equation-system/113968)

<div class="topic-metadata">

**Author:** [@CurioMath](https://discourse.julialang.org/u/CurioMath)\
**Replies:** 0\
**Last updated:** [May 7, 2024, 7:48pm UTC](https://discourse.julialang.org/t/incorporating-structural-information-into-neural-ode-as-a-differential-equation-system/113968 "2024-05-07T19:48:21Z")

</div>

Can I know if we can feed the known physics information about a system, as a Differential Equation System into Neural network architecture within NeuralODE in DiffEqFlux.jl? I have referred documentation examples, but f…

---

## [Linear/Poly Fit on a set of data](https://discourse.julialang.org/t/linear-poly-fit-on-a-set-of-data/114168)

<div class="topic-metadata">

**Author:** [@S\_Han](https://discourse.julialang.org/u/S_Han)\
**Replies:** 4\
**Last updated:** [May 12, 2024, 8:52pm UTC](https://discourse.julialang.org/t/linear-poly-fit-on-a-set-of-data/114168 "2024-05-12T20:52:29Z")

</div>

HI I’m trying to fit a curve on this dataset. im using CurveFit.curve\_fit() to find a linear/poly fit to this dataset. However, when I am using Polynomial, fit = CurveFit.curve\_fit(Polynomial,gamma\_k\[1:21\],tau\_opt\[1…

---

## [Development Process for Working with Genie and Javascript REST API](https://discourse.julialang.org/t/development-process-for-working-with-genie-and-javascript-rest-api/41336)

<div class="topic-metadata">

**Author:** [@whenning](https://discourse.julialang.org/u/whenning)\
**Replies:** 15\
**Last updated:** [July 26, 2020, 7:07pm UTC](https://discourse.julialang.org/t/development-process-for-working-with-genie-and-javascript-rest-api/41336 "2020-07-26T19:07:48Z")

</div>

Describe the Goal I am attempting to call my local Genie web server using a REST API in javascript. Is this an appropriate development process? The server works great when I call something like http://127.0.0.1:8000/ d…

---

## [Installing DiffEqBase on Windows fails](https://discourse.julialang.org/t/installing-diffeqbase-on-windows-fails/114148)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [May 12, 2024, 10:07am UTC](https://discourse.julialang.org/t/installing-diffeqbase-on-windows-fails/114148 "2024-05-12T10:07:36Z")

</div>

I am using Windows 10.0 home, freshly installed. rm -rf .julia mkdir tmp cd tmp julia --project="." and then in Julia using Pkg pkg"add DiffEqBase" ... Installed ManualMemory ───────────────────── v0.1.8 Insta…

---

## [Mac OpenMP-capable compiler?](https://discourse.julialang.org/t/mac-openmp-capable-compiler/114112)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [May 12, 2024, 1:48pm UTC](https://discourse.julialang.org/t/mac-openmp-capable-compiler/114112 "2024-05-12T13:48:26Z")

</div>

I am trying to test a package with a wrapped library in c++ that uses OpenMP. Is there a suitable compiler on the Mac that would be reliably present?

---

## [Installing MKL on Windows fails](https://discourse.julialang.org/t/installing-mkl-on-windows-fails/114149)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [May 12, 2024, 10:33am UTC](https://discourse.julialang.org/t/installing-mkl-on-windows-fails/114149 "2024-05-12T10:33:17Z")

</div>

Installing MKL on a freshly installed Windows 10.0 home fails: C:\\Users\\ufechner\\tmp\>julia --project \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ …

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

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