# General Usage

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

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

**Page:** 290

---

## [Julia spawn several commands](https://discourse.julialang.org/t/julia-spawn-several-commands/7421)

<div class="topic-metadata">

**Author:** [@tawheeler](https://discourse.julialang.org/u/tawheeler)\
**Replies:** 9\
**Last updated:** [May 19, 2023, 9:19am UTC](https://discourse.julialang.org/t/julia-spawn-several-commands/7421 "2023-05-19T09:19:57Z")

</div>

Hi Julia users, I would like to run a command that is actually several commands separated by semi-colons. ex: run(\`ls; ls\`) I get an error that semi-colons needs to be quoted. run('ls; ls') does not work run(ls';' …

---

## [Recompile generated function when methods get defined](https://discourse.julialang.org/t/recompile-generated-function-when-methods-get-defined/99089)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 6\
**Last updated:** [May 19, 2023, 8:32am UTC](https://discourse.julialang.org/t/recompile-generated-function-when-methods-get-defined/99089 "2023-05-19T08:32:49Z")

</div>

Normally, generated functions can only use methods defined earlier: julia\> f(x) = 1 julia\> @generated g(x...) = f(x...) julia\> f(x, y) = 2 julia\> g(1) 1 julia\> g(1, 1) ERROR: MethodError: no method matching f(::Type{In…

---

## [Installing PythonPlot fails](https://discourse.julialang.org/t/installing-pythonplot-fails/99100)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 0\
**Last updated:** [May 19, 2023, 8:32am UTC](https://discourse.julialang.org/t/installing-pythonplot-fails/99100 "2023-05-19T08:32:35Z")

</div>

Precompiling PythonPlot on Windows with Julia 1.9 fails: (WindTurbines) pkg\> precompile Precompiling project... ✗ PythonPlot 0 dependencies successfully precompiled in 4 seconds. 201 already precompiled. ERROR: The…

---

## [DateTime: how to handle "yymmdd" format?](https://discourse.julialang.org/t/datetime-how-to-handle-yymmdd-format/99074)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 5\
**Last updated:** [May 19, 2023, 7:51am UTC](https://discourse.julialang.org/t/datetime-how-to-handle-yymmdd-format/99074 "2023-05-19T07:51:34Z")

</div>

I have to read a text data which uses the “yymmdd” format for the date. For example the date 2023-05-19 is expressed as “230519” in the file. How does one convert the string to a DateTime object? In Julia’s Dates packag…

---

## [Performance of IdDict vs Dict](https://discourse.julialang.org/t/performance-of-iddict-vs-dict/57589)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 13\
**Last updated:** [May 19, 2023, 5:18am UTC](https://discourse.julialang.org/t/performance-of-iddict-vs-dict/57589 "2023-05-19T05:18:53Z")

</div>

I have always lazily assumed that IdDict would always be faster if keying by identity is desired, but it seems like this is not the case: julia\> function benchmarkdict(DType, ks) d = DType(k =\> k for k in ks)…

---

## [Problem in reading data with DLMreader package](https://discourse.julialang.org/t/problem-in-reading-data-with-dlmreader-package/99096)

<div class="topic-metadata">

**Author:** [@akshdfyehd](https://discourse.julialang.org/u/akshdfyehd)\
**Replies:** 0\
**Last updated:** [May 19, 2023, 5:05am UTC](https://discourse.julialang.org/t/problem-in-reading-data-with-dlmreader-package/99096 "2023-05-19T05:05:03Z")

</div>

Hi, I have the data in 11th and 13th (accommodation cost and transportation cost) column with , and USD and $ which I would like to remove, my tutor have asked specifically using DLMReader package, informat function, I h…

---

## [Windows 11 versus WSL2: Need for Speed](https://discourse.julialang.org/t/windows-11-versus-wsl2-need-for-speed/99086)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [May 18, 2023, 10:17pm UTC](https://discourse.julialang.org/t/windows-11-versus-wsl2-need-for-speed/99086 "2023-05-18T22:17:45Z")

</div>

Could one gain a significant advantage using Julia in Linux running within WSL2 compared to the Windows version? Package instantiation. 239 dependencies, always starting from blank slate (no depot). Julia Version 1.9.0…

---

## [How to maximize replicability of a package](https://discourse.julialang.org/t/how-to-maximize-replicability-of-a-package/99034)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 16\
**Last updated:** [May 18, 2023, 9:32pm UTC](https://discourse.julialang.org/t/how-to-maximize-replicability-of-a-package/99034 "2023-05-18T21:32:38Z")

</div>

I’m developing a new package for a broad audience with prospective users valuing replicability/reproducibility of results. On my laptop and desktop which have different versions of Ubuntu, different hardware (AMD versus…

---

## [A way for identifying the code portion being re-compiled?](https://discourse.julialang.org/t/a-way-for-identifying-the-code-portion-being-re-compiled/99077)

<div class="topic-metadata">

**Author:** [@Atiyah](https://discourse.julialang.org/u/Atiyah)\
**Replies:** 1\
**Last updated:** [May 18, 2023, 8:29pm UTC](https://discourse.julialang.org/t/a-way-for-identifying-the-code-portion-being-re-compiled/99077 "2023-05-18T20:29:57Z")

</div>

Motivation: I done some re-structuring to my code. Afterwords, re-executing with the @time macro within REPL indicates that part of the code is getting re-compiled, e.g. .... seconds (... , 50.63% compilation time: 100%…

---

## [Working with MCMCChains?](https://discourse.julialang.org/t/working-with-mcmcchains/99014)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 9\
**Last updated:** [May 18, 2023, 6:52pm UTC](https://discourse.julialang.org/t/working-with-mcmcchains/99014 "2023-05-18T18:52:58Z")

</div>

Suppose I’ve fit a model with Turing and I have a “Chains” object. Suppose my model has a bunch of nuisance parameters, and I’m just interested in looking at several particular parameters. I want to extract a chains obje…

---

## [Runtime initializaion of parametric type in package from input](https://discourse.julialang.org/t/runtime-initializaion-of-parametric-type-in-package-from-input/99080)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 0\
**Last updated:** [May 18, 2023, 6:33pm UTC](https://discourse.julialang.org/t/runtime-initializaion-of-parametric-type-in-package-from-input/99080 "2023-05-18T18:33:37Z")

</div>

Hi, I have a package, where I want to define MyStaticVectorType type, as an alias to SVector{MEM\_SIZE,Int} (from StaticArrays.jl). Where MEM\_SIZE is loaded from environment variable when the program runs, so it’s avail…

---

## [Removing specific Type from Union](https://discourse.julialang.org/t/removing-specific-type-from-union/98943)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 13\
**Last updated:** [May 18, 2023, 6:15pm UTC](https://discourse.julialang.org/t/removing-specific-type-from-union/98943 "2023-05-18T18:15:54Z")

</div>

I am trying to find a way to remove a specific type from a Union of types. In the code below, I would like to inherit from AbtractArray{T,N} if R is Nothing but otherwise inherit from the Union{T,R}: julia\> struct MyT{T…

---

## [Improving snippets highlight of forum](https://discourse.julialang.org/t/improving-snippets-highlight-of-forum/99070)

<div class="topic-metadata">

**Author:** [@math4mad](https://discourse.julialang.org/u/math4mad)\
**Replies:** 0\
**Last updated:** [May 18, 2023, 3:19pm UTC](https://discourse.julialang.org/t/improving-snippets-highlight-of-forum/99070 "2023-05-18T15:19:20Z")

</div>

For. discourse.julialang.org seems improve a little. need inject a js script if your browser are chrome or edge , you can use tampermonkey if you use Safari , you can use use Userscripts copy this snippet…

---

## [Type check conventions](https://discourse.julialang.org/t/type-check-conventions/99047)

<div class="topic-metadata">

**Author:** [@gxyau](https://discourse.julialang.org/u/gxyau)\
**Replies:** 1\
**Last updated:** [May 18, 2023, 2:37pm UTC](https://discourse.julialang.org/t/type-check-conventions/99047 "2023-05-18T14:37:12Z")

</div>

I recently just discovered how to do type check in Julia, and I was just wondering what the convention is, and what differences are the two methods. Say I have a variable vec1 of type Vector{\<:Number}. If I understand i…

---

## [How do I parallelize a while loop?](https://discourse.julialang.org/t/how-do-i-parallelize-a-while-loop/99053)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 3\
**Last updated:** [May 18, 2023, 12:37pm UTC](https://discourse.julialang.org/t/how-do-i-parallelize-a-while-loop/99053 "2023-05-18T12:37:49Z")

</div>

I am trying to parallelize a while loop in Julia but I am not sure where to start. For example, suppose I have the following loop: A = \[\] i = 0 while i \< 5000000 j = rand(1:5000000) if j == i push!(A,i) i = 0 …

---

## [Constructor functionality within Struct](https://discourse.julialang.org/t/constructor-functionality-within-struct/99040)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 2\
**Last updated:** [May 18, 2023, 8:36am UTC](https://discourse.julialang.org/t/constructor-functionality-within-struct/99040 "2023-05-18T08:36:53Z")

</div>

Is this bad coding? @with\_kw struct X @deftype Float64 a; b; c; d; e; f; g xv::Vector{Float64} yv = map(xv) do x # 10 lines of calculation using struct variables a - g. end end The do block c…

---

## [Calling a function to change a struct?](https://discourse.julialang.org/t/calling-a-function-to-change-a-struct/98846)

<div class="topic-metadata">

**Author:** [@hshackle](https://discourse.julialang.org/u/hshackle)\
**Replies:** 8\
**Last updated:** [May 18, 2023, 4:49am UTC](https://discourse.julialang.org/t/calling-a-function-to-change-a-struct/98846 "2023-05-18T04:49:00Z")

</div>

I am trying to use a function in order to modify a struct that is passed to it as a variable. Below is a minimal bit of code I have put together to illustrate my confusion. struct a x::Int y::Int end function s…

---

## [Julia crashes with new installation on installing a package](https://discourse.julialang.org/t/julia-crashes-with-new-installation-on-installing-a-package/79150)

<div class="topic-metadata">

**Author:** [@amca01](https://discourse.julialang.org/u/amca01)\
**Replies:** 3\
**Last updated:** [May 18, 2023, 3:36am UTC](https://discourse.julialang.org/t/julia-crashes-with-new-installation-on-installing-a-package/79150 "2023-05-18T03:36:07Z")

</div>

I’ve had troubles with Julia 1.7.1 on Windows 10, so just now I downloaded and installed 1.7.2 - as a user, and checked “Add Julia to PATH” as recommended. The first thing was to add a package or two: Pkg\> add "Linear…

---

## [Julia.exe just disappeared, when packages were installing](https://discourse.julialang.org/t/julia-exe-just-disappeared-when-packages-were-installing/75387)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 8\
**Last updated:** [May 18, 2023, 3:33am UTC](https://discourse.julialang.org/t/julia-exe-just-disappeared-when-packages-were-installing/75387 "2023-05-18T03:33:34Z")

</div>

I’ve got a new laptop from the university. (win10) I’ve installed Julia. (ver 1.7.1) Open in a terminal, it works. Using Pkg; Pkg.update(); - it works. (there is no packages) Pkg.add(“DataFrames”) - started to instal p…

---

## [Function to string](https://discourse.julialang.org/t/function-to-string/99018)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 17\
**Last updated:** [May 18, 2023, 2:24am UTC](https://discourse.julialang.org/t/function-to-string/99018 "2023-05-18T02:24:58Z")

</div>

I have a function ω = 2 f(t) = cos(3 ω + t) I would like a function, say, my\_string(fct) that would return “cos(3 ω + t)”. Is this possible? A simple example would be great. Alternatively, given a string: strg = …

---

## [Trouble understanding @turbo and passing kwargs](https://discourse.julialang.org/t/trouble-understanding-turbo-and-passing-kwargs/99023)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 1\
**Last updated:** [May 18, 2023, 2:27am UTC](https://discourse.julialang.org/t/trouble-understanding-turbo-and-passing-kwargs/99023 "2023-05-18T02:27:15Z")

</div>

After searching for awhile I’m stuck trying to understand why This works fine using LoopVectorization x = rand(10) y = rand(10) function turbofun(x,y) return x\*y end @turbo turbofun.(x, y) and so does this func…

---

## [How to use gridap topology optimization while using 2 governing equations](https://discourse.julialang.org/t/how-to-use-gridap-topology-optimization-while-using-2-governing-equations/99017)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 0\
**Last updated:** [May 17, 2023, 9:08pm UTC](https://discourse.julialang.org/t/how-to-use-gridap-topology-optimization-while-using-2-governing-equations/99017 "2023-05-17T21:08:22Z")

</div>

I want to use gridap topology optimization for fracture optimization. so there is two governing equations one is for stress strain relation and the other is about fracture energy. how can i use gridap in this case? as i …

---

## [Time difference in months/quarters/years](https://discourse.julialang.org/t/time-difference-in-months-quarters-years/98890)

<div class="topic-metadata">

**Author:** [@Pino](https://discourse.julialang.org/u/Pino)\
**Replies:** 3\
**Last updated:** [May 17, 2023, 8:37pm UTC](https://discourse.julialang.org/t/time-difference-in-months-quarters-years/98890 "2023-05-17T20:37:15Z")

</div>

I’d like to calculate the number of periods between two dates. The aim is to calculate a loan amortizing schedule. The following code arrives up to a certain point, i.e. to calculate the interval in days, but I’d like t…

---

## [Is there a way to switch between inline and interactive mode with IJulia and PyPlot?](https://discourse.julialang.org/t/is-there-a-way-to-switch-between-inline-and-interactive-mode-with-ijulia-and-pyplot/21128)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 9\
**Last updated:** [May 17, 2023, 7:41pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-switch-between-inline-and-interactive-mode-with-ijulia-and-pyplot/21128 "2023-05-17T19:41:19Z")

</div>

Basically I’m working in Jupyter notebook and occasionally I want to pop out a plot into its own window to make it interactive (otherwise inline by default is OK). Is this possible?

---

## [Saving Flux models](https://discourse.julialang.org/t/saving-flux-models/99013)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 0\
**Last updated:** [May 17, 2023, 7:25pm UTC](https://discourse.julialang.org/t/saving-flux-models/99013 "2023-05-17T19:25:43Z")

</div>

Checking documentation for current stable Flux v0.13.16, I am wondering why it is suggested so many transformations (struct, functor) prior to saving a model with Flux.state(transformed\_model). In which sense just savin…

---

## [SizedVector and Float32](https://discourse.julialang.org/t/sizedvector-and-float32/99003)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 2\
**Last updated:** [May 17, 2023, 4:33pm UTC](https://discourse.julialang.org/t/sizedvector-and-float32/99003 "2023-05-17T16:33:48Z")

</div>

I encountered an issue with SizedVector in StaticArrays.jl. The following works: i::Int64 = 3 a = SizedVector{i}(\[1., 2., 3.\]) But if i is an Int32, I get an error: j::Int32 = 3 a = SizedVector{j}(\[1., 2., 3.\]) I g…

---

## [Not all parameters being estimated in DiffEqFlux](https://discourse.julialang.org/t/not-all-parameters-being-estimated-in-diffeqflux/98891)

<div class="topic-metadata">

**Author:** [@ANasc](https://discourse.julialang.org/u/ANasc)\
**Replies:** 5\
**Last updated:** [May 17, 2023, 3:02pm UTC](https://discourse.julialang.org/t/not-all-parameters-being-estimated-in-diffeqflux/98891 "2023-05-17T15:02:00Z")

</div>

I’m trying to fit a simple Von Bertalanffy curve to some data using DiffEqFlux but one of the parameters (init\_p\[3\]) does not change with each iteration. I suspect it might have something to do with the step function ins…

---

## [Convert buffer function existing in matlab to julia language](https://discourse.julialang.org/t/convert-buffer-function-existing-in-matlab-to-julia-language/98926)

<div class="topic-metadata">

**Author:** [@RDuarte](https://discourse.julialang.org/u/RDuarte)\
**Replies:** 5\
**Last updated:** [May 17, 2023, 1:04pm UTC](https://discourse.julialang.org/t/convert-buffer-function-existing-in-matlab-to-julia-language/98926 "2023-05-17T13:04:51Z")

</div>

Hello everyone, I’ve been using Matlab for years but now I would like to move to Julia, however I’m having some doubts regarding equivalent functions in Julia. The problem is, in matlab I use the function buffer (Buffe…

---

## [Converting python code into julia code](https://discourse.julialang.org/t/converting-python-code-into-julia-code/98991)

<div class="topic-metadata">

**Author:** [@RDuarte](https://discourse.julialang.org/u/RDuarte)\
**Replies:** 9\
**Last updated:** [May 17, 2023, 2:29pm UTC](https://discourse.julialang.org/t/converting-python-code-into-julia-code/98991 "2023-05-17T14:29:54Z")

</div>

Hello everyone, I’m new in Julia word and I would like to translate a code/function I have in python to julia language but I’m didn’t have success till this moment. The function I have is: def buffer(X, n, p=0, opt=No…

---

## [Help with algorithm: calculate max possible score of DigitParty game](https://discourse.julialang.org/t/help-with-algorithm-calculate-max-possible-score-of-digitparty-game/98843)

<div class="topic-metadata">

**Author:** [@natemcintosh](https://discourse.julialang.org/u/natemcintosh)\
**Replies:** 10\
**Last updated:** [May 17, 2023, 2:26pm UTC](https://discourse.julialang.org/t/help-with-algorithm-calculate-max-possible-score-of-digitparty-game/98843 "2023-05-17T14:26:41Z")

</div>

I created a package that provides a programmatically playable copy of Digit Party. The game itself is pretty simple, but has a good depth of strategy; I highly recommend playing a few games. I need help with one part th…

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

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