# General Usage

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

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

**Page:** 110

---

## [Is there a way to force language server to re-index a package?](https://discourse.julialang.org/t/is-there-a-way-to-force-language-server-to-re-index-a-package/122947)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [November 24, 2024, 3:55pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-force-language-server-to-re-index-a-package/122947 "2024-11-24T15:55:05Z")

</div>

If I am working on a package and add new functions the language server does not index them, which means hovering over the name of this function in examples or tests shows nothing and goto definition does not work. The f…

---

## [New interpolation method ModelingToolkit](https://discourse.julialang.org/t/new-interpolation-method-modelingtoolkit/123000)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 4\
**Last updated:** [November 24, 2024, 11:30am UTC](https://discourse.julialang.org/t/new-interpolation-method-modelingtoolkit/123000 "2024-11-24T11:30:27Z")

</div>

I am trying to use the new interpolation method via parameters (Callable parameters and interpolating data · ModelingToolkit.jl) However I am struggling to understand how I should use it. This is my model: @mtkmodel Si…

---

## [Capturing "sub" dependencies during precompilation](https://discourse.julialang.org/t/capturing-sub-dependencies-during-precompilation/123013)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 0\
**Last updated:** [November 24, 2024, 10:46am UTC](https://discourse.julialang.org/t/capturing-sub-dependencies-during-precompilation/123013 "2024-11-24T10:46:50Z")

</div>

I have a package X which depends on Y which depends on Z. Z is not a direct dependency of X, and Y is done by a “third-party”, so I can’t influence it. I’m using some example code @compile\_workload, but still see a lot …

---

## [Adding a filter to open\_dialogue() in Gtk4](https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994)

<div class="topic-metadata">

**Author:** [@elwwan](https://discourse.julialang.org/u/elwwan)\
**Replies:** 1\
**Last updated:** [November 24, 2024, 1:24am UTC](https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994 "2024-11-24T01:24:43Z")

</div>

Hello, I’m trying to add a filter to a file selection. Here is my current code : function on\_choose\_file\_button\_click(w) open\_dialog("Choose Data File"; start\_folder = pwd()) do filename global data\_file\_path = f…

---

## [Using prettytables with Pluto](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 24\
**Last updated:** [November 23, 2024, 9:59pm UTC](https://discourse.julialang.org/t/using-prettytables-with-pluto/69895 "2024-11-23T21:59:13Z")

</div>

Hi all, PrettyTables for my custom type does not print out correctly in Pluto. It does work properly in the REPL however. I noticed that DataFrames uses PrettyTables and it works in Pluto. What is needed to get it to wo…

---

## [Pluto.jl 0.20.3 broken image plots](https://discourse.julialang.org/t/pluto-jl-0-20-3-broken-image-plots/123002)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 1\
**Last updated:** [November 23, 2024, 8:43pm UTC](https://discourse.julialang.org/t/pluto-jl-0-20-3-broken-image-plots/123002 "2024-11-23T20:43:55Z")

</div>

Hello, good evening. I recently update my packages, and pluto to 20.3 and I’m getting broken image plots like this May please someone help?

---

## [Help improving particle simulation on GPU](https://discourse.julialang.org/t/help-improving-particle-simulation-on-gpu/122733)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 0\
**Last updated:** [November 17, 2024, 8:23am UTC](https://discourse.julialang.org/t/help-improving-particle-simulation-on-gpu/122733 "2024-11-17T08:23:00Z")

</div>

Hi, I am trying to simulate particles on CUDA. I have a bottleneck and I am wondering if some of you have any advice. This is a MWE of a much more sophisticated example. Basically, I have a field of probabiblities dist…

---

## [Juliacall with SB3 for RL in WSL bings to segmetation fault problems](https://discourse.julialang.org/t/juliacall-with-sb3-for-rl-in-wsl-bings-to-segmetation-fault-problems/122989)

<div class="topic-metadata">

**Author:** [@Claudio](https://discourse.julialang.org/u/Claudio)\
**Replies:** 0\
**Last updated:** [November 23, 2024, 10:41am UTC](https://discourse.julialang.org/t/juliacall-with-sb3-for-rl-in-wsl-bings-to-segmetation-fault-problems/122989 "2024-11-23T10:41:49Z")

</div>

I am trying to train a RL agent using SB3, torch, and Gymnasium. I use a linux environment through wsl2 (Ubuntu-22.04), and VisualStudio Code. To speed up the step phase in my environment, I invoke Julia passing through …

---

## [How to wrap C++ function writing to FILE\*?](https://discourse.julialang.org/t/how-to-wrap-c-function-writing-to-file/122945)

<div class="topic-metadata">

**Author:** [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Replies:** 1\
**Last updated:** [November 22, 2024, 9:11pm UTC](https://discourse.julialang.org/t/how-to-wrap-c-function-writing-to-file/122945 "2024-11-22T21:11:53Z")

</div>

I want to wrap a C++ function writing to a file stream to be able to print to a file or to stdout (eventually I’d like to try if redirect\_stdout would work to make it print to a custom buffer). However, CxxWrap does not …

---

## [Transforming a daily DataFrame with missing values into a DataFrame with end-of-month values](https://discourse.julialang.org/t/transforming-a-daily-dataframe-with-missing-values-into-a-dataframe-with-end-of-month-values/122870)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 11\
**Last updated:** [November 22, 2024, 4:15pm UTC](https://discourse.julialang.org/t/transforming-a-daily-dataframe-with-missing-values-into-a-dataframe-with-end-of-month-values/122870 "2024-11-22T16:15:51Z")

</div>

I am trying to transform a daily DataFrame (df) into a monthly DataFrame (monthly\_df) with end-of-month values. The following code works: monthly\_df = df\[findall(date -\> date == lastdayofmonth(date), df.date), :\] Howev…

---

## [REPL hangs in Julia 1.11](https://discourse.julialang.org/t/repl-hangs-in-julia-1-11/122921)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 2\
**Last updated:** [November 22, 2024, 3:31am UTC](https://discourse.julialang.org/t/repl-hangs-in-julia-1-11/122921 "2024-11-22T03:31:16Z")

</div>

Hello, I’m experiencing some failures in compilation, the REPL freezes when executing this code: julia\> using Clapeyron julia\> model = PCSAFT("water"); julia\> saturation\_pressure(model, 298.0) #REPL freezes here Using…

---

## [How to simplify a symbolic expression](https://discourse.julialang.org/t/how-to-simplify-a-symbolic-expression/104381)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 11\
**Last updated:** [November 22, 2024, 3:46pm UTC](https://discourse.julialang.org/t/how-to-simplify-a-symbolic-expression/104381 "2024-11-22T15:46:16Z")

</div>

I want to simplify an expression by replacing a sub-expression with a new variable, called Q. The following code doesn’t work: # simplify an expression using Symbolics @variables t @syms ω(t) Pg(t) Pge(t) Pgc(t) @vari…

---

## [Out of VRAM (CUDA) when training MLJ + XGBoost.jl](https://discourse.julialang.org/t/out-of-vram-cuda-when-training-mlj-xgboost-jl/122966)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 0\
**Last updated:** [November 22, 2024, 3:41pm UTC](https://discourse.julialang.org/t/out-of-vram-cuda-when-training-mlj-xgboost-jl/122966 "2024-11-22T15:41:53Z")

</div>

Currently hitting out of memory when training AND inferecing. When it only fails on inference, it looks like this: XGBoostError: (caller: XGBoosterPredictFromDMatrix) \[14:54:49\] /workspace/srcdir/xgboost/src/c\_api/../d…

---

## [Performance detoriation with the increase of array size](https://discourse.julialang.org/t/performance-detoriation-with-the-increase-of-array-size/122364)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 13\
**Last updated:** [November 22, 2024, 10:48am UTC](https://discourse.julialang.org/t/performance-detoriation-with-the-increase-of-array-size/122364 "2024-11-22T10:48:38Z")

</div>

A MWE, in REPL, Julia 1.9.4: julia\> using BenchmarkTools julia\> function myset!(y, x, n, ind) @views for i = 1 : n x\[ind\[i\], :, :\] .= y\[:, :, i\] end …

---

## [CxxWrap module rely on external dll](https://discourse.julialang.org/t/cxxwrap-module-rely-on-external-dll/122917)

<div class="topic-metadata">

**Author:** [@Sergey](https://discourse.julialang.org/u/Sergey)\
**Replies:** 1\
**Last updated:** [November 22, 2024, 9:33am UTC](https://discourse.julialang.org/t/cxxwrap-module-rely-on-external-dll/122917 "2024-11-22T09:33:16Z")

</div>

Hi. Is it possible to develop CxxWrap module which depend on dll lib? Since we directly load dll in jl file and one dll cant load another. module CppTypes using CxxWrap @wrapmodule(() -\> "libcore.dll", :define…

---

## [Printing with nested indentation](https://discourse.julialang.org/t/printing-with-nested-indentation/122924)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 3\
**Last updated:** [November 22, 2024, 9:30am UTC](https://discourse.julialang.org/t/printing-with-nested-indentation/122924 "2024-11-22T09:30:07Z")

</div>

Is there some generic reusable solution for the problem of printing nested objects with indentation? For example a custom show method for an array-like type where each item should be printed with an indent. But the items…

---

## [Printing types: regular usage vs. jldoctests](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [November 21, 2024, 4:24pm UTC](https://discourse.julialang.org/t/printing-types-regular-usage-vs-jldoctests/122892 "2024-11-21T16:24:39Z")

</div>

When I use my package regularly, a data type is shown like this: julia\> using PDBTools julia\> ats = read\_pdb(PDBTools.TESTPDB) Vector{Atom{Nothing}} with 62026 atoms with fields: index name resname chain resnum…

---

## [Checked vs unchecked, e.g. (floored) divison](https://discourse.julialang.org/t/checked-vs-unchecked-e-g-floored-divison/122899)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [November 21, 2024, 4:07pm UTC](https://discourse.julialang.org/t/checked-vs-unchecked-e-g-floored-divison/122899 "2024-11-21T16:07:37Z")

</div>

Continuing the discussion from Why are there all these strange stumbling blocks in Julia?: I first continue, answer here by forking old discussion (by clicking corner in top left corner, for the first time, good to know…

---

## [Strange error message when using maximum()](https://discourse.julialang.org/t/strange-error-message-when-using-maximum/122889)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 9\
**Last updated:** [November 21, 2024, 1:54pm UTC](https://discourse.julialang.org/t/strange-error-message-when-using-maximum/122889 "2024-11-21T13:54:12Z")

</div>

Hello everyone, I encounter a strange error when using the maximum function on Julia v1.10.6. Let’s look at a variable Na, which is a vector of integers. Example code: println(Na) println(typeof(Na)) println(typeof(Na…

---

## [Specify loss function directly for NeuralPDE?](https://discourse.julialang.org/t/specify-loss-function-directly-for-neuralpde/77757)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 7\
**Last updated:** [November 21, 2024, 1:50pm UTC](https://discourse.julialang.org/t/specify-loss-function-directly-for-neuralpde/77757 "2024-11-21T13:50:39Z")

</div>

Hello, In NeuralPDE you normally define the PDE (lhs-rhs=0) symbolically and the loss function is built internally, loosely \\int dvars ||lhs(vars) - rhs(vars)||^2 . Is there a way to specify the objective function sy…

---

## [Downloading transformer weights](https://discourse.julialang.org/t/downloading-transformer-weights/122893)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [November 21, 2024, 12:26pm UTC](https://discourse.julialang.org/t/downloading-transformer-weights/122893 "2024-11-21T12:26:12Z")

</div>

I’d like to download the weighting matrices for an open source transformer model (BERT, GPT2…) and try and do the matrix equations from scatch in Julia. Any thoughts on the best way to do this? ChatGPT suggested eithe…

---

## [Idea: shortcut notation for Union{T, Nothing}](https://discourse.julialang.org/t/idea-shortcut-notation-for-union-t-nothing/71895)

<div class="topic-metadata">

**Author:** [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)\
**Replies:** 2\
**Last updated:** [November 21, 2024, 11:02am UTC](https://discourse.julialang.org/t/idea-shortcut-notation-for-union-t-nothing/71895 "2024-11-21T11:02:22Z")

</div>

It would be nice if Union{T, Nothing} could be notated as T? like in Kotlin, C# etc. Not necessary but nice to have. Makes the code more compact and readable.

---

## [Issue computing eigenvalues/vectors and orthonormalization](https://discourse.julialang.org/t/issue-computing-eigenvalues-vectors-and-orthonormalization/122835)

<div class="topic-metadata">

**Author:** [@Sparsetacus](https://discourse.julialang.org/u/Sparsetacus)\
**Replies:** 9\
**Last updated:** [November 21, 2024, 7:50am UTC](https://discourse.julialang.org/t/issue-computing-eigenvalues-vectors-and-orthonormalization/122835 "2024-11-21T07:50:46Z")

</div>

Hi there, I am having trouble to compute eigenvectors and orthonormalize them. I try to solve the generalized eigenvalues problem associated to matrices A and B. A is not symmetric; B is symmetric but not necessary de…

---

## [Figure not fitting in the frame with Plots.jl](https://discourse.julialang.org/t/figure-not-fitting-in-the-frame-with-plots-jl/122874)

<div class="topic-metadata">

**Author:** [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Replies:** 1\
**Last updated:** [November 21, 2024, 6:27am UTC](https://discourse.julialang.org/t/figure-not-fitting-in-the-frame-with-plots-jl/122874 "2024-11-21T06:27:49Z")

</div>

Hi, I’m making a figure with Plots.jl and GR backend. I have an issue as the figure does not fully fit in the frame: the colorbar annotations are cut out on the right side. Is there a simple workaround for this (els…

---

## [Useful "rules" for coding assistants](https://discourse.julialang.org/t/useful-rules-for-coding-assistants/122868)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 3\
**Last updated:** [November 21, 2024, 3:52am UTC](https://discourse.julialang.org/t/useful-rules-for-coding-assistants/122868 "2024-11-21T03:52:34Z")

</div>

Coding assistants Cursor (and recently Copilot) accept rules to guide responses. I’ve read that coding assistant results can be greatly improved with well defined rules. To that end I’d like to dedicate this thread to Ju…

---

## [Private states in Julia modules](https://discourse.julialang.org/t/private-states-in-julia-modules/1312)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 24\
**Last updated:** [November 20, 2024, 2:03pm UTC](https://discourse.julialang.org/t/private-states-in-julia-modules/1312 "2024-11-20T14:03:57Z")

</div>

Hi, I’m new to Julia, but with long strong background in object-oriented design. What I haven’t yet got my mind around is how to design a type with private state. An example might be an object containing a Dirty flag, i…

---

## [How can I convert a CompoundPeriod type object to Period type in Julia?](https://discourse.julialang.org/t/how-can-i-convert-a-compoundperiod-type-object-to-period-type-in-julia/60930)

<div class="topic-metadata">

**Author:** [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Replies:** 19\
**Last updated:** [November 20, 2024, 1:08pm UTC](https://discourse.julialang.org/t/how-can-i-convert-a-compoundperiod-type-object-to-period-type-in-julia/60930 "2024-11-20T13:08:45Z")

</div>

Using Dates module in Julia I am able to transform a Period type object (Hour, Minute, Second, Day etc.) to another Period type as below: using Dates julia\> convert(Day, Hour(96)) 4 days julia\> convert(Second, Hour(20…

---

## ["Keeping" precompilation of user defined code](https://discourse.julialang.org/t/keeping-precompilation-of-user-defined-code/122821)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 6\
**Last updated:** [November 20, 2024, 11:05am UTC](https://discourse.julialang.org/t/keeping-precompilation-of-user-defined-code/122821 "2024-11-20T11:05:10Z")

</div>

I have a tool/framework package that normally operates on “no-code” configuration files. Since users might need functionality that is not part of the core package at that time, the possibility exists to “load addons” dur…

---

## [Quiver plots using Plots.jl](https://discourse.julialang.org/t/quiver-plots-using-plots-jl/122841)

<div class="topic-metadata">

**Author:** [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Replies:** 0\
**Last updated:** [November 20, 2024, 10:17am UTC](https://discourse.julialang.org/t/quiver-plots-using-plots-jl/122841 "2024-11-20T10:17:48Z")

</div>

Dear all, Would anyone have an example of a quiver plot where the size of the arrowhead and length of the bar can be controlled? There are old threads about this issue and I did not want resurface them as this issue ma…

---

## [Literate.jl: treat comments as comments](https://discourse.julialang.org/t/literate-jl-treat-comments-as-comments/122832)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 2\
**Last updated:** [November 20, 2024, 8:11am UTC](https://discourse.julialang.org/t/literate-jl-treat-comments-as-comments/122832 "2024-11-20T08:11:49Z")

</div>

In Literate, if I have code like function foo(vec) # print the elements for x in vec print(x) end end Literate.markdown(; flavor=Literate.DocumenterFlavor()) will treat the comment as some separator…

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

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