# General Usage

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

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

**Page:** 299

---

## [Multithreaded IOBuffer memory leak?](https://discourse.julialang.org/t/multithreaded-iobuffer-memory-leak/98003)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 15\
**Last updated:** [April 29, 2023, 4:36am UTC](https://discourse.julialang.org/t/multithreaded-iobuffer-memory-leak/98003 "2023-04-29T04:36:35Z")

</div>

See #49545. Basically this piece of code leads to runaway memory that I can’t get rid of anymore: function explode(lck, buffer, path, message; kwargs...) lock(buffer) do println(buffer, message) ope…

---

## [How to use HawkesProcesses.jl to plot intensity for a given vector?](https://discourse.julialang.org/t/how-to-use-hawkesprocesses-jl-to-plot-intensity-for-a-given-vector/98073)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 1\
**Last updated:** [April 29, 2023, 3:50am UTC](https://discourse.julialang.org/t/how-to-use-hawkesprocesses-jl-to-plot-intensity-for-a-given-vector/98073 "2023-04-29T03:50:17Z")

</div>

I’m trying to figure out how to use HawkesProcesses.jl to get the intensity for a given input vector of event arrival data. # Event arrival data vector eventTimestamps = sort(rand(100)\*100) bg = 0.5 kappa = 0.5 kernel…

---

## [Mass Spring Damper with BlockSystems.jl](https://discourse.julialang.org/t/mass-spring-damper-with-blocksystems-jl/97981)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 4\
**Last updated:** [April 29, 2023, 1:51am UTC](https://discourse.julialang.org/t/mass-spring-damper-with-blocksystems-jl/97981 "2023-04-29T01:51:27Z")

</div>

How does one add a proportional constant k and a damping constant b to this IOBlock to setup a spring mass damper transfer function? using BlockSystems using ModelingToolkit @parameters t M F(t) @variables x(t) v(t) D …

---

## [Create a matrix with given dimension](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 2\
**Last updated:** [April 29, 2023, 12:59am UTC](https://discourse.julialang.org/t/create-a-matrix-with-given-dimension/98066 "2023-04-29T00:59:07Z")

</div>

Dear all, I need to creeate a null three-dimensional matrix d = d\[s,l,t\] where s = \[2,3,4,5\], l=\[12,13,14,15,16\] and t=1:12, e.g, I don’t need for example of positions \[1,1,1\], \[1,2,1\], etc, but only in the ranges of th…

---

## [What's the best Julia Editor?](https://discourse.julialang.org/t/whats-the-best-julia-editor/98060)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 5\
**Last updated:** [April 28, 2023, 11:11pm UTC](https://discourse.julialang.org/t/whats-the-best-julia-editor/98060 "2023-04-28T23:11:15Z")

</div>

I used to use Atom/Juno for my Julia programming purposes. However, it seems that Atom is being sunsetted. What is the best alternative? Many thanks.

---

## [How to save the queen?](https://discourse.julialang.org/t/how-to-save-the-queen/98024)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 9\
**Last updated:** [April 28, 2023, 8:29pm UTC](https://discourse.julialang.org/t/how-to-save-the-queen/98024 "2023-04-28T20:29:06Z")

</div>

I’m looking for (but haven’t found yet) a way to save the solutions of the 8 queens problem on a chessboard into an array of some sort, without necessarily having to “print” them live. If possible by changing the follow…

---

## [Reading different types of data in Julia](https://discourse.julialang.org/t/reading-different-types-of-data-in-julia/97906)

<div class="topic-metadata">

**Author:** [@yvikhlya](https://discourse.julialang.org/u/yvikhlya)\
**Replies:** 4\
**Last updated:** [April 28, 2023, 4:53pm UTC](https://discourse.julialang.org/t/reading-different-types-of-data-in-julia/97906 "2023-04-28T16:53:03Z")

</div>

Hello All, I am new to Julia, coming from python. I have collections of observational data and output from GCM model in netcdf format, but of different “types” (different grids, frequency, conventions etc, not julia typ…

---

## [TAB autocomplete for MutableNamedTuples works for first level only](https://discourse.julialang.org/t/tab-autocomplete-for-mutablenamedtuples-works-for-first-level-only/98047)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 1\
**Last updated:** [April 28, 2023, 3:56pm UTC](https://discourse.julialang.org/t/tab-autocomplete-for-mutablenamedtuples-works-for-first-level-only/98047 "2023-04-28T15:56:17Z")

</div>

Consider the following nested tuple example: a = (b=(c=1,),) In REPL I can type a. + TAB and I will see the level(s) below it. This can continue regadless of the number of levels in the tuple. This only works for the…

---

## [Optimizing Direct 1D Convolution Code](https://discourse.julialang.org/t/optimizing-direct-1d-convolution-code/97658)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 21\
**Last updated:** [April 28, 2023, 2:53pm UTC](https://discourse.julialang.org/t/optimizing-direct-1d-convolution-code/97658 "2023-04-28T14:53:46Z")

</div>

I am trying to create a function for a direct (Not fft() based) 1D convolution. Originally I used the classic implementation: using BenchmarkTools; function \_Conv1D!( vO :: Array{T, 1}, vA :: Array{T, 1}, vB :: Array{…

---

## [Interrupt \`Threads.@threads\` computation](https://discourse.julialang.org/t/interrupt-threads-threads-computation/71199)

<div class="topic-metadata">

**Author:** [@disberd](https://discourse.julialang.org/u/disberd)\
**Replies:** 14\
**Last updated:** [April 28, 2023, 12:39pm UTC](https://discourse.julialang.org/t/interrupt-threads-threads-computation/71199 "2023-04-28T12:39:01Z")

</div>

I sometime deal with very lengthy computation that I would like to interrupt before they finish. I can achieve this by wrapping the function with @async and then throw an InterruptException() to the task when I want it …

---

## [How to order axis with categorical variable in AlgebraOfGraphics?](https://discourse.julialang.org/t/how-to-order-axis-with-categorical-variable-in-algebraofgraphics/98027)

<div class="topic-metadata">

**Author:** [@SebastianCallh](https://discourse.julialang.org/u/SebastianCallh)\
**Replies:** 1\
**Last updated:** [April 28, 2023, 11:32am UTC](https://discourse.julialang.org/t/how-to-order-axis-with-categorical-variable-in-algebraofgraphics/98027 "2023-04-28T11:32:16Z")

</div>

Hello! I’m experimenting with AlgebraOfGraphics and stumbled upon something I haven’t been able to do. I looks like the default behaviour when plotting categorical variable on the y axis and continuous on the x axis is t…

---

## [Fail to deploy from Documenter to GITHUB](https://discourse.julialang.org/t/fail-to-deploy-from-documenter-to-github/98021)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 14\
**Last updated:** [April 28, 2023, 10:44am UTC](https://discourse.julialang.org/t/fail-to-deploy-from-documenter-to-github/98021 "2023-04-28T10:44:09Z")

</div>

I am working on Muscade.jl (work in progress!), and I have a first incomplete documentation I wish to deploy. Everything works fine… except I get a 404. Here is the dump: My repo structure includes Muscade docs …

---

## [Octavian Matmul slow in for loop](https://discourse.julialang.org/t/octavian-matmul-slow-in-for-loop/98030)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 0\
**Last updated:** [April 28, 2023, 9:19am UTC](https://discourse.julialang.org/t/octavian-matmul-slow-in-for-loop/98030 "2023-04-28T09:19:13Z")

</div>

Hey. I want to use octavian matmul in a foor loop. However, the code gets around 10 times slower in the loop. using BenchmarkTools using LinearAlgebra using LoopVectorization struct cust\_Dense W :: Array{Float32,2} …

---

## [Broadcast function performance of Julia vs Numpy vs Nd4J](https://discourse.julialang.org/t/broadcast-function-performance-of-julia-vs-numpy-vs-nd4j/98007)

<div class="topic-metadata">

**Author:** [@Vyacheslav\_Vorobyov](https://discourse.julialang.org/u/Vyacheslav_Vorobyov)\
**Replies:** 12\
**Last updated:** [April 28, 2023, 6:39am UTC](https://discourse.julialang.org/t/broadcast-function-performance-of-julia-vs-numpy-vs-nd4j/98007 "2023-04-28T06:39:09Z")

</div>

Hi everybody! Recently suddenly faced the fact, that in Julia, applying function to a matrix a bit(but consistently) slower than in Numpy(Python) or Nd4J(Java), and that was a bit surprised me because I believe all usin…

---

## [Julia slower than Python to sort and reverse a list of integers](https://discourse.julialang.org/t/julia-slower-than-python-to-sort-and-reverse-a-list-of-integers/97453)

<div class="topic-metadata">

**Author:** [@lucasmsoares96](https://discourse.julialang.org/u/lucasmsoares96)\
**Replies:** 40\
**Last updated:** [April 28, 2023, 4:42am UTC](https://discourse.julialang.org/t/julia-slower-than-python-to-sort-and-reverse-a-list-of-integers/97453 "2023-04-28T04:42:38Z")

</div>

My goal is to compare Julia’s performance against other languages like Python, Scala and Rust to perform some simple tasks. My first task was to sort an array of 999999 integers read from a text file. The code below run…

---

## [Maximum\_weight\_matching changes the symmetry of the original weight matrix?](https://discourse.julialang.org/t/maximum-weight-matching-changes-the-symmetry-of-the-original-weight-matrix/98005)

<div class="topic-metadata">

**Author:** [@OliviaPhillips](https://discourse.julialang.org/u/OliviaPhillips)\
**Replies:** 2\
**Last updated:** [April 28, 2023, 1:07am UTC](https://discourse.julialang.org/t/maximum-weight-matching-changes-the-symmetry-of-the-original-weight-matrix/98005 "2023-04-28T01:07:25Z")

</div>

I noticed that the maximum\_weight\_matching function seems to alter the weight matrix utilized in the matching. When I try to use the original graph in future calculations, I’m getting errors because its adjacency matrix …

---

## [Trouble Sending HTTP Requests to Port 443 (HTTPS) using Sockets.jl](https://discourse.julialang.org/t/trouble-sending-http-requests-to-port-443-https-using-sockets-jl/97998)

<div class="topic-metadata">

**Author:** [@TheDude](https://discourse.julialang.org/u/TheDude)\
**Replies:** 6\
**Last updated:** [April 27, 2023, 8:19pm UTC](https://discourse.julialang.org/t/trouble-sending-http-requests-to-port-443-https-using-sockets-jl/97998 "2023-04-27T20:19:51Z")

</div>

Trying to send HTTP requests using the Sockets.jl package. It works on port 80 say for “example.com” but any attempt to contact a server at port 443 (HTTPS) I’m met with a - 400 Bad Request - The plain HTTP request was…

---

## [How to speed up LoopVectorized code - 3x slower than C++ code](https://discourse.julialang.org/t/how-to-speed-up-loopvectorized-code-3x-slower-than-c-code/96440)

<div class="topic-metadata">

**Author:** [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Replies:** 19\
**Last updated:** [April 27, 2023, 5:35pm UTC](https://discourse.julialang.org/t/how-to-speed-up-loopvectorized-code-3x-slower-than-c-code/96440 "2023-04-27T17:35:52Z")

</div>

using StaticArrays, Parameters, LinearAlgebra, BenchmarkTools, StructArrays, LoopVectorization const T = Float32 const Point = SVector{3, T} @with\_kw struct Ray @deftype Point origin = zeros(Point) direction = …

---

## [Stacked environments](https://discourse.julialang.org/t/stacked-environments/97955)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 2\
**Last updated:** [April 27, 2023, 3:12pm UTC](https://discourse.julialang.org/t/stacked-environments/97955 "2023-04-27T15:12:11Z")

</div>

I’d like to start making better use of stacked environments and have a few questions. If I’m not mistaken the only sanctioned way to add another stacked environment is by modifying LOAD\_PATH, e.g. push!(LOAD\_PATH, "@mye…

---

## [Improve type inference in iterating over \`Eigen\`](https://discourse.julialang.org/t/improve-type-inference-in-iterating-over-eigen/97987)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 5\
**Last updated:** [April 27, 2023, 11:26am UTC](https://discourse.julialang.org/t/improve-type-inference-in-iterating-over-eigen/97987 "2023-04-27T11:26:15Z")

</div>

In the following example: julia\> @code\_warntype (A -\> ((λ,v) = eigen(A); (λ,v)))(rand(2,2)) MethodInstance for (::var"#19#20")(::Matrix{Float64}) from (::var"#19#20")(A) @ Main REPL\[14\]:1 Arguments #self#::Core.Cons…

---

## ["type definition not allowed inside a local scope"](https://discourse.julialang.org/t/type-definition-not-allowed-inside-a-local-scope/3907)

<div class="topic-metadata">

**Author:** [@Dandan](https://discourse.julialang.org/u/Dandan)\
**Replies:** 20\
**Last updated:** [April 27, 2023, 3:24am UTC](https://discourse.julialang.org/t/type-definition-not-allowed-inside-a-local-scope/3907 "2023-04-27T03:24:39Z")

</div>

Hi. Julia tells me that “type definition not allowed inside a local scope”. I have a simple question - why? :slight\_smile:

---

## [Error with dependency of NetworkDynamics.jl. What to do?](https://discourse.julialang.org/t/error-with-dependency-of-networkdynamics-jl-what-to-do/97978)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 0\
**Last updated:** [April 27, 2023, 12:55am UTC](https://discourse.julialang.org/t/error-with-dependency-of-networkdynamics-jl-what-to-do/97978 "2023-04-27T00:55:09Z")

</div>

I am trying to run this BlockSystems.jl example but I’m getting an issue with what seems like a dependency of NetworkDynamics.jl. LoadError: UndefVarError: AllObserved not defined in expression starting at /Users/bry…

---

## [How to change a public interface](https://discourse.julialang.org/t/how-to-change-a-public-interface/97958)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 9:49pm UTC](https://discourse.julialang.org/t/how-to-change-a-public-interface/97958 "2023-04-26T21:49:05Z")

</div>

Let’s say I have a package that defines an abstract type with an interface: if you define successor\_is\_prime, then my module will define predecessor\_is\_prime. module Arithmetic function successor\_is\_prime end pr…

---

## [Plots adjust the subtitle position](https://discourse.julialang.org/t/plots-adjust-the-subtitle-position/97971)

<div class="topic-metadata">

**Author:** [@jianqixi](https://discourse.julialang.org/u/jianqixi)\
**Replies:** 0\
**Last updated:** [April 26, 2023, 9:44pm UTC](https://discourse.julialang.org/t/plots-adjust-the-subtitle-position/97971 "2023-04-26T21:44:32Z")

</div>

Hi I am trying to plot some subplots with title or label. I tried to use label which was assumed to be appeared within the plot, but it didn’t. Then I tried to use title, it works now, but the position of those subtitle …

---

## [Error when adding CairoMakie in a fresh temporary environment](https://discourse.julialang.org/t/error-when-adding-cairomakie-in-a-fresh-temporary-environment/97962)

<div class="topic-metadata">

**Author:** [@martinmestre](https://discourse.julialang.org/u/martinmestre)\
**Replies:** 1\
**Last updated:** [April 26, 2023, 7:18pm UTC](https://discourse.julialang.org/t/error-when-adding-cairomakie-in-a-fresh-temporary-environment/97962 "2023-04-26T19:18:56Z")

</div>

Hi, this is the full output: (jl\_iJ7m9n) pkg\> add CairoMakie Resolving package versions... Updating \`/tmp/jl\_iJ7m9n/Project.toml\` \[13f3f980\] + CairoMakie v0.10.4 Updating \`/tmp/jl\_iJ7m9n/Manifest.toml\` \[6…

---

## [Plot images within a loop](https://discourse.julialang.org/t/plot-images-within-a-loop/97960)

<div class="topic-metadata">

**Author:** [@jianqixi](https://discourse.julialang.org/u/jianqixi)\
**Replies:** 5\
**Last updated:** [April 26, 2023, 6:13pm UTC](https://discourse.julialang.org/t/plot-images-within-a-loop/97960 "2023-04-26T18:13:28Z")

</div>

I am trying to plot some data within one loop using the following code: n=length(B) for i in 1:n i=contourf(x,y,B\[i\], layout=n) display(i) end Here B is a matrix and each B\[i\] is one array. When using the above cod…

---

## [Outer Product of SparseMatrix and SparseVector](https://discourse.julialang.org/t/outer-product-of-sparsematrix-and-sparsevector/97947)

<div class="topic-metadata">

**Author:** [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Replies:** 5\
**Last updated:** [April 26, 2023, 4:08pm UTC](https://discourse.julialang.org/t/outer-product-of-sparsematrix-and-sparsevector/97947 "2023-04-26T16:08:19Z")

</div>

Is there an elegant/optimized way to take the outer product of 3 sparse vectors? Problem 1: Triple Outer Product In numpy I can just chain calls to np.outer(np.outer(v,v),v) but I cannot do the same in Julia. I see th…

---

## [Is it possible to get the most fitting dispatch types?](https://discourse.julialang.org/t/is-it-possible-to-get-the-most-fitting-dispatch-types/97909)

<div class="topic-metadata">

**Author:** [@jt1](https://discourse.julialang.org/u/jt1)\
**Replies:** 5\
**Last updated:** [April 26, 2023, 2:27pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-the-most-fitting-dispatch-types/97909 "2023-04-26T14:27:29Z")

</div>

Say that I have a list of function argument types possible\_argument\_types = \[(Int,), (Int,Union{Real,Char}), (Float64,Int), (Any,Int)\] And the input type input\_type = (String,Int) Is it possible for a function like t…

---

## [Multi-threaded code with :dynamic scheduler and mutable data](https://discourse.julialang.org/t/multi-threaded-code-with-dynamic-scheduler-and-mutable-data/97887)

<div class="topic-metadata">

**Author:** [@lijas](https://discourse.julialang.org/u/lijas)\
**Replies:** 5\
**Last updated:** [April 26, 2023, 12:25pm UTC](https://discourse.julialang.org/t/multi-threaded-code-with-dynamic-scheduler-and-mutable-data/97887 "2023-04-26T12:25:09Z")

</div>

I have a loop which I am currently multi-threading using the :static scheduler: threadcache = \[create\_cache() for i in 1:Threads.nthreads()\] Threads.@threads :static for i in 1:... data = threadcache\[Threads.threadi…

---

## [How to do a timedwait on a ReentrantLock or Threads.Condition](https://discourse.julialang.org/t/how-to-do-a-timedwait-on-a-reentrantlock-or-threads-condition/97885)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 1\
**Last updated:** [April 25, 2023, 9:10am UTC](https://discourse.julialang.org/t/how-to-do-a-timedwait-on-a-reentrantlock-or-threads-condition/97885 "2023-04-25T09:10:44Z")

</div>

Is it possible to do a timedwait on a ReentrantLock or Threads.Condition? rlock = ReentrantLock() timedwait(rlock, 5)

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

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