# General Usage

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

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

**Page:** 667

---

## [Providing variable length args to \`run\` command?](https://discourse.julialang.org/t/providing-variable-length-args-to-run-command/51882)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 2\
**Last updated:** [December 16, 2020, 2:58pm UTC](https://discourse.julialang.org/t/providing-variable-length-args-to-run-command/51882 "2020-12-16T14:58:33Z")

</div>

Hey all. I’m having some trouble using the run command with a variable number of args to the thing I’m trying to run. For context, I’m playing around with some ways to very directly interact with Gnuplot scripts. I’m awa…

---

## [Interval times Int64 and Interval times BigInt discrepancy](https://discourse.julialang.org/t/interval-times-int64-and-interval-times-bigint-discrepancy/51902)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 7\
**Last updated:** [December 16, 2020, 1:47pm UTC](https://discourse.julialang.org/t/interval-times-int64-and-interval-times-bigint-discrepancy/51902 "2020-12-16T13:47:22Z")

</div>

I want to get the positive root of some polynomials with ridiculous precision. The polynomials I care I about are of the form \\sum\_{k=0}^{n-1} a\_k x^k - x^n, with a\_k's being natural numbers. I am trying to write a progr…

---

## [What's the differences between \`throw(ArgumentError(""))\` and \`return throw(ArgumentError("")\`)](https://discourse.julialang.org/t/whats-the-differences-between-throw-argumenterror-and-return-throw-argumenterror/51909)

<div class="topic-metadata">

**Author:** [@baddate](https://discourse.julialang.org/u/baddate)\
**Replies:** 1\
**Last updated:** [December 16, 2020, 11:23am UTC](https://discourse.julialang.org/t/whats-the-differences-between-throw-argumenterror-and-return-throw-argumenterror/51909 "2020-12-16T11:23:05Z")

</div>

i wrote a function that will throw an ArgumentError if it occurred any exception. but i have a question about throwing an error: i can use throw() directly, also i can use the return keyword. Is there any difference? …

---

## [DrWatson.jl: How to put a float 1e15 in the name? and how to save txt files?](https://discourse.julialang.org/t/drwatson-jl-how-to-put-a-float-1e15-in-the-name-and-how-to-save-txt-files/49875)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 2\
**Last updated:** [December 16, 2020, 9:11am UTC](https://discourse.julialang.org/t/drwatson-jl-how-to-put-a-float-1e15-in-the-name-and-how-to-save-txt-files/49875 "2020-12-16T09:11:01Z")

</div>

Hello everyone? As the title says, it’s a DrWatson.jl related question. Actually, I have 2 questions Question 1 Let’s say I have julia\> using DrWatson julia\> params = Dict(:a=\>1e15, :b=\>1:23) Dict{Symbol,Any} with 2 …

---

## [Should reinterpret return the parent array if the eltype is unchanged?](https://discourse.julialang.org/t/should-reinterpret-return-the-parent-array-if-the-eltype-is-unchanged/51920)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [December 16, 2020, 8:44am UTC](https://discourse.julialang.org/t/should-reinterpret-return-the-parent-array-if-the-eltype-is-unchanged/51920 "2020-12-16T08:44:47Z")

</div>

For example: julia\> a = \[1 + im, 2 + 2im\] 2-element Array{Complex{Int64},1}: 1 + 1im 2 + 2im julia\> reinterpret(eltype(a), a) 2-element reinterpret(Complex{Int64}, ::Array{Complex{Int64},1}): 1 + 1im 2 + 2im Do we…

---

## [Not accepting "%f" in ccall(:sscanf, args...)?](https://discourse.julialang.org/t/not-accepting-f-in-ccall-sscanf-args/51854)

<div class="topic-metadata">

**Author:** [@Ibb](https://discourse.julialang.org/u/Ibb)\
**Replies:** 2\
**Last updated:** [December 16, 2020, 1:58am UTC](https://discourse.julialang.org/t/not-accepting-f-in-ccall-sscanf-args/51854 "2020-12-16T01:58:35Z")

</div>

Test on Windows 10 19042.662, Julia version 1.5.3 (2020-11-09). Code below works. u,v,w= Ref{Int32}(0),Ref{Int32}(0),Ref{Int32}(0) ccall(:sscanf, Int, (Ptr{UInt8}, Ptr{UInt8}, Ref{Int32}, Ref{Int32}, Ref{Int32}), "1 2 …

---

## [High precision interval rounding error](https://discourse.julialang.org/t/high-precision-interval-rounding-error/51885)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 6\
**Last updated:** [December 15, 2020, 11:46pm UTC](https://discourse.julialang.org/t/high-precision-interval-rounding-error/51885 "2020-12-15T23:46:34Z")

</div>

Before everything I need a disclaimer: I do understand that the precision which I set is comically large. However, there is a legitimate reason for what I am doing, but I’m not going to go into it. The following snippet…

---

## [REPL help mode discoverability](https://discourse.julialang.org/t/repl-help-mode-discoverability/51676)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 11\
**Last updated:** [December 15, 2020, 9:54pm UTC](https://discourse.julialang.org/t/repl-help-mode-discoverability/51676 "2020-12-15T21:54:00Z")

</div>

As a relative newcomer to Julia, I have been making increasing use of the REPL and other versions of tooling to understand and select a workflow for julia use. One problem I have is the ability to discover needed functi…

---

## [Get function as expr](https://discourse.julialang.org/t/get-function-as-expr/51886)

<div class="topic-metadata">

**Author:** [@Volker\_Weissmann](https://discourse.julialang.org/u/Volker_Weissmann)\
**Replies:** 5\
**Last updated:** [December 15, 2020, 6:22pm UTC](https://discourse.julialang.org/t/get-function-as-expr/51886 "2020-12-15T18:22:07Z")

</div>

My question is the same as Is there a way to get the expression object for a function? , but the old answer does not work in new julia versions. Lets say you defined method: function func() return 17 end I know th…

---

## [Could you please produce a New toml for TextAnalysis - its downgrading DataFrames version](https://discourse.julialang.org/t/could-you-please-produce-a-new-toml-for-textanalysis-its-downgrading-dataframes-version/51819)

<div class="topic-metadata">

**Author:** [@lulamprea](https://discourse.julialang.org/u/lulamprea)\
**Replies:** 6\
**Last updated:** [December 15, 2020, 3:35pm UTC](https://discourse.julialang.org/t/could-you-please-produce-a-new-toml-for-textanalysis-its-downgrading-dataframes-version/51819 "2020-12-15T15:35:03Z")

</div>

When Adding TextAnalysis package it downgrades DataFrames to 0.21.8. I need to user 0.22 version. Could you please update TextAnalysis to suppots Dataframes 0.22+? Thansks,

---

## [Rationale & operations for built-in \`HTML\` type](https://discourse.julialang.org/t/rationale-operations-for-built-in-html-type/50585)

<div class="topic-metadata">

**Author:** [@cce](https://discourse.julialang.org/u/cce)\
**Replies:** 12\
**Last updated:** [December 15, 2020, 2:39pm UTC](https://discourse.julialang.org/t/rationale-operations-for-built-in-html-type/50585 "2020-12-15T14:39:31Z")

</div>

I’m curious about the scope of the built-in HTML type. It’s nice that something like this exists, to indicate that a given string value is intended to be valid HTML. However, it doesn’t seem that general operations on …

---

## [How to replace consume and produce with channels](https://discourse.julialang.org/t/how-to-replace-consume-and-produce-with-channels/5125)

<div class="topic-metadata">

**Author:** [@scidom](https://discourse.julialang.org/u/scidom)\
**Replies:** 14\
**Last updated:** [December 15, 2020, 1:12pm UTC](https://discourse.julialang.org/t/how-to-replace-consume-and-produce-with-channels/5125 "2020-12-15T13:12:56Z")

</div>

I got a deprecation warning while trying to upgrade to Julia v0.6, saying that the consume() and produce() functions are not available anymore, and that I should use channels. The usage of channels is not clear to me ye…

---

## [Using incompletely initialized structs instead of fields of type Union{Nothing,T}](https://discourse.julialang.org/t/using-incompletely-initialized-structs-instead-of-fields-of-type-union-nothing-t/51831)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 8\
**Last updated:** [December 15, 2020, 12:20pm UTC](https://discourse.julialang.org/t/using-incompletely-initialized-structs-instead-of-fields-of-type-union-nothing-t/51831 "2020-12-15T12:20:19Z")

</div>

Suppose I want to define a custom type that I initialize gradually one field at a time. I could do something like this: mutable struct A x::Union{Nothing, Int} y::Union{Nothing, Bool} z::Union{Nothing, Strin…

---

## [Interpolating in a heatmap using Gnuplot.jl](https://discourse.julialang.org/t/interpolating-in-a-heatmap-using-gnuplot-jl/51683)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 6\
**Last updated:** [December 15, 2020, 12:20pm UTC](https://discourse.julialang.org/t/interpolating-in-a-heatmap-using-gnuplot-jl/51683 "2020-12-15T12:20:18Z")

</div>

I have a matrix with dimensions 26 x 25 and am using gnuplot to create a heatmap. This is relatively simple by running @gp :- comb "w image pixels". However, I have two questions Is it possible to interpolate data so…

---

## [Is the type-instability in take!(::RemoteChannel) of practical concern?](https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [December 15, 2020, 12:15pm UTC](https://discourse.julialang.org/t/is-the-type-instability-in-take-remotechannel-of-practical-concern/51864 "2020-12-15T12:15:18Z")

</div>

For example: julia\> using Distributed julia\> r = RemoteChannel(()-\>Channel{Bool}(Inf)) RemoteChannel{Channel{Bool}}(1, 1, 1) julia\> @code\_warntype take!(r) Variables #self#::Core.Compiler.Const(take!, false) rr::R…

---

## [Calling a Julia function from Python--pass a dictionary of arguments and get an array returned](https://discourse.julialang.org/t/calling-a-julia-function-from-python-pass-a-dictionary-of-arguments-and-get-an-array-returned/32052)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 4\
**Last updated:** [December 15, 2020, 2:41am UTC](https://discourse.julialang.org/t/calling-a-julia-function-from-python-pass-a-dictionary-of-arguments-and-get-an-array-returned/32052 "2020-12-15T02:41:53Z")

</div>

I am writing a little package in julia, but I also need to plug the package into an existing python jupyter notebook, etc. So I was hoping someone could tell me how to call a Julia function from Python 3. That is, I wan…

---

## [Help with @generated](https://discourse.julialang.org/t/help-with-generated/51829)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 1\
**Last updated:** [December 14, 2020, 11:32pm UTC](https://discourse.julialang.org/t/help-with-generated/51829 "2020-12-14T23:32:16Z")

</div>

Apart from what I am asking below, I would really appreciate if someone could point me to some resource that explains the usage of the macro generated. I want to write a function that will loop through an array and will…

---

## [Easier way to split-apply-combine in DataFrames.jl](https://discourse.julialang.org/t/easier-way-to-split-apply-combine-in-dataframes-jl/51779)

<div class="topic-metadata">

**Author:** [@stefanjwojcik](https://discourse.julialang.org/u/stefanjwojcik)\
**Replies:** 5\
**Last updated:** [December 14, 2020, 10:03pm UTC](https://discourse.julialang.org/t/easier-way-to-split-apply-combine-in-dataframes-jl/51779 "2020-12-14T22:03:01Z")

</div>

I am updating some code that uses DataFrames.jl. I formerly used the by command and the aggregate command to execute commands over multiple columns, but it looks like these commands were deprecated recently. The updates …

---

## [Help avoid a bit of python](https://discourse.julialang.org/t/help-avoid-a-bit-of-python/51802)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 4\
**Last updated:** [December 14, 2020, 8:54pm UTC](https://discourse.julialang.org/t/help-avoid-a-bit-of-python/51802 "2020-12-14T20:54:51Z")

</div>

I’m using the Picamera library to grab an image from a Pi Camera on a Raspberry Pi. The main Python code in question is (found here): import io import time import picamera from PIL import Image # Create the in-memory s…

---

## [NLopt not optimising](https://discourse.julialang.org/t/nlopt-not-optimising/51796)

<div class="topic-metadata">

**Author:** [@Massimiliano\_Vasile](https://discourse.julialang.org/u/Massimiliano_Vasile)\
**Replies:** 13\
**Last updated:** [December 14, 2020, 8:53pm UTC](https://discourse.julialang.org/t/nlopt-not-optimising/51796 "2020-12-14T20:53:19Z")

</div>

Hi I am rather new to Julia and I am experimenting with NLopt. I ran the tests on github and they work fine but then I tried my own objective and constraints. function ps(x,grad) return x\[1\] end function ps\_con(x,gr…

---

## [How to read long output from external command?](https://discourse.julialang.org/t/how-to-read-long-output-from-external-command/47870)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 4\
**Last updated:** [December 14, 2020, 7:44pm UTC](https://discourse.julialang.org/t/how-to-read-long-output-from-external-command/47870 "2020-12-14T19:44:38Z")

</div>

I’m trying to read all the output from an external program like this (MWE): out = Pipe() run(pipeline(\`head -c10 /dev/urandom\`, stdout=out), wait=true) close(out.in) read(out) |\> length # shows "10" as expected This is…

---

## [Any French working days/holiday calendar?](https://discourse.julialang.org/t/any-french-working-days-holiday-calendar/51808)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [December 14, 2020, 6:04pm UTC](https://discourse.julialang.org/t/any-french-working-days-holiday-calendar/51808 "2020-12-14T18:04:43Z")

</div>

Is there any package that returns false/true (or even better a \[0,1\] float for sub-country holidays averaged by population… yeahh… but this would be too much :slight\_smile: :slight\_smile: ) for something like isholiday.(…

---

## [No more evaluation in closed module in Julia 1.5+ == no more code-gen in modules?](https://discourse.julialang.org/t/no-more-evaluation-in-closed-module-in-julia-1-5-no-more-code-gen-in-modules/51804)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 9\
**Last updated:** [December 14, 2020, 4:16pm UTC](https://discourse.julialang.org/t/no-more-evaluation-in-closed-module-in-julia-1-5-no-more-code-gen-in-modules/51804 "2020-12-14T16:16:29Z")

</div>

In some “helper package” (module) I have some functions similar to that one: function make\_polynomial(c::Array{T,1} where T\<:Number; return\_code=false) if length(c) == 1 f\_body = :($(c\[1\])) else …

---

## [In-REPL pager for Markdown](https://discourse.julialang.org/t/in-repl-pager-for-markdown/51768)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 2\
**Last updated:** [December 14, 2020, 4:09pm UTC](https://discourse.julialang.org/t/in-repl-pager-for-markdown/51768 "2020-12-14T16:09:12Z")

</div>

I’m trying to print Markdown output to the terminal, which I can accomplish with… using Markdown md\_str = md"# My Header" display(md\_str) Ideally, I’d like to print this to a pager, not the REPL itself. However, Inter…

---

## [Finding size of a google protocol buffer object](https://discourse.julialang.org/t/finding-size-of-a-google-protocol-buffer-object/51803)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 0\
**Last updated:** [December 14, 2020, 2:02pm UTC](https://discourse.julialang.org/t/finding-size-of-a-google-protocol-buffer-object/51803 "2020-12-14T14:02:10Z")

</div>

I’ve looked through ProtoBuf.jl, and nothing has jumped out. Short of calling writeproto(), is there a way of finding the size of the binary-formatted object?

---

## [Vectorize optimize](https://discourse.julialang.org/t/vectorize-optimize/51513)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 6\
**Last updated:** [December 14, 2020, 9:58am UTC](https://discourse.julialang.org/t/vectorize-optimize/51513 "2020-12-14T09:58:02Z")

</div>

Is there a better way to write this? @pipe \[(1,2),(2,3)\] .|\> (f(x) = (x-\_\[1\])^2 + (x-\_\[2\])^2 ) .|\> optimize(\_, -10,10).minimizer I’d like to minimize a function over a given variable for different values of the oth…

---

## [Understanding when GC.gc() frees memory and doesn't](https://discourse.julialang.org/t/understanding-when-gc-gc-frees-memory-and-doesnt/51682)

<div class="topic-metadata">

**Author:** [@tbenst](https://discourse.julialang.org/u/tbenst)\
**Replies:** 1\
**Last updated:** [December 14, 2020, 8:11am UTC](https://discourse.julialang.org/t/understanding-when-gc-gc-frees-memory-and-doesnt/51682 "2020-12-14T08:11:30Z")

</div>

Consider the two code chunks below. When run in vscode, the first fails to free memory as reported by htop, while the second frees memory successfully. This is not just a reporting issue–if I create another large array i…

---

## [GenericLinearAlgebra overwrites methods from GenericSchur and GenericSVD](https://discourse.julialang.org/t/genericlinearalgebra-overwrites-methods-from-genericschur-and-genericsvd/35056)

<div class="topic-metadata">

**Author:** [@pearlzli](https://discourse.julialang.org/u/pearlzli)\
**Replies:** 4\
**Last updated:** [December 13, 2020, 8:30pm UTC](https://discourse.julialang.org/t/genericlinearalgebra-overwrites-methods-from-genericschur-and-genericsvd/35056 "2020-12-13T20:30:43Z")

</div>

I’m working on a project that uses both GenericLinearAlgebra (dependency of ConvexHull) and GenericSVD and GenericSchur (dependencies of CSVFiles). When I load my project, I get a lot of long warnings about GenericLinear…

---

## [How to let the compiler know that a global variable is type-stable for duration of function](https://discourse.julialang.org/t/how-to-let-the-compiler-know-that-a-global-variable-is-type-stable-for-duration-of-function/51732)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 6\
**Last updated:** [December 13, 2020, 6:43pm UTC](https://discourse.julialang.org/t/how-to-let-the-compiler-know-that-a-global-variable-is-type-stable-for-duration-of-function/51732 "2020-12-13T18:43:02Z")

</div>

I’m trying to run a simulation on a process where a process stream can contain various chemical components. For example, ethanol (C2H5OH) and water (H2). There’s a lot of places in the simulation where it makes sense to …

---

## [Pycall Package install error](https://discourse.julialang.org/t/pycall-package-install-error/51760)

<div class="topic-metadata">

**Author:** [@R\_Surya\_Narayan](https://discourse.julialang.org/u/R_Surya_Narayan)\
**Replies:** 4\
**Last updated:** [December 13, 2020, 3:38pm UTC](https://discourse.julialang.org/t/pycall-package-install-error/51760 "2020-12-13T15:38:21Z")

</div>

Hello everyone, I am trying to call cantera (a python package) from Julia using PyCall, however when I run Pkg.add("PyCall"); I get the following error: Resolving package versions... ERROR: Unsatisfiable requirements …

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

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