# General Usage

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

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

**Page:** 786

---

## [Repeated type parameter in method error of promoting constructor](https://discourse.julialang.org/t/repeated-type-parameter-in-method-error-of-promoting-constructor/34892)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [February 20, 2020, 1:55pm UTC](https://discourse.julialang.org/t/repeated-type-parameter-in-method-error-of-promoting-constructor/34892 "2020-02-20T13:55:27Z")

</div>

Consider the type with the promoting constructor struct Foo{T,TX\<:AbstractVector{T},TFX} Δ::T x::TX fx::TFX residual\_norm::T converged::Bool iterations::Int end function Foo(Δ::T1, x::AbstractVe…

---

## [Queries regarding ray traversing through cube using VoxelRayTracers package](https://discourse.julialang.org/t/queries-regarding-ray-traversing-through-cube-using-voxelraytracers-package/34880)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 4\
**Last updated:** [February 20, 2020, 12:43pm UTC](https://discourse.julialang.org/t/queries-regarding-ray-traversing-through-cube-using-voxelraytracers-package/34880 "2020-02-20T12:43:54Z")

</div>

Hi , I am trying to use VoxelRayTracers.jl. I have few doubts regarding usage of this package. I want to trace a ray through 3D voxelized cube. My aim is to find ray intersected voxels with intersection lengths. How …

---

## [Why is ArgParse slow?](https://discourse.julialang.org/t/why-is-argparse-slow/34741)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 8\
**Last updated:** [February 20, 2020, 12:16pm UTC](https://discourse.julialang.org/t/why-is-argparse-slow/34741 "2020-02-20T12:16:00Z")

</div>

I really love ArgParse.jl - it has a ton of features, the documentation is great, and it works exactly as advertised. But it’s slow. Adding even a couple of arguments adds several seconds to start up time. It’s really am…

---

## [Using ForwardDiff with Custom Struct](https://discourse.julialang.org/t/using-forwarddiff-with-custom-struct/34894)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 3\
**Last updated:** [February 20, 2020, 10:18am UTC](https://discourse.julialang.org/t/using-forwarddiff-with-custom-struct/34894 "2020-02-20T10:18:52Z")

</div>

Hi guys, I have a function, loglikelihood ll, of a vector of parameters that I need to AutoDiff. I also need to apply some transformations within ll, and as long as I keep the Vector form of the input, that works fine. …

---

## [Native GUI suggestion for Linux](https://discourse.julialang.org/t/native-gui-suggestion-for-linux/34722)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 39\
**Last updated:** [February 20, 2020, 6:13am UTC](https://discourse.julialang.org/t/native-gui-suggestion-for-linux/34722 "2020-02-20T06:13:22Z")

</div>

I have some signal processing code (pitch detection from an audio signal) and I would like to write a very simple application that displays the result graphically in a window, continuously updated in real time, maybe con…

---

## [Realtime plotting](https://discourse.julialang.org/t/realtime-plotting/15638)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 9\
**Last updated:** [February 19, 2020, 9:39pm UTC](https://discourse.julialang.org/t/realtime-plotting/15638 "2020-02-19T21:39:15Z")

</div>

Hello, I want to plot real-time flight control data to get a better and faster understanding of the performance of our flight controllers. The incoming data stream might be decoded in a C-function (because it already e…

---

## [How to get the first state of a iterator?](https://discourse.julialang.org/t/how-to-get-the-first-state-of-a-iterator/34846)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 5\
**Last updated:** [February 19, 2020, 8:39pm UTC](https://discourse.julialang.org/t/how-to-get-the-first-state-of-a-iterator/34846 "2020-02-19T20:39:02Z")

</div>

I need to create a vector with the states of an iterator for which the element satisfies a certain condition. However, to do that, I would need to know the first state of an iterator (i.e. the default argument of iterat…

---

## [Filter dict and change its keys](https://discourse.julialang.org/t/filter-dict-and-change-its-keys/34873)

<div class="topic-metadata">

**Author:** [@rvignolo](https://discourse.julialang.org/u/rvignolo)\
**Replies:** 5\
**Last updated:** [February 19, 2020, 7:14pm UTC](https://discourse.julialang.org/t/filter-dict-and-change-its-keys/34873 "2020-02-19T19:14:19Z")

</div>

Is is possible to filter a dictionary and change its keys elegantly? julia\> dict = Dict{Tuple{Symbol,Symbol},Expr}((:X₁, :X₁) =\> :(σX(σ\[1\], X₁)), (:X₁, :X₂) =\> :(σX(σ\[1\], X₁)),(:X₂, :X₂) =\> :(σX(σ\[2\], X₂)),(:X₃, :X₃) =\> …

---

## [Broadcast with container for multidimensional array](https://discourse.julialang.org/t/broadcast-with-container-for-multidimensional-array/34825)

<div class="topic-metadata">

**Author:** [@MaxPauer](https://discourse.julialang.org/u/MaxPauer)\
**Replies:** 3\
**Last updated:** [February 19, 2020, 4:56pm UTC](https://discourse.julialang.org/t/broadcast-with-container-for-multidimensional-array/34825 "2020-02-19T16:56:25Z")

</div>

Hi, I’ve got a container type for a multidimensional array, and I want to redirect the iterate function to the ‘inner’ array. This works fine, except it does not preserve dimensions when combined with a broadcast call. …

---

## [Is there a streamlines function/package?](https://discourse.julialang.org/t/is-there-a-streamlines-function-package/34800)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 9\
**Last updated:** [February 19, 2020, 10:28am UTC](https://discourse.julialang.org/t/is-there-a-streamlines-function-package/34800 "2020-02-19T10:28:04Z")

</div>

Does anyone know of a package to compute 3D streamlines in Julia? Like Matlab’s: Compute 3-D streamline data - MATLAB stream3 - MathWorks Deutschland I specifically want to get the XYZ data describing the streamlines. …

---

## [Not working: \`\`redirect\_stdout(IOBuffer()) do ... end\`\`](https://discourse.julialang.org/t/not-working-redirect-stdout-iobuffer-do-end/34841)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 0\
**Last updated:** [February 19, 2020, 7:17am UTC](https://discourse.julialang.org/t/not-working-redirect-stdout-iobuffer-do-end/34841 "2020-02-19T07:17:03Z")

</div>

Just wanted to use redirect\_stdout function on IOBuffer but this fails… can we transform an IOBuffer to stream type recognized by redirect\_stdout?

---

## [Published VS unpublished // registered vs unregistered](https://discourse.julialang.org/t/published-vs-unpublished-registered-vs-unregistered/34838)

<div class="topic-metadata">

**Author:** [@markushhh](https://discourse.julialang.org/u/markushhh)\
**Replies:** 4\
**Last updated:** [February 19, 2020, 7:11am UTC](https://discourse.julialang.org/t/published-vs-unpublished-registered-vs-unregistered/34838 "2020-02-19T07:11:20Z")

</div>

I read a couple of times that “people” tend to trust registered packages. Where does the difference in trust come from? Is a registered package checked for harmful code? Do I miss a point?

---

## [Executing Packages and Directories](https://discourse.julialang.org/t/executing-packages-and-directories/34819)

<div class="topic-metadata">

**Author:** [@hieronimo](https://discourse.julialang.org/u/hieronimo)\
**Replies:** 3\
**Last updated:** [February 19, 2020, 7:03am UTC](https://discourse.julialang.org/t/executing-packages-and-directories/34819 "2020-02-19T07:03:19Z")

</div>

In Python, one can run a program by package name, file name, directory name or zip file name. Also, one can run commands from stdin (e.g. by pipelines) link In Julia, we can run commands from stdin but it isn’t mentione…

---

## [Functions in function args?](https://discourse.julialang.org/t/functions-in-function-args/34777)

<div class="topic-metadata">

**Author:** [@nmatzke](https://discourse.julialang.org/u/nmatzke)\
**Replies:** 3\
**Last updated:** [February 19, 2020, 4:11am UTC](https://discourse.julialang.org/t/functions-in-function-args/34777 "2020-02-19T04:11:36Z")

</div>

Hi all! I am wondering – in R, you can default function argument defaults with functions, e.g. tmpfun ← function(a, b=2\*a) { return(a+b) } tmpfun(a=1) Returns: 3 …is anything like this possible in Julia? It’s not…

---

## [What would be the best way / command to bechmark Geopandas vs VegaLite?](https://discourse.julialang.org/t/what-would-be-the-best-way-command-to-bechmark-geopandas-vs-vegalite/34779)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 3\
**Last updated:** [February 19, 2020, 1:47am UTC](https://discourse.julialang.org/t/what-would-be-the-best-way-command-to-bechmark-geopandas-vs-vegalite/34779 "2020-02-19T01:47:25Z")

</div>

Hi I have plotted a choropleth map using Geopandas (Python) and Vegalite (Julia). I want to benchmark both of them (ease of use, speed, etc). I am very interested in speed. So maybe a @time or @time\_ns or tic() toc(),…

---

## [Ccall help](https://discourse.julialang.org/t/ccall-help/34785)

<div class="topic-metadata">

**Author:** [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Replies:** 8\
**Last updated:** [February 19, 2020, 1:30am UTC](https://discourse.julialang.org/t/ccall-help/34785 "2020-02-19T01:30:37Z")

</div>

Hi all, I’m trying to get OnlinePackage to be able to post a package on github, but also set up the necessary SSH keys to get documenter building. I had it working on travis, but now I’m trying to get it work with githu…

---

## [Dynamically assign variables in a function](https://discourse.julialang.org/t/dynamically-assign-variables-in-a-function/34833)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 2\
**Last updated:** [February 18, 2020, 10:19pm UTC](https://discourse.julialang.org/t/dynamically-assign-variables-in-a-function/34833 "2020-02-18T22:19:31Z")

</div>

I would like to assign variables in functions. For example, function func(p) a = A(p) b = B(p) c = C(p) # Then do something using a, b, c end Those a, b, c are parameters I want to use in the function, and they depend …

---

## ["LoadError: invalid redefinition of constant" when creating new Distribution](https://discourse.julialang.org/t/loaderror-invalid-redefinition-of-constant-when-creating-new-distribution/34786)

<div class="topic-metadata">

**Author:** [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)\
**Replies:** 3\
**Last updated:** [February 18, 2020, 9:51pm UTC](https://discourse.julialang.org/t/loaderror-invalid-redefinition-of-constant-when-creating-new-distribution/34786 "2020-02-18T21:51:24Z")

</div>

I am trying to create a new distribution (bivariate Projected Normal) using skellam.jl as an example, however I am getting this error: push!(LOAD\_PATH, ".") using Revise using ProjectedNormal ┌ Info: Precompiling Proj…

---

## [Is there a faster way to extract single rows of a dataframe than the filter function](https://discourse.julialang.org/t/is-there-a-faster-way-to-extract-single-rows-of-a-dataframe-than-the-filter-function/34821)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 3\
**Last updated:** [February 18, 2020, 9:50pm UTC](https://discourse.julialang.org/t/is-there-a-faster-way-to-extract-single-rows-of-a-dataframe-than-the-filter-function/34821 "2020-02-18T21:50:02Z")

</div>

Hi how’s it going, here is the code I’m currently using: df is a 1 row dataframe. df2 is a multiple row dataframe x= filter(row → row\[Symbol(‘ID’)\]\[1\]==df\[Symbol(“ID”)\]\[1\], df2\]) So essentially I’m trying to do a loo…

---

## [Error reported in a blank line (MethodError: no method matching getindex(::Float64, ::UnitRange{Int64})](https://discourse.julialang.org/t/error-reported-in-a-blank-line-methoderror-no-method-matching-getindex-float64-unitrange-int64/34766)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 5\
**Last updated:** [February 18, 2020, 9:46pm UTC](https://discourse.julialang.org/t/error-reported-in-a-blank-line-methoderror-no-method-matching-getindex-float64-unitrange-int64/34766 "2020-02-18T21:46:56Z")

</div>

Question solved: At the end this is found to be due to multiplying a constant with a vector, while the error report is a bit distracting (in line much ). for i in 1:nDemes println("deme### ", i) NDeme = …

---

## [Delete rows in DataFrame Conditionally](https://discourse.julialang.org/t/delete-rows-in-dataframe-conditionally/34774)

<div class="topic-metadata">

**Author:** [@aedunn12](https://discourse.julialang.org/u/aedunn12)\
**Replies:** 4\
**Last updated:** [February 18, 2020, 8:36pm UTC](https://discourse.julialang.org/t/delete-rows-in-dataframe-conditionally/34774 "2020-02-18T20:36:37Z")

</div>

I’m trying to delete specific rows in my DataFrame based on conditionals of the row above. In my data, there is a repeated row of the same time point at each time that a medication is administered. My goal is to delete a…

---

## [Macro cannot see variables in calling function's scope](https://discourse.julialang.org/t/macro-cannot-see-variables-in-calling-functions-scope/34806)

<div class="topic-metadata">

**Author:** [@brownlight](https://discourse.julialang.org/u/brownlight)\
**Replies:** 4\
**Last updated:** [February 18, 2020, 7:00pm UTC](https://discourse.julialang.org/t/macro-cannot-see-variables-in-calling-functions-scope/34806 "2020-02-18T19:00:38Z")

</div>

Scenario: A variable exists in the (local) scope of a function. func1 calls macro passing it the variable as a parameter. But, the macro can’t see the variable. I have run into this issue when migrating code from versio…

---

## [Performance of Cartesian Indices and Views](https://discourse.julialang.org/t/performance-of-cartesian-indices-and-views/34820)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 0\
**Last updated:** [February 18, 2020, 5:51pm UTC](https://discourse.julialang.org/t/performance-of-cartesian-indices-and-views/34820 "2020-02-18T17:51:55Z")

</div>

Hello all, I have a some code that uses Cartesian Indices that slows down heavily when views are involved. The slowdown is dimension dependent, I was able to figure out that it is because in some cases things inline/unr…

---

## [Perf improvement suggestion for simple extrema](https://discourse.julialang.org/t/perf-improvement-suggestion-for-simple-extrema/34776)

<div class="topic-metadata">

**Author:** [@wizebt](https://discourse.julialang.org/u/wizebt)\
**Replies:** 4\
**Last updated:** [February 18, 2020, 2:30pm UTC](https://discourse.julialang.org/t/perf-improvement-suggestion-for-simple-extrema/34776 "2020-02-18T14:30:28Z")

</div>

While working on large arrays (images) searching for the fastest min/max and extrema I struggled to findout that recent fast minimum and maximum implementation use reduce. However extrema can be improved julia\> versioni…

---

## [@inbounds macro on sparse arrays](https://discourse.julialang.org/t/inbounds-macro-on-sparse-arrays/34810)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 2\
**Last updated:** [February 18, 2020, 2:19pm UTC](https://discourse.julialang.org/t/inbounds-macro-on-sparse-arrays/34810 "2020-02-18T14:19:21Z")

</div>

Hi all, the @inbounds macro can speed up the in-place editing of a standard array by a factor of two; however it has no performance gain for the same task when applied on a sparse matrix. Please see my test functions an…

---

## [Status of libraries for saving binary files: composite datatypes](https://discourse.julialang.org/t/status-of-libraries-for-saving-binary-files-composite-datatypes/34809)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 2\
**Last updated:** [February 18, 2020, 2:16pm UTC](https://discourse.julialang.org/t/status-of-libraries-for-saving-binary-files-composite-datatypes/34809 "2020-02-18T14:16:29Z")

</div>

Hi, I am having some serious trouble saving composite datatypes. For small output files, BSON works fine. However, in cases where it is hard to split the output into many chunks, I tried to use JLD2. Unfortunately, thi…

---

## [Profiling module precompilation](https://discourse.julialang.org/t/profiling-module-precompilation/33438)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 6\
**Last updated:** [February 18, 2020, 1:30pm UTC](https://discourse.julialang.org/t/profiling-module-precompilation/33438 "2020-02-18T13:30:20Z")

</div>

Hi! My package (AugmentedGaussianProcesses.jl) always take forever to precompile when I make modifications. I would like to see where the bottlenecks are to eventually optimize or remove problematic stuff. Is there any…

---

## [Evaluating a Julia Expr using a C++ class](https://discourse.julialang.org/t/evaluating-a-julia-expr-using-a-c-class/34621)

<div class="topic-metadata">

**Author:** [@ReinhardMu](https://discourse.julialang.org/u/ReinhardMu)\
**Replies:** 1\
**Last updated:** [February 18, 2020, 12:30pm UTC](https://discourse.julialang.org/t/evaluating-a-julia-expr-using-a-c-class/34621 "2020-02-18T12:30:58Z")

</div>

Hello, I am trying to write an interface for an existing global optimization solver written in C++, so that it can be used in JUMP. The solver needs to evaluate the functions defining the optimization problem with a gi…

---

## [Cell array or 3d array that enable its sub-matrix (2d array) freely renew themself without size constraint](https://discourse.julialang.org/t/cell-array-or-3d-array-that-enable-its-sub-matrix-2d-array-freely-renew-themself-without-size-constraint/34211)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 9\
**Last updated:** [February 18, 2020, 10:26am UTC](https://discourse.julialang.org/t/cell-array-or-3d-array-that-enable-its-sub-matrix-2d-array-freely-renew-themself-without-size-constraint/34211 "2020-02-18T10:26:17Z")

</div>

Hi community, What I am looking for is described in the title (as the row numbers of my 2d sub-matrixs are changing within a for loop). The only expression of cell array I found, as below, doesn’t work any more. A = …

---

## [Fortran - common block](https://discourse.julialang.org/t/fortran-common-block/34798)

<div class="topic-metadata">

**Author:** [@josemaria](https://discourse.julialang.org/u/josemaria)\
**Replies:** 1\
**Last updated:** [February 18, 2020, 8:58am UTC](https://discourse.julialang.org/t/fortran-common-block/34798 "2020-02-18T08:58:22Z")

</div>

Where could I see an example about how to interface with common blocks in Fortran?

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

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