# General Usage

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

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

**Page:** 701

---

## [Avoid allocations in the naive discrete Fourier transform](https://discourse.julialang.org/t/avoid-allocations-in-the-naive-discrete-fourier-transform/46847)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 12\
**Last updated:** [September 19, 2020, 12:23am UTC](https://discourse.julialang.org/t/avoid-allocations-in-the-naive-discrete-fourier-transform/46847 "2020-09-19T00:23:38Z")

</div>

Hello, I try to implemente a straight forwared discrete Fourier transform abut I do not see what variables are allocated in the intermediate steps. For my undertanding it is a generator expression and should get the resu…

---

## [Determine the log level](https://discourse.julialang.org/t/determine-the-log-level/46718)

<div class="topic-metadata">

**Author:** [@lyonsquark](https://discourse.julialang.org/u/lyonsquark)\
**Replies:** 6\
**Last updated:** [September 18, 2020, 11:25pm UTC](https://discourse.julialang.org/t/determine-the-log-level/46718 "2020-09-18T23:25:46Z")

</div>

Hi - Is there a way to determine the current logging level in code? For example, I would like to do extra work (e.g. maybe record timing information) only if @debug logging is turned on for that module/file. E.g… if log…

---

## [PlotlyJS: Blink connection trouble on WSL2](https://discourse.julialang.org/t/plotlyjs-blink-connection-trouble-on-wsl2/46881)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [September 18, 2020, 9:52pm UTC](https://discourse.julialang.org/t/plotlyjs-blink-connection-trouble-on-wsl2/46881 "2020-09-18T21:52:04Z")

</div>

Running this on WSL2. Graphics works (for instance, Firefox comes up no problem). Trying to use PlotlyJS I get this error message: julia\> include("klein\_gordon\_var.jl") …

---

## [Subtyping parametric composite types](https://discourse.julialang.org/t/subtyping-parametric-composite-types/9944)

<div class="topic-metadata">

**Author:** [@cdacosta](https://discourse.julialang.org/u/cdacosta)\
**Replies:** 12\
**Last updated:** [September 18, 2020, 7:35pm UTC](https://discourse.julialang.org/t/subtyping-parametric-composite-types/9944 "2020-09-18T19:35:00Z")

</div>

I am struggling to understand how I can reuse methods which have been defined as composite parametric types. I am working with the LinearMaps.jl package which defines a FunctionMap as struct FunctionMap{T,F1,F2} \<: Line…

---

## [Struct Parametric struct with type constrains in Union](https://discourse.julialang.org/t/struct-parametric-struct-with-type-constrains-in-union/46854)

<div class="topic-metadata">

**Author:** [@efokken](https://discourse.julialang.org/u/efokken)\
**Replies:** 4\
**Last updated:** [September 18, 2020, 7:20pm UTC](https://discourse.julialang.org/t/struct-parametric-struct-with-type-constrains-in-union/46854 "2020-09-18T19:20:20Z")

</div>

Hi there! I would like to use a struct of the following form: struct thing{T\<:Function} p::Union{Float64,T} someother\_member end When I create an instance like this: thing(x-\>2,"other") it works well. But …

---

## [Failed to precompile LibSndFile](https://discourse.julialang.org/t/failed-to-precompile-libsndfile/46830)

<div class="topic-metadata">

**Author:** [@kogad](https://discourse.julialang.org/u/kogad)\
**Replies:** 7\
**Last updated:** [September 18, 2020, 7:13pm UTC](https://discourse.julialang.org/t/failed-to-precompile-libsndfile/46830 "2020-09-18T19:13:28Z")

</div>

I’m trying to use LibSndFile.jl, but I get a following error: julia\> using LibSndFile \[ Info: Precompiling LibSndFile \[b13ce0c6-77b0-50c6-a2db-140568b8d1a5\] ERROR: LoadError: LibSndFile not properly installed. Please ru…

---

## [Broadcasting and function composition (circ)](https://discourse.julialang.org/t/broadcasting-and-function-composition-circ/46748)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 10\
**Last updated:** [September 18, 2020, 5:13pm UTC](https://discourse.julialang.org/t/broadcasting-and-function-composition-circ/46748 "2020-09-18T17:13:28Z")

</div>

How does one easily compose and broadcast? For example, x = randn(100,10) mapslices(cumprod ∘ exp, x; dims=1) fails because we need to broadcast exp. One workaround is to do the following x = randn(100,10) expdot(v)…

---

## [Delay in processing](https://discourse.julialang.org/t/delay-in-processing/46853)

<div class="topic-metadata">

**Author:** [@rjmoses](https://discourse.julialang.org/u/rjmoses)\
**Replies:** 7\
**Last updated:** [September 18, 2020, 4:55pm UTC](https://discourse.julialang.org/t/delay-in-processing/46853 "2020-09-18T16:55:41Z")

</div>

I have a routine that has about a 3 second delay in it for some reason. Essentially, the code goes: Do some initialization stuff, create three arrays of 1920 elements each (two Char, 1 structure) and initialize them …

---

## [Scope behaviors in Atom (Juno)](https://discourse.julialang.org/t/scope-behaviors-in-atom-juno/46706)

<div class="topic-metadata">

**Author:** [@goodluck](https://discourse.julialang.org/u/goodluck)\
**Replies:** 20\
**Last updated:** [September 18, 2020, 2:43pm UTC](https://discourse.julialang.org/t/scope-behaviors-in-atom-juno/46706 "2020-09-18T14:43:55Z")

</div>

in Scope of Variables · The Julia Language it says What does this code do? Hint: it’s a trick question. The answer is “it depends.” If this code is entered interactively, it behaves the same way it does in a function bod…

---

## [Julian implementation of FFT with arbitrary precision](https://discourse.julialang.org/t/julian-implementation-of-fft-with-arbitrary-precision/46842)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 3\
**Last updated:** [September 18, 2020, 1:35pm UTC](https://discourse.julialang.org/t/julian-implementation-of-fft-with-arbitrary-precision/46842 "2020-09-18T13:35:33Z")

</div>

Hello, I wonder if anyone knows a package which implements a fft in multiple dimensions for arbitrary precision number (BigFloats). I have not found any but I could imagine it exists.

---

## [Running Julia in the Cloud](https://discourse.julialang.org/t/running-julia-in-the-cloud/46839)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 1\
**Last updated:** [September 18, 2020, 12:42pm UTC](https://discourse.julialang.org/t/running-julia-in-the-cloud/46839 "2020-09-18T12:42:35Z")

</div>

Hey everyone, I wanted to ask if you know any sites on which I can easily run Julia code on any machine that is faster than my 5 year old Laptop? I need to run something a little bit more computationally intensive and I…

---

## [How to track dynamic dispatch](https://discourse.julialang.org/t/how-to-track-dynamic-dispatch/46826)

<div class="topic-metadata">

**Author:** [@tisztamo](https://discourse.julialang.org/u/tisztamo)\
**Replies:** 4\
**Last updated:** [September 18, 2020, 9:07am UTC](https://discourse.julialang.org/t/how-to-track-dynamic-dispatch/46826 "2020-09-18T09:07:29Z")

</div>

Similar to --track-allocation, I would like to see where in my code dynamic dispatch happened during a specific run. Is there a tool for that?

---

## [How to wait on multiple file descriptors/streams](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 0\
**Last updated:** [September 18, 2020, 7:42am UTC](https://discourse.julialang.org/t/how-to-wait-on-multiple-file-descriptors-streams/46827 "2020-09-18T07:42:41Z")

</div>

Hello all, I’m trying to read from multiple sockets/file descriptors, and would like to wait for either of them to have available bytes, then read them, and go back to waiting. In a regular posix system, I would use sel…

---

## [Waiting on a file: poll\_fd and RawFD](https://discourse.julialang.org/t/waiting-on-a-file-poll-fd-and-rawfd/1876)

<div class="topic-metadata">

**Author:** [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Replies:** 5\
**Last updated:** [September 18, 2020, 7:35am UTC](https://discourse.julialang.org/t/waiting-on-a-file-poll-fd-and-rawfd/1876 "2020-09-18T07:35:08Z")

</div>

Hello, I’ve found a few different ways to wait on a file until data is available to read. Of the methods I’ve found, poll\_fd seems to match my use case well, but I worry that it requires the use of RawFD, which only app…

---

## [Generic array scan line](https://discourse.julialang.org/t/generic-array-scan-line/46816)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 9\
**Last updated:** [September 18, 2020, 7:12am UTC](https://discourse.julialang.org/t/generic-array-scan-line/46816 "2020-09-18T07:12:57Z")

</div>

I have: const w, h = 640, 480 a = rand(Float32, w, h) and an algorithm, which requires scanning array a by row or column in all possible directions like shown here: function scan4(a) scanLine = zeros(max(w, h)) f…

---

## [How to mmap a string](https://discourse.julialang.org/t/how-to-mmap-a-string/39291)

<div class="topic-metadata">

**Author:** [@lesshaste](https://discourse.julialang.org/u/lesshaste)\
**Replies:** 18\
**Last updated:** [September 18, 2020, 6:18am UTC](https://discourse.julialang.org/t/how-to-mmap-a-string/39291 "2020-09-18T06:18:40Z")

</div>

I have a really large text file with one line in it. For slightly smaller files I just read it in with: line = readline(filename) I then process line from left to right. As a toy example: for i in 1:10 …

---

## [Plotly with multiple jupyter windows](https://discourse.julialang.org/t/plotly-with-multiple-jupyter-windows/46807)

<div class="topic-metadata">

**Author:** [@MatFi](https://discourse.julialang.org/u/MatFi)\
**Replies:** 0\
**Last updated:** [September 17, 2020, 10:42pm UTC](https://discourse.julialang.org/t/plotly-with-multiple-jupyter-windows/46807 "2020-09-17T22:42:25Z")

</div>

When I create a plot with the Plots package using the plotlyjs() backend in a jupyter-notebook this works wonderfully at first. But if I open a new browser window with the same notebook (and close the old one) I don’t g…

---

## [Gridded Interplation with NoInterp fails when specifying nodes](https://discourse.julialang.org/t/gridded-interplation-with-nointerp-fails-when-specifying-nodes/46756)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 9:46pm UTC](https://discourse.julialang.org/t/gridded-interplation-with-nointerp-fails-when-specifying-nodes/46756 "2020-09-17T21:46:49Z")

</div>

I have a function f(z,k) where I am trying to interpolate along k. Both z and k may be non-uniform. I do not want any interpolation along z. I am using Interpolations.jl and trying out the following: julia\> interpolate(…

---

## [Different exponent results with Int64 and Float64](https://discourse.julialang.org/t/different-exponent-results-with-int64-and-float64/46804)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 9:25pm UTC](https://discourse.julialang.org/t/different-exponent-results-with-int64-and-float64/46804 "2020-09-17T21:25:59Z")

</div>

During a calculation, I realized the following two examples produce different results. This doesn’t match my intuition, because the first example defaults to Int64, and the second example defaults to Float64. julia\> (1…

---

## [How to searchsortedfirst when each element requires expensive transformation](https://discourse.julialang.org/t/how-to-searchsortedfirst-when-each-element-requires-expensive-transformation/46720)

<div class="topic-metadata">

**Author:** [@MFairley](https://discourse.julialang.org/u/MFairley)\
**Replies:** 24\
**Last updated:** [September 17, 2020, 8:49pm UTC](https://discourse.julialang.org/t/how-to-searchsortedfirst-when-each-element-requires-expensive-transformation/46720 "2020-09-17T20:49:40Z")

</div>

I have a problem where I have an expensive function expensive() and I want to find the first integer i in 0:n such that expensive(i) \> a where a is some constant and we know that expensive(j) \> a for j \>= i. I want to m…

---

## [How to iterate the optimization model with the updated bounds of the variables?](https://discourse.julialang.org/t/how-to-iterate-the-optimization-model-with-the-updated-bounds-of-the-variables/46746)

<div class="topic-metadata">

**Author:** [@mamuniut09](https://discourse.julialang.org/u/mamuniut09)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 7:57pm UTC](https://discourse.julialang.org/t/how-to-iterate-the-optimization-model-with-the-updated-bounds-of-the-variables/46746 "2020-09-17T19:57:24Z")

</div>

Hello all, The optimization code is given below. x\_min=1; x\_max=7; y\_min=2; y\_max=5; m= Model(with\_optimizer(Ipopt.Optimizer)) @variable(m, x\>=0) @variable(m, y\>=0) @variable(m, z) @variable(m, w) @constraint(m,…

---

## [How can I specialize similar and copy on a offset custom array?](https://discourse.julialang.org/t/how-can-i-specialize-similar-and-copy-on-a-offset-custom-array/46796)

<div class="topic-metadata">

**Author:** [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Replies:** 0\
**Last updated:** [September 17, 2020, 6:17pm UTC](https://discourse.julialang.org/t/how-can-i-specialize-similar-and-copy-on-a-offset-custom-array/46796 "2020-09-17T18:17:36Z")

</div>

Hi All! :smiley: I have a Spinor struct, that Inherits from AbstractVector, but it’s index go from 0 to 2^{\\lfloor dim/2\\rfloor}-1, with dim a part of the Spinor struct, for this I’m using CustomUnitRanges.jl. The Spino…

---

## [OrdinaryDiffEq.jl: DiscreteCallback at last step](https://discourse.julialang.org/t/ordinarydiffeq-jl-discretecallback-at-last-step/46795)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 4\
**Last updated:** [September 17, 2020, 6:22pm UTC](https://discourse.julialang.org/t/ordinarydiffeq-jl-discretecallback-at-last-step/46795 "2020-09-17T18:22:11Z")

</div>

Is there an easy way to determine whether a DiscreteCallback is called after the last step of an integration, i.e. just before the integration terminates? I would like to call such a callback using my chosen condition(u,…

---

## [How to recover Julia execution flags from julia?](https://discourse.julialang.org/t/how-to-recover-julia-execution-flags-from-julia/46790)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 2\
**Last updated:** [September 17, 2020, 4:27pm UTC](https://discourse.julialang.org/t/how-to-recover-julia-execution-flags-from-julia/46790 "2020-09-17T16:27:19Z")

</div>

Hi, Is it possible to know how julia have been launch (-Ox) during a julia code execution ?

---

## [ImageInTerminal with Julia 1.5.1](https://discourse.julialang.org/t/imageinterminal-with-julia-1-5-1/46786)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 3:58pm UTC](https://discourse.julialang.org/t/imageinterminal-with-julia-1-5-1/46786 "2020-09-17T15:58:44Z")

</div>

I receive the following alert: using ImageInTerminal, ImageView \[ Info: Precompiling ImageInTerminal \[d8c32880-2388-543b-8c61-d9f865259254\] ┌ Warning: ImageInTerminal is not supported for Windows platform: Julia at leas…

---

## [NLsolve stops quickly](https://discourse.julialang.org/t/nlsolve-stops-quickly/46777)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 5\
**Last updated:** [September 17, 2020, 3:37pm UTC](https://discourse.julialang.org/t/nlsolve-stops-quickly/46777 "2020-09-17T15:37:44Z")

</div>

Hey everyone, I have a multivariate non-linear root-finding problem for which I would like to use NLsolve.jl. It does not seem to work, however: using NLsolve function f!(F, β) F = mbagg(β, par) - mc.(β, par = par)…

---

## [Submodule needs pyplot and it breaks documenter](https://discourse.julialang.org/t/submodule-needs-pyplot-and-it-breaks-documenter/46785)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 0\
**Last updated:** [September 17, 2020, 2:55pm UTC](https://discourse.julialang.org/t/submodule-needs-pyplot-and-it-breaks-documenter/46785 "2020-09-17T14:55:34Z")

</div>

I am building a package and have a submodule that uses PyPlot. The main package does not. When I try using MyPkg I get a complaint unless PyPlot is in the Project.toml. Having put it in and pushed the new material, I g…

---

## [Is there a short version of: \`Pkg.TOML.parse(open("Project.toml"))\["deps"\] |\> keys |\> collect .|\> Pkg.add\`?](https://discourse.julialang.org/t/is-there-a-short-version-of-pkg-toml-parse-open-project-toml-deps-keys-collect-pkg-add/46768)

<div class="topic-metadata">

**Author:** [@arabidopsis](https://discourse.julialang.org/u/arabidopsis)\
**Replies:** 4\
**Last updated:** [September 17, 2020, 12:02pm UTC](https://discourse.julialang.org/t/is-there-a-short-version-of-pkg-toml-parse-open-project-toml-deps-keys-collect-pkg-add/46768 "2020-09-17T12:02:50Z")

</div>

I was trying to add the required depedencies from a repo with a Project.toml file. I tried activate/update/resolve etc. They did things… except seemingly add any packages. I finally used the code snippet above to read …

---

## [SparseMatrixCSC definition in function](https://discourse.julialang.org/t/sparsematrixcsc-definition-in-function/46766)

<div class="topic-metadata">

**Author:** [@jmurga](https://discourse.julialang.org/u/jmurga)\
**Replies:** 4\
**Last updated:** [September 17, 2020, 10:20am UTC](https://discourse.julialang.org/t/sparsematrixcsc-definition-in-function/46766 "2020-09-17T10:20:56Z")

</div>

Hi everyone! I’m developing a module within several functions. I found some troubles with the type definition at some inputs functions. I don’t know why but I cannot use SparseMatrixCSC type as the input type. After bu…

---

## [Readdlm \> strange behaviour](https://discourse.julialang.org/t/readdlm-strange-behaviour/46765)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 10:06am UTC](https://discourse.julialang.org/t/readdlm-strange-behaviour/46765 "2020-09-17T10:06:31Z")

</div>

I heve 14 line in file but readdlm reads only no empty lines ? What wrong ? julia\> readdlm("file.txt",'\\t') 3×1 Array{Any,2}: "00-028" "reqweae" "qwe" julia\> readdlm("file.txt",'\\r') 3×1 Array{Any,2}: "00-028" "…

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

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