# General Usage

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

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

**Page:** 168

---

## [Loading a csv-like file with a multi-line header](https://discourse.julialang.org/t/loading-a-csv-like-file-with-a-multi-line-header/113806)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 11\
**Last updated:** [May 20, 2024, 12:02am UTC](https://discourse.julialang.org/t/loading-a-csv-like-file-with-a-multi-line-header/113806 "2024-05-20T00:02:14Z")

</div>

Hi, I would like to load a IAGA-2002 file like http://www.bcmt.fr/DATABANK/VARIATION/ppt/sec/2024/03/ppt20240301vsec.sec Format IAGA-2002 | Source of Data IP…

---

## [How to define a macro via Package Extension?](https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 9\
**Last updated:** [May 19, 2024, 7:49pm UTC](https://discourse.julialang.org/t/how-to-define-a-macro-via-package-extension/114218 "2024-05-19T19:49:29Z")

</div>

I thought that you’d define functions my extending the original package’s functions like MyPackage.myfunc(::SpecialExtensionType) = ... The same however does not work for macros macro MyPackage.mymacro() end throws er…

---

## [Increasing the solution speed of sparse linear system](https://discourse.julialang.org/t/increasing-the-solution-speed-of-sparse-linear-system/114173)

<div class="topic-metadata">

**Author:** [@aqw](https://discourse.julialang.org/u/aqw)\
**Replies:** 14\
**Last updated:** [May 19, 2024, 7:42pm UTC](https://discourse.julialang.org/t/increasing-the-solution-speed-of-sparse-linear-system/114173 "2024-05-19T19:42:17Z")

</div>

Hello, Does Julia have any package for sparse linear solvers for LU decomposed sparse matrices that are multi-threaded? I want to improve the solution speed of a big system which I have to solve ~500-700 times. us…

---

## [Mismatch error when using the ODESystem and ODEProblem to convert DAE system to ODE system](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 3\
**Last updated:** [May 19, 2024, 4:54pm UTC](https://discourse.julialang.org/t/mismatch-error-when-using-the-odesystem-and-odeproblem-to-convert-dae-system-to-ode-system/114438 "2024-05-19T16:54:58Z")

</div>

I have used the ODESystem and ODEProblem to convert the DAE system into ODE system in Julia. It works well for the systems with 10 and 54 equations, but when I tried for the larger system with 88 or 198 equations it has …

---

## [Creating Symbolics Piecewise Function Printout](https://discourse.julialang.org/t/creating-symbolics-piecewise-function-printout/114445)

<div class="topic-metadata">

**Author:** [@wirazulka](https://discourse.julialang.org/u/wirazulka)\
**Replies:** 1\
**Last updated:** [May 19, 2024, 4:10pm UTC](https://discourse.julialang.org/t/creating-symbolics-piecewise-function-printout/114445 "2024-05-19T16:10:36Z")

</div>

Hi I want to make a print out of symbolic mathematical expression like below : Already trying using symbolics.jl but I cant find the correct syntax for piecewise equation.

---

## [Error from OrdinaryDiffEq.jl example](https://discourse.julialang.org/t/error-from-ordinarydiffeq-jl-example/114414)

<div class="topic-metadata">

**Author:** [@NonDairyNeutrino](https://discourse.julialang.org/u/NonDairyNeutrino)\
**Replies:** 3\
**Last updated:** [May 19, 2024, 4:05pm UTC](https://discourse.julialang.org/t/error-from-ordinarydiffeq-jl-example/114414 "2024-05-19T16:05:59Z")

</div>

The given example in “Classical Physics Models · DifferentialEquations.jl” # Simple Harmonic Oscillator Problem using OrdinaryDiffEq, Plots #Parameters ω = 1 #Initial Conditions x₀ = \[0.0\] dx₀ = \[π / 2\] tspan = (0.0, …

---

## [Combining Lux.jl with IPNewton() for Optimization](https://discourse.julialang.org/t/combining-lux-jl-with-ipnewton-for-optimization/114391)

<div class="topic-metadata">

**Author:** [@paul188](https://discourse.julialang.org/u/paul188)\
**Replies:** 2\
**Last updated:** [May 19, 2024, 2:52pm UTC](https://discourse.julialang.org/t/combining-lux-jl-with-ipnewton-for-optimization/114391 "2024-05-19T14:52:14Z")

</div>

I have some specific bounds on my Neural Network weights and biases, that cannot be expressed as simple parameter inequlality constraints. That’s why I would like to try something like IPNewton for the Optimization, even…

---

## [DataFrame transformation is so slow, what am I doing wrong?](https://discourse.julialang.org/t/dataframe-transformation-is-so-slow-what-am-i-doing-wrong/114430)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 17\
**Last updated:** [May 19, 2024, 2:41pm UTC](https://discourse.julialang.org/t/dataframe-transformation-is-so-slow-what-am-i-doing-wrong/114430 "2024-05-19T14:41:29Z")

</div>

I want to do a transformation which may depends on a large number of columns. The MWE & benchmark codes: using DataFrames df = DataFrame(rand(10, 50), :auto) cols = propertynames(df) # due to the design of my actual c…

---

## [Proper way to deal with \`Vector{Any}\` when defining a function](https://discourse.julialang.org/t/proper-way-to-deal-with-vector-any-when-defining-a-function/114422)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 12\
**Last updated:** [May 19, 2024, 10:37am UTC](https://discourse.julialang.org/t/proper-way-to-deal-with-vector-any-when-defining-a-function/114422 "2024-05-19T10:37:54Z")

</div>

function catstr(arr::Vector{String}) return reduce(\*, arr) end # Method-1: OK arr = \["hello", "world"\] catstr(arr) # Method-2: Not OK arr = \[\] push!(arr, "hello") push!(arr, "world") catstr(arr) Whose fault? Is th…

---

## [SortedDict with mutable values - why does this allocate?](https://discourse.julialang.org/t/sorteddict-with-mutable-values-why-does-this-allocate/114378)

<div class="topic-metadata">

**Author:** [@freeman](https://discourse.julialang.org/u/freeman)\
**Replies:** 11\
**Last updated:** [May 19, 2024, 9:21am UTC](https://discourse.julialang.org/t/sorteddict-with-mutable-values-why-does-this-allocate/114378 "2024-05-19T09:21:35Z")

</div>

I’m surprised that one of these allocates and the other doesn’t. I’m pretty sure that this isn’t specific to the package and that instead my surprise comes form me not understand Julia well enough. I wonder if someone he…

---

## [Is there a way to read a large bunch of objects of different bitstypes on multiple workers, without copying them?](https://discourse.julialang.org/t/is-there-a-way-to-read-a-large-bunch-of-objects-of-different-bitstypes-on-multiple-workers-without-copying-them/114450)

<div class="topic-metadata">

**Author:** [@Zaph](https://discourse.julialang.org/u/Zaph)\
**Replies:** 0\
**Last updated:** [May 19, 2024, 7:30am UTC](https://discourse.julialang.org/t/is-there-a-way-to-read-a-large-bunch-of-objects-of-different-bitstypes-on-multiple-workers-without-copying-them/114450 "2024-05-19T07:30:37Z")

</div>

For my code I am using a long multydimensional list of anonymous functions, which I calculated in a previous session and loaded as a constant into the current session. I then run a pmap operation (over another list), in …

---

## [The LanguageServer.jl and the Julia VS Code extension need better care](https://discourse.julialang.org/t/the-languageserver-jl-and-the-julia-vs-code-extension-need-better-care/114434)

<div class="topic-metadata">

**Author:** [@j-adel](https://discourse.julialang.org/u/j-adel)\
**Replies:** 6\
**Last updated:** [May 18, 2024, 10:15pm UTC](https://discourse.julialang.org/t/the-languageserver-jl-and-the-julia-vs-code-extension-need-better-care/114434 "2024-05-18T22:15:16Z")

</div>

My experience with working on Julia code in VS Code (the supposed best coding environment for Julia) has been very hit-or-miss and there are very few signs of progress in the last year. A while ago, I encountered an iss…

---

## [Expected Vector{Number}, got a value of type Vector{Int64}](https://discourse.julialang.org/t/expected-vector-number-got-a-value-of-type-vector-int64/114439)

<div class="topic-metadata">

**Author:** [@Amnesian](https://discourse.julialang.org/u/Amnesian)\
**Replies:** 5\
**Last updated:** [May 18, 2024, 8:48pm UTC](https://discourse.julialang.org/t/expected-vector-number-got-a-value-of-type-vector-int64/114439 "2024-05-18T20:48:44Z")

</div>

So I have this function, but it is giving me a very strange error. function runCommands(;programName::String="simulation", dt::Number=0.01, T::Number=2, temps::Vector{Number}, N::Integer, sizeArr::Vector{Integer}) c…

---

## [Transparent background with Luxor.jl](https://discourse.julialang.org/t/transparent-background-with-luxor-jl/114437)

<div class="topic-metadata">

**Author:** [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Replies:** 2\
**Last updated:** [May 18, 2024, 5:26pm UTC](https://discourse.julialang.org/t/transparent-background-with-luxor-jl/114437 "2024-05-18T17:26:05Z")

</div>

Hi. Does somebody know how I can generate a .png file with a transparent background? The docs here say that it should suffice to put background(0,0,0,0). Using the MWE from Simple examples · Luxor using Luxor @png be…

---

## [Is there a quicker way to obtain normalized multivariate random normal draws?](https://discourse.julialang.org/t/is-there-a-quicker-way-to-obtain-normalized-multivariate-random-normal-draws/114411)

<div class="topic-metadata">

**Author:** [@schwob](https://discourse.julialang.org/u/schwob)\
**Replies:** 15\
**Last updated:** [May 18, 2024, 3:33pm UTC](https://discourse.julialang.org/t/is-there-a-quicker-way-to-obtain-normalized-multivariate-random-normal-draws/114411 "2024-05-18T15:33:39Z")

</div>

I want to make n random draws from a Multivariate Normal distribution, then divide each element in each of the random draws by the norm of the random draw. Mathematically, I want to obtain \\mathbf{y}\_i=\\mathbf{x}\_i/||\\ma…

---

## [Why is global scope different?](https://discourse.julialang.org/t/why-is-global-scope-different/114398)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 11\
**Last updated:** [May 17, 2024, 10:46pm UTC](https://discourse.julialang.org/t/why-is-global-scope-different/114398 "2024-05-17T22:46:30Z")

</div>

I just read through the Scope of Variables manual page and added a summary to the top of it. The main thing I still don’t understand is why global scope needs to be treated so differently from local scopes. The rational…

---

## [Speeding up evaluation of small exponential-like series](https://discourse.julialang.org/t/speeding-up-evaluation-of-small-exponential-like-series/114314)

<div class="topic-metadata">

**Author:** [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Replies:** 19\
**Last updated:** [May 17, 2024, 11:07pm UTC](https://discourse.julialang.org/t/speeding-up-evaluation-of-small-exponential-like-series/114314 "2024-05-17T23:07:08Z")

</div>

I have an application where the following function to evaluate an exponential-like series is called many times for different p vectors (the last two inputs are fixed), and takes a good portion of the running time. I was …

---

## [Displaying .tiff or .tif images in Julia through QML.jl](https://discourse.julialang.org/t/displaying-tiff-or-tif-images-in-julia-through-qml-jl/114394)

<div class="topic-metadata">

**Author:** [@Moeasy64](https://discourse.julialang.org/u/Moeasy64)\
**Replies:** 1\
**Last updated:** [May 17, 2024, 10:45pm UTC](https://discourse.julialang.org/t/displaying-tiff-or-tif-images-in-julia-through-qml-jl/114394 "2024-05-17T22:45:15Z")

</div>

Good morning, I am trying to display a .tiff image inside my qml application through qml.jl. I’ve seen there’s a way through third party bundles to display such image type. Anyway I can’t figure out how to do it with Jul…

---

## [Most compact way to create an array of a known container type with a different eltype?](https://discourse.julialang.org/t/most-compact-way-to-create-an-array-of-a-known-container-type-with-a-different-eltype/114215)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 6\
**Last updated:** [May 17, 2024, 10:49pm UTC](https://discourse.julialang.org/t/most-compact-way-to-create-an-array-of-a-known-container-type-with-a-different-eltype/114215 "2024-05-17T22:49:36Z")

</div>

For example, suppose that we have an array type such as Atype = Array{ComplexF64,3} and would like to create an array of the same container type (in this case Array) but with a different element type, say Int (so the tar…

---

## [When is it okay to use \`@assert\`?](https://discourse.julialang.org/t/when-is-it-okay-to-use-assert/114399)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 7\
**Last updated:** [May 17, 2024, 8:48pm UTC](https://discourse.julialang.org/t/when-is-it-okay-to-use-assert/114399 "2024-05-17T20:48:43Z")

</div>

I see @assert used frequently in the wild to check function inputs, and it looks a lot nicer than putting a bunch of if/throw statements at the top of every function. However, ModernJuliaWorkflows says: To test the ar…

---

## [2D examples of DistMesh.jl or other simple mesh generator?](https://discourse.julialang.org/t/2d-examples-of-distmesh-jl-or-other-simple-mesh-generator/114404)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 2\
**Last updated:** [May 17, 2024, 7:02pm UTC](https://discourse.julialang.org/t/2d-examples-of-distmesh-jl-or-other-simple-mesh-generator/114404 "2024-05-17T19:02:16Z")

</div>

Hi everyone. I am looking to generate some simple 2D meshes (triangles filling a big rectangle with some smaller square holes). I used for years the DistMesh for Matlab. Now I am trying to use the Julia port. There are …

---

## [Ask for better method to visualizing two-dimensional or three-dimensional areas](https://discourse.julialang.org/t/ask-for-better-method-to-visualizing-two-dimensional-or-three-dimensional-areas/114387)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 1\
**Last updated:** [May 17, 2024, 10:02am UTC](https://discourse.julialang.org/t/ask-for-better-method-to-visualizing-two-dimensional-or-three-dimensional-areas/114387 "2024-05-17T10:02:07Z")

</div>

What’s the most recommended way to visualize a two-dimensional or three-dimensional areas, e.g., f(x, y) \\leqslant c and f(x, y, z) \\leqslant c ? I’ve tried CairoMakie.contour but I’m not quite satisfied with it: using…

---

## [Cast/parse multiple variables at once](https://discourse.julialang.org/t/cast-parse-multiple-variables-at-once/114345)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 5\
**Last updated:** [May 17, 2024, 8:42am UTC](https://discourse.julialang.org/t/cast-parse-multiple-variables-at-once/114345 "2024-05-17T08:42:27Z")

</div>

Hi, Having to process dates read from files, I’m currently doing e.g.: date="20240516235400" yyyy, mm, dd, h, m, s = parse(Int32, date\[1:4\]), parse(Int32, date\[5:6\]), parse(Int32, date\[7:8\]), parse(Int32, date\[9:10\]), …

---

## [Distributed and SGE qsub](https://discourse.julialang.org/t/distributed-and-sge-qsub/114386)

<div class="topic-metadata">

**Author:** [@TongTongYee](https://discourse.julialang.org/u/TongTongYee)\
**Replies:** 0\
**Last updated:** [May 17, 2024, 7:44am UTC](https://discourse.julialang.org/t/distributed-and-sge-qsub/114386 "2024-05-17T07:44:59Z")

</div>

Hi! How to qsub julia codes with Distributed package? I’m using Distributed package. And to run the code, I have used SGE qsub. I maybe understood ‘how to run MPI’ with qsub. MPI need an option ‘-pe N’, where N is numb…

---

## [Function call with quotes instead of parenthesis](https://discourse.julialang.org/t/function-call-with-quotes-instead-of-parenthesis/114382)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 3\
**Last updated:** [May 17, 2024, 7:42am UTC](https://discourse.julialang.org/t/function-call-with-quotes-instead-of-parenthesis/114382 "2024-05-17T07:42:07Z")

</div>

Hello, I was looking at the LocalRegistry package when I noticed the following (unrelated I think to the actual LocalRegistry package). using Pkg pkg"registry add \<repository url\>" It looks like the quotes are used in…

---

## [Improper function nesting causes boxing/runtime dispatch?](https://discourse.julialang.org/t/improper-function-nesting-causes-boxing-runtime-dispatch/114307)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 3\
**Last updated:** [May 17, 2024, 7:00am UTC](https://discourse.julialang.org/t/improper-function-nesting-causes-boxing-runtime-dispatch/114307 "2024-05-17T07:00:01Z")

</div>

Note the code example below: struct Radix{N} Radix(n::Integer) = new{n}(); end # Nesting: testfunc! -\> \_add, \_addpositions function testfunc!(array, num, radix) \_add(a, b, ::Radix{2}) = a ⊻ b \_add(a, …

---

## [Enzyme.jl cannot differentiate through vector of distributions?](https://discourse.julialang.org/t/enzyme-jl-cannot-differentiate-through-vector-of-distributions/114338)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 2\
**Last updated:** [May 17, 2024, 6:55am UTC](https://discourse.julialang.org/t/enzyme-jl-cannot-differentiate-through-vector-of-distributions/114338 "2024-05-17T06:55:45Z")

</div>

I have a vector y which is a Vector{Float64}, but each y\[i\] is sampled from a different marginal distribution specified by vecdist\[i\]. I want the gradient of the loglikelihood function (scalar output), but I’m getting a…

---

## [Docstring for \`Method\`](https://discourse.julialang.org/t/docstring-for-method/92675)

<div class="topic-metadata">

**Author:** [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Replies:** 5\
**Last updated:** [May 17, 2024, 6:48am UTC](https://discourse.julialang.org/t/docstring-for-method/92675 "2024-05-17T06:48:28Z")

</div>

Hey everyone, I’m trying to do something that I thought would be easy but is actually rather tricky. I simply want to get the docstring of a Method. For example: """ my f """ f(x::Int) = 2x """ with strings """ f(x…

---

## [How to conveniently pass arguments from a function to another?](https://discourse.julialang.org/t/how-to-conveniently-pass-arguments-from-a-function-to-another/114385)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 4\
**Last updated:** [May 17, 2024, 5:31am UTC](https://discourse.julialang.org/t/how-to-conveniently-pass-arguments-from-a-function-to-another/114385 "2024-05-17T05:31:04Z")

</div>

function f(x=1, y=2, z=3; a=1, b=2, c=3) # How do I know if a/b/c is assigned a value? 2 \* g(x, y, z; a=a, b=b, c=c) # Do I have to pass the arguments one by one to g? end function g(x=1, y=2, z=3; a=1, b=2, c=3…

---

## [ROS2 client library for Julialang](https://discourse.julialang.org/t/ros2-client-library-for-julialang/32095)

<div class="topic-metadata">

**Author:** [@andreasziegler](https://discourse.julialang.org/u/andreasziegler)\
**Replies:** 10\
**Last updated:** [May 17, 2024, 4:55am UTC](https://discourse.julialang.org/t/ros2-client-library-for-julialang/32095 "2024-05-17T04:55:26Z")

</div>

Hi As a robotics engineer, I’m working with ROS2. From an (software) engineering and research perspective, I’m quite interested in Julia however with the lack of a ROS2 client library for Julia, it’s for me currently a …

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

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