# General Usage

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

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

**Page:** 233

---

## [Showing percentage different between bar of grouped bar chart in Plotly](https://discourse.julialang.org/t/showing-percentage-different-between-bar-of-grouped-bar-chart-in-plotly/105681)

<div class="topic-metadata">

**Author:** [@nnguyengiatan](https://discourse.julialang.org/u/nnguyengiatan)\
**Replies:** 3\
**Last updated:** [November 4, 2023, 1:33pm UTC](https://discourse.julialang.org/t/showing-percentage-different-between-bar-of-grouped-bar-chart-in-plotly/105681 "2023-11-04T13:33:26Z")

</div>

Hello all, As you can see in the example below, I would like to label my grouped bar chart with the % differential between each group of bars. Could anyone point me to documentation or examples that would cover that? H…

---

## [Funny Benchmark with Julia (no longer) at the bottom](https://discourse.julialang.org/t/funny-benchmark-with-julia-no-longer-at-the-bottom/104611)

<div class="topic-metadata">

**Author:** [@algunion](https://discourse.julialang.org/u/algunion)\
**Replies:** 149\
**Last updated:** [November 4, 2023, 1:32pm UTC](https://discourse.julialang.org/t/funny-benchmark-with-julia-no-longer-at-the-bottom/104611 "2023-11-04T13:32:17Z")

</div>

A. S. To prevent any confusion: at the time when this was originally posted, Julia’s run was about 600ms and was ~20x slower than Rust. This is not longer the case. Resuming the original post… … → I stumbled upon thi…

---

## [Code optimization using SIMD or LoopVectorization](https://discourse.julialang.org/t/code-optimization-using-simd-or-loopvectorization/105782)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 7\
**Last updated:** [November 4, 2023, 7:13am UTC](https://discourse.julialang.org/t/code-optimization-using-simd-or-loopvectorization/105782 "2023-11-04T07:13:21Z")

</div>

Dear Julia experts, I have implemented the probability density function for the Pearson-IV distribution. This implementation is based on the R-package “PearsonDS”. Here is the code: import SpecialFunctions: lgamma, gam…

---

## [Providing @testset option with macro depending on Julia version](https://discourse.julialang.org/t/providing-testset-option-with-macro-depending-on-julia-version/105689)

<div class="topic-metadata">

**Author:** [@AnHeuermann](https://discourse.julialang.org/u/AnHeuermann)\
**Replies:** 1\
**Last updated:** [November 4, 2023, 6:57am UTC](https://discourse.julialang.org/t/providing-testset-option-with-macro-depending-on-julia-version/105689 "2023-11-04T06:57:08Z")

</div>

I want to use Test.@testset with option failfast=true in my unit testing. But this feature requires at least Julia 1.9 and I’m testing on both newer and older versions of Julia. I would like to define a macro or functio…

---

## [Connecting Julia to DB2 LUW database](https://discourse.julialang.org/t/connecting-julia-to-db2-luw-database/105770)

<div class="topic-metadata">

**Author:** [@brianhfield](https://discourse.julialang.org/u/brianhfield)\
**Replies:** 4\
**Last updated:** [November 3, 2023, 9:14pm UTC](https://discourse.julialang.org/t/connecting-julia-to-db2-luw-database/105770 "2023-11-03T21:14:28Z")

</div>

Fairly new to Julia. I am trying to determine if it is possible to query a DB2 LUW database directly with Julia and I haven’t found any definitive answers so far. Does anyone here happen to know? Is there a package I …

---

## [Distributed programming with callable mutable types/"functors"](https://discourse.julialang.org/t/distributed-programming-with-callable-mutable-types-functors/105543)

<div class="topic-metadata">

**Author:** [@hijit](https://discourse.julialang.org/u/hijit)\
**Replies:** 5\
**Last updated:** [November 3, 2023, 3:45pm UTC](https://discourse.julialang.org/t/distributed-programming-with-callable-mutable-types-functors/105543 "2023-11-03T15:45:01Z")

</div>

Hello I have a question regarding distributed programming with callable mutable types and how they are handled by workers when used in a @distributed loop. In particular if I have an instance of a callable mutable type (…

---

## [What is happening with the nightly precompile cache?](https://discourse.julialang.org/t/what-is-happening-with-the-nightly-precompile-cache/105736)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 1\
**Last updated:** [November 3, 2023, 3:39pm UTC](https://discourse.julialang.org/t/what-is-happening-with-the-nightly-precompile-cache/105736 "2023-11-03T15:39:18Z")

</div>

In every update I do I see the pre-compile cache file increase size. Just did now and the cache file grew 14 MB from what it was from a version with 5 days. For GMT (with a reduced number of pre-compile cases than last r…

---

## [Interactive Plot in Agents.jl not clickable](https://discourse.julialang.org/t/interactive-plot-in-agents-jl-not-clickable/105747)

<div class="topic-metadata">

**Author:** [@Kemper](https://discourse.julialang.org/u/Kemper)\
**Replies:** 7\
**Last updated:** [November 3, 2023, 2:14pm UTC](https://discourse.julialang.org/t/interactive-plot-in-agents-jl-not-clickable/105747 "2023-11-03T14:14:50Z")

</div>

Hi everyone! I am starting with agent based modelling, but I am not sure if this is a problem with Agents.jl or a general one: I try to do a very simple interactive plot, and the plot as well as the buttons and slide b…

---

## [Optimization problem: make as many friends as possible](https://discourse.julialang.org/t/optimization-problem-make-as-many-friends-as-possible/105694)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 10\
**Last updated:** [November 3, 2023, 1:44pm UTC](https://discourse.julialang.org/t/optimization-problem-make-as-many-friends-as-possible/105694 "2023-11-03T13:44:54Z")

</div>

Julians, I heard you like performance contests, here is one. Problem statement: A company wants to teach its employees how to work on tasks. It also wants them to make as many friends as possible. Two people become fri…

---

## [\`Type(val)\` vs \`convert(Type, val)\` (Converting more than 365 days to months and years)](https://discourse.julialang.org/t/type-val-vs-convert-type-val-converting-more-than-365-days-to-months-and-years/105684)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 14\
**Last updated:** [November 3, 2023, 1:32pm UTC](https://discourse.julialang.org/t/type-val-vs-convert-type-val-converting-more-than-365-days-to-months-and-years/105684 "2023-11-03T13:32:37Z")

</div>

I was wondering how many years were between two events. So I define the timepoints, and find their difference: julia\> using Dates julia\> d0 = Date(1980, 6, 17) 1980-06-17 julia\> d1 = Date(2015, 1, 4) 2015-01-04 julia\>…

---

## [Building Julia 1.10 on Windows](https://discourse.julialang.org/t/building-julia-1-10-on-windows/105744)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [November 3, 2023, 10:35am UTC](https://discourse.julialang.org/t/building-julia-1-10-on-windows/105744 "2023-11-03T10:35:36Z")

</div>

How can I build Julia from source on Windows? Which toolchain and compiler should I install?

---

## [ERROR: The following package names could not be resolved: \* Dataframes](https://discourse.julialang.org/t/error-the-following-package-names-could-not-be-resolved-dataframes/105746)

<div class="topic-metadata">

**Author:** [@aleppersico](https://discourse.julialang.org/u/aleppersico)\
**Replies:** 2\
**Last updated:** [November 3, 2023, 9:17am UTC](https://discourse.julialang.org/t/error-the-following-package-names-could-not-be-resolved-dataframes/105746 "2023-11-03T09:17:54Z")

</div>

Hey all, As in my daily routine I was about to work with dataframes but today the package Dataframes.jl is not working. I have of course installed the package some time ago, but today I had to reinstall it after I got t…

---

## [How can I give a function to eigs() in julia like matlab](https://discourse.julialang.org/t/how-can-i-give-a-function-to-eigs-in-julia-like-matlab/105699)

<div class="topic-metadata">

**Author:** [@Meteoooor](https://discourse.julialang.org/u/Meteoooor)\
**Replies:** 6\
**Last updated:** [November 3, 2023, 7:57am UTC](https://discourse.julialang.org/t/how-can-i-give-a-function-to-eigs-in-julia-like-matlab/105699 "2023-11-03T07:57:05Z")

</div>

I have the following matlab code: function \[ DomRVec, DomEig, Error \] = MyEigs( Tup, Tdn, NumofValue, SpeString, Dbond, Dspin, InitVec ) VecDim = Dbond^2; Tup = reshape( permute( Tup, \[ 1, 3, 2 \] ), \[ Dbond \* Dspin, D…

---

## [Plotting Trouble and GR](https://discourse.julialang.org/t/plotting-trouble-and-gr/105724)

<div class="topic-metadata">

**Author:** [@ivanricardo](https://discourse.julialang.org/u/ivanricardo)\
**Replies:** 4\
**Last updated:** [November 3, 2023, 6:00am UTC](https://discourse.julialang.org/t/plotting-trouble-and-gr/105724 "2023-11-03T06:00:20Z")

</div>

Hello, I have been struggling with the base Plots package and have been getting the following error every time I try to plot /home/ivan/.julia/artifacts/7f59a0ec3d19c98dce30a3ba8ea9cbd8824ce4a6/bin/gksqt: /usr/bin/…/li…

---

## [PlotlyJS 0.18.11 hangs when trying "using" - but only the first time!](https://discourse.julialang.org/t/plotlyjs-0-18-11-hangs-when-trying-using-but-only-the-first-time/105636)

<div class="topic-metadata">

**Author:** [@mjmat](https://discourse.julialang.org/u/mjmat)\
**Replies:** 8\
**Last updated:** [November 3, 2023, 5:57am UTC](https://discourse.julialang.org/t/plotlyjs-0-18-11-hangs-when-trying-using-but-only-the-first-time/105636 "2023-11-03T05:57:53Z")

</div>

I am experiencing a strange behavior with PlotlyJS 0.18.11. The first time I try “using” the package, Julia hangs. If I interrupt the process (CTRL-C, I am on Windows 10) I get error different error messages in VSCode o…

---

## [Save Flux model to ONNX?](https://discourse.julialang.org/t/save-flux-model-to-onnx/70335)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 14\
**Last updated:** [November 3, 2023, 3:06am UTC](https://discourse.julialang.org/t/save-flux-model-to-onnx/70335 "2023-11-03T03:06:57Z")

</div>

How to save a Flux model to ONNX? Is there currently a way to do it?

---

## [Avoiding allocations in a map over a tuple](https://discourse.julialang.org/t/avoiding-allocations-in-a-map-over-a-tuple/105734)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 3\
**Last updated:** [November 2, 2023, 11:24pm UTC](https://discourse.julialang.org/t/avoiding-allocations-in-a-map-over-a-tuple/105734 "2023-11-02T23:24:55Z")

</div>

Is there a way to avoid allocations in this function without using a generated function? function foo(t::Tuple) map(t) do x isodd(x) ? 1 : 1.0 end end julia\> using BenchmarkTools julia\> t = (1, 2, 3, 4…

---

## [What is the equivalent of numpy.random.choice for generating a non-uniform random sample based on a user supplied probability?](https://discourse.julialang.org/t/what-is-the-equivalent-of-numpy-random-choice-for-generating-a-non-uniform-random-sample-based-on-a-user-supplied-probability/34461)

<div class="topic-metadata">

**Author:** [@PyDataBlog](https://discourse.julialang.org/u/PyDataBlog)\
**Replies:** 7\
**Last updated:** [November 2, 2023, 10:35pm UTC](https://discourse.julialang.org/t/what-is-the-equivalent-of-numpy-random-choice-for-generating-a-non-uniform-random-sample-based-on-a-user-supplied-probability/34461 "2023-11-02T22:35:14Z")

</div>

Hi, I’m on the lookout for the equivalent of \[numpy.random.choice()\](numpy.random.choice — NumPy v1.15 Manual). I want to generate random indices based on non-uniform random sampling. For example, I can do this with N…

---

## [Define macros depending on optimization level](https://discourse.julialang.org/t/define-macros-depending-on-optimization-level/105714)

<div class="topic-metadata">

**Author:** [@mancolric](https://discourse.julialang.org/u/mancolric)\
**Replies:** 3\
**Last updated:** [November 2, 2023, 7:45pm UTC](https://discourse.julialang.org/t/define-macros-depending-on-optimization-level/105714 "2023-11-02T19:45:45Z")

</div>

I would like to define the macro const var"@lvec" = const var"@turbo @." if Julia is started with optimization levels 2 or 3, and const var"@lvec" = const var"@." otherwise. My main motivation is that I use @tturbo @. v…

---

## [Adding compat entry to stdlib breaks tests on Julia 1.3](https://discourse.julialang.org/t/adding-compat-entry-to-stdlib-breaks-tests-on-julia-1-3/105705)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 10\
**Last updated:** [November 2, 2023, 6:58pm UTC](https://discourse.julialang.org/t/adding-compat-entry-to-stdlib-breaks-tests-on-julia-1-3/105705 "2023-11-02T18:58:33Z")

</div>

I’m trying to register a new package version, and JuliaRegistrator asked me to add a compat entry for LinearAlgebra.jl. I added LinearAlgebra = "1" to my compat entry, but then my Github CI tests for Julia 1.3 fail with …

---

## [Would you want the REPL to warn against performance traps, at least non-const globals?](https://discourse.julialang.org/t/would-you-want-the-repl-to-warn-against-performance-traps-at-least-non-const-globals/105719)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [November 2, 2023, 6:45pm UTC](https://discourse.julialang.org/t/would-you-want-the-repl-to-warn-against-performance-traps-at-least-non-const-globals/105719 "2023-11-02T18:45:51Z")

</div>

https://www.reddit.com/r/Julia/comments/17m7knl/same\_code\_in\_julia\_takes\_6\_minutes\_vs\_15\_seconds/ const s = 6; const L = sqrt(11); r(z) = 1 ./sqrt.(s^2 - (L-z).^2) That’s part of larger code that was 24x slower than …

---

## [How to do a 2d interpolation?](https://discourse.julialang.org/t/how-to-do-a-2d-interpolation/105698)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [November 2, 2023, 2:49pm UTC](https://discourse.julialang.org/t/how-to-do-a-2d-interpolation/105698 "2023-11-02T14:49:48Z")

</div>

How can I do a 2D interpolation on a regular grid? This works (1D): using PyPlot, Interpolations TSR = 2.0:1.0:10.0 TSR\_fine = 2.0:0.01:10.0 CP1 = sin.(TSR) plot(TSR, CP1) itp\_cubic1 = cubic\_spline\_interpolation(TSR…

---

## [\[Call for Collaborators\]: Tool for Extracting Treatment Pathways in Patient Populations Standardized in the OMOP CDM](https://discourse.julialang.org/t/call-for-collaborators-tool-for-extracting-treatment-pathways-in-patient-populations-standardized-in-the-omop-cdm/105704)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 0\
**Last updated:** [November 2, 2023, 2:34pm UTC](https://discourse.julialang.org/t/call-for-collaborators-tool-for-extracting-treatment-pathways-in-patient-populations-standardized-in-the-omop-cdm/105704 "2023-11-02T14:34:34Z")

</div>

Hi folks :wave: This is a call for collaborators for a project I am starting! I’d love collaborators on this work if you are interested in the idea; I’ll be working on it at any rate! Details as follows: Title: Tool f…

---

## [Stackoverflow error with no stacktrace](https://discourse.julialang.org/t/stackoverflow-error-with-no-stacktrace/105690)

<div class="topic-metadata">

**Author:** [@Larbino1](https://discourse.julialang.org/u/Larbino1)\
**Replies:** 3\
**Last updated:** [November 2, 2023, 1:21pm UTC](https://discourse.julialang.org/t/stackoverflow-error-with-no-stacktrace/105690 "2023-11-02T13:21:00Z")

</div>

I’m experienceing a strange bug which results in a stack overflow error with no stacktrace at all. I’m not sure how or why this happens, and I have found it impossible to diagnose. I haven’t been able to reprodruce the b…

---

## [Avoid Dynamic Dispatch](https://discourse.julialang.org/t/avoid-dynamic-dispatch/105685)

<div class="topic-metadata">

**Author:** [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)\
**Replies:** 2\
**Last updated:** [November 2, 2023, 11:05am UTC](https://discourse.julialang.org/t/avoid-dynamic-dispatch/105685 "2023-11-02T11:05:09Z")

</div>

For some tensor operations I need to keep track of partial indices and call out to user supplied functions. In principle the type of all arguments can be inferred statically, but Julia doesn’t seem to do that, leading to…

---

## [How to get the path of a Julia script](https://discourse.julialang.org/t/how-to-get-the-path-of-a-julia-script/1728)

<div class="topic-metadata">

**Author:** [@willow](https://discourse.julialang.org/u/willow)\
**Replies:** 7\
**Last updated:** [November 2, 2023, 2:29am UTC](https://discourse.julialang.org/t/how-to-get-the-path-of-a-julia-script/1728 "2023-11-02T02:29:02Z")

</div>

I have found a small inconsistency in the google group lists. When you type “julia get directory of script” into a google search box (finding a way to programmatically determine the file path of the currently executing s…

---

## [Transform dataframes to suit confusion matrix plotting](https://discourse.julialang.org/t/transform-dataframes-to-suit-confusion-matrix-plotting/105677)

<div class="topic-metadata">

**Author:** [@Cong](https://discourse.julialang.org/u/Cong)\
**Replies:** 0\
**Last updated:** [November 2, 2023, 12:12am UTC](https://discourse.julialang.org/t/transform-dataframes-to-suit-confusion-matrix-plotting/105677 "2023-11-02T00:12:27Z")

</div>

I have a dataframe like the one below, and I would like to transform it to plot a confusion matrix. :TopL, :TopR, :BotL, :BotR are the four choices, and each time two and only two of them will be presented. :portChoice …

---

## [How to determine the coefficients of a polynom](https://discourse.julialang.org/t/how-to-determine-the-coefficients-of-a-polynom/105648)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [November 1, 2023, 9:09pm UTC](https://discourse.julialang.org/t/how-to-determine-the-coefficients-of-a-polynom/105648 "2023-11-01T21:09:34Z")

</div>

How can I determine the coefficients of a polynom? using Symbolics @variables R a b c d U J Q s input = 2s + 4U\*a\*s^2 + Q\*(J+s) function split\_s(input::Num) end res = split\_s(input) # expected output: # the factors…

---

## [Cairo text functions discrepancies](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 2\
**Last updated:** [November 1, 2023, 6:22pm UTC](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635 "2023-11-01T18:22:54Z")

</div>

I am testing the different text drawing functions in Cairo.jl: show\_text, text, and text\_path. The text function is the only one that produces the wrong size and is positioned at a distance from the insertion point (see …

---

## [How would I retrieve the result from CUDA.@profile?](https://discourse.julialang.org/t/how-would-i-retrieve-the-result-from-cuda-profile/105548)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 7\
**Last updated:** [November 1, 2023, 5:20pm UTC](https://discourse.julialang.org/t/how-would-i-retrieve-the-result-from-cuda-profile/105548 "2023-11-01T17:20:45Z")

</div>

Hi! Checking out the new release of CUDA.jl, which really has made profiling a lot easier! Much appreciated. I was wondering though, how do I retrieve the result from the profiling? #https://info.juliahub.com/cuda-jl-5…

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

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