# General Usage

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

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

**Page:** 259

---

## [Test macro that checks no exception was thrown?](https://discourse.julialang.org/t/test-macro-that-checks-no-exception-was-thrown/41394)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 3\
**Last updated:** [August 11, 2023, 10:32pm UTC](https://discourse.julialang.org/t/test-macro-that-checks-no-exception-was-thrown/41394 "2023-08-11T22:32:48Z")

</div>

I want to implement a test that just need to know the function did not throw any exception. There’s @test\_throws but that’s the exact opposite of what I need. Is there anything like that? I could work around by using …

---

## [Unittest for postgresql database](https://discourse.julialang.org/t/unittest-for-postgresql-database/102720)

<div class="topic-metadata">

**Author:** [@cbe](https://discourse.julialang.org/u/cbe)\
**Replies:** 0\
**Last updated:** [August 11, 2023, 3:48pm UTC](https://discourse.julialang.org/t/unittest-for-postgresql-database/102720 "2023-08-11T15:48:17Z")

</div>

Hello, I would like to test a function doing a call to a database, but I want to mock my connection. I want to test that the returned type of my function is correct without actually calling the database. I’m thinking a…

---

## [Does Jevons Paradox Apply to Julia for Health Informatics Research?](https://discourse.julialang.org/t/does-jevons-paradox-apply-to-julia-for-health-informatics-research/102722)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 2\
**Last updated:** [August 11, 2023, 5:59pm UTC](https://discourse.julialang.org/t/does-jevons-paradox-apply-to-julia-for-health-informatics-research/102722 "2023-08-11T17:59:14Z")

</div>

Hi all, :wave: Over the past few years, I have been developing tools for health informatics research (specifically observational health research) within Julia. My personal reasons for this has been personal productivity…

---

## [Is there any method that I can input Chinese character using GMT.jl?](https://discourse.julialang.org/t/is-there-any-method-that-i-can-input-chinese-character-using-gmt-jl/102717)

<div class="topic-metadata">

**Author:** [@Vincent\_Liao](https://discourse.julialang.org/u/Vincent_Liao)\
**Replies:** 0\
**Last updated:** [August 11, 2023, 3:01pm UTC](https://discourse.julialang.org/t/is-there-any-method-that-i-can-input-chinese-character-using-gmt-jl/102717 "2023-08-11T15:01:45Z")

</div>

The following is my code using GMT gmtbegin("Figure1", fmt="pdf,png") gmtset(PS\_CHAR\_ENCODING="Standard+", FONT\_LABEL="10p,39,black", ) subplot(grid="2x3", panels\_size=(8,6), margins="6p") bas…

---

## [The state of loop optimization in Julia](https://discourse.julialang.org/t/the-state-of-loop-optimization-in-julia/102711)

<div class="topic-metadata">

**Author:** [@Tarny\_GG\_Channie](https://discourse.julialang.org/u/Tarny_GG_Channie)\
**Replies:** 1\
**Last updated:** [August 11, 2023, 10:24am UTC](https://discourse.julialang.org/t/the-state-of-loop-optimization-in-julia/102711 "2023-08-11T10:24:49Z")

</div>

We have loop vectorization which optimizes a single, highly restricted loop, then we will have loopmodel with less restriction but no multithreading. Then, there is a “future work” for loopvectorization. Naturally, one w…

---

## [Franklin.jl Dynamically Loading and Suppressing Pages](https://discourse.julialang.org/t/franklin-jl-dynamically-loading-and-suppressing-pages/102530)

<div class="topic-metadata">

**Author:** [@Ian\_L](https://discourse.julialang.org/u/Ian_L)\
**Replies:** 4\
**Last updated:** [August 11, 2023, 7:39am UTC](https://discourse.julialang.org/t/franklin-jl-dynamically-loading-and-suppressing-pages/102530 "2023-08-11T07:39:24Z")

</div>

There are two separate but slightly related problems. First, I have a directory called posts containing markdown files to be displayed. I would like to keep some of these markdown files in the folder, but suppress them d…

---

## [Partially parametrized external constructor of a parametric type](https://discourse.julialang.org/t/partially-parametrized-external-constructor-of-a-parametric-type/102687)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 10\
**Last updated:** [August 10, 2023, 11:59pm UTC](https://discourse.julialang.org/t/partially-parametrized-external-constructor-of-a-parametric-type/102687 "2023-08-10T23:59:24Z")

</div>

Define a parametric type with parameters S and T (S is intended to be an integer, and T is intended to be a floating-point number): struct FooBar{S,T} x::S y::T FooBar{S,T}(x,y) where {S,T} = new(x,y) end D…

---

## [How to tag a new release for a package?](https://discourse.julialang.org/t/how-to-tag-a-new-release-for-a-package/4078)

<div class="topic-metadata">

**Author:** [@billmclean](https://discourse.julialang.org/u/billmclean)\
**Replies:** 3\
**Last updated:** [August 10, 2023, 8:06pm UTC](https://discourse.julialang.org/t/how-to-tag-a-new-release-for-a-package/4078 "2023-08-10T20:06:15Z")

</div>

I am unsure of the best way for the owner of an already registered package to release an updated version. Is it sufficient to commit the changes, push them to origin/master and do julia\> PkgDev.tag(“MyPackage”) (assum…

---

## [Problem of unnecessarily iterating many times in for loop](https://discourse.julialang.org/t/problem-of-unnecessarily-iterating-many-times-in-for-loop/101319)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 18\
**Last updated:** [August 10, 2023, 7:51pm UTC](https://discourse.julialang.org/t/problem-of-unnecessarily-iterating-many-times-in-for-loop/101319 "2023-08-10T19:51:06Z")

</div>

For the following code it gives output many times(about 40 times) for only three true matches . Unnecessary iteration will decrease performance as far as i know it should give only three output . julia\> using CSV, Data…

---

## [Recover full printing of \`UnionAll\` type](https://discourse.julialang.org/t/recover-full-printing-of-unionall-type/102693)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 1\
**Last updated:** [August 10, 2023, 7:45pm UTC](https://discourse.julialang.org/t/recover-full-printing-of-unionall-type/102693 "2023-08-10T19:45:00Z")

</div>

As discussed in this thread, printing of UnionAll types changed in Julia 1.7, as demonstrated here: 1.6 julia\> struct Foo{A,B} end julia\> Foo{Int} Foo{Int64, B} where B 1.7 julia\> struct Foo{A,B} end julia\> Foo{Int} …

---

## [One Julia sys.so is slower than the other](https://discourse.julialang.org/t/one-julia-sys-so-is-slower-than-the-other/102689)

<div class="topic-metadata">

**Author:** [@limonspb](https://discourse.julialang.org/u/limonspb)\
**Replies:** 0\
**Last updated:** [August 10, 2023, 6:14pm UTC](https://discourse.julialang.org/t/one-julia-sys-so-is-slower-than-the-other/102689 "2023-08-10T18:14:34Z")

</div>

Hello dear experts. Might be a weird question. I have two different sys.so files of Julia (precompiled Julia with some third-party packages included, PackageCompiler is used). Both files are Julia 1.6.1. The problem i…

---

## [ForwardDiffSensitivity Faster than Adjoint Methods](https://discourse.julialang.org/t/forwarddiffsensitivity-faster-than-adjoint-methods/102652)

<div class="topic-metadata">

**Author:** [@George\_Stepaniants](https://discourse.julialang.org/u/George_Stepaniants)\
**Replies:** 8\
**Last updated:** [August 10, 2023, 4:30pm UTC](https://discourse.julialang.org/t/forwarddiffsensitivity-faster-than-adjoint-methods/102652 "2023-08-10T16:30:50Z")

</div>

I am having a problem speeding up my Neural ODE gradient computations. Namely, I have defined a neural ode struct which accepts a control input and am aiming to optimize the parameters of the neural network to optimize a…

---

## [Julia why the output is 4:4 of the function findnext](https://discourse.julialang.org/t/julia-why-the-output-is-4-4-of-the-function-findnext/102678)

<div class="topic-metadata">

**Author:** [@saampandit](https://discourse.julialang.org/u/saampandit)\
**Replies:** 2\
**Last updated:** [August 10, 2023, 12:47pm UTC](https://discourse.julialang.org/t/julia-why-the-output-is-4-4-of-the-function-findnext/102678 "2023-08-10T12:47:30Z")

</div>

I am new to Julia why the function is returning value 4:4 what does it means ?? findnext("o", "xylophone", 1)

---

## [Latex Title Makie](https://discourse.julialang.org/t/latex-title-makie/102667)

<div class="topic-metadata">

**Author:** [@janrpeters](https://discourse.julialang.org/u/janrpeters)\
**Replies:** 1\
**Last updated:** [August 10, 2023, 9:40am UTC](https://discourse.julialang.org/t/latex-title-makie/102667 "2023-08-10T09:40:31Z")

</div>

No matter whether I use title = "Example Trajectory", #L"Example Trajectory for $\\tau=0$", titlefont = texfont(), or title =#L"Example Trajectory for $\\tau=0$", in Makie, I never manage to get the title t…

---

## [Differences in using MvNormal and Normal in the calculation of the likelihood](https://discourse.julialang.org/t/differences-in-using-mvnormal-and-normal-in-the-calculation-of-the-likelihood/102602)

<div class="topic-metadata">

**Author:** [@99dB](https://discourse.julialang.org/u/99dB)\
**Replies:** 4\
**Last updated:** [August 10, 2023, 8:43am UTC](https://discourse.julialang.org/t/differences-in-using-mvnormal-and-normal-in-the-calculation-of-the-likelihood/102602 "2023-08-10T08:43:45Z")

</div>

Hello all, I have a question related the ODE Turing tutorial: using Turing, DifferentialEquations, StatsPlots, LinearAlgebra, Random Random.seed!(14); function lotka\_volterra(du, u, p, t) # Model parameters. …

---

## [Julia equivalent of R's quantile function](https://discourse.julialang.org/t/julia-equivalent-of-rs-quantile-function/102584)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 7\
**Last updated:** [August 10, 2023, 5:25am UTC](https://discourse.julialang.org/t/julia-equivalent-of-rs-quantile-function/102584 "2023-08-10T05:25:49Z")

</div>

I am trying to convert R code to Julia and need help on below logic conversion. Currently in R they are trying to process each row in percentile\_to df using for loop by passing arguments to function func\_get\_percentile\_…

---

## [Implementing Tables.jl interface results in Stack Overflow](https://discourse.julialang.org/t/implementing-tables-jl-interface-results-in-stack-overflow/102633)

<div class="topic-metadata">

**Author:** [@MitchellWeg](https://discourse.julialang.org/u/MitchellWeg)\
**Replies:** 1\
**Last updated:** [August 10, 2023, 12:57am UTC](https://discourse.julialang.org/t/implementing-tables-jl-interface-results-in-stack-overflow/102633 "2023-08-10T00:57:19Z")

</div>

For my package, I’m trying to implement the Tables.jl package. I however don’t really have a clue on how to implement the interface, and what the specific functions need to return. Currently, I have this code. It howeve…

---

## [Problem with multiplying functions to create Lagrange interpolating polynomial basis](https://discourse.julialang.org/t/problem-with-multiplying-functions-to-create-lagrange-interpolating-polynomial-basis/102578)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 1\
**Last updated:** [August 10, 2023, 1:57am UTC](https://discourse.julialang.org/t/problem-with-multiplying-functions-to-create-lagrange-interpolating-polynomial-basis/102578 "2023-08-10T01:57:19Z")

</div>

I am trying to write some functions to generate a Lagrange interpolating polynomial basis. That is, I want to create a vector where each element is a lagrange polynomial basis function. I have some code below but it does…

---

## [DataFrame: New columns with names from existing column](https://discourse.julialang.org/t/dataframe-new-columns-with-names-from-existing-column/102658)

<div class="topic-metadata">

**Author:** [@bmit](https://discourse.julialang.org/u/bmit)\
**Replies:** 1\
**Last updated:** [August 10, 2023, 1:50am UTC](https://discourse.julialang.org/t/dataframe-new-columns-with-names-from-existing-column/102658 "2023-08-10T01:50:55Z")

</div>

I’m trying to take an existing DataFrame that looks something like the following: df = DataFrame(:x =\> \[1, 2, 3, 1, 2\], :y =\> \[:A, :A, :A, :B, :B\], :z =\> 1:2:9) 5×3 DataFrame Row │ x y z │ Int64 …

---

## [What's the aliasing story in Julia](https://discourse.julialang.org/t/whats-the-aliasing-story-in-julia/102564)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 36\
**Last updated:** [August 9, 2023, 9:50pm UTC](https://discourse.julialang.org/t/whats-the-aliasing-story-in-julia/102564 "2023-08-09T21:50:31Z")

</div>

So let’s say I’m looking at a function that takes multiple mutable arguments, say, any! or extrema! or sortperm!, or sum!, or copyto!, or mul!. Who is responsible for handling aliasing? Am I ever allowed to pass in two o…

---

## [Why does indexing with a scalar allocate memory?](https://discourse.julialang.org/t/why-does-indexing-with-a-scalar-allocate-memory/102656)

<div class="topic-metadata">

**Author:** [@qua4tre](https://discourse.julialang.org/u/qua4tre)\
**Replies:** 2\
**Last updated:** [August 9, 2023, 11:44pm UTC](https://discourse.julialang.org/t/why-does-indexing-with-a-scalar-allocate-memory/102656 "2023-08-09T23:44:57Z")

</div>

julia\> @time 2.0; 0.000005 seconds julia\> x = fill(2.0, 3) 3-element Vector{Float64}: 2.0 2.0 2.0 julia\> @time x\[1\]; 0.000009 seconds (1 allocation: 16 bytes) I would have assumed x\[1\] would be a nonallocating …

---

## [Write Large Parquet to S3](https://discourse.julialang.org/t/write-large-parquet-to-s3/102639)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 6\
**Last updated:** [August 9, 2023, 8:43pm UTC](https://discourse.julialang.org/t/write-large-parquet-to-s3/102639 "2023-08-09T20:43:09Z")

</div>

I have an AWS Glue table made up of parquet files. Unfortunately, the upstream process creates files that are too small for optimal querying from Athena/Redshift so I am looking to consolidate them up to files closer to …

---

## [Help needed to train simple RNN using Flux](https://discourse.julialang.org/t/help-needed-to-train-simple-rnn-using-flux/102650)

<div class="topic-metadata">

**Author:** [@chenwilliam77](https://discourse.julialang.org/u/chenwilliam77)\
**Replies:** 0\
**Last updated:** [August 9, 2023, 7:36pm UTC](https://discourse.julialang.org/t/help-needed-to-train-simple-rnn-using-flux/102650 "2023-08-09T19:36:46Z")

</div>

I am trying to learn a function of time series data using a neural network. In the example below, I’m simulating an AR(1), and I’m trying to learn the function f(x\_t, x\_{t - 1}, x\_{t - 2}, . . .) = x\_t^2 + x\_{t - 1}^2 \*…

---

## [Is it possible to precompile (with PrecompileTools) code from a package extension?](https://discourse.julialang.org/t/is-it-possible-to-precompile-with-precompiletools-code-from-a-package-extension/102647)

<div class="topic-metadata">

**Author:** [@BenjaminDoran](https://discourse.julialang.org/u/BenjaminDoran)\
**Replies:** 1\
**Last updated:** [August 9, 2023, 6:27pm UTC](https://discourse.julialang.org/t/is-it-possible-to-precompile-with-precompiletools-code-from-a-package-extension/102647 "2023-08-09T18:27:43Z")

</div>

I was trying to use PrecompileTools to make a pre-compilation workflow for a package extension but ran into issues where because the weak-dependency is not part of the module its name is not defined. Is it possible to p…

---

## [ModelingToolkit compilation time for many small simulations](https://discourse.julialang.org/t/modelingtoolkit-compilation-time-for-many-small-simulations/102631)

<div class="topic-metadata">

**Author:** [@Antomek](https://discourse.julialang.org/u/Antomek)\
**Replies:** 5\
**Last updated:** [August 9, 2023, 4:21pm UTC](https://discourse.julialang.org/t/modelingtoolkit-compilation-time-for-many-small-simulations/102631 "2023-08-09T16:21:14Z")

</div>

Hello all, I am in a situation where I want to run many small ODEs, to do an ensemble-type of simulation. I really like using ModelingToolkit, and was trying to use it for this purpose. However, my code is running rea…

---

## [Using superscript ⁻¹ as a postfix operator for inv?](https://discourse.julialang.org/t/using-superscript-as-a-postfix-operator-for-inv/40413)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 15\
**Last updated:** [August 9, 2023, 1:59pm UTC](https://discourse.julialang.org/t/using-superscript-as-a-postfix-operator-for-inv/40413 "2023-08-09T13:59:11Z")

</div>

Nice. I see they’re using the latest unicode. Does anyone know if it will be possible (an supported by Julia) to express negative one “-1” as a superscript w/ unicode? X^{-1} is a lot leaner than inv(X) or X^-1

---

## [Read file to io](https://discourse.julialang.org/t/read-file-to-io/102629)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [August 9, 2023, 12:04pm UTC](https://discourse.julialang.org/t/read-file-to-io/102629 "2023-08-09T12:04:44Z")

</div>

Given a filename and an io::IO, what’s the recommended way of reading a file and dumping it to io? A naive solution is function read\_to\_io(filename::AbstractString, io::IO) open(filename, "r") do src\_io whi…

---

## [Difference between % and mod](https://discourse.julialang.org/t/difference-between-and-mod/102630)

<div class="topic-metadata">

**Author:** [@janrpeters](https://discourse.julialang.org/u/janrpeters)\
**Replies:** 1\
**Last updated:** [August 9, 2023, 11:02am UTC](https://discourse.julialang.org/t/difference-between-and-mod/102630 "2023-08-09T11:02:14Z")

</div>

For ‘’’ (-3.2) % π ‘’’ I get ‘’’ -0.05840734641020706 ‘’’ but for ‘’’ mod(-3.2,π) ‘’’ I get ‘’’ 3.083185307179586 ‘’’ I like the latter for my purpose but is that difference a bug or a feature?

---

## [Plots, InitError: UndefVarError: GR\_jll not defined](https://discourse.julialang.org/t/plots-initerror-undefvarerror-gr-jll-not-defined/102448)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 4\
**Last updated:** [August 9, 2023, 8:31am UTC](https://discourse.julialang.org/t/plots-initerror-undefvarerror-gr-jll-not-defined/102448 "2023-08-09T08:31:44Z")

</div>

In some circumstances, a user may encounter the following error. Failed to precompile Plots \[91a5bcdd-55d7-5caf-9e0b-520d859cae80\] to "~/.julia/compiled/v1.9/Plots/jl\_crbDAx". ERROR: LoadError: InitError: UndefVarError:…

---

## [Append! produces #undef values from missings. Related to WeakRefStrings / JDF](https://discourse.julialang.org/t/append-produces-undef-values-from-missings-related-to-weakrefstrings-jdf/102613)

<div class="topic-metadata">

**Author:** [@Parazetamol](https://discourse.julialang.org/u/Parazetamol)\
**Replies:** 0\
**Last updated:** [August 8, 2023, 7:45pm UTC](https://discourse.julialang.org/t/append-produces-undef-values-from-missings-related-to-weakrefstrings-jdf/102613 "2023-08-08T19:45:25Z")

</div>

Hi there, i’m afraid I discovered a bug while working with DataFrames and JDF. But the problem seems to be related to WeakRefStrings: What do you think? Greetings Parazetamol using DataFrames, JDF # DataFrames v1.…

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

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