# General Usage

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

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

**Page:** 545

---

## [Inheritance and Dispatch with Restricted Type Parameters of Abstract Super Type](https://discourse.julialang.org/t/inheritance-and-dispatch-with-restricted-type-parameters-of-abstract-super-type/68444)

<div class="topic-metadata">

**Author:** [@manuelbb-upb](https://discourse.julialang.org/u/manuelbb-upb)\
**Replies:** 0\
**Last updated:** [September 20, 2021, 8:20am UTC](https://discourse.julialang.org/t/inheritance-and-dispatch-with-restricted-type-parameters-of-abstract-super-type/68444 "2021-09-20T08:20:52Z")

</div>

Hi, I was confused by the dispatch behavior with a hierarchy of types with (restricted) type parameters. Now I want to know if I understand correctly why the following does not work as I initially expected: 1st Example …

---

## [How to better use pointers?](https://discourse.julialang.org/t/how-to-better-use-pointers/68433)

<div class="topic-metadata">

**Author:** [@Rratic](https://discourse.julialang.org/u/Rratic)\
**Replies:** 13\
**Last updated:** [September 20, 2021, 7:45am UTC](https://discourse.julialang.org/t/how-to-better-use-pointers/68433 "2021-09-20T07:45:33Z")

</div>

I love pointers, but there are limited functions in julia. C/C++ Julia p=&a p=pointer\_from\_objref(a) a=\*p a=unsafe\_pointer\_to\_objref(p) \*p=3 how? p-\>x=3 how? p-\>tab\["a"\]=3 how? etc.

---

## [Loaderror: failed to precompile cairo \[159f3aea-2a34-519c-b102-8c37f9878175\] to c:\\users\\user\\.julia\\compiled\\v1.6\\cairo\\jl\_d1d4.tmp (windows 10)](https://discourse.julialang.org/t/loaderror-failed-to-precompile-cairo-159f3aea-2a34-519c-b102-8c37f9878175-to-c-users-user-julia-compiled-v1-6-cairo-jl-d1d4-tmp-windows-10/68437)

<div class="topic-metadata">

**Author:** [@shahla](https://discourse.julialang.org/u/shahla)\
**Replies:** 0\
**Last updated:** [September 20, 2021, 6:36am UTC](https://discourse.julialang.org/t/loaderror-failed-to-precompile-cairo-159f3aea-2a34-519c-b102-8c37f9878175-to-c-users-user-julia-compiled-v1-6-cairo-jl-d1d4-tmp-windows-10/68437 "2021-09-20T06:36:54Z")

</div>

Hi i’m new in julia and when i want run code in vscode i see these errors, can you help me please??? \[ Info: Precompiling Cairo \[159f3aea-2a34-519c-b102-8c37f9878175\] ERROR: LoadError: LoadError: InitError: could not l…

---

## [Construct Plots.Plot object from a figure object of a backend, e.g., PlotlyJS.Plot](https://discourse.julialang.org/t/construct-plots-plot-object-from-a-figure-object-of-a-backend-e-g-plotlyjs-plot/68407)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [September 20, 2021, 5:19am UTC](https://discourse.julialang.org/t/construct-plots-plot-object-from-a-figure-object-of-a-backend-e-g-plotlyjs-plot/68407 "2021-09-20T05:19:10Z")

</div>

Hi, I wonder if it’s possible to construct a Plots.Plot object from a PlotlyJS.Plot object or other backend’s Plot object :slight\_smile: For example, \_fig = PlotlyJS.Plot(...) fig = construct\_from\_plotlyjs(\_fig) # ty…

---

## [Julia Stopped working due to 2 deprecated methods](https://discourse.julialang.org/t/julia-stopped-working-due-to-2-deprecated-methods/59348)

<div class="topic-metadata">

**Author:** [@Tomas\_Rose](https://discourse.julialang.org/u/Tomas_Rose)\
**Replies:** 7\
**Last updated:** [September 20, 2021, 4:54am UTC](https://discourse.julialang.org/t/julia-stopped-working-due-to-2-deprecated-methods/59348 "2021-09-20T04:54:09Z")

</div>

HI everyone, Maybe someone could help me out here. When I opened atom yesterday, there were two updates available. It has happened before that these updates must be installed or otherwise the program stops working. But …

---

## [Replace date year](https://discourse.julialang.org/t/replace-date-year/68301)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 22\
**Last updated:** [September 19, 2021, 9:21pm UTC](https://discourse.julialang.org/t/replace-date-year/68301 "2021-09-19T21:21:13Z")

</div>

d = Date(2010,01,01) How can I replace the year with 2011?

---

## [Pkg add vs update for installed package](https://discourse.julialang.org/t/pkg-add-vs-update-for-installed-package/68418)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [September 19, 2021, 8:50pm UTC](https://discourse.julialang.org/t/pkg-add-vs-update-for-installed-package/68418 "2021-09-19T20:50:34Z")

</div>

What is the difference between add Package and update Package, for a Package that has a version already installed?

---

## [Color for each bar in a bar plot](https://discourse.julialang.org/t/color-for-each-bar-in-a-bar-plot/68420)

<div class="topic-metadata">

**Author:** [@ksamtsak](https://discourse.julialang.org/u/ksamtsak)\
**Replies:** 5\
**Last updated:** [September 19, 2021, 7:23pm UTC](https://discourse.julialang.org/t/color-for-each-bar-in-a-bar-plot/68420 "2021-09-19T19:23:42Z")

</div>

Hi! I want to plot a bar graph of a data frame with 1 column corresponding to the height of the bar and another to its color. For example: julia\> df= DataFrame("data"=\>rand(10), "color"=\>round.(Int,rand(10)\*9 .+ 1)) 10×…

---

## [Function on matrix transpose and performance](https://discourse.julialang.org/t/function-on-matrix-transpose-and-performance/20068)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 11\
**Last updated:** [September 19, 2021, 6:59pm UTC](https://discourse.julialang.org/t/function-on-matrix-transpose-and-performance/20068 "2021-09-19T18:59:08Z")

</div>

Here’s a quick example: foo(X::Matrix{Float64}) = maximum(X) bar(X::AbstractMatrix{Float64}) = maximum(X) X = randn(5000, 200); Xt = transpose(X); @btime foo($X) # 1 600.898 μs (0 allocations: 0 bytes) 4.6973555070913…

---

## [A particular function that modifies the input](https://discourse.julialang.org/t/a-particular-function-that-modifies-the-input/68387)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 4\
**Last updated:** [September 19, 2021, 5:55pm UTC](https://discourse.julialang.org/t/a-particular-function-that-modifies-the-input/68387 "2021-09-19T17:55:25Z")

</div>

I think I’m going to learn a lot whith this question. First, my principal goal is to transform any matrix according the following rule: For each column, find the first element equal to 1.1. Suposse the position of this…

---

## [Vector of arrays initialization](https://discourse.julialang.org/t/vector-of-arrays-initialization/68402)

<div class="topic-metadata">

**Author:** [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Replies:** 3\
**Last updated:** [September 19, 2021, 2:45pm UTC](https://discourse.julialang.org/t/vector-of-arrays-initialization/68402 "2021-09-19T14:45:14Z")

</div>

Hi, I have a case where I want to create a container for a list of arrays with known sizes but different types. The first thing that comes to mind is vector of vectors, like this: nv = 2 T = \[Float32, Int32\] nsize = \[4…

---

## [How to plot periodogram from DSP.jl?](https://discourse.julialang.org/t/how-to-plot-periodogram-from-dsp-jl/67969)

<div class="topic-metadata">

**Author:** [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)\
**Replies:** 5\
**Last updated:** [September 19, 2021, 10:07am UTC](https://discourse.julialang.org/t/how-to-plot-periodogram-from-dsp-jl/67969 "2021-09-19T10:07:12Z")

</div>

I am trying to plot a periodogram for the following data. However, I am not sure how can i plot a periodogram object ? Code: #= DataFrame 10×10 DataFrame Row │ Date Open High Low Close Volume …

---

## [Performance of cld vs ceil](https://discourse.julialang.org/t/performance-of-cld-vs-ceil/68309)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [September 17, 2021, 1:28pm UTC](https://discourse.julialang.org/t/performance-of-cld-vs-ceil/68309 "2021-09-17T13:28:36Z")

</div>

For floating-point arguments, julia\> x = 5.5; y = 2.2; julia\> @btime cld($(Ref(x))\[\], $(Ref(y))\[\]) 23.836 ns (0 allocations: 0 bytes) 3.0 julia\> @btime ceil(($(Ref(x))\[\] / $(Ref(y))\[\])) 2.682 ns (0 allocations: 0 …

---

## [Plots package install error](https://discourse.julialang.org/t/plots-package-install-error/68393)

<div class="topic-metadata">

**Author:** [@sqwu547](https://discourse.julialang.org/u/sqwu547)\
**Replies:** 3\
**Last updated:** [September 19, 2021, 7:20am UTC](https://discourse.julialang.org/t/plots-package-install-error/68393 "2021-09-19T07:20:38Z")

</div>

How can I figure this error?

---

## [Relative barmode in PGFPlotsX.jl](https://discourse.julialang.org/t/relative-barmode-in-pgfplotsx-jl/68095)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 4\
**Last updated:** [September 18, 2021, 2:43pm UTC](https://discourse.julialang.org/t/relative-barmode-in-pgfplotsx-jl/68095 "2021-09-18T14:43:04Z")

</div>

Hi, I am trying to make a bar chart in PGFPlotsX.jl with the same properties of the PlotlyJS bar charts with relative barmode. I was not able to find an example neither in the PGFPlots.jl gallery, nor in the Plots.jl do…

---

## [Has anyone used Kasdin's Runge-Kutta SDE algorithm?](https://discourse.julialang.org/t/has-anyone-used-kasdins-runge-kutta-sde-algorithm/68198)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 4\
**Last updated:** [September 17, 2021, 7:46pm UTC](https://discourse.julialang.org/t/has-anyone-used-kasdins-runge-kutta-sde-algorithm/68198 "2021-09-17T19:46:31Z")

</div>

Dear all, I am doing SDE now. I know Julia has fancy differentialequations.jl. It has several SDE solver like SRIW1 or something like that, which uses adaptive Runge-Kutta (RK). I also found there is a fortran version o…

---

## [Extract a \`PlotlyJS.Plot\` object from \`Plots.Plot\`](https://discourse.julialang.org/t/extract-a-plotlyjs-plot-object-from-plots-plot/68362)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [September 18, 2021, 6:56am UTC](https://discourse.julialang.org/t/extract-a-plotlyjs-plot-object-from-plots-plot/68362 "2021-09-18T06:56:15Z")

</div>

Hi, I’m looking forward to how to use Dash.jl conveniently. For interactive plotting, I found that PlotlyJS.Plot object should be returned in a callback of Dash.jl like this examples. And I’m familiar with Plots.jl s…

---

## [Value of @\_\_DIR\_\_ in Pluto notebook on Binder](https://discourse.julialang.org/t/value-of-dir-in-pluto-notebook-on-binder/68179)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 7\
**Last updated:** [September 18, 2021, 12:02am UTC](https://discourse.julialang.org/t/value-of-dir-in-pluto-notebook-on-binder/68179 "2021-09-18T00:02:02Z")

</div>

I have a Pluto notebook checked into GitHub that I’d like to be able to access through Binder. My notebook uses @DIR to activate a workspace (also in GitHub) that identifies the packages needed by the notebook. This wo…

---

## [How to define an element inside a structure with type 3x3 Matrix{Float64}](https://discourse.julialang.org/t/how-to-define-an-element-inside-a-structure-with-type-3x3-matrix-float64/68357)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 6\
**Last updated:** [September 17, 2021, 11:45pm UTC](https://discourse.julialang.org/t/how-to-define-an-element-inside-a-structure-with-type-3x3-matrix-float64/68357 "2021-09-17T23:45:20Z")

</div>

I need to define Ls to be of 3x3 Matrix{Float64}. I could write as below but it is not working, any idea to define this? mutable struct R Ls::Array{Float64, 3x3} = \[0,0,0; 0,0,0; 0,0,0\] Ls::Vector{Vector{Float6…

---

## [Julia folder size](https://discourse.julialang.org/t/julia-folder-size/68356)

<div class="topic-metadata">

**Author:** [@evad](https://discourse.julialang.org/u/evad)\
**Replies:** 4\
**Last updated:** [September 17, 2021, 11:32pm UTC](https://discourse.julialang.org/t/julia-folder-size/68356 "2021-09-17T23:32:03Z")

</div>

Can I ask why ~/.julia folder keeps on growing in size? I need to remove the ~/.julia folder and reinstall everything once in a while, to keep a small footprint… currently the folder is over 2.8G for 57 packages… whereas…

---

## [Set aspect ratio of Makie plot](https://discourse.julialang.org/t/set-aspect-ratio-of-makie-plot/20707)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 5\
**Last updated:** [September 17, 2021, 7:35pm UTC](https://discourse.julialang.org/t/set-aspect-ratio-of-makie-plot/20707 "2021-09-17T19:35:58Z")

</div>

I want to set the aspect ratio of a Makie.volume plot. It seems to be fixed by the number of voxels in each direction: using Makie volume(rand(32, 32, 64))

---

## [Julia bindings for ZStd](https://discourse.julialang.org/t/julia-bindings-for-zstd/68349)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 0\
**Last updated:** [September 17, 2021, 6:47pm UTC](https://discourse.julialang.org/t/julia-bindings-for-zstd/68349 "2021-09-17T18:47:29Z")

</div>

I’m building bindings for Zstd ( Zstandard - Real-time data compression algorithm ) using Clang.jl. I’ve currently put together as a pull request to @bicycle1885’s CodecZstd.jl. https://github.com/JuliaIO/CodecZstd.jl/p…

---

## [Specifying name of exported images in Literate.jl](https://discourse.julialang.org/t/specifying-name-of-exported-images-in-literate-jl/68348)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 0\
**Last updated:** [September 17, 2021, 6:29pm UTC](https://discourse.julialang.org/t/specifying-name-of-exported-images-in-literate-jl/68348 "2021-09-17T18:29:07Z")

</div>

Hello, I have followed the recommendation in Literate.jl’s docs to export plots as PNGs as follows p = plot(...) DisplayAs.PNG(p) which saves the figure and inserts the link. The trouble is that the image file has alw…

---

## [Hash function for immutable struct containing mutable vectors](https://discourse.julialang.org/t/hash-function-for-immutable-struct-containing-mutable-vectors/68326)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [September 17, 2021, 6:24pm UTC](https://discourse.julialang.org/t/hash-function-for-immutable-struct-containing-mutable-vectors/68326 "2021-09-17T18:24:45Z")

</div>

Suppose I have an immutable struct A containing immutable fields as well as a (mutable) vector of immutable objects (such as Int64 objects), struct A x::Int y::Vector{Int} end Does Julia automatically define se…

---

## [Performance of select! on a DataFrame](https://discourse.julialang.org/t/performance-of-select-on-a-dataframe/68343)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 2\
**Last updated:** [September 17, 2021, 4:12pm UTC](https://discourse.julialang.org/t/performance-of-select-on-a-dataframe/68343 "2021-09-17T16:12:50Z")

</div>

Naively I would expect that dropping columns (in place) from a DataFrame with select! would be a very cheap operation, on the order of nanoseconds. But I’m getting times in the microsecond range: julia\> using DataFrames…

---

## [A Recap of the state of the Symbolics ecosystem](https://discourse.julialang.org/t/a-recap-of-the-state-of-the-symbolics-ecosystem/68022)

<div class="topic-metadata">

**Author:** [@0x0f0f0f](https://discourse.julialang.org/u/0x0f0f0f)\
**Replies:** 7\
**Last updated:** [September 17, 2021, 3:52pm UTC](https://discourse.julialang.org/t/a-recap-of-the-state-of-the-symbolics-ecosystem/68022 "2021-09-17T15:52:24Z")

</div>

The introduction of TermInterface.jl has allowed for large potential in generalization of term rewriting and symbolic analysis and manipulation features. Also, it’s been a few months we’ve been talking about the integrat…

---

## [Threaded loop far slower than sequential loop (+ high compilation time)](https://discourse.julialang.org/t/threaded-loop-far-slower-than-sequential-loop-high-compilation-time/68338)

<div class="topic-metadata">

**Author:** [@StefanMathis](https://discourse.julialang.org/u/StefanMathis)\
**Replies:** 3\
**Last updated:** [September 17, 2021, 3:16pm UTC](https://discourse.julialang.org/t/threaded-loop-far-slower-than-sequential-loop-high-compilation-time/68338 "2021-09-17T15:16:32Z")

</div>

Hello, when trying to parallelize a loop, the performance got absolutely thrashed - roundabout by a factor of 1000. I tried to replicate the problem with a MWE and found something interesting: main() = loop(Vector{Floa…

---

## [HDF5 error occuring when using MAT package](https://discourse.julialang.org/t/hdf5-error-occuring-when-using-mat-package/68335)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 2\
**Last updated:** [September 17, 2021, 2:38pm UTC](https://discourse.julialang.org/t/hdf5-error-occuring-when-using-mat-package/68335 "2021-09-17T14:38:11Z")

</div>

I am getting the following error when trying to use the MAT package. I have no clue about how to interpret it. Any help would be appreciated. julia\> file = matopen("t.mat", "w"); HDF5-DIAG: Error detected in HDF5 (1.12.…

---

## [ProgressMeter on a @distributed for loop](https://discourse.julialang.org/t/progressmeter-on-a-distributed-for-loop/68315)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 2\
**Last updated:** [September 17, 2021, 2:18pm UTC](https://discourse.julialang.org/t/progressmeter-on-a-distributed-for-loop/68315 "2021-09-17T14:18:08Z")

</div>

Hi all, I am having trouble using ProgressMeter with a @distributed for loop. Here is an MWE Any ideas why this is not working?

---

## [UnitRange in 1.7-rc1, bug?](https://discourse.julialang.org/t/unitrange-in-1-7-rc1-bug/68327)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 7\
**Last updated:** [September 17, 2021, 2:01pm UTC](https://discourse.julialang.org/t/unitrange-in-1-7-rc1-bug/68327 "2021-09-17T14:01:37Z")

</div>

(1:5) .- 1/7 in 1.7-rc1 (Win64) gives 0.8571428571428572:1.0:3.857142857142857, while 1.6.2 gives (the more reasonable) 0.8571428571428572:1.0:4.857142857142858 Can anyone confirm? If so, I’ll file an issue.

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

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