# General Usage

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

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

**Page:** 439

---

## [DataType to String](https://discourse.julialang.org/t/datatype-to-string/82405)

<div class="topic-metadata">

**Author:** [@chiion](https://discourse.julialang.org/u/chiion)\
**Replies:** 7\
**Last updated:** [June 8, 2022, 9:38am UTC](https://discourse.julialang.org/t/datatype-to-string/82405 "2022-06-08T09:38:46Z")

</div>

Hi All, I’m writing a module with a function that converts an internal DataType into a string. However, without importing/exporting the DataType, the module name is added to the string. Example: module A struct T…

---

## [Detecting \`Tuple{Type{some type}}\`](https://discourse.julialang.org/t/detecting-tuple-type-some-type/82406)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 3\
**Last updated:** [June 8, 2022, 7:32am UTC](https://discourse.julialang.org/t/detecting-tuple-type-some-type/82406 "2022-06-08T07:32:39Z")

</div>

I’d like to check if a variabe is of the form Tuple{Type{Complex}} or Tuple{Type{Float64}} or anything else where the inner-most thing is a type. Here are a couple of my failed attempts: julia\> Tuple{Type{Complex}} isa …

---

## [Using eval to evaluate a variable inside an expression when string interpolation is not ok](https://discourse.julialang.org/t/using-eval-to-evaluate-a-variable-inside-an-expression-when-string-interpolation-is-not-ok/82356)

<div class="topic-metadata">

**Author:** [@mikeliux](https://discourse.julialang.org/u/mikeliux)\
**Replies:** 5\
**Last updated:** [June 8, 2022, 5:56am UTC](https://discourse.julialang.org/t/using-eval-to-evaluate-a-variable-inside-an-expression-when-string-interpolation-is-not-ok/82356 "2022-06-08T05:56:24Z")

</div>

I am learning Julia and I am trying to create a function to shuffle an n-dimensional array X along a desired dimension. This same strategy will be used later to split an array into 2 subarrays along a desired dimension. …

---

## [Links to the source in the documentation](https://discourse.julialang.org/t/links-to-the-source-in-the-documentation/82385)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 7\
**Last updated:** [June 8, 2022, 4:52am UTC](https://discourse.julialang.org/t/links-to-the-source-in-the-documentation/82385 "2022-06-08T04:52:48Z")

</div>

How does one get the links to the source to show up in the documentation? Like this one:

---

## [Get latest frame from VideoIO.opencamera() buffer](https://discourse.julialang.org/t/get-latest-frame-from-videoio-opencamera-buffer/82400)

<div class="topic-metadata">

**Author:** [@arnief3](https://discourse.julialang.org/u/arnief3)\
**Replies:** 0\
**Last updated:** [June 8, 2022, 2:44am UTC](https://discourse.julialang.org/t/get-latest-frame-from-videoio-opencamera-buffer/82400 "2022-06-08T02:44:09Z")

</div>

Is it possible to grab the latest frame from the VideoIO.opencamera() buffer. Can I flush the buffer so that read(cam) waits for a new frame? Right now I am forced to close and reopen the camera each time I want to grab …

---

## [Is there a trick to input an \`Expr\` into a macro?](https://discourse.julialang.org/t/is-there-a-trick-to-input-an-expr-into-a-macro/82383)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 7\
**Last updated:** [June 8, 2022, 2:27am UTC](https://discourse.julialang.org/t/is-there-a-trick-to-input-an-expr-into-a-macro/82383 "2022-06-08T02:27:08Z")

</div>

AFAIK a macro only works like a “tag” on source code that is parsed to input expressions for the macro. Is there a way to make a macro work on an Expr instance? I’m aware that this might be a problem because macros are …

---

## [Regular grid](https://discourse.julialang.org/t/regular-grid/82371)

<div class="topic-metadata">

**Author:** [@sbrisard](https://discourse.julialang.org/u/sbrisard)\
**Replies:** 9\
**Last updated:** [June 8, 2022, 1:34am UTC](https://discourse.julialang.org/t/regular-grid/82371 "2022-06-08T01:34:25Z")

</div>

Hello there, I’m implementing Siddon’s algorithm for the calculation of the radiological path through an array of voxels. I was wondering what would be the most Juliesque way to define a regular grid? As an array of Ste…

---

## [What data structure do I need? (and is it implemented in Julia?)](https://discourse.julialang.org/t/what-data-structure-do-i-need-and-is-it-implemented-in-julia/82378)

<div class="topic-metadata">

**Author:** [@JAgho](https://discourse.julialang.org/u/JAgho)\
**Replies:** 5\
**Last updated:** [June 7, 2022, 7:43pm UTC](https://discourse.julialang.org/t/what-data-structure-do-i-need-and-is-it-implemented-in-julia/82378 "2022-06-07T19:43:46Z")

</div>

I have a collection of coordinates which is a fixed set. I collect these into groups using some arbitrary clustering scheme. Consequently I now hold some collection of arrays. I need to be able to merge groups together, …

---

## [What is the equivalent of this OpenMP Directive in Julia?](https://discourse.julialang.org/t/what-is-the-equivalent-of-this-openmp-directive-in-julia/82014)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 14\
**Last updated:** [June 7, 2022, 7:13pm UTC](https://discourse.julialang.org/t/what-is-the-equivalent-of-this-openmp-directive-in-julia/82014 "2022-06-07T19:13:09Z")

</div>

What is the equivalent to the below command in Julia, in which I can run a specific code (or function) on a specific CPU core? !$OMP PARALLEL # Code !$OMP END PARALLEL

---

## [ProgressMeter while using DataFrame commands?](https://discourse.julialang.org/t/progressmeter-while-using-dataframe-commands/65405)

<div class="topic-metadata">

**Author:** [@joonp](https://discourse.julialang.org/u/joonp)\
**Replies:** 2\
**Last updated:** [June 7, 2022, 6:38pm UTC](https://discourse.julialang.org/t/progressmeter-while-using-dataframe-commands/65405 "2022-06-07T18:38:09Z")

</div>

Hi, I have a code chunk that uses DataFrame groupby() and combine() and that requires heavy computation for each group. I would like to see its progress such as out of n groups… how many groups have finished the computa…

---

## [Why is Traceur Warning: is assigned as Union{Nothing, Tuple{Int64, Int64}}?](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322)

<div class="topic-metadata">

**Author:** [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Replies:** 2\
**Last updated:** [June 7, 2022, 2:41pm UTC](https://discourse.julialang.org/t/why-is-traceur-warning-is-assigned-as-union-nothing-tuple-int64-int64/82322 "2022-06-07T14:41:17Z")

</div>

Hello, I am optimizing my code. I have made all the types stable according to @code\_warntype, but @trace is still giving me this warning throughout my code Warning: is assigned as Union{Nothing, Tuple{Int64, Int64}} …

---

## [Small changes on large arrays of custom types: mutable or immutable? shallow or deepcopy?](https://discourse.julialang.org/t/small-changes-on-large-arrays-of-custom-types-mutable-or-immutable-shallow-or-deepcopy/82335)

<div class="topic-metadata">

**Author:** [@skraemer](https://discourse.julialang.org/u/skraemer)\
**Replies:** 3\
**Last updated:** [June 7, 2022, 12:56pm UTC](https://discourse.julialang.org/t/small-changes-on-large-arrays-of-custom-types-mutable-or-immutable-shallow-or-deepcopy/82335 "2022-06-07T12:56:51Z")

</div>

(I have previously asked this on the New to Julia category, but I think might rather belong here) There are a few things somehow all related about the following situation concerning mutability to which I can not find a …

---

## [Prepare self-hosted runner on Windows 10 for Github Actions and Julia private registry and packages](https://discourse.julialang.org/t/prepare-self-hosted-runner-on-windows-10-for-github-actions-and-julia-private-registry-and-packages/82367)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 0\
**Last updated:** [June 7, 2022, 12:18pm UTC](https://discourse.julialang.org/t/prepare-self-hosted-runner-on-windows-10-for-github-actions-and-julia-private-registry-and-packages/82367 "2022-06-07T12:18:01Z")

</div>

Leaving this here just as an instruction for others. I’ve tried to add Windows self-hosted runner to build and test my private package and got the following error: \> Run julia-actions/add-julia-registry@v1 C:\\Windows\\S…

---

## [Unregistered dependencies do not work with unregistered package](https://discourse.julialang.org/t/unregistered-dependencies-do-not-work-with-unregistered-package/82340)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [June 7, 2022, 11:48am UTC](https://discourse.julialang.org/t/unregistered-dependencies-do-not-work-with-unregistered-package/82340 "2022-06-07T11:48:20Z")

</div>

Hi all, I have two unregistered packages on a private repo, A and B. A is a dependency of B. When I set up the packages locally, and add the unregistered package to the Project.toml, everything works ok. However, if I …

---

## [Benchmarking all algorithms in DiffEq/Optimisation code](https://discourse.julialang.org/t/benchmarking-all-algorithms-in-diffeq-optimisation-code/82358)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 1\
**Last updated:** [June 7, 2022, 11:05am UTC](https://discourse.julialang.org/t/benchmarking-all-algorithms-in-diffeq-optimisation-code/82358 "2022-06-07T11:05:41Z")

</div>

If I have some ODE code, say this code from the https://diffeq.sciml.ai/stable/tutorials/advanced\_ode\_example/: using DifferentialEquations, LinearAlgebra, SparseArrays const N = 32 const xyd\_brusselator = range(0,stop…

---

## [RISC-V Dev Term r01](https://discourse.julialang.org/t/risc-v-dev-term-r01/82345)

<div class="topic-metadata">

**Author:** [@AlanAylmer](https://discourse.julialang.org/u/AlanAylmer)\
**Replies:** 3\
**Last updated:** [June 7, 2022, 9:28am UTC](https://discourse.julialang.org/t/risc-v-dev-term-r01/82345 "2022-06-07T09:28:01Z")

</div>

Hi everyone. I got a ClockworkPi Dev Term r01 and the website says Julia is tested on clockwork pi. Seems like the sort of thing julia users (like me!) would like. The Kinetic Kudu Debian OS shipped with the box doesn’…

---

## [Failing to register new version because](https://discourse.julialang.org/t/failing-to-register-new-version-because/82346)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 9\
**Last updated:** [June 7, 2022, 8:30am UTC](https://discourse.julialang.org/t/failing-to-register-new-version-because/82346 "2022-06-07T08:30:02Z")

</div>

What does this mean? \[ Info: Attempting to \`Pkg.add\` the package Copying registry from \`~/work/General/General\` Copied registry \`General\` to \`/tmp/jl\_jNfC54/registries/General\` \[ Info: Attempting to \`Pkg.add\`…

---

## [Bottom horizontal legend](https://discourse.julialang.org/t/bottom-horizontal-legend/62548)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 4\
**Last updated:** [June 7, 2022, 7:26am UTC](https://discourse.julialang.org/t/bottom-horizontal-legend/62548 "2022-06-07T07:26:54Z")

</div>

layer = let n = 100 df = (; x=rand(n), y=rand(n), c=rand(\["a", "b", "c"\], n), ) d = data(df) m = mapping(:x, :y, color=:c) v = visual(Lines) d \* m \* v end grid = draw(layer) leg = only(x for …

---

## [How to distribute the solving of a linear system on multiple Procs?](https://discourse.julialang.org/t/how-to-distribute-the-solving-of-a-linear-system-on-multiple-procs/82359)

<div class="topic-metadata">

**Author:** [@Eurel](https://discourse.julialang.org/u/Eurel)\
**Replies:** 0\
**Last updated:** [June 7, 2022, 7:24am UTC](https://discourse.julialang.org/t/how-to-distribute-the-solving-of-a-linear-system-on-multiple-procs/82359 "2022-06-07T07:24:06Z")

</div>

I intend to solve a linear system on a cluster and expect some scaling. I tried to combine DistributedArrays.jl with IterativeSolvers.jl on my local machine but it would seem the overhead isn’t worth it. using Distrib…

---

## [Dictionary Issue when using MAT.jl](https://discourse.julialang.org/t/dictionary-issue-when-using-mat-jl/82334)

<div class="topic-metadata">

**Author:** [@Aditya\_Rai](https://discourse.julialang.org/u/Aditya_Rai)\
**Replies:** 6\
**Last updated:** [June 7, 2022, 5:52am UTC](https://discourse.julialang.org/t/dictionary-issue-when-using-mat-jl/82334 "2022-06-07T05:52:26Z")

</div>

Hi Everyone, I am new to Julia and I was trying to convert some MATLAB code to Julia. The code I am converting uses .MAT file ( a MATLAB file to store workspace variables). In order to load this .MAT file I am using MAT…

---

## [Setting up a SDESystem, encountering an error while using structural\_simplify](https://discourse.julialang.org/t/setting-up-a-sdesystem-encountering-an-error-while-using-structural-simplify/82313)

<div class="topic-metadata">

**Author:** [@Rohan\_Rajagopal](https://discourse.julialang.org/u/Rohan_Rajagopal)\
**Replies:** 2\
**Last updated:** [June 7, 2022, 5:04am UTC](https://discourse.julialang.org/t/setting-up-a-sdesystem-encountering-an-error-while-using-structural-simplify/82313 "2022-06-07T05:04:48Z")

</div>

Setting up a SDESystem, encountering an error while using structural\_simplify that I can’t quite understand. using ModelingToolkit, Symbolics, Plots, DifferentialEquations, LogExpFunctions e\_0 = 2.5 ν\_0 = 6 r = 0.56 …

---

## [Semaphore with permit id?](https://discourse.julialang.org/t/semaphore-with-permit-id/82142)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 1\
**Last updated:** [June 7, 2022, 2:50am UTC](https://discourse.julialang.org/t/semaphore-with-permit-id/82142 "2022-06-07T02:50:44Z")

</div>

I’d like to use a Semaphore like object with say four permits, where a call to acquire would tell me which of the four permits was assigned and a call to release would release that specific permit. I understand that Sem…

---

## [Results of SecondOrderODEProblem give ERROR: This object is not a GPU array](https://discourse.julialang.org/t/results-of-secondorderodeproblem-give-error-this-object-is-not-a-gpu-array/82100)

<div class="topic-metadata">

**Author:** [@Molox](https://discourse.julialang.org/u/Molox)\
**Replies:** 2\
**Last updated:** [June 6, 2022, 9:02pm UTC](https://discourse.julialang.org/t/results-of-secondorderodeproblem-give-error-this-object-is-not-a-gpu-array/82100 "2022-06-06T21:02:47Z")

</div>

This is a sample code I found on DiffEqGPU. I can easily get results using Array(sol) for 1st order ODE, but for 2nd order, it returns “ERROR: This object is not a GPU array” Thanks for the help!! # -----------------…

---

## [Closures over types are type unstable](https://discourse.julialang.org/t/closures-over-types-are-type-unstable/82337)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 6\
**Last updated:** [June 6, 2022, 7:33pm UTC](https://discourse.julialang.org/t/closures-over-types-are-type-unstable/82337 "2022-06-06T19:33:00Z")

</div>

The closure returned by the following function function f(x::AbstractArray) T = eltype(x) ax = axes(x) return () -\> zeros(T, 1000) end is type unstable: @code\_warntype f(rand(3))() Met…

---

## [Expressiveness for queries](https://discourse.julialang.org/t/expressiveness-for-queries/82318)

<div class="topic-metadata">

**Author:** [@kumarbalachandran](https://discourse.julialang.org/u/kumarbalachandran)\
**Replies:** 3\
**Last updated:** [June 6, 2022, 6:58pm UTC](https://discourse.julialang.org/t/expressiveness-for-queries/82318 "2022-06-06T18:58:04Z")

</div>

I have a table, with some missing values and I wanted to do a data retrieval from the table. It so happened that a comparison of the DataFrames implementation I came up with is much more wordy than the equivalent Pandas.…

---

## [Saving sufficient information about array to construct a similar one later](https://discourse.julialang.org/t/saving-sufficient-information-about-array-to-construct-a-similar-one-later/82331)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 2\
**Last updated:** [June 6, 2022, 6:45pm UTC](https://discourse.julialang.org/t/saving-sufficient-information-about-array-to-construct-a-similar-one-later/82331 "2022-06-06T18:45:47Z")

</div>

I have a function f which takes in x::AbstractArray. My function returns another function g (a closure). Inside g, I do not need x, but I need to construct similar(x). Therefore, so that I do not to waste memory by clo…

---

## [Exponentiation returning negative value or zero value when should be positive](https://discourse.julialang.org/t/exponentiation-returning-negative-value-or-zero-value-when-should-be-positive/82330)

<div class="topic-metadata">

**Author:** [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Replies:** 1\
**Last updated:** [June 6, 2022, 6:18pm UTC](https://discourse.julialang.org/t/exponentiation-returning-negative-value-or-zero-value-when-should-be-positive/82330 "2022-06-06T18:18:31Z")

</div>

If I use the exponentiation operator in the terminal for a positive integer to itself, sometimes it returns a negative value or returns zero. Below is two screen shots. Could someone explain why this could be occurr…

---

## [Function to check if a value is contained in a MutableBinaryHeap](https://discourse.julialang.org/t/function-to-check-if-a-value-is-contained-in-a-mutablebinaryheap/82159)

<div class="topic-metadata">

**Author:** [@Alejandro\_Quiaro\_San](https://discourse.julialang.org/u/Alejandro_Quiaro_San)\
**Replies:** 2\
**Last updated:** [June 6, 2022, 4:48pm UTC](https://discourse.julialang.org/t/function-to-check-if-a-value-is-contained-in-a-mutablebinaryheap/82159 "2022-06-06T16:48:26Z")

</div>

Hello everyone. Yesterday I posted this question I found a solution that I would like to share, given an input heap (minhp) and a value that I want to look for (node): function searchhp(minhp,node) #this functio…

---

## [UndefVarError when calling macro inside function](https://discourse.julialang.org/t/undefvarerror-when-calling-macro-inside-function/82320)

<div class="topic-metadata">

**Author:** [@luciano-drozda](https://discourse.julialang.org/u/luciano-drozda)\
**Replies:** 7\
**Last updated:** [June 6, 2022, 4:25pm UTC](https://discourse.julialang.org/t/undefvarerror-when-calling-macro-inside-function/82320 "2022-06-06T16:25:37Z")

</div>

It relates to this post but I’m still unclear about the correct use of esc in my case. I’m willing to call a function func to all fields of a struct. Here’s my macro : macro call\_on\_fields(func, struct\_) exprs = \[:(…

---

## [UInt128 to Float64 conversion](https://discourse.julialang.org/t/uint128-to-float64-conversion/82317)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 2\
**Last updated:** [June 6, 2022, 3:14pm UTC](https://discourse.julialang.org/t/uint128-to-float64-conversion/82317 "2022-06-06T15:14:05Z")

</div>

Came upon an interesting blogpost where the author explains how they implemented their own unsigned 128 bit int to 64 bit float conversion in rust just because they didn’t think it existed, and when they realised it did …

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

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