# Latest

**URL:** https://discourse.julialang.org/latest.md?page=894

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

**Page:** 895

---

## [Memory Allocation on Views for Arrays](https://discourse.julialang.org/t/memory-allocation-on-views-for-arrays/70887)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 5\
**Last updated:** [October 15, 2022, 2:14pm UTC](https://discourse.julialang.org/t/memory-allocation-on-views-for-arrays/70887 "2022-10-15T14:14:43Z")

</div>

Hi there, I would like to make a function that returns a view on an an 2-dimensional array. The view would change based on if the array has more rows and columns. MWE: using BenchmarkTools data1 = randn(100, 2) data2 =…

---

## [Is it possible to convert WebIO to a html file?](https://discourse.julialang.org/t/is-it-possible-to-convert-webio-to-a-html-file/88778)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 0\
**Last updated:** [October 15, 2022, 1:21pm UTC](https://discourse.julialang.org/t/is-it-possible-to-convert-webio-to-a-html-file/88778 "2022-10-15T13:21:55Z")

</div>

I’m trying to find ways of getting around vscode jupyter not supporting WebIO.jl. The idea is that iframes display just fine in the notebook so I’m trying to find a way to display something from say Interact.jl inside a…

---

## [Assigning struct to multiple variables](https://discourse.julialang.org/t/assigning-struct-to-multiple-variables/88763)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 6\
**Last updated:** [October 15, 2022, 12:33pm UTC](https://discourse.julialang.org/t/assigning-struct-to-multiple-variables/88763 "2022-10-15T12:33:20Z")

</div>

I would like to export a struct to variables. Say I have the following struct struct point x::Float64 y::Float64 end and I use it to define a point A=point(3.0,4.0) Is there a concise way to extract the…

---

## [Convert float to string with given decimal points](https://discourse.julialang.org/t/convert-float-to-string-with-given-decimal-points/88775)

<div class="topic-metadata">

**Author:** [@lieskjur](https://discourse.julialang.org/u/lieskjur)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 12:21pm UTC](https://discourse.julialang.org/t/convert-float-to-string-with-given-decimal-points/88775 "2022-10-15T12:21:05Z")

</div>

I am making some animations with the @animate macro and would like to display time in the title. Right now I am using string(round(t,digits=2)) but whenever the converted number has less than two decimals the text gets …

---

## [Julia extension crashes in User mode](https://discourse.julialang.org/t/julia-extension-crashes-in-user-mode/88652)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 12\
**Last updated:** [October 15, 2022, 11:03am UTC](https://discourse.julialang.org/t/julia-extension-crashes-in-user-mode/88652 "2022-10-15T11:03:28Z")

</div>

but works well in “Admin” mode. Typically happens with Plots/GR. Any ideas? (Windows 64, Julia 1.8.2, VS code 1.72.1, Julia extension 1.37.2.)

---

## [Tagbot unexpected internal error](https://discourse.julialang.org/t/tagbot-unexpected-internal-error/74680)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 10:29am UTC](https://discourse.julialang.org/t/tagbot-unexpected-internal-error/74680 "2022-10-15T10:29:13Z")

</div>

For some reason, tagbot is not working. Here is the error: Error: TagBot experienced an unexpected internal failure Traceback (most recent call last): File "/root/tagbot/action/\_\_main\_\_.py", line 94, in \<module\> r…

---

## [Eror UndefVarError: plot not defined](https://discourse.julialang.org/t/eror-undefvarerror-plot-not-defined/24936)

<div class="topic-metadata">

**Author:** [@math](https://discourse.julialang.org/u/math)\
**Replies:** 17\
**Last updated:** [October 15, 2022, 9:40am UTC](https://discourse.julialang.org/t/eror-undefvarerror-plot-not-defined/24936 "2022-10-15T09:40:36Z")

</div>

I am getting this error: UndefVarError: plot not defined Here is my code: # Packages using Pkg #using Plots using DifferentialEquations using PyPlot # Parameters i = 1.25 # 0.089;%nutrient input HG 4.5 gram per 4 day…

---

## [Surface/mesh/wireframe with only the coordinates](https://discourse.julialang.org/t/surface-mesh-wireframe-with-only-the-coordinates/88501)

<div class="topic-metadata">

**Author:** [@Mervyn\_Larrier](https://discourse.julialang.org/u/Mervyn_Larrier)\
**Replies:** 19\
**Last updated:** [October 15, 2022, 9:40am UTC](https://discourse.julialang.org/t/surface-mesh-wireframe-with-only-the-coordinates/88501 "2022-10-15T09:40:36Z")

</div>

I have a ton of x,y,z coordinates, and I need to represent them graphically. This could be as either a mesh, contour plot, wireframe, or surface. Julia doesn’t really argue with me; everything compiles. But I get a blan…

---

## [Does ModelingToolKit suitable for this kind of battery modeling (Example in simulink)?](https://discourse.julialang.org/t/does-modelingtoolkit-suitable-for-this-kind-of-battery-modeling-example-in-simulink/88759)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 2\
**Last updated:** [October 15, 2022, 8:15am UTC](https://discourse.julialang.org/t/does-modelingtoolkit-suitable-for-this-kind-of-battery-modeling-example-in-simulink/88759 "2022-10-15T08:15:29Z")

</div>

Hi all, I want to implement a battery simulation model, an example is given on Matlab Simulink: I am new to ModelingToolkit and trying to the possibilities of implementing this in Julia. Thank you very much for the p…

---

## [Best practices for error trapping and exception handling in Julia as of mid 2022](https://discourse.julialang.org/t/best-practices-for-error-trapping-and-exception-handling-in-julia-as-of-mid-2022/88754)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 4\
**Last updated:** [October 15, 2022, 6:53am UTC](https://discourse.julialang.org/t/best-practices-for-error-trapping-and-exception-handling-in-julia-as-of-mid-2022/88754 "2022-10-15T06:53:52Z")

</div>

Hey folks. I was trying to identify some best practices around error trapping or exception handling in Julia as of today, or at least mid-2022. I have found a bunch of blog posts on exception handling in Julia, for examp…

---

## [@spawn large memory allocation reduced when some code abstracted out in a function](https://discourse.julialang.org/t/spawn-large-memory-allocation-reduced-when-some-code-abstracted-out-in-a-function/88691)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 6\
**Last updated:** [October 15, 2022, 6:24am UTC](https://discourse.julialang.org/t/spawn-large-memory-allocation-reduced-when-some-code-abstracted-out-in-a-function/88691 "2022-10-15T06:24:38Z")

</div>

In another discussion, bizarre behavior that requires further attention and explanation came up. A recursive textbook implementation of quicksort makes no memory allocations as it modifies its argument input vector. H…

---

## [Why Makie's default color cycle not defined in ColorSchemes.jl?](https://discourse.julialang.org/t/why-makies-default-color-cycle-not-defined-in-colorschemes-jl/88711)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 6:14am UTC](https://discourse.julialang.org/t/why-makies-default-color-cycle-not-defined-in-colorschemes-jl/88711 "2022-10-15T06:14:35Z")

</div>

I notice here that the default color cycle is based on colors produced by wong\_colors, which is not available in ColorSchemes.jl. As pointed in this post, it is quite similar to ColorSchemes.seaborn\_colorblind6. Why not…

---

## [State of PlotlyJS and support packages](https://discourse.julialang.org/t/state-of-plotlyjs-and-support-packages/86119)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 10\
**Last updated:** [October 15, 2022, 3:51am UTC](https://discourse.julialang.org/t/state-of-plotlyjs-and-support-packages/86119 "2022-10-15T03:51:12Z")

</div>

PlotlyJS seems to be unmaintained by its current (and only) maintainer @sglyon. It also relies on Blink.jl, a wrapper for Electron, where the last commit was more than one year ago and uses a version of Electron more tha…

---

## [Developing a module the Julian way such that its functions are visible during development](https://discourse.julialang.org/t/developing-a-module-the-julian-way-such-that-its-functions-are-visible-during-development/88497)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 18\
**Last updated:** [October 15, 2022, 12:13am UTC](https://discourse.julialang.org/t/developing-a-module-the-julian-way-such-that-its-functions-are-visible-during-development/88497 "2022-10-15T00:13:26Z")

</div>

I’m writing a Julia package that contains one module. The module includes many source files and functions. I want to develop new functions in the module without having to export every required function within the module …

---

## [Vector Multiplication on Submatrices](https://discourse.julialang.org/t/vector-multiplication-on-submatrices/88686)

<div class="topic-metadata">

**Author:** [@willsharpless](https://discourse.julialang.org/u/willsharpless)\
**Replies:** 9\
**Last updated:** [October 14, 2022, 10:29pm UTC](https://discourse.julialang.org/t/vector-multiplication-on-submatrices/88686 "2022-10-14T22:29:19Z")

</div>

If I have a matrix which is a (horizontal) collection of matrices, A := \\begin{bmatrix} A\_0 & A\_1 & A\_2 & \\dots & A\_t \\end{bmatrix} , \\quad A\_i \\in \\mathbb{R}^{n \\times n}, A \\in \\mathbb{R}^{n \\times tn} and I want …

---

## [Help to set properly the scope of a dataframe: want it to be local to a function but not local within each interation of a for-loop inside that function](https://discourse.julialang.org/t/help-to-set-properly-the-scope-of-a-dataframe-want-it-to-be-local-to-a-function-but-not-local-within-each-interation-of-a-for-loop-inside-that-function/88753)

<div class="topic-metadata">

**Author:** [@martinmestre](https://discourse.julialang.org/u/martinmestre)\
**Replies:** 2\
**Last updated:** [October 14, 2022, 9:48pm UTC](https://discourse.julialang.org/t/help-to-set-properly-the-scope-of-a-dataframe-want-it-to-be-local-to-a-function-but-not-local-within-each-interation-of-a-for-loop-inside-that-function/88753 "2022-10-14T21:48:28Z")

</div>

Hello, I have made the following MWE: using DataFrames function Neuquen(df\_in::DataFrame)::DataFrame for i in 1:2 println("step $i") df\_built = append!(df\_in, DataFrame(a=\[1,2,3\], b=\[1,2,3\], c=\[1,2,…

---

## [Indexing a number](https://discourse.julialang.org/t/indexing-a-number/88735)

<div class="topic-metadata">

**Author:** [@Woodmouth](https://discourse.julialang.org/u/Woodmouth)\
**Replies:** 13\
**Last updated:** [October 14, 2022, 9:08pm UTC](https://discourse.julialang.org/t/indexing-a-number/88735 "2022-10-14T21:08:27Z")

</div>

If a number is generally treated as a list, \> 1\[1\] 1 \> 1\[2\] BoundsError \>length(1) 1 and so on, how come 1\[:\] gives an error? I would have expected the result to be the same as \[1\]\[:\]. I think this should be included…

---

## [Destructuring syntax does not respect const annotation](https://discourse.julialang.org/t/destructuring-syntax-does-not-respect-const-annotation/88751)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [October 14, 2022, 8:55pm UTC](https://discourse.julialang.org/t/destructuring-syntax-does-not-respect-const-annotation/88751 "2022-10-14T20:55:32Z")

</div>

The const keyword seems to have no effect when used with the destructuring syntax in Julia 1.7+. julia\> t = (;a = 1, b = 2); julia\> const (;a, b) = t (a = 1, b = 2) julia\> a = 3 # re-definition produces no error or wa…

---

## [Why does fill(:a)\[1\] work?](https://discourse.julialang.org/t/why-does-fill-a-1-work/88752)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 1\
**Last updated:** [October 14, 2022, 8:10pm UTC](https://discourse.julialang.org/t/why-does-fill-a-1-work/88752 "2022-10-14T20:10:57Z")

</div>

Why does fill(:a)\[1\] work? It is a zero-dimensional array, so I expect it to index with fill(:a)\[\] but apparently \[1\] also works.

---

## [How to access/ change a parameter inside loop?](https://discourse.julialang.org/t/how-to-access-change-a-parameter-inside-loop/88747)

<div class="topic-metadata">

**Author:** [@Mike\_comen](https://discourse.julialang.org/u/Mike_comen)\
**Replies:** 5\
**Last updated:** [October 14, 2022, 7:26pm UTC](https://discourse.julialang.org/t/how-to-access-change-a-parameter-inside-loop/88747 "2022-10-14T19:26:13Z")

</div>

As variables are local inside while/ for loop in Julia, I was wondering how to see the changes that happen inside loop and then use the values after changes?? For example, consider a very simple implementation of raisin…

---

## [Pkg.instantiate aborts Julia](https://discourse.julialang.org/t/pkg-instantiate-aborts-julia/88679)

<div class="topic-metadata">

**Author:** [@tasdemir](https://discourse.julialang.org/u/tasdemir)\
**Replies:** 9\
**Last updated:** [October 14, 2022, 7:03pm UTC](https://discourse.julialang.org/t/pkg-instantiate-aborts-julia/88679 "2022-10-14T19:03:13Z")

</div>

When I use instantiate command, Julia throws a warning and aborts. Every time I start giving a try to Julia language I stuck in a small step and go back to Python unfortunately. This is frustrating. Please help. My syste…

---

## [How to obtain log likelihoods from turing model](https://discourse.julialang.org/t/how-to-obtain-log-likelihoods-from-turing-model/88700)

<div class="topic-metadata">

**Author:** [@neuro\_enthusiast](https://discourse.julialang.org/u/neuro_enthusiast)\
**Replies:** 4\
**Last updated:** [October 14, 2022, 7:00pm UTC](https://discourse.julialang.org/t/how-to-obtain-log-likelihoods-from-turing-model/88700 "2022-10-14T19:00:07Z")

</div>

What are some good ways of obtaining the likelihood of observing some data given the parameters ( P(y|\\theta), where I feed in y and \\theta )? I couldn’t quite find it in the documentation. edit: would be especially hel…

---

## [Print.(v) for vector of custom structure?](https://discourse.julialang.org/t/print-v-for-vector-of-custom-structure/88699)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 17\
**Last updated:** [October 14, 2022, 6:51pm UTC](https://discourse.julialang.org/t/print-v-for-vector-of-custom-structure/88699 "2022-10-14T18:51:41Z")

</div>

What is going on here? julia\> struct A x::Int end julia\> Base.show(io::IO, a::A) = print(io, "$(a.x)") julia\> v = \[A(1), A(2)\]; julia\> print.(v) 122-element Vector{Nothing}: nothing nothing this …

---

## [Can’t make VSCode aware of a local package](https://discourse.julialang.org/t/can-t-make-vscode-aware-of-a-local-package/86808)

<div class="topic-metadata">

**Author:** [@senhalil](https://discourse.julialang.org/u/senhalil)\
**Replies:** 7\
**Last updated:** [October 14, 2022, 5:53pm UTC](https://discourse.julialang.org/t/can-t-make-vscode-aware-of-a-local-package/86808 "2022-10-14T17:53:02Z")

</div>

If I do as follows, VSCode works as expected – i.e., I can click and go to definition of an exported function from my script and the files defining these functions are parsed correctly, etc. – however, this is not ideal …

---

## [Safe way to open new file and unlock an existing file to enable deletion, if it exists](https://discourse.julialang.org/t/safe-way-to-open-new-file-and-unlock-an-existing-file-to-enable-deletion-if-it-exists/88676)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 0\
**Last updated:** [October 13, 2022, 4:12pm UTC](https://discourse.julialang.org/t/safe-way-to-open-new-file-and-unlock-an-existing-file-to-enable-deletion-if-it-exists/88676 "2022-10-13T16:12:54Z")

</div>

Assume you have the habit to use the variable fid as an IOStream-variable and you are not sure, if the related file is still open (it might be that a process has crashed or you have forgotten to close the old not longer …

---

## [Can you compile Julia into Scheme/FemtoLisp or directly its VM code (or other language more appropriate)?](https://discourse.julialang.org/t/can-you-compile-julia-into-scheme-femtolisp-or-directly-its-vm-code-or-other-language-more-appropriate/88746)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 11\
**Last updated:** [October 14, 2022, 5:43pm UTC](https://discourse.julialang.org/t/can-you-compile-julia-into-scheme-femtolisp-or-directly-its-vm-code-or-other-language-more-appropriate/88746 "2022-10-14T17:43:23Z")

</div>

Julia compiles code into native code, but it may take time, and at the opposite end you can use Julia as an interpreter with julia --compile=min but it’s very slow at runtime (only the non-compilation step is fast). Pyt…

---

## [Julia spherical harmonics different from python](https://discourse.julialang.org/t/julia-spherical-harmonics-different-from-python/88638)

<div class="topic-metadata">

**Author:** [@Juliapix](https://discourse.julialang.org/u/Juliapix)\
**Replies:** 8\
**Last updated:** [October 14, 2022, 4:11pm UTC](https://discourse.julialang.org/t/julia-spherical-harmonics-different-from-python/88638 "2022-10-14T16:11:46Z")

</div>

I would like to calculate the Spherical Harmonics with Julia. I have done this with the following code: using GSL function radius(x, y, z) return sqrt(x^2 + y^2 + z^2) end function theta(x, y, z) return acos(z…

---

## [Creating a Weighted Graph](https://discourse.julialang.org/t/creating-a-weighted-graph/41241)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 33\
**Last updated:** [June 16, 2020, 9:50pm UTC](https://discourse.julialang.org/t/creating-a-weighted-graph/41241 "2020-06-16T21:50:46Z")

</div>

I would like to try using a weighted graph. To this end, I added SimpleWeightedGraphs to Atom, created an erdos\_renyi directed graph, and then applied SimpleWeightedGraphs to this graph. const G = erdos\_renyi(10000, 0.0…

---

## [Problem with running Julia 1.6.7 with CUDA 11.7](https://discourse.julialang.org/t/problem-with-running-julia-1-6-7-with-cuda-11-7/87596)

<div class="topic-metadata">

**Author:** [@hpaldan](https://discourse.julialang.org/u/hpaldan)\
**Replies:** 8\
**Last updated:** [October 14, 2022, 3:19pm UTC](https://discourse.julialang.org/t/problem-with-running-julia-1-6-7-with-cuda-11-7/87596 "2022-10-14T15:19:31Z")

</div>

I have a problem with running CUDA on Julia and can’t figure out what is going wrong. Allocating seems to work fine but any kind of operation creates large bug reports. using CUDA CUDA.functional() # returns true N = 2^…

---

## [ExifViewer.jl: Package Announcement](https://discourse.julialang.org/t/exifviewer-jl-package-announcement/88704)

<div class="topic-metadata">

**Author:** [@Ashwani\_Rathee](https://discourse.julialang.org/u/Ashwani_Rathee)\
**Replies:** 2\
**Last updated:** [October 14, 2022, 2:32pm UTC](https://discourse.julialang.org/t/exifviewer-jl-package-announcement/88704 "2022-10-14T14:32:30Z")

</div>

Very excited to announce release of ExifViewer.jl 0.1.0 !! ExifViewer.jl provides for support for accessing image metadata from image files in Julia. ExifViewer.jl is a Julia wrapper over LibExif C library. It’s one of …

[Previous page](https://discourse.julialang.org/latest.md?page=893)

[Next page](https://discourse.julialang.org/latest.md?page=895)
