# General Usage

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

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

**Page:** 474

---

## [Using splat inside macro](https://discourse.julialang.org/t/using-splat-inside-macro/77761)

<div class="topic-metadata">

**Author:** [@pjgorski](https://discourse.julialang.org/u/pjgorski)\
**Replies:** 3\
**Last updated:** [March 14, 2022, 9:33am UTC](https://discourse.julialang.org/t/using-splat-inside-macro/77761 "2022-03-14T09:33:44Z")

</div>

I wanted to create a macro to print simulation status every now and then. function display\_res(ntuple::NamedTuple) cur = Dates.format(now(), "HH:MM:SS dd.mm.yyyy"); str = savename(ntuple, connector="; ", sort = …

---

## [For T in (Float64,) vs let T=Float64](https://discourse.julialang.org/t/for-t-in-float64-vs-let-t-float64/77842)

<div class="topic-metadata">

**Author:** [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Replies:** 3\
**Last updated:** [March 14, 2022, 6:26am UTC](https://discourse.julialang.org/t/for-t-in-float64-vs-let-t-float64/77842 "2022-03-14T06:26:23Z")

</div>

I wonder why the first one in the following fails for T in (Float64,) sizefloat(x::T) = sizeof(T) println(methods(sizefloat)) println(sizefloat(3.4)) end ERROR: UndefVarError: T not defined Stacktrace: \[1\]…

---

## [Data Interpolation on a spherical or geographic coordinate system](https://discourse.julialang.org/t/data-interpolation-on-a-spherical-or-geographic-coordinate-system/77833)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 1\
**Last updated:** [March 13, 2022, 11:18pm UTC](https://discourse.julialang.org/t/data-interpolation-on-a-spherical-or-geographic-coordinate-system/77833 "2022-03-13T23:18:36Z")

</div>

I am just starting a new project where I want to use the Agents.jl package to create an agent based model. The nice thing about Agents.jl is that it supports geographic meshes or grids, like the WGS84 projection, which i…

---

## [Help reducing compilation time](https://discourse.julialang.org/t/help-reducing-compilation-time/77823)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 8\
**Last updated:** [March 13, 2022, 8:58pm UTC](https://discourse.julialang.org/t/help-reducing-compilation-time/77823 "2022-03-13T20:58:53Z")

</div>

Hi! I have the following function: function textview( lines::Vector{T}, view::NTuple{4, Int}; active\_highlight::String = \_CSI \* "30;43m", active\_match::Int = 0, frozen\_columns\_at\_beginning::Int = 0,…

---

## [Julia app as package?](https://discourse.julialang.org/t/julia-app-as-package/77831)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [March 13, 2022, 8:37pm UTC](https://discourse.julialang.org/t/julia-app-as-package/77831 "2022-03-13T20:37:02Z")

</div>

I have a Julia application (https://github.com/ufechner7/KiteViewer) which I might want to convert into a Julia package. Main reasons: easier to install, no git needed easier to use continues integration because for p…

---

## [AMD Rome vs Intel Xeon shows bad scaling with threads for AMD](https://discourse.julialang.org/t/amd-rome-vs-intel-xeon-shows-bad-scaling-with-threads-for-amd/77683)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 20\
**Last updated:** [March 13, 2022, 6:53pm UTC](https://discourse.julialang.org/t/amd-rome-vs-intel-xeon-shows-bad-scaling-with-threads-for-amd/77683 "2022-03-13T18:53:17Z")

</div>

I ran my 3D finite difference stencil benchmark https://github.com/Chiil/MicroHH.jl/blob/main/test/dynamics\_kernel.jl on AMD Rome 7H12 and Intel Xeon Platinum 8360Y with grid spacing (itot = 256; jtot = 256; ktot = 1024)…

---

## [Weights and indices for linear interpolation/extrapolation](https://discourse.julialang.org/t/weights-and-indices-for-linear-interpolation-extrapolation/77580)

<div class="topic-metadata">

**Author:** [@fredrikpaues](https://discourse.julialang.org/u/fredrikpaues)\
**Replies:** 15\
**Last updated:** [March 12, 2022, 7:29pm UTC](https://discourse.julialang.org/t/weights-and-indices-for-linear-interpolation-extrapolation/77580 "2022-03-12T19:29:10Z")

</div>

A performance-critical function of a bigger program that I’m writing consists of locating points on a grid. It amounts to finding the indices and weights needed for a linear interpolation/extrapolation—without doing the …

---

## [Convex hull and its edges](https://discourse.julialang.org/t/convex-hull-and-its-edges/77787)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 2\
**Last updated:** [March 13, 2022, 12:50am UTC](https://discourse.julialang.org/t/convex-hull-and-its-edges/77787 "2022-03-13T00:50:07Z")

</div>

Hello, My R package cxhull is based on the C library Qhull. Not only it can compute the vertices of a convex hull, it also returns the edges of the convex hull, and more. I need the edges of the convex hull of a set of…

---

## [Question regarding "WARNING: ignoring conflicting import"](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579)

<div class="topic-metadata">

**Author:** [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Replies:** 3\
**Last updated:** [March 13, 2022, 12:41am UTC](https://discourse.julialang.org/t/question-regarding-warning-ignoring-conflicting-import/77579 "2022-03-13T00:41:00Z")

</div>

No matter how many times I run the following, I get no warning or error: using CSV: getrow However, I get warning when I do this more than once: module Test function func() println("func") end end using .Test: …

---

## [Defining parametric unions with no parametric members](https://discourse.julialang.org/t/defining-parametric-unions-with-no-parametric-members/77786)

<div class="topic-metadata">

**Author:** [@pgoulart](https://discourse.julialang.org/u/pgoulart)\
**Replies:** 6\
**Last updated:** [March 13, 2022, 12:09am UTC](https://discourse.julialang.org/t/defining-parametric-unions-with-no-parametric-members/77786 "2022-03-13T00:09:24Z")

</div>

I am trying to understand the syntax and requirements for defining parametric union types. It seems that defining a parametric union doesn’t work unless at least one of its components is also parametric. Example: F…

---

## [Struct of Arrays (SoA) vs Array of Structs (AoS)](https://discourse.julialang.org/t/struct-of-arrays-soa-vs-array-of-structs-aos/30015)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 30\
**Last updated:** [March 12, 2022, 10:47pm UTC](https://discourse.julialang.org/t/struct-of-arrays-soa-vs-array-of-structs-aos/30015 "2022-03-12T22:47:43Z")

</div>

There are two ways to arrange data in memory. SoA means Struct of Arrays and AoS means Array of Structs. I’m trying to understand when one is better than the other in Julia. I was reading @ChrisRackauckas fantastic lect…

---

## [Possible threading bug on M1 Max (only ARM build)](https://discourse.julialang.org/t/possible-threading-bug-on-m1-max-only-arm-build/77779)

<div class="topic-metadata">

**Author:** [@robertfeldt](https://discourse.julialang.org/u/robertfeldt)\
**Replies:** 19\
**Last updated:** [March 12, 2022, 10:01pm UTC](https://discourse.julialang.org/t/possible-threading-bug-on-m1-max-only-arm-build/77779 "2022-03-12T22:01:01Z")

</div>

Got a new MacBook Pro 16" M1 Max with 64GB mem and installed both the 1.7.2 ARM build and the 1.6.5 macOS (so non-ARM) build. The simple Threads.@threads example from the doc pages behaves as expected on the non-arm buil…

---

## [Compute Distribution among binary vector](https://discourse.julialang.org/t/compute-distribution-among-binary-vector/77792)

<div class="topic-metadata">

**Author:** [@GoYetChallenged](https://discourse.julialang.org/u/GoYetChallenged)\
**Replies:** 1\
**Last updated:** [March 12, 2022, 8:21pm UTC](https://discourse.julialang.org/t/compute-distribution-among-binary-vector/77792 "2022-03-12T20:21:43Z")

</div>

I want to compute marginal distributions among binary data.For example, I have several vectors like a = \[0, 1, 0, 1\] b = \[1, 0, 0, 1\] and compute all possible distributions, like P(a=0, b=0) = 1/4, P(a=0, b=1) = 1/4, P…

---

## [PlotlyJS subplots](https://discourse.julialang.org/t/plotlyjs-subplots/48173)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 4\
**Last updated:** [March 11, 2022, 8:52pm UTC](https://discourse.julialang.org/t/plotlyjs-subplots/48173 "2022-03-11T20:52:35Z")

</div>

Is there a way how to plot subplots containing more than one scatter plot? Here is just example where I tried to put 3 scatter plots into the first subplot: using PlotlyBase trace1a = scatter(x=1:3, y=2:4) trace1b …

---

## [\`length.(AbstractArray\[\])\` and \`size.(AbstractArray\[\])\` return empty arrays of \`Any\`](https://discourse.julialang.org/t/length-abstractarray-and-size-abstractarray-return-empty-arrays-of-any/77749)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 19\
**Last updated:** [March 11, 2022, 7:59pm UTC](https://discourse.julialang.org/t/length-abstractarray-and-size-abstractarray-return-empty-arrays-of-any/77749 "2022-03-11T19:59:28Z")

</div>

Code: julia\> length.(AbstractArray\[\]) Any\[\] Wat?.. I should be expecting an array of lengths, right? AbstractArray\[\] is empty, so it should be an empty array of lengths. A length is a number. The length of a finite col…

---

## [Accessing fields of structs passed from C to Julia](https://discourse.julialang.org/t/accessing-fields-of-structs-passed-from-c-to-julia/77712)

<div class="topic-metadata">

**Author:** [@acarta](https://discourse.julialang.org/u/acarta)\
**Replies:** 9\
**Last updated:** [March 11, 2022, 6:05pm UTC](https://discourse.julialang.org/t/accessing-fields-of-structs-passed-from-c-to-julia/77712 "2022-03-11T18:05:06Z")

</div>

I’m using PackageCompiler to create a C-compatible library. The library’s main purpose is to analyze data that’s collected and passed from an existing C codebase. The communication between my library and the existing co…

---

## [@isdefined in eltype implementation](https://discourse.julialang.org/t/isdefined-in-eltype-implementation/77759)

<div class="topic-metadata">

**Author:** [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Replies:** 2\
**Last updated:** [March 11, 2022, 4:54pm UTC](https://discourse.julialang.org/t/isdefined-in-eltype-implementation/77759 "2022-03-11T16:54:03Z")

</div>

Hi, I’m trying to figure out what @isdefined is doing here: eltype(::Type{\<:AbstractArray{E}}) where {E} = @isdefined(E) ? E : Any How can E not be defined at this point? Thanks

---

## [Install package error: curl: (60) Cert verify failed: BADCERT\_NOT\_TRUSTED](https://discourse.julialang.org/t/install-package-error-curl-60-cert-verify-failed-badcert-not-trusted/42731)

<div class="topic-metadata">

**Author:** [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)\
**Replies:** 2\
**Last updated:** [March 11, 2022, 4:29pm UTC](https://discourse.julialang.org/t/install-package-error-curl-60-cert-verify-failed-badcert-not-trusted/42731 "2022-03-11T16:29:35Z")

</div>

julia\> versioninfo() Julia Version 1.4.1 Commit 381693d3df\* (2020-04-14 17:20 UTC) Platform Info: OS: Linux (x86\_64-pc-linux-gnu) CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz WORD\_SIZE: 64 LIBM: libopenlibm L…

---

## [Outline cell of heatmap](https://discourse.julialang.org/t/outline-cell-of-heatmap/77758)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 0\
**Last updated:** [March 11, 2022, 3:54pm UTC](https://discourse.julialang.org/t/outline-cell-of-heatmap/77758 "2022-03-11T15:54:27Z")

</div>

Suppose I have a heatmap. For example r = rand(1:10,5,5) heatmap(r) I would like to outline one of its cells with a dashed red rectangle. Do you have any suggestion on how to achieve this? See an example below, where …

---

## [Is there a bug in package Market Data?](https://discourse.julialang.org/t/is-there-a-bug-in-package-market-data/77751)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 2\
**Last updated:** [March 11, 2022, 2:31pm UTC](https://discourse.julialang.org/t/is-there-a-bug-in-package-market-data/77751 "2022-03-11T14:31:58Z")

</div>

Maybe the package MarketData has a small bug. I ran the following: using Dates, DataFrames, MarketData DataFrame(yahoo("^GSPC")) The result is a dataframe with the last line duplicated. This is what is printed on the s…

---

## [Inspect inferred types and generated codes for inner functions](https://discourse.julialang.org/t/inspect-inferred-types-and-generated-codes-for-inner-functions/77688)

<div class="topic-metadata">

**Author:** [@Uroc327](https://discourse.julialang.org/u/Uroc327)\
**Replies:** 5\
**Last updated:** [March 11, 2022, 1:58pm UTC](https://discourse.julialang.org/t/inspect-inferred-types-and-generated-codes-for-inner-functions/77688 "2022-03-11T13:58:04Z")

</div>

Often it is convenient to have inner functions, eg for functional ones like mapreduce. How can I apply code inspection macros like @code\_llvm or @code\_warntype to the “full” function? Example: julia\> function test(a) …

---

## [Implementing leaf and non-leaf node by using parametric type](https://discourse.julialang.org/t/implementing-leaf-and-non-leaf-node-by-using-parametric-type/77686)

<div class="topic-metadata">

**Author:** [@ykkan](https://discourse.julialang.org/u/ykkan)\
**Replies:** 3\
**Last updated:** [March 11, 2022, 1:15pm UTC](https://discourse.julialang.org/t/implementing-leaf-and-non-leaf-node-by-using-parametric-type/77686 "2022-03-11T13:15:20Z")

</div>

Hello everyone, I would like to implement a binary tree by using the parametric type instead of inheritance. The structure is something like # leaf node struct Node{T} vale::T first\_weights::Nothing second\_weigh…

---

## [Is admonition available in Franklin.jl?](https://discourse.julialang.org/t/is-admonition-available-in-franklin-jl/77727)

<div class="topic-metadata">

**Author:** [@Natsulait](https://discourse.julialang.org/u/Natsulait)\
**Replies:** 7\
**Last updated:** [March 11, 2022, 1:13pm UTC](https://discourse.julialang.org/t/is-admonition-available-in-franklin-jl/77727 "2022-03-11T13:13:47Z")

</div>

I found that in Franklin’s website: I wonder how I can do this.

---

## [Obtaining parameter types for a function](https://discourse.julialang.org/t/obtaining-parameter-types-for-a-function/62169)

<div class="topic-metadata">

**Author:** [@harris-chris](https://discourse.julialang.org/u/harris-chris)\
**Replies:** 13\
**Last updated:** [March 11, 2022, 7:31am UTC](https://discourse.julialang.org/t/obtaining-parameter-types-for-a-function/62169 "2022-03-11T07:31:22Z")

</div>

Hello all, Is there any way to obtain the parameter types for a given method? For example, if I have function f(x::Int64) x end, is there a way to recover the type of parameter x? I realize that generic methods may make…

---

## [What's the problem with this simple multi-thread code?](https://discourse.julialang.org/t/whats-the-problem-with-this-simple-multi-thread-code/77626)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 17\
**Last updated:** [March 11, 2022, 4:50am UTC](https://discourse.julialang.org/t/whats-the-problem-with-this-simple-multi-thread-code/77626 "2022-03-11T04:50:18Z")

</div>

I defined a very simple function to compute the dot product, which is supposed to be equivalent to dot(x,A,y) in the package LinearAlgebra. For performance, I use Threads.@threads to make it multi-thread: using Benchmar…

---

## [Tullio - multiline syntax - Soft or hard local scope?](https://discourse.julialang.org/t/tullio-multiline-syntax-soft-or-hard-local-scope/77616)

<div class="topic-metadata">

**Author:** [@Emmanuel-R8](https://discourse.julialang.org/u/Emmanuel-R8)\
**Replies:** 6\
**Last updated:** [March 11, 2022, 2:51am UTC](https://discourse.julialang.org/t/tullio-multiline-syntax-soft-or-hard-local-scope/77616 "2022-03-11T02:51:04Z")

</div>

I have a block of code using Tullio with a begin ... end syntax. I discovered that, within the block, only = can be used. No := will be acctepted. My problem now is that on execution that patch\_mean is an unknown symbo…

---

## [Generate a random number exclusive on both sides: smaller# \< x \< larger#?](https://discourse.julialang.org/t/generate-a-random-number-exclusive-on-both-sides-smaller-x-larger/77719)

<div class="topic-metadata">

**Author:** [@Bob\_Bass](https://discourse.julialang.org/u/Bob_Bass)\
**Replies:** 6\
**Last updated:** [March 10, 2022, 10:02pm UTC](https://discourse.julialang.org/t/generate-a-random-number-exclusive-on-both-sides-smaller-x-larger/77719 "2022-03-10T22:02:53Z")

</div>

Hi. How can I generate a random real number between -3 and 3 that is exclusive on both sides? Thank you.

---

## [PNGFiles load from stream doesn't work with TCPSocket](https://discourse.julialang.org/t/pngfiles-load-from-stream-doesnt-work-with-tcpsocket/77713)

<div class="topic-metadata">

**Author:** [@joeynelson](https://discourse.julialang.org/u/joeynelson)\
**Replies:** 0\
**Last updated:** [March 10, 2022, 7:08pm UTC](https://discourse.julialang.org/t/pngfiles-load-from-stream-doesnt-work-with-tcpsocket/77713 "2022-03-10T19:08:44Z")

</div>

I have a simple server that just serves up a raw PNG file any client that connects. In Julia I wrote the following function to attempt to load that image. function ReadTeensyImage(server) sock = Sockets.connect(ser…

---

## [Need Help with accented characters](https://discourse.julialang.org/t/need-help-with-accented-characters/77699)

<div class="topic-metadata">

**Author:** [@folleyz](https://discourse.julialang.org/u/folleyz)\
**Replies:** 5\
**Last updated:** [March 10, 2022, 6:58pm UTC](https://discourse.julialang.org/t/need-help-with-accented-characters/77699 "2022-03-10T18:58:56Z")

</div>

Hello, i’m new in Julia and i’m facing a problem with accented characters like ã or á. I loaded a dataframe from my SQLServer Database using ODBC and i’m having trouble to Uppercase the column “unidade”, i think this oc…

---

## [OpenCV VideoWriter\_fourcc error](https://discourse.julialang.org/t/opencv-videowriter-fourcc-error/77710)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 0\
**Last updated:** [March 10, 2022, 6:22pm UTC](https://discourse.julialang.org/t/opencv-videowriter-fourcc-error/77710 "2022-03-10T18:22:43Z")

</div>

Hello, Running the below instructions as preparation for writing a sequence of images to a video file with OpenCV as framework: using OpenCV; const cv = OpenCV fourcc = cv.VideoWriter\_fourcc(\*'XVID') The instruction …

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

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