# General Usage

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

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

**Page:** 547

---

## [@views bug or expected behaviour?](https://discourse.julialang.org/t/views-bug-or-expected-behaviour/68186)

<div class="topic-metadata">

**Author:** [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Replies:** 3\
**Last updated:** [September 15, 2021, 8:00pm UTC](https://discourse.julialang.org/t/views-bug-or-expected-behaviour/68186 "2021-09-15T20:00:23Z")

</div>

Consider the code n = 5 z = randn(ComplexF64, n) x = zeros(n) y = zeros(n) i = 2 j = 4 @views x\[i:j\] , y\[i:j\] = reim(z\[i:j\]) In julia 1.6.1 this throws the error ERROR: syntax: "i:j" is not a valid function argument n…

---

## [Semver and exporting variables](https://discourse.julialang.org/t/semver-and-exporting-variables/68225)

<div class="topic-metadata">

**Author:** [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Replies:** 1\
**Last updated:** [September 15, 2021, 6:59pm UTC](https://discourse.julialang.org/t/semver-and-exporting-variables/68225 "2021-09-15T18:59:40Z")

</div>

Semver is great, Julia is great, but it very mildly bothers me that any code which does using can’t strictly adhere to semver. For example: using A, B f(x) Initially A exports f and B doesn’t. A later version of B doe…

---

## [Data structure for visualizing and scaling](https://discourse.julialang.org/t/data-structure-for-visualizing-and-scaling/68222)

<div class="topic-metadata">

**Author:** [@jhgorse](https://discourse.julialang.org/u/jhgorse)\
**Replies:** 0\
**Last updated:** [September 15, 2021, 6:10pm UTC](https://discourse.julialang.org/t/data-structure-for-visualizing-and-scaling/68222 "2021-09-15T18:10:03Z")

</div>

Hello, New julia user here coming from MATLAB background and enjoying things so far. I have been playing with ImPlot.jl + CImGui and am inspired to create a log viewer and realtime visualizer for a system I’ve inherite…

---

## [Broadcast comparison of array of enum objects gives an error](https://discourse.julialang.org/t/broadcast-comparison-of-array-of-enum-objects-gives-an-error/68146)

<div class="topic-metadata">

**Author:** [@pjgorski](https://discourse.julialang.org/u/pjgorski)\
**Replies:** 11\
**Last updated:** [September 15, 2021, 1:56pm UTC](https://discourse.julialang.org/t/broadcast-comparison-of-array-of-enum-objects-gives-an-error/68146 "2021-09-15T13:56:24Z")

</div>

I have an array of @Enum objects. I want to count the array elements having a certain value. @enum E x = 0 y = 1 Es = \[E(0) for i in 1:100\] sum(Es .== E(0)) Above code and just Es .== E(0) gives the following error: E…

---

## [On loop scoping, inside functions](https://discourse.julialang.org/t/on-loop-scoping-inside-functions/68201)

<div class="topic-metadata">

**Author:** [@levasco](https://discourse.julialang.org/u/levasco)\
**Replies:** 3\
**Last updated:** [September 15, 2021, 11:54am UTC](https://discourse.julialang.org/t/on-loop-scoping-inside-functions/68201 "2021-09-15T11:54:06Z")

</div>

I know, this topic again. After a year I thought I understood this well enough, I was wrong. I expect this to work but it doesn’t. I don’t want to declare b as a global here, just access it inside the function. function…

---

## [Matrix multiplication but sum of min() instead of sum of product](https://discourse.julialang.org/t/matrix-multiplication-but-sum-of-min-instead-of-sum-of-product/68174)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 7\
**Last updated:** [September 15, 2021, 11:36am UTC](https://discourse.julialang.org/t/matrix-multiplication-but-sum-of-min-instead-of-sum-of-product/68174 "2021-09-15T11:36:21Z")

</div>

Hi everyone, I’m new to Julia and I’m using it to do some network analysis on historical data. As I have valued bimodal data for my graphs, I need to “normalize" those values. Basically, I need to do some “matrix multi…

---

## [PkgDev and VSCode julia: tag release](https://discourse.julialang.org/t/pkgdev-and-vscode-julia-tag-release/68147)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 0\
**Last updated:** [September 14, 2021, 1:02pm UTC](https://discourse.julialang.org/t/pkgdev-and-vscode-julia-tag-release/68147 "2021-09-14T13:02:43Z")

</div>

What is the proper way of dealing with a rejected pull request on the General registry when using PkgDev.tag through the vscode extension interface? Am I supposed to push the requested modifications to my project on the…

---

## [How to fit functions with same parameters?](https://discourse.julialang.org/t/how-to-fit-functions-with-same-parameters/68192)

<div class="topic-metadata">

**Author:** [@y-iizawa](https://discourse.julialang.org/u/y-iizawa)\
**Replies:** 2\
**Last updated:** [September 15, 2021, 7:35am UTC](https://discourse.julialang.org/t/how-to-fit-functions-with-same-parameters/68192 "2021-09-15T07:35:22Z")

</div>

Hello. I have some functions with the same parameters and want to fit these parameters with each data. Example: p is parameters set. Now I consider two parameters p\[1\] and p\[2\] as examples. example\_1(x) = p\[1\] + p\[2\]…

---

## [Emacs-jupyter code-blocks and unicode completion](https://discourse.julialang.org/t/emacs-jupyter-code-blocks-and-unicode-completion/68188)

<div class="topic-metadata">

**Author:** [@ChauhanT](https://discourse.julialang.org/u/ChauhanT)\
**Replies:** 0\
**Last updated:** [September 15, 2021, 1:55am UTC](https://discourse.julialang.org/t/emacs-jupyter-code-blocks-and-unicode-completion/68188 "2021-09-15T01:55:44Z")

</div>

Hi, I’m trying to set up unicode completion in julia for emacs-jupyter and have almost got it working. However, I have a really weird issue. The unicode suggestions show up as expected, but when I select them (by tappin…

---

## [Easy call to Julia functions from C++ using C++14](https://discourse.julialang.org/t/easy-call-to-julia-functions-from-c-using-c-14/20751)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 0\
**Last updated:** [February 13, 2019, 3:51pm UTC](https://discourse.julialang.org/t/easy-call-to-julia-functions-from-c-using-c-14/20751 "2019-02-13T15:51:13Z")

</div>

Hi guys! I just want to share a very simple code I created in C++ (using standard C++14) to make calls to Julia functions easier. My use case is that I need to call a lot of functions from my package SatelliteToolbox.jl …

---

## [Embedding Julia code in parallel C++](https://discourse.julialang.org/t/embedding-julia-code-in-parallel-c/68163)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 2\
**Last updated:** [September 14, 2021, 10:53pm UTC](https://discourse.julialang.org/t/embedding-julia-code-in-parallel-c/68163 "2021-09-14T22:53:48Z")

</div>

Hey all- I’m working on a rather large machine learning project that entails using a C++ main to call functions written in Julia. In addition the regular pain of who manages what variables and how to translate between bi…

---

## [Calling Julia Functions using 'cfunction'](https://discourse.julialang.org/t/calling-julia-functions-using-cfunction/9032)

<div class="topic-metadata">

**Author:** [@pemryan](https://discourse.julialang.org/u/pemryan)\
**Replies:** 0\
**Last updated:** [February 13, 2018, 12:06pm UTC](https://discourse.julialang.org/t/calling-julia-functions-using-cfunction/9032 "2018-02-13T12:06:16Z")

</div>

Hello, Besides the examples given in doc (https://docs.julialang.org/en/stable/manual/embedding/), I figured out two more methods to call Julia functions in C, using the built-in ‘cfunction’: 1) use julia cfunction …

---

## [How to free resources used within the JuliaCall environment?](https://discourse.julialang.org/t/how-to-free-resources-used-within-the-juliacall-environment/66565)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 0\
**Last updated:** [August 17, 2021, 7:09pm UTC](https://discourse.julialang.org/t/how-to-free-resources-used-within-the-juliacall-environment/66565 "2021-08-17T19:09:16Z")

</div>

What is the best way to do this? Is there a variable within the R session that I can rm() to free memory from the julia variables that were created?

---

## [How to write a custom distribution using pdf from a Kernel Density Estimator?](https://discourse.julialang.org/t/how-to-write-a-custom-distribution-using-pdf-from-a-kernel-density-estimator/68175)

<div class="topic-metadata">

**Author:** [@vkv](https://discourse.julialang.org/u/vkv)\
**Replies:** 4\
**Last updated:** [September 14, 2021, 9:50pm UTC](https://discourse.julialang.org/t/how-to-write-a-custom-distribution-using-pdf-from-a-kernel-density-estimator/68175 "2021-09-14T21:50:12Z")

</div>

Let x = rand(100); #some data PDF of x can be estimated using KDE: using KernelDensity KDE\_x = kde(x) ik = InterpKDE(KDE\_x) KDE\_pdf(x) = pdf(ik, x) How can the KDE\_pdf function be used in to construct a custom distri…

---

## [How to make fast JuliaCall?](https://discourse.julialang.org/t/how-to-make-fast-juliacall/51602)

<div class="topic-metadata">

**Author:** [@Ravinder\_Ram](https://discourse.julialang.org/u/Ravinder_Ram)\
**Replies:** 0\
**Last updated:** [December 10, 2020, 11:38am UTC](https://discourse.julialang.org/t/how-to-make-fast-juliacall/51602 "2020-12-10T11:38:45Z")

</div>

I made the package using JuliaCall so that I can use in R studio. But it is slower than R is my code not running on JIT julia compiler. how to make fast juliacall?

---

## [How to prevent this warning](https://discourse.julialang.org/t/how-to-prevent-this-warning/68159)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 2\
**Last updated:** [September 14, 2021, 8:49pm UTC](https://discourse.julialang.org/t/how-to-prevent-this-warning/68159 "2021-09-14T20:49:17Z")

</div>

objc\[5352\]: Class RunLoopModeTracker is implemented in both /opt/miniconda3/lib/libQt5Core.5.9.7.dylib (0x168cffa80) and /Users/lewis/.julia/artifacts/d594d9e68b9d104aaf1a41d933728d2dad54c869/lib/QtCore.framework/Version…

---

## [Multithreaded synchronization using events allocates a lot](https://discourse.julialang.org/t/multithreaded-synchronization-using-events-allocates-a-lot/68158)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 0\
**Last updated:** [September 14, 2021, 5:44pm UTC](https://discourse.julialang.org/t/multithreaded-synchronization-using-events-allocates-a-lot/68158 "2021-09-14T17:44:22Z")

</div>

Context I’d like to use threads to parallelise a physics simulation code. The amount of work each thread has to do in a single loop might be quite small, so I want to keep all the threads running all the time as a lightw…

---

## [How to avoid clipping points at plot boundaries?](https://discourse.julialang.org/t/how-to-avoid-clipping-points-at-plot-boundaries/68150)

<div class="topic-metadata">

**Author:** [@gedankenexperiment](https://discourse.julialang.org/u/gedankenexperiment)\
**Replies:** 6\
**Last updated:** [September 14, 2021, 5:25pm UTC](https://discourse.julialang.org/t/how-to-avoid-clipping-points-at-plot-boundaries/68150 "2021-09-14T17:25:08Z")

</div>

Hi there, I have defined axis limits such that I have ticks at the boundaries of my plot. But data points whose values correspond to the limits are clipped at the plot boundaries. In R, one can prevent this by using coo…

---

## [How to find angle between two vectors?](https://discourse.julialang.org/t/how-to-find-angle-between-two-vectors/68149)

<div class="topic-metadata">

**Author:** [@Minimum-Pollution-96](https://discourse.julialang.org/u/Minimum-Pollution-96)\
**Replies:** 4\
**Last updated:** [September 14, 2021, 2:39pm UTC](https://discourse.julialang.org/t/how-to-find-angle-between-two-vectors/68149 "2021-09-14T14:39:56Z")

</div>

My current implementation is function angle(a, b) return acosd(a⋅b/(norm(a)\*norm(b))) end But, sometimes, it throws domain error as LoadError: DomainError with 1.0000000000000002: acos(x) not defined for |x| \> 1 I…

---

## [How to disable LibPQ error messages being printed to console](https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101)

<div class="topic-metadata">

**Author:** [@Laco\_Kovac](https://discourse.julialang.org/u/Laco_Kovac)\
**Replies:** 1\
**Last updated:** [September 14, 2021, 12:46pm UTC](https://discourse.julialang.org/t/how-to-disable-libpq-error-messages-being-printed-to-console/68101 "2021-09-14T12:46:05Z")

</div>

LibPQ is printing error messages to the console, even though it is expected to fail and I don’t want these messages to show up in the console. I looked for some LibPQ option(s), but didn’t find anything suitable. Or wo…

---

## [On beauty of Distributions.jl pdf interface](https://discourse.julialang.org/t/on-beauty-of-distributions-jl-pdf-interface/67895)

<div class="topic-metadata">

**Author:** [@thisismygitrepo](https://discourse.julialang.org/u/thisismygitrepo)\
**Replies:** 20\
**Last updated:** [September 14, 2021, 11:18am UTC](https://discourse.julialang.org/t/on-beauty-of-distributions-jl-pdf-interface/67895 "2021-09-14T11:18:51Z")

</div>

Julia is often touted for its syntax that resembles math notation. I have a kind of objection here. Getting values of this density function with this syntax is awkward to say the least. Shouldn’t this be simply p(0:0…

---

## [Surprising runtime behaviour when wrapping functions](https://discourse.julialang.org/t/surprising-runtime-behaviour-when-wrapping-functions/68140)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 4\
**Last updated:** [September 14, 2021, 11:21am UTC](https://discourse.julialang.org/t/surprising-runtime-behaviour-when-wrapping-functions/68140 "2021-09-14T11:21:14Z")

</div>

Running the following test program using BenchmarkTools f(x) = x struct Wrapper f::Function end function evaluate(f, x) return f(x) end function evaluate(wrapper::Wrapper, x) return wrapper.f(x) end func…

---

## [LightXML vs EzXML](https://discourse.julialang.org/t/lightxml-vs-ezxml/61091)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 7\
**Last updated:** [September 14, 2021, 10:48am UTC](https://discourse.julialang.org/t/lightxml-vs-ezxml/61091 "2021-09-14T10:48:13Z")

</div>

Hi, I have started playing with LightXML and EzXML. I found EzXML to be easier to use and better documented than LightXML. I am still struggling to do some basic stuff wiyh LightXML. I wanted to have the view of the co…

---

## [Why could this happen?](https://discourse.julialang.org/t/why-could-this-happen/68128)

<div class="topic-metadata">

**Author:** [@Rratic](https://discourse.julialang.org/u/Rratic)\
**Replies:** 7\
**Last updated:** [September 14, 2021, 7:07am UTC](https://discourse.julialang.org/t/why-could-this-happen/68128 "2021-09-14T07:07:36Z")

</div>

I used Expr to express a very very complicated math expression. I used println(io,expr) to put it into a file. The size of the file is 480KB. When I opened the file (using vscode,so I’m sure the problem is not here), …

---

## [Local GUI coverage](https://discourse.julialang.org/t/local-gui-coverage/6842)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 9\
**Last updated:** [September 13, 2021, 11:37pm UTC](https://discourse.julialang.org/t/local-gui-coverage/6842 "2021-09-13T23:37:53Z")

</div>

Is there any simple way I can get nice coverage reports, with calls per line, locally? What do you guys use? The process outlined in Coverage.jl is a bit convoluted. I’m basically looking for a local version of coverall…

---

## [Clean dependencies for Plots](https://discourse.julialang.org/t/clean-dependencies-for-plots/59617)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 4\
**Last updated:** [September 13, 2021, 7:45pm UTC](https://discourse.julialang.org/t/clean-dependencies-for-plots/59617 "2021-09-13T19:45:53Z")

</div>

I have just upgraded to Julia 1.6. Looks nice. Rebuilt as many packages as I could (seems Julia errors out on some rebuilds). I go back and forth between pyplot and gr as backends for Plots. Both have some bad side effe…

---

## [PackageCompiler throwing error on fresh machine](https://discourse.julialang.org/t/packagecompiler-throwing-error-on-fresh-machine/68109)

<div class="topic-metadata">

**Author:** [@connormeaton](https://discourse.julialang.org/u/connormeaton)\
**Replies:** 6\
**Last updated:** [September 13, 2021, 5:53pm UTC](https://discourse.julialang.org/t/packagecompiler-throwing-error-on-fresh-machine/68109 "2021-09-13T17:53:49Z")

</div>

I have been able to successfully use PackageCompiler to compile a Julia script into a binary and run on a different machine (same OS and distro) that doesn’t have Julia or any dependencies. For some reason, my workflow n…

---

## [Bug in Juliahub search](https://discourse.julialang.org/t/bug-in-juliahub-search/68094)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 2\
**Last updated:** [September 13, 2021, 1:37pm UTC](https://discourse.julialang.org/t/bug-in-juliahub-search/68094 "2021-09-13T13:37:13Z")

</div>

Why does searching for DataFramesMacros come up empty? https://juliahub.com/ui/Search?q=DataFramesMacros&type=packages If I do search for DataFramesMeta, I find both so I know it’s there. Not sure where to file an issu…

---

## [Creating a function with the same name as given to a struct](https://discourse.julialang.org/t/creating-a-function-with-the-same-name-as-given-to-a-struct/68006)

<div class="topic-metadata">

**Author:** [@danilo-bc](https://discourse.julialang.org/u/danilo-bc)\
**Replies:** 5\
**Last updated:** [September 13, 2021, 12:19pm UTC](https://discourse.julialang.org/t/creating-a-function-with-the-same-name-as-given-to-a-struct/68006 "2021-09-13T12:19:21Z")

</div>

I’m trying to follow a programming exercise in Python (2.x) which follows these steps to make a simple test for building a test runner: test= WasRun("testMethod") print test.wasRun test.testMethod() print test.wasRun N…

---

## [LoadError: UndefVarError: include not defined when using Pkg.test](https://discourse.julialang.org/t/loaderror-undefvarerror-include-not-defined-when-using-pkg-test/68084)

<div class="topic-metadata">

**Author:** [@sim](https://discourse.julialang.org/u/sim)\
**Replies:** 5\
**Last updated:** [September 13, 2021, 12:11pm UTC](https://discourse.julialang.org/t/loaderror-undefvarerror-include-not-defined-when-using-pkg-test/68084 "2021-09-13T12:11:35Z")

</div>

Hello, I want to create a package A with different modules, A and Aux, and test them using pkg.test. The project structure is as follows: #src/A.jl include("aux.jl") module A export f f(x)=x^2 end #src/Aux.jl module Au…

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

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