# General Usage

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

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

**Page:** 510

---

## [Multiple dispatch: Value and type methods](https://discourse.julialang.org/t/multiple-dispatch-value-and-type-methods/72901)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 14\
**Last updated:** [December 10, 2021, 9:19pm UTC](https://discourse.julialang.org/t/multiple-dispatch-value-and-type-methods/72901 "2021-12-10T21:19:48Z")

</div>

I’ve found it very handy to sometimes define things like foo(x::T) = foo(T) function foo(::Type{T}) where {T} ... end I’ve heard suggestions that this is bad style, but to me it seems like a useful idiom for cases…

---

## [How to use the faster compressed registry on v1.7 after updating?](https://discourse.julialang.org/t/how-to-use-the-faster-compressed-registry-on-v1-7-after-updating/72401)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 6\
**Last updated:** [December 10, 2021, 7:22pm UTC](https://discourse.julialang.org/t/how-to-use-the-faster-compressed-registry-on-v1-7-after-updating/72401 "2021-12-10T19:22:59Z")

</div>

i read somewhere that if you are upgrading, to use the new registry you have to delete the old one, what does that mean?

---

## [Possible performance improvement in matrix multiplication involving a transpose and a complex matrix](https://discourse.julialang.org/t/possible-performance-improvement-in-matrix-multiplication-involving-a-transpose-and-a-complex-matrix/72813)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [December 10, 2021, 3:56pm UTC](https://discourse.julialang.org/t/possible-performance-improvement-in-matrix-multiplication-involving-a-transpose-and-a-complex-matrix/72813 "2021-12-10T15:56:58Z")

</div>

julia\> ZC = rand(1800, 1680); M = rand(ComplexF64, 1800, 1800); julia\> @time ZC' \* M; 9.169792 seconds (3 allocations: 46.143 MiB) julia\> @time permutedims(ZC) \* M; 0.877853 seconds (6 allocations: 115.357 MiB, 1.5…

---

## [We should have a function detecting if two numbers have the same sign](https://discourse.julialang.org/t/we-should-have-a-function-detecting-if-two-numbers-have-the-same-sign/72629)

<div class="topic-metadata">

**Author:** [@powerzf](https://discourse.julialang.org/u/powerzf)\
**Replies:** 13\
**Last updated:** [December 10, 2021, 2:55pm UTC](https://discourse.julialang.org/t/we-should-have-a-function-detecting-if-two-numbers-have-the-same-sign/72629 "2021-12-10T14:55:19Z")

</div>

We should have such a function！！ issign(x,y) issign(-1,1) --\>false issign(1,-1) --\>false issign(1,1) --\>true issign(-1,-1) --\>true

---

## [Solving a partial differential equation](https://discourse.julialang.org/t/solving-a-partial-differential-equation/72815)

<div class="topic-metadata">

**Author:** [@Physics\_Student](https://discourse.julialang.org/u/Physics_Student)\
**Replies:** 9\
**Last updated:** [December 10, 2021, 2:01pm UTC](https://discourse.julialang.org/t/solving-a-partial-differential-equation/72815 "2021-12-10T14:01:02Z")

</div>

Hi together, I want to solve the following partial differential equation numerically with Julia: d/dx f(x,y) = 1/y \* (y^2\* f(x,y) + d/dy f(x,y) + d^2/dy^2 f(x,y)) Has anyone an idea how to do this?

---

## [Incorrect concrete type for Vector{Pair{Any, Any}}?](https://discourse.julialang.org/t/incorrect-concrete-type-for-vector-pair-any-any/72885)

<div class="topic-metadata">

**Author:** [@anicusan](https://discourse.julialang.org/u/anicusan)\
**Replies:** 7\
**Last updated:** [December 10, 2021, 1:24pm UTC](https://discourse.julialang.org/t/incorrect-concrete-type-for-vector-pair-any-any/72885 "2021-12-10T13:24:03Z")

</div>

Hello, My question’s rather simple: julia\> \[1=\>2\] 1-element Vector{Pair{Int64, Int64}}: 1 =\> 2 julia\> \[1=\>2\] isa Vector{Pair{Any, Any}} false Why is Vector{Pair{Int64, Int64}} not a subtype of Vector{Pair{Any, Any}}?…

---

## ['Negative' UnitRange in Julia?](https://discourse.julialang.org/t/negative-unitrange-in-julia/72864)

<div class="topic-metadata">

**Author:** [@DorianT](https://discourse.julialang.org/u/DorianT)\
**Replies:** 6\
**Last updated:** [December 10, 2021, 11:01am UTC](https://discourse.julialang.org/t/negative-unitrange-in-julia/72864 "2021-12-10T11:01:02Z")

</div>

Today I came across some behaviour regarding UnitRanges that I did not quiet understand. I was hoping to find some enlightenment here :angel: The issues boils down to this behavior, below is some more context: julia\> 4…

---

## [Makie Animation](https://discourse.julialang.org/t/makie-animation/72869)

<div class="topic-metadata">

**Author:** [@vahhab70](https://discourse.julialang.org/u/vahhab70)\
**Replies:** 1\
**Last updated:** [December 10, 2021, 8:59am UTC](https://discourse.julialang.org/t/makie-animation/72869 "2021-12-10T08:59:54Z")

</div>

Hello, I highly appreciate it if anybody helps me. I want to generate an animation using GLMakie. It seems the previous frames remain in the video and frames are not updated. Any help would be appreciated. using GLMak…

---

## [MethodError: promote\_type error saving DataFrame to SQLite database](https://discourse.julialang.org/t/methoderror-promote-type-error-saving-dataframe-to-sqlite-database/72038)

<div class="topic-metadata">

**Author:** [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Replies:** 5\
**Last updated:** [December 10, 2021, 2:03am UTC](https://discourse.julialang.org/t/methoderror-promote-type-error-saving-dataframe-to-sqlite-database/72038 "2021-12-10T02:03:18Z")

</div>

My apologies that the MWE example is somewhat involved to setup. Overview: I’m loading a .csv file into a DataFrame, then I want to save that DataFrame to an SQLite database. I’m using Julia 1.6.2 (Windows). Preliminar…

---

## [Searchsortedlast performance](https://discourse.julialang.org/t/searchsortedlast-performance/72711)

<div class="topic-metadata">

**Author:** [@snowgum](https://discourse.julialang.org/u/snowgum)\
**Replies:** 43\
**Last updated:** [December 9, 2021, 9:57pm UTC](https://discourse.julialang.org/t/searchsortedlast-performance/72711 "2021-12-09T21:57:23Z")

</div>

I am trying to write a Julia port of the Weno4Interpolation python package, an algorithm based on Janett et al. (2019) to perform higher order interpolations. The code itself is not complex, but has many statements, mos…

---

## [Benchmark macro with BenchmarkTools](https://discourse.julialang.org/t/benchmark-macro-with-benchmarktools/72723)

<div class="topic-metadata">

**Author:** [@mattwigway](https://discourse.julialang.org/u/mattwigway)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 9:53pm UTC](https://discourse.julialang.org/t/benchmark-macro-with-benchmarktools/72723 "2021-12-09T21:53:51Z")

</div>

I’m benchmarking my package DiscreteChoiceModels.jl and comparing against other packages in R and Python. A significant entry point to the package is a macro which implements a domain-specific language to specify models.…

---

## [Where do I add a rationalize() function?](https://discourse.julialang.org/t/where-do-i-add-a-rationalize-function/72823)

<div class="topic-metadata">

**Author:** [@ayushsengupta8](https://discourse.julialang.org/u/ayushsengupta8)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 8:02pm UTC](https://discourse.julialang.org/t/where-do-i-add-a-rationalize-function/72823 "2021-12-09T20:02:16Z")

</div>

Can anyone provide me the exact file name in GitHub (also the folder which it is in) so that I can add a rationalize function in the code. P.S I am completely new to opensource that’s why I am not sure about this topic.…

---

## [I am unable to understand what the function below does, please help!](https://discourse.julialang.org/t/i-am-unable-to-understand-what-the-function-below-does-please-help/72847)

<div class="topic-metadata">

**Author:** [@ayushsengupta8](https://discourse.julialang.org/u/ayushsengupta8)\
**Replies:** 2\
**Last updated:** [December 9, 2021, 6:31pm UTC](https://discourse.julialang.org/t/i-am-unable-to-understand-what-the-function-below-does-please-help/72847 "2021-12-09T18:31:46Z")

</div>

function include(mod::Module, path::String) ccall(:jl\_array\_grow\_end, Cvoid, (Any, UInt), \_included\_files, UInt(1)) Core.arrayset(true, \_included\_files, (mod, ccall(:jl\_prepend\_cwd, Any, (Any,), path)), arraylen(\_i…

---

## [Allocations in advent of code](https://discourse.julialang.org/t/allocations-in-advent-of-code/72759)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 9\
**Last updated:** [December 9, 2021, 5:24pm UTC](https://discourse.julialang.org/t/allocations-in-advent-of-code/72759 "2021-12-09T17:24:44Z")

</div>

I was fiddling around with the super fun advent of code this year and got surprised by an allocation in the day 5 puzzle. input = \[3,4,3,1,2\] histogram = \[count(==(i),input) for i in 0:8\] phase(day) = mod(day-1,9)+1 @al…

---

## [Linking to MKL 2019 with AMD CPUs?](https://discourse.julialang.org/t/linking-to-mkl-2019-with-amd-cpus/71508)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 17\
**Last updated:** [December 9, 2021, 5:20pm UTC](https://discourse.julialang.org/t/linking-to-mkl-2019-with-amd-cpus/71508 "2021-12-09T17:20:12Z")

</div>

Question Does BinaryBuilder allow Ryzen/Threadripper owners to choose MKL 2019 as the binary to use for MKL.jl and MKLSparse.jl? Context Back in 2019 the MKL libraries had a “loophole” that allowed AMD CPUs to take adva…

---

## [Interpolate LaTeX and function call in markdown](https://discourse.julialang.org/t/interpolate-latex-and-function-call-in-markdown/72833)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 4:02pm UTC](https://discourse.julialang.org/t/interpolate-latex-and-function-call-in-markdown/72833 "2021-12-09T16:02:06Z")

</div>

Hi all, I was wondering how I can interpolate LaTeX and a function call in Pluto’s markdown. Suppose I have one cell θ = 1/3 And a markdown cell: md" $\\theta =$ = $round(θ, digits=2) " I tried adding \\ in several p…

---

## [Set function name](https://discourse.julialang.org/t/set-function-name/72810)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 3:56pm UTC](https://discourse.julialang.org/t/set-function-name/72810 "2021-12-09T15:56:34Z")

</div>

How can I define a function with a given name? let fname = :myfunction @eval quote function $(fname)() 42 end end end UndefVarError: fname not defined

---

## [Threads.@threads scheduling puzzle](https://discourse.julialang.org/t/threads-threads-scheduling-puzzle/72831)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 2\
**Last updated:** [December 9, 2021, 3:56pm UTC](https://discourse.julialang.org/t/threads-threads-scheduling-puzzle/72831 "2021-12-09T15:56:27Z")

</div>

Consider this function test(duration) Threads.@threads for i=1:length(duration) sleep(duration\[i\]) end end In my 2 core computer, 4 total threads with hyperthreading, running the above with julia\> @time test(\[…

---

## [Plots.jl: PGFPlotsX not defined](https://discourse.julialang.org/t/plots-jl-pgfplotsx-not-defined/72826)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 0\
**Last updated:** [December 9, 2021, 1:31pm UTC](https://discourse.julialang.org/t/plots-jl-pgfplotsx-not-defined/72826 "2021-12-09T13:31:09Z")

</div>

Since today I receive the following error message whenever I try to plot something using PGFPlotsX: ERROR: LoadError: UndefVarError: PGFPlotsX not defined Stacktrace: \[1\] top-level scope @ util.jl:500 Revise evaluat…

---

## [How to change the entire command line](https://discourse.julialang.org/t/how-to-change-the-entire-command-line/72824)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 2\
**Last updated:** [December 9, 2021, 1:45pm UTC](https://discourse.julialang.org/t/how-to-change-the-entire-command-line/72824 "2021-12-09T13:45:46Z")

</div>

Hello everyone, This might be a weird question, and I don’t know how to ask it properly, but I really would like to know how to change the text of a command line without using print(). A good example is in this video, …

---

## [Issues running Genie apps on JuliaHub](https://discourse.julialang.org/t/issues-running-genie-apps-on-juliahub/72809)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 12:51pm UTC](https://discourse.julialang.org/t/issues-running-genie-apps-on-juliahub/72809 "2021-12-09T12:51:07Z")

</div>

Apologies if this is not the right place to post - I’m following up on a Slack thread in the #juliahub-usage channel Slack Working on adding out-of-the-box support for Genie apps on JuliaHub but there seem to be issues …

---

## [Get function with macro](https://discourse.julialang.org/t/get-function-with-macro/72819)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [December 9, 2021, 12:34pm UTC](https://discourse.julialang.org/t/get-function-with-macro/72819 "2021-12-09T12:34:22Z")

</div>

How can I get the function object with a macro? module C macro getfunc(sig) name = sig.args\[1\] end export @method, @getfunc end module D using Main.C function foo() 1 end using Test @test (@getfunc foo()) ==…

---

## [Parsing Julia code with a large array is very slow or results in \`StackOverflowError\`](https://discourse.julialang.org/t/parsing-julia-code-with-a-large-array-is-very-slow-or-results-in-stackoverflowerror/72720)

<div class="topic-metadata">

**Author:** [@fingolfin](https://discourse.julialang.org/u/fingolfin)\
**Replies:** 24\
**Last updated:** [December 9, 2021, 10:04am UTC](https://discourse.julialang.org/t/parsing-julia-code-with-a-large-array-is-very-slow-or-results-in-stackoverflowerror/72720 "2021-12-09T10:04:43Z")

</div>

The following is based on a real world case, where I got a huge file with univariate polynomials in them, but I’ve tried to simplify it for easier reproduction. Note that in my original test case, I actually got a ReadOn…

---

## [Named argument variant of \`new\` or some other way to initialize a \`mutable struct\` efficiently \*and\* "readable"?](https://discourse.julialang.org/t/named-argument-variant-of-new-or-some-other-way-to-initialize-a-mutable-struct-efficiently-and-readable/72764)

<div class="topic-metadata">

**Author:** [@fingolfin](https://discourse.julialang.org/u/fingolfin)\
**Replies:** 14\
**Last updated:** [December 9, 2021, 9:20am UTC](https://discourse.julialang.org/t/named-argument-variant-of-new-or-some-other-way-to-initialize-a-mutable-struct-efficiently-and-readable/72764 "2021-12-09T09:20:43Z")

</div>

Consider a (mutable) struct with a bunch of members, and a constructor: mutable struct Foo x::Vector{Int} y::Vector{Int} z::Vector{Int} # ... here more members might come Foo() = new(\[1\], \[2\], \[3\]) end Now, a…

---

## [Is there anybody know why this kind of simple code cannot be run?](https://discourse.julialang.org/t/is-there-anybody-know-why-this-kind-of-simple-code-cannot-be-run/72795)

<div class="topic-metadata">

**Author:** [@Lyupinpin](https://discourse.julialang.org/u/Lyupinpin)\
**Replies:** 5\
**Last updated:** [December 9, 2021, 6:24am UTC](https://discourse.julialang.org/t/is-there-anybody-know-why-this-kind-of-simple-code-cannot-be-run/72795 "2021-12-09T06:24:43Z")

</div>

function test\_reason() for i = 1:10 if i == 1 x = 1 else x = x+1 end end end test\_reason() It seems that it has some scope problem but it’s strange that I have …

---

## [Unable to get the bandwith of a matrix](https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806)

<div class="topic-metadata">

**Author:** [@Rajesh\_Nakka](https://discourse.julialang.org/u/Rajesh_Nakka)\
**Replies:** 1\
**Last updated:** [December 9, 2021, 6:18am UTC](https://discourse.julialang.org/t/unable-to-get-the-bandwith-of-a-matrix/72806 "2021-12-09T06:18:29Z")

</div>

I am trying to get the bandwidth of a matrix using BandedMatrices.jl in the following manner. using BandedMatrices A = \[ 2.0 5.0 5.0 0.0 0.0 0.0 2.0 5.0 5.0 0.0 0.0 0.0 2.0 5.0 5.0 0.0 0.0 0.0 0.0 0.0 …

---

## [RESTful api with mTLS](https://discourse.julialang.org/t/restful-api-with-mtls/72797)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 0\
**Last updated:** [December 8, 2021, 11:51pm UTC](https://discourse.julialang.org/t/restful-api-with-mtls/72797 "2021-12-08T23:51:32Z")

</div>

I need to create a client/server system using RESTful api over mTLS. Is there a recommended Julia package (or packages) that support this functionality? Better yet, is there a code example? btw, my colleagues are expe…

---

## [Request for comments on approach to multithreaded work](https://discourse.julialang.org/t/request-for-comments-on-approach-to-multithreaded-work/72728)

<div class="topic-metadata">

**Author:** [@miguelbiron](https://discourse.julialang.org/u/miguelbiron)\
**Replies:** 2\
**Last updated:** [December 8, 2021, 11:00pm UTC](https://discourse.julialang.org/t/request-for-comments-on-approach-to-multithreaded-work/72728 "2021-12-08T23:00:35Z")

</div>

Hi, I’m developing a multithreaded version of a piece of software and already have a working solution. I just want to check if there is a simpler way of doing it. Basically, the problem can be reduced to this: suppose …

---

## [Splitting the PATH variable](https://discourse.julialang.org/t/splitting-the-path-variable/72735)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 6\
**Last updated:** [December 8, 2021, 10:46pm UTC](https://discourse.julialang.org/t/splitting-the-path-variable/72735 "2021-12-08T22:46:51Z")

</div>

I want to re-order path entries. On unix, ENV\["PATH"\] = "/usr/local/bin:/usr/bin:/bin" or some such. On windows, ENV\["PATH"\] = "c:\\\\usr\\\\local\\\\bin;c:\\\\usr\\\\bin;c:\\\\bin" But it could be ENV\["PATH"\] = "c:\\\\usr\\\\local\\…

---

## [Pluto and packages under development](https://discourse.julialang.org/t/pluto-and-packages-under-development/72768)

<div class="topic-metadata">

**Author:** [@threadedblue](https://discourse.julialang.org/u/threadedblue)\
**Replies:** 6\
**Last updated:** [December 8, 2021, 10:30pm UTC](https://discourse.julialang.org/t/pluto-and-packages-under-development/72768 "2021-12-08T22:30:16Z")

</div>

As I see it, a primary concern of Pluto is ensuring the shareability of notebooks. (There, I just invented a word.) And for this reason, Pluto requires packages to be registered. Am I not correct? However, sometimes an…

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

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