# General Usage

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

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

**Page:** 675

---

## [Is there a Julia implementation of BUGS (Bayesian inference Using Gibbs Sampling)?](https://discourse.julialang.org/t/is-there-a-julia-implementation-of-bugs-bayesian-inference-using-gibbs-sampling/50564)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [November 22, 2020, 6:07am UTC](https://discourse.julialang.org/t/is-there-a-julia-implementation-of-bugs-bayesian-inference-using-gibbs-sampling/50564 "2020-11-22T06:07:05Z")

</div>

As the subject says. Any hints appreciated.

---

## [Merge dataframes where one value is between two others](https://discourse.julialang.org/t/merge-dataframes-where-one-value-is-between-two-others/34738)

<div class="topic-metadata">

**Author:** [@junder873](https://discourse.julialang.org/u/junder873)\
**Replies:** 7\
**Last updated:** [November 22, 2020, 4:24am UTC](https://discourse.julialang.org/t/merge-dataframes-where-one-value-is-between-two-others/34738 "2020-11-22T04:24:53Z")

</div>

This question is very close to this Stackoverflow question. The primary issue is merging two dataframes with a restriction based on date ranges. This is a common issue in financial data, in my case, stock returns. The e…

---

## [Question about Franklin.jl](https://discourse.julialang.org/t/question-about-franklin-jl/50224)

<div class="topic-metadata">

**Author:** [@adeil](https://discourse.julialang.org/u/adeil)\
**Replies:** 10\
**Last updated:** [November 21, 2020, 8:12pm UTC](https://discourse.julialang.org/t/question-about-franklin-jl/50224 "2020-11-21T20:12:43Z")

</div>

I’m creating a website with Franklin.jl. However, after restarting my computer, the following message appears in the REPL when I try to modify the file: julia\> using Franklin julia\> serve() ┌ Franklin Warning: in \<conf…

---

## [Promotion rules for custom structs](https://discourse.julialang.org/t/promotion-rules-for-custom-structs/50548)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [November 21, 2020, 6:05pm UTC](https://discourse.julialang.org/t/promotion-rules-for-custom-structs/50548 "2020-11-21T18:05:24Z")

</div>

I have a custom struct Body (shown below). For another struct, I’d like to be able to keep vectors of Body variables, and I’d like to be able to promote Body{Float32} to Body{Float64}, Body{Float64} to Body{BigFloat}, et…

---

## [Comparing type precision](https://discourse.julialang.org/t/comparing-type-precision/50540)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [November 21, 2020, 5:06pm UTC](https://discourse.julialang.org/t/comparing-type-precision/50540 "2020-11-21T17:06:44Z")

</div>

I’m building a struct that takes a collection of elements, and I want the inner constructor to parameterize the struct by the element type of the collection. I showed what I’m looking for as the max\_precision function i…

---

## [Pkg update results in Unsatifiable requirements detected](https://discourse.julialang.org/t/pkg-update-results-in-unsatifiable-requirements-detected/50525)

<div class="topic-metadata">

**Author:** [@Phil\_Tomson](https://discourse.julialang.org/u/Phil_Tomson)\
**Replies:** 1\
**Last updated:** [November 21, 2020, 4:22pm UTC](https://discourse.julialang.org/t/pkg-update-results-in-unsatifiable-requirements-detected/50525 "2020-11-21T16:22:00Z")

</div>

It had been a while since I did a pkg update. I did one today and got: ERROR: Unsatisfiable requirements detected for package CuArrays \[3a865a2d\]: CuArrays \[3a865a2d\] log: ├─possible versions are: \[0.2.1, 0.3.0, 0.4.…

---

## [Using NL solver to find zeros](https://discourse.julialang.org/t/using-nl-solver-to-find-zeros/50323)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 9\
**Last updated:** [November 20, 2020, 5:17pm UTC](https://discourse.julialang.org/t/using-nl-solver-to-find-zeros/50323 "2020-11-20T17:17:51Z")

</div>

I was using Roots.jl for this sort of problem, and wanted to use ModelingTookit.jl or NLsolver.jl (the former uses the later). using ModelingToolkit ∂xf(x)=(2 \* x) \* inv(2 \* sqrt(3 + (x ^ 2))) nl\_f = @eval eval(∂xf\[.01\]…

---

## [Reusing eigendecomposition for matrix exponentials](https://discourse.julialang.org/t/reusing-eigendecomposition-for-matrix-exponentials/50528)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 6\
**Last updated:** [November 21, 2020, 1:32pm UTC](https://discourse.julialang.org/t/reusing-eigendecomposition-for-matrix-exponentials/50528 "2020-11-21T13:32:32Z")

</div>

Looking into the documentation, exp is using the eigen decomposition to calculate the exponetial exp(A) of a matrix A. Is there a function in Julia/BLAS to compute exp(c\*A) for a constant, possible imaginary, c for a lot…

---

## [AssertionError: IndexStyle(value) === IndexLinear() in loss function](https://discourse.julialang.org/t/assertionerror-indexstyle-value-indexlinear-in-loss-function/50531)

<div class="topic-metadata">

**Author:** [@praveen](https://discourse.julialang.org/u/praveen)\
**Replies:** 0\
**Last updated:** [November 21, 2020, 12:14pm UTC](https://discourse.julialang.org/t/assertionerror-indexstyle-value-indexlinear-in-loss-function/50531 "2020-11-21T12:14:37Z")

</div>

please anyone help me out not able to debug here is the code trying to create data on second order ode and then passing random parameter in equation and applying DiffEqFlux.sciml\_train to predict parameter using Diff…

---

## [How to do to shortly create for vector of dates range selector](https://discourse.julialang.org/t/how-to-do-to-shortly-create-for-vector-of-dates-range-selector/50512)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [November 21, 2020, 8:24am UTC](https://discourse.julialang.org/t/how-to-do-to-shortly-create-for-vector-of-dates-range-selector/50512 "2020-11-21T08:24:33Z")

</div>

julia\> m 6-element Array{Date,1}: 2017-03-01 2017-04-01 2017-05-01 2017-06-01 2017-07-01 2017-08-01 julia\> (m.\>Date("2017-04-01")) .& (m.\<Date("2017-08-01")) 6-element BitArray{1}: 0 0 1 1 1 0 something lik…

---

## [Use \`mitmproxy\` with Julia AWS.jl](https://discourse.julialang.org/t/use-mitmproxy-with-julia-aws-jl/50524)

<div class="topic-metadata">

**Author:** [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Replies:** 0\
**Last updated:** [November 21, 2020, 4:58am UTC](https://discourse.julialang.org/t/use-mitmproxy-with-julia-aws-jl/50524 "2020-11-21T04:58:11Z")

</div>

I was trying to use mitmproxy to debug a AWS connection issue, however it produces the following error, any idea why? ERROR: DNSError: , unknown node or service (EAI\_NONAME) Stacktrace: \[1\] getalladdrinfo(::String) at …

---

## [Hello. May someone explain me this expression? N = Int(1e3)](https://discourse.julialang.org/t/hello-may-someone-explain-me-this-expression-n-int-1e3/50520)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 4\
**Last updated:** [November 21, 2020, 12:51am UTC](https://discourse.julialang.org/t/hello-may-someone-explain-me-this-expression-n-int-1e3/50520 "2020-11-21T00:51:55Z")

</div>

I tryed reproduce this using 1\\euler3 unicode, without success. May someone help me to understand this expression?

---

## [Switch find-zero method if convergence fails without try-catch](https://discourse.julialang.org/t/switch-find-zero-method-if-convergence-fails-without-try-catch/50482)

<div class="topic-metadata">

**Author:** [@Jacob\_Stevens](https://discourse.julialang.org/u/Jacob_Stevens)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 11:18pm UTC](https://discourse.julialang.org/t/switch-find-zero-method-if-convergence-fails-without-try-catch/50482 "2020-11-20T23:18:30Z")

</div>

I have an inner loop which solves a simple equation using find\_zero(), currently with the default Order0() method at a plausible starting value. 99.99% of the time, this works smoothly with no issues. However, occasional…

---

## [Eachindex efficiency on row-major arrays](https://discourse.julialang.org/t/eachindex-efficiency-on-row-major-arrays/50511)

<div class="topic-metadata">

**Author:** [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 10:42pm UTC](https://discourse.julialang.org/t/eachindex-efficiency-on-row-major-arrays/50511 "2020-11-20T22:42:14Z")

</div>

I’m confused by these seemingly contradicting facts: From eachindex docstring: Create an iterable object for visiting each index of an AbstractArray A in an efficient manner (emphasize mine) A transposed view o…

---

## [Slow appendencode on Raspberry Pi](https://discourse.julialang.org/t/slow-appendencode-on-raspberry-pi/50504)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 3\
**Last updated:** [November 20, 2020, 5:56pm UTC](https://discourse.julialang.org/t/slow-appendencode-on-raspberry-pi/50504 "2020-11-20T17:56:57Z")

</div>

On a Raspberry Pi in the following MWE: using VideoIO, Dates, BenchmarkTools cam = VideoIO.opencamera() img = read(cam) filename = "video.mp4" framerate = 200 props = \[:priv\_data =\> ("crf"=\>"0","preset"=\>"ultrafast")\] e…

---

## [Scope Question (Maybe Bug?)](https://discourse.julialang.org/t/scope-question-maybe-bug/50500)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 9\
**Last updated:** [November 20, 2020, 3:39pm UTC](https://discourse.julialang.org/t/scope-question-maybe-bug/50500 "2020-11-20T15:39:23Z")

</div>

I have an example that has me confused about scope. I define a variable current\_header which is inside a for loop. My understanding is this variable should be in the scope of the for loop. Furthermore this example wor…

---

## [Best way to update Julia](https://discourse.julialang.org/t/best-way-to-update-julia/50483)

<div class="topic-metadata">

**Author:** [@Flock1](https://discourse.julialang.org/u/Flock1)\
**Replies:** 5\
**Last updated:** [November 20, 2020, 1:08pm UTC](https://discourse.julialang.org/t/best-way-to-update-julia/50483 "2020-11-20T13:08:44Z")

</div>

Hi, I want to know what’s the best way to update Julia? I used this as a reference and I realized that the path to Julia is not present in PATH environment variable. So I’ll probably need to uninstall Julia and install …

---

## [Testing function with "if @generated"?](https://discourse.julialang.org/t/testing-function-with-if-generated/17823)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 10\
**Last updated:** [November 20, 2020, 12:51pm UTC](https://discourse.julialang.org/t/testing-function-with-if-generated/17823 "2020-11-20T12:51:09Z")

</div>

How to I test both generated and non-generated implementation paths of a function that uses if @generated? I’m sure I saw something about it once, but I can’t find it again …

---

## [GitHub actions CI using CodeCov code coverage](https://discourse.julialang.org/t/github-actions-ci-using-codecov-code-coverage/50487)

<div class="topic-metadata">

**Author:** [@jhbdiehl](https://discourse.julialang.org/u/jhbdiehl)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 12:49pm UTC](https://discourse.julialang.org/t/github-actions-ci-using-codecov-code-coverage/50487 "2020-11-20T12:49:21Z")

</div>

I am currently trying to shift my Julia CI from Travis to GitHub actions (and am pretty new to the topic of CI). Any working workflow for implementing codecov.io usage for GitHub actions in a julia project is highly appr…

---

## [Pycall, Exception Handling of Python errors with Julia's \`try-catch\`](https://discourse.julialang.org/t/pycall-exception-handling-of-python-errors-with-julias-try-catch/50405)

<div class="topic-metadata">

**Author:** [@4aHxKzD](https://discourse.julialang.org/u/4aHxKzD)\
**Replies:** 3\
**Last updated:** [November 20, 2020, 10:55am UTC](https://discourse.julialang.org/t/pycall-exception-handling-of-python-errors-with-julias-try-catch/50405 "2020-11-20T10:55:04Z")

</div>

Assuming I have the following python code: import module as m try: # do something except (m.SomeError, ValueError) as err: # do other stuff And that I want to write it in Julia using PyCall, starting with: us…

---

## [Can I get the type of an inner function without calling the outer function?](https://discourse.julialang.org/t/can-i-get-the-type-of-an-inner-function-without-calling-the-outer-function/50417)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 6\
**Last updated:** [November 20, 2020, 6:26am UTC](https://discourse.julialang.org/t/can-i-get-the-type-of-an-inner-function-without-calling-the-outer-function/50417 "2020-11-20T06:26:19Z")

</div>

In the code below, bar is an inner function. I’d like to get its type from outside the outer function foo, but without calling foo. Is that possible? function foo() bar() = 1 end T = typeof(foo()) # var"#bar#8" # …

---

## [Julia's assignment behavior differs from Fortran?](https://discourse.julialang.org/t/julias-assignment-behavior-differs-from-fortran/50389)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 47\
**Last updated:** [November 20, 2020, 6:14am UTC](https://discourse.julialang.org/t/julias-assignment-behavior-differs-from-fortran/50389 "2020-11-20T06:14:55Z")

</div>

When I was first starting I was horrified by this, when trying to literally translate Fortran to Julia: julia\> function f() local x = Vector{Float64}(undef,3) local y = Vector{Float64}(undef,3) …

---

## [How do I implement recursive interpolation ($) for string macros?](https://discourse.julialang.org/t/how-do-i-implement-recursive-interpolation-for-string-macros/50444)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 4\
**Last updated:** [November 20, 2020, 2:57am UTC](https://discourse.julialang.org/t/how-do-i-implement-recursive-interpolation-for-string-macros/50444 "2020-11-20T02:57:49Z")

</div>

Could Meta.parse grow an option to re-use $ interpolation semantics within a string macro? I’m trying to replicate functionality of Mike Bostock’s Hyper Text Literal only ported to Julia (HypertextLiteral.jl). Specific…

---

## [This code do not works anymore after julia 1.5.3 update](https://discourse.julialang.org/t/this-code-do-not-works-anymore-after-julia-1-5-3-update/50452)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 13\
**Last updated:** [November 19, 2020, 7:12pm UTC](https://discourse.julialang.org/t/this-code-do-not-works-anymore-after-julia-1-5-3-update/50452 "2020-11-19T19:12:24Z")

</div>

Hello, good day. I updated my environment to julia 1.5.3 and a lot of project I had stoped work. This code do not works anymore. Someone knows why it stoped work? setosa\_df = iris\[iris\[:species\] .== "setosa", :\] ERR…

---

## [Help debugging an error with Zygote](https://discourse.julialang.org/t/help-debugging-an-error-with-zygote/50411)

<div class="topic-metadata">

**Author:** [@ElOceanografo](https://discourse.julialang.org/u/ElOceanografo)\
**Replies:** 1\
**Last updated:** [November 19, 2020, 5:37pm UTC](https://discourse.julialang.org/t/help-debugging-an-error-with-zygote/50411 "2020-11-19T17:37:54Z")

</div>

Hoping someone who understands autodiff better than I do can help me figure out what’s going on here. I’ve got a function that calls ldl from LDLFactorizations.jl, and then does further calculations on a field of the LD…

---

## [Forced recompilation](https://discourse.julialang.org/t/forced-recompilation/27367)

<div class="topic-metadata">

**Author:** [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Replies:** 7\
**Last updated:** [November 19, 2020, 5:07pm UTC](https://discourse.julialang.org/t/forced-recompilation/27367 "2020-11-19T17:07:18Z")

</div>

Is it possible to force Julia to recompile cached code? Background: I need to upload packages with unregistered dependencies to a remote machine. If I develop these packages locally, Manifest.toml points to a directory…

---

## [\`cat\` allocates too much memory](https://discourse.julialang.org/t/cat-allocates-too-much-memory/50443)

<div class="topic-metadata">

**Author:** [@ArthurW](https://discourse.julialang.org/u/ArthurW)\
**Replies:** 11\
**Last updated:** [November 19, 2020, 4:50pm UTC](https://discourse.julialang.org/t/cat-allocates-too-much-memory/50443 "2020-11-19T16:50:54Z")

</div>

Hi. I’m new to Julia language. I’m trying to convert a big vector of small arrays into a tensor, but cat() is drawing too much resources. julia\> A = \[rand(Int, (28,28)) for \_ ∈ 1:10000\]; julia\> @time cat(A..., dims=3)…

---

## [Unexpected speed difference for differently chained functions](https://discourse.julialang.org/t/unexpected-speed-difference-for-differently-chained-functions/50427)

<div class="topic-metadata">

**Author:** [@Phypix](https://discourse.julialang.org/u/Phypix)\
**Replies:** 3\
**Last updated:** [November 19, 2020, 4:23pm UTC](https://discourse.julialang.org/t/unexpected-speed-difference-for-differently-chained-functions/50427 "2020-11-19T16:23:23Z")

</div>

I want to chain several to be applied element-wise on an array. I have first used the default approach with f(A) = @. f1(f2(A)). However I noticed, that by defining the captures c1 = x -\> f1.(x) and c2 = x -\> f2.(x) and…

---

## [SDE with diagonal noise](https://discourse.julialang.org/t/sde-with-diagonal-noise/50420)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 4\
**Last updated:** [November 19, 2020, 1:31pm UTC](https://discourse.julialang.org/t/sde-with-diagonal-noise/50420 "2020-11-19T13:31:53Z")

</div>

I am trying to solve the following SDE: du=f(u,p,t)dt+\\sigma dW, where f(u,p,t) can be written as following: function f(du,u,p,t) #calculate the derivative of the vector at time j p=0.0 for i=1:Nx if i==2 …

---

## [Svdvals is inefficient for tall matrices](https://discourse.julialang.org/t/svdvals-is-inefficient-for-tall-matrices/50330)

<div class="topic-metadata">

**Author:** [@JeffFessler](https://discourse.julialang.org/u/JeffFessler)\
**Replies:** 2\
**Last updated:** [November 19, 2020, 2:46pm UTC](https://discourse.julialang.org/t/svdvals-is-inefficient-for-tall-matrices/50330 "2020-11-19T14:46:08Z")

</div>

For a tall matrix X, calling svdvals(X) directly is noticeably slower than calling it on svdvals(X'X) despite the overhead of the extra matrix-matrix multiply: using BenchmarkTools: @btime using LinearAlgebra: svdvals X…

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

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