# General Usage

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

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

**Page:** 645

---

## [Trouble getting started with Dierckx 2D Spline](https://discourse.julialang.org/t/trouble-getting-started-with-dierckx-2d-spline/54995)

<div class="topic-metadata">

**Author:** [@natemcintosh](https://discourse.julialang.org/u/natemcintosh)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 10:02pm UTC](https://discourse.julialang.org/t/trouble-getting-started-with-dierckx-2d-spline/54995 "2021-02-10T22:02:42Z")

</div>

Background Looking at the documentation for creating 2D splines, Spline2D(x, y, z; w=ones(length(x)), kx=3, ky=3, s=0.0) Spline2D(x, y, z; kx=3, ky=3, s=0.0) Fit a 2-d spline to the input data. x and y must be 1-d arr…

---

## [Is this the best way to convert a NUL terminated C-string into a Julia \`String\`?](https://discourse.julialang.org/t/is-this-the-best-way-to-convert-a-nul-terminated-c-string-into-a-julia-string/55037)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 11, 2021, 2:25am UTC](https://discourse.julialang.org/t/is-this-the-best-way-to-convert-a-nul-terminated-c-string-into-a-julia-string/55037 "2021-02-11T02:25:19Z")

</div>

Is this the best way to convert a NUL terminated C-string into a Julia String? julia\> typeof(text) Array{UInt8,1} julia\> unsafe\_string(pointer(text)) "C14120-20P" Note that the original poster on Slack cannot see your…

---

## [How to Best Store and Access Credentials in Julia?](https://discourse.julialang.org/t/how-to-best-store-and-access-credentials-in-julia/54997)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 13\
**Last updated:** [February 11, 2021, 12:30pm UTC](https://discourse.julialang.org/t/how-to-best-store-and-access-credentials-in-julia/54997 "2021-02-11T12:30:09Z")

</div>

Hi all, I was recently stumped by something: Suppose I have some credentials I need to store to access a SQL DB. How should I best store these credentials for Julia to easily access? My current pattern is to use a com…

---

## [How do I load an image from an array](https://discourse.julialang.org/t/how-do-i-load-an-image-from-an-array/24382)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 6\
**Last updated:** [February 11, 2021, 11:27am UTC](https://discourse.julialang.org/t/how-do-i-load-an-image-from-an-array/24382 "2021-02-11T11:27:12Z")

</div>

I have a JPEG encoded image that I loaded from the web using HTTP.get. How do I decode it using FileIO.load? I would like to know both how to deal with data in an array instead of in the file system, and whether there’s…

---

## [What's the right way to unwrap a \`TaskFailedException\`?](https://discourse.julialang.org/t/whats-the-right-way-to-unwrap-a-taskfailedexception/55052)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 7\
**Last updated:** [February 11, 2021, 10:42am UTC](https://discourse.julialang.org/t/whats-the-right-way-to-unwrap-a-taskfailedexception/55052 "2021-02-11T10:42:25Z")

</div>

What’s the right way to unwrap a TaskFailedException? err.task.exception.task.exception gives me the original exception, but that seems very brittle. Note that the original poster on Slack cannot see your response here …

---

## [Abstract-type field in struct for solving an ODE problem](https://discourse.julialang.org/t/abstract-type-field-in-struct-for-solving-an-ode-problem/55050)

<div class="topic-metadata">

**Author:** [@hopeso](https://discourse.julialang.org/u/hopeso)\
**Replies:** 1\
**Last updated:** [February 11, 2021, 10:06am UTC](https://discourse.julialang.org/t/abstract-type-field-in-struct-for-solving-an-ode-problem/55050 "2021-02-11T10:06:47Z")

</div>

Hi, I’m learning Julia and particularly interested in solving differential equations using the DifferentialEquations package. I’m having a trouble with understanding how to make a good type-stable struct that is integrat…

---

## [Anyone know how to do broadcasting on a function with a non-iterable argument? i.e](https://discourse.julialang.org/t/anyone-know-how-to-do-broadcasting-on-a-function-with-a-non-iterable-argument-i-e/55051)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 11, 2021, 9:49am UTC](https://discourse.julialang.org/t/anyone-know-how-to-do-broadcasting-on-a-function-with-a-non-iterable-argument-i-e/55051 "2021-02-11T09:49:19Z")

</div>

anyone know how to do broadcasting on a function with a non-iterable argument? i.e. f(x,p) = x\*p.val where p is a struct with a single value val . Thus, the desired result would be broadcasting over x and multiplying eve…

---

## [Invalidation checker for packages \[code snippet\]](https://discourse.julialang.org/t/invalidation-checker-for-packages-code-snippet/54976)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 0\
**Last updated:** [February 10, 2021, 10:02am UTC](https://discourse.julialang.org/t/invalidation-checker-for-packages-code-snippet/54976 "2021-02-10T10:02:29Z")

</div>

Hey, I just wanted to share this code snippet which can be helpful to find where the imported invalidation comes from. using SnoopCompileCore using SnoopCompile using SnoopCompile: countchildren using Pkg using Printf …

---

## [Set\_indexing\_prop!() in MetaGraph gives an error](https://discourse.julialang.org/t/set-indexing-prop-in-metagraph-gives-an-error/54912)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 1\
**Last updated:** [February 11, 2021, 6:45am UTC](https://discourse.julialang.org/t/set-indexing-prop-in-metagraph-gives-an-error/54912 "2021-02-11T06:45:06Z")

</div>

Hi, I am testing the ability to use MetaGraph to filter through a graph. context: node 1 is the table which I want to metaindex with the type : “Source”. This seems to work fine until I want to set the index (linenum…

---

## [Can I run an external audio player program from Julia? Or simply playback a sterio .wav file?](https://discourse.julialang.org/t/can-i-run-an-external-audio-player-program-from-julia-or-simply-playback-a-sterio-wav-file/54964)

<div class="topic-metadata">

**Author:** [@bionicinnovations1](https://discourse.julialang.org/u/bionicinnovations1)\
**Replies:** 5\
**Last updated:** [February 10, 2021, 10:42pm UTC](https://discourse.julialang.org/t/can-i-run-an-external-audio-player-program-from-julia-or-simply-playback-a-sterio-wav-file/54964 "2021-02-10T22:42:23Z")

</div>

I am trying to play a wav file (in stereo) with my sound card (Windows 10), and haven’t been able to work it so far. WAV.jl doesn’t support playback in Windows, and I can’t seem to work out how to get it working in Port…

---

## [I can use \`getfield(Module, :functionname)\` to grab a variable in \`Module\`, e.g. \`](https://discourse.julialang.org/t/i-can-use-getfield-module-functionname-to-grab-a-variable-in-module-e-g/55029)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 10:29pm UTC](https://discourse.julialang.org/t/i-can-use-getfield-module-functionname-to-grab-a-variable-in-module-e-g/55029 "2021-02-10T22:29:14Z")

</div>

I can use getfield(Module, :functionname) to grab a variable in Module, e.g. Main: but can I do the same for a local variable in a function? Note that the original poster on Slack cannot see your response here on Discou…

---

## [Help with package documentation](https://discourse.julialang.org/t/help-with-package-documentation/54423)

<div class="topic-metadata">

**Author:** [@apoor](https://discourse.julialang.org/u/apoor)\
**Replies:** 9\
**Last updated:** [February 10, 2021, 9:41pm UTC](https://discourse.julialang.org/t/help-with-package-documentation/54423 "2021-02-10T21:41:59Z")

</div>

I’m working on developing my first Julia package called FeatureEng – for feature engineering – and I’m having trouble working with Documenter.jl. https://github.com/a-poor/FeatureEng.jl I have a github workflow that bu…

---

## [Trouble with passing arguments to KrylovKit.eigsolve](https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 9:10pm UTC](https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025 "2021-02-10T21:10:15Z")

</div>

I am trying to follow the instructions for the eigenvalue solver in the KrylovKit package but even the simplest of instructions they have provided throw an error. I am confounded that instructions to even the simplest of…

---

## [Hello!, I'm currently trying to merge a set of asset returns from a CSV file, we h](https://discourse.julialang.org/t/hello-im-currently-trying-to-merge-a-set-of-asset-returns-from-a-csv-file-we-h/55022)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 9:00pm UTC](https://discourse.julialang.org/t/hello-im-currently-trying-to-merge-a-set-of-asset-returns-from-a-csv-file-we-h/55022 "2021-02-10T21:00:41Z")

</div>

Hello!, I’m currently trying to merge a set of asset returns from a CSV file, we have two assets and I have got them into a dataframe along with the timestamp, as follows Row │ timestamp brka brkb │ Date…

---

## [Display() of an Array type showing unwanted info](https://discourse.julialang.org/t/display-of-an-array-type-showing-unwanted-info/55016)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 2\
**Last updated:** [February 10, 2021, 8:43pm UTC](https://discourse.julialang.org/t/display-of-an-array-type-showing-unwanted-info/55016 "2021-02-10T20:43:28Z")

</div>

Hello Here is a snippet that illustrates my problem: const Asn = Array{Tuple{String,Int64},1} Base.summary(io::IO, x::Asn) = print(io, \*(\[s\[1\] for s in x\]...), " = ", \*(\[s\[2\] for s in x\]...)) Base.show(io::IO, x::…

---

## [Problem on benchmarking multi-thread code](https://discourse.julialang.org/t/problem-on-benchmarking-multi-thread-code/55021)

<div class="topic-metadata">

**Author:** [@ykkan](https://discourse.julialang.org/u/ykkan)\
**Replies:** 3\
**Last updated:** [February 10, 2021, 8:27pm UTC](https://discourse.julialang.org/t/problem-on-benchmarking-multi-thread-code/55021 "2021-02-10T20:27:01Z")

</div>

Hello, I am trying to benchmark function with thread parallelization and compare the result with non-parallelized version of function. using Base.Threads nx = 10000 a = zeros(nx) b = rand(nx) dindicies = 2:(nx-1) fun…

---

## [Storing big data file for fast access?](https://discourse.julialang.org/t/storing-big-data-file-for-fast-access/54992)

<div class="topic-metadata">

**Author:** [@mihrits](https://discourse.julialang.org/u/mihrits)\
**Replies:** 8\
**Last updated:** [February 10, 2021, 7:31pm UTC](https://discourse.julialang.org/t/storing-big-data-file-for-fast-access/54992 "2021-02-10T19:31:15Z")

</div>

I have a somewhat big .txt data file (~70 MB, ~1M lines, ~30 columns) that I plan to study during the next few months. Data are mostly floats, but also strings and integers. And I’ll probably work with more files like th…

---

## [Is there an efficient way to associate a value with a parameterized type.For exa](https://discourse.julialang.org/t/is-there-an-efficient-way-to-associate-a-value-with-a-parameterized-type-for-exa/54940)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 5:49pm UTC](https://discourse.julialang.org/t/is-there-an-efficient-way-to-associate-a-value-with-a-parameterized-type-for-exa/54940 "2021-02-10T17:49:14Z")

</div>

Is there an efficient way to associate a value with a parameterized type. For example: struct GaloisField{p,r}; val::Int end +(a::G, b::G} where G&lt;:GaloisField = addop(a.val, b.val, logtable(G)) Memoization of lo…

---

## [Is this a valid way of evaluating string of code in local scope?](https://discourse.julialang.org/t/is-this-a-valid-way-of-evaluating-string-of-code-in-local-scope/54996)

<div class="topic-metadata">

**Author:** [@calebwin](https://discourse.julialang.org/u/calebwin)\
**Replies:** 6\
**Last updated:** [February 10, 2021, 5:21pm UTC](https://discourse.julialang.org/t/is-this-a-valid-way-of-evaluating-string-of-code-in-local-scope/54996 "2021-02-10T17:21:34Z")

</div>

From what I’ve read and observed, it seems like there isn’t a way of eval-ing code in local scope or otherwise without incurring significant performance penalty (lots of extra memory allocations and significantly longer …

---

## [Is there a way to implicitly convert two variables with the same \*intrinsic type\*](https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 4:14pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-implicitly-convert-two-variables-with-the-same-intrinsic-type/55006 "2021-02-10T16:14:08Z")

</div>

Is there a way to implicitly convert two variables with the same intrinsic type but coming from different modules? see below for example LoadError: MethodError: no method matching synthetise\_schedule(::Array{Main.Schedu…

---

## [Only make compilation of a script](https://discourse.julialang.org/t/only-make-compilation-of-a-script/55001)

<div class="topic-metadata">

**Author:** [@Ludsrill](https://discourse.julialang.org/u/Ludsrill)\
**Replies:** 4\
**Last updated:** [February 10, 2021, 4:51pm UTC](https://discourse.julialang.org/t/only-make-compilation-of-a-script/55001 "2021-02-10T16:51:29Z")

</div>

I only want to know if it’s possible to make a compilation for a script without running the script if it’s possible, how can I do it?

---

## [Installation path and environment variables](https://discourse.julialang.org/t/installation-path-and-environment-variables/54980)

<div class="topic-metadata">

**Author:** [@otto\_bay](https://discourse.julialang.org/u/otto_bay)\
**Replies:** 3\
**Last updated:** [February 10, 2021, 4:22pm UTC](https://discourse.julialang.org/t/installation-path-and-environment-variables/54980 "2021-02-10T16:22:45Z")

</div>

hello, Apologies in advance for the newbie questions: I am new to Julia… I have installed Julia, Atom and Juno and everything seemed to work well to start with. Sadly the .atom and the .julia were created (without ask…

---

## [ScatterNNlib: array mutation not supported](https://discourse.julialang.org/t/scatternnlib-array-mutation-not-supported/55004)

<div class="topic-metadata">

**Author:** [@DeepQ](https://discourse.julialang.org/u/DeepQ)\
**Replies:** 0\
**Last updated:** [February 10, 2021, 3:44pm UTC](https://discourse.julialang.org/t/scatternnlib-array-mutation-not-supported/55004 "2021-02-10T15:44:32Z")

</div>

I know that Zygote.jl doesn’t support array mutation. I tried to use ScatterNNlib.gather but It shows array mutation error: using Flux using ScatterNNlib f(x) = gather(x, \[1 3; 4 2\], 2) gradient(x -\> f(x), rand(4,4)) L…

---

## [Loglogistic function robustness in Turing.jl](https://discourse.julialang.org/t/loglogistic-function-robustness-in-turing-jl/54908)

<div class="topic-metadata">

**Author:** [@virgile-baudrot](https://discourse.julialang.org/u/virgile-baudrot)\
**Replies:** 4\
**Last updated:** [February 10, 2021, 2:27pm UTC](https://discourse.julialang.org/t/loglogistic-function-robustness-in-turing-jl/54908 "2021-02-10T14:27:29Z")

</div>

I realized in a Turing.jl model that the log-logistic function was more robust (less rejection) when written as: x^β/(α^β + x^β) rather than: 1/(1+(x/α)^-β) What are the reason? How could I check the robustness of su…

---

## [Could not apply vbox in AbstractPlotting](https://discourse.julialang.org/t/could-not-apply-vbox-in-abstractplotting/54975)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 1:37pm UTC](https://discourse.julialang.org/t/could-not-apply-vbox-in-abstractplotting/54975 "2021-02-10T13:37:28Z")

</div>

using GLMakie using CairoMakie using AbstractPlotting CairoMakie.activate!() AbstractPlotting.inline!(true) All above packages are up to date. Running the following example: t = range(0, stop = 1, length = 100) θ = …

---

## [Julia 1.6.0-rc2 (and 1.7 and rc1) with threads is slower - considerations for the Benchmark Game](https://discourse.julialang.org/t/julia-1-6-0-rc2-and-1-7-and-rc1-with-threads-is-slower-considerations-for-the-benchmark-game/54957)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [February 10, 2021, 12:04pm UTC](https://discourse.julialang.org/t/julia-1-6-0-rc2-and-1-7-and-rc1-with-threads-is-slower-considerations-for-the-benchmark-game/54957 "2021-02-10T12:04:54Z")

</div>

First the good stuff, the release candidate takes one sec, 1/5 of the time off when threading isn’t used. But while new and old are both faster as expected with threading, the gain is less on the release candidate makin…

---

## [Calling @docs twice for the same function in Documenter.jl](https://discourse.julialang.org/t/calling-docs-twice-for-the-same-function-in-documenter-jl/37791)

<div class="topic-metadata">

**Author:** [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Replies:** 6\
**Last updated:** [February 10, 2021, 11:43am UTC](https://discourse.julialang.org/t/calling-docs-twice-for-the-same-function-in-documenter-jl/37791 "2021-02-10T11:43:40Z")

</div>

When using Documenter.jl say I have the following two markdown files, Page1.md some text 1 \`\`@docs foo \`\` Page2.md some text 2 \`\`@docs foo \`\` I observe that this results in a warning of the form, Warning: duplicate …

---

## [Zygote: ERROR: LoadError: type NamedTuple has no field first](https://discourse.julialang.org/t/zygote-error-loaderror-type-namedtuple-has-no-field-first/54199)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 5\
**Last updated:** [February 10, 2021, 11:18am UTC](https://discourse.julialang.org/t/zygote-error-loaderror-type-namedtuple-has-no-field-first/54199 "2021-02-10T11:18:54Z")

</div>

Hi, I’m trying to get started using Zygote in a numerical simulation. Basically I need to differentiate through a Laplace solver and am getting an error which I don’t know how to handle. Here is the code: using Plots …

---

## [Hi! I have a function, let's say \`f(ϕ) = sin(ϕ), ϕ = 0...10\`. Now I want to break](https://discourse.julialang.org/t/hi-i-have-a-function-lets-say-f-sin-0-10-now-i-want-to-break/54826)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 28\
**Last updated:** [February 10, 2021, 8:34am UTC](https://discourse.julialang.org/t/hi-i-have-a-function-lets-say-f-sin-0-10-now-i-want-to-break/54826 "2021-02-10T08:34:45Z")

</div>

Hi! I have a function, let’s say f(ϕ) = sin(ϕ), ϕ = 0...10. Now I want to break that function down in a list of lines that approximates the real function well (maybe with a maximum or minimum line length, angle between l…

---

## [Can't use tuple of \`UInt\` as index](https://discourse.julialang.org/t/cant-use-tuple-of-uint-as-index/54968)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 4\
**Last updated:** [February 10, 2021, 8:58am UTC](https://discourse.julialang.org/t/cant-use-tuple-of-uint-as-index/54968 "2021-02-10T08:58:09Z")

</div>

Is this expected behavior? julia\> idx = UInt(3); A = rand(4); A\[idx\] 0.10882052381690266 julia\> idx = (UInt(3), UInt(1)); A = rand(4, 5); A\[idx\] ERROR: ArgumentError: invalid index: (0x0000000000000003, 0x0000000000000…

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

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