# General Usage

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

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

**Page:** 453

---

## [Code running on local Julia, but failing on CI tests with Ububtu\_latest and Windows\_latest](https://discourse.julialang.org/t/code-running-on-local-julia-but-failing-on-ci-tests-with-ububtu-latest-and-windows-latest/80638)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 5\
**Last updated:** [May 8, 2022, 1:15pm UTC](https://discourse.julialang.org/t/code-running-on-local-julia-but-failing-on-ci-tests-with-ububtu-latest-and-windows-latest/80638 "2022-05-08T13:15:33Z")

</div>

The following code is running correctly on my machine using LinearAlgebra using ApproxFun Af = Fun(t -\> \[0 1; -10\*cos(t) -24-10\*sin(t)\],Fourier(0..2π)); D = Derivative(domain(Af)); ND = \[D 0I; 0I D\]; Aop = Af - ND; NA =…

---

## [Import a module only when needed](https://discourse.julialang.org/t/import-a-module-only-when-needed/80654)

<div class="topic-metadata">

**Author:** [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Replies:** 5\
**Last updated:** [May 8, 2022, 11:34am UTC](https://discourse.julialang.org/t/import-a-module-only-when-needed/80654 "2022-05-08T11:34:04Z")

</div>

As a strategy for reducing using SomePkg latency, is it possible for a package to import a module in a lazy way, only when some functionality is required? Something similar to what Requires.jl, but where the user doesn’…

---

## [HMAC\_SHA256 not matching in Julia and python](https://discourse.julialang.org/t/hmac-sha256-not-matching-in-julia-and-python/73873)

<div class="topic-metadata">

**Author:** [@AMJ](https://discourse.julialang.org/u/AMJ)\
**Replies:** 4\
**Last updated:** [May 8, 2022, 11:28am UTC](https://discourse.julialang.org/t/hmac-sha256-not-matching-in-julia-and-python/73873 "2022-05-08T11:28:08Z")

</div>

I have to encode a pass phrase with a “api secret” in SHA256 then base encode64 and send it to the rest api server but I can not manage to match what I get out of python with Julia. This is the python code import hmac …

---

## [How does Experimental.@force\_compile work?](https://discourse.julialang.org/t/how-does-experimental-force-compile-work/80681)

<div class="topic-metadata">

**Author:** [@xlxs4](https://discourse.julialang.org/u/xlxs4)\
**Replies:** 0\
**Last updated:** [May 7, 2022, 9:00pm UTC](https://discourse.julialang.org/t/how-does-experimental-force-compile-work/80681 "2022-05-07T21:00:31Z")

</div>

So I was playing around with @edit: @edit @time exp(1) In the definition of the time macro, timing.jl, line 216: while false; end # compiler heuristic: compile this block (alter this if the heuristic changes) I follo…

---

## [Installing Packages Julia v1.7.2](https://discourse.julialang.org/t/installing-packages-julia-v1-7-2/80678)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [May 7, 2022, 8:06pm UTC](https://discourse.julialang.org/t/installing-packages-julia-v1-7-2/80678 "2022-05-07T20:06:21Z")

</div>

Dear all, I m a new user of Julia Language. I have installed Julia 1.7.2 and Atom. However, when I run Julia, the following credentials of Github are requested to install the initial packages: Updating git-repo \`ht…

---

## [Embedding pkg SatelliteToolbox in a Cpp software](https://discourse.julialang.org/t/embedding-pkg-satellitetoolbox-in-a-cpp-software/80679)

<div class="topic-metadata">

**Author:** [@guitarti87](https://discourse.julialang.org/u/guitarti87)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 7:55pm UTC](https://discourse.julialang.org/t/embedding-pkg-satellitetoolbox-in-a-cpp-software/80679 "2022-05-07T19:55:33Z")

</div>

Hello all, I am wondering if anyone could help me. I am new to Julia language and it is being quiete difficult to understand how to embed julia in a cpp code. What I am trying is to use the pkg SatelliteToolbox from ju…

---

## [Create matrix from two vectors](https://discourse.julialang.org/t/create-matrix-from-two-vectors/80651)

<div class="topic-metadata">

**Author:** [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Replies:** 6\
**Last updated:** [May 7, 2022, 7:12pm UTC](https://discourse.julialang.org/t/create-matrix-from-two-vectors/80651 "2022-05-07T19:12:25Z")

</div>

After defining a bivariate function f(x::Int, y::Int) , how can I get a matrix A = ( f(a\[i\], b\[j\]) ) using two vector a and b . For example, let a = \[1, 2\] , b = \[1, 2, 3\] and f(x, y) = x + y , the desirble result shoul…

---

## [Stuck trying to register updates](https://discourse.julialang.org/t/stuck-trying-to-register-updates/80673)

<div class="topic-metadata">

**Author:** [@Rratic](https://discourse.julialang.org/u/Rratic)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 5:33pm UTC](https://discourse.julialang.org/t/stuck-trying-to-register-updates/80673 "2022-05-07T17:33:16Z")

</div>

guys, this is the situation: when I first registered, the version was 1.0.0-alpha, which might be a little strange I tried 1.0.0 pull but it didn’t tell me the reason it failed to merge, and I didn’t understand the ERR…

---

## [Equivalent of hyp2f1 in Julia](https://discourse.julialang.org/t/equivalent-of-hyp2f1-in-julia/80674)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 3:22pm UTC](https://discourse.julialang.org/t/equivalent-of-hyp2f1-in-julia/80674 "2022-05-07T15:22:32Z")

</div>

I am translating some Python code to Julia that uses the SciPy function hyp2f1. What would be the equivalent function in Julia? https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.hyp2f1.html

---

## [Does Searchlight ORM have relationships?](https://discourse.julialang.org/t/does-searchlight-orm-have-relationships/80660)

<div class="topic-metadata">

**Author:** [@Xergon](https://discourse.julialang.org/u/Xergon)\
**Replies:** 1\
**Last updated:** [May 7, 2022, 12:23pm UTC](https://discourse.julialang.org/t/does-searchlight-orm-have-relationships/80660 "2022-05-07T12:23:27Z")

</div>

Hey all, Does Searchlight have active support for relational databases? I know it has a Relationships module but the usage is not very clear. If so, can you explain a bit? I am very new to the genie ecosystem and my ex…

---

## [Useful: How to check the parameters that can be used by a function](https://discourse.julialang.org/t/useful-how-to-check-the-parameters-that-can-be-used-by-a-function/80659)

<div class="topic-metadata">

**Author:** [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Replies:** 0\
**Last updated:** [May 7, 2022, 11:24am UTC](https://discourse.julialang.org/t/useful-how-to-check-the-parameters-that-can-be-used-by-a-function/80659 "2022-05-07T11:24:04Z")

</div>

Sometimes I create functions that receive a function as parameter, but in Julia the type is Function without any information, so when the function pass as parameter is not right, the error message is not very informative…

---

## [Working with \`LinearAlgebra.mul!\`](https://discourse.julialang.org/t/working-with-linearalgebra-mul/80649)

<div class="topic-metadata">

**Author:** [@sinecera10](https://discourse.julialang.org/u/sinecera10)\
**Replies:** 12\
**Last updated:** [May 7, 2022, 11:42am UTC](https://discourse.julialang.org/t/working-with-linearalgebra-mul/80649 "2022-05-07T11:42:30Z")

</div>

Reposting a reddit post here to solicit comments from the Julia community. I may have chanced upon a bug? According to reddit users No-Distribution4263 and Foura5 both foo! and bar! should result in an error. But the cas…

---

## [Weave hangs when I tried it](https://discourse.julialang.org/t/weave-hangs-when-i-tried-it/38483)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 10:38am UTC](https://discourse.julialang.org/t/weave-hangs-when-i-tried-it/38483 "2022-05-07T10:38:35Z")

</div>

I tried the following code from the document. (weave) pkg\> st Status \`~/Work/weave/Project.toml\` \[717857b8\] DSP v0.6.6 \[91a5bcdd\] Plots v1.2.0 \[44d3d7a6\] Weave v0.9.4 julia\> using Weave julia\> weave(joinpath(dir…

---

## [Optimizing over an integral that is computed with simulation](https://discourse.julialang.org/t/optimizing-over-an-integral-that-is-computed-with-simulation/80646)

<div class="topic-metadata">

**Author:** [@samerb](https://discourse.julialang.org/u/samerb)\
**Replies:** 2\
**Last updated:** [May 7, 2022, 3:47am UTC](https://discourse.julialang.org/t/optimizing-over-an-integral-that-is-computed-with-simulation/80646 "2022-05-07T03:47:21Z")

</div>

If g(x)\\equiv \\int h(\\tau) dF(\\tau) is a multi-dimensional integral which I’d need Monte Carlo integration to compute, is there a good way to optimize the function g(\\cdot)? Would standard optimization routines (from e.…

---

## [How to reopen a shared library?](https://discourse.julialang.org/t/how-to-reopen-a-shared-library/80642)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 0\
**Last updated:** [May 7, 2022, 12:41am UTC](https://discourse.julialang.org/t/how-to-reopen-a-shared-library/80642 "2022-05-07T00:41:56Z")

</div>

I’m using a shared library by ccall in my code, it works fine as long as the library does not change. However, if I’ve used the library in Julia REPL, then changed c source code and recompiled the library, the Julia REP…

---

## [Calling struct fields with symbol or string](https://discourse.julialang.org/t/calling-struct-fields-with-symbol-or-string/80633)

<div class="topic-metadata">

**Author:** [@stephans3](https://discourse.julialang.org/u/stephans3)\
**Replies:** 3\
**Last updated:** [May 7, 2022, 12:21am UTC](https://discourse.julialang.org/t/calling-struct-fields-with-symbol-or-string/80633 "2022-05-07T00:21:51Z")

</div>

Hi all, I got to the problem how to call field names in a struct automatically with symbols or strings. This can be solved manually with if-else-constructions but is quite long and error-prone. Beside some related top…

---

## [Why can't Enums be #undef?](https://discourse.julialang.org/t/why-cant-enums-be-undef/80635)

<div class="topic-metadata">

**Author:** [@janneshb](https://discourse.julialang.org/u/janneshb)\
**Replies:** 8\
**Last updated:** [May 6, 2022, 11:14pm UTC](https://discourse.julialang.org/t/why-cant-enums-be-undef/80635 "2022-05-06T23:14:40Z")

</div>

When trying to initialize Enum as #undef it instead goes into an invalid state by adopting an arbitrary integer. Consider the following example: julia\> @enum Fruit Apple Banana Peach julia\> struct Basket{T} …

---

## [Next portable Julia in VSCode](https://discourse.julialang.org/t/next-portable-julia-in-vscode/80626)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 11\
**Last updated:** [May 6, 2022, 9:40pm UTC](https://discourse.julialang.org/t/next-portable-julia-in-vscode/80626 "2022-05-06T21:40:45Z")

</div>

https://github.com/PetrKryslUCSD/VSCode\_Julia\_portable The whole package consists of a couple of scripts that install Git and a working Julia and preconfigured VSCode. Everything is confined to a single folder (includin…

---

## [DifferentialEquations: Sundials and LSODA report convergence failure, Julia solvers silently fail?](https://discourse.julialang.org/t/differentialequations-sundials-and-lsoda-report-convergence-failure-julia-solvers-silently-fail/80489)

<div class="topic-metadata">

**Author:** [@qtoloza](https://discourse.julialang.org/u/qtoloza)\
**Replies:** 2\
**Last updated:** [May 6, 2022, 9:20pm UTC](https://discourse.julialang.org/t/differentialequations-sundials-and-lsoda-report-convergence-failure-julia-solvers-silently-fail/80489 "2022-05-06T21:20:14Z")

</div>

Hi all! I have an ODE whose solution (mysteriously to me) fails to converge for a set of inputs. The real problem is that solve() does not throw an error and halt integration when I use a native Julia solver (I’ve tried…

---

## [Improve performance of Bellman operator](https://discourse.julialang.org/t/improve-performance-of-bellman-operator/80624)

<div class="topic-metadata">

**Author:** [@axel365](https://discourse.julialang.org/u/axel365)\
**Replies:** 7\
**Last updated:** [May 6, 2022, 8:05pm UTC](https://discourse.julialang.org/t/improve-performance-of-bellman-operator/80624 "2022-05-06T20:05:12Z")

</div>

Hi there, I am creating a function for the Bellman operator, a common tool in economics and macroeconomics. The function takes an Array of dimension n where n is the number of state variables and iterates it one period,…

---

## [Speed of power "^"](https://discourse.julialang.org/t/speed-of-power/80605)

<div class="topic-metadata">

**Author:** [@zhubonan](https://discourse.julialang.org/u/zhubonan)\
**Replies:** 16\
**Last updated:** [May 6, 2022, 3:17pm UTC](https://discourse.julialang.org/t/speed-of-power/80605 "2022-05-06T15:17:26Z")

</div>

I am writing a code that involves lots of use of “^” and profiling seems to suggest “^” is contributing a lot of the time. I have done the following test of the timing. Replacing “^” “\*” seems to give a massive speed up…

---

## [Stacked bars for different length](https://discourse.julialang.org/t/stacked-bars-for-different-length/80577)

<div class="topic-metadata">

**Author:** [@Aminath\_Shausan](https://discourse.julialang.org/u/Aminath_Shausan)\
**Replies:** 2\
**Last updated:** [May 6, 2022, 12:07pm UTC](https://discourse.julialang.org/t/stacked-bars-for-different-length/80577 "2022-05-06T12:07:08Z")

</div>

Hi, I am trying to plot stacked bar graphs from the following data frame: name duration label String3 Int64 SubStri… 1 AUS 31 1 2 AUS 89 2 3 AUS 133 3 4 GBR 86 1 5 GBR 88 …

---

## [Optimizing a Spectral Proper Orthogonal Decomposition Method](https://discourse.julialang.org/t/optimizing-a-spectral-proper-orthogonal-decomposition-method/80522)

<div class="topic-metadata">

**Author:** [@Whyborn](https://discourse.julialang.org/u/Whyborn)\
**Replies:** 19\
**Last updated:** [May 6, 2022, 11:24am UTC](https://discourse.julialang.org/t/optimizing-a-spectral-proper-orthogonal-decomposition-method/80522 "2022-05-06T11:24:45Z")

</div>

I have written a Spectral Proper Orthogonal Decomposition (doi:10.1017/jfm.2018.283) algorithm in both Python and Julia, and I’ve found my Python code to be about 5x faster than the Julia code. I expect the performance t…

---

## [Performance of global variables as default argument values](https://discourse.julialang.org/t/performance-of-global-variables-as-default-argument-values/80399)

<div class="topic-metadata">

**Author:** [@jbu](https://discourse.julialang.org/u/jbu)\
**Replies:** 8\
**Last updated:** [May 6, 2022, 8:54am UTC](https://discourse.julialang.org/t/performance-of-global-variables-as-default-argument-values/80399 "2022-05-06T08:54:11Z")

</div>

Is there a performance penalty for using non-const global variables as default argument values in functions? For example, consider the following snippet: globalval = 10 function addxy(x, y=globalval) return x + y e…

---

## [Which variable initialization is optimized away when variable unused?](https://discourse.julialang.org/t/which-variable-initialization-is-optimized-away-when-variable-unused/80587)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 2\
**Last updated:** [May 6, 2022, 5:39am UTC](https://discourse.julialang.org/t/which-variable-initialization-is-optimized-away-when-variable-unused/80587 "2022-05-06T05:39:24Z")

</div>

I have a method where x is used, but y isn’t used. Why when I assign sqrt(100) to y then it’s ignored and not even executed (which is the desired behaviour), but when it’s assigned collect(1:100) then it is executed? I…

---

## [Given an object, return Julia code that defines the object](https://discourse.julialang.org/t/given-an-object-return-julia-code-that-defines-the-object/80579)

<div class="topic-metadata">

**Author:** [@Ashlin\_Harris](https://discourse.julialang.org/u/Ashlin_Harris)\
**Replies:** 11\
**Last updated:** [May 6, 2022, 1:11am UTC](https://discourse.julialang.org/t/given-an-object-return-julia-code-that-defines-the-object/80579 "2022-05-06T01:11:16Z")

</div>

Is there a function or macro that accepts an object and returns the Julia code that defines the object? For instance, is there a function f() with the following behaviour? julia\> X=Dict(\[("A", 1), ("B", 2)\]) Dict{String…

---

## [Distributed functions, but never run concurrently](https://discourse.julialang.org/t/distributed-functions-but-never-run-concurrently/80519)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 3\
**Last updated:** [May 6, 2022, 2:03am UTC](https://discourse.julialang.org/t/distributed-functions-but-never-run-concurrently/80519 "2022-05-06T02:03:31Z")

</div>

I have a function N functions f() that I want to run across a distributed set of M worker processes, where N functions \> M workers. Naively, I tried: for \_ in 1:N @spawnat :any f() end However, this runs f() concu…

---

## [How to approximate a function](https://discourse.julialang.org/t/how-to-approximate-a-function/80576)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 20\
**Last updated:** [May 6, 2022, 1:17am UTC](https://discourse.julialang.org/t/how-to-approximate-a-function/80576 "2022-05-06T01:17:22Z")

</div>

I have the following function: function wind\_factor(height) log1 = log(height / 0.0002) / log(6.0 / 0.0002) exp1 = exp(0.08163 \* log(height/6.0)) return log1 + (log1 - exp1) end The parameter height is in …

---

## [Makie recipe with plots being added on the fly and why does the recipe run so long](https://discourse.julialang.org/t/makie-recipe-with-plots-being-added-on-the-fly-and-why-does-the-recipe-run-so-long/80539)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 3\
**Last updated:** [May 5, 2022, 9:17pm UTC](https://discourse.julialang.org/t/makie-recipe-with-plots-being-added-on-the-fly-and-why-does-the-recipe-run-so-long/80539 "2022-05-05T21:17:10Z")

</div>

I am trying to make a Makie recipe for a sequence of images with the current image frame from the sequence being an Observable (frame). I would like to have the separate frames of the image load on demand, when the frame …

---

## [Impenetrable error message](https://discourse.julialang.org/t/impenetrable-error-message/80554)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 12\
**Last updated:** [May 5, 2022, 8:14pm UTC](https://discourse.julialang.org/t/impenetrable-error-message/80554 "2022-05-05T20:14:44Z")

</div>

I would not be surprised if novices were stumped. I certainly am: (JuliaTutorial) pkg\> add FinEtoolsHeatDiff Resolving package versions... ERROR: Unsatisfiable requirements detected for package FinEtoolsHeatDiff \[972…

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

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