# General Usage

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

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

**Page:** 202

---

## [Why this specific package I created will not be added in a new PC?](https://discourse.julialang.org/t/why-this-specific-package-i-created-will-not-be-added-in-a-new-pc/110077)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 3\
**Last updated:** [February 11, 2024, 8:50pm UTC](https://discourse.julialang.org/t/why-this-specific-package-i-created-will-not-be-added-in-a-new-pc/110077 "2024-02-11T20:50:20Z")

</div>

I got a fast new PC and was excited about developing Julia with it. I managed to install the standard packages and a couple of my own packages. One package I developed, called Utils.jl will not load, with the message bel…

---

## [Nanmean options?](https://discourse.julialang.org/t/nanmean-options/4994)

<div class="topic-metadata">

**Author:** [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Replies:** 17\
**Last updated:** [February 11, 2024, 6:50pm UTC](https://discourse.julialang.org/t/nanmean-options/4994 "2024-02-11T18:50:40Z")

</div>

Up until Julia 0.6 mean ignored NaN’s. What are the options for those of us that want a simple nanmean function? Somewhere I remember seeing an alternative function in Base but I haven’t been able to find it again. The…

---

## [MySQL Cursor](https://discourse.julialang.org/t/mysql-cursor/110075)

<div class="topic-metadata">

**Author:** [@Pino](https://discourse.julialang.org/u/Pino)\
**Replies:** 0\
**Last updated:** [February 11, 2024, 6:49pm UTC](https://discourse.julialang.org/t/mysql-cursor/110075 "2024-02-11T18:49:20Z")

</div>

Hi, I’m trying to loop through exsisting SQL tables to retrieve the balance at a certain report date. query\_data = "SELECT \`date\`, \`balance\` FROM $table\_name" # Execute the query data = DBInterface.execute(con…

---

## [Optimize code which uses KernelAbstractions.jl](https://discourse.julialang.org/t/optimize-code-which-uses-kernelabstractions-jl/110068)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 1\
**Last updated:** [February 11, 2024, 5:29pm UTC](https://discourse.julialang.org/t/optimize-code-which-uses-kernelabstractions-jl/110068 "2024-02-11T17:29:57Z")

</div>

Hi, in RadonKA.jl I just launch the kernel with the following code: \[....\] kernel! = radon\_kernel!(backend) kernel!(sinogram::AbstractArray{T}, img, weights, in\_height, out\_height, angles, mid, rad…

---

## [Julia crashes for larger PINNs?](https://discourse.julialang.org/t/julia-crashes-for-larger-pinns/109714)

<div class="topic-metadata">

**Author:** [@georgegito](https://discourse.julialang.org/u/georgegito)\
**Replies:** 6\
**Last updated:** [February 11, 2024, 3:49pm UTC](https://discourse.julialang.org/t/julia-crashes-for-larger-pinns/109714 "2024-02-11T15:49:27Z")

</div>

Hello, I am trying to train a PINN using NeuralPDE. I use the example of the documentation (Introduction to NeuralPDE for PDEs · NeuralPDE.jl) and when I try to increase the network size, the performance struggles and Ju…

---

## [Help me optimize my special solution to save VTP (VTK) file?](https://discourse.julialang.org/t/help-me-optimize-my-special-solution-to-save-vtp-vtk-file/110064)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [February 11, 2024, 2:39pm UTC](https://discourse.julialang.org/t/help-me-optimize-my-special-solution-to-save-vtp-vtk-file/110064 "2024-02-11T14:39:52Z")

</div>

Hello! Lately I’ve learned a lot from all of you guys on the forum on how to write performant code and reduce allocs/type instabilities, which has been really nice. I have a case where I want to save a lot of simulation…

---

## [Problem with GRU and LSTM Layers in Flux](https://discourse.julialang.org/t/problem-with-gru-and-lstm-layers-in-flux/110060)

<div class="topic-metadata">

**Author:** [@LucaGeminiani00](https://discourse.julialang.org/u/LucaGeminiani00)\
**Replies:** 0\
**Last updated:** [February 11, 2024, 11:14am UTC](https://discourse.julialang.org/t/problem-with-gru-and-lstm-layers-in-flux/110060 "2024-02-11T11:14:21Z")

</div>

I have built a Time series forecasting model in Flux.jl including an LSTM layer (the problem is the same also when I include a GRU layer). I am able to train the model without errors. However, when I try to run: model(va…

---

## [Bug in Julia or in a package](https://discourse.julialang.org/t/bug-in-julia-or-in-a-package/110043)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [February 11, 2024, 8:35am UTC](https://discourse.julialang.org/t/bug-in-julia-or-in-a-package/110043 "2024-02-11T08:35:16Z")

</div>

The following bug was closed with the comment it would be a Julia bug: I am not convinced that this is a bug in Julia, I think it is a bug in a package. What do you think?

---

## [Metalhead.UNet output array limit](https://discourse.julialang.org/t/metalhead-unet-output-array-limit/110029)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 2\
**Last updated:** [February 10, 2024, 11:24pm UTC](https://discourse.julialang.org/t/metalhead-unet-output-array-limit/110029 "2024-02-10T23:24:01Z")

</div>

Cheers, Would like to confirm if the yhat array output of Metalhead.UNet model is limited to \[0:1\] elements. Apparently its upper bound is higher than 1. Model is instantiated as follows: backbone = Metalhead.backbon…

---

## [If I have a string such as, "Float64", can I convert it to the Julia DataType?](https://discourse.julialang.org/t/if-i-have-a-string-such-as-float64-can-i-convert-it-to-the-julia-datatype/110035)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 8\
**Last updated:** [February 10, 2024, 10:26pm UTC](https://discourse.julialang.org/t/if-i-have-a-string-such-as-float64-can-i-convert-it-to-the-julia-datatype/110035 "2024-02-10T22:26:40Z")

</div>

Basically, if I have my type written in a string format, can I convert it to the actual DataType inside of Julia? Kind regards

---

## [Random number generation](https://discourse.julialang.org/t/random-number-generation/110010)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 19\
**Last updated:** [February 10, 2024, 10:42pm UTC](https://discourse.julialang.org/t/random-number-generation/110010 "2024-02-10T22:42:48Z")

</div>

Why do I get different result when I run the rand command twice with the same seed in the Julia REPL? using Random using Distributions rng = MersenneTwister(1234) rand(rng) # outputs 0.5908446386657102 #run again ran…

---

## [Behavior of \`fieldtypes\` applied to \`Tuple{...}\`](https://discourse.julialang.org/t/behavior-of-fieldtypes-applied-to-tuple/110030)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 2\
**Last updated:** [February 10, 2024, 6:42pm UTC](https://discourse.julialang.org/t/behavior-of-fieldtypes-applied-to-tuple/110030 "2024-02-10T18:42:50Z")

</div>

Here is the docstring for fieldtypes: fieldtypes(T::Type) The declared types of all fields in a composite DataType T as a tuple. Examples ≡≡≡≡≡≡≡≡≡≡ julia\> struct Foo x::Int64 y::String e…

---

## [How to add Juliaup to path?](https://discourse.julialang.org/t/how-to-add-juliaup-to-path/110005)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [February 10, 2024, 6:35pm UTC](https://discourse.julialang.org/t/how-to-add-juliaup-to-path/110005 "2024-02-10T18:35:59Z")

</div>

Windows pc decided to suddenly cleanse some environment variables. How can I add it again? I tried reinstalling juliaup, nothing happened. Kind regards

---

## [Error mySQL connect](https://discourse.julialang.org/t/error-mysql-connect/110031)

<div class="topic-metadata">

**Author:** [@Pino](https://discourse.julialang.org/u/Pino)\
**Replies:** 1\
**Last updated:** [February 10, 2024, 4:42pm UTC](https://discourse.julialang.org/t/error-mysql-connect/110031 "2024-02-10T16:42:14Z")

</div>

I’m using Julia 1.8.5 and I’m trying to operate on a mysql database. When I try to use the below string I get a UndefVarError:mysql\_connect. I wonder if there’s a compatibility problem because the code I’m using seems l…

---

## [Do-block syntax with keyword arguments](https://discourse.julialang.org/t/do-block-syntax-with-keyword-arguments/101111)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [February 10, 2024, 1:37pm UTC](https://discourse.julialang.org/t/do-block-syntax-with-keyword-arguments/101111 "2024-02-10T13:37:26Z")

</div>

Is is possible to use the do syntax with keyword arguments? MWE: just\_call(f, args...; kwargs...) = f(args...; kwargs...) # lambda just\_call((x; z) -\> @show(x, z), 1; z = 2) # do just\_call(1; z = 2) do x; z @show …

---

## [Checking if a name is an alias](https://discourse.julialang.org/t/checking-if-a-name-is-an-alias/110024)

<div class="topic-metadata">

**Author:** [@putianyi888](https://discourse.julialang.org/u/putianyi888)\
**Replies:** 1\
**Last updated:** [February 10, 2024, 11:31am UTC](https://discourse.julialang.org/t/checking-if-a-name-is-an-alias/110024 "2024-02-10T11:31:29Z")

</div>

I’m looking for a more external/generic way to achieve sourcetypename(type::UnionAll) = sourcetypename(type.body) sourcetypename(type::DataType) = type.name.name isnotalias(type) = string(type) == string(sourcetypename(…

---

## [Using LBFGS to train Flux models](https://discourse.julialang.org/t/using-lbfgs-to-train-flux-models/109942)

<div class="topic-metadata">

**Author:** [@gradureau](https://discourse.julialang.org/u/gradureau)\
**Replies:** 10\
**Last updated:** [February 10, 2024, 7:25am UTC](https://discourse.julialang.org/t/using-lbfgs-to-train-flux-models/109942 "2024-02-10T07:25:14Z")

</div>

Hey everyone, I have found out that using LBFGS is quite used in the Physics-Informed Neural Networks and I am wondering it it is interesting to use it for usual MLPs. Is there a way to use it in Flux? Thank you for yo…

---

## [Why is the bounds-checking not elided in isassigned for \`SlowSubArray\`s despite an inbounds annotation?](https://discourse.julialang.org/t/why-is-the-bounds-checking-not-elided-in-isassigned-for-slowsubarray-s-despite-an-inbounds-annotation/110019)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [February 10, 2024, 7:12am UTC](https://discourse.julialang.org/t/why-is-the-bounds-checking-not-elided-in-isassigned-for-slowsubarray-s-despite-an-inbounds-annotation/110019 "2024-02-10T07:12:03Z")

</div>

Function definition julia\> function mycopyto!(dest::AbstractArray, src::AbstractArray) iterdest, itersrc = eachindex(dest), eachindex(src) @inbounds for I in iterdest if isassigned(s…

---

## [Performance tips for Union Types](https://discourse.julialang.org/t/performance-tips-for-union-types/13928)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 6\
**Last updated:** [February 9, 2024, 10:57pm UTC](https://discourse.julialang.org/t/performance-tips-for-union-types/13928 "2024-02-09T22:57:35Z")

</div>

As I’ve summed up from the scattered discourse posts, the Julia compiler has been optimised for the small Union Types. Yet, it seems, there is no information about it in the Julia docs (I’ve searched in the Performance …

---

## [Dictionary lookup errors when the struct contains empty vectors](https://discourse.julialang.org/t/dictionary-lookup-errors-when-the-struct-contains-empty-vectors/109965)

<div class="topic-metadata">

**Author:** [@kangboli](https://discourse.julialang.org/u/kangboli)\
**Replies:** 6\
**Last updated:** [February 9, 2024, 10:31pm UTC](https://discourse.julialang.org/t/dictionary-lookup-errors-when-the-struct-contains-empty-vectors/109965 "2024-02-09T22:31:49Z")

</div>

I’m running into a problem with Dict and I think it could be a bug? Julia’s documentation says that the implementation of Dict uses hash as the hashing function for the key, and isequal to determine equality, but the fol…

---

## [Transformations in ArnoldiMethod.jl](https://discourse.julialang.org/t/transformations-in-arnoldimethod-jl/109953)

<div class="topic-metadata">

**Author:** [@densmojd](https://discourse.julialang.org/u/densmojd)\
**Replies:** 2\
**Last updated:** [February 9, 2024, 7:21pm UTC](https://discourse.julialang.org/t/transformations-in-arnoldimethod-jl/109953 "2024-02-09T19:21:55Z")

</div>

I have a question about the documentation of “transformations” (i.e., multiplying the inverse of a matrix times a vector without explicitly forming the inverse) in ArnoldiMethod.jl, although I think the topic is of broad…

---

## [Underscore syntax and anonymous modules?](https://discourse.julialang.org/t/underscore-syntax-and-anonymous-modules/110003)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 1\
**Last updated:** [February 9, 2024, 6:18pm UTC](https://discourse.julialang.org/t/underscore-syntax-and-anonymous-modules/110003 "2024-02-09T18:18:59Z")

</div>

So I can’t do module \_ end? Is that still consistent with “syntax requires a variable but the variable is never used”? It would be useful in creating different namespaces.

---

## [Usage rules for bare underscores](https://discourse.julialang.org/t/usage-rules-for-bare-underscores/28858)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 13\
**Last updated:** [April 20, 2022, 11:58pm UTC](https://discourse.julialang.org/t/usage-rules-for-bare-underscores/28858 "2022-04-20T23:58:35Z")

</div>

I’ve seen a few examples where one can use a bare underscore in an expression, e.g., julia\> map(\_ -\> "hello", 1:4) 4-element Array{String,1}: "hello" "hello" "hello" "hello" julia\> \["hello" for \_ in 1:4\] 4-element …

---

## [Why do hash functions use xor to combine multiple values?](https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967)

<div class="topic-metadata">

**Author:** [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Replies:** 11\
**Last updated:** [February 9, 2024, 5:15pm UTC](https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967 "2024-02-09T17:15:24Z")

</div>

Continuing the discussion from Dictionary lookup errors when the struct contains empty vectors: Usually in these hash function one sees xor being used to combine the results of multiple values. I myself usually also us…

---

## [Compiling julia code into static binary](https://discourse.julialang.org/t/compiling-julia-code-into-static-binary/109996)

<div class="topic-metadata">

**Author:** [@gradureau](https://discourse.julialang.org/u/gradureau)\
**Replies:** 0\
**Last updated:** [February 9, 2024, 4:58pm UTC](https://discourse.julialang.org/t/compiling-julia-code-into-static-binary/109996 "2024-02-09T16:58:18Z")

</div>

Hey everyone, I have a program that uses julia modules and I would like to generate a binary that could be used independently. I have seen some posts on the matter that don’t give me the solution I am looking for and s…

---

## [PDE system in Acasual modeling](https://discourse.julialang.org/t/pde-system-in-acasual-modeling/109990)

<div class="topic-metadata">

**Author:** [@Sushrut\_Deshpande](https://discourse.julialang.org/u/Sushrut_Deshpande)\
**Replies:** 1\
**Last updated:** [February 9, 2024, 4:35pm UTC](https://discourse.julialang.org/t/pde-system-in-acasual-modeling/109990 "2024-02-09T16:35:58Z")

</div>

Hello, Thank you for making modeling toolkit. I really enjoy it!! I wanted to know if there is any elegant/simple way to model PDE systems inside “acasual modeling” method of Modelingtoolkit? I can generally solve P…

---

## [Array addition in Enzyme](https://discourse.julialang.org/t/array-addition-in-enzyme/109901)

<div class="topic-metadata">

**Author:** [@jwalker](https://discourse.julialang.org/u/jwalker)\
**Replies:** 7\
**Last updated:** [February 9, 2024, 3:13pm UTC](https://discourse.julialang.org/t/array-addition-in-enzyme/109901 "2024-02-09T15:13:07Z")

</div>

There are a couple of issues in here, but they’re related in how I discovered them. In attempting to test Enzyme on some basic vector operations, I came across a problem with derivatives of the addition function. In par…

---

## [Running a Julia script from MATLAB using system()](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 1\
**Last updated:** [February 9, 2024, 3:08pm UTC](https://discourse.julialang.org/t/running-a-julia-script-from-matlab-using-system/109931 "2024-02-09T15:08:26Z")

</div>

Hello, I’m trying to run a Julia .jl script in a MATLAB program using the system command. The script runs perfectly fine, when I attempt to do so from the terminal, but I get a segmentation fault when I try to run it th…

---

## [Can this be written even faster? (CPU)](https://discourse.julialang.org/t/can-this-be-written-even-faster-cpu/109924)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 34\
**Last updated:** [February 9, 2024, 2:24pm UTC](https://discourse.julialang.org/t/can-this-be-written-even-faster-cpu/109924 "2024-02-09T14:24:35Z")

</div>

Hello! My usual experience has been that when I think something is as fast as I think it can be, then someone shows me how to do it even faster :slight\_smile: I’ve made a script attached below with a serial version and…

---

## [Case-insensitive prefix/suffix stripping](https://discourse.julialang.org/t/case-insensitive-prefix-suffix-stripping/109871)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 13\
**Last updated:** [February 8, 2024, 10:30pm UTC](https://discourse.julialang.org/t/case-insensitive-prefix-suffix-stripping/109871 "2024-02-08T22:30:19Z")

</div>

Sure, but where’s the fun in that? What’s not fun, is it’s kind of broken… I would want chopsuffix and chopprefix to work, well according to my definition, be able to to do e.g.: chopprefix(s, "http://", "https://")…

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

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