# General Usage

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

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

**Page:** 343

---

## [LibSSL Undefined Symbol error when installing Genie Builder](https://discourse.julialang.org/t/libssl-undefined-symbol-error-when-installing-genie-builder/92637)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 4\
**Last updated:** [January 17, 2023, 2:04am UTC](https://discourse.julialang.org/t/libssl-undefined-symbol-error-when-installing-genie-builder/92637 "2023-01-17T02:04:52Z")

</div>

I am trying to install the Genie web framework and use the Genie Builder extension in VSCode. But I am hitting an error, and I can’t quite tell if it is a Genie issue or a more generic Julia issue. The core of the error …

---

## [Tuple with conditional entries](https://discourse.julialang.org/t/tuple-with-conditional-entries/93052)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 3\
**Last updated:** [January 17, 2023, 2:02am UTC](https://discourse.julialang.org/t/tuple-with-conditional-entries/93052 "2023-01-17T02:02:39Z")

</div>

Is it possible create a tuple with the existence of entries conditioned on some variables? I.e. what I want is something like mytuple = (42 if condition1, pi condition2 ) # == (42, pi) if condition1 and condition2 are …

---

## [How to onehot encode batches of sequences?](https://discourse.julialang.org/t/how-to-onehot-encode-batches-of-sequences/33237)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 2\
**Last updated:** [January 17, 2023, 12:37am UTC](https://discourse.julialang.org/t/how-to-onehot-encode-batches-of-sequences/33237 "2023-01-17T00:37:40Z")

</div>

Is there a recommended way to one-hot encode a batch of sequences? More precisely, I am modelling sequences from an alphabet with q letters. A sequence of length N can be one-hot encoded as a q x N one-hot matrix (e.g.,…

---

## [Constant propagation of function of type](https://discourse.julialang.org/t/constant-propagation-of-function-of-type/92963)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 3\
**Last updated:** [January 16, 2023, 11:34pm UTC](https://discourse.julialang.org/t/constant-propagation-of-function-of-type/92963 "2023-01-16T23:34:58Z")

</div>

Suppose I have a function function f(args...) X = g(typeof(args)) # do stuff with X and args.. end The function g is fairly complicated (performs a recursive walk of a tuple type-type), but ultimately it is p…

---

## [State of Diffractor.jl](https://discourse.julialang.org/t/state-of-diffractor-jl/92959)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 4\
**Last updated:** [January 16, 2023, 7:27pm UTC](https://discourse.julialang.org/t/state-of-diffractor-jl/92959 "2023-01-16T19:27:40Z")

</div>

Hello everyone, does someone know whats the state of Diffractor.jl is? I saw many posts from 2021, saying that it would be soon avaible. The current versioin of Diffractor.jl in the repo has a julia version depencey of…

---

## [Random memory access performance - how to hint compiler/runtime to preload/cache/plan](https://discourse.julialang.org/t/random-memory-access-performance-how-to-hint-compiler-runtime-to-preload-cache-plan/93046)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 0\
**Last updated:** [January 16, 2023, 8:04pm UTC](https://discourse.julialang.org/t/random-memory-access-performance-how-to-hint-compiler-runtime-to-preload-cache-plan/93046 "2023-01-16T20:04:42Z")

</div>

Hi, I have some constant size matrices (so I use StaticArrays package, verified it’s faster than Array/Vector) which I access many times randomly in a loop. After random reads/writes, I need to copy a part of one array…

---

## [Gradient calculation in PINN](https://discourse.julialang.org/t/gradient-calculation-in-pinn/61525)

<div class="topic-metadata">

**Author:** [@JunichiFukui](https://discourse.julialang.org/u/JunichiFukui)\
**Replies:** 5\
**Last updated:** [January 16, 2023, 6:02pm UTC](https://discourse.julialang.org/t/gradient-calculation-in-pinn/61525 "2023-01-16T18:02:50Z")

</div>

Hi, everyone, I am trying to build a Physics Informed Neural Network (PINN) for solving the Navier-Stokes equations like NVidia SimNet using Flux. The input of the neural network is the position X\_i, Y\_i, Z\_i of each po…

---

## [How to get username?](https://discourse.julialang.org/t/how-to-get-username/93023)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 6\
**Last updated:** [January 16, 2023, 2:52pm UTC](https://discourse.julialang.org/t/how-to-get-username/93023 "2023-01-16T14:52:02Z")

</div>

How do I get the username of the user running the julia process? On Linux I can do ENV\["USER"\] and on Windows: ENV\["USERNAME"\] But I don’t know what to do on other operating systems. What is the os-independent way …

---

## [Code obfuscation | Using the \`--strip-ir\` option in PackageCompiler.jl](https://discourse.julialang.org/t/code-obfuscation-using-the-strip-ir-option-in-packagecompiler-jl/91426)

<div class="topic-metadata">

**Author:** [@hayk](https://discourse.julialang.org/u/hayk)\
**Replies:** 2\
**Last updated:** [January 16, 2023, 2:09pm UTC](https://discourse.julialang.org/t/code-obfuscation-using-the-strip-ir-option-in-packagecompiler-jl/91426 "2023-01-16T14:09:24Z")

</div>

I would like to distribute my package while hiding the source code. I came across PackageCompiler.jl and julia’s --strip-ir option to help, but when I load a sysimage generated using that option, I get an error that some…

---

## [Reading DataFrames from JLD2 files](https://discourse.julialang.org/t/reading-dataframes-from-jld2-files/88543)

<div class="topic-metadata">

**Author:** [@ehsani63](https://discourse.julialang.org/u/ehsani63)\
**Replies:** 9\
**Last updated:** [January 16, 2023, 12:58pm UTC](https://discourse.julialang.org/t/reading-dataframes-from-jld2-files/88543 "2023-01-16T12:58:00Z")

</div>

The results of my simulations are saved as DataFrames in JLD2 files: struct Sim params::Dict adf::DataFrame model::ABM end # Running simulations and generating results... ... sim = Sim(d, adf, model) # con…

---

## [QuadGK Computation Question](https://discourse.julialang.org/t/quadgk-computation-question/92983)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 8\
**Last updated:** [January 16, 2023, 12:01pm UTC](https://discourse.julialang.org/t/quadgk-computation-question/92983 "2023-01-16T12:01:27Z")

</div>

Hi all, I have tried QuadGK, but the result is not the same as the solution manual. Is there a problem in between? this is my code: using SymPy, QuadGK x = symbols("x") f(x) = (x^6 + 2)/(8x^2) # simplify(diff(f(x),…

---

## [How to dispatch on a Tuple with unknown length, but elements have same abstract type?](https://discourse.julialang.org/t/how-to-dispatch-on-a-tuple-with-unknown-length-but-elements-have-same-abstract-type/93017)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 4\
**Last updated:** [January 16, 2023, 11:42am UTC](https://discourse.julialang.org/t/how-to-dispatch-on-a-tuple-with-unknown-length-but-elements-have-same-abstract-type/93017 "2023-01-16T11:42:33Z")

</div>

Consider this example: a = (complex(1,2), complex(1.0, 2.0)) The length of a is not fixed to 2, but could be arbitrary. Is there a way to dispatch on this? I tried a isa NTuple{N, \<: Complex} where N but this is ob…

---

## [Help to track down a type instability](https://discourse.julialang.org/t/help-to-track-down-a-type-instability/92970)

<div class="topic-metadata">

**Author:** [@vlc](https://discourse.julialang.org/u/vlc)\
**Replies:** 5\
**Last updated:** [January 16, 2023, 9:52am UTC](https://discourse.julialang.org/t/help-to-track-down-a-type-instability/92970 "2023-01-16T09:52:07Z")

</div>

Hi there, I have a piece of code that is sometimes type-stable, sometimes not, and can’t understand why… I’ve been scratching my head on this for a while, a fresh look would be very much appreciated… I’ve boiled it dow…

---

## [Not possible to "share" top-level variables during precompilation?](https://discourse.julialang.org/t/not-possible-to-share-top-level-variables-during-precompilation/92973)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 2\
**Last updated:** [January 16, 2023, 4:34am UTC](https://discourse.julialang.org/t/not-possible-to-share-top-level-variables-during-precompilation/92973 "2023-01-16T04:34:50Z")

</div>

I noticed the following behavior I’m trying to understand if its intentional, a bug, or could be changed. It seems obscure but has kind of come up as I’m trying to make Memoization.jl more precompile-friendly. On 1.9-bet…

---

## [Problem with stiff ODE solved by Julia](https://discourse.julialang.org/t/problem-with-stiff-ode-solved-by-julia/92980)

<div class="topic-metadata">

**Author:** [@liao2877104858](https://discourse.julialang.org/u/liao2877104858)\
**Replies:** 6\
**Last updated:** [January 16, 2023, 3:29am UTC](https://discourse.julialang.org/t/problem-with-stiff-ode-solved-by-julia/92980 "2023-01-16T03:29:26Z")

</div>

There’s an ODE to be solved. It’s a chemical reaction system. There is 863 reactions and 230 species. The system is quite stiff and large. So I ues some algorithms advised by Solving Large Stiff Equations · DifferentialE…

---

## [Looking for use cases of Julia in computational and data science research with astrophysics focus](https://discourse.julialang.org/t/looking-for-use-cases-of-julia-in-computational-and-data-science-research-with-astrophysics-focus/92257)

<div class="topic-metadata">

**Author:** [@brookluo](https://discourse.julialang.org/u/brookluo)\
**Replies:** 10\
**Last updated:** [January 15, 2023, 9:51pm UTC](https://discourse.julialang.org/t/looking-for-use-cases-of-julia-in-computational-and-data-science-research-with-astrophysics-focus/92257 "2023-01-15T21:51:43Z")

</div>

Hi all, I am a PhD student studying astrophysics. I am very interested in Julia and have been using it in some side projects on computational and data science. I hope to use Julia in astronomy research so I would apprec…

---

## [Vector type-recipe plotting in Julia](https://discourse.julialang.org/t/vector-type-recipe-plotting-in-julia/92986)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 7:22pm UTC](https://discourse.julialang.org/t/vector-type-recipe-plotting-in-julia/92986 "2023-01-15T19:22:22Z")

</div>

I saw this question on stackoverflow. And I also have the same question: Could we define plot for one data point and it automatically works for an Array of it? IIs there a way to write a plotting type recipe for a type T…

---

## [Difficulty in understanding Error from Zygote](https://discourse.julialang.org/t/difficulty-in-understanding-error-from-zygote/92968)

<div class="topic-metadata">

**Author:** [@Gattu\_Mytraya](https://discourse.julialang.org/u/Gattu_Mytraya)\
**Replies:** 2\
**Last updated:** [January 15, 2023, 7:42pm UTC](https://discourse.julialang.org/t/difficulty-in-understanding-error-from-zygote/92968 "2023-01-15T19:42:52Z")

</div>

I’m trying to write a custom adjoint for a function given below: function factor\_divide(poly::Vector{ComplexF64}, α::ComplexF64, p::Int64) quotient\_deg::Int64 = size(poly,1) - p - 1 quotient::Vector{ComplexF64} …

---

## [Franklin.jl file tree in navigation bar](https://discourse.julialang.org/t/franklin-jl-file-tree-in-navigation-bar/92996)

<div class="topic-metadata">

**Author:** [@Antomek](https://discourse.julialang.org/u/Antomek)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 6:37pm UTC](https://discourse.julialang.org/t/franklin-jl-file-tree-in-navigation-bar/92996 "2023-01-15T18:37:13Z")

</div>

Hello everyone, I am trying to build a website with Franklin.jl. One of the elements I would like to have on the website is a wiki, with all of the posts being markdown files in a certain file structure, e.g. wiki/wik…

---

## [Precompilation failure caused by package dependency version](https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995)

<div class="topic-metadata">

**Author:** [@Rex\_Wang](https://discourse.julialang.org/u/Rex_Wang)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 5:10pm UTC](https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995 "2023-01-15T17:10:08Z")

</div>

I am trying to install two packages ClimeTools and MultivariateStats. The former requires version 0.32.2 of the package StatsBase while the latter requires 0.33.21. This results in a conflict and prevents me from success…

---

## [SymPy Simplify Took too Long for Area of Surface Revolution of a sphere](https://discourse.julialang.org/t/sympy-simplify-took-too-long-for-area-of-surface-revolution-of-a-sphere/92988)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [January 15, 2023, 3:06pm UTC](https://discourse.julialang.org/t/sympy-simplify-took-too-long-for-area-of-surface-revolution-of-a-sphere/92988 "2023-01-15T15:06:08Z")

</div>

Hi all, I want to calculate symbolically area of a surface of a sphere. y = f(x) = \\sqrt{r^{2} - x^{2}} with -r \\le x \\le r this is my code: using SymPy x, r = symbols("x r") f(x) = sqrt(r^2 - x^2) # simplify(diff(…

---

## [Unexpected comma in array expression Stacktrace:](https://discourse.julialang.org/t/unexpected-comma-in-array-expression-stacktrace/92993)

<div class="topic-metadata">

**Author:** [@priyanshujiiii](https://discourse.julialang.org/u/priyanshujiiii)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 2:02pm UTC](https://discourse.julialang.org/t/unexpected-comma-in-array-expression-stacktrace/92993 "2023-01-15T14:02:47Z")

</div>

---

## [How to efficiently split StaticArrays into columns?](https://discourse.julialang.org/t/how-to-efficiently-split-staticarrays-into-columns/92990)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [January 15, 2023, 1:35pm UTC](https://discourse.julialang.org/t/how-to-efficiently-split-staticarrays-into-columns/92990 "2023-01-15T13:35:47Z")

</div>

Hi! Suppose I have: using StaticArrays Values = rand(SVector{3,Float64},10^6) I know that I can split this into components as such: ValuesX = getindex.(Values,1) @benchmark getindex.($Values,1) BenchmarkTools.Tria…

---

## [Sankey Diagram in JULIA](https://discourse.julialang.org/t/sankey-diagram-in-julia/92884)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 8\
**Last updated:** [January 15, 2023, 10:10am UTC](https://discourse.julialang.org/t/sankey-diagram-in-julia/92884 "2023-01-15T10:10:34Z")

</div>

How to create Sankey Diagram in JULIA ? Is there any working package completely in Julia ? JuliaHub this is not working properly .    ~  julia  ✔ …

---

## [What is the usage of "type recipes" in RecipesBase.jl & Plots.jl?](https://discourse.julialang.org/t/what-is-the-usage-of-type-recipes-in-recipesbase-jl-plots-jl/92985)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 7:58am UTC](https://discourse.julialang.org/t/what-is-the-usage-of-type-recipes-in-recipesbase-jl-plots-jl/92985 "2023-01-15T07:58:30Z")

</div>

The signature of a normal recipe looks like @recipe function f(data::AbstractArray{MyType}) And the “type recipes”'s signature look like: @recipe f(::Type{MyWrapper}, mw::MyWrapper) = mw.v What is the difference? Why…

---

## [How to tell if code is being run in global scope?](https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982)

<div class="topic-metadata">

**Author:** [@Jollywatt](https://discourse.julialang.org/u/Jollywatt)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 6:13am UTC](https://discourse.julialang.org/t/how-to-tell-if-code-is-being-run-in-global-scope/92982 "2023-01-15T06:13:25Z")

</div>

How do you tell if code is being evaluated at top-level, or directly into the REPL? I have a macro that defines some variables in the current scope. For example: macro defs(n) assignments = \[:($(esc(Symbol("x$i"))) = …

---

## [Is there a way to ask Pkg for a package's download URL?](https://discourse.julialang.org/t/is-there-a-way-to-ask-pkg-for-a-packages-download-url/92686)

<div class="topic-metadata">

**Author:** [@SamuraiAku](https://discourse.julialang.org/u/SamuraiAku)\
**Replies:** 2\
**Last updated:** [January 15, 2023, 4:45am UTC](https://discourse.julialang.org/t/is-there-a-way-to-ask-pkg-for-a-packages-download-url/92686 "2023-01-15T04:45:37Z")

</div>

The use case for this question is when one must submit a FOSS review ticket to your IT organization. One essential field is the URL that Pkg uses to download the package. The organization then downloads the source code …

---

## [How to define a nested type?](https://discourse.julialang.org/t/how-to-define-a-nested-type/92978)

<div class="topic-metadata">

**Author:** [@wangyunyueyueniao](https://discourse.julialang.org/u/wangyunyueyueniao)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 2:45am UTC](https://discourse.julialang.org/t/how-to-define-a-nested-type/92978 "2023-01-15T02:45:27Z")

</div>

For example: a nested dict with unknown depth. Tree=Dict{Char,Union{Dict{Char,...},Int}} I have tried this: Tree=Dict{Char,Union{Tree,Int}} But it gives “UndefVarError: Tree not defined” (I want to use this tree to …

---

## [It work, \`global VAR = include("global\_var.jl")\` but is it correct?](https://discourse.julialang.org/t/it-work-global-var-include-global-var-jl-but-is-it-correct/92972)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 1\
**Last updated:** [January 15, 2023, 2:34am UTC](https://discourse.julialang.org/t/it-work-global-var-include-global-var-jl-but-is-it-correct/92972 "2023-01-15T02:34:58Z")

</div>

\# global\_var.jl : \[ 1, 2, 3, # ... \] global VAR = include("global\_var.jl") it work, but is it correct ?

---

## [Get the decimal part of a number](https://discourse.julialang.org/t/get-the-decimal-part-of-a-number/78282)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 7\
**Last updated:** [January 15, 2023, 2:14am UTC](https://discourse.julialang.org/t/get-the-decimal-part-of-a-number/78282 "2023-01-15T02:14:07Z")

</div>

Is there a function in Base Julia to get the decimal part of a number? I feel like I’ve seen that function before, but now I can’t find it. For example, I would like the following: julia\> x = 12.345; julia\> foo(x) 0.34…

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

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