# General Usage

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

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

**Page:** 112

---

## [Left join algorithm for columnar tables](https://discourse.julialang.org/t/left-join-algorithm-for-columnar-tables/122725)

<div class="topic-metadata">

**Author:** [@memosik97](https://discourse.julialang.org/u/memosik97)\
**Replies:** 4\
**Last updated:** [November 18, 2024, 1:20am UTC](https://discourse.julialang.org/t/left-join-algorithm-for-columnar-tables/122725 "2024-11-18T01:20:36Z")

</div>

Hello I’m making custom Tables (Dict{Symbol, Vector} basically) since there seems to be no library matching my needs (columnar tables optimized for data insertions). I’m just a beginner (few days into Julia). I have a w…

---

## [How to create a Manifest file that works also with the test environment?](https://discourse.julialang.org/t/how-to-create-a-manifest-file-that-works-also-with-the-test-environment/122746)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [November 17, 2024, 10:05pm UTC](https://discourse.julialang.org/t/how-to-create-a-manifest-file-that-works-also-with-the-test-environment/122746 "2024-11-17T22:05:35Z")

</div>

Sometimes I have the problem that activating the test environment downgrades packages of the main environment. This can be time consuming and even error prone. I now use the following script to create a Manifest.toml f…

---

## [Unroll setfield!](https://discourse.julialang.org/t/unroll-setfield/122545)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 30\
**Last updated:** [November 17, 2024, 1:53pm UTC](https://discourse.julialang.org/t/unroll-setfield/122545 "2024-11-17T13:53:07Z")

</div>

I need to unroll a loop calling setfield! to build a data structure. A MWE is below: julia\> @kwdef mutable struct Data32 a::Int32 = 0 b::Float32 = 0 c::String = "" d::Int32 = …

---

## [Blocked Updates/ Upgrades while adding "DifferentialEquations" package](https://discourse.julialang.org/t/blocked-updates-upgrades-while-adding-differentialequations-package/122450)

<div class="topic-metadata">

**Author:** [@Ziad\_ishere](https://discourse.julialang.org/u/Ziad_ishere)\
**Replies:** 5\
**Last updated:** [November 17, 2024, 5:11pm UTC](https://discourse.julialang.org/t/blocked-updates-upgrades-while-adding-differentialequations-package/122450 "2024-11-17T17:11:54Z")

</div>

When i attempt to add DifferentialEquations package, some dependencies do not install, what could be the cause? Should i reinstall Julia with different version? julia\> Pkg.add("DifferentialEquations") Resolving packa…

---

## [Can the overhead of \`myT{\<:T}\` compared to \`myT{T}\`, where \`T\` is a concrete type, be avoided?](https://discourse.julialang.org/t/can-the-overhead-of-myt-t-compared-to-myt-t-where-t-is-a-concrete-type-be-avoided/122721)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 3\
**Last updated:** [November 17, 2024, 11:05am UTC](https://discourse.julialang.org/t/can-the-overhead-of-myt-t-compared-to-myt-t-where-t-is-a-concrete-type-be-avoided/122721 "2024-11-17T11:05:17Z")

</div>

I understand that Vector{\<:Float64} is not the same as Vector{Float64} as it allows the bottom type Union{} to be its element type and is (therefore) not a concrete type: julia\> Vector{Union{}} \<: Vector{\<:Float64} true…

---

## [A slight confusion with a \`let\` block](https://discourse.julialang.org/t/a-slight-confusion-with-a-let-block/122726)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.julialang.org/u/Dan)\
**Replies:** 2\
**Last updated:** [November 17, 2024, 2:01am UTC](https://discourse.julialang.org/t/a-slight-confusion-with-a-let-block/122726 "2024-11-17T02:01:59Z")

</div>

Playing around the REPL, I got confused by the following (Julia 1.11): julia\> using StaticArrays julia\> L = 3; julia\> let L = 5, Q = @MVector \[false for i in 1:L\] @show L, Q end (L, Q) = (5, Bool\[0, 0, 0…

---

## [Creating an Iterable of Dicts](https://discourse.julialang.org/t/creating-an-iterable-of-dicts/122527)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 15\
**Last updated:** [November 16, 2024, 7:44pm UTC](https://discourse.julialang.org/t/creating-an-iterable-of-dicts/122527 "2024-11-16T19:44:55Z")

</div>

Hi. I’m interested in learning more about creating Iterables to save space. In particular, right now I want to create an Iterable that runs through the rows of a truth table. The following code generates an array that (a…

---

## [Does a "MultiNumber" package exist?](https://discourse.julialang.org/t/does-a-multinumber-package-exist/122696)

<div class="topic-metadata">

**Author:** [@nielsls](https://discourse.julialang.org/u/nielsls)\
**Replies:** 8\
**Last updated:** [November 16, 2024, 7:02pm UTC](https://discourse.julialang.org/t/does-a-multinumber-package-exist/122696 "2024-11-16T19:02:10Z")

</div>

I’m looking for a package with a struct like: struct MultiNumber{N, T \<: Real} \<: Real data::NTuple{N, T} end Where all mathematical operations on a MultiNumber would just apply element-wise. I.e. it would mimic a …

---

## [How to print the blank line in the file?](https://discourse.julialang.org/t/how-to-print-the-blank-line-in-the-file/122709)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 7\
**Last updated:** [November 16, 2024, 2:42pm UTC](https://discourse.julialang.org/t/how-to-print-the-blank-line-in-the-file/122709 "2024-11-16T14:42:34Z")

</div>

Hello, The input.txt file is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 The code below does not print the empty line: inn = open("input.txt", "r") inp = readline(inn) while inp != "" println(…

---

## [Variable scope concept](https://discourse.julialang.org/t/variable-scope-concept/122277)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 21\
**Last updated:** [November 16, 2024, 1:03pm UTC](https://discourse.julialang.org/t/variable-scope-concept/122277 "2024-11-16T13:03:31Z")

</div>

Hello, Why is the error related to the variable scope given in the following code? num = 0 for line in eachline("file.txt") num +=1 end print(num) The error is: ┌ Warning: Assignment to \`num\` in soft scope is am…

---

## [Need help understanding Type parameters and Vararg tuples](https://discourse.julialang.org/t/need-help-understanding-type-parameters-and-vararg-tuples/122683)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 3\
**Last updated:** [November 16, 2024, 12:51pm UTC](https://discourse.julialang.org/t/need-help-understanding-type-parameters-and-vararg-tuples/122683 "2024-11-16T12:51:51Z")

</div>

Hello! I’m encountering quite an headscratcher, I’ve given it quite some time but I couldn’t crack. I am struggling to understand why a tuple of two types is not being recognized as such, while all the intermediate step…

---

## [The combination of parse and length](https://discourse.julialang.org/t/the-combination-of-parse-and-length/122282)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 4\
**Last updated:** [November 16, 2024, 9:05am UTC](https://discourse.julialang.org/t/the-combination-of-parse-and-length/122282 "2024-11-16T09:05:01Z")

</div>

Hello, Why is the following combination wrong? w = "Hello" print(parse(Int,length(w))) Thank you.

---

## [Base.== error](https://discourse.julialang.org/t/base-error/122706)

<div class="topic-metadata">

**Author:** [@abdo](https://discourse.julialang.org/u/abdo)\
**Replies:** 2\
**Last updated:** [November 16, 2024, 7:12am UTC](https://discourse.julialang.org/t/base-error/122706 "2024-11-16T07:12:17Z")

</div>

Point2D(x::Real, y::Real) Creates a Point2D object with dimensions x and y Can take either two Numbers or a string similat to “(1, 2)” Example julia-repl julia\> Point2D(1,2) (1, 2) strng = “(1, -2.4)” Point2D(strn…

---

## [How to load a file-as-a-module when an Environment is present](https://discourse.julialang.org/t/how-to-load-a-file-as-a-module-when-an-environment-is-present/122680)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [November 15, 2024, 2:45pm UTC](https://discourse.julialang.org/t/how-to-load-a-file-as-a-module-when-an-environment-is-present/122680 "2024-11-15T14:45:26Z")

</div>

I need to load a module defined in a local file without using includet() (because of an issue with nested includet). I tried then LOAD\_PATH and at the beginning this works: a.jl : using Pkg Pkg.activate(@\_\_DIR\_\_) push…

---

## [Recommendation to solve linear systems with very large positive definite symmetric sparse matrix (~10^6 x 10^6)](https://discourse.julialang.org/t/recommendation-to-solve-linear-systems-with-very-large-positive-definite-symmetric-sparse-matrix-10-6-x-10-6/122603)

<div class="topic-metadata">

**Author:** [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Replies:** 14\
**Last updated:** [November 15, 2024, 8:10pm UTC](https://discourse.julialang.org/t/recommendation-to-solve-linear-systems-with-very-large-positive-definite-symmetric-sparse-matrix-10-6-x-10-6/122603 "2024-11-15T20:10:00Z")

</div>

Since there are many people in this forum that have a wide knowledge in not only programming but also in numerical analysis, I would like to ask for a recommendation on which solvers to consider to solve stardard linear …

---

## [Package Development: Why is Ref needed to pass a global constant to a function?](https://discourse.julialang.org/t/package-development-why-is-ref-needed-to-pass-a-global-constant-to-a-function/122566)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 13\
**Last updated:** [November 15, 2024, 7:47pm UTC](https://discourse.julialang.org/t/package-development-why-is-ref-needed-to-pass-a-global-constant-to-a-function/122566 "2024-11-15T19:47:05Z")

</div>

I currently have the following setup (which works great) but somehow seems inelegant: src/MyPackage.jl module MyPackage include("mysrc.jl") const CONFIG = Ref{Config}() end src/mysrc.jl @with\_kw struct Config a :…

---

## [Better way to get the corresponding constructor from composite-type instances?](https://discourse.julialang.org/t/better-way-to-get-the-corresponding-constructor-from-composite-type-instances/122661)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 4\
**Last updated:** [November 15, 2024, 3:27pm UTC](https://discourse.julialang.org/t/better-way-to-get-the-corresponding-constructor-from-composite-type-instances/122661 "2024-11-15T15:27:25Z")

</div>

MWE: julia\> abstract type MyType{T} \<: Any end julia\> struct myT1{T} \<: MyType{T} a::T end julia\> struct myT2{T} \<: MyType{T} a::T end julia\> getBuilder(a::MyType) = getfield(Main, (nameof…

---

## [Any way to skip a constructor for Accessors.jl-like syntax?](https://discourse.julialang.org/t/any-way-to-skip-a-constructor-for-accessors-jl-like-syntax/122678)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 3:24pm UTC](https://discourse.julialang.org/t/any-way-to-skip-a-constructor-for-accessors-jl-like-syntax/122678 "2024-11-15T15:24:45Z")

</div>

So this internal :new expression seems to be working again. I’m wondering if it’s possible to unsafely skip inner constructors’ validation to instantiate tweaks to existing instances with setting syntax like Accessors.jl…

---

## [Revise with nested \`include\`?](https://discourse.julialang.org/t/revise-with-nested-include/97916)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 6\
**Last updated:** [November 15, 2024, 1:22pm UTC](https://discourse.julialang.org/t/revise-with-nested-include/97916 "2024-11-15T13:22:50Z")

</div>

Hi, I have a simple question about nested include when using Revise.jl. Consider the following nested structure: module1.jl: module Module1 function f1() println("abc") end include("module2.jl") end…

---

## [Adding new layer to GeoMakie.jl poly plot](https://discourse.julialang.org/t/adding-new-layer-to-geomakie-jl-poly-plot/122667)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 12:23pm UTC](https://discourse.julialang.org/t/adding-new-layer-to-geomakie-jl-poly-plot/122667 "2024-11-15T12:23:33Z")

</div>

Hi there, I have two sets of Shapefile geometries. If I run: f, a, p = poly(shapefile\_df.polygon; axis = (; type = GeoAxis)) I will get the desired map. However, I would like to add another layer with a different colo…

---

## [Dimension mismatch error](https://discourse.julialang.org/t/dimension-mismatch-error/122590)

<div class="topic-metadata">

**Author:** [@Vegetasan](https://discourse.julialang.org/u/Vegetasan)\
**Replies:** 10\
**Last updated:** [November 15, 2024, 8:41am UTC](https://discourse.julialang.org/t/dimension-mismatch-error/122590 "2024-11-15T08:41:50Z")

</div>

Hello everyone, I’m working on a project in Julia to predict reaction mechanisms for a given set of inputs using kinetic modeling. I’m fairly new to Julia, and everything seems to be running well except for a dimension …

---

## [Why/where does this allocate?](https://discourse.julialang.org/t/why-where-does-this-allocate/122607)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 10\
**Last updated:** [November 15, 2024, 2:50am UTC](https://discourse.julialang.org/t/why-where-does-this-allocate/122607 "2024-11-15T02:50:10Z")

</div>

I think this function in Julia allocates once, 16 bytes, at poptask (can’t easily run it alone): julia\> function wait() GC.safepoint() W = Base.workqueue\_for(Threads.threadid()) Base.pop…

---

## [Why doesn't multithreading over a vector/array lead to data race?](https://discourse.julialang.org/t/why-doesnt-multithreading-over-a-vector-array-lead-to-data-race/122621)

<div class="topic-metadata">

**Author:** [@ttx002000](https://discourse.julialang.org/u/ttx002000)\
**Replies:** 5\
**Last updated:** [November 15, 2024, 2:41am UTC](https://discourse.julialang.org/t/why-doesnt-multithreading-over-a-vector-array-lead-to-data-race/122621 "2024-11-15T02:41:59Z")

</div>

Hi All, I under stand the following function will lead to undefined behaviour s=0 Threads.@threads for ja in 1:1000 global s+=ja end as each thread is modifying the same variables at the same time. But why does…

---

## [Equivalent of np.delete?](https://discourse.julialang.org/t/equivalent-of-np-delete/122642)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 7\
**Last updated:** [November 15, 2024, 1:39am UTC](https://discourse.julialang.org/t/equivalent-of-np-delete/122642 "2024-11-15T01:39:04Z")

</div>

Hi, I would like to do the same as: import numpy as np a = np.array(\[\[\[\[1,2,3\],\[4,5,6\]\],\[\[7,8,9\],\[10,11,12\]\],\[\[13,14,15\],\[16,17,18\]\]\], \[\[\[1,2,3\],\[4,5,6\]\],\[\[7,8,9\],\[10,11,12\]\],\[\[13,14,15\],\[16,17,18\]\]\], …

---

## [Sparse non-square linear problem](https://discourse.julialang.org/t/sparse-non-square-linear-problem/122650)

<div class="topic-metadata">

**Author:** [@Nichola](https://discourse.julialang.org/u/Nichola)\
**Replies:** 3\
**Last updated:** [November 15, 2024, 1:00am UTC](https://discourse.julialang.org/t/sparse-non-square-linear-problem/122650 "2024-11-15T01:00:17Z")

</div>

I would like to solve Ax = b where A is a sparse non-square array. For example : using SparseArrays using LinearSolve n = 3 m = 4 A = sparse(rand(ComplexF64, m, n)) b = rand(ComplexF64, m) prob = LinearProblem(A, b) …

---

## [UDPSocket sends short datagram using reinterpret](https://discourse.julialang.org/t/udpsocket-sends-short-datagram-using-reinterpret/122640)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [November 14, 2024, 4:33pm UTC](https://discourse.julialang.org/t/udpsocket-sends-short-datagram-using-reinterpret/122640 "2024-11-14T16:33:55Z")

</div>

Is this a bug? Common use case for UDPSocket: I have a struct that isbits. I want to msg = reinterpret(UInt8, \[myobj\]) and transmit this via a UDP datagram to be read on another Julia process, where I’ll just recv the d…

---

## [How to convert a dataframe into a 1-D vector, line by line?](https://discourse.julialang.org/t/how-to-convert-a-dataframe-into-a-1-d-vector-line-by-line/122594)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 6\
**Last updated:** [November 14, 2024, 4:29pm UTC](https://discourse.julialang.org/t/how-to-convert-a-dataframe-into-a-1-d-vector-line-by-line/122594 "2024-11-14T16:29:19Z")

</div>

Hi, I have a dataframe looking like: using DataFrames df = DataFrame(a=1:4, b=5:8) 4×2 DataFrame Row │ a b │ Int64 Int64 ─────┼────────────── 1 │ 1 5 2 │ 2 6 3 │ 3 …

---

## [Improving parallel loop performance by using \`numpy\` for allocations](https://discourse.julialang.org/t/improving-parallel-loop-performance-by-using-numpy-for-allocations/122420)

<div class="topic-metadata">

**Author:** [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Replies:** 11\
**Last updated:** [November 14, 2024, 2:58pm UTC](https://discourse.julialang.org/t/improving-parallel-loop-performance-by-using-numpy-for-allocations/122420 "2024-11-14T14:58:24Z")

</div>

This example might be interesting to help understand what performance improvement still can be made in multi-threaded worklfows. There was a related discussion on memory management in numpy not long ago Why is Julia's pe…

---

## [How to robustly interact with the REPL from outside a Julia process?](https://discourse.julialang.org/t/how-to-robustly-interact-with-the-repl-from-outside-a-julia-process/122623)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 5\
**Last updated:** [November 14, 2024, 2:47pm UTC](https://discourse.julialang.org/t/how-to-robustly-interact-with-the-repl-from-outside-a-julia-process/122623 "2024-11-14T14:47:12Z")

</div>

I want to make automated recordings of REPL activity with asciinema. Normally one would start julia via asciinema, interact with the REPL and then exit. But I want to write out all pressed keys programmatically. My first…

---

## [Is it possible to get an exception message as a string?](https://discourse.julialang.org/t/is-it-possible-to-get-an-exception-message-as-a-string/3201)

<div class="topic-metadata">

**Author:** [@izaid](https://discourse.julialang.org/u/izaid)\
**Replies:** 4\
**Last updated:** [April 14, 2017, 2:37am UTC](https://discourse.julialang.org/t/is-it-possible-to-get-an-exception-message-as-a-string/3201 "2017-04-14T02:37:32Z")

</div>

So, for language interop reasons, I’d like to translate Julia exceptions into a different kind of error. In the C API, it is pretty clear that jl\_exception\_occurred is what to use to check if an exception occurred or not…

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

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