# General Usage

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

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

**Page:** 375

---

## [Simulating no internet connection](https://discourse.julialang.org/t/simulating-no-internet-connection/89640)

<div class="topic-metadata">

**Author:** [@Name1](https://discourse.julialang.org/u/Name1)\
**Replies:** 1\
**Last updated:** [November 2, 2022, 5:33am UTC](https://discourse.julialang.org/t/simulating-no-internet-connection/89640 "2022-11-02T05:33:57Z")

</div>

Hi all, catch e if e isa (Sockets.DNSError) # print message elseif e isa (HTTP.StatusError) # print message end end # ... I know that the Sockets.DNSError can either be triggered by an inval…

---

## [Julia fails to precompile plots](https://discourse.julialang.org/t/julia-fails-to-precompile-plots/88411)

<div class="topic-metadata">

**Author:** [@Matteo](https://discourse.julialang.org/u/Matteo)\
**Replies:** 32\
**Last updated:** [November 2, 2022, 2:03am UTC](https://discourse.julialang.org/t/julia-fails-to-precompile-plots/88411 "2022-11-02T02:03:34Z")

</div>

I’m using Julia 1.8 on my Mac with Atom. I know that Atom is not anymore the editor recommended for Julia, but I think my problem is not related to Atom. In fact I have a problem with the package “Plots”: when I run the …

---

## [Is there a NamedArray or DimensionalData type package that can combine orthogonal dimensions?](https://discourse.julialang.org/t/is-there-a-namedarray-or-dimensionaldata-type-package-that-can-combine-orthogonal-dimensions/89610)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 4\
**Last updated:** [November 2, 2022, 1:29am UTC](https://discourse.julialang.org/t/is-there-a-namedarray-or-dimensionaldata-type-package-that-can-combine-orthogonal-dimensions/89610 "2022-11-02T01:29:44Z")

</div>

Vectorised operations on regular arrays produce a cross product across dimensions. e.g. x = \[1 2 3\] a = reshape( x, (3,1,1)) b = reshape( x, (1,3,1)) c = reshape( x, (1,1,3)) X = @. a + b + c X\[3,3,3\] # =9 Simila…

---

## [Help with failing package compilaton of AbstractFFTs](https://discourse.julialang.org/t/help-with-failing-package-compilaton-of-abstractffts/88938)

<div class="topic-metadata">

**Author:** [@votroto](https://discourse.julialang.org/u/votroto)\
**Replies:** 11\
**Last updated:** [November 2, 2022, 12:59am UTC](https://discourse.julialang.org/t/help-with-failing-package-compilaton-of-abstractffts/88938 "2022-11-02T00:59:32Z")

</div>

Hi I’m trying to install CUDA.jl, but its dependency AbstractFFTs keeps failing. Here is an output from the session. Is there any way to debug it? Is the problem on my end? Neither Julia 1.8, 1.7, nor 1.6 works. $ julia…

---

## [Using a mix of maintained and unmaintained packages?](https://discourse.julialang.org/t/using-a-mix-of-maintained-and-unmaintained-packages/89622)

<div class="topic-metadata">

**Author:** [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Replies:** 3\
**Last updated:** [November 2, 2022, 12:18am UTC](https://discourse.julialang.org/t/using-a-mix-of-maintained-and-unmaintained-packages/89622 "2022-11-02T00:18:29Z")

</div>

Say packages A and B both depend on HTTP, but B isn’t being maintained anymore and still uses 0.9.17. A is fresh and up-to-date and can run on HTTP 1.5.1. I want to use both packages A and B in my application, but I don’…

---

## [From toy to production code with sparse matrix and sparse-direct factorizations](https://discourse.julialang.org/t/from-toy-to-production-code-with-sparse-matrix-and-sparse-direct-factorizations/89105)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 17\
**Last updated:** [November 1, 2022, 10:01pm UTC](https://discourse.julialang.org/t/from-toy-to-production-code-with-sparse-matrix-and-sparse-direct-factorizations/89105 "2022-11-01T22:01:25Z")

</div>

Dear all, I would like to port a toy code that assembles one sparse matrix and solves one linear system of equation to a production code that assembles many sparse matrices and solves many systems of equation iterativel…

---

## [\`Vector{Bool}\` to Int](https://discourse.julialang.org/t/vector-bool-to-int/89560)

<div class="topic-metadata">

**Author:** [@this\_josh](https://discourse.julialang.org/u/this_josh)\
**Replies:** 14\
**Last updated:** [November 1, 2022, 9:07pm UTC](https://discourse.julialang.org/t/vector-bool-to-int/89560 "2022-11-01T21:07:51Z")

</div>

I’m using PyCall to interact with a python package which returns integers as a Vector{Bool}, e.g. \[true, true, false, true, true, true, false, true\]. How can I easily convert this to an integer? In a previous question i…

---

## [Show right y-axis using twinx() with Plots pyplot()](https://discourse.julialang.org/t/show-right-y-axis-using-twinx-with-plots-pyplot/30750)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 10\
**Last updated:** [November 1, 2022, 8:49pm UTC](https://discourse.julialang.org/t/show-right-y-axis-using-twinx-with-plots-pyplot/30750 "2022-11-01T20:49:43Z")

</div>

Hi, I am using twinx() to overlay 2 graphs with different y-axis, but only the y-axis on the left shows up in the plot. On the right, I only see numbers. Also, the y-label on the right gets cut out. Does anyone know ho…

---

## [Can't Install Python with CondaPkg in Docker](https://discourse.julialang.org/t/cant-install-python-with-condapkg-in-docker/89631)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 0\
**Last updated:** [November 1, 2022, 8:03pm UTC](https://discourse.julialang.org/t/cant-install-python-with-condapkg-in-docker/89631 "2022-11-01T20:03:28Z")

</div>

I started a conversation here, but I’m under the impression that this is not a CondaPkg issue, so I’m wondering if the wider community can help. I have a project that uses PythonCall. It works well on my computer (Windo…

---

## [Understanding version compatibility message](https://discourse.julialang.org/t/understanding-version-compatibility-message/89627)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [November 1, 2022, 6:54pm UTC](https://discourse.julialang.org/t/understanding-version-compatibility-message/89627 "2022-11-01T18:54:57Z")

</div>

In Julia 1.8, I get the following result by pkg\> st -o: (@v1.8) pkg\> st -o MyPkg1 Status \`~/.julia/environments/v1.8/Project.toml\` ⌅ \[1766def0\] MyPkg1 v0.1.4 (\<v0.2.1): MyPkg2, MyPkg3, MyPkg4 Does this means that MyPkg…

---

## [Running files multiple times and saving output of each instance](https://discourse.julialang.org/t/running-files-multiple-times-and-saving-output-of-each-instance/89625)

<div class="topic-metadata">

**Author:** [@Max\_Beez](https://discourse.julialang.org/u/Max_Beez)\
**Replies:** 3\
**Last updated:** [November 1, 2022, 6:51pm UTC](https://discourse.julialang.org/t/running-files-multiple-times-and-saving-output-of-each-instance/89625 "2022-11-01T18:51:13Z")

</div>

If I have a file I would like to run multiple times I know I could use an include statement within a for-loop. I would like to run such a file say N times, and for each iteration I would like to save the output. What wo…

---

## [Floating point optimizations](https://discourse.julialang.org/t/floating-point-optimizations/89585)

<div class="topic-metadata">

**Author:** [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Replies:** 5\
**Last updated:** [November 1, 2022, 2:59pm UTC](https://discourse.julialang.org/t/floating-point-optimizations/89585 "2022-11-01T14:59:14Z")

</div>

Running julia with --math-mode=ieee is somehow equivalent to compiling a c++ project in MSVC with /fp:strict?

---

## [Suppressing precompilation](https://discourse.julialang.org/t/suppressing-precompilation/89624)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 2\
**Last updated:** [November 1, 2022, 5:33pm UTC](https://discourse.julialang.org/t/suppressing-precompilation/89624 "2022-11-01T17:33:14Z")

</div>

Is there a way to suppress precompilation when adding packages? Right now I am adding and removing packages repeatedly to resolve package version compatibility, and waiting for precompilation to finish every time is exh…

---

## [Best \`separate\` performance?](https://discourse.julialang.org/t/best-separate-performance/25841)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 18\
**Last updated:** [November 1, 2022, 3:13pm UTC](https://discourse.julialang.org/t/best-separate-performance/25841 "2022-11-01T15:13:57Z")

</div>

Hi all, I’ve been trying out some ways of separating a Vector into a true and false part based on predicate f, and the basic code below is what I ended up with. My question/challenge is whether anyone knows a faster way …

---

## [Does TensorOperations.jl not support Zygote.jl?](https://discourse.julialang.org/t/does-tensoroperations-jl-not-support-zygote-jl/89174)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [November 1, 2022, 3:11pm UTC](https://discourse.julialang.org/t/does-tensoroperations-jl-not-support-zygote-jl/89174 "2022-11-01T15:11:50Z")

</div>

julia\> using Zygote julia\> using TensorOperations julia\> function f(x) @tensor b\[i,k\] := x\[i,j\]\*x\[j,k\] sum(b) end f (generic function with 1 method) julia\> a=rand(10,10); julia\> gradient(f,a)…

---

## [Need a rarely used binary operator for matrices](https://discourse.julialang.org/t/need-a-rarely-used-binary-operator-for-matrices/89263)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 15\
**Last updated:** [November 1, 2022, 12:52pm UTC](https://discourse.julialang.org/t/need-a-rarely-used-binary-operator-for-matrices/89263 "2022-11-01T12:52:08Z")

</div>

Could you suggest a good binary operator that is not commonly used for matrices in Julia Base or packages? I need to use it for some common matrix operations in my code. I don’t want to step on something else.

---

## [How to mutate the value (not binding) of a scalar?](https://discourse.julialang.org/t/how-to-mutate-the-value-not-binding-of-a-scalar/89607)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 8\
**Last updated:** [November 1, 2022, 12:45pm UTC](https://discourse.julialang.org/t/how-to-mutate-the-value-not-binding-of-a-scalar/89607 "2022-11-01T12:45:42Z")

</div>

I can do the following to mutate the original memory, w = ones(3) 3-element Vector{Float64}: 1.0 1.0 1.0 x = w 3-element Vector{Float64}: 1.0 1.0 1.0 x\[2\]=2. 2.0 but I can’t find a way to mutate w if it…

---

## [Prevent escaping for single symbol inside macro body](https://discourse.julialang.org/t/prevent-escaping-for-single-symbol-inside-macro-body/89609)

<div class="topic-metadata">

**Author:** [@disberd](https://discourse.julialang.org/u/disberd)\
**Replies:** 0\
**Last updated:** [November 1, 2022, 10:37am UTC](https://discourse.julialang.org/t/prevent-escaping-for-single-symbol-inside-macro-body/89609 "2022-11-01T10:37:12Z")

</div>

Is there a function or any other way to prevent escaping of a specific symbol when wrapping the expr returned by a macro with esc()? I sometime want to have a few symbols within the macro body to be unescaped and it wou…

---

## [Saving extra values during DifferentialEquations solution only at specific times](https://discourse.julialang.org/t/saving-extra-values-during-differentialequations-solution-only-at-specific-times/89586)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 1\
**Last updated:** [November 1, 2022, 9:11am UTC](https://discourse.julialang.org/t/saving-extra-values-during-differentialequations-solution-only-at-specific-times/89586 "2022-11-01T09:11:29Z")

</div>

I have a problem where I want to solve some extra parameters produced while solving a differential equation. For example, the following saves some random number everytime the ODE is evaluated: f = (u, p, t) -\> (a = rand…

---

## [Recommended way to set up global buffers](https://discourse.julialang.org/t/recommended-way-to-set-up-global-buffers/89597)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 2\
**Last updated:** [November 1, 2022, 8:39am UTC](https://discourse.julialang.org/t/recommended-way-to-set-up-global-buffers/89597 "2022-11-01T08:39:54Z")

</div>

Say my package needs some global buffers to avoid allocations of many small vectors of a fixed type but with variable length (with benchmark results showing that this gives indeed a nice speedup). This could look as foll…

---

## [Parsing a Julia file](https://discourse.julialang.org/t/parsing-a-julia-file/32622)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 4\
**Last updated:** [November 1, 2022, 7:53am UTC](https://discourse.julialang.org/t/parsing-a-julia-file/32622 "2022-11-01T07:53:18Z")

</div>

How can I parse a .jl file into a Vector{Expr}, similar to what include does (but without executing of course). I expected Meta.parse to accept an IO, but it doesn’t.

---

## [No matching method error after using range](https://discourse.julialang.org/t/no-matching-method-error-after-using-range/89503)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 4\
**Last updated:** [November 1, 2022, 12:54am UTC](https://discourse.julialang.org/t/no-matching-method-error-after-using-range/89503 "2022-11-01T00:54:43Z")

</div>

Hello, The last line of my code returns the following error, but both appear to be matrixes. I cannot seem to figure out what is wrong? MethodError: no method matching +(::Float64, ::Matrix{Float64}) For element-wise a…

---

## [Resizing ODE integrator with matrix or VectorOfArray initial condition](https://discourse.julialang.org/t/resizing-ode-integrator-with-matrix-or-vectorofarray-initial-condition/89583)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 3\
**Last updated:** [November 1, 2022, 12:48am UTC](https://discourse.julialang.org/t/resizing-ode-integrator-with-matrix-or-vectorofarray-initial-condition/89583 "2022-11-01T00:48:05Z")

</div>

Consider the following: using OrdinaryDiffEq using ElasticArrays function sysde!(du, u, p, t) du\[:, 1\] .= rand(2) du\[:, 2\] .= rand(2) du\[:, 3\] .= rand(2) nothing end u0 = ElasticArray{Float64}(\[0.0 0.0 …

---

## [Is there a structure that combines NammedArray and DotMap functionality?](https://discourse.julialang.org/t/is-there-a-structure-that-combines-nammedarray-and-dotmap-functionality/89541)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 5\
**Last updated:** [November 1, 2022, 12:26am UTC](https://discourse.julialang.org/t/is-there-a-structure-that-combines-nammedarray-and-dotmap-functionality/89541 "2022-11-01T00:26:52Z")

</div>

x = NamedArray(\[1,2,3\],\["a","b","c"\]) x = DotMap( Dict( zip(\["a","b","c"\],\[1,2,3\]) ) ) So you could write both exp.(x) and x.b

---

## [Broadcasting and piping](https://discourse.julialang.org/t/broadcasting-and-piping/89542)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 4\
**Last updated:** [October 31, 2022, 11:22pm UTC](https://discourse.julialang.org/t/broadcasting-and-piping/89542 "2022-10-31T23:22:25Z")

</div>

The basic pipe operator allows for broacasting e.g. 1:5 .|\> exp As far as I know @chain and Lazy @\> don’t support this. You can get around this by defining. ⬅map(a,b) = map(b,a) and writing @\> 1:5 …

---

## [Maximum of matrix vector product for "large" matrices](https://discourse.julialang.org/t/maximum-of-matrix-vector-product-for-large-matrices/89229)

<div class="topic-metadata">

**Author:** [@DorianC](https://discourse.julialang.org/u/DorianC)\
**Replies:** 5\
**Last updated:** [October 31, 2022, 8:17pm UTC](https://discourse.julialang.org/t/maximum-of-matrix-vector-product-for-large-matrices/89229 "2022-10-31T20:17:06Z")

</div>

I am using MTK and noticed that when I construct an algebraic variable defined as the max of the matrix-vector product of the state vector, the results are accurate for small matrices, but go inaccurate rapidly as the ma…

---

## [Removing Juliaup on Windows](https://discourse.julialang.org/t/removing-juliaup-on-windows/89573)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 1\
**Last updated:** [October 31, 2022, 5:39pm UTC](https://discourse.julialang.org/t/removing-juliaup-on-windows/89573 "2022-10-31T17:39:34Z")

</div>

I am using Juliaup on Windows 10. Is there a method to completely remove it and the installed Julia files? I would like to start from a freshly installed base.

---

## [Bumping package version after Artifact update](https://discourse.julialang.org/t/bumping-package-version-after-artifact-update/89522)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 11\
**Last updated:** [October 31, 2022, 4:30pm UTC](https://discourse.julialang.org/t/bumping-package-version-after-artifact-update/89522 "2022-10-31T16:30:35Z")

</div>

If I update the source of the artifact (.tar.gz file in another repo) that the package depends upon, do I need to bump the package version? Or will the artifact system automatically see, that the source has changed and w…

---

## [XKCD style plots](https://discourse.julialang.org/t/xkcd-style-plots/89477)

<div class="topic-metadata">

**Author:** [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Replies:** 3\
**Last updated:** [October 31, 2022, 3:26pm UTC](https://discourse.julialang.org/t/xkcd-style-plots/89477 "2022-10-31T15:26:49Z")

</div>

I’m a frequent user of the xkcd R package which allows you to make plots like the ones you see in xkcd. Has anyone tried to make a theme like that for Makie or any other plotting package? A quick duck duck go search woul…

---

## [How to specify a transformation with multiple arguments via minilanguage](https://discourse.julialang.org/t/how-to-specify-a-transformation-with-multiple-arguments-via-minilanguage/89474)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 5\
**Last updated:** [October 31, 2022, 2:59pm UTC](https://discourse.julialang.org/t/how-to-specify-a-transformation-with-multiple-arguments-via-minilanguage/89474 "2022-10-31T14:59:20Z")

</div>

Suppose I have a DataFrame df and GroupDataFrame df = DataFrame(a=\[1,1,2,2\], b =\[3,3,4,4\]) dfg = groupby(df,:a) further suppose I have a function fun1 that takes a vector x and multiple arguments y, z. function fun1(x…

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

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