# General Usage

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

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

**Page:** 576

---

## [Reducing memory allocations when storing vectors to fields of a mutable type](https://discourse.julialang.org/t/reducing-memory-allocations-when-storing-vectors-to-fields-of-a-mutable-type/64623)

<div class="topic-metadata">

**Author:** [@LionMod](https://discourse.julialang.org/u/LionMod)\
**Replies:** 6\
**Last updated:** [July 14, 2021, 2:43pm UTC](https://discourse.julialang.org/t/reducing-memory-allocations-when-storing-vectors-to-fields-of-a-mutable-type/64623 "2021-07-14T14:43:53Z")

</div>

I have a mutable type called Data mutable struct Data data\_a::Vector{Int64} data\_b::Vector{Int64} end I get two vectors that are of type Vector{Float64} from a solution of an ODE and want to construct t…

---

## [How to install Python packages for PyCall?](https://discourse.julialang.org/t/how-to-install-python-packages-for-pycall/64560)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 10\
**Last updated:** [July 14, 2021, 1:02pm UTC](https://discourse.julialang.org/t/how-to-install-python-packages-for-pycall/64560 "2021-07-14T13:02:22Z")

</div>

How to install Python PKG in Julia using PyCall? For example,https://github.com/LucasBoTang/Optimal\_Classification\_Trees， How can it be used in Julia? Thank you very much!

---

## [Invoke a method from a particular world-age](https://discourse.julialang.org/t/invoke-a-method-from-a-particular-world-age/64526)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 1\
**Last updated:** [July 14, 2021, 12:02pm UTC](https://discourse.julialang.org/t/invoke-a-method-from-a-particular-world-age/64526 "2021-07-14T12:02:43Z")

</div>

Is there a way to invoke a method from a particular world age? I am defining automatically a ton of methods using metaprogramming. But for particular cases I would like to not hit the overload I have defined, but rath…

---

## [Meaning of \`pkgdir\`](https://discourse.julialang.org/t/meaning-of-pkgdir/64563)

<div class="topic-metadata">

**Author:** [@ThomasBreuer](https://discourse.julialang.org/u/ThomasBreuer)\
**Replies:** 1\
**Last updated:** [July 14, 2021, 11:56am UTC](https://discourse.julialang.org/t/meaning-of-pkgdir/64563 "2021-07-14T11:56:49Z")

</div>

Calling Pkg.activate (in Julia 1.5.3) seems to change the output of pkgdir. My situation is as follows. Two versions of a package X, say, are installed, a released one in ~/.julia/packages and a develop version in anot…

---

## [Choose random numbers according to certain math rule](https://discourse.julialang.org/t/choose-random-numbers-according-to-certain-math-rule/64611)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 4\
**Last updated:** [July 14, 2021, 7:02am UTC](https://discourse.julialang.org/t/choose-random-numbers-according-to-certain-math-rule/64611 "2021-07-14T07:02:01Z")

</div>

How do I choose certain numbers that fulfill a certain relationship between them? The simplest case, for example: choose a and b positive real numbers such that a+b = 20. Something more complicated, for example: how to c…

---

## [Create hard links in Julia - Is there another way than via external command run()?](https://discourse.julialang.org/t/create-hard-links-in-julia-is-there-another-way-than-via-external-command-run/12908)

<div class="topic-metadata">

**Author:** [@oniter](https://discourse.julialang.org/u/oniter)\
**Replies:** 1\
**Last updated:** [July 14, 2021, 1:46am UTC](https://discourse.julialang.org/t/create-hard-links-in-julia-is-there-another-way-than-via-external-command-run/12908 "2021-07-14T01:46:50Z")

</div>

Hi all! Is there a Julia function/way to create a hard link to a file like the ln command under linux? In the moment I only can do that via the run() cmd. I didn’t find anything in the Docs besides symlink(). As alwa…

---

## [Documenter.makedocs not tracking changes to code](https://discourse.julialang.org/t/documenter-makedocs-not-tracking-changes-to-code/64606)

<div class="topic-metadata">

**Author:** [@orome](https://discourse.julialang.org/u/orome)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 10:00pm UTC](https://discourse.julialang.org/t/documenter-makedocs-not-tracking-changes-to-code/64606 "2021-07-13T22:00:48Z")

</div>

:blush: See below, I forgot Revise! I don’t understand what’s happening hen I use Documenter.makedocs() to create documentation for my package. I’ve performed the following steps: Initialize a template for document ge…

---

## [How do I get the current Pkg.status() on a project under development?](https://discourse.julialang.org/t/how-do-i-get-the-current-pkg-status-on-a-project-under-development/64602)

<div class="topic-metadata">

**Author:** [@orome](https://discourse.julialang.org/u/orome)\
**Replies:** 0\
**Last updated:** [July 13, 2021, 8:38pm UTC](https://discourse.julialang.org/t/how-do-i-get-the-current-pkg-status-on-a-project-under-development/64602 "2021-07-13T20:38:51Z")

</div>

If I dev ..path/to/MyProject and then using Revise and using MyProject my REPL session tracks any changes I make to the code, and test MyProject does too. But status does not report the latest version (and perhaps more) …

---

## [What packages exist for creating CLIs?](https://discourse.julialang.org/t/what-packages-exist-for-creating-clis/64577)

<div class="topic-metadata">

**Author:** [@orome](https://discourse.julialang.org/u/orome)\
**Replies:** 6\
**Last updated:** [July 13, 2021, 8:11pm UTC](https://discourse.julialang.org/t/what-packages-exist-for-creating-clis/64577 "2021-07-13T20:11:59Z")

</div>

I’m looking for a package to implement a CLI in Julia but all I can find is ArgParse, which takes a pretty complicated and old fished approach (based, I assume on the antiquated Python’s argparse). Is there something mo…

---

## [Memory allocation with function passed as arguments](https://discourse.julialang.org/t/memory-allocation-with-function-passed-as-arguments/64575)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 4\
**Last updated:** [July 13, 2021, 7:15pm UTC](https://discourse.julialang.org/t/memory-allocation-with-function-passed-as-arguments/64575 "2021-07-13T19:15:00Z")

</div>

When I call test() twice after compiling code fn = (x -\> 2\*exp(x), x -\> 2\*sin(x)) function test\_calc(x, fn1, fn2) @. x = x + fn1(x) + fn2(x) end function test() A = Float64.(collect(1:10)) @time test\_calc(…

---

## [Wait for whichever task is first](https://discourse.julialang.org/t/wait-for-whichever-task-is-first/64588)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 4\
**Last updated:** [July 13, 2021, 4:55pm UTC](https://discourse.julialang.org/t/wait-for-whichever-task-is-first/64588 "2021-07-13T16:55:52Z")

</div>

Hi all, does someone know a function which takes two Tasks (or Futures) and waits until one of them becomes available, cancels the other and returns the result? best, Stephan

---

## [Memory allocation inconsistency (again...)](https://discourse.julialang.org/t/memory-allocation-inconsistency-again/64538)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 14\
**Last updated:** [July 13, 2021, 3:02pm UTC](https://discourse.julialang.org/t/memory-allocation-inconsistency-again/64538 "2021-07-13T15:02:25Z")

</div>

When I run the following struct Test x :: Array{Float64, 1} y :: Array{Float64, 1} end function test() var = Test(\[1, 2\], \[1, 2\]) @time @. var.x = var.y - var.x/var.y^2 @time @. var.x = var.y - var…

---

## [Available fonts in Luxor.jl](https://discourse.julialang.org/t/available-fonts-in-luxor-jl/64576)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 2:58pm UTC](https://discourse.julialang.org/t/available-fonts-in-luxor-jl/64576 "2021-07-13T14:58:16Z")

</div>

What are the available fonts in Luxor that can be used cross-platform? How can I make a package using Luxor that provides the same text results on different platforms? Any help is appreciated.

---

## [Using eval and a macro with \`$\`](https://discourse.julialang.org/t/using-eval-and-a-macro-with/64570)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 2\
**Last updated:** [July 13, 2021, 1:47pm UTC](https://discourse.julialang.org/t/using-eval-and-a-macro-with/64570 "2021-07-13T13:47:55Z")

</div>

I’ve been working on a macro which uses $ in a special way. But for certain tests, I need to use @eval or eval. Here is a very stupid MWE showin the problem, roughly julia\> macro with\_dollar(x) if x isa Expr &…

---

## [Deactivate logging message locally](https://discourse.julialang.org/t/deactivate-logging-message-locally/64493)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 3\
**Last updated:** [July 13, 2021, 1:39pm UTC](https://discourse.julialang.org/t/deactivate-logging-message-locally/64493 "2021-07-13T13:39:07Z")

</div>

I currently have a struct whose constructor logs some messages when called, using @info and potentially @warn. This is useful to me when I need to check in the log what parameters I actually used in some of my computatio…

---

## [Precompilation, environments, and \`Distributed\` computing](https://discourse.julialang.org/t/precompilation-environments-and-distributed-computing/22431)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [July 13, 2021, 1:02pm UTC](https://discourse.julialang.org/t/precompilation-environments-and-distributed-computing/22431 "2021-07-13T13:02:38Z")

</div>

I’m using Distributed.jl to run simulations in parallel from a Jupyter Notebook, and my simulations are performed using a local repo SimModels (I have not yet made it a module) which pmaps various models/simulations to e…

---

## [Website via Franklin.jl from Pluto.jl notebooks](https://discourse.julialang.org/t/website-via-franklin-jl-from-pluto-jl-notebooks/55703)

<div class="topic-metadata">

**Author:** [@Stefan\_Bringuier](https://discourse.julialang.org/u/Stefan_Bringuier)\
**Replies:** 6\
**Last updated:** [July 13, 2021, 12:25pm UTC](https://discourse.julialang.org/t/website-via-franklin-jl-from-pluto-jl-notebooks/55703 "2021-07-13T12:25:08Z")

</div>

I have a collection of Pluto.jl notebooks that I’ve been putting together for solving science problems using SymPy.jl. The collection of notebooks is a git repo with a Project.toml and Manifest.toml. I want to turn these…

---

## [SymPy coeff() different behavior depending on how it is called](https://discourse.julialang.org/t/sympy-coeff-different-behavior-depending-on-how-it-is-called/64549)

<div class="topic-metadata">

**Author:** [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Replies:** 2\
**Last updated:** [July 13, 2021, 10:25am UTC](https://discourse.julialang.org/t/sympy-coeff-different-behavior-depending-on-how-it-is-called/64549 "2021-07-13T10:25:15Z")

</div>

I am trying to get the coefficients from several SymPy expressions. Since there are a lot of different combinations, I’d like to loop over them with a variable n. However that fails when n=-1. Here is an example, where t…

---

## [Iterable type signature?](https://discourse.julialang.org/t/iterable-type-signature/64550)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 8\
**Last updated:** [July 13, 2021, 9:52am UTC](https://discourse.julialang.org/t/iterable-type-signature/64550 "2021-07-13T09:52:18Z")

</div>

Say I have a function that iterates over some values (e.g., vector, range, iterator): function f(xs) for x in xs println(x) end end Can I give it a type signature that indicates the function requires xs to be i…

---

## [Why these two functions have different allocations?](https://discourse.julialang.org/t/why-these-two-functions-have-different-allocations/64517)

<div class="topic-metadata">

**Author:** [@Fred\_He](https://discourse.julialang.org/u/Fred_He)\
**Replies:** 11\
**Last updated:** [July 13, 2021, 8:19am UTC](https://discourse.julialang.org/t/why-these-two-functions-have-different-allocations/64517 "2021-07-13T08:19:39Z")

</div>

I want to avoid any excess allocation. The f1! below needs 2m+1 allocations while the f2! needs m+1 allocations. is ito possible to make this kind of functionality 1 allocation only? function f1!(du, u) m,n = size(…

---

## [Using nonunique() with multiple dataframe columns](https://discourse.julialang.org/t/using-nonunique-with-multiple-dataframe-columns/64523)

<div class="topic-metadata">

**Author:** [@kbot](https://discourse.julialang.org/u/kbot)\
**Replies:** 2\
**Last updated:** [July 13, 2021, 7:54am UTC](https://discourse.julialang.org/t/using-nonunique-with-multiple-dataframe-columns/64523 "2021-07-13T07:54:14Z")

</div>

Hi, I’d like to identify rows with duplicate values across multiple columns (i.e. colA && colC && colD) with something like findall( nonunique( df, CONDITION) ) for one column CONDITION is easy e.g. :colA. How can I…

---

## [DataFrame column names with symbols](https://discourse.julialang.org/t/dataframe-column-names-with-symbols/62985)

<div class="topic-metadata">

**Author:** [@Ismam](https://discourse.julialang.org/u/Ismam)\
**Replies:** 7\
**Last updated:** [July 13, 2021, 5:47am UTC](https://discourse.julialang.org/t/dataframe-column-names-with-symbols/62985 "2021-07-13T05:47:26Z")

</div>

I’m using DataFramesMeta and would like to calculate a new column called “p\*”. I’ve tried: @transform(df, p\* = … ) @transform(df, “p\*” = … ) No luck. I can make do with: Disc\[!,“p\*”\] .= … But, not ideal. Thanks!

---

## [Is it possible to apply some pipeline whether it'd be MLJ, Scikitlearn or FeatureTransform by group?](https://discourse.julialang.org/t/is-it-possible-to-apply-some-pipeline-whether-itd-be-mlj-scikitlearn-or-featuretransform-by-group/64548)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 0\
**Last updated:** [July 13, 2021, 4:23am UTC](https://discourse.julialang.org/t/is-it-possible-to-apply-some-pipeline-whether-itd-be-mlj-scikitlearn-or-featuretransform-by-group/64548 "2021-07-13T04:23:56Z")

</div>

I have asked about this on about scikitlearn. But I can’t find a good solution. E.g. if I want to perform pca or standardscaler, I might want to do it within each group? But there is no easy way to do that in a pipelin…

---

## [Data type for a “stupid” binary search tree](https://discourse.julialang.org/t/data-type-for-a-stupid-binary-search-tree/64474)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 4\
**Last updated:** [July 13, 2021, 3:59am UTC](https://discourse.julialang.org/t/data-type-for-a-stupid-binary-search-tree/64474 "2021-07-13T03:59:51Z")

</div>

I need a data type for a collection of objects (stored in a given order) which supports both O(log n) insertion and deletion methods, as well as some way to perform a dichotomic search (where I provide the left-or-right …

---

## [Summing over missing column values in a DataFrame](https://discourse.julialang.org/t/summing-over-missing-column-values-in-a-dataframe/64547)

<div class="topic-metadata">

**Author:** [@Ismam](https://discourse.julialang.org/u/Ismam)\
**Replies:** 2\
**Last updated:** [July 13, 2021, 3:39am UTC](https://discourse.julialang.org/t/summing-over-missing-column-values-in-a-dataframe/64547 "2021-07-13T03:39:03Z")

</div>

Hi, I’m using DataFramesMeta and having trouble with wrangling with missing values. df = DataFrame(x = 1:5, y = \[missing, 4, missing, 2, 1\]) x y Int64 Int64? 1 1 missing 2 2 4 3 3 missing 4 4 2 5 5 1…

---

## [Obtaining the name of a package imported using Pkg.develop?](https://discourse.julialang.org/t/obtaining-the-name-of-a-package-imported-using-pkg-develop/64541)

<div class="topic-metadata">

**Author:** [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Replies:** 0\
**Last updated:** [July 12, 2021, 11:41pm UTC](https://discourse.julialang.org/t/obtaining-the-name-of-a-package-imported-using-pkg-develop/64541 "2021-07-12T23:41:33Z")

</div>

Hello all, I have a situation where I’m importing a package programatically by using Pkg.develop(url=url\_string), where url\_string is a user input. I then need to find out what the name of the package is. The best I can…

---

## [Surface plotting using PyPlot](https://discourse.julialang.org/t/surface-plotting-using-pyplot/54417)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 9\
**Last updated:** [July 12, 2021, 9:56pm UTC](https://discourse.julialang.org/t/surface-plotting-using-pyplot/54417 "2021-07-12T21:56:13Z")

</div>

Hi, I want to use PyPlot (I don’t like Plots) for plotting a surface, but I seem to miss how this is done. I have a 1D-array of x values, a 1D-array of y values, and a 2D array z of f(x,y) values. In this case length(x…

---

## [Julia plots: How to fill graph background with different colors](https://discourse.julialang.org/t/julia-plots-how-to-fill-graph-background-with-different-colors/17040)

<div class="topic-metadata">

**Author:** [@pythonuser](https://discourse.julialang.org/u/pythonuser)\
**Replies:** 7\
**Last updated:** [July 11, 2021, 9:11pm UTC](https://discourse.julialang.org/t/julia-plots-how-to-fill-graph-background-with-different-colors/17040 "2021-07-11T21:11:53Z")

</div>

I am trying make a plot with the background colors different for each section of the y-axis. For example: using Plots gr() plot(Plots.fakedata(50, 1), w=3, fill = (0, 0.2, :red)) generates the image: I want to fill…

---

## [|\>=, piping update operator](https://discourse.julialang.org/t/piping-update-operator/64511)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 16\
**Last updated:** [July 12, 2021, 7:23pm UTC](https://discourse.julialang.org/t/piping-update-operator/64511 "2021-07-12T19:23:35Z")

</div>

Using SymPy.jl for a little bit I ended up wanting to do something like this using SymPy @syms x y x = cos(y)^2 + sin(y)^2 x |\>= simplify i.e. using a piped updating operator. Could this be possible, and if not, why?

---

## [RemoteChannel and usage of put! and take! on the same process](https://discourse.julialang.org/t/remotechannel-and-usage-of-put-and-take-on-the-same-process/64525)

<div class="topic-metadata">

**Author:** [@deveshjawla](https://discourse.julialang.org/u/deveshjawla)\
**Replies:** 0\
**Last updated:** [July 12, 2021, 6:39pm UTC](https://discourse.julialang.org/t/remotechannel-and-usage-of-put-and-take-on-the-same-process/64525 "2021-07-12T18:39:25Z")

</div>

using Distributed addprocs(2, exeflags="--project") @everywhere begin function update\_remote\_counter(remote\_counter::RemoteChannel, update\_count::Int) old\_value=take!(remote\_counter) put!(remote\_counter, old\_value +…

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

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