# General Usage

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

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

**Page:** 302

---

## [Test works in REPL but not as part of @testset](https://discourse.julialang.org/t/test-works-in-repl-but-not-as-part-of-testset/97703)

<div class="topic-metadata">

**Author:** [@mmv](https://discourse.julialang.org/u/mmv)\
**Replies:** 3\
**Last updated:** [April 20, 2023, 11:54pm UTC](https://discourse.julialang.org/t/test-works-in-repl-but-not-as-part-of-testset/97703 "2023-04-20T23:54:34Z")

</div>

Hi! I started deploying the JMtk15 project on GitHub, but this question is about my local implementation (using Julia 1.8.5 and git 2.39.2 on a recent MacBook Pro): The test function jMtkReadData\_tst\_0100.jl works as ex…

---

## [How to join multicast group on specific interface](https://discourse.julialang.org/t/how-to-join-multicast-group-on-specific-interface/97724)

<div class="topic-metadata">

**Author:** [@perfecto25](https://discourse.julialang.org/u/perfecto25)\
**Replies:** 0\
**Last updated:** [April 20, 2023, 10:53pm UTC](https://discourse.julialang.org/t/how-to-join-multicast-group-on-specific-interface/97724 "2023-04-20T22:53:47Z")

</div>

Hello, I need to join a MC group lets say 224.0.0.2 port 21000 and I need to join on a local interface with IP of 192.168.38.10 I want to test to see if Im recieving any data from the group looking at docs, how do I s…

---

## [Plot inequality using sympy](https://discourse.julialang.org/t/plot-inequality-using-sympy/97722)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 1\
**Last updated:** [April 20, 2023, 9:41pm UTC](https://discourse.julialang.org/t/plot-inequality-using-sympy/97722 "2023-04-20T21:41:53Z")

</div>

How to plot this inequality in sympy? I did other inequations and dont have this problem. Also this works pretty neat in python with plot\_implicit @syms x, y; ineq = Ge(x + 2y, 5); @info ineq; w = solve(…

---

## [Invoking Julia from the Terminal on MacOS](https://discourse.julialang.org/t/invoking-julia-from-the-terminal-on-macos/1124)

<div class="topic-metadata">

**Author:** [@vincent](https://discourse.julialang.org/u/vincent)\
**Replies:** 11\
**Last updated:** [April 20, 2023, 6:42pm UTC](https://discourse.julialang.org/t/invoking-julia-from-the-terminal-on-macos/1124 "2023-04-20T18:42:57Z")

</div>

hi happy to found julia after long time of hesitations in the choice of a language to make animated graphicals mathematics now, i follow the instructions on http://docs.julialang.org/en/stable/manual/getting-started/ …

---

## [Interpolating multiple parameters into a Cmd](https://discourse.julialang.org/t/interpolating-multiple-parameters-into-a-cmd/97709)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 2\
**Last updated:** [April 20, 2023, 3:32pm UTC](https://discourse.julialang.org/t/interpolating-multiple-parameters-into-a-cmd/97709 "2023-04-20T15:32:39Z")

</div>

Thank you Steven. Raising this topic from the dead. In my scenario, concatenation of the command fails, as I get single apostrophes in the command that I don’t want, see my first comment. Any ideas how I can avoid thi…

---

## [∪ doesn't parse as expected](https://discourse.julialang.org/t/doesnt-parse-as-expected/97671)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 13\
**Last updated:** [April 20, 2023, 3:26pm UTC](https://discourse.julialang.org/t/doesnt-parse-as-expected/97671 "2023-04-20T15:26:57Z")

</div>

julia\> 1..2 ∪ 3..5 ERROR: syntax: extra token ".." after end of expression Stacktrace: \[1\] top-level scope @ none:1 That’s a bummer. I was hoping to use this syntax inside a macro expansion, but it doesn’t even pars…

---

## [Hex2bytes: length of iterable must be even](https://discourse.julialang.org/t/hex2bytes-length-of-iterable-must-be-even/97704)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 15\
**Last updated:** [April 20, 2023, 3:14pm UTC](https://discourse.julialang.org/t/hex2bytes-length-of-iterable-must-be-even/97704 "2023-04-20T15:14:14Z")

</div>

Hi there, it seems hex2bytes is really not safe, but depending on the concrete number, it will throw an error. Workaround: using "0" \* string(65537, base=16), but this looks really weird. Can someone explain why such a …

---

## [sort(keys(Dict(:a =\> 1, :b =\> 2))) throws MethodError](https://discourse.julialang.org/t/sort-keys-dict-a-1-b-2-throws-methoderror/97701)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 13\
**Last updated:** [April 20, 2023, 2:28pm UTC](https://discourse.julialang.org/t/sort-keys-dict-a-1-b-2-throws-methoderror/97701 "2023-04-20T14:28:02Z")

</div>

I guess this is rather a discussion: sort(keys(Dict(:a =\> 1, :b =\> 2))) throws the following MethodError ERROR: MethodError: no method matching sort(::Base.KeySet{Symbol, Dict{Symbol, Int64}}) Closest candidates are: …

---

## [How do I dot-assign to a returned value using \`@.\`?](https://discourse.julialang.org/t/how-do-i-dot-assign-to-a-returned-value-using/97683)

<div class="topic-metadata">

**Author:** [@Kino](https://discourse.julialang.org/u/Kino)\
**Replies:** 2\
**Last updated:** [April 20, 2023, 2:34pm UTC](https://discourse.julialang.org/t/how-do-i-dot-assign-to-a-returned-value-using/97683 "2023-04-20T14:34:06Z")

</div>

Let’s create 2 arrays first: julia\> a = rand(100); b = rand(100) Take identity(a) as an example. These works: identity(a) .= b identity(a) .+= b @. $identity(a) += b x = identity(a); @. x = b But this doesn’t: juli…

---

## [Problem Saving TIFF Images](https://discourse.julialang.org/t/problem-saving-tiff-images/7267)

<div class="topic-metadata">

**Author:** [@MLackner](https://discourse.julialang.org/u/MLackner)\
**Replies:** 2\
**Last updated:** [April 20, 2023, 2:30pm UTC](https://discourse.julialang.org/t/problem-saving-tiff-images/7267 "2023-04-20T14:30:21Z")

</div>

Hi! I’ve got trouble saving images in .tiff format. Am I doing something seriously wrong with this code? (I’ve got ImageMagick and QuartzImageIO installed) using Images using TestImages img = testimage("moonsurface.…

---

## [Repeated Precompilation in 1.9rc2](https://discourse.julialang.org/t/repeated-precompilation-in-1-9rc2/97652)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 6\
**Last updated:** [April 20, 2023, 1:51pm UTC](https://discourse.julialang.org/t/repeated-precompilation-in-1-9rc2/97652 "2023-04-20T13:51:07Z")

</div>

Using 1.9-rc2 in noticed, that quite often precompilation repeats even though there is no apparent reason for that. What I observe in my day to day usage: start Julia (Revise and Test is loaded in startup) activate env…

---

## [What is StrideArrays.jl](https://discourse.julialang.org/t/what-is-stridearrays-jl/97146)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 26\
**Last updated:** [April 20, 2023, 12:01pm UTC](https://discourse.julialang.org/t/what-is-stridearrays-jl/97146 "2023-04-20T12:01:03Z")

</div>

It’s an odd question to ask, but I see StrideArrays.jl being used in a lot of extremely performance critical code, but meanwhile the documentation of the project… leaves a lot to be desired. So: what is StrideArrays.jl?…

---

## [ZMQ Basics Publisher Example Crashes](https://discourse.julialang.org/t/zmq-basics-publisher-example-crashes/97700)

<div class="topic-metadata">

**Author:** [@opiateblush](https://discourse.julialang.org/u/opiateblush)\
**Replies:** 0\
**Last updated:** [April 20, 2023, 11:20am UTC](https://discourse.julialang.org/t/zmq-basics-publisher-example-crashes/97700 "2023-04-20T11:20:13Z")

</div>

Hey, unfortunately there was no response to my issue on GitHub, so maybe someone over here got an idea what the problem might be: The example publisher in the Basics section of the ZMQ Guide crashes if put in a function…

---

## [Disable compiler optimization](https://discourse.julialang.org/t/disable-compiler-optimization/97663)

<div class="topic-metadata">

**Author:** [@green.nsk](https://discourse.julialang.org/u/green.nsk)\
**Replies:** 7\
**Last updated:** [April 20, 2023, 10:18am UTC](https://discourse.julialang.org/t/disable-compiler-optimization/97663 "2023-04-20T10:18:21Z")

</div>

is there a reliable way to disable optimization for code like this? function read\_reg64(base::Ptr{UInt32}, offset::Int) lower = unsafe\_load(base, offset + 1) upper = unsafe\_load(base, offset + 2) % UInt64 u…

---

## [Best practice for reading large matrix with repeated spaces as text](https://discourse.julialang.org/t/best-practice-for-reading-large-matrix-with-repeated-spaces-as-text/97685)

<div class="topic-metadata">

**Author:** [@sparrowhawk](https://discourse.julialang.org/u/sparrowhawk)\
**Replies:** 8\
**Last updated:** [April 20, 2023, 9:00am UTC](https://discourse.julialang.org/t/best-practice-for-reading-large-matrix-with-repeated-spaces-as-text/97685 "2023-04-20T09:00:02Z")

</div>

Hi, I have a moderately large text file with 1305639×114 entires in a matrix, separated by repeated whitespaces (not always fixed width) per line. About 1.5 GB or so with the spaces. On julia 1.8.2 The file reads fine w…

---

## [IOError: could not spawn \`....\`: no such file or directory (ENOENT)](https://discourse.julialang.org/t/ioerror-could-not-spawn-no-such-file-or-directory-enoent/72540)

<div class="topic-metadata">

**Author:** [@ANDREA-TQ](https://discourse.julialang.org/u/ANDREA-TQ)\
**Replies:** 3\
**Last updated:** [April 20, 2023, 7:30am UTC](https://discourse.julialang.org/t/ioerror-could-not-spawn-no-such-file-or-directory-enoent/72540 "2023-04-20T07:30:06Z")

</div>

Hi I’m new in the world of programming, i’m trying to perform this exercise but it gives me this error could you help me please? this is my Julia version julia\> versioninfo() Julia Version 1.6.3 Commit ae8452a9e0…

---

## [Create a Cmd from a String](https://discourse.julialang.org/t/create-a-cmd-from-a-string/2842)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 9\
**Last updated:** [March 25, 2023, 8:26pm UTC](https://discourse.julialang.org/t/create-a-cmd-from-a-string/2842 "2023-03-25T20:26:28Z")

</div>

I am using Julia to combine information from a combination of sources and generate a (rather lengthy) string that is a call to an external program. I can generate a String containing the text that I would type into the s…

---

## [ConstructFrom.jl - Construct objects without spelling out their types](https://discourse.julialang.org/t/constructfrom-jl-construct-objects-without-spelling-out-their-types/97459)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 2\
**Last updated:** [April 20, 2023, 4:22am UTC](https://discourse.julialang.org/t/constructfrom-jl-construct-objects-without-spelling-out-their-types/97459 "2023-04-20T04:22:03Z")

</div>

Over the past couple of weeks, I’ve frequently had to write code like the following. struct MyType data::Dict{Int, Dict{Float64, String}} end MyType() = MyType(Dict{Int, Dict{Float64, String}}()) …

---

## [Julia crashes when using ImageView together with PyPlot](https://discourse.julialang.org/t/julia-crashes-when-using-imageview-together-with-pyplot/63071)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [April 20, 2023, 2:13am UTC](https://discourse.julialang.org/t/julia-crashes-when-using-imageview-together-with-pyplot/63071 "2023-04-20T02:13:37Z")

</div>

In one of my machines, it has become impossible for me to use PyPlot and ImageView at the same time, Julia crashes with a message like: XmbTextListToTextProperty result code -2 XmbTextListToTextProperty result code -2 X…

---

## [Is there any way to make custom binary infix operators right associative?](https://discourse.julialang.org/t/is-there-any-way-to-make-custom-binary-infix-operators-right-associative/3202)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 7\
**Last updated:** [April 20, 2023, 1:35am UTC](https://discourse.julialang.org/t/is-there-any-way-to-make-custom-binary-infix-operators-right-associative/3202 "2023-04-20T01:35:17Z")

</div>

If I define some new binary infix operator, it appears to always be left associative by default, i.e. julia\> ⨳(a,b) = (a,b) julia\> 1⨳2⨳3 ((1,2),3) Is there any to make it right associative instead? I had guessed defini…

---

## [Hline and PlotlyJS](https://discourse.julialang.org/t/hline-and-plotlyjs/97677)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 1\
**Last updated:** [April 19, 2023, 9:29pm UTC](https://discourse.julialang.org/t/hline-and-plotlyjs/97677 "2023-04-19T21:29:21Z")

</div>

Today it gave me a bit of a headache to figure out how to use the function hline() inside a PlotlyJS-figure. By text string search inside the PlotlyJS-package I was able to put a minimal example together, I hope it help…

---

## [Cubic Spline Interpolation for unevenly sampled data with gradient support?](https://discourse.julialang.org/t/cubic-spline-interpolation-for-unevenly-sampled-data-with-gradient-support/89794)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 1\
**Last updated:** [April 19, 2023, 9:27pm UTC](https://discourse.julialang.org/t/cubic-spline-interpolation-for-unevenly-sampled-data-with-gradient-support/89794 "2023-04-19T21:27:25Z")

</div>

I’m trying to use Flux.jl to optimize a loss function that needs to perform cubic spline interpolation, so I need a package that includes gradient support. Right now I’m working with DataInterpolations.jl. So far I have …

---

## [Opinions on piping into variable?](https://discourse.julialang.org/t/opinions-on-piping-into-variable/86643)

<div class="topic-metadata">

**Author:** [@martin.auer](https://discourse.julialang.org/u/martin.auer)\
**Replies:** 11\
**Last updated:** [April 19, 2023, 7:39pm UTC](https://discourse.julialang.org/t/opinions-on-piping-into-variable/86643 "2023-04-19T19:39:52Z")

</div>

We use the Julia REPL quite a bit with custom data flows. When interactively toying around with them, we find the pipe operator extremely handy; especially combined with expressive Base.show() output, the sense of progre…

---

## [Extra dimensions and CartesianIndices](https://discourse.julialang.org/t/extra-dimensions-and-cartesianindices/97665)

<div class="topic-metadata">

**Author:** [@danicaratelli](https://discourse.julialang.org/u/danicaratelli)\
**Replies:** 2\
**Last updated:** [April 19, 2023, 5:35pm UTC](https://discourse.julialang.org/t/extra-dimensions-and-cartesianindices/97665 "2023-04-19T17:35:17Z")

</div>

Hello, I was wondering whether anyone has had to deal with “extra dimensions” while using ChartesianIndices. In particular, I am tempted to implement the following but it doesn’t work. Thanks in advance! N = 2; M = 2;…

---

## [Change the dependent variable in GLM linear regression programmatically](https://discourse.julialang.org/t/change-the-dependent-variable-in-glm-linear-regression-programmatically/97496)

<div class="topic-metadata">

**Author:** [@rustysinsix](https://discourse.julialang.org/u/rustysinsix)\
**Replies:** 7\
**Last updated:** [April 19, 2023, 4:32pm UTC](https://discourse.julialang.org/t/change-the-dependent-variable-in-glm-linear-regression-programmatically/97496 "2023-04-19T16:32:45Z")

</div>

Hello Everyone, I am new to julia dn i have been trying to run a basic linear regression model using the GLM package, I have found how to programmatically change the independent variables but i am unable to find a way to…

---

## [Array indexing/slicing is slow](https://discourse.julialang.org/t/array-indexing-slicing-is-slow/97633)

<div class="topic-metadata">

**Author:** [@danicaratelli](https://discourse.julialang.org/u/danicaratelli)\
**Replies:** 9\
**Last updated:** [April 19, 2023, 2:07pm UTC](https://discourse.julialang.org/t/array-indexing-slicing-is-slow/97633 "2023-04-19T14:07:27Z")

</div>

I am doing very simple calculations in loops. It looks like the array extraction is the most expensive part of this. Is there an obvious way to speed it up? Here is a MWE of what I am doing. Any help would be greatly app…

---

## [Structs with Fixed length strings and allocatedinline](https://discourse.julialang.org/t/structs-with-fixed-length-strings-and-allocatedinline/97646)

<div class="topic-metadata">

**Author:** [@Vinothkumar\_Raman](https://discourse.julialang.org/u/Vinothkumar_Raman)\
**Replies:** 1\
**Last updated:** [April 19, 2023, 12:18pm UTC](https://discourse.julialang.org/t/structs-with-fixed-length-strings-and-allocatedinline/97646 "2023-04-19T12:18:30Z")

</div>

I have struct like this, struct A a:: Symbol end I see a huge number of allocations of objects Union{A, Nothing}. I checked \> Base.allocatedinline(A) true \> Base.allocatedinline(Union{A, Nothing}) false I ori…

---

## [Type container equivalence](https://discourse.julialang.org/t/type-container-equivalence/97588)

<div class="topic-metadata">

**Author:** [@Vinothkumar\_Raman](https://discourse.julialang.org/u/Vinothkumar_Raman)\
**Replies:** 9\
**Last updated:** [April 19, 2023, 1:05am UTC](https://discourse.julialang.org/t/type-container-equivalence/97588 "2023-04-19T01:05:12Z")

</div>

I have struct which encapsulates a value with timestamp, like this. struct Timestampped{T} time:: UInt64 data:: T end Julia seem to have trouble with type stability when it has Timestampped{Union{A, Nothing}}.…

---

## [How best to structure a physics (wave optics) simulator?](https://discourse.julialang.org/t/how-best-to-structure-a-physics-wave-optics-simulator/77952)

<div class="topic-metadata">

**Author:** [@Yly](https://discourse.julialang.org/u/Yly)\
**Replies:** 2\
**Last updated:** [April 18, 2023, 10:25pm UTC](https://discourse.julialang.org/t/how-best-to-structure-a-physics-wave-optics-simulator/77952 "2023-04-18T22:25:20Z")

</div>

I am a physicist working on a project involving wave optics, which I would like to use Julia for. Being relatively new to this language (and not a programmer by trade), I’m not sure of the best way to structure the prob…

---

## [Need advice: tracing function calls non-invasively](https://discourse.julialang.org/t/need-advice-tracing-function-calls-non-invasively/97584)

<div class="topic-metadata">

**Author:** [@sumiya11](https://discourse.julialang.org/u/sumiya11)\
**Replies:** 7\
**Last updated:** [April 18, 2023, 8:52pm UTC](https://discourse.julialang.org/t/need-advice-tracing-function-calls-non-invasively/97584 "2023-04-18T20:52:41Z")

</div>

Hi everyone ! I want to record statistics about calls of some functions – the number of calls, runtime, etc. – without modifying the function code (or the code in the function parent module). I have the following proto…

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

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