# General Usage

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

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

**Page:** 565

---

## [Help wanted to create Julia binding for the MGIS project using CxxWrap and testing](https://discourse.julialang.org/t/help-wanted-to-create-julia-binding-for-the-mgis-project-using-cxxwrap-and-testing/24244)

<div class="topic-metadata">

**Author:** [@thelfer](https://discourse.julialang.org/u/thelfer)\
**Replies:** 0\
**Last updated:** [May 15, 2019, 4:09pm UTC](https://discourse.julialang.org/t/help-wanted-to-create-julia-binding-for-the-mgis-project-using-cxxwrap-and-testing/24244 "2019-05-15T16:09:14Z")

</div>

Hi, I hope that this request is not off-topic. I am the main developper of a project called MGIS (https://github.com/thelfer/MFrontGenericInterfaceSupport) which aims at providing tools to interact with the mechanical …

---

## [Embedding C++ code inside a Julia function using Cxx package](https://discourse.julialang.org/t/embedding-c-code-inside-a-julia-function-using-cxx-package/30659)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [November 3, 2019, 4:50pm UTC](https://discourse.julialang.org/t/embedding-c-code-inside-a-julia-function-using-cxx-package/30659 "2019-11-03T16:50:45Z")

</div>

Hey, I was playing with the Cxx package and tried the following code and got confused. :wink: julia\> function playing() for i=1:5 icxx""" int tellme; std:…

---

## [How to make CxxWrap bindings to a std::vector\<std::tuple...?](https://discourse.julialang.org/t/how-to-make-cxxwrap-bindings-to-a-std-vector-std-tuple/37976)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 0\
**Last updated:** [April 21, 2020, 5:24pm UTC](https://discourse.julialang.org/t/how-to-make-cxxwrap-bindings-to-a-std-vector-std-tuple/37976 "2020-04-21T17:24:59Z")

</div>

I’m continuing on my CxxWrap.jl journey… I would like to wrap a function that returns the complex type: std::vector\<std::tuple\<int, int\> \>. A function that returns simply a tuple or a vector works fine. I can also get …

---

## [Compiling CUDA code with Cxx.jl](https://discourse.julialang.org/t/compiling-cuda-code-with-cxx-jl/28382)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 0\
**Last updated:** [September 4, 2019, 5:57pm UTC](https://discourse.julialang.org/t/compiling-cuda-code-with-cxx-jl/28382 "2019-09-04T17:57:45Z")

</div>

Hi, I was wondering whether there is an example where they compile a CUDA code with Cxx.jl with specific compiler flags. So my question is actually two fold: how to pass specific compiler flags? how to compile cuda c…

---

## [Help needed for packaging a C++ wrapper with CxxWrap](https://discourse.julialang.org/t/help-needed-for-packaging-a-c-wrapper-with-cxxwrap/41591)

<div class="topic-metadata">

**Author:** [@cstich](https://discourse.julialang.org/u/cstich)\
**Replies:** 0\
**Last updated:** [June 17, 2020, 1:01pm UTC](https://discourse.julialang.org/t/help-needed-for-packaging-a-c-wrapper-with-cxxwrap/41591 "2020-06-17T13:01:37Z")

</div>

I have written a Julia wrapper for a C++ library using CxxWrapper . I don’t have much experience with C++ but I managed to compile everything with cmake into a shared library and I can call the function I want from withi…

---

## [How to use @code\_native with Cxx.jl](https://discourse.julialang.org/t/how-to-use-code-native-with-cxx-jl/34556)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 0\
**Last updated:** [February 13, 2020, 5:26am UTC](https://discourse.julialang.org/t/how-to-use-code-native-with-cxx-jl/34556 "2020-02-13T05:26:18Z")

</div>

Hi, If I do something like using Cxx cxx""" double f(double x) { return 2.0\*pow(x,4)-3.0\*pow(x,3)+2.0\*pow(x,2)-x; } """ jf(x) = @cxx f(x) and then do @code\_native jf(2.0) the code appears to be the code that call…

---

## [Call C++ dll used Cxx.jl on windows](https://discourse.julialang.org/t/call-c-dll-used-cxx-jl-on-windows/60766)

<div class="topic-metadata">

**Author:** [@wgst1024](https://discourse.julialang.org/u/wgst1024)\
**Replies:** 0\
**Last updated:** [May 8, 2021, 8:46am UTC](https://discourse.julialang.org/t/call-c-dll-used-cxx-jl-on-windows/60766 "2021-05-08T08:46:41Z")

</div>

Refer to official documents Example 8: Using C++ with shared libraries，the example is on linux，but I want to test on windows. https://github.com/JuliaInterop/Cxx.jl JuliaDll.h #ifndef ARRAYMAKER\_H #define ARRAYMAKER…

---

## [Reviving concrete package depending on Cxx.jl](https://discourse.julialang.org/t/reviving-concrete-package-depending-on-cxx-jl/51734)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 0\
**Last updated:** [December 12, 2020, 6:34pm UTC](https://discourse.julialang.org/t/reviving-concrete-package-depending-on-cxx-jl/51734 "2020-12-12T18:34:48Z")

</div>

Case and point. Last Friday, 11 December, there was a meeting of Julia users from Discours working in high energy physics (topic for another discusion). At the top of priorities emerges reviving of ROOT.jl package, which…

---

## [Handling of single object vs. 1-element array of object](https://discourse.julialang.org/t/handling-of-single-object-vs-1-element-array-of-object/65949)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 13\
**Last updated:** [August 7, 2021, 6:22am UTC](https://discourse.julialang.org/t/handling-of-single-object-vs-1-element-array-of-object/65949 "2021-08-07T06:22:36Z")

</div>

See for example mutable struct Coords x::Float64 y::Float64 z::Float64 end Coords() = Coords(rand(), rand(), rand()) c5 = \[Coords() for i in 1:5\] c1a = \[Coords() for i in 1:1\] c1b = Coords() fieldnames(type…

---

## [PlotlyJS: how to introduce shapes into time series?](https://discourse.julialang.org/t/plotlyjs-how-to-introduce-shapes-into-time-series/65955)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 5\
**Last updated:** [August 7, 2021, 12:25am UTC](https://discourse.julialang.org/t/plotlyjs-how-to-introduce-shapes-into-time-series/65955 "2021-08-07T00:25:27Z")

</div>

Hi, I need to insert shapes into a time series using PlotlyJS, and name them. I know how to do it using Plots or PGFPlotsX. For example, what I want is something similar to the following plot, produced with PGFPlotsX aft…

---

## [Type inference with a tuple slice](https://discourse.julialang.org/t/type-inference-with-a-tuple-slice/33650)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 13\
**Last updated:** [August 6, 2021, 10:20pm UTC](https://discourse.julialang.org/t/type-inference-with-a-tuple-slice/33650 "2021-08-06T22:20:07Z")

</div>

Hi, I’m playing around with NTuple to better familiarize myself with variable length function argument etc. In the process, I encountered an example where type inference failed. Here is a minimal example. function test…

---

## [How to include a module from a specific path directory in REPL of VS Code?](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 5\
**Last updated:** [August 6, 2021, 7:30pm UTC](https://discourse.julialang.org/t/how-to-include-a-module-from-a-specific-path-directory-in-repl-of-vs-code/65914 "2021-08-06T19:30:32Z")

</div>

I have a module called (SynchronousMachines) in this path directory (C:\\Work\\Julia\\Simulation\\SynchronousMachine), as seen below: I need to include this module from the RELP (not main code) in VS code. For this I am …

---

## [How to convert multi-dimensional indices into one-dimensional indices](https://discourse.julialang.org/t/how-to-convert-multi-dimensional-indices-into-one-dimensional-indices/65950)

<div class="topic-metadata">

**Author:** [@Valery](https://discourse.julialang.org/u/Valery)\
**Replies:** 3\
**Last updated:** [August 6, 2021, 5:05pm UTC](https://discourse.julialang.org/t/how-to-convert-multi-dimensional-indices-into-one-dimensional-indices/65950 "2021-08-06T17:05:41Z")

</div>

A = rand(3,3) b = findall(A .\> .5) For instance: 3-element Vector{CartesianIndex{2}}: CartesianIndex(1,1) CartesianIndex(3,1) CartesianIndex(2,2) How to do if I want b to contain the corresponding Int to access the ar…

---

## [Findall() but returning a bool array](https://discourse.julialang.org/t/findall-but-returning-a-bool-array/65934)

<div class="topic-metadata">

**Author:** [@Valery](https://discourse.julialang.org/u/Valery)\
**Replies:** 3\
**Last updated:** [August 6, 2021, 4:27pm UTC](https://discourse.julialang.org/t/findall-but-returning-a-bool-array/65934 "2021-08-06T16:27:08Z")

</div>

Hi all, I would have liked the findall() function to return booleans. Code example: A = \[1 2; 3 4\] B = findall(\>(2),A) C = \[0 0; 1 1\] B == C This code will obviously return false at the B==C assertion. What should I …

---

## [Length(skipmissing( )) not implemented](https://discourse.julialang.org/t/length-skipmissing-not-implemented/65943)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 7\
**Last updated:** [August 6, 2021, 4:24pm UTC](https://discourse.julialang.org/t/length-skipmissing-not-implemented/65943 "2021-08-06T16:24:48Z")

</div>

julia\> x = \[2.0, missing, 3.0\]; julia\> length(x) 3 julia\> length(skipmissing(x)) ERROR: MethodError: no method matching length(::Base.SkipMissing{Vector{Union{Missing, Float64}}}) julia\> count(a -\> true, skipmissing(x…

---

## [From a Julia program, run a ffmpeg shell command on a folder of files to make a mp4 movie](https://discourse.julialang.org/t/from-a-julia-program-run-a-ffmpeg-shell-command-on-a-folder-of-files-to-make-a-mp4-movie/65910)

<div class="topic-metadata">

**Author:** [@nelsonah](https://discourse.julialang.org/u/nelsonah)\
**Replies:** 2\
**Last updated:** [August 6, 2021, 4:10pm UTC](https://discourse.julialang.org/t/from-a-julia-program-run-a-ffmpeg-shell-command-on-a-folder-of-files-to-make-a-mp4-movie/65910 "2021-08-06T16:10:53Z")

</div>

Presently I have a Julia script file that generates a folder of jpeg files. Then I launch Windows PowerShell in that folder and execute my ffmpeg command such as: ffmpeg -r 50 -start\_number 10001 -i i\_%5d.jpeg -c:v lib…

---

## [Key BlackBoxOptim not found](https://discourse.julialang.org/t/key-blackboxoptim-not-found/65919)

<div class="topic-metadata">

**Author:** [@mengxiaoliu](https://discourse.julialang.org/u/mengxiaoliu)\
**Replies:** 1\
**Last updated:** [August 6, 2021, 2:49pm UTC](https://discourse.julialang.org/t/key-blackboxoptim-not-found/65919 "2021-08-06T14:49:00Z")

</div>

Hello, I am examining the parallel computing speed in BlackBoxOptim by optimizing the Rosebrock function using codes adapted from rosenbrock\_parallel.jl by @robertfeldt. The code I run is as follows: using Distributed …

---

## [Savefig() in Plots.jl is slow when I scatter 13056 points](https://discourse.julialang.org/t/savefig-in-plots-jl-is-slow-when-i-scatter-13056-points/54443)

<div class="topic-metadata">

**Author:** [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Replies:** 22\
**Last updated:** [August 6, 2021, 11:02am UTC](https://discourse.julialang.org/t/savefig-in-plots-jl-is-slow-when-i-scatter-13056-points/54443 "2021-08-06T11:02:38Z")

</div>

Hi everyone, I am using Plots with pyplot() backend. I have a set of ~200 points to scatter, each of them has a unique marker size and color. I also need to plot several lines. After all steps with plot!() and scatter!(…

---

## [Concrete Example 0805: how to prevent using global variable in the module?](https://discourse.julialang.org/t/concrete-example-0805-how-to-prevent-using-global-variable-in-the-module/65917)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 6\
**Last updated:** [August 6, 2021, 10:50am UTC](https://discourse.julialang.org/t/concrete-example-0805-how-to-prevent-using-global-variable-in-the-module/65917 "2021-08-06T10:50:08Z")

</div>

I learned from all of you that Julia discourage global variable. Thank you very much indeed! I am translating my Fortran code to Julia. It is a Monte Carlo parametric expectation maximization code. Basically using gauss…

---

## [SplitODEProblem efficiency against classical ODEProblem](https://discourse.julialang.org/t/splitodeproblem-efficiency-against-classical-odeproblem/65232)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 4\
**Last updated:** [August 6, 2021, 10:34am UTC](https://discourse.julialang.org/t/splitodeproblem-efficiency-against-classical-odeproblem/65232 "2021-08-06T10:34:38Z")

</div>

Hello, I read the documentation of the DifferentialEquations.jl package. I had an ODE problem where the RHS is f(u, p, t) = ( L + L(t) ) \* u, where L and L(t) are two sparse matrices (usually 600x600 matrix with a lot …

---

## [Explicitly declaring the ODE Jacobian being less efficiently](https://discourse.julialang.org/t/explicitly-declaring-the-ode-jacobian-being-less-efficiently/65045)

<div class="topic-metadata">

**Author:** [@Caique\_Rodrigues](https://discourse.julialang.org/u/Caique_Rodrigues)\
**Replies:** 16\
**Last updated:** [August 6, 2021, 10:22am UTC](https://discourse.julialang.org/t/explicitly-declaring-the-ode-jacobian-being-less-efficiently/65045 "2021-08-06T10:22:50Z")

</div>

One of the problems that I am solving, without explicitly declaring the jacobian, was being solved in, roughly, 800 seconds. It isn’t that fast, the system is really stiff, but I am trying to optimize it as far as I can.…

---

## [Should there be a \`mapfilter\` function or macro?](https://discourse.julialang.org/t/should-there-be-a-mapfilter-function-or-macro/65933)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 5\
**Last updated:** [August 6, 2021, 10:18am UTC](https://discourse.julialang.org/t/should-there-be-a-mapfilter-function-or-macro/65933 "2021-08-06T10:18:58Z")

</div>

I often encounter a scenario, where I use map but then notice in the body of the closure that I want to throw away some values. I think there’s no simple way to do this. Here’s a mockup version: itr = 1:100 mapfilter(it…

---

## [Is multi-threading in Julia more like openMP or MPI?](https://discourse.julialang.org/t/is-multi-threading-in-julia-more-like-openmp-or-mpi/65930)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 2\
**Last updated:** [August 6, 2021, 9:30am UTC](https://discourse.julialang.org/t/is-multi-threading-in-julia-more-like-openmp-or-mpi/65930 "2021-08-06T09:30:44Z")

</div>

It is very beneficial to talk with you guys about Julia. I noticed that when you guys talking about prevent using global variables, many of you repeatedly mentioned that it can be thread safe not to use global variable. …

---

## [How to display the elements of 1D array in one line?](https://discourse.julialang.org/t/how-to-display-the-elements-of-1d-array-in-one-line/65925)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 6\
**Last updated:** [August 6, 2021, 8:12am UTC](https://discourse.julialang.org/t/how-to-display-the-elements-of-1d-array-in-one-line/65925 "2021-08-06T08:12:00Z")

</div>

I have an array a, a=Array{Float64,1}() for i in 1:10 push!(a,i\*10.0) end display(a) However, println or display, they all show the elements of the array vertically, like below 10-element Array{Float64,1}: 10.0 …

---

## [Typeof a function](https://discourse.julialang.org/t/typeof-a-function/65865)

<div class="topic-metadata">

**Author:** [@Judd](https://discourse.julialang.org/u/Judd)\
**Replies:** 19\
**Last updated:** [August 6, 2021, 8:04am UTC](https://discourse.julialang.org/t/typeof-a-function/65865 "2021-08-06T08:04:21Z")

</div>

What does the output mean? #1, #2, and couting. julia\> typeof((a::Int64) -\> a + 1) var"#1#2" julia\> typeof((a::Int64) -\> a + 1) var"#3#4"

---

## [How to correctly define and use global variables in the module in Julia?](https://discourse.julialang.org/t/how-to-correctly-define-and-use-global-variables-in-the-module-in-julia/65720)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 19\
**Last updated:** [August 6, 2021, 7:54am UTC](https://discourse.julialang.org/t/how-to-correctly-define-and-use-global-variables-in-the-module-in-julia/65720 "2021-08-06T07:54:52Z")

</div>

In fortran, we know that we can in a module define a global variable (use the private property), so that we can use the subroutines in the module to set or change the values of that variable. That updated variable can be…

---

## [Poor speed gain using \`pmap\`](https://discourse.julialang.org/t/poor-speed-gain-using-pmap/65694)

<div class="topic-metadata">

**Author:** [@Rick](https://discourse.julialang.org/u/Rick)\
**Replies:** 17\
**Last updated:** [August 6, 2021, 8:01am UTC](https://discourse.julialang.org/t/poor-speed-gain-using-pmap/65694 "2021-08-06T08:01:49Z")

</div>

Hi, I am using the pmap function for parallelization. However, the speedup is not satisfactory. The speed gain is very far from linear. As an illustration, I count the time used when each simulation draws 10,000,000 ran…

---

## [Updating the location of a method definition](https://discourse.julialang.org/t/updating-the-location-of-a-method-definition/65247)

<div class="topic-metadata">

**Author:** [@gcv](https://discourse.julialang.org/u/gcv)\
**Replies:** 8\
**Last updated:** [August 6, 2021, 6:28am UTC](https://discourse.julialang.org/t/updating-the-location-of-a-method-definition/65247 "2021-08-06T06:28:58Z")

</div>

Is there a good way to change where Julia thinks a method definition is located (file and line number)? I got halfway there with this: m = first(methods(MyModule.mymethod)) m.file = Symbol("/path/to/real/file") m.line =…

---

## [How to delete the columns of a dataframe that have only positive values?](https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922)

<div class="topic-metadata">

**Author:** [@Vzehnder](https://discourse.julialang.org/u/Vzehnder)\
**Replies:** 1\
**Last updated:** [August 6, 2021, 5:06am UTC](https://discourse.julialang.org/t/how-to-delete-the-columns-of-a-dataframe-that-have-only-positive-values/65922 "2021-08-06T05:06:32Z")

</div>

I’m trying to edit a DataFrame, my objective is to keep the columns in which at least one value is \<=0. For example, using the code using DataFrames data = Dict("A"=\>\[1,7,2\], "B"=\>\[3,-9,-3\], "C"=\>\[3,0,6\], …

---

## [Does Julia have format IO like Fortran or even better?](https://discourse.julialang.org/t/does-julia-have-format-io-like-fortran-or-even-better/65923)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 2\
**Last updated:** [August 6, 2021, 3:29am UTC](https://discourse.julialang.org/t/does-julia-have-format-io-like-fortran-or-even-better/65923 "2021-08-06T03:29:42Z")

</div>

I am 100% sure that Julia have more efficient format IO than Fortran. But could any one advice how to do format IO, or like, is there some packages to use so that the output could be nicer? Thanks! For example, in a Fo…

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

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