# General Usage

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

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

**Page:** 300

---

## [Collecting Base.Broadcast.Broadcasted](https://discourse.julialang.org/t/collecting-base-broadcast-broadcasted/97933)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 2\
**Last updated:** [April 26, 2023, 9:59am UTC](https://discourse.julialang.org/t/collecting-base-broadcast-broadcasted/97933 "2023-04-26T09:59:51Z")

</div>

when overloading broadcasted() one may sometimes want to call collect. However, this seems to not remember the size: julia\> a = reshape(1:100,(10,10)) 10×10 reshape(::UnitRange{Int64}, 10, 10) with eltype Int64: 1 11…

---

## [Log-Linear Interpolation](https://discourse.julialang.org/t/log-linear-interpolation/97932)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 7:54am UTC](https://discourse.julialang.org/t/log-linear-interpolation/97932 "2023-04-26T07:54:38Z")

</div>

Does Interpolations have a log-linear model. Its common for interpolating interest rate curves. e.g. t = 1:5 zero\_rate = .01:.01:.05 discount\_factor = @. exp(- t \* zero\_rate) log\_linear = ex…

---

## [Struct and macro - currency pair - ways to specify](https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 6:53am UTC](https://discourse.julialang.org/t/struct-and-macro-currency-pair-ways-to-specify/97930 "2023-04-26T06:53:15Z")

</div>

I’ve defined a currency pair as struct ccy\_pair; c1::Symbol c2::Symbol end ccy\_pair(x::String) = ccy\_pair(Symbol(x\[1:3\]),Symbol(x\[end-2:end\])) macro p\_str(x) ccy\_pair(x) end So I can write as ccy\_p…

---

## [What's the meaning of project\_hash in Manifest.toml?](https://discourse.julialang.org/t/whats-the-meaning-of-project-hash-in-manifest-toml/97923)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 5:43am UTC](https://discourse.julialang.org/t/whats-the-meaning-of-project-hash-in-manifest-toml/97923 "2023-04-26T05:43:28Z")

</div>

Let’s create a new environment in Julia 1.8.5: (@v1.8) pkg\> activate . Activating new project at \`/private/tmp/test\` (test) pkg\> add Example Updating registry at \`~/.julia/registries/General.toml\` Resolving pa…

---

## [Precompiling LanguageServer.runserver() with PrecompileTools.jl](https://discourse.julialang.org/t/precompiling-languageserver-runserver-with-precompiletools-jl/97926)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 0\
**Last updated:** [April 26, 2023, 3:39am UTC](https://discourse.julialang.org/t/precompiling-languageserver-runserver-with-precompiletools-jl/97926 "2023-04-26T03:39:14Z")

</div>

After a conversation on Slack, with Tom McLaughlin, I decided to try adding some precompilation to LanguageServer.jl. Tom had noticed about 10 second lag in the execution of LanguageServer.runserver(). This is part of j…

---

## [How to plot with aitoff projection? (Makie)](https://discourse.julialang.org/t/how-to-plot-with-aitoff-projection-makie/97922)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 12:02am UTC](https://discourse.julialang.org/t/how-to-plot-with-aitoff-projection-makie/97922 "2023-04-26T00:02:42Z")

</div>

example: Geographic Projections — Matplotlib 3.7.1 documentation

---

## [(Flux/Lux) Custom Layers as Functions of Other Layers](https://discourse.julialang.org/t/flux-lux-custom-layers-as-functions-of-other-layers/97913)

<div class="topic-metadata">

**Author:** [@Bizzi](https://discourse.julialang.org/u/Bizzi)\
**Replies:** 4\
**Last updated:** [April 25, 2023, 7:50pm UTC](https://discourse.julialang.org/t/flux-lux-custom-layers-as-functions-of-other-layers/97913 "2023-04-25T19:50:31Z")

</div>

Hey everyone. For some experiments, I want to set up a network where some of the weights are not trained, but instead are given as functions of other (trained) weights in my network. For a simple example, take the NN of…

---

## [Sysimage compilaiton failed with Flux](https://discourse.julialang.org/t/sysimage-compilaiton-failed-with-flux/97914)

<div class="topic-metadata">

**Author:** [@lucasmsoares96](https://discourse.julialang.org/u/lucasmsoares96)\
**Replies:** 0\
**Last updated:** [April 25, 2023, 7:25pm UTC](https://discourse.julialang.org/t/sysimage-compilaiton-failed-with-flux/97914 "2023-04-25T19:25:51Z")

</div>

when having to compile a custom sysimage with the command using PackageCompiler; create\_sysimage(\["Flux"\]; sysimage\_path="JuliaSysimage.so") i get the following error ⡆ \[00m:22s\] PackageCompiler: compiling incremental…

---

## [Giving a Talk to Celebrate Julia within Health Informatics Research!](https://discourse.julialang.org/t/giving-a-talk-to-celebrate-julia-within-health-informatics-research/97632)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 6\
**Last updated:** [April 25, 2023, 3:37pm UTC](https://discourse.julialang.org/t/giving-a-talk-to-celebrate-julia-within-health-informatics-research/97632 "2023-04-25T15:37:38Z")

</div>

Hey folks, :wave: I am wondering if I could get some help/feedback! I am giving a talk this Friday to the observational health research community (OHDSI) and am getting the opportunity to share on some of the tools and …

---

## [How to define default plotting attributes for all my recipes using only \`RecipesBase.jl\`?](https://discourse.julialang.org/t/how-to-define-default-plotting-attributes-for-all-my-recipes-using-only-recipesbase-jl/93384)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [April 25, 2023, 1:55pm UTC](https://discourse.julialang.org/t/how-to-define-default-plotting-attributes-for-all-my-recipes-using-only-recipesbase-jl/93384 "2023-04-25T13:55:02Z")

</div>

I have several @recipes, which share the same plotattributes, such as framestyle, grid, legend\_foreground\_color, etc. If Plots.jl is imported, I could just use default, right? But is it possible that I only use RecipesBa…

---

## [\[Linux\] only receiving 1365 events when reading from /dev/input](https://discourse.julialang.org/t/linux-only-receiving-1365-events-when-reading-from-dev-input/97886)

<div class="topic-metadata">

**Author:** [@screw\_dog](https://discourse.julialang.org/u/screw_dog)\
**Replies:** 0\
**Last updated:** [April 25, 2023, 5:39am UTC](https://discourse.julialang.org/t/linux-only-receiving-1365-events-when-reading-from-dev-input/97886 "2023-04-25T05:39:03Z")

</div>

I’m trying to read keyboard input events from dev/input/eventN, but after reading exactly 1365 events the file is reported as empty and never receives any more data. MWE: dev\_num = 6 # my keyboard is event6, use \`cat /p…

---

## [ForwardDiff through StatsBase's fit(Histogram, ...)](https://discourse.julialang.org/t/forwarddiff-through-statsbases-fit-histogram/97892)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 0\
**Last updated:** [April 25, 2023, 11:25am UTC](https://discourse.julialang.org/t/forwarddiff-through-statsbases-fit-histogram/97892 "2023-04-25T11:25:23Z")

</div>

I have code that is trying to autodifferentiate through the histogram fitting of StatsBase using ForwardDiff, any tips on how to get this to work? I’m hitting TwicePrecision and it’s trying to convert to Float64. Here’s…

---

## [Redefining a single function broadcast rule?](https://discourse.julialang.org/t/redefining-a-single-function-broadcast-rule/97890)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 2\
**Last updated:** [April 25, 2023, 10:01am UTC](https://discourse.julialang.org/t/redefining-a-single-function-broadcast-rule/97890 "2023-04-25T10:01:01Z")

</div>

I would like to redefine a single broadcast rule relating to the coalesce. broadcast. The reason is that the ShiftedArray type can return missing or nothing for out-of-bound shifted access. If the user uses coalesce.(my…

---

## [Text outside of Axis with Makie](https://discourse.julialang.org/t/text-outside-of-axis-with-makie/97888)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 2\
**Last updated:** [April 25, 2023, 8:59am UTC](https://discourse.julialang.org/t/text-outside-of-axis-with-makie/97888 "2023-04-25T08:59:47Z")

</div>

Is it possible, using Makie.jl, to add text outside of an axis? For instance, in using CairoMakie fig = Figure() ax = Axis(fig\[1, 1\]) I want to add text right on the top-left on the plot outside of the axis itself. I…

---

## [Specifying broadcast in reduce operations](https://discourse.julialang.org/t/specifying-broadcast-in-reduce-operations/97589)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 5\
**Last updated:** [April 25, 2023, 6:43am UTC](https://discourse.julialang.org/t/specifying-broadcast-in-reduce-operations/97589 "2023-04-25T06:43:48Z")

</div>

Writing a new CircShiftedArrays package that specified its own BroadcastStyle, I have the trouble that reduce operations such as sum do not get affected by my overloaded functions. I overloaded copyto! and materialize! …

---

## [Calling Julia program from C and avoiding recompiling](https://discourse.julialang.org/t/calling-julia-program-from-c-and-avoiding-recompiling/97800)

<div class="topic-metadata">

**Author:** [@mb96](https://discourse.julialang.org/u/mb96)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 9:44pm UTC](https://discourse.julialang.org/t/calling-julia-program-from-c-and-avoiding-recompiling/97800 "2023-04-24T21:44:34Z")

</div>

Hi! I am planning on calling my Julia programs from my C script where the calling will have to be done many times. However, I am worried about whether this will mean having to recompile the functions all the time as if …

---

## [Julia Surface or Non-Square Heatmap Plots with Spesific Function](https://discourse.julialang.org/t/julia-surface-or-non-square-heatmap-plots-with-spesific-function/97826)

<div class="topic-metadata">

**Author:** [@Umut\_Can\_Turhan](https://discourse.julialang.org/u/Umut_Can_Turhan)\
**Replies:** 8\
**Last updated:** [April 24, 2023, 8:19pm UTC](https://discourse.julialang.org/t/julia-surface-or-non-square-heatmap-plots-with-spesific-function/97826 "2023-04-24T20:19:29Z")

</div>

Hi! I have some coordinates points (non-grid or non-square): Each scatter points have x values: 74-element Vector{Any}: 13.0 2.0 59.5 55.0 22.0 57.5 21.0 28.0 100.5 35.0 64.0 34.5 23.0 ⋮ 85.5 83.0 66…

---

## [Warning: backend \`PlotlyJS\` is not installed](https://discourse.julialang.org/t/warning-backend-plotlyjs-is-not-installed/97746)

<div class="topic-metadata">

**Author:** [@jianqixi](https://discourse.julialang.org/u/jianqixi)\
**Replies:** 13\
**Last updated:** [April 24, 2023, 8:14pm UTC](https://discourse.julialang.org/t/warning-backend-plotlyjs-is-not-installed/97746 "2023-04-24T20:14:59Z")

</div>

I am trying to using backend of PlotlyJS in my julia code, but it shows the warning: Warning: backend PlotlyJS is not installed. └ @ Plots C:\\Users\\username.julia\\packages\\Plots\\p3KMq\\src\\backends.jl:43 Then there is …

---

## [Variable Name with Cdot?](https://discourse.julialang.org/t/variable-name-with-cdot/97838)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 6\
**Last updated:** [April 24, 2023, 5:38pm UTC](https://discourse.julialang.org/t/variable-name-with-cdot/97838 "2023-04-24T17:38:39Z")

</div>

This may seem like a silly question. It is not really that important but if its possible I’d like to do it. I am writing some code for a fluid solver and I have terms that represent diffusion and advection. I can write t…

---

## [Iterating over range is slower than while loop](https://discourse.julialang.org/t/iterating-over-range-is-slower-than-while-loop/96991)

<div class="topic-metadata">

**Author:** [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Replies:** 7\
**Last updated:** [April 24, 2023, 4:10pm UTC](https://discourse.julialang.org/t/iterating-over-range-is-slower-than-while-loop/96991 "2023-04-24T16:10:14Z")

</div>

using BenchmarkTools, SIMD function test(x) N = 8 c = Vec{N, Float32}(0) lane = VecRange{N}(0) @inbounds @fastmath for i in 1:N:length(x) c += x\[lane + i\] end return sum(c) end functio…

---

## [Tooling for line-by-line memory allocation analysis](https://discourse.julialang.org/t/tooling-for-line-by-line-memory-allocation-analysis/74552)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 15\
**Last updated:** [April 24, 2023, 4:09pm UTC](https://discourse.julialang.org/t/tooling-for-line-by-line-memory-allocation-analysis/74552 "2023-04-24T16:09:55Z")

</div>

I am tracking down an allocation problem in a large codebase. I generated the allocation information as described in the manual, and managed to get all those MallocInfo objects, but I am unsure what to do next. That is,…

---

## [Flux Restructure for ComponentArrays.jl unreasonably slow](https://discourse.julialang.org/t/flux-restructure-for-componentarrays-jl-unreasonably-slow/97849)

<div class="topic-metadata">

**Author:** [@glatteis](https://discourse.julialang.org/u/glatteis)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 12:56pm UTC](https://discourse.julialang.org/t/flux-restructure-for-componentarrays-jl-unreasonably-slow/97849 "2023-04-24T12:56:18Z")

</div>

In some situations, you have to restructure a lot if you use Flux and want to run your batches as seperate solves, not as one big solve, for instance using an EnsembleProblem. You have to use something like a ComponentAr…

---

## [Are there any more-readable alternatives to using many individual variables for performance critical code?](https://discourse.julialang.org/t/are-there-any-more-readable-alternatives-to-using-many-individual-variables-for-performance-critical-code/97820)

<div class="topic-metadata">

**Author:** [@Qile0317](https://discourse.julialang.org/u/Qile0317)\
**Replies:** 8\
**Last updated:** [April 24, 2023, 12:45pm UTC](https://discourse.julialang.org/t/are-there-any-more-readable-alternatives-to-using-many-individual-variables-for-performance-critical-code/97820 "2023-04-24T12:45:57Z")

</div>

For a package I’ve been developing in which the code performance is critical, many functions utilize a very long list of individual variables, both arguments and internal variables alike. I’ve tried in the past to modify…

---

## [KernelAbstraction ndrange using UnitRange](https://discourse.julialang.org/t/kernelabstraction-ndrange-using-unitrange/96713)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 9:38am UTC](https://discourse.julialang.org/t/kernelabstraction-ndrange-using-unitrange/96713 "2023-04-24T09:38:22Z")

</div>

I have an array with size(A)=(N,M) and I would like to run a kernel over ndrange=(2:N-1,3:M-1). Is there a way to do this other than defining an OffsetArray wrapper?

---

## [Obscure error message when using Documenter plugin in PkgTemplates.jl](https://discourse.julialang.org/t/obscure-error-message-when-using-documenter-plugin-in-pkgtemplates-jl/97831)

<div class="topic-metadata">

**Author:** [@mmv](https://discourse.julialang.org/u/mmv)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 8:59am UTC](https://discourse.julialang.org/t/obscure-error-message-when-using-documenter-plugin-in-pkgtemplates-jl/97831 "2023-04-24T08:59:20Z")

</div>

Hi! I am trying to initiate a second project by defining a template suitable for use with the package PkgTemplates. The template definition appears to work fine without the Documenter plugin, but as soon as I include it…

---

## [Julia Threads.@threads slower than single thread performance](https://discourse.julialang.org/t/julia-threads-threads-slower-than-single-thread-performance/46823)

<div class="topic-metadata">

**Author:** [@cricci](https://discourse.julialang.org/u/cricci)\
**Replies:** 11\
**Last updated:** [April 24, 2023, 8:57am UTC](https://discourse.julialang.org/t/julia-threads-threads-slower-than-single-thread-performance/46823 "2023-04-24T08:57:11Z")

</div>

I am trying to solve numerically the heat equation in 1d: I am using finite differences and I have some trouble using the @threads instruction in Julia. In particular below there are two version of the same code: the …

---

## [Why I still recommend Julia: how 300 lines of Julia code being 1000x faster than MATLAB's C Mex codes](https://discourse.julialang.org/t/why-i-still-recommend-julia-how-300-lines-of-julia-code-being-1000x-faster-than-matlabs-c-mex-codes/97842)

<div class="topic-metadata">

**Author:** [@JohnnyChen94](https://discourse.julialang.org/u/JohnnyChen94)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 7:43am UTC](https://discourse.julialang.org/t/why-i-still-recommend-julia-how-300-lines-of-julia-code-being-1000x-faster-than-matlabs-c-mex-codes/97842 "2023-04-24T07:43:11Z")

</div>

I believe this is an excellent real-world example to showcase Julia’s superiority. GaloisFieldNumbers is a reference (snapshotted) implementation that shows the beauty of Julia in 300 lines of code. It was released a fe…

---

## [Can PythonCall / CondaPkg use custom channels?](https://discourse.julialang.org/t/can-pythoncall-condapkg-use-custom-channels/97815)

<div class="topic-metadata">

**Author:** [@huguesmp](https://discourse.julialang.org/u/huguesmp)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 7:38am UTC](https://discourse.julialang.org/t/can-pythoncall-condapkg-use-custom-channels/97815 "2023-04-24T07:38:38Z")

</div>

I use Julia in a very restrictive corporate environment at work. For python packages, we must use Artifactory for both Conda and pip. This means that for the conda command to work, I need a .condarc file which sets up t…

---

## [How to parse string with non-US number format?](https://discourse.julialang.org/t/how-to-parse-string-with-non-us-number-format/97833)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 5:41am UTC](https://discourse.julialang.org/t/how-to-parse-string-with-non-us-number-format/97833 "2023-04-24T05:41:20Z")

</div>

How to convert the string "132.993,00" to the floating point value 132993.00? Are the internationalization or locale packages in Julia that handle country-specific number formats? Base.parse doesn’t contain options to p…

---

## [Working with different versions of Julia](https://discourse.julialang.org/t/working-with-different-versions-of-julia/97573)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 6\
**Last updated:** [April 23, 2023, 8:46pm UTC](https://discourse.julialang.org/t/working-with-different-versions-of-julia/97573 "2023-04-23T20:46:12Z")

</div>

Under normal circumstances, I work with a single version of Julia, say, Julia 1.8. I have a folder of Julia code, along with Project.toml and Manifest.toml files. I would also like to work with Julia 1.9. What is the str…

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

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