# General Usage

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

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

**Page:** 476

---

## [Easiest way to convert between integer and hex](https://discourse.julialang.org/t/easiest-way-to-convert-between-integer-and-hex/20473)

<div class="topic-metadata">

**Author:** [@srikar\_sastry](https://discourse.julialang.org/u/srikar_sastry)\
**Replies:** 7\
**Last updated:** [March 7, 2022, 10:09am UTC](https://discourse.julialang.org/t/easiest-way-to-convert-between-integer-and-hex/20473 "2022-03-07T10:09:44Z")

</div>

Hello, MATLAB provides dec2hex, hex2dec and other such functions to go between different number representations. After searching on the web and Julia documentation, I couldn’t easily get hits on these type of questions …

---

## [Ensure solution stays at zero](https://discourse.julialang.org/t/ensure-solution-stays-at-zero/77482)

<div class="topic-metadata">

**Author:** [@colebrookson](https://discourse.julialang.org/u/colebrookson)\
**Replies:** 0\
**Last updated:** [March 6, 2022, 9:57pm UTC](https://discourse.julialang.org/t/ensure-solution-stays-at-zero/77482 "2022-03-06T21:57:50Z")

</div>

I’m using a VectorContinuousCallback to perform an “extinction event”, where for my large 50-equation system, if the values of one species (i’m modeling a bunch of interacting species) goes below 10e-30 then the value of…

---

## [Why is julia slowest here?](https://discourse.julialang.org/t/why-is-julia-slowest-here/77479)

<div class="topic-metadata">

**Author:** [@matic\_lauko](https://discourse.julialang.org/u/matic_lauko)\
**Replies:** 4\
**Last updated:** [March 6, 2022, 7:47pm UTC](https://discourse.julialang.org/t/why-is-julia-slowest-here/77479 "2022-03-06T19:47:20Z")

</div>

https://github.com/niklas-heer/speed-comparison I tried to convince my friend that Julia is faster than python, he googled it and found this(above), why is it that python is faster than Julia, and even JS. Is it somethi…

---

## [Confusing julia behavior. @everywhere macro changes the scope of local variables to global](https://discourse.julialang.org/t/confusing-julia-behavior-everywhere-macro-changes-the-scope-of-local-variables-to-global/77436)

<div class="topic-metadata">

**Author:** [@singularity](https://discourse.julialang.org/u/singularity)\
**Replies:** 5\
**Last updated:** [March 6, 2022, 7:18pm UTC](https://discourse.julialang.org/t/confusing-julia-behavior-everywhere-macro-changes-the-scope-of-local-variables-to-global/77436 "2022-03-06T19:18:03Z")

</div>

I just encountered a very confusing julia behavior. I always thought that variables defined inside a function remain local to that function. But in the following example, the scope changes. I define a simple function as…

---

## [Create named array in Julia](https://discourse.julialang.org/t/create-named-array-in-julia/77476)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 3\
**Last updated:** [March 6, 2022, 4:15pm UTC](https://discourse.julialang.org/t/create-named-array-in-julia/77476 "2022-03-06T16:15:29Z")

</div>

Hello, I am generating an array with some numeric parameters that then I pass to a function as: parms = \[1,2,3,4,5\] function x!(pt) μ, κ, δ, ω, η = p return( ((μ+κ)\*(δ+ω))^(1/η) ) end x(parms) It would be usef…

---

## [Measuring time of only a part of a for-loop](https://discourse.julialang.org/t/measuring-time-of-only-a-part-of-a-for-loop/77445)

<div class="topic-metadata">

**Author:** [@Handam](https://discourse.julialang.org/u/Handam)\
**Replies:** 4\
**Last updated:** [March 6, 2022, 7:07am UTC](https://discourse.julialang.org/t/measuring-time-of-only-a-part-of-a-for-loop/77445 "2022-03-06T07:07:13Z")

</div>

Hi, is there a way to the following: for i in 1:100 if i == 2 @time begin elseif i == 88 end end end Obviously this code does not work, but I think it makes it clear what I want to achieve: measuring the time t…

---

## [How to check if field in a structure has defined default value?](https://discourse.julialang.org/t/how-to-check-if-field-in-a-structure-has-defined-default-value/77449)

<div class="topic-metadata">

**Author:** [@sz1992](https://discourse.julialang.org/u/sz1992)\
**Replies:** 3\
**Last updated:** [March 6, 2022, 12:23am UTC](https://discourse.julialang.org/t/how-to-check-if-field-in-a-structure-has-defined-default-value/77449 "2022-03-06T00:23:24Z")

</div>

Hi, let’s take this structure Base.@kwdef mutable struct js1 name::String id::Int32 = 16 end Is there a way to check and find out that field id has default value? As an folow up question, is there a way to f…

---

## [Help with excessive, unpredictable GC time from string allocations](https://discourse.julialang.org/t/help-with-excessive-unpredictable-gc-time-from-string-allocations/77334)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 12\
**Last updated:** [March 5, 2022, 10:49pm UTC](https://discourse.julialang.org/t/help-with-excessive-unpredictable-gc-time-from-string-allocations/77334 "2022-03-05T22:49:24Z")

</div>

I’ve been having a hell of a time with some performance disasters when loading a large number of strings from a file. I am hitting this in my rewrite of a parquet reader and was caught rather by surprise, because despit…

---

## [Problem with the Tuple type](https://discourse.julialang.org/t/problem-with-the-tuple-type/77458)

<div class="topic-metadata">

**Author:** [@david16correa](https://discourse.julialang.org/u/david16correa)\
**Replies:** 4\
**Last updated:** [March 5, 2022, 9:31pm UTC](https://discourse.julialang.org/t/problem-with-the-tuple-type/77458 "2022-03-05T21:31:57Z")

</div>

Hi! I’m new to this forum, though not to Julia. I have a question. Recently I tried to build a function meant to accept as input only vectors of n-tuples (without specifying n). For example, consider the following: X …

---

## [Surface plots not respecting \`axis\` options in multiple plots](https://discourse.julialang.org/t/surface-plots-not-respecting-axis-options-in-multiple-plots/77448)

<div class="topic-metadata">

**Author:** [@amit1](https://discourse.julialang.org/u/amit1)\
**Replies:** 0\
**Last updated:** [March 5, 2022, 6:47pm UTC](https://discourse.julialang.org/t/surface-plots-not-respecting-axis-options-in-multiple-plots/77448 "2022-03-05T18:47:27Z")

</div>

Giving axis=(\[\], false) during multiple surface plots does not turn off the axis, as opposed to simple line plots, where it does. using Plots plotlyjs() xt = collect(-50:50) yt = collect(-50:50) p1t = surface(@. x^2 + …

---

## [Logging: symbol evaluation under the hood](https://discourse.julialang.org/t/logging-symbol-evaluation-under-the-hood/77399)

<div class="topic-metadata">

**Author:** [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Replies:** 4\
**Last updated:** [March 5, 2022, 6:56pm UTC](https://discourse.julialang.org/t/logging-symbol-evaluation-under-the-hood/77399 "2022-03-05T18:56:38Z")

</div>

Hey everyone, As mentioned in other posts, I’m working on a package called Term.jl that does a bunch of pretty terminal stuff like printing formatted error messages: One of the features I’d like to add is formatted …

---

## [Make Scatter Interpolation behave like Linear Interpolation?](https://discourse.julialang.org/t/make-scatter-interpolation-behave-like-linear-interpolation/77439)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 2\
**Last updated:** [March 5, 2022, 1:00pm UTC](https://discourse.julialang.org/t/make-scatter-interpolation-behave-like-linear-interpolation/77439 "2022-03-05T13:00:09Z")

</div>

Hi all! I have a very interesting Data set to interpolate and I need a bit of help. I have 5D knots and a Value that I need interpolated. The Columns are (just for you to know) Temperature Pressure Mineral\_%1 Mineral%2…

---

## [Initialising a Constructor with an Undef value](https://discourse.julialang.org/t/initialising-a-constructor-with-an-undef-value/77438)

<div class="topic-metadata">

**Author:** [@imantha](https://discourse.julialang.org/u/imantha)\
**Replies:** 1\
**Last updated:** [March 5, 2022, 8:06am UTC](https://discourse.julialang.org/t/initialising-a-constructor-with-an-undef-value/77438 "2022-03-05T08:06:13Z")

</div>

Hi, I have two Struts where one struct requires and object of the other as one of it’s fields. I am wondering how to initialise with an undef value of it. Here is an example mutable struct Casualty id::Int pos::Tupl…

---

## [How to use ForwardDiff?](https://discourse.julialang.org/t/how-to-use-forwarddiff/77434)

<div class="topic-metadata">

**Author:** [@samerb](https://discourse.julialang.org/u/samerb)\
**Replies:** 1\
**Last updated:** [March 5, 2022, 5:29am UTC](https://discourse.julialang.org/t/how-to-use-forwarddiff/77434 "2022-03-05T05:29:48Z")

</div>

I’m trying to learn how to use autodifferentiation for the first time since that came up in something else. What am I doing wrong? using ForwardDiff f(x) = 2x g = x -\> ForwardDiff.gradient(f, x) g(2) # DimensionMismatch…

---

## [Using ccall for C function with out-parameter pointer to pointer to struct](https://discourse.julialang.org/t/using-ccall-for-c-function-with-out-parameter-pointer-to-pointer-to-struct/50999)

<div class="topic-metadata">

**Author:** [@dmillard](https://discourse.julialang.org/u/dmillard)\
**Replies:** 4\
**Last updated:** [March 5, 2022, 12:50am UTC](https://discourse.julialang.org/t/using-ccall-for-c-function-with-out-parameter-pointer-to-pointer-to-struct/50999 "2022-03-05T00:50:35Z")

</div>

Hi, I’m wrapping libfreenect into Julia. The excellent BinaryBuilder maintainers have helped me get a jll into Yggdrasil, but now I’m working on a more Julian wrapper. One of the functions I’m wrapping takes a pointer t…

---

## [Using \`plotlyjs\` backend inside Pluto notebook](https://discourse.julialang.org/t/using-plotlyjs-backend-inside-pluto-notebook/77420)

<div class="topic-metadata">

**Author:** [@amit1](https://discourse.julialang.org/u/amit1)\
**Replies:** 2\
**Last updated:** [March 4, 2022, 8:10pm UTC](https://discourse.julialang.org/t/using-plotlyjs-backend-inside-pluto-notebook/77420 "2022-03-04T20:10:17Z")

</div>

I have a Pluto notebook that grew somewhat in size, and now I want to plot some data in it. If I give plotlyjs() backend selection command in notebook I get error saying PlutoJS could not be found in environment. Which, …

---

## [Dispatch on enum](https://discourse.julialang.org/t/dispatch-on-enum/77398)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 7\
**Last updated:** [March 4, 2022, 5:17pm UTC](https://discourse.julialang.org/t/dispatch-on-enum/77398 "2022-03-04T17:17:40Z")

</div>

Hey all :slight\_smile: Is it possible to dispatch a function on different enum instances. Something like this: julia\> @enum E a b julia\> f(::Type{a}) = :a julia\> f(::Type{b}) = :b julia\> f(a) :a

---

## [Convert Symbolics.jl expression to plottable function](https://discourse.julialang.org/t/convert-symbolics-jl-expression-to-plottable-function/77411)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 1\
**Last updated:** [March 4, 2022, 4:12pm UTC](https://discourse.julialang.org/t/convert-symbolics-jl-expression-to-plottable-function/77411 "2022-03-04T16:12:28Z")

</div>

The solution here isn’t working for me. I am getting “not a valid function argument name” error when trying to use built function. julia\> using Symbolics, UnicodePlots julia\> @variables a x b 3-element Vector{Num}: a …

---

## [Enforce interface implementation](https://discourse.julialang.org/t/enforce-interface-implementation/52872)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 26\
**Last updated:** [March 4, 2022, 3:01pm UTC](https://discourse.julialang.org/t/enforce-interface-implementation/52872 "2022-03-04T15:01:22Z")

</div>

I’m trying to refactor GenericInstruments.jl in order to play nicer with instrument front panels GUIs for our online university labs. The problem is the following: different instruments keep popping up and the code need…

---

## [VS Code constant pain point](https://discourse.julialang.org/t/vs-code-constant-pain-point/77388)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 5\
**Last updated:** [March 4, 2022, 2:43pm UTC](https://discourse.julialang.org/t/vs-code-constant-pain-point/77388 "2022-03-04T14:43:19Z")

</div>

I like a lot of things about Julia in VS Code, but one thing where it constantly falls short is lookup of symbols defined in user packages. Standard-library code is fine but the user code is always a problem As th…

---

## [GPU performance evaluation exceeds target peakflop using CUDA.jl](https://discourse.julialang.org/t/gpu-performance-evaluation-exceeds-target-peakflop-using-cuda-jl/59092)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 6\
**Last updated:** [March 4, 2022, 2:03pm UTC](https://discourse.julialang.org/t/gpu-performance-evaluation-exceeds-target-peakflop-using-cuda-jl/59092 "2022-03-04T14:03:12Z")

</div>

Hi, I use the following kernel (weirdly adding n\_{nin}\*(n\_{nin}-1)/2 to array elements) in order to evaluate the peak performance of my GPU : # CPU bound kernel for large enough values of nin function kernel\_compute\_bo…

---

## [Changing array values in place when embedding in C++](https://discourse.julialang.org/t/changing-array-values-in-place-when-embedding-in-c/77248)

<div class="topic-metadata">

**Author:** [@cloclo](https://discourse.julialang.org/u/cloclo)\
**Replies:** 4\
**Last updated:** [March 4, 2022, 1:52pm UTC](https://discourse.julialang.org/t/changing-array-values-in-place-when-embedding-in-c/77248 "2022-03-04T13:52:46Z")

</div>

Hello, I may be missing the obvious here, hopefully someone can point it out to me: when calling a custom julia function from C++ passing an array of doubles, the array values should be changed in place but is not. For…

---

## [Coverage and precompilation](https://discourse.julialang.org/t/coverage-and-precompilation/77324)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 6\
**Last updated:** [March 4, 2022, 12:46pm UTC](https://discourse.julialang.org/t/coverage-and-precompilation/77324 "2022-03-04T12:46:26Z")

</div>

Hi! When I add precompilation statements from SnoopCompile, I start to see weird coverage results. Take a look here: Everything seems fine when I remove those statements. I saw that this can be improved if I run Ju…

---

## [Best practice to use lots of pre-allocated arrays in a function](https://discourse.julialang.org/t/best-practice-to-use-lots-of-pre-allocated-arrays-in-a-function/77353)

<div class="topic-metadata">

**Author:** [@Iddingsite](https://discourse.julialang.org/u/Iddingsite)\
**Replies:** 7\
**Last updated:** [March 4, 2022, 12:32pm UTC](https://discourse.julialang.org/t/best-practice-to-use-lots-of-pre-allocated-arrays-in-a-function/77353 "2022-03-04T12:32:10Z")

</div>

I am still quite new to Julia, working on numerical modeling and I am starting to write a bigger project than usual. I have a function that takes, as arguments, lots of pre-allocated arrays and parameters and update the…

---

## [How to analyze the solution?](https://discourse.julialang.org/t/how-to-analyze-the-solution/77395)

<div class="topic-metadata">

**Author:** [@egor](https://discourse.julialang.org/u/egor)\
**Replies:** 1\
**Last updated:** [March 4, 2022, 11:07am UTC](https://discourse.julialang.org/t/how-to-analyze-the-solution/77395 "2022-03-04T11:07:31Z")

</div>

Hello everyone, I recently switched to julia from python and ran into a problem. I solve a parameterized system: Γ(x, λ, Θ) = 1 / (1 + exp(-λ\*(x - Θ))) function parametrized\_2hr!(du, u, p, t) a = p\[1\]; b = p\[2\]; c…

---

## [ArgumentError: no outer repetition count may be negative; got (-1,)](https://discourse.julialang.org/t/argumenterror-no-outer-repetition-count-may-be-negative-got-1/77384)

<div class="topic-metadata">

**Author:** [@bbokser](https://discourse.julialang.org/u/bbokser)\
**Replies:** 4\
**Last updated:** [March 4, 2022, 2:21am UTC](https://discourse.julialang.org/t/argumenterror-no-outer-repetition-count-may-be-negative-got-1/77384 "2022-03-04T02:21:25Z")

</div>

I have received the following error, and could not find any explanation for its meaning in Google search results. ArgumentError: no outer repetition count may be negative; got (-1,) Stacktrace: \[1\] check @ ./abstra…

---

## [Juno Error "Can't resolve version"](https://discourse.julialang.org/t/juno-error-cant-resolve-version/77373)

<div class="topic-metadata">

**Author:** [@Dustin\_Hess](https://discourse.julialang.org/u/Dustin_Hess)\
**Replies:** 7\
**Last updated:** [March 3, 2022, 10:44pm UTC](https://discourse.julialang.org/t/juno-error-cant-resolve-version/77373 "2022-03-03T22:44:08Z")

</div>

I am using Manjaro Gnome. I updated to Julia 1.7.2 for some reason this broke Juno. I have completely purged my system of all prior Julia versions and added Julia to my PATH even though pamac does this already. Any help …

---

## [How to upgrade code for a symmetric distance matrix from julia-1.0 to julia-1.6](https://discourse.julialang.org/t/how-to-upgrade-code-for-a-symmetric-distance-matrix-from-julia-1-0-to-julia-1-6/77302)

<div class="topic-metadata">

**Author:** [@jjdegruijter](https://discourse.julialang.org/u/jjdegruijter)\
**Replies:** 17\
**Last updated:** [March 3, 2022, 9:11pm UTC](https://discourse.julialang.org/t/how-to-upgrade-code-for-a-symmetric-distance-matrix-from-julia-1-0-to-julia-1-6/77302 "2022-03-03T21:11:04Z")

</div>

As part of my code for julia-1.6 I try to calculate an NxN symmetric ‘distance’ matrix, where ‘distance’ is a function of 4 vectors (extracted as columns from a DataFrame),and two parameters (‘R2’ and ‘range’). While th…

---

## [What are the options of hosting jupyter notebooks with Julia kernels?](https://discourse.julialang.org/t/what-are-the-options-of-hosting-jupyter-notebooks-with-julia-kernels/77332)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 1\
**Last updated:** [March 3, 2022, 8:48pm UTC](https://discourse.julialang.org/t/what-are-the-options-of-hosting-jupyter-notebooks-with-julia-kernels/77332 "2022-03-03T20:48:01Z")

</div>

I am teaching a Linear Algebra course now. To show students vectors in 3d-space, I created some interactive 3D plots with Julia and jupyter notebooks. I wonder if there is a way that I can host the notebooks so my studen…

---

## [Error EBUSY on saving JLD2 file using Julia-1.3.0-rc2](https://discourse.julialang.org/t/error-ebusy-on-saving-jld2-file-using-julia-1-3-0-rc2/29228)

<div class="topic-metadata">

**Author:** [@alkoedl](https://discourse.julialang.org/u/alkoedl)\
**Replies:** 13\
**Last updated:** [March 3, 2022, 7:07pm UTC](https://discourse.julialang.org/t/error-ebusy-on-saving-jld2-file-using-julia-1-3-0-rc2/29228 "2022-03-03T19:07:23Z")

</div>

I’m getting the following error when trying to save a file in JLD2 format on Julia-1.3.0-rc2: $ C:/Users/blabla/AppData/Local/Julia-1.3.0-rc2/bin/julia.exe \[ Info: loading C:\\Users\\blabla\\.julia\\config\\startup.jl …

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

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