# General Usage

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

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

**Page:** 365

---

## [How to disable expression evaluation at compile time?](https://discourse.julialang.org/t/how-to-disable-expression-evaluation-at-compile-time/90800)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 0\
**Last updated:** [November 25, 2022, 11:52am UTC](https://discourse.julialang.org/t/how-to-disable-expression-evaluation-at-compile-time/90800 "2022-11-25T11:52:55Z")

</div>

How to disable expression evaluation at compile time ? f1(x) = x + 2 f2(x) = x + f1(2) f1() need evaluate at function call

---

## [Get this exit code -1073741819 / 3221225477 every couple of runs in the MWE](https://discourse.julialang.org/t/get-this-exit-code-1073741819-3221225477-every-couple-of-runs-in-the-mwe/90288)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 9\
**Last updated:** [November 25, 2022, 10:11am UTC](https://discourse.julialang.org/t/get-this-exit-code-1073741819-3221225477-every-couple-of-runs-in-the-mwe/90288 "2022-11-25T10:11:48Z")

</div>

Hi all :slight\_smile: I’ve got a script that runs the whole day, streaming data and calculating stuff every second. But around 3 hours the scripts suddenly stops with no error message, no output. I only got an error cod…

---

## [Type Inference](https://discourse.julialang.org/t/type-inference/89761)

<div class="topic-metadata">

**Author:** [@tchebycheff](https://discourse.julialang.org/u/tchebycheff)\
**Replies:** 6\
**Last updated:** [November 25, 2022, 8:23am UTC](https://discourse.julialang.org/t/type-inference/89761 "2022-11-25T08:23:12Z")

</div>

I always held automatic type inference as one of Julia’s distinguishing features. Why are packages full of type qualifications? Is it the performance improvement, error handling or just the coolness factor? P.S. I hope…

---

## [Interact.jl in Jupyter Notebook and Julia 1.7.3 kernel does not show the slider](https://discourse.julialang.org/t/interact-jl-in-jupyter-notebook-and-julia-1-7-3-kernel-does-not-show-the-slider/90774)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [November 24, 2022, 8:11pm UTC](https://discourse.julialang.org/t/interact-jl-in-jupyter-notebook-and-julia-1-7-3-kernel-does-not-show-the-slider/90774 "2022-11-24T20:11:05Z")

</div>

Hi all, I try this GitHub - JuliaGizmos/Interact.jl: Interactive widgets to play with your Julia code this is the code: using Interact, DynamicalSystems, Plots @manipulate for px=0:0.01:.3, py=0:0.01:.3, plane = …

---

## [Any Other Method to Calculate Indefinite Integral Besides Using SymPy?](https://discourse.julialang.org/t/any-other-method-to-calculate-indefinite-integral-besides-using-sympy/90707)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 8\
**Last updated:** [November 24, 2022, 8:01pm UTC](https://discourse.julialang.org/t/any-other-method-to-calculate-indefinite-integral-besides-using-sympy/90707 "2022-11-24T20:01:49Z")

</div>

Hi all, I use this code to calculate the indefinite integral of a complex trigonometric function: # To compute an indefinite integral using SymPy # we can also use @vars x y z x = symbols("x") integrate((sin((x^(2) +…

---

## [How to use TableView in a browser?](https://discourse.julialang.org/t/how-to-use-tableview-in-a-browser/90693)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 4\
**Last updated:** [November 24, 2022, 1:25pm UTC](https://discourse.julialang.org/t/how-to-use-tableview-in-a-browser/90693 "2022-11-24T13:25:42Z")

</div>

The documentation of TableView shows how to show a (large) table in a Blink window: julia\> using TableView, Blink, DataFrames julia\> w = Blink.Window() julia\> body!(w, showtable(DataFrame(rand(100,100), :auto))) Thi…

---

## [How to programmatically identify the currently active environment?](https://discourse.julialang.org/t/how-to-programmatically-identify-the-currently-active-environment/43257)

<div class="topic-metadata">

**Author:** [@benninkrs](https://discourse.julialang.org/u/benninkrs)\
**Replies:** 4\
**Last updated:** [November 24, 2022, 1:02pm UTC](https://discourse.julialang.org/t/how-to-programmatically-identify-the-currently-active-environment/43257 "2022-11-24T13:02:13Z")

</div>

When in Pkg mode, the prompt shows the name of the currently active environment. I would like to obtain this information programmatically. As far as I can tell, Pkg doesn’t document any way to do this. From poking arou…

---

## [How to use broadcast？](https://discourse.julialang.org/t/how-to-use-broadcast/90743)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 2\
**Last updated:** [November 24, 2022, 10:09am UTC](https://discourse.julialang.org/t/how-to-use-broadcast/90743 "2022-11-24T10:09:14Z")

</div>

I have two variables, x and y, and I want to loop through an x, intersect with a y, and return a Vector every time I loop through an x x=\[10,20,30\] y=\[50,60,70,80\] function m(i,y) n=i:i+50 return \[i,i+50,length(…

---

## [\`juliaup update\` does not update the Julia](https://discourse.julialang.org/t/juliaup-update-does-not-update-the-julia/88080)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 4\
**Last updated:** [November 24, 2022, 6:10am UTC](https://discourse.julialang.org/t/juliaup-update-does-not-update-the-julia/88080 "2022-11-24T06:10:55Z")

</div>

I tried to update Julia using Juliaup, but I haven’t been successful. First, I updated Juliaup using juliaup self update, and after that, I tried to update julia to 1.8.2 using juliaup update, but it stuck in that phase: …

---

## [How to count the interval number in sites not using for loop and push!?](https://discourse.julialang.org/t/how-to-count-the-interval-number-in-sites-not-using-for-loop-and-push/90738)

<div class="topic-metadata">

**Author:** [@zhangchunyong](https://discourse.julialang.org/u/zhangchunyong)\
**Replies:** 1\
**Last updated:** [November 24, 2022, 3:10am UTC](https://discourse.julialang.org/t/how-to-count-the-interval-number-in-sites-not-using-for-loop-and-push/90738 "2022-11-24T03:10:43Z")

</div>

I have an interval and some sites,I want to judge whether each of the interval are in sites,and finally count the number.like the following using BenchmarkTools intervals=10650:10699 sites=\[10673,10655,10662,10670,1065…

---

## [Python lmfit takes weights into account, but Julia LsqFit package seems not to](https://discourse.julialang.org/t/python-lmfit-takes-weights-into-account-but-julia-lsqfit-package-seems-not-to/90679)

<div class="topic-metadata">

**Author:** [@humbleclaw](https://discourse.julialang.org/u/humbleclaw)\
**Replies:** 9\
**Last updated:** [November 23, 2022, 11:26pm UTC](https://discourse.julialang.org/t/python-lmfit-takes-weights-into-account-but-julia-lsqfit-package-seems-not-to/90679 "2022-11-23T23:26:35Z")

</div>

Hello everyone. Using Python I have been able to do non-linear fits with lmfit creating a residual function for a potential mathematical function to fit, just as follows def pow\_res(pars, E, data, sig): values = p…

---

## [How to avoid compiling methods for different types when @nospecialize doesn't seem to work?](https://discourse.julialang.org/t/how-to-avoid-compiling-methods-for-different-types-when-nospecialize-doesnt-seem-to-work/90677)

<div class="topic-metadata">

**Author:** [@SortofDamocles](https://discourse.julialang.org/u/SortofDamocles)\
**Replies:** 10\
**Last updated:** [November 23, 2022, 11:37pm UTC](https://discourse.julialang.org/t/how-to-avoid-compiling-methods-for-different-types-when-nospecialize-doesnt-seem-to-work/90677 "2022-11-23T23:37:47Z")

</div>

Consider the following struct: struct MetaTuple data::Tuple{Vararg{Union{Tuple{}, Tuple{Int16}, Tuple{Int16, Int16}, Tuple{Int16, Int16, Int16}, Tuple{Int16, Int16, Int16, Int16}}}} end Its data is a tuple of tuple…

---

## [Non-call expression encountered](https://discourse.julialang.org/t/non-call-expression-encountered/90725)

<div class="topic-metadata">

**Author:** [@Pino](https://discourse.julialang.org/u/Pino)\
**Replies:** 2\
**Last updated:** [November 23, 2022, 11:22pm UTC](https://discourse.julialang.org/t/non-call-expression-encountered/90725 "2022-11-23T23:22:16Z")

</div>

New to Julia, coming from matlab. I’m tying to run a regression using a dataframe but I want to use a specific range of the dataframe as I have many covariates. So instead of running the following df\_test = DataFrame(…

---

## [Concise call keyword arg with default by conditional](https://discourse.julialang.org/t/concise-call-keyword-arg-with-default-by-conditional/90716)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 2\
**Last updated:** [November 23, 2022, 5:04pm UTC](https://discourse.julialang.org/t/concise-call-keyword-arg-with-default-by-conditional/90716 "2022-11-23T17:04:05Z")

</div>

I tried to show an example below. This might be a bit persnickety, but it seems like it would be nice to have a cleaner solution for this situation. I have function A with a keyword argument that specifies a default val…

---

## [\`invoke\` for non-conforming types](https://discourse.julialang.org/t/invoke-for-non-conforming-types/90720)

<div class="topic-metadata">

**Author:** [@erik-f](https://discourse.julialang.org/u/erik-f)\
**Replies:** 0\
**Last updated:** [November 23, 2022, 4:32pm UTC](https://discourse.julialang.org/t/invoke-for-non-conforming-types/90720 "2022-11-23T16:32:32Z")

</div>

Is there a way to invoke a function f1(::A) = nothing with an argument that is not of the type A? So basically invoke(f1, Tuple{A}, a) where a is not of the type A. As for the context: For advanced testing, I want …

---

## [Argmax returns wrong value](https://discourse.julialang.org/t/argmax-returns-wrong-value/90645)

<div class="topic-metadata">

**Author:** [@lukas\_r](https://discourse.julialang.org/u/lukas_r)\
**Replies:** 13\
**Last updated:** [November 23, 2022, 2:48pm UTC](https://discourse.julialang.org/t/argmax-returns-wrong-value/90645 "2022-11-23T14:48:17Z")

</div>

I have an array of n vectors (of varying length) that I am searching for the largest value. For this I first find the vector containing the largest value with argmax(array) and then find the index of that value with argm…

---

## [Why the integral of |x| is not exact? with SymPy](https://discourse.julialang.org/t/why-the-integral-of-x-is-not-exact-with-sympy/90705)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 5\
**Last updated:** [November 23, 2022, 2:39pm UTC](https://discourse.julialang.org/t/why-the-integral-of-x-is-not-exact-with-sympy/90705 "2022-11-23T14:39:03Z")

</div>

Dear all, I have tried SymPy to compute indefinite integral of |x|, this is the code: using SymPy # we can also use @vars x y z x = symbols("x") integrate(abs(x)) but the result is like this at terminal, different f…

---

## [Get the output of a Julia function called from C](https://discourse.julialang.org/t/get-the-output-of-a-julia-function-called-from-c/90699)

<div class="topic-metadata">

**Author:** [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)\
**Replies:** 6\
**Last updated:** [November 23, 2022, 2:08pm UTC](https://discourse.julialang.org/t/get-the-output-of-a-julia-function-called-from-c/90699 "2022-11-23T14:08:08Z")

</div>

I have a Julia module called MyGramSchmidt which contains a function called fwht that takes a Vector{Float64} as input and returns a Vector{Float64}. I would like to define a C variable and use it to get the output of fw…

---

## [Why sleep() throws EOFError?](https://discourse.julialang.org/t/why-sleep-throws-eoferror/46106)

<div class="topic-metadata">

**Author:** [@tisztamo](https://discourse.julialang.org/u/tisztamo)\
**Replies:** 1\
**Last updated:** [November 23, 2022, 12:31pm UTC](https://discourse.julialang.org/t/why-sleep-throws-eoferror/46106 "2022-11-23T12:31:58Z")

</div>

I got this, but cannot reproduce it for now: ┌ Error: xxxx │ exception = │ EOFError: read end of file │ Stacktrace: │ \[1\] wait at ./asyncevent.jl:128 \[inlined\] │ \[2\] sleep at ./asyncevent.jl:213 \[inlined…

---

## [Modular multiplication without overflow](https://discourse.julialang.org/t/modular-multiplication-without-overflow/90421)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 32\
**Last updated:** [November 23, 2022, 12:08pm UTC](https://discourse.julialang.org/t/modular-multiplication-without-overflow/90421 "2022-11-23T12:08:16Z")

</div>

Let’s say I have three integers of the same type and want to compute (a \* b) % c. a \* b might overflow producing wrong results even though the mathematically correct answer (e.g. using BigInts) would not overflow. What i…

---

## [Replace Vector at indices and return a copy](https://discourse.julialang.org/t/replace-vector-at-indices-and-return-a-copy/90692)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 9\
**Last updated:** [November 23, 2022, 10:28am UTC](https://discourse.julialang.org/t/replace-vector-at-indices-and-return-a-copy/90692 "2022-11-23T10:28:18Z")

</div>

What’s the easiest way to return a copy of a Vector with replaced elements at some indices with some specific values ? I can start with one approach: julia\> v = \[10,20,30,40,50\]; julia\> inds = \[2,5\]; julia\> vals = \[2…

---

## [Error compiling C code that runs Julia code](https://discourse.julialang.org/t/error-compiling-c-code-that-runs-julia-code/90694)

<div class="topic-metadata">

**Author:** [@nvenkov1](https://discourse.julialang.org/u/nvenkov1)\
**Replies:** 1\
**Last updated:** [November 23, 2022, 10:05am UTC](https://discourse.julialang.org/t/error-compiling-c-code-that-runs-julia-code/90694 "2022-11-23T10:05:46Z")

</div>

My Julia folder is /home/nxf93431/julia-1.8.1/ and I write the following main.c file in C: #include \<julia.h\> JULIA\_DEFINE\_FAST\_TLS int main(int argc, char \*argv\[\]) { jl\_init(); jl\_eval\_string("print(sqrt(2.))"); …

---

## [Vulnerabilities in binary executables, especially for Windows platform](https://discourse.julialang.org/t/vulnerabilities-in-binary-executables-especially-for-windows-platform/90688)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 0\
**Last updated:** [November 23, 2022, 8:15am UTC](https://discourse.julialang.org/t/vulnerabilities-in-binary-executables-especially-for-windows-platform/90688 "2022-11-23T08:15:12Z")

</div>

We’ve developed a julia package and compile it with PackageCompiler.jl. We can produce binary executables for both Windows and Linux platforms, and they work fine. Problems occur, however, when we begin to do vulnerabil…

---

## [Generate random number following gaussian distribution](https://discourse.julialang.org/t/generate-random-number-following-gaussian-distribution/90669)

<div class="topic-metadata">

**Author:** [@JosieG](https://discourse.julialang.org/u/JosieG)\
**Replies:** 3\
**Last updated:** [November 23, 2022, 2:52am UTC](https://discourse.julialang.org/t/generate-random-number-following-gaussian-distribution/90669 "2022-11-23T02:52:13Z")

</div>

I know rand() will generate a random number following unif(0,1), but how to generate a random number following gaussian distribution? Is there an existing function?

---

## [Does copy() always create a valid copy of BigFloat?](https://discourse.julialang.org/t/does-copy-always-create-a-valid-copy-of-bigfloat/90672)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 7\
**Last updated:** [November 22, 2022, 11:37pm UTC](https://discourse.julialang.org/t/does-copy-always-create-a-valid-copy-of-bigfloat/90672 "2022-11-22T23:37:27Z")

</div>

Does copy() always create a valid copy of BigFloat? x = big(1.0) # -\> 1.0 y = copy(x) # -\> 1.0 x == y # -\> true x += 1 # -\> 2.0 x == y # -\> false y # -\> 1.0

---

## [How to transform DataFrame back to its data source](https://discourse.julialang.org/t/how-to-transform-dataframe-back-to-its-data-source/90536)

<div class="topic-metadata">

**Author:** [@alexgr](https://discourse.julialang.org/u/alexgr)\
**Replies:** 7\
**Last updated:** [November 22, 2022, 11:36pm UTC](https://discourse.julialang.org/t/how-to-transform-dataframe-back-to-its-data-source/90536 "2022-11-22T23:36:47Z")

</div>

How would you approach going back from DataFrame to a vector of Records given this code? struct Record A::UInt32 B::Float32 C::Float32 end # get bytes from stream; Vector{UInt8} buffer = rand(UInt8, sizeof…

---

## [GLIBCXX version not found](https://discourse.julialang.org/t/glibcxx-version-not-found/82209)

<div class="topic-metadata">

**Author:** [@Clemapfel](https://discourse.julialang.org/u/Clemapfel)\
**Replies:** 10\
**Last updated:** [November 22, 2022, 2:36pm UTC](https://discourse.julialang.org/t/glibcxx-version-not-found/82209 "2022-11-22T14:36:47Z")

</div>

Hi, I have a shared C library I compiled myself. When trying to ccall in Julia, it throws the following error: julia\> ccall((:test, "./\<...\>.so"), Cvoid, ()) ERROR: could not load library "./\<...\>.so" /home/redacted/App…

---

## [Extract function from function type](https://discourse.julialang.org/t/extract-function-from-function-type/90651)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 13\
**Last updated:** [November 22, 2022, 10:59pm UTC](https://discourse.julialang.org/t/extract-function-from-function-type/90651 "2022-11-22T22:59:53Z")

</div>

Consider the following: foo(x) = x foo\_type = foo |\> typeof # Don't know how to implement but I know what I want it to do # Example: default(foo\_type) -\> foo default(::Type{T}) where T \<: Function = ??? # The followin…

---

## [Extremely slow \`invoke\` when inlined](https://discourse.julialang.org/t/extremely-slow-invoke-when-inlined/90665)

<div class="topic-metadata">

**Author:** [@mateuszbaran](https://discourse.julialang.org/u/mateuszbaran)\
**Replies:** 3\
**Last updated:** [November 22, 2022, 9:00pm UTC](https://discourse.julialang.org/t/extremely-slow-invoke-when-inlined/90665 "2022-11-22T21:00:50Z")

</div>

Consider the following code: function e() els = Any\[\[1\], 10.0\] return rand(els) end function f() a = e() g(a) end function g(a) return invoke(\*, Tuple{supertype(typeof(a)),Float64}, a, 10.0) end T…

---

## [Access denied when adding package](https://discourse.julialang.org/t/access-denied-when-adding-package/83273)

<div class="topic-metadata">

**Author:** [@luhuh](https://discourse.julialang.org/u/luhuh)\
**Replies:** 9\
**Last updated:** [November 22, 2022, 8:49pm UTC](https://discourse.julialang.org/t/access-denied-when-adding-package/83273 "2022-11-22T20:49:41Z")

</div>

Hello everyone! I’ve been having some trouble adding and building the JuMP and Clp packages on my Julia (but I got IJulia to be added and installed). The problem comes when I do Pkg.add(“JuMP”) or Pkg.add(“Clp”). The err…

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

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