# General Usage

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

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

**Page:** 172

---

## [How to run a HTTP.jl server in parallel, while doing computations in the foreground?](https://discourse.julialang.org/t/how-to-run-a-http-jl-server-in-parallel-while-doing-computations-in-the-foreground/101889)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 21\
**Last updated:** [May 8, 2024, 11:08am UTC](https://discourse.julialang.org/t/how-to-run-a-http-jl-server-in-parallel-while-doing-computations-in-the-foreground/101889 "2024-05-08T11:08:32Z")

</div>

Hello! I’ve been trying to create a simple Prometheus client for Julia. For this, I need to run a small web server inside my application, which does all sorts of computations. The problem is that the web server provided…

---

## [Why Julia fails to infere types in this example? What is the cost of this? What are requirements for type inference?](https://discourse.julialang.org/t/why-julia-fails-to-infere-types-in-this-example-what-is-the-cost-of-this-what-are-requirements-for-type-inference/113800)

<div class="topic-metadata">

**Author:** [@shamazmazum](https://discourse.julialang.org/u/shamazmazum)\
**Replies:** 12\
**Last updated:** [May 8, 2024, 8:10am UTC](https://discourse.julialang.org/t/why-julia-fails-to-infere-types-in-this-example-what-is-the-cost-of-this-what-are-requirements-for-type-inference/113800 "2024-05-08T08:10:44Z")

</div>

Hi! I’ve opened a bug report (#54344) on github today which was immediately closed and I was sent here. I’ve read that for a good performance @code\_warntype macro should produce an output without lines colored in red. Fo…

---

## [OpenMP in a shared library opened in Julia](https://discourse.julialang.org/t/openmp-in-a-shared-library-opened-in-julia/113880)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [May 8, 2024, 8:00am UTC](https://discourse.julialang.org/t/openmp-in-a-shared-library-opened-in-julia/113880 "2024-05-08T08:00:36Z")

</div>

A C++ (mostly C, really) library is dynamically loaded into Julia. That library uses OpenMP for parallelism. I do not seem to be getting any speedups, which makes me wonder: Is there some interaction of Julia and the C+…

---

## [Reproducibility: What's the risk of a dependency becoming unavailable?](https://discourse.julialang.org/t/reproducibility-whats-the-risk-of-a-dependency-becoming-unavailable/113940)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 9\
**Last updated:** [May 8, 2024, 6:40am UTC](https://discourse.julialang.org/t/reproducibility-whats-the-risk-of-a-dependency-becoming-unavailable/113940 "2024-05-08T06:40:26Z")

</div>

Hi all I’m talking a lot about reproducibility of computational results in my role as Data Editor of an Economics journal. I’m aware that julia is better positioned than most (all) languages on that front, and I’m tryin…

---

## [Reinforcementlearning.jjl](https://discourse.julialang.org/t/reinforcementlearning-jjl/113948)

<div class="topic-metadata">

**Author:** [@ttidrick](https://discourse.julialang.org/u/ttidrick)\
**Replies:** 3\
**Last updated:** [May 8, 2024, 6:31am UTC](https://discourse.julialang.org/t/reinforcementlearning-jjl/113948 "2024-05-08T06:31:52Z")

</div>

Hi All, I’m curious if anyone has opinions, comments, heads-ups, etc. concerning the package ‘ReinforcementLearning.jl’. Thanks, Ty Tidrick

---

## [Specify the range of color range of marker\_z](https://discourse.julialang.org/t/specify-the-range-of-color-range-of-marker-z/113977)

<div class="topic-metadata">

**Author:** [@yuehao](https://discourse.julialang.org/u/yuehao)\
**Replies:** 0\
**Last updated:** [May 8, 2024, 2:13am UTC](https://discourse.julialang.org/t/specify-the-range-of-color-range-of-marker-z/113977 "2024-05-08T02:13:32Z")

</div>

I am using Plots.jl to plot 3-D in 2-D colormap using: scatter(x, y, marker\_z=z, color=:jet) The color is automatically map to range \[zmin, zmax\] of the vector z. However, to compare several cases (of z), I hope to fi…

---

## [Method overwriting in StyledStrings.jl v1.0 (\`julia1-compat\`)](https://discourse.julialang.org/t/method-overwriting-in-styledstrings-jl-v1-0-julia1-compat/113935)

<div class="topic-metadata">

**Author:** [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Replies:** 5\
**Last updated:** [May 7, 2024, 8:08pm UTC](https://discourse.julialang.org/t/method-overwriting-in-styledstrings-jl-v1-0-julia1-compat/113935 "2024-05-07T20:08:13Z")

</div>

StyledStrings.jl, an external stdlib of julia v1.11 or later, was recently registered as a package.:tada: However, StyledStrings v1.0 currently does method overwriting. WARNING: Method definition \*(Union{AbstractChar, …

---

## [Doctests with approx](https://discourse.julialang.org/t/doctests-with-approx/113962)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 2\
**Last updated:** [May 7, 2024, 7:16pm UTC](https://discourse.julialang.org/t/doctests-with-approx/113962 "2024-05-07T19:16:51Z")

</div>

Is there any way to use approximate equality tests in the doctests? I have various numerical functions whose output changes by eps() or so with some regularity — apparently depending on all sorts of obscure choices made…

---

## [Int f() { return ...; }: What do I pass to ccall?](https://discourse.julialang.org/t/int-f-return-what-do-i-pass-to-ccall/113957)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [May 7, 2024, 5:57pm UTC](https://discourse.julialang.org/t/int-f-return-what-do-i-pass-to-ccall/113957 "2024-05-07T17:57:14Z")

</div>

What do I pass when there are no arguments?

---

## [Is there a macroscopic analysis on Julia packages?](https://discourse.julialang.org/t/is-there-a-macroscopic-analysis-on-julia-packages/113944)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 2\
**Last updated:** [May 7, 2024, 1:59pm UTC](https://discourse.julialang.org/t/is-there-a-macroscopic-analysis-on-julia-packages/113944 "2024-05-07T13:59:24Z")

</div>

For example, this could include the distribution of domains among existing Julia packages, the trend in the growth of Julia package numbers, and possibly additional things such as the distribution of developer amounts fo…

---

## [Gradient of loss function from ODE solution](https://discourse.julialang.org/t/gradient-of-loss-function-from-ode-solution/113910)

<div class="topic-metadata">

**Author:** [@Enrico\_Camporeale](https://discourse.julialang.org/u/Enrico_Camporeale)\
**Replies:** 1\
**Last updated:** [May 7, 2024, 8:53am UTC](https://discourse.julialang.org/t/gradient-of-loss-function-from-ode-solution/113910 "2024-05-07T08:53:56Z")

</div>

I am interested in the autodiff feature of Julia. Specifically I have an ODE problem that solves for the motion of solar system planets and I have defined a loss function. I want to calculate the gradient of the loss fun…

---

## [Creating Single-Entry Matrix?](https://discourse.julialang.org/t/creating-single-entry-matrix/113932)

<div class="topic-metadata">

**Author:** [@ArcticOwl](https://discourse.julialang.org/u/ArcticOwl)\
**Replies:** 4\
**Last updated:** [May 7, 2024, 6:48am UTC](https://discourse.julialang.org/t/creating-single-entry-matrix/113932 "2024-05-07T06:48:35Z")

</div>

Hello everyone! I am new to Julia and I want to create single-entry matrices i.e., 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0…

---

## [Extracting numbers from Symbols](https://discourse.julialang.org/t/extracting-numbers-from-symbols/113930)

<div class="topic-metadata">

**Author:** [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)\
**Replies:** 2\
**Last updated:** [May 7, 2024, 4:03am UTC](https://discourse.julialang.org/t/extracting-numbers-from-symbols/113930 "2024-05-07T04:03:20Z")

</div>

Given a vector of Symbols like \[:v01, :v20, :v33\], is there a way to extract the numbers directly without first converting them to strings? My current solution with string conversion is: v = \[:v01, :v20, :v33\] nums = @.…

---

## [Practice material or exercises from the course Julia Programming For Nervous Beginners](https://discourse.julialang.org/t/practice-material-or-exercises-from-the-course-julia-programming-for-nervous-beginners/92155)

<div class="topic-metadata">

**Author:** [@german\_saenz](https://discourse.julialang.org/u/german_saenz)\
**Replies:** 5\
**Last updated:** [May 6, 2024, 9:09pm UTC](https://discourse.julialang.org/t/practice-material-or-exercises-from-the-course-julia-programming-for-nervous-beginners/92155 "2024-05-06T21:09:22Z")

</div>

Hello, I have recently started the Julia Programming For Nervous Beginners course, however in the lessons the instructor Henri Laurie invites us to do the exercises. I have already checked in the repository and also in …

---

## [Avoiding allocations when normalizing a vector](https://discourse.julialang.org/t/avoiding-allocations-when-normalizing-a-vector/113913)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 11\
**Last updated:** [May 6, 2024, 7:08pm UTC](https://discourse.julialang.org/t/avoiding-allocations-when-normalizing-a-vector/113913 "2024-05-06T19:08:52Z")

</div>

Hello. Given that calling function function integrand(r,rp) diff = MArray(r-rp) return normalize!(diff) end as in r = Point3D(0.,0,0); rp = Point3D(5.,0,0) @btime integrand(r,rp) results in one (single) al…

---

## [Best data structure for fast unions of large sets of integers](https://discourse.julialang.org/t/best-data-structure-for-fast-unions-of-large-sets-of-integers/113785)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 56\
**Last updated:** [May 6, 2024, 6:23pm UTC](https://discourse.julialang.org/t/best-data-structure-for-fast-unions-of-large-sets-of-integers/113785 "2024-05-06T18:23:10Z")

</div>

Nerdsnipe alert In the SparseConnectivityTracer.jl project, @hill and I need to efficiencly compute unions of non-disjoint sets of integers, which can be very large (thousands, even millions). The default Set{Int} is …

---

## [Pkg.add syntax](https://discourse.julialang.org/t/pkg-add-syntax/113919)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [May 6, 2024, 5:44pm UTC](https://discourse.julialang.org/t/pkg-add-syntax/113919 "2024-05-06T17:44:02Z")

</div>

I try to get rid of the warning I get when executing in a script: julia -e "using Pkg; pkg\\"add KiteSimulators#main\\" " Not working: julia -e "using Pkg; pkg.add(\\"KiteSimulators\\", rev=\\"main\\") Any idea?

---

## [Code style consultation: Should we strive to avoid code duplication?](https://discourse.julialang.org/t/code-style-consultation-should-we-strive-to-avoid-code-duplication/113858)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 21\
**Last updated:** [May 6, 2024, 5:18pm UTC](https://discourse.julialang.org/t/code-style-consultation-should-we-strive-to-avoid-code-duplication/113858 "2024-05-06T17:18:38Z")

</div>

Should we strive to avoid code duplication when defining a function with multiple methods if they have similar code? Specifically, for the following function with two methods, should we combine them into a single method…

---

## [How to: High-performance differentiable programming with broad AD-library support?](https://discourse.julialang.org/t/how-to-high-performance-differentiable-programming-with-broad-ad-library-support/113884)

<div class="topic-metadata">

**Author:** [@ThummeTo](https://discourse.julialang.org/u/ThummeTo)\
**Replies:** 13\
**Last updated:** [May 6, 2024, 3:35pm UTC](https://discourse.julialang.org/t/how-to-high-performance-differentiable-programming-with-broad-ad-library-support/113884 "2024-05-06T15:35:28Z")

</div>

Hi at all, I am currently struggling with three (competing?) goals on code design. I want code, that: (1) is fast, (b) is differentiable and (c) differentiable by current (and future) AD-libraries (like at least Forward…

---

## [Challenges with Arrow and Parquet in a (reasonably substantial) Julia Project](https://discourse.julialang.org/t/challenges-with-arrow-and-parquet-in-a-reasonably-substantial-julia-project/113209)

<div class="topic-metadata">

**Author:** [@chris-b1](https://discourse.julialang.org/u/chris-b1)\
**Replies:** 57\
**Last updated:** [May 6, 2024, 2:53pm UTC](https://discourse.julialang.org/t/challenges-with-arrow-and-parquet-in-a-reasonably-substantial-julia-project/113209 "2024-05-06T14:53:38Z")

</div>

I was curious if you could expand on this a bit. In my experience Arrow.jl is well supported and performant. I haven’t used it much but there is also Parquet2.jl which is actively developed.

---

## [ConcurrencyViolationError in UnitfulExt](https://discourse.julialang.org/t/concurrencyviolationerror-in-unitfulext/112069)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 10\
**Last updated:** [May 6, 2024, 2:29pm UTC](https://discourse.julialang.org/t/concurrencyviolationerror-in-unitfulext/112069 "2024-05-06T14:29:44Z")

</div>

I get the following pre-compilation error: ⠇ \[00m:15s\] PackageCompiler: compiling incremental system image┌ Error: Error during loading of extension UnitfulExt of Plots, use \`Base.retry\_load\_extensions()\` to retry. │ …

---

## [How to check for a safe cast?](https://discourse.julialang.org/t/how-to-check-for-a-safe-cast/113853)

<div class="topic-metadata">

**Author:** [@berquist](https://discourse.julialang.org/u/berquist)\
**Replies:** 3\
**Last updated:** [May 6, 2024, 1:39pm UTC](https://discourse.julialang.org/t/how-to-check-for-a-safe-cast/113853 "2024-05-06T13:39:42Z")

</div>

NumPy has numpy.can\_cast — NumPy v1.26 Manual. I’d like to know if it exists in a library before I write something simplified based upon sizeof, which I think is what NumPy is mostly doing anyway.

---

## [Bit instructions from C++. Do we have them?](https://discourse.julialang.org/t/bit-instructions-from-c-do-we-have-them/113900)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.julialang.org/u/Dan)\
**Replies:** 1\
**Last updated:** [May 6, 2024, 12:56pm UTC](https://discourse.julialang.org/t/bit-instructions-from-c-do-we-have-them/113900 "2024-05-06T12:56:03Z")

</div>

From a Twitter post: Do we have all these? Seems like we do have some of them. Could be good practice to adopt the missing ones. The source is: C23 stdbit.h quick reference

---

## [Why trigonometric functions throw an error for Inf?](https://discourse.julialang.org/t/why-trigonometric-functions-throw-an-error-for-inf/113899)

<div class="topic-metadata">

**Author:** [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Replies:** 2\
**Last updated:** [May 6, 2024, 12:18pm UTC](https://discourse.julialang.org/t/why-trigonometric-functions-throw-an-error-for-inf/113899 "2024-05-06T12:18:37Z")

</div>

I belive many other floating point functions just return NaN for fast results or IEEE floating point compliance for incompatible input values but sin, cos like trigonometric functions throw for Inf but also not throw for…

---

## [Is this the right way of distributing the system of differential equations over multiple nodes on a cluster?](https://discourse.julialang.org/t/is-this-the-right-way-of-distributing-the-system-of-differential-equations-over-multiple-nodes-on-a-cluster/113612)

<div class="topic-metadata">

**Author:** [@Shashank](https://discourse.julialang.org/u/Shashank)\
**Replies:** 2\
**Last updated:** [May 6, 2024, 11:51am UTC](https://discourse.julialang.org/t/is-this-the-right-way-of-distributing-the-system-of-differential-equations-over-multiple-nodes-on-a-cluster/113612 "2024-05-06T11:51:40Z")

</div>

I have a large system of ordinary differential equations, and the right-hand side of the equation is coupled and time-consuming. I have written code that parallelizes the evaluation of the right-hand side over multiple t…

---

## [Could Someone Guide me on Issue with Array Indexing in Julia?](https://discourse.julialang.org/t/could-someone-guide-me-on-issue-with-array-indexing-in-julia/113897)

<div class="topic-metadata">

**Author:** [@rich20509](https://discourse.julialang.org/u/rich20509)\
**Replies:** 1\
**Last updated:** [May 6, 2024, 11:13am UTC](https://discourse.julialang.org/t/could-someone-guide-me-on-issue-with-array-indexing-in-julia/113897 "2024-05-06T11:13:41Z")

</div>

Hello there, This is my code: Julia code demonstrating the issue x = \[1, 2, 3, 4, 5\] y = x\[1:3\] Now let’s try to modify y y\[1\] = 10 println("x: ", x) println("y: ", y) I am encountering an unexpected behavior wh…

---

## [Problems with distributed package](https://discourse.julialang.org/t/problems-with-distributed-package/113893)

<div class="topic-metadata">

**Author:** [@greivin](https://discourse.julialang.org/u/greivin)\
**Replies:** 0\
**Last updated:** [May 6, 2024, 10:18am UTC](https://discourse.julialang.org/t/problems-with-distributed-package/113893 "2024-05-06T10:18:37Z")

</div>

I have been having troubles using the Distributed package. I have one function that returns a 100 x 4 array. This array is produced by averaging over some dimensions of a SharedArray that is constructed with a distribute…

---

## [Using LoggingExtras to filter LogMessages that were generated from a specific function](https://discourse.julialang.org/t/using-loggingextras-to-filter-logmessages-that-were-generated-from-a-specific-function/113883)

<div class="topic-metadata">

**Author:** [@reumle](https://discourse.julialang.org/u/reumle)\
**Replies:** 1\
**Last updated:** [May 6, 2024, 10:00am UTC](https://discourse.julialang.org/t/using-loggingextras-to-filter-logmessages-that-were-generated-from-a-specific-function/113883 "2024-05-06T10:00:37Z")

</div>

Hello , LoggingExtras lets the coder filter messages that satisfy a condition. Is it possible to keep only the messages that were issued from within a given function Is it possible to combine the above condition with a…

---

## [ModelingToolkit.jl -- intermediate symbolic variables calculated from solutions output in the state vector](https://discourse.julialang.org/t/modelingtoolkit-jl-intermediate-symbolic-variables-calculated-from-solutions-output-in-the-state-vector/54024)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 5\
**Last updated:** [May 6, 2024, 9:53am UTC](https://discourse.julialang.org/t/modelingtoolkit-jl-intermediate-symbolic-variables-calculated-from-solutions-output-in-the-state-vector/54024 "2024-05-06T09:53:23Z")

</div>

When getting a solution from ODEProblem which was created with ModelingToolkit.jl. Is there a way of evaluating symbolic variables/equations that are not in the state vector in plots, etc. Is there an easy way to maybe…

---

## [Embed metadata in PDF](https://discourse.julialang.org/t/embed-metadata-in-pdf/62593)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [May 6, 2024, 8:01am UTC](https://discourse.julialang.org/t/embed-metadata-in-pdf/62593 "2024-05-06T08:01:49Z")

</div>

I am saving a plot as a PDF and I want to embed some metadata about the plot into the pdf file. Is that possible?

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

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