# General Usage

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

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

**Page:** 306

---

## [Problems with module redefinition from vscode](https://discourse.julialang.org/t/problems-with-module-redefinition-from-vscode/97166)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 5\
**Last updated:** [April 11, 2023, 9:18am UTC](https://discourse.julialang.org/t/problems-with-module-redefinition-from-vscode/97166 "2023-04-11T09:18:08Z")

</div>

Module redefinition leads to inconsistent behaviour, at least when run in code blocks with Shift+Enter from vscode. Can anyone confirm this? I made a file and run it in cycle from top to bottom: #1, #2, THEN AGAIN #1: #…

---

## [Nonempty prefixes function](https://discourse.julialang.org/t/nonempty-prefixes-function/97136)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 14\
**Last updated:** [April 11, 2023, 8:21am UTC](https://discourse.julialang.org/t/nonempty-prefixes-function/97136 "2023-04-11T08:21:39Z")

</div>

Is there a function somewhere like this? nonempty\_prefixes(xs) = \[@view xs\[firstindex(xs):i\] for i in eachindex(xs)\] julia\> xs = String('a':'z') "abcdefghijklmnopqrstuvwxyz" julia\> nonempty\_prefixes(xs) 26-element Vec…

---

## [How to extract 0-255 arrays 3 RGB layers from a gif file?](https://discourse.julialang.org/t/how-to-extract-0-255-arrays-3-rgb-layers-from-a-gif-file/97301)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 4\
**Last updated:** [April 11, 2023, 2:49am UTC](https://discourse.julialang.org/t/how-to-extract-0-255-arrays-3-rgb-layers-from-a-gif-file/97301 "2023-04-11T02:49:28Z")

</div>

How to extract 0-255 arrays 3 RGB layers from a gif file? What package?

---

## [Diverging results of eigen() between Julia and Python](https://discourse.julialang.org/t/diverging-results-of-eigen-between-julia-and-python/97258)

<div class="topic-metadata">

**Author:** [@mkoculak](https://discourse.julialang.org/u/mkoculak)\
**Replies:** 11\
**Last updated:** [April 11, 2023, 12:58am UTC](https://discourse.julialang.org/t/diverging-results-of-eigen-between-julia-and-python/97258 "2023-04-11T00:58:50Z")

</div>

I am converting an algorithm from python to julia that uses eigen decomposition in the “hot loop” updating the solution. Python version uses scipy eigh function, which I already learned needs to be translated as eigen(Sy…

---

## [Memory management issue (malloc) on macBook Pro M2](https://discourse.julialang.org/t/memory-management-issue-malloc-on-macbook-pro-m2/97277)

<div class="topic-metadata">

**Author:** [@mmv](https://discourse.julialang.org/u/mmv)\
**Replies:** 7\
**Last updated:** [April 11, 2023, 12:19am UTC](https://discourse.julialang.org/t/memory-management-issue-malloc-on-macbook-pro-m2/97277 "2023-04-11T00:19:07Z")

</div>

Hi! I’m developing Julia wrappers to the NASA C library Mtk used to manipulate remote sensing data files, available from GitHub - nasa/MISR-Toolkit: an API facilitating the access of MISR standard product files. Here is…

---

## [Why does \`@time\` macro allocate in a \`let\` block, a local scope?](https://discourse.julialang.org/t/why-does-time-macro-allocate-in-a-let-block-a-local-scope/97266)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 0\
**Last updated:** [April 9, 2023, 2:15am UTC](https://discourse.julialang.org/t/why-does-time-macro-allocate-in-a-let-block-a-local-scope/97266 "2023-04-09T02:15:45Z")

</div>

The Performance Tips has a section on using @time to identify excessive allocations and reduce usage of untyped global variables. When allocations were technically eliminated, it points out that “the 1 allocation \[of 16 …

---

## [Reading quantization table of JPEG](https://discourse.julialang.org/t/reading-quantization-table-of-jpeg/97315)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 1\
**Last updated:** [April 10, 2023, 7:17pm UTC](https://discourse.julialang.org/t/reading-quantization-table-of-jpeg/97315 "2023-04-10T19:17:15Z")

</div>

Hi All, is there some easy way, how to read coefficients of quantization table from a jpeg file? I have been looking at GitHub - JuliaIO/JpegTurbo.jl: Julia interface to libjpeg-turbo, but I have not found a relevant ca…

---

## [Broadcast strange on \`0-dimensional Array\`?](https://discourse.julialang.org/t/broadcast-strange-on-0-dimensional-array/97311)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 2\
**Last updated:** [April 10, 2023, 6:05pm UTC](https://discourse.julialang.org/t/broadcast-strange-on-0-dimensional-array/97311 "2023-04-10T18:05:41Z")

</div>

I stumbled over a small thing that surprised me. Assume we have a Szenario where we want to be able to have mutating functions, but we came along with floats. We could just turn them into 0-Arrays using fill(0.0). I was …

---

## [Developing my package with Revise and Pluto is very slow sometimes](https://discourse.julialang.org/t/developing-my-package-with-revise-and-pluto-is-very-slow-sometimes/97306)

<div class="topic-metadata">

**Author:** [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Replies:** 0\
**Last updated:** [April 10, 2023, 2:26pm UTC](https://discourse.julialang.org/t/developing-my-package-with-revise-and-pluto-is-very-slow-sometimes/97306 "2023-04-10T14:26:18Z")

</div>

I’m doing experienments with my developing package, and runing experienment with it, running training loop in Pluto.jl. So I often need to change some source code and re-run the code to see the effect. This package also …

---

## [Dictionary to variables in julia](https://discourse.julialang.org/t/dictionary-to-variables-in-julia/47676)

<div class="topic-metadata">

**Author:** [@libensvivit](https://discourse.julialang.org/u/libensvivit)\
**Replies:** 10\
**Last updated:** [April 10, 2023, 12:01pm UTC](https://discourse.julialang.org/t/dictionary-to-variables-in-julia/47676 "2023-04-10T12:01:37Z")

</div>

Hey, I will keep the question simple, so I have a dictionary like this: my\_dict = Dict(“dataFolder”=\> “my\_data”, “tile\_size” =\> \[100, 200\], “dims” =\> 20) and I want the keys to be variables as in my workspace with t…

---

## [How to parse a string with ranges?](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 7\
**Last updated:** [April 10, 2023, 4:48am UTC](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288 "2023-04-10T04:48:31Z")

</div>

I would like to avoid using eval to parse some user input from the REPL that expects lists of integers and may contain some ranges, as in this MWE: # INPUT: str = "1 3:3:12 18 20" # OUTPUT: v = eval(Meta.parse("\[" \* j…

---

## [Multiple BLISBLAS Threads on Workers](https://discourse.julialang.org/t/multiple-blisblas-threads-on-workers/97269)

<div class="topic-metadata">

**Author:** [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Replies:** 3\
**Last updated:** [April 10, 2023, 12:47am UTC](https://discourse.julialang.org/t/multiple-blisblas-threads-on-workers/97269 "2023-04-10T00:47:04Z")

</div>

I am refining a BLAS intensive pipeline and have loved (and gotten a nice speedup from) BLISBLAS.jl. I happen to be running on a cluster with hyperthreading. Currently, I am running using addprocs(SlurmClusterManager()) …

---

## [Making Turing Fast with large numbers of parameters?](https://discourse.julialang.org/t/making-turing-fast-with-large-numbers-of-parameters/69072)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 127\
**Last updated:** [April 9, 2023, 10:26pm UTC](https://discourse.julialang.org/t/making-turing-fast-with-large-numbers-of-parameters/69072 "2023-04-09T22:26:35Z")

</div>

I’ve got a turing model where there are a few parameters for each of a couple hundred objects, plus some structural parameters… so let’s call it close to 500 parameters. I have a friend who has a simpler model (similar …

---

## [VSCode incredibly slow at saving files on windows](https://discourse.julialang.org/t/vscode-incredibly-slow-at-saving-files-on-windows/97286)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 0\
**Last updated:** [April 9, 2023, 8:52pm UTC](https://discourse.julialang.org/t/vscode-incredibly-slow-at-saving-files-on-windows/97286 "2023-04-09T20:52:10Z")

</div>

VSCode is taking a long time to format and save files on Windows 11. I’ve configured VSCode to autoformat and save on change of mouse focus, so it is formatting and saving a lot. Format and save time is fast when VSCode…

---

## [Implementation of Bennetin's algorithm for Lyapunov exponents](https://discourse.julialang.org/t/implementation-of-bennetins-algorithm-for-lyapunov-exponents/97207)

<div class="topic-metadata">

**Author:** [@Sh\_166](https://discourse.julialang.org/u/Sh_166)\
**Replies:** 1\
**Last updated:** [April 9, 2023, 5:32pm UTC](https://discourse.julialang.org/t/implementation-of-bennetins-algorithm-for-lyapunov-exponents/97207 "2023-04-09T17:32:56Z")

</div>

I want to calculate the Lyapunov indices for a system - problem is that I can’t get DynamicalSystems.jl to work (described here). Therefore, I decided to do it a much more crude way by writing out the steps myself. Now,…

---

## [How to isolate user](https://discourse.julialang.org/t/how-to-isolate-user/97280)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 4\
**Last updated:** [April 9, 2023, 5:25pm UTC](https://discourse.julialang.org/t/how-to-isolate-user/97280 "2023-04-09T17:25:28Z")

</div>

Hello. How to isolate the user? Can I run the REPL in a slave process for a user without them having access to the master process’s data?

---

## [How to replace current module from itself?](https://discourse.julialang.org/t/how-to-replace-current-module-from-itself/97282)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 1\
**Last updated:** [April 9, 2023, 5:23pm UTC](https://discourse.julialang.org/t/how-to-replace-current-module-from-itself/97282 "2023-04-09T17:23:31Z")

</div>

Hello, how to replace current module from itself? It is possible? Need use module REPL or enough macro?

---

## [Having trouble using types defined in extension modules?](https://discourse.julialang.org/t/having-trouble-using-types-defined-in-extension-modules/97260)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 5\
**Last updated:** [April 9, 2023, 3:11pm UTC](https://discourse.julialang.org/t/having-trouble-using-types-defined-in-extension-modules/97260 "2023-04-09T15:11:25Z")

</div>

My setup is on Julia 1.9 I have a package Foo, it has an extension module FooBarExt, and in that I define a type MyFooBarType. Then from another module I want to do: using Foo, Bar foo(::MyFooBarType) = ... But I can’…

---

## [Draw Parametric Equations from dsolve of SymPy with Plots](https://discourse.julialang.org/t/draw-parametric-equations-from-dsolve-of-sympy-with-plots/97270)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [April 9, 2023, 12:24pm UTC](https://discourse.julialang.org/t/draw-parametric-equations-from-dsolve-of-sympy-with-plots/97270 "2023-04-09T12:24:12Z")

</div>

Hi all, I want to draw parametric equations of x(t), y(t) but I got errors: LoadError: AssertionError: !(F2 \<: Function || F2 \<: AbstractArray && F2.parameters\[1\] \<: Function) if I try plot(f,g) I got the same erro…

---

## [What is alternative command besides \`print(ivp\_vt)\` to looks like when only typing \`ivp\_vt\` in REPL?](https://discourse.julialang.org/t/what-is-alternative-command-besides-print-ivp-vt-to-looks-like-when-only-typing-ivp-vt-in-repl/97271)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [April 9, 2023, 12:38pm UTC](https://discourse.julialang.org/t/what-is-alternative-command-besides-print-ivp-vt-to-looks-like-when-only-typing-ivp-vt-in-repl/97271 "2023-04-09T12:38:20Z")

</div>

This is about aesthetic matter, I want to make print(ivp\_vt) shown like when I type ivp\_vt, but the problem is if I type print(ivp\_vt) there is this bugging Eq at front and the format becomes ugly as well, the fraction…

---

## [Best way to get a vector of BigFloat values drawn from a uniform distribution](https://discourse.julialang.org/t/best-way-to-get-a-vector-of-bigfloat-values-drawn-from-a-uniform-distribution/97256)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 4\
**Last updated:** [April 9, 2023, 10:36am UTC](https://discourse.julialang.org/t/best-way-to-get-a-vector-of-bigfloat-values-drawn-from-a-uniform-distribution/97256 "2023-04-09T10:36:53Z")

</div>

Is there some better and simple way to implement this for BigFloat: function rand\_uniform(lo::F, hi::F, n::Signed) where {F \<: AbstractFloat} ret = Vector{F}(undef, n) dist = Distributions.Uniform(lo, hi) for i ∈ …

---

## [Read data file and create a dictionary from the metadata](https://discourse.julialang.org/t/read-data-file-and-create-a-dictionary-from-the-metadata/97200)

<div class="topic-metadata">

**Author:** [@Austin\_Weber](https://discourse.julialang.org/u/Austin_Weber)\
**Replies:** 14\
**Last updated:** [April 8, 2023, 4:09pm UTC](https://discourse.julialang.org/t/read-data-file-and-create-a-dictionary-from-the-metadata/97200 "2023-04-08T16:09:59Z")

</div>

I have a spectral data file in which the contents are stored like this: #FORMAT : EMSA #VERSION : 1.0 #TITLE : 2023-Apr-06 #NPOINTS : 4096 #NCOLUMNS : 1 #SPECTRUM : 0.00, 0.0 10.00, …

---

## [Why does Pluto instantiate each time a notebook is launched?](https://discourse.julialang.org/t/why-does-pluto-instantiate-each-time-a-notebook-is-launched/96965)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [April 8, 2023, 12:11pm UTC](https://discourse.julialang.org/t/why-does-pluto-instantiate-each-time-a-notebook-is-launched/96965 "2023-04-08T12:11:07Z")

</div>

Hi all, I’m a bit confused about how Pluto works. As shown in the screenshot below, I noticed that it instantiates each time I launch the same notebook (with no explicit changes to the dependencies). Instantiation accou…

---

## [Applying SnoopPrecompile to ProtoBuf Generated Code](https://discourse.julialang.org/t/applying-snoopprecompile-to-protobuf-generated-code/97240)

<div class="topic-metadata">

**Author:** [@ThomasPluck](https://discourse.julialang.org/u/ThomasPluck)\
**Replies:** 2\
**Last updated:** [April 8, 2023, 11:17am UTC](https://discourse.julialang.org/t/applying-snoopprecompile-to-protobuf-generated-code/97240 "2023-04-08T11:17:09Z")

</div>

Hi, so I’m generating some code using .protofiles, they are the usual messages etc. - I have some building automation that I’m fairly happy with and everything works as intended: These proto files can get quite large,…

---

## [Julia and Projective Geometric Algebra with GLMakie: Unable to Plot 3D Triangle](https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [April 8, 2023, 8:41am UTC](https://discourse.julialang.org/t/julia-and-projective-geometric-algebra-with-glmakie-unable-to-plot-3d-triangle/97244 "2023-04-08T08:41:25Z")

</div>

Hi all, I am following this medium: and I am trying the code to plot 3D Triangle from REPL: #= 1. includes “ripga3d.jl” so the REPL can evaluate 3D PGA expressions, 2. defines three vertices of a triangle in 3…

---

## [Best Debug Workflow for Dr Watson](https://discourse.julialang.org/t/best-debug-workflow-for-dr-watson/97234)

<div class="topic-metadata">

**Author:** [@WillHWThompson](https://discourse.julialang.org/u/WillHWThompson)\
**Replies:** 7\
**Last updated:** [April 8, 2023, 6:03am UTC](https://discourse.julialang.org/t/best-debug-workflow-for-dr-watson/97234 "2023-04-08T06:03:39Z")

</div>

I am extremely frustrated by my current workflow. There has to be a better way and I wanted to ask for advice. Here is how I have been working. I use Dr. Watson for all of my projects. I write all my store all my source…

---

## [SymPy to Solve Initial Value Condition (First Order Differential Equation)](https://discourse.julialang.org/t/sympy-to-solve-initial-value-condition-first-order-differential-equation/97203)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [April 8, 2023, 5:31am UTC](https://discourse.julialang.org/t/sympy-to-solve-initial-value-condition-first-order-differential-equation/97203 "2023-04-08T05:31:57Z")

</div>

Hi all, I want to check is my code correct to compute IVP of \\frac{dx}{dt} = \\sqrt{2g} \\frac{R}{\\sqrt{R+x}} the initial condition is x(0)=0 using SymPy @syms t, g, R @syms x() # Computing IVP with SymPy x(t).diff(t)…

---

## [Retrieving an instance of an enum using a string](https://discourse.julialang.org/t/retrieving-an-instance-of-an-enum-using-a-string/61183)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 6\
**Last updated:** [April 8, 2023, 3:19am UTC](https://discourse.julialang.org/t/retrieving-an-instance-of-an-enum-using-a-string/61183 "2023-04-08T03:19:50Z")

</div>

This has been posed, sort of, several times in Discourse or stackoverflow. For this example: @enum condition nil=5 mild sick severe It is easy to get the enum with an integer: julia\> condition(5) nil::condition = 5 I…

---

## [Efficient repeated sampling of small vector](https://discourse.julialang.org/t/efficient-repeated-sampling-of-small-vector/97093)

<div class="topic-metadata">

**Author:** [@PaterPen](https://discourse.julialang.org/u/PaterPen)\
**Replies:** 13\
**Last updated:** [April 8, 2023, 2:10am UTC](https://discourse.julialang.org/t/efficient-repeated-sampling-of-small-vector/97093 "2023-04-08T02:10:36Z")

</div>

Hi, my problem is simple: I am currently playing around with Multi-Armed Bandits and long story short in every iteration step I need to sample 10 iid. random variables (one for each arm). I noticed that it takes signifi…

---

## [Write data to Arrow file row by row](https://discourse.julialang.org/t/write-data-to-arrow-file-row-by-row/59165)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 7\
**Last updated:** [April 7, 2023, 9:31pm UTC](https://discourse.julialang.org/t/write-data-to-arrow-file-row-by-row/59165 "2023-04-07T21:31:06Z")

</div>

I have a large amount of data I am loading from an API and I would like to write the output of each call to a “row” of a file in order not to keep it in RAM/ in case the program errors. I have been using the Arrow.jl pac…

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

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