# General Usage

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

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

**Page:** 254

---

## [Method for Base.\* when at least one argument is of a given type](https://discourse.julialang.org/t/method-for-base-when-at-least-one-argument-is-of-a-given-type/103277)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [August 28, 2023, 9:49am UTC](https://discourse.julialang.org/t/method-for-base-when-at-least-one-argument-is-of-a-given-type/103277 "2023-08-28T09:49:53Z")

</div>

Suppose I want to define a vararg method for Base.\* which is invoked when at least one argument is of a given type Foo (for the purposes of this discussion, struct Foo end suffices). What’s the recommended way of doing …

---

## [Very strange timing results with StaticArrays](https://discourse.julialang.org/t/very-strange-timing-results-with-staticarrays/103269)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 4\
**Last updated:** [August 28, 2023, 9:35am UTC](https://discourse.julialang.org/t/very-strange-timing-results-with-staticarrays/103269 "2023-08-28T09:35:26Z")

</div>

Running Julia 1.9.3 on an M2 MacBook Air, macOS Ventura 13.4.1. Performing almost any operation requiring a moderate to large StaticArray is extremely slow. I mean extremely slow, measurable in tens of minutes. And this …

---

## [Fatal: error thrown and no exception handler available for a \* method](https://discourse.julialang.org/t/fatal-error-thrown-and-no-exception-handler-available-for-a-method/103275)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [August 28, 2023, 8:34am UTC](https://discourse.julialang.org/t/fatal-error-thrown-and-no-exception-handler-available-for-a-method/103275 "2023-08-28T08:34:05Z")

</div>

This is an MWE simplified from some code that tries to implement \* for a type and AbstractStrings. In this MWE, the intention is to return a Foo whenever any argument is a Foo. Is this a bug, or user error? I think that…

---

## [Forward compatibility and stability of Julia vs. Packages](https://discourse.julialang.org/t/forward-compatibility-and-stability-of-julia-vs-packages/97968)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 97\
**Last updated:** [August 27, 2023, 7:36pm UTC](https://discourse.julialang.org/t/forward-compatibility-and-stability-of-julia-vs-packages/97968 "2023-08-27T19:36:32Z")

</div>

Totally agree that it’s not common, but: It depends! Take a scenario where you have a project confirmed working, with a set of versions: Julia 1.x.y, PackageA 0.x.y, PackageB 1.x.y, … . And you want to update one of …

---

## [How to determine the methods for a callable object without instantiating it?](https://discourse.julialang.org/t/how-to-determine-the-methods-for-a-callable-object-without-instantiating-it/102618)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 18\
**Last updated:** [August 27, 2023, 2:30pm UTC](https://discourse.julialang.org/t/how-to-determine-the-methods-for-a-callable-object-without-instantiating-it/102618 "2023-08-27T14:30:30Z")

</div>

Suppose I have the following: struct A{T} x::T end (a::A)(y) = a.x+y Then I can say julia\> a = A(1); methods(a) # 1 method for callable object: \[1\] (a::A)(y) @ Main REPL\[2\]:1 This list only depends on the type …

---

## [Package addition/tweaking system](https://discourse.julialang.org/t/package-addition-tweaking-system/103253)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 0\
**Last updated:** [August 27, 2023, 10:29am UTC](https://discourse.julialang.org/t/package-addition-tweaking-system/103253 "2023-08-27T10:29:10Z")

</div>

Imagine there was a package A, which was incomplete for all use cases, but then, you want to add tweaks to it for your use, so you might add some methods to the package function for some compatibility with package B, but…

---

## [\`push!\` semantics](https://discourse.julialang.org/t/push-semantics/103234)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 5\
**Last updated:** [August 27, 2023, 2:53am UTC](https://discourse.julialang.org/t/push-semantics/103234 "2023-08-27T02:53:35Z")

</div>

It doesn’t seem to me the behavior of push!, as seen in the program below, is clear from the documentation. Should I file an issue about it, or is this just my confusion? Specifically, I wasn’t sure whether the Vector …

---

## [Why is converting from a type to a symbol so slow?](https://discourse.julialang.org/t/why-is-converting-from-a-type-to-a-symbol-so-slow/103212)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 7\
**Last updated:** [August 26, 2023, 9:18pm UTC](https://discourse.julialang.org/t/why-is-converting-from-a-type-to-a-symbol-so-slow/103212 "2023-08-26T21:18:23Z")

</div>

I was experimenting with the sort function where I gave to the by keyword a type related to each element of the array, but types can’t be compared with each others. So I tried to convert the type to a symbol, but it was …

---

## [What is the meaning of the @overlay macro?](https://discourse.julialang.org/t/what-is-the-meaning-of-the-overlay-macro/103222)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [August 26, 2023, 8:56pm UTC](https://discourse.julialang.org/t/what-is-the-meaning-of-the-overlay-macro/103222 "2023-08-26T20:56:22Z")

</div>

I saw this here: allow \`@overlay\` for methods with return type declaration by aviatesk · Pull Request #51054 · JuliaLang/julia · GitHub But I could not find any documentation about it. Does someone know?

---

## [How to check if variable is a typed global?](https://discourse.julialang.org/t/how-to-check-if-variable-is-a-typed-global/103172)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 5\
**Last updated:** [August 26, 2023, 8:18pm UTC](https://discourse.julialang.org/t/how-to-check-if-variable-is-a-typed-global/103172 "2023-08-26T20:18:58Z")

</div>

(other then try to assign a wrong-typed value and catch the error)

---

## [Tab views in GLMakie](https://discourse.julialang.org/t/tab-views-in-glmakie/103227)

<div class="topic-metadata">

**Author:** [@tgf314](https://discourse.julialang.org/u/tgf314)\
**Replies:** 1\
**Last updated:** [August 26, 2023, 7:15pm UTC](https://discourse.julialang.org/t/tab-views-in-glmakie/103227 "2023-08-26T19:15:38Z")

</div>

I’d like to implement a tab view using GLMakie. By that I mean an area of a layout with a row of buttons that can select from a set of items (for example Axis objects) to display in the view. Since I’m not sure of the …

---

## [Map a vector to multiple vectors](https://discourse.julialang.org/t/map-a-vector-to-multiple-vectors/103156)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 13\
**Last updated:** [August 26, 2023, 4:45pm UTC](https://discourse.julialang.org/t/map-a-vector-to-multiple-vectors/103156 "2023-08-26T16:45:41Z")

</div>

Is there a simple way to map a vector to multiple vectors? vin = \[1,2,3,4\] v1, v2, v3 = map(v) do x return x, 2x, 3x end The above doesn’t work, but that shows what I mean. Usually, you’d get a vector of tuples from …

---

## [How to reset camera in Makie/GLMakie](https://discourse.julialang.org/t/how-to-reset-camera-in-makie-glmakie/103220)

<div class="topic-metadata">

**Author:** [@tgf314](https://discourse.julialang.org/u/tgf314)\
**Replies:** 2\
**Last updated:** [August 26, 2023, 3:59pm UTC](https://discourse.julialang.org/t/how-to-reset-camera-in-makie-glmakie/103220 "2023-08-26T15:59:35Z")

</div>

Specifically I am plotting an image on an Axis using image!. I can can zoom and pan with mouse but I want to create a function to reset the camera to its initial state. What is a good way to do that ?

---

## [Universal Time vs UTC Time in Dates](https://discourse.julialang.org/t/universal-time-vs-utc-time-in-dates/103204)

<div class="topic-metadata">

**Author:** [@barrettp](https://discourse.julialang.org/u/barrettp)\
**Replies:** 11\
**Last updated:** [August 26, 2023, 9:03am UTC](https://discourse.julialang.org/t/universal-time-vs-utc-time-in-dates/103204 "2023-08-26T09:03:26Z")

</div>

Are you sure you mean UT/UT1 and not UTC, because all computer clocks are synchronized using NTP which uses UTC as its time standard. So when you ask the computer for the date you are getting UTC, not UT1. Does that mea…

---

## [How to canonically load and run user-provided functions from a file?](https://discourse.julialang.org/t/how-to-canonically-load-and-run-user-provided-functions-from-a-file/103180)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 2\
**Last updated:** [August 26, 2023, 6:06am UTC](https://discourse.julialang.org/t/how-to-canonically-load-and-run-user-provided-functions-from-a-file/103180 "2023-08-26T06:06:39Z")

</div>

Let’s consider a Julia package OurPackage.jl that creates a long-running process. In this process, from time to time we want to load a user-provided file and execute a function implemented in it. For example, the user wo…

---

## [Why is inplace addition to array slice allocating?](https://discourse.julialang.org/t/why-is-inplace-addition-to-array-slice-allocating/103214)

<div class="topic-metadata">

**Author:** [@jeffreyesun](https://discourse.julialang.org/u/jeffreyesun)\
**Replies:** 2\
**Last updated:** [August 26, 2023, 3:18am UTC](https://discourse.julialang.org/t/why-is-inplace-addition-to-array-slice-allocating/103214 "2023-08-26T03:18:44Z")

</div>

I found an allocation in my code I wasn’t expecting. It happens when I do inplace addition .+= to a slice of an array. Consider the following: foo = zeros(3,3,3) function test1(foo) foo\[1,:,1\] .+= 2 return noth…

---

## [Enable all functions to work on element of new type](https://discourse.julialang.org/t/enable-all-functions-to-work-on-element-of-new-type/103210)

<div class="topic-metadata">

**Author:** [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Replies:** 2\
**Last updated:** [August 25, 2023, 11:09pm UTC](https://discourse.julialang.org/t/enable-all-functions-to-work-on-element-of-new-type/103210 "2023-08-25T23:09:54Z")

</div>

If I make a new struct that contains a certain type (a DataFrame in below example) like: struct StructContainingDataFrame df::DataFrame something\_else::Any end Is it then possible to make this work with all fun…

---

## [How to hide a type parameter?](https://discourse.julialang.org/t/how-to-hide-a-type-parameter/103187)

<div class="topic-metadata">

**Author:** [@ColinCaine](https://discourse.julialang.org/u/ColinCaine)\
**Replies:** 4\
**Last updated:** [August 25, 2023, 9:59pm UTC](https://discourse.julialang.org/t/how-to-hide-a-type-parameter/103187 "2023-08-25T21:59:51Z")

</div>

It’s not a big deal, but I’d kinda like to hide a type parameter of a struct. The value of this parameter is determined from the value of the other parameters. Here’s a small example including working and unexpectedly b…

---

## [Why is it so complicated to access a row in a DataFrame?](https://discourse.julialang.org/t/why-is-it-so-complicated-to-access-a-row-in-a-dataframe/103162)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 12\
**Last updated:** [August 25, 2023, 9:25pm UTC](https://discourse.julialang.org/t/why-is-it-so-complicated-to-access-a-row-in-a-dataframe/103162 "2023-08-25T21:25:43Z")

</div>

Hello, This question has already been asked several times (here for example How to set a index in Julia's DataFrame? - Stack Overflow) but I still don’t understand why DataFrame.jl doesn’t have an index\_col parameter li…

---

## [Finite hlines in Plot? Plots.jl](https://discourse.julialang.org/t/finite-hlines-in-plot-plots-jl/103189)

<div class="topic-metadata">

**Author:** [@abehersan](https://discourse.julialang.org/u/abehersan)\
**Replies:** 1\
**Last updated:** [August 25, 2023, 9:19pm UTC](https://discourse.julialang.org/t/finite-hlines-in-plot-plots-jl/103189 "2023-08-25T21:19:03Z")

</div>

Is there a function similar to hline! but defined only over a finite x-range? I.e. something like: hline!(\[3\], \[-1, 0\]) Where a line would be plotted at y=3 from x=-1 to x=0. I am aware this can be done simply by plot…

---

## [Help with creating binaries](https://discourse.julialang.org/t/help-with-creating-binaries/103142)

<div class="topic-metadata">

**Author:** [@Rajender\_Mudigonda](https://discourse.julialang.org/u/Rajender_Mudigonda)\
**Replies:** 1\
**Last updated:** [August 25, 2023, 8:47pm UTC](https://discourse.julialang.org/t/help-with-creating-binaries/103142 "2023-08-25T20:47:55Z")

</div>

HI I am trying to create binary for the jl package… by wrapping in a c code, and loading a custom sysimage… using gcc -DJULIAC\_PROGRAM\_LIBNAME="taxpayer.so" -D\_WIN32 -o MyApp MyApp.c taxpayer.so -O2 -fPIE -I"E:/Program…

---

## [How to split initial conditions across multiple timesteps](https://discourse.julialang.org/t/how-to-split-initial-conditions-across-multiple-timesteps/103199)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 1\
**Last updated:** [August 25, 2023, 7:07pm UTC](https://discourse.julialang.org/t/how-to-split-initial-conditions-across-multiple-timesteps/103199 "2023-08-25T19:07:06Z")

</div>

I have a differential equation ddf = f/x^2 - df/x - k\*f^2/x and I’d know f(0) = 0 and df(1) = 1. How can I tell DifferentialEquations.jl about those initial conditions?

---

## [List files in a directory, meeting certain conditions](https://discourse.julialang.org/t/list-files-in-a-directory-meeting-certain-conditions/103197)

<div class="topic-metadata">

**Author:** [@chadagreene](https://discourse.julialang.org/u/chadagreene)\
**Replies:** 2\
**Last updated:** [August 25, 2023, 5:50pm UTC](https://discourse.julialang.org/t/list-files-in-a-directory-meeting-certain-conditions/103197 "2023-08-25T17:50:40Z")

</div>

In MATLAB, I can list all the files in a directory like this: f = dir('/Users/myname/path'); and I can limit results to the files that meet certain conditions like this: f = dir('/Users/myname/path/StartsWith\*.txt');…

---

## [Multithreaded LIBSVM and XGBoost crashing](https://discourse.julialang.org/t/multithreaded-libsvm-and-xgboost-crashing/103179)

<div class="topic-metadata">

**Author:** [@dbass](https://discourse.julialang.org/u/dbass)\
**Replies:** 7\
**Last updated:** [August 25, 2023, 5:02pm UTC](https://discourse.julialang.org/t/multithreaded-libsvm-and-xgboost-crashing/103179 "2023-08-25T17:02:34Z")

</div>

Hello, I would like to perform crossvalidation and grid search using SVM (and XGBoost), using a parameter grid defined for each method. In MATLAB, within each split, I can run parfor, and each thread will train some mo…

---

## [Developing multiple packages in the same repository](https://discourse.julialang.org/t/developing-multiple-packages-in-the-same-repository/103191)

<div class="topic-metadata">

**Author:** [@joh](https://discourse.julialang.org/u/joh)\
**Replies:** 0\
**Last updated:** [August 25, 2023, 2:30pm UTC](https://discourse.julialang.org/t/developing-multiple-packages-in-the-same-repository/103191 "2023-08-25T14:30:11Z")

</div>

What is the recommended workflow to work on multiple packages that belong to the same repository? An example is POMDPs.jl which consists of POMDPs.jl and the subpackage POMDPTools.jl, which is located at lib/POMDPTools. …

---

## [Reduce type inference when using nested ForwardDiff](https://discourse.julialang.org/t/reduce-type-inference-when-using-nested-forwarddiff/103181)

<div class="topic-metadata">

**Author:** [@Vik1](https://discourse.julialang.org/u/Vik1)\
**Replies:** 0\
**Last updated:** [August 25, 2023, 9:03am UTC](https://discourse.julialang.org/t/reduce-type-inference-when-using-nested-forwarddiff/103181 "2023-08-25T09:03:51Z")

</div>

Hi Julia wizards, I am calculating derivatives wrt. different arguments of a function. Unfortunately, the compilation time in my actual use case is very high due to type inference. I had a quick fix, that reduced it, bu…

---

## [Trying to make multithreading to work on applying a function number of times](https://discourse.julialang.org/t/trying-to-make-multithreading-to-work-on-applying-a-function-number-of-times/103124)

<div class="topic-metadata">

**Author:** [@ahmed](https://discourse.julialang.org/u/ahmed)\
**Replies:** 11\
**Last updated:** [August 25, 2023, 7:51am UTC](https://discourse.julialang.org/t/trying-to-make-multithreading-to-work-on-applying-a-function-number-of-times/103124 "2023-08-25T07:51:37Z")

</div>

I have a function F that does some computations on its input arrays. First I’m trying to see if I can make this function as fast as possible as this function will be computed 50 times in one of possibly many iterations s…

---

## [Float64 Lux model (Loss stuck at 1e-8)](https://discourse.julialang.org/t/float64-lux-model-loss-stuck-at-1e-8/103135)

<div class="topic-metadata">

**Author:** [@Baba\_Yara\_Fahiz](https://discourse.julialang.org/u/Baba_Yara_Fahiz)\
**Replies:** 1\
**Last updated:** [August 24, 2023, 7:28pm UTC](https://discourse.julialang.org/t/float64-lux-model-loss-stuck-at-1e-8/103135 "2023-08-24T19:28:05Z")

</div>

It’s very easy to convert a Flux model to Float64 using code like so: model = Chain(Dense(N, 32, tanh), Dense(32, 16, tanh), Dense(16, 8, tanh), Dense(8, 1, s…

---

## [Adaptation of NLsolve for function with vector output](https://discourse.julialang.org/t/adaptation-of-nlsolve-for-function-with-vector-output/103139)

<div class="topic-metadata">

**Author:** [@Outeirom](https://discourse.julialang.org/u/Outeirom)\
**Replies:** 4\
**Last updated:** [August 24, 2023, 8:07pm UTC](https://discourse.julialang.org/t/adaptation-of-nlsolve-for-function-with-vector-output/103139 "2023-08-24T20:07:56Z")

</div>

I’m facing an issue with NLSolve. I have two interacting functions that are working well, and I need to adapt them. Let me briefly summarize how the functions are currently set up and what I’m aiming to achieve. Firstly…

---

## [Style: include tests in source files?](https://discourse.julialang.org/t/style-include-tests-in-source-files/103161)

<div class="topic-metadata">

**Author:** [@bcon](https://discourse.julialang.org/u/bcon)\
**Replies:** 5\
**Last updated:** [August 24, 2023, 7:12pm UTC](https://discourse.julialang.org/t/style-include-tests-in-source-files/103161 "2023-08-24T19:12:36Z")

</div>

In a typical Julia package, tests are separated from the source files leading, I’d argue, to the omission of tests and a slower development cycle. I would rather include function tests in the same file and adjacent to t…

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

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