# General Usage

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

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

**Page:** 229

---

## [Failing to embed Julia in C++](https://discourse.julialang.org/t/failing-to-embed-julia-in-c/106381)

<div class="topic-metadata">

**Author:** [@droodman](https://discourse.julialang.org/u/droodman)\
**Replies:** 1\
**Last updated:** [November 18, 2023, 12:49am UTC](https://discourse.julialang.org/t/failing-to-embed-julia-in-c/106381 "2023-11-18T00:49:06Z")

</div>

I’m trying to embed Julia in C++ on an M2 MacBook under MacOS Sonoma with Julia 1.9.3. I’ve succeeded in compiling the same program in Windows, with Visual Studio, and Ubuntu 22.04, with g++. But on the Mac, g++ is gener…

---

## [How to deploy the documentation?](https://discourse.julialang.org/t/how-to-deploy-the-documentation/106379)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [November 17, 2023, 9:19pm UTC](https://discourse.julialang.org/t/how-to-deploy-the-documentation/106379 "2023-11-17T21:19:20Z")

</div>

I generated a documentation for my latest package, but I cannot deploy the documentation, even though I followed all steps as described at Hosting Documentation · Documenter.jl I get the following error: ERROR: LoadE…

---

## [Error while moving files :name too long (ENAMETOOLONG)](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 2\
**Last updated:** [November 17, 2023, 9:09pm UTC](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377 "2023-11-17T21:09:14Z")

</div>

I am getting name too long (ENAMETOOLONG) when i try to move file from one folder to another. My code is as given below :yawning\_face: \`for i in 1:length(IO) mat=match(r".+beta-(\\d.\\d+)\_betaerr(\\d.\\d+)",IO\[i\]) if…

---

## [Reduce the allocations in the for loop](https://discourse.julialang.org/t/reduce-the-allocations-in-the-for-loop/106348)

<div class="topic-metadata">

**Author:** [@supeng\_xu](https://discourse.julialang.org/u/supeng_xu)\
**Replies:** 3\
**Last updated:** [November 17, 2023, 3:11pm UTC](https://discourse.julialang.org/t/reduce-the-allocations-in-the-for-loop/106348 "2023-11-17T15:11:25Z")

</div>

With the increase of Num, the allocations become larger and larger, can someone help me to optimize this program, here is an easy example ps: in my program, Num is quite larger, ~100000 function test(x,y) c=rand(2)…

---

## [Speeding up \`fit(Histogram)\`](https://discourse.julialang.org/t/speeding-up-fit-histogram/106355)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.julialang.org/u/Dan)\
**Replies:** 10\
**Last updated:** [November 17, 2023, 4:48pm UTC](https://discourse.julialang.org/t/speeding-up-fit-histogram/106355 "2023-11-17T16:48:19Z")

</div>

As an offshoot of a thread about Makie histograms, I’ve tried to benchmark StatsBase fit(Histogtam) like so: julia\> using StatsBase julia\> @btime fit(Histogram, v, 0.0:0.1:1.0) setup=(Random.seed!(1234); v = rand(1\_000…

---

## [Performance Report: Effect of Reading CSV file on Mergeing two DataFrames](https://discourse.julialang.org/t/performance-report-effect-of-reading-csv-file-on-mergeing-two-dataframes/106304)

<div class="topic-metadata">

**Author:** [@Sourish](https://discourse.julialang.org/u/Sourish)\
**Replies:** 18\
**Last updated:** [November 17, 2023, 4:37pm UTC](https://discourse.julialang.org/t/performance-report-effect-of-reading-csv-file-on-mergeing-two-dataframes/106304 "2023-11-17T16:37:33Z")

</div>

Hi I was trying to merge two data frames - but I realised how we read the csv files - that is going to have a bearing on the same merge function. using DataFrames, CSV, FileIO, CSVFiles, PyCall, BenchmarkTools diamonds…

---

## [Sum of tuples are slow](https://discourse.julialang.org/t/sum-of-tuples-are-slow/38541)

<div class="topic-metadata">

**Author:** [@tfr](https://discourse.julialang.org/u/tfr)\
**Replies:** 12\
**Last updated:** [November 17, 2023, 2:45pm UTC](https://discourse.julialang.org/t/sum-of-tuples-are-slow/38541 "2023-11-17T14:45:39Z")

</div>

I did the following tests using BenchmarkTools a = collect(1: 100) a\_tuple = Tuple(a) @benchmark sum($a) @benchmark sum($a\_tuple) For the array a the output is BenchmarkTools.Trial: memory estimate: 0 bytes allo…

---

## [How to move markers in a scatter plot above the x-axis in CairoMakie?](https://discourse.julialang.org/t/how-to-move-markers-in-a-scatter-plot-above-the-x-axis-in-cairomakie/106345)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 3\
**Last updated:** [November 17, 2023, 12:53pm UTC](https://discourse.julialang.org/t/how-to-move-markers-in-a-scatter-plot-above-the-x-axis-in-cairomakie/106345 "2023-11-17T12:53:47Z")

</div>

Hi, I am trying to create a dot plot with CairoMakie using the scatter function. I want the dots to appear above the x-axis spine and decorations. Currently they are being partially hidden as the spine and decorations …

---

## [Solve differential equation algebraically](https://discourse.julialang.org/t/solve-differential-equation-algebraically/106352)

<div class="topic-metadata">

**Author:** [@shikil](https://discourse.julialang.org/u/shikil)\
**Replies:** 4\
**Last updated:** [November 17, 2023, 11:33am UTC](https://discourse.julialang.org/t/solve-differential-equation-algebraically/106352 "2023-11-17T11:33:56Z")

</div>

Hi everyone, I’m looking for a package that can solve differential equation similar to below Sage code: sage: y = function('y')(x) sage: de = diff(y, x) - y\* 2 / x sage: h = desolve(de, y) sage: show(expand(h)) \_C\*x^2 …

---

## [Use tags, setup, teardown with the \`@benchmarkset\` macro](https://discourse.julialang.org/t/use-tags-setup-teardown-with-the-benchmarkset-macro/98936)

<div class="topic-metadata">

**Author:** [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)\
**Replies:** 2\
**Last updated:** [November 17, 2023, 10:17am UTC](https://discourse.julialang.org/t/use-tags-setup-teardown-with-the-benchmarkset-macro/98936 "2023-11-17T10:17:07Z")

</div>

Is there a way to use tags with the @benchmarkset macro? What about setup and teardown? I’ve been searching the docsumentation but to no avail.

---

## [DataFrames: Turning a column of ints into an array of ints per row dependent upon grouping of matching inputs](https://discourse.julialang.org/t/dataframes-turning-a-column-of-ints-into-an-array-of-ints-per-row-dependent-upon-grouping-of-matching-inputs/105978)

<div class="topic-metadata">

**Author:** [@Name1](https://discourse.julialang.org/u/Name1)\
**Replies:** 6\
**Last updated:** [November 17, 2023, 8:48am UTC](https://discourse.julialang.org/t/dataframes-turning-a-column-of-ints-into-an-array-of-ints-per-row-dependent-upon-grouping-of-matching-inputs/105978 "2023-11-17T08:48:33Z")

</div>

Hi all, I want to turn this DataFrame (see first image) df = DataFrame(Year = \[1,2,3,1,2,3\], Name=\["Jack","Jack","Jack","Jill","Jill","Jill"\], Gender=\["M","M","M","F","F","F"\], Cash=\[10.0, 14.0, 12.0, 20.5, 21.5, 22…

---

## [Precompiling function with @threads for and kwcalls](https://discourse.julialang.org/t/precompiling-function-with-threads-for-and-kwcalls/106347)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 0\
**Last updated:** [November 17, 2023, 1:20am UTC](https://discourse.julialang.org/t/precompiling-function-with-threads-for-and-kwcalls/106347 "2023-11-17T01:20:20Z")

</div>

I’ve run my package with @snoopc and found out that the Threads.@threads for anonymous function and kwcalls are always gettting compiled each run, instead of being precompiled and cached: 3935816979 "Tuple{Base.Threads.…

---

## [Package LibGit2 does not have libGit2\_jll](https://discourse.julialang.org/t/package-libgit2-does-not-have-libgit2-jll/106333)

<div class="topic-metadata">

**Author:** [@JohnS](https://discourse.julialang.org/u/JohnS)\
**Replies:** 1\
**Last updated:** [November 16, 2023, 10:57pm UTC](https://discourse.julialang.org/t/package-libgit2-does-not-have-libgit2-jll/106333 "2023-11-16T22:57:29Z")

</div>

I successfully precompiled my package locally but received the following error in my Github Actions CI Julia nightly. Any suggestions on how to fix are most welcome, and please let me know if I need to provide other info…

---

## [Set markeralpha of points on scatterplot based on vector](https://discourse.julialang.org/t/set-markeralpha-of-points-on-scatterplot-based-on-vector/106337)

<div class="topic-metadata">

**Author:** [@wpowell96](https://discourse.julialang.org/u/wpowell96)\
**Replies:** 0\
**Last updated:** [November 16, 2023, 9:59pm UTC](https://discourse.julialang.org/t/set-markeralpha-of-points-on-scatterplot-based-on-vector/106337 "2023-11-16T21:59:23Z")

</div>

Given a 3D scatter plot with N points and another vector with N points, one can set the color within a colormap of the individual points on the scatter plot with the extra vector as so: using Plots, Random w = rand(100…

---

## [Improve speed of vector-jacobian product](https://discourse.julialang.org/t/improve-speed-of-vector-jacobian-product/106312)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [November 16, 2023, 6:31pm UTC](https://discourse.julialang.org/t/improve-speed-of-vector-jacobian-product/106312 "2023-11-16T18:31:59Z")

</div>

Hi, I would like to improve some part of a code which relies on vector-jacobian product (vjp), ie computing the action of the adjoint of an operator. On my computer, the computation of vjp is ~100x slower than the evalu…

---

## [DifferentialEquations.jl saving p vector solution](https://discourse.julialang.org/t/differentialequations-jl-saving-p-vector-solution/106322)

<div class="topic-metadata">

**Author:** [@CasBex](https://discourse.julialang.org/u/CasBex)\
**Replies:** 1\
**Last updated:** [November 16, 2023, 3:59pm UTC](https://discourse.julialang.org/t/differentialequations-jl-saving-p-vector-solution/106322 "2023-11-16T15:59:48Z")

</div>

I’m currently using Functional Mockup Units (fmus) in my work and have been combining it with DifferentialEquations.jl in simulations. An FMU consists of an input, state and output, where the state comprises all variable…

---

## [How to LogSumExp.jl](https://discourse.julialang.org/t/how-to-logsumexp-jl/103894)

<div class="topic-metadata">

**Author:** [@Z\_M](https://discourse.julialang.org/u/Z_M)\
**Replies:** 3\
**Last updated:** [November 16, 2023, 11:44am UTC](https://discourse.julialang.org/t/how-to-logsumexp-jl/103894 "2023-11-16T11:44:26Z")

</div>

Hi guys I want to calculate equations like log(a \* exp(b1) + c \* exp(b2)) I can write: logsumexp(\[log(a) + b1, log(c) + b2\]). I want to know if this method is stable. And I know that in scipy, the logsumexp functi…

---

## [Using HTTP to do a post request where some parameters are JSON strings](https://discourse.julialang.org/t/using-http-to-do-a-post-request-where-some-parameters-are-json-strings/106277)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 2\
**Last updated:** [November 16, 2023, 11:22am UTC](https://discourse.julialang.org/t/using-http-to-do-a-post-request-where-some-parameters-are-json-strings/106277 "2023-11-16T11:22:03Z")

</div>

I’m having a problem where, when trying to write data into a server’s api using post, I cannot seem to send the correct format of json strings, i.e. without the \\" characters in between that we get when we do json(string…

---

## [Weird interaction between packages](https://discourse.julialang.org/t/weird-interaction-between-packages/106306)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [November 16, 2023, 10:25am UTC](https://discourse.julialang.org/t/weird-interaction-between-packages/106306 "2023-11-16T10:25:01Z")

</div>

I am trying to reduce the load time of my project. What I found, using: using Timers; tic() using MAT, PyPlot function read\_lookup(varname="Tables") file = matopen(joinpath("data", "TablesCpCtCq.mat")) res = …

---

## [Is there a way to block type conversion?](https://discourse.julialang.org/t/is-there-a-way-to-block-type-conversion/106302)

<div class="topic-metadata">

**Author:** [@pao](https://discourse.julialang.org/u/pao)\
**Replies:** 6\
**Last updated:** [November 16, 2023, 9:16am UTC](https://discourse.julialang.org/t/is-there-a-way-to-block-type-conversion/106302 "2023-11-16T09:16:26Z")

</div>

I’m writing some simple functions with combinatorial flavor (derived from IBM’s research language FL), but they cannot be used as needed by the intrusive type conversion. Example: julia\> DISTL(\[100,\[10.,20.,30.\]\]) …

---

## [How to improve code to compute the mean of values grouped by DateTime?](https://discourse.julialang.org/t/how-to-improve-code-to-compute-the-mean-of-values-grouped-by-datetime/106235)

<div class="topic-metadata">

**Author:** [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Replies:** 7\
**Last updated:** [November 15, 2023, 11:27pm UTC](https://discourse.julialang.org/t/how-to-improve-code-to-compute-the-mean-of-values-grouped-by-datetime/106235 "2023-11-15T23:27:37Z")

</div>

I have written the piece of code below. It takes a vector of DateTime, a vector of Float64, and an integer g as input to calculate the mean of the the type Float64 by grouped DateTime type given time granularity g. In t…

---

## [Error with sin and cos function after update NeuralPDE](https://discourse.julialang.org/t/error-with-sin-and-cos-function-after-update-neuralpde/102154)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 8\
**Last updated:** [November 15, 2023, 9:50pm UTC](https://discourse.julialang.org/t/error-with-sin-and-cos-function-after-update-neuralpde/102154 "2023-11-15T21:50:41Z")

</div>

I have updated to the latest version of package NeuralPDE and used the res = Optimization.solve(prob,OptimizationOptimJL.BFGS(); callback = callback, maxiters = 1500) to solve the ODE system on Jupyter notebook. I got th…

---

## [Why does b \*= A\[r\] allocate memory?](https://discourse.julialang.org/t/why-does-b-a-r-allocate-memory/106279)

<div class="topic-metadata">

**Author:** [@Christopher\_White](https://discourse.julialang.org/u/Christopher_White)\
**Replies:** 6\
**Last updated:** [November 15, 2023, 9:29pm UTC](https://discourse.julialang.org/t/why-does-b-a-r-allocate-memory/106279 "2023-11-15T21:29:32Z")

</div>

The following code does a whole bunch of allocations: N = 10000000 A = randn(Float64, N) b = 1.0 @show typeof(b) @time for r = 1:N b \*= A\[r\] end Why is that? How can I write this in a way that doesn’t allocate ~ a…

---

## [PlotlyJS and subplots: shared yaxis\_range](https://discourse.julialang.org/t/plotlyjs-and-subplots-shared-yaxis-range/106238)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 1\
**Last updated:** [November 15, 2023, 6:01pm UTC](https://discourse.julialang.org/t/plotlyjs-and-subplots-shared-yaxis-range/106238 "2023-11-15T18:01:26Z")

</div>

Edited: now, with a MWE that can be replicated Hi, I need to create a figure with some subplots, like the following one: The code I used is this: using PlotlyJS p1 = make\_subplots(rows=2, cols=2, specs=\[Spec(…

---

## [Function only works if println statements are included](https://discourse.julialang.org/t/function-only-works-if-println-statements-are-included/106210)

<div class="topic-metadata">

**Author:** [@opiateblush](https://discourse.julialang.org/u/opiateblush)\
**Replies:** 8\
**Last updated:** [November 15, 2023, 4:51pm UTC](https://discourse.julialang.org/t/function-only-works-if-println-statements-are-included/106210 "2023-11-15T16:51:18Z")

</div>

Hey, I have the following piece of code that works as intended if the commented lines with the println statements are included. If they are commented out the if statement that compares the dictionaries evaluates to true …

---

## [App using Dash with multi components (dcc\_dropdown and dcc\_graph) error](https://discourse.julialang.org/t/app-using-dash-with-multi-components-dcc-dropdown-and-dcc-graph-error/106269)

<div class="topic-metadata">

**Author:** [@Siv\_Soerensen](https://discourse.julialang.org/u/Siv_Soerensen)\
**Replies:** 0\
**Last updated:** [November 15, 2023, 3:25pm UTC](https://discourse.julialang.org/t/app-using-dash-with-multi-components-dcc-dropdown-and-dcc-graph-error/106269 "2023-11-15T15:25:35Z")

</div>

I would like to make an application in which I have both a dcc\_dropdown and a dcc\_graph component, but I do not seem to be able to get the right ‘format of the call’. I had ChatGPT make a ‘simplified version’ of my code…

---

## [Passing variables to @macros](https://discourse.julialang.org/t/passing-variables-to-macros/106245)

<div class="topic-metadata">

**Author:** [@preston-johnson](https://discourse.julialang.org/u/preston-johnson)\
**Replies:** 2\
**Last updated:** [November 15, 2023, 3:11pm UTC](https://discourse.julialang.org/t/passing-variables-to-macros/106245 "2023-11-15T15:11:37Z")

</div>

Greetings, friends: (Preface) Excel is outdated. I thought I loved LET() and LAMBDA(), but I can no longer spend my waking life with VBA and reflectionless formulas. Just in the same way that Julia was created to satis…

---

## [Heterogeneous space](https://discourse.julialang.org/t/heterogeneous-space/106262)

<div class="topic-metadata">

**Author:** [@Kemper](https://discourse.julialang.org/u/Kemper)\
**Replies:** 2\
**Last updated:** [November 15, 2023, 1:52pm UTC](https://discourse.julialang.org/t/heterogeneous-space/106262 "2023-11-15T13:52:15Z")

</div>

Hello! If I have a simple model in Agents.jl, where Agents have to find food. And now I would like to add obsticles, like lets say a river, how can I do that? Is there a way to use a grid as space which has e.g. ones …

---

## [Package manager](https://discourse.julialang.org/t/package-manager/106247)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [November 15, 2023, 12:08pm UTC](https://discourse.julialang.org/t/package-manager/106247 "2023-11-15T12:08:49Z")

</div>

When should I use: up --project in the package manager? Advantages/ disadvantages?

---

## [Matrix-vector representation of a system of linear inequalities](https://discourse.julialang.org/t/matrix-vector-representation-of-a-system-of-linear-inequalities/106188)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 7\
**Last updated:** [November 15, 2023, 9:10am UTC](https://discourse.julialang.org/t/matrix-vector-representation-of-a-system-of-linear-inequalities/106188 "2023-11-15T09:10:40Z")

</div>

Hello, Consider for example this set of linear inequalities: It is equivalent to: and this can be represented as A\*\[x;y;z\] \<= b where the matrix A is given by the coefficients of the variables at the LHS and the v…

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

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