# General Usage

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

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

**Page:** 304

---

## [Convert Vectors of Numbers and Bases to Two-Dimensional Matrix of Strings](https://discourse.julialang.org/t/convert-vectors-of-numbers-and-bases-to-two-dimensional-matrix-of-strings/97520)

<div class="topic-metadata">

**Author:** [@Cougar](https://discourse.julialang.org/u/Cougar)\
**Replies:** 9\
**Last updated:** [April 16, 2023, 2:39pm UTC](https://discourse.julialang.org/t/convert-vectors-of-numbers-and-bases-to-two-dimensional-matrix-of-strings/97520 "2023-04-16T14:39:40Z")

</div>

Given two Vector{Int64} n and b shown below, I’m looking for a succinct and efficient way to build the 3×3 Matrix{String} described … top row is binary, octal, hexadecimal expansions of 321. middle row is binary, oct…

---

## [Is there a way to return from a function from within a thread?](https://discourse.julialang.org/t/is-there-a-way-to-return-from-a-function-from-within-a-thread/35656)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 13\
**Last updated:** [April 16, 2023, 11:52am UTC](https://discourse.julialang.org/t/is-there-a-way-to-return-from-a-function-from-within-a-thread/35656 "2023-04-16T11:52:04Z")

</div>

I have a function that does a @threads loop. There is a condition that gets evaluated inside the loop. If the condition returns false, there’s no point in continuing any of the work; I’d like to just return false: funct…

---

## [Coupled PINN](https://discourse.julialang.org/t/coupled-pinn/95521)

<div class="topic-metadata">

**Author:** [@Reza\_AO](https://discourse.julialang.org/u/Reza_AO)\
**Replies:** 32\
**Last updated:** [April 16, 2023, 6:56am UTC](https://discourse.julialang.org/t/coupled-pinn/95521 "2023-04-16T06:56:33Z")

</div>

Hi. I wanted to solve two different heat diffusion equations(coupled) and solve them. For this I need 2 seperate domains for equations and I want to solve them in parallel in 2 independent Neural Networks. How can I solv…

---

## [Using proxychains with Julia?](https://discourse.julialang.org/t/using-proxychains-with-julia/97535)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 0\
**Last updated:** [April 16, 2023, 3:46am UTC](https://discourse.julialang.org/t/using-proxychains-with-julia/97535 "2023-04-16T03:46:39Z")

</div>

I need to access some servers via a socks proxy. I’m able to do this with python by calling $ proxychains python but trying the same with julia causes it to hang at startup. Any idea what’s going on? Not sure if it’…

---

## [What package allowed setting the learning rate for a minimization problem?](https://discourse.julialang.org/t/what-package-allowed-setting-the-learning-rate-for-a-minimization-problem/97523)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 6\
**Last updated:** [April 16, 2023, 12:50am UTC](https://discourse.julialang.org/t/what-package-allowed-setting-the-learning-rate-for-a-minimization-problem/97523 "2023-04-16T00:50:05Z")

</div>

What package allowed setting the learning rate for a minimization problem? Thank you P.S. it looks like Opitm.jl isn’t allowed.

---

## [Julia 1.9 vs. 1.8 performance for comprehension and splatting?](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 0\
**Last updated:** [April 15, 2023, 8:00pm UTC](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521 "2023-04-15T20:00:04Z")

</div>

Julia 1.9 seems to be slower than 1.8 for some comprehension and splatting code. Here’s a minimal working example. I’ve written functions for doubling the values of a dictionary, including a “normal” version involving a …

---

## [Flattening nested operators in \`Expr\`](https://discourse.julialang.org/t/flattening-nested-operators-in-expr/96468)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 6\
**Last updated:** [April 15, 2023, 2:12pm UTC](https://discourse.julialang.org/t/flattening-nested-operators-in-expr/96468 "2023-04-15T14:12:22Z")

</div>

I have an Expr that comes to me looking like this: :((+)((+)(1,2),3)) except that my actual Exprs have 100s of terms, each of which is a complicated expression (which may involve products with further sums that I don’t…

---

## [Variable number of command line arguments with ArgParse.jl](https://discourse.julialang.org/t/variable-number-of-command-line-arguments-with-argparse-jl/97493)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [April 15, 2023, 2:11pm UTC](https://discourse.julialang.org/t/variable-number-of-command-line-arguments-with-argparse-jl/97493 "2023-04-15T14:11:07Z")

</div>

With ArgParse.jl, how can I parse key word arguments like --myoption 1 while ignoring all positional arguments, when the number of position argument is not fixed, i.e. “vararg”?

---

## [How to replace all values in an array with missing values?](https://discourse.julialang.org/t/how-to-replace-all-values-in-an-array-with-missing-values/75467)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 43\
**Last updated:** [April 15, 2023, 12:24pm UTC](https://discourse.julialang.org/t/how-to-replace-all-values-in-an-array-with-missing-values/75467 "2023-04-15T12:24:26Z")

</div>

I have an array A with the size of 360 x 180 x 100. The current missing value indicator is NaN. My goal is to replace all NaN values with missing values. Below is my code: A\[isnan.(A)\] .= missing; Unfortunately, I got…

---

## [\[Linux\] .jl files are identified as "plain text documents"](https://discourse.julialang.org/t/linux-jl-files-are-identified-as-plain-text-documents/87698)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 9\
**Last updated:** [April 15, 2023, 10:56am UTC](https://discourse.julialang.org/t/linux-jl-files-are-identified-as-plain-text-documents/87698 "2023-04-15T10:56:24Z")

</div>

On windows, I chose to open .jl files in VSCode and .txt files in notepad. I have installed linux, and now when i change the default program for .jl files, it also changes for .txt files, as both are identified as “plai…

---

## [Why is a staggering 30% of the CPU profile not accounted for?](https://discourse.julialang.org/t/why-is-a-staggering-30-of-the-cpu-profile-not-accounted-for/97478)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 2\
**Last updated:** [April 15, 2023, 10:23am UTC](https://discourse.julialang.org/t/why-is-a-staggering-30-of-the-cpu-profile-not-accounted-for/97478 "2023-04-15T10:23:42Z")

</div>

How come that 30% (on the right-hand side) of the CPU performance profile here is not accounted for? This is in the preview version of the (VS) Code Julia extension, with Julia 1.9.0-rc2, on Linux. This seems reprod…

---

## [Functions with static table-like inputs and outputs](https://discourse.julialang.org/t/functions-with-static-table-like-inputs-and-outputs/97471)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 5\
**Last updated:** [April 15, 2023, 10:09am UTC](https://discourse.julialang.org/t/functions-with-static-table-like-inputs-and-outputs/97471 "2023-04-15T10:09:13Z")

</div>

I often have to write functions that recalculate some arrays of structures (sorted by one of the fields) into other arrays of structures. I often had to do conversions from one array of structures into another to fit arg…

---

## [Split country column into a column with city and a column with country](https://discourse.julialang.org/t/split-country-column-into-a-column-with-city-and-a-column-with-country/96586)

<div class="topic-metadata">

**Author:** [@akshdfyehd](https://discourse.julialang.org/u/akshdfyehd)\
**Replies:** 5\
**Last updated:** [March 28, 2023, 10:57am UTC](https://discourse.julialang.org/t/split-country-column-into-a-column-with-city-and-a-column-with-country/96586 "2023-03-28T10:57:19Z")

</div>

Hi, i have got a travel dataset and I need to split the destination column into two columns, one column is city and another column is country name, for example, “Sydney, Australia” will be split into sydney in city colum…

---

## [Importing symbols from submodule](https://discourse.julialang.org/t/importing-symbols-from-submodule/97488)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 2\
**Last updated:** [April 14, 2023, 7:39pm UTC](https://discourse.julialang.org/t/importing-symbols-from-submodule/97488 "2023-04-14T19:39:25Z")

</div>

I’d like to import symbols from a submodule without fully qualifying the module. Like this import TestPackage.InnerMod import InnerMod: inner\_a # or import InnerMod.a But that gives me ArgumentError: Package InnerMod n…

---

## [Embedding Julia in Scala](https://discourse.julialang.org/t/embedding-julia-in-scala/97347)

<div class="topic-metadata">

**Author:** [@Simon\_Parten](https://discourse.julialang.org/u/Simon_Parten)\
**Replies:** 10\
**Last updated:** [April 14, 2023, 7:24pm UTC](https://discourse.julialang.org/t/embedding-julia-in-scala/97347 "2023-04-14T19:24:32Z")

</div>

Hi, I’m setting out to conduct a POC which calls Julia from Scala, via Julia’s C interface. https://github.com/Quafadas/slincTest/blob/master/slinc.scala#L30 I’ve checked that I can call functions from the std C libra…

---

## [Best way to alternate RNG in inner functions?](https://discourse.julialang.org/t/best-way-to-alternate-rng-in-inner-functions/97487)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [April 14, 2023, 7:14pm UTC](https://discourse.julialang.org/t/best-way-to-alternate-rng-in-inner-functions/97487 "2023-04-14T19:14:51Z")

</div>

Given a code in which rand is called in a inner function, as in this simplified example: module Test import Random export outer RNG = Random.Xoshiro() function inner(x) x += rand(RNG) end function outer(x) …

---

## [Subset sum problem with SymbolicRegressions.jl](https://discourse.julialang.org/t/subset-sum-problem-with-symbolicregressions-jl/97479)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 7\
**Last updated:** [April 14, 2023, 5:56pm UTC](https://discourse.julialang.org/t/subset-sum-problem-with-symbolicregressions-jl/97479 "2023-04-14T17:56:56Z")

</div>

Trying to solve Digits: A Daily Math Puzzle - The New York Times with Julia and it’s clearly a NP-complete problem because it’s harder than the Subset sum problem which is known to be NP-complete. The current attempt is…

---

## [Is it the correct way to check for specializations?](https://discourse.julialang.org/t/is-it-the-correct-way-to-check-for-specializations/93490)

<div class="topic-metadata">

**Author:** [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Replies:** 4\
**Last updated:** [April 14, 2023, 5:49pm UTC](https://discourse.julialang.org/t/is-it-the-correct-way-to-check-for-specializations/93490 "2023-04-14T17:49:29Z")

</div>

Following the last paragraph at docs, I want to check if julia is generating specialized version for some of my code. Testing against some built-in functions, first define function get\_sp(wfx) for mi in wfx.speciali…

---

## [Several second delay to process first input with OhMyREPL installed](https://discourse.julialang.org/t/several-second-delay-to-process-first-input-with-ohmyrepl-installed/97447)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 4\
**Last updated:** [April 14, 2023, 4:58pm UTC](https://discourse.julialang.org/t/several-second-delay-to-process-first-input-with-ohmyrepl-installed/97447 "2023-04-14T16:58:01Z")

</div>

Running Julia 1.8.5 x86, built by Homebrew on an M2 MBP. The problem: When I start Julia, the REPL prompt shows normally. But when I type my first input, it takes several seconds before it even appears. After the first …

---

## [VR in Julia!](https://discourse.julialang.org/t/vr-in-julia/69922)

<div class="topic-metadata">

**Author:** [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Replies:** 9\
**Last updated:** [April 14, 2023, 3:06pm UTC](https://discourse.julialang.org/t/vr-in-julia/69922 "2023-04-14T15:06:40Z")

</div>

I’m a game developer who generally programs in c++. I’m new to the language and came up with a plan to make it really simple to call my codebase from julia. I succeeded enough on this to make it really trivial to try emb…

---

## [Mutable function parameter of primitive type](https://discourse.julialang.org/t/mutable-function-parameter-of-primitive-type/40204)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 12\
**Last updated:** [April 14, 2023, 2:43pm UTC](https://discourse.julialang.org/t/mutable-function-parameter-of-primitive-type/40204 "2023-04-14T14:43:53Z")

</div>

I’m going through Julia manual and I’m having a bit of a problem comprehending mutability and pass by sharing concept as applied to primitive types. Can some show me an example where x will be modified by calling f(x) so…

---

## [Multithreaded CSV writes](https://discourse.julialang.org/t/multithreaded-csv-writes/47660)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 20\
**Last updated:** [April 14, 2023, 2:09pm UTC](https://discourse.julialang.org/t/multithreaded-csv-writes/47660 "2023-04-14T14:09:00Z")

</div>

Hi! I am trying to write many data frames to CSV format in parallel. Interestingly, the multi-threaded version is slower than doing it sequentially, and it comes with a very high GC cost. Any idea what’s happening? What …

---

## [Annotations disappear when put on modified plot](https://discourse.julialang.org/t/annotations-disappear-when-put-on-modified-plot/97394)

<div class="topic-metadata">

**Author:** [@Woodmouth](https://discourse.julialang.org/u/Woodmouth)\
**Replies:** 2\
**Last updated:** [April 14, 2023, 1:51pm UTC](https://discourse.julialang.org/t/annotations-disappear-when-put-on-modified-plot/97394 "2023-04-14T13:51:28Z")

</div>

This disscusion presents a way to use annotations to create a multi-colored title, but I have some issues creating annotations on plots that have been modified. Here is a minimal reproducible example using Julia 1.7.2. u…

---

## [How to early return from inside a @threads loop](https://discourse.julialang.org/t/how-to-early-return-from-inside-a-threads-loop/97457)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 6\
**Last updated:** [April 14, 2023, 12:17pm UTC](https://discourse.julialang.org/t/how-to-early-return-from-inside-a-threads-loop/97457 "2023-04-14T12:17:01Z")

</div>

Normally you are thought to avoid thread race in parallel programming, but in certain conditions you would want a sort of thread race. I need to compute some expensive computation and return the function the first time …

---

## [Bringing old C code into Julia](https://discourse.julialang.org/t/bringing-old-c-code-into-julia/97442)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 7\
**Last updated:** [April 14, 2023, 11:58am UTC](https://discourse.julialang.org/t/bringing-old-c-code-into-julia/97442 "2023-04-14T11:58:36Z")

</div>

Hi everyone. I finally found the original and pro stockwell transform code in C wrapped somewhere. I was wondering if anyone can help me figure out how to call this from julia. Kind regards

---

## [Custom vector type causes runtime dispatch when used as view slicing indices](https://discourse.julialang.org/t/custom-vector-type-causes-runtime-dispatch-when-used-as-view-slicing-indices/97470)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 0\
**Last updated:** [April 14, 2023, 11:46am UTC](https://discourse.julialang.org/t/custom-vector-type-causes-runtime-dispatch-when-used-as-view-slicing-indices/97470 "2023-04-14T11:46:07Z")

</div>

In my code there’s a custom vector type (SkipVec) that is used for indexing a matrix with @view. I recently realized (due to JET.jl) that it seems to cause runtime dispatch for some reason: src/SkipVectors.jl · main · Ne…

---

## [What should I do with these building errors?](https://discourse.julialang.org/t/what-should-i-do-with-these-building-errors/97467)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 0\
**Last updated:** [April 14, 2023, 11:20am UTC](https://discourse.julialang.org/t/what-should-i-do-with-these-building-errors/97467 "2023-04-14T11:20:51Z")

</div>

Hi, I’m trying to migrate GMT.jl to use a GMT\_jll artifact but it has not been easy. The build fails for Julia1.7 and nightly but works fine for Julia 1.8 and 1.9rc Specifically it fails for 1.7 with and for night…

---

## [Odd example :-)](https://discourse.julialang.org/t/odd-example/97460)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [April 14, 2023, 8:43am UTC](https://discourse.julialang.org/t/odd-example/97460 "2023-04-14T08:43:17Z")

</div>

hmmm… I assume because min trasforming the int to a float round it up a little and doing that it brings it over the value of typemax… any nice workaround rather than manually remove values ? julia\> Int(typemax(Int64)) 9…

---

## [Canonical Julian way to represent multiple implementations of same algorithm](https://discourse.julialang.org/t/canonical-julian-way-to-represent-multiple-implementations-of-same-algorithm/97312)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 7\
**Last updated:** [April 10, 2023, 8:35pm UTC](https://discourse.julialang.org/t/canonical-julian-way-to-represent-multiple-implementations-of-same-algorithm/97312 "2023-04-10T20:35:24Z")

</div>

Suppose I have some number of different implementations of the same algorithm, or more generally just multiple implementations meeting the same requirements (i.e. identical inputs give identical outputs, modulo usual flo…

---

## [Converting array to a vector](https://discourse.julialang.org/t/converting-array-to-a-vector/34881)

<div class="topic-metadata">

**Author:** [@bandaya](https://discourse.julialang.org/u/bandaya)\
**Replies:** 15\
**Last updated:** [April 14, 2023, 7:29am UTC](https://discourse.julialang.org/t/converting-array-to-a-vector/34881 "2023-04-14T07:29:58Z")

</div>

I have an array T which is 76×1 Array{Any,2}. How can I convert it into 76-element Array{Float64,1} or a 76 element row vector? This array contains data only in rows.

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

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