# General Usage

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

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

**Page:** 516

---

## [Document splatting behaviour in broadcasting](https://discourse.julialang.org/t/document-splatting-behaviour-in-broadcasting/72068)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 7\
**Last updated:** [November 26, 2021, 8:00am UTC](https://discourse.julialang.org/t/document-splatting-behaviour-in-broadcasting/72068 "2021-11-26T08:00:03Z")

</div>

Hello! This use of splatting just turned up in my code: # using Pkg # Pkg.add("ColorTypes") using ColorTypes \_colors = \[\[0.0,0.2,1.0\], \[0.0,0.5,0.0\], \[1.0,0.0,0.0\]\]; \_color = RGB.(\_colors...) # 3-element Array{RGB{Flo…

---

## [ElasticArrays/ArraysofArrays for Vector of Arrays](https://discourse.julialang.org/t/elasticarrays-arraysofarrays-for-vector-of-arrays/70426)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 5\
**Last updated:** [November 25, 2021, 9:04pm UTC](https://discourse.julialang.org/t/elasticarrays-arraysofarrays-for-vector-of-arrays/70426 "2021-11-25T21:04:18Z")

</div>

Dear all, I would like to use ArraysOfArrays and ElasticArrays to handle indexing a Vector vec of type Vector{\<:AbstractArray{T}} where {T} better, as I often need to call vec\[iter\]\[idx\], and afaik with these packages I…

---

## [Deinterleave data](https://discourse.julialang.org/t/deinterleave-data/72013)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 12\
**Last updated:** [November 25, 2021, 1:26pm UTC](https://discourse.julialang.org/t/deinterleave-data/72013 "2021-11-25T13:26:37Z")

</div>

I am de-interleaving data that has been stored as a vector. I would like to store the data as a matrix. I have tried and performance tested 3 methods, and am looking for any comments on how to improve it. And example …

---

## [Issue in loading the model from a stored file](https://discourse.julialang.org/t/issue-in-loading-the-model-from-a-stored-file/72062)

<div class="topic-metadata">

**Author:** [@Dharmaraja\_Muthukris](https://discourse.julialang.org/u/Dharmaraja_Muthukris)\
**Replies:** 0\
**Last updated:** [November 25, 2021, 1:24pm UTC](https://discourse.julialang.org/t/issue-in-loading-the-model-from-a-stored-file/72062 "2021-11-25T13:24:31Z")

</div>

I saved a linear regression model as a .jdl file using JDL package. When I tried to retrieve and try predict with that model I get the following message. Please help me. ERROR: MethodError: no method matching predict(::…

---

## [Visualising Gridap result](https://discourse.julialang.org/t/visualising-gridap-result/71947)

<div class="topic-metadata">

**Author:** [@Aiswarya](https://discourse.julialang.org/u/Aiswarya)\
**Replies:** 1\
**Last updated:** [November 25, 2021, 3:09pm UTC](https://discourse.julialang.org/t/visualising-gridap-result/71947 "2021-11-25T15:09:42Z")

</div>

Is there any way to visualise the solution uh in this code https://gridap.github.io/Tutorials/dev/pages/t001\_poisson/ other than writinfg it as vtk file. plot is not working.

---

## [Rationale for adding singleton dim](https://discourse.julialang.org/t/rationale-for-adding-singleton-dim/72053)

<div class="topic-metadata">

**Author:** [@mottelet](https://discourse.julialang.org/u/mottelet)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 11:17am UTC](https://discourse.julialang.org/t/rationale-for-adding-singleton-dim/72053 "2021-11-25T11:17:16Z")

</div>

Hi. What is the rationale for adding a singleton dimension in the following commands: julia\> A=rand(3,3);A\[:,\[2 1 3\]\] 3×1×3 Array{Float64, 3}: \[:, :, 1\] = 0.7056166212562252 0.6016873438276988 0.8375543887468311 \[:…

---

## [PlotlyJS: stacked barmode not working as expected](https://discourse.julialang.org/t/plotlyjs-stacked-barmode-not-working-as-expected/72035)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 10:41am UTC](https://discourse.julialang.org/t/plotlyjs-stacked-barmode-not-working-as-expected/72035 "2021-11-25T10:41:16Z")

</div>

Hi, I was having a problem with a plot using the stacked bar mode and thought that I would be doing something wrong. I did not understand why because it used to work in the past. So I tried the example in the PlotlyJS d…

---

## [Strange behavior of Range object](https://discourse.julialang.org/t/strange-behavior-of-range-object/72048)

<div class="topic-metadata">

**Author:** [@mottelet](https://discourse.julialang.org/u/mottelet)\
**Replies:** 1\
**Last updated:** [November 25, 2021, 9:37am UTC](https://discourse.julialang.org/t/strange-behavior-of-range-object/72048 "2021-11-25T09:37:53Z")

</div>

Hello, I am wondering why a “potentially” empty (when collected) range such as 10:1 is echoed differently (although equivalently empty) julia\> 10:1 10:9 S.

---

## [How to initialize array with one unknow dimension size](https://discourse.julialang.org/t/how-to-initialize-array-with-one-unknow-dimension-size/72045)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 2\
**Last updated:** [November 25, 2021, 9:17am UTC](https://discourse.julialang.org/t/how-to-initialize-array-with-one-unknow-dimension-size/72045 "2021-11-25T09:17:53Z")

</div>

I am not able to find any example how to initialize 2D array with one unknown dimension. Normally I use: A = zeros(dim1,dim2) for ii = 1:dim2 A\[:,ii\] = some\_function\_returning\_vector\_of\_dim1() end But very ofte…

---

## [Using ccall and pointer to pointer in linked list](https://discourse.julialang.org/t/using-ccall-and-pointer-to-pointer-in-linked-list/72041)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 2\
**Last updated:** [November 25, 2021, 6:55am UTC](https://discourse.julialang.org/t/using-ccall-and-pointer-to-pointer-in-linked-list/72041 "2021-11-25T06:55:39Z")

</div>

Below is an example from K.N.King “C Programming” for a linked list, where add\_to\_list() acts pretty much like pushfirst!() of Julia: #include \<stdio.h\> #include \<stdlib.h\> struct node { int value; struct node …

---

## [Forward mode Autodiff for Matrix multiplication](https://discourse.julialang.org/t/forward-mode-autodiff-for-matrix-multiplication/72032)

<div class="topic-metadata">

**Author:** [@tgautam03](https://discourse.julialang.org/u/tgautam03)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 12:44am UTC](https://discourse.julialang.org/t/forward-mode-autodiff-for-matrix-multiplication/72032 "2021-11-25T00:44:38Z")

</div>

Hi, I’m new to Julia and looking to learn more about Autodiff in julia. I’ve matrix multiplication and want to get the derivative of a matrix wrt to a matrix. For example in the equations below, I want to compute \\frac{…

---

## [PyCall No system-wide Python was found](https://discourse.julialang.org/t/pycall-no-system-wide-python-was-found/71605)

<div class="topic-metadata">

**Author:** [@marcello](https://discourse.julialang.org/u/marcello)\
**Replies:** 5\
**Last updated:** [November 24, 2021, 9:33pm UTC](https://discourse.julialang.org/t/pycall-no-system-wide-python-was-found/71605 "2021-11-24T21:33:07Z")

</div>

Hello Julia/PyCall team, trying to add the PyCall package I get the error build.log\` \[\> \] 0/2 ERROR: Error building \`PyCall\`: ┌ Info: No system-wide Python was found; got the fol…

---

## [Passing an array of structures through \`ccall\`](https://discourse.julialang.org/t/passing-an-array-of-structures-through-ccall/5194)

<div class="topic-metadata">

**Author:** [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Replies:** 17\
**Last updated:** [November 24, 2021, 8:23pm UTC](https://discourse.julialang.org/t/passing-an-array-of-structures-through-ccall/5194 "2021-11-24T20:23:33Z")

</div>

I’m trying to pass an array of structure (actually, a pointer to the chunk of memory containing the first structure) from Julia to C through ccall. An example of what I’m trying to do is shown below, using just C: #inc…

---

## [PowerModels power flow](https://discourse.julialang.org/t/powermodels-power-flow/37986)

<div class="topic-metadata">

**Author:** [@hmemy](https://discourse.julialang.org/u/hmemy)\
**Replies:** 19\
**Last updated:** [November 24, 2021, 4:52pm UTC](https://discourse.julialang.org/t/powermodels-power-flow/37986 "2021-11-24T16:52:34Z")

</div>

Hello, I am using PowerModels to analyse the power flow of a network. Why is the voltage angle different from the results obtained by MATPOWER tools in MATLAB. I am using this line to calculate the optimal power flow. …

---

## [NamedTuple with 10\_000 elements?](https://discourse.julialang.org/t/namedtuple-with-10-000-elements/71979)

<div class="topic-metadata">

**Author:** [@bbejanov](https://discourse.julialang.org/u/bbejanov)\
**Replies:** 16\
**Last updated:** [November 24, 2021, 4:42pm UTC](https://discourse.julialang.org/t/namedtuple-with-10-000-elements/71979 "2021-11-24T16:42:40Z")

</div>

Hi everyone, I have basically a matrix with named columns. Currently my implementation is similar to this: struct SimData{T, C \<: AbstractMatrix{T}} \<: AbstractMatrix{T} columns::NamedTuple values::C # inn…

---

## [Building Julia on WSL](https://discourse.julialang.org/t/building-julia-on-wsl/71990)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 1\
**Last updated:** [November 24, 2021, 4:28pm UTC](https://discourse.julialang.org/t/building-julia-on-wsl/71990 "2021-11-24T16:28:58Z")

</div>

I’m getting these errors when trying to cross-compile the Windows build of Julia on WSL: 002d:err:module:LdrInitializeThunk "libLLVM.dll" failed to initialize, aborting 002d:err:module:LdrInitializeThunk Initializing dl…

---

## [Why is printing to a terminal slow?](https://discourse.julialang.org/t/why-is-printing-to-a-terminal-slow/42987)

<div class="topic-metadata">

**Author:** [@asmar](https://discourse.julialang.org/u/asmar)\
**Replies:** 28\
**Last updated:** [November 24, 2021, 4:25pm UTC](https://discourse.julialang.org/t/why-is-printing-to-a-terminal-slow/42987 "2021-11-24T16:25:33Z")

</div>

Hello, I tried just a simple benchmark of printing a million numbers in an array. Surprisingly, it takes a lot of time. I imagine this might be connected to how julia communicates with the system, printing parts not th…

---

## [Boundary intervals for splines using CompactBases](https://discourse.julialang.org/t/boundary-intervals-for-splines-using-compactbases/71344)

<div class="topic-metadata">

**Author:** [@Dan.phi](https://discourse.julialang.org/u/Dan.phi)\
**Replies:** 4\
**Last updated:** [November 24, 2021, 11:44am UTC](https://discourse.julialang.org/t/boundary-intervals-for-splines-using-compactbases/71344 "2021-11-24T11:44:08Z")

</div>

I want to implement natural cubic splines in Julia via B-splines (which are a basis for splines). I found CompactBases.jl, which uses B-splines and allows me to evaluate the basis functions at a value x. Now, let the se…

---

## [Date Hour Method](https://discourse.julialang.org/t/date-hour-method/71978)

<div class="topic-metadata">

**Author:** [@luflarois](https://discourse.julialang.org/u/luflarois)\
**Replies:** 3\
**Last updated:** [November 24, 2021, 10:58am UTC](https://discourse.julialang.org/t/date-hour-method/71978 "2021-11-24T10:58:56Z")

</div>

Hi. I create a function to use Hour function: function createFileNames(steps,type,prefix,sufix,nml,dataIni) if type==1 for t = 1:steps h = (t-1)\*nml\["step"\] println(dataIni + Hour(h)) end end end But whe…

---

## [Query regarding type-stability of cat](https://discourse.julialang.org/t/query-regarding-type-stability-of-cat/72003)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [November 24, 2021, 11:39am UTC](https://discourse.julialang.org/t/query-regarding-type-stability-of-cat/72003 "2021-11-24T11:39:53Z")

</div>

The function cat seems to internally use cat\_t. The definition of cat\_t that is used in my case is @inline cat\_t(::Type{T}, X...; dims) where {T} = \_cat\_t(dims, T, X...) However, for some reason, the function \_cat\_t se…

---

## [Unexpected (?) behaviour of \`values()\` for generic \`kwargs...\`](https://discourse.julialang.org/t/unexpected-behaviour-of-values-for-generic-kwargs/71938)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 4\
**Last updated:** [November 24, 2021, 10:02am UTC](https://discourse.julialang.org/t/unexpected-behaviour-of-values-for-generic-kwargs/71938 "2021-11-24T10:02:12Z")

</div>

If I define a function with kwargs..., then I can use keys() to get the names of whatever arguments were passed julia\> function printkeys(; kwargs...) println(keys(kwargs)) end printkeys (generic funct…

---

## [Module Generation from macros](https://discourse.julialang.org/t/module-generation-from-macros/2555)

<div class="topic-metadata">

**Author:** [@mbeltagy](https://discourse.julialang.org/u/mbeltagy)\
**Replies:** 8\
**Last updated:** [November 24, 2021, 4:29am UTC](https://discourse.julialang.org/t/module-generation-from-macros/2555 "2021-11-24T04:29:44Z")

</div>

I am trying to generate modules using a macro, but it keeps failing. I am not sure how to handle this. EG. julia\> macro mymodule(name) quote module ($name) end …

---

## [VS Code Extension Error](https://discourse.julialang.org/t/vs-code-extension-error/71757)

<div class="topic-metadata">

**Author:** [@CaoHua](https://discourse.julialang.org/u/CaoHua)\
**Replies:** 3\
**Last updated:** [November 24, 2021, 2:31am UTC](https://discourse.julialang.org/t/vs-code-extension-error/71757 "2021-11-24T02:31:35Z")

</div>

Dears, My VS Code could not start Julia since Julia Extension 1.4.0 (till latest 1.5.5). There is an error saying the julia executable path is not correct. However, it is actually right. When I go back to the older ve…

---

## [Way to plot graph of codebase? (i.e. function circles and dependency arrows)](https://discourse.julialang.org/t/way-to-plot-graph-of-codebase-i-e-function-circles-and-dependency-arrows/3450)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 5\
**Last updated:** [November 23, 2021, 10:13pm UTC](https://discourse.julialang.org/t/way-to-plot-graph-of-codebase-i-e-function-circles-and-dependency-arrows/3450 "2021-11-23T22:13:26Z")

</div>

I’m getting to the point where I have a decent amount of functions in my codebase. I was wondering if there was a way to automatically construct an image w/ a graph showing: the functions, macros, etc their interdepen…

---

## [Configurate database connection (APP created with Genie)](https://discourse.julialang.org/t/configurate-database-connection-app-created-with-genie/71918)

<div class="topic-metadata">

**Author:** [@fms-1988](https://discourse.julialang.org/u/fms-1988)\
**Replies:** 9\
**Last updated:** [November 23, 2021, 9:07pm UTC](https://discourse.julialang.org/t/configurate-database-connection-app-created-with-genie/71918 "2021-11-23T21:07:02Z")

</div>

I bootstrapped an APP using Genie. I chose the MySQL DB. I edited the db/connection.yml file as required: env: ENV\["GENIE\_ENV"\] dev: adapter: MySQL database: db host: localhost username: felipe password:…

---

## [MPI Configuration](https://discourse.julialang.org/t/mpi-configuration/71968)

<div class="topic-metadata">

**Author:** [@spasmann](https://discourse.julialang.org/u/spasmann)\
**Replies:** 0\
**Last updated:** [November 23, 2021, 7:33pm UTC](https://discourse.julialang.org/t/mpi-configuration/71968 "2021-11-23T19:33:15Z")

</div>

Hello, I’m trying to configure MPI.jl. I installed OpenMPI according to these instructions: https://wiki.helsinki.fi/display/HUGG/Open+MPI+install+on+Mac+OS+X I’ve confirmed that /usr/local/bin is in $PATH. Then I fol…

---

## [How to cast function input parameters](https://discourse.julialang.org/t/how-to-cast-function-input-parameters/71910)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 10\
**Last updated:** [November 23, 2021, 8:32pm UTC](https://discourse.julialang.org/t/how-to-cast-function-input-parameters/71910 "2021-11-23T20:32:27Z")

</div>

In the code below, I have a Float32 vector to which I would like to add a number. To ensure that computation happens at single precision, I force the input parameters to be Float32. Is it possible to allow the function t…

---

## [DataFrame Matrix Constructor without Copying](https://discourse.julialang.org/t/dataframe-matrix-constructor-without-copying/71916)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 7\
**Last updated:** [November 23, 2021, 6:21pm UTC](https://discourse.julialang.org/t/dataframe-matrix-constructor-without-copying/71916 "2021-11-23T18:21:45Z")

</div>

I’m curious why the following method for creating a DataFrame using an existing matrix doesn’t exist. In some ways it seems like the simplest way to create a DataFrame. using DataFrames mat = rand(10000,3) df = DataFram…

---

## [Dramatic performance change by adding additional unused method](https://discourse.julialang.org/t/dramatic-performance-change-by-adding-additional-unused-method/71771)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 33\
**Last updated:** [November 23, 2021, 5:21pm UTC](https://discourse.julialang.org/t/dramatic-performance-change-by-adding-additional-unused-method/71771 "2021-11-23T17:21:22Z")

</div>

This is a followup of not-understanding-linear-growing-allocations. It took me a while to get a manageable reproducer after my first attempt of forgetting a simple const in a type alias. The code is as follows: using Be…

---

## [DataFrame groups as an argument of a function](https://discourse.julialang.org/t/dataframe-groups-as-an-argument-of-a-function/65371)

<div class="topic-metadata">

**Author:** [@bojusemo](https://discourse.julialang.org/u/bojusemo)\
**Replies:** 15\
**Last updated:** [November 23, 2021, 3:18pm UTC](https://discourse.julialang.org/t/dataframe-groups-as-an-argument-of-a-function/65371 "2021-11-23T15:18:35Z")

</div>

Hi Guys, May you help me, please? How can I use the groups obtained from a DataFrame with the Split-Apply-Combine Strategy as an argument for a function into another function? I have try to do it by three ways but it d…

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

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