# General Usage

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

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

**Page:** 581

---

## [Is there a maximum(f, op, itrs...) in Julia?](https://discourse.julialang.org/t/is-there-a-maximum-f-op-itrs-in-julia/63868)

<div class="topic-metadata">

**Author:** [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Replies:** 14\
**Last updated:** [July 2, 2021, 7:36am UTC](https://discourse.julialang.org/t/is-there-a-maximum-f-op-itrs-in-julia/63868 "2021-07-02T07:36:18Z")

</div>

Sometimes I see the following pattern in code. How can I write this in a more-efficient/elegant way? Without writing explicit loops, of course. a = rand(5,5); b = rand(5,5); delta = maximum(abs, i-j for (i,j) in zip(a,b…

---

## [Diagnose to\_vertices(::Vector{Float64})](https://discourse.julialang.org/t/diagnose-to-vertices-vector-float64/63636)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [July 2, 2021, 4:48am UTC](https://discourse.julialang.org/t/diagnose-to-vertices-vector-float64/63636 "2021-07-02T04:48:59Z")

</div>

I don’t really know what’s going on here, are there any tips for diagnosing it? (I don’t have a reproducible example so I won’t be surprised if there’s nothing to say …) julia\> draw(layers) ERROR: MethodError: no metho…

---

## [How to run a @example block and get the result inside a docstring?](https://discourse.julialang.org/t/how-to-run-a-example-block-and-get-the-result-inside-a-docstring/63922)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 2\
**Last updated:** [July 2, 2021, 3:54am UTC](https://discourse.julialang.org/t/how-to-run-a-example-block-and-get-the-result-inside-a-docstring/63922 "2021-07-02T03:54:35Z")

</div>

Currently, I am using DocStringExtensions and the abbreviations, e.g. $SIGNATURES, are helping me a lot by generating information inside the docstrings. I was expecting something similar with Documenter and the @example …

---

## [Best way to host a julia webapp?](https://discourse.julialang.org/t/best-way-to-host-a-julia-webapp/55719)

<div class="topic-metadata">

**Author:** [@Jojo\_Dad](https://discourse.julialang.org/u/Jojo_Dad)\
**Replies:** 3\
**Last updated:** [July 1, 2021, 10:00pm UTC](https://discourse.julialang.org/t/best-way-to-host-a-julia-webapp/55719 "2021-07-01T22:00:35Z")

</div>

I want to host a Julia webapp. But I would like to avoid having to use my own server on the Web. Are there commercial Website hosting services for Julia-based applications?

---

## [Dash.jl send\_file or send\_data\_frame](https://discourse.julialang.org/t/dash-jl-send-file-or-send-data-frame/63499)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 1\
**Last updated:** [July 1, 2021, 9:58pm UTC](https://discourse.julialang.org/t/dash-jl-send-file-or-send-data-frame/63499 "2021-07-01T21:58:56Z")

</div>

I am working with Dash and want to provide a link to download a file (e.g. a CSV). I can see that dash supports the following, but I could not find any of these functions in DashCoreComponents for Julia. Am I missing a…

---

## [Could the Profile.print() tree view sort in the other order?](https://discourse.julialang.org/t/could-the-profile-print-tree-view-sort-in-the-other-order/63881)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 1\
**Last updated:** [July 1, 2021, 10:59am UTC](https://discourse.julialang.org/t/could-the-profile-print-tree-view-sort-in-the-other-order/63881 "2021-07-01T10:59:43Z")

</div>

Hi, I’m aware there are other ways of viewing profile output, but Profile.print() is pretty handy in a pinch. It would be even handier if the tree was sorted by count. The docs say that sortedby “Controls the order in…

---

## [Incompatible changes in Pkg?](https://discourse.julialang.org/t/incompatible-changes-in-pkg/51326)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 17\
**Last updated:** [July 1, 2021, 8:13pm UTC](https://discourse.julialang.org/t/incompatible-changes-in-pkg/51326 "2021-07-01T20:13:44Z")

</div>

I am getting some new errors. With 1.5.3. Current folder: C:\\Users\\PetrKrysl\\Documents\\work\\FinEtoolsTestAll.jl\\tests\\FinEtools.jl …

---

## [Is it good practice to have a variable binding change type in Julia programming?](https://discourse.julialang.org/t/is-it-good-practice-to-have-a-variable-binding-change-type-in-julia-programming/63896)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 6\
**Last updated:** [July 1, 2021, 3:06pm UTC](https://discourse.julialang.org/t/is-it-good-practice-to-have-a-variable-binding-change-type-in-julia-programming/63896 "2021-07-01T15:06:13Z")

</div>

Is the following good practice and why? x = \[rand(3,3) for i in 1:10\] x = sum(x) The first assignment binds x to Array{Matrix} and the second to Matrix. The type of the object x is bind to changes in the code. Code is …

---

## [Type stability / tuple lengths](https://discourse.julialang.org/t/type-stability-tuple-lengths/63867)

<div class="topic-metadata">

**Author:** [@nchisholm](https://discourse.julialang.org/u/nchisholm)\
**Replies:** 2\
**Last updated:** [July 1, 2021, 2:46pm UTC](https://discourse.julialang.org/t/type-stability-tuple-lengths/63867 "2021-07-01T14:46:41Z")

</div>

Consider the following function that, given a tuple t, computes partial products of the elements specified by a second tuple parts as follows function partialprods(t::NTuple{N,Int}, parts::NTuple{M,Int}) where {N,M} …

---

## [Feedback on how to make this bit of code more Julian](https://discourse.julialang.org/t/feedback-on-how-to-make-this-bit-of-code-more-julian/63888)

<div class="topic-metadata">

**Author:** [@Roland\_Guichard](https://discourse.julialang.org/u/Roland_Guichard)\
**Replies:** 9\
**Last updated:** [July 1, 2021, 2:46pm UTC](https://discourse.julialang.org/t/feedback-on-how-to-make-this-bit-of-code-more-julian/63888 "2021-07-01T14:46:06Z")

</div>

Hello there, I am relatively new to Julia but I have developed this piece of code (I haven’t posted the full code yet) that is working as intended. However, I’d really appreciate feedbacks on how to improve it and make …

---

## [Data Preparation for TGS Salt Identification](https://discourse.julialang.org/t/data-preparation-for-tgs-salt-identification/63893)

<div class="topic-metadata">

**Author:** [@Paritosh\_Kr](https://discourse.julialang.org/u/Paritosh_Kr)\
**Replies:** 0\
**Last updated:** [July 1, 2021, 2:19pm UTC](https://discourse.julialang.org/t/data-preparation-for-tgs-salt-identification/63893 "2021-07-01T14:19:22Z")

</div>

I am writing a Unet in Flux.jl for TGS Salt identification challenge . The data is organised as follows:- data/train/images - contains (101x101x3) training images data/train/masks - contains (101x101x1) training mask…

---

## [Which keyword could I plot color on triangle mesh using mesh3d in Plots with plotlyjs backend?](https://discourse.julialang.org/t/which-keyword-could-i-plot-color-on-triangle-mesh-using-mesh3d-in-plots-with-plotlyjs-backend/63887)

<div class="topic-metadata">

**Author:** [@deltaeecs](https://discourse.julialang.org/u/deltaeecs)\
**Replies:** 0\
**Last updated:** [July 1, 2021, 1:07pm UTC](https://discourse.julialang.org/t/which-keyword-could-i-plot-color-on-triangle-mesh-using-mesh3d-in-plots-with-plotlyjs-backend/63887 "2021-07-01T13:07:48Z")

</div>

In PlotlyJS package, intensity is used to set the color on triangles or vertexes in mesh3d function. Is there any way to do the same thing in Plots with plotlyjs backend?

---

## [Why can't I use \`{}\` in a default function definition? Seems like a bug](https://discourse.julialang.org/t/why-cant-i-use-in-a-default-function-definition-seems-like-a-bug/63092)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 12\
**Last updated:** [July 1, 2021, 12:55pm UTC](https://discourse.julialang.org/t/why-cant-i-use-in-a-default-function-definition-seems-like-a-bug/63092 "2021-07-01T12:55:37Z")

</div>

Hi all :slight\_smile: julia\> f(g = function(::Dict) end) = g f (generic function with 2 methods) julia\> f(g = function(::Dict{}) end) = g ERROR: syntax: expected "(" in function definition Stacktrace: \[1\] top-level sc…

---

## [Speed of Julia vs. Fortran and other languages](https://discourse.julialang.org/t/speed-of-julia-vs-fortran-and-other-languages/63850)

<div class="topic-metadata">

**Author:** [@Beliavsky](https://discourse.julialang.org/u/Beliavsky)\
**Replies:** 6\
**Last updated:** [July 1, 2021, 12:54pm UTC](https://discourse.julialang.org/t/speed-of-julia-vs-fortran-and-other-languages/63850 "2021-07-01T12:54:37Z")

</div>

The Benchmarks category of Fortran code on GitHub lists many benchmarks where Julia is considered, listed below. I will not make any generalizations about the results. Assessment of Programming Languages for Computation…

---

## [Why is this raytracer slow?](https://discourse.julialang.org/t/why-is-this-raytracer-slow/59176)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 29\
**Last updated:** [May 5, 2021, 3:11pm UTC](https://discourse.julialang.org/t/why-is-this-raytracer-slow/59176 "2021-05-05T15:11:17Z")

</div>

I bumped into this repo. https://github.com/edin/raytracer It compares implementations in different languages. I’m surprised that julia is more than 5 times slower than C. The code seems idiomatic. Does anyone have s…

---

## [Is there a readymade Array Type that stores data as Run-length-encoding of delta?](https://discourse.julialang.org/t/is-there-a-readymade-array-type-that-stores-data-as-run-length-encoding-of-delta/63793)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 9\
**Last updated:** [July 1, 2021, 7:34am UTC](https://discourse.julialang.org/t/is-there-a-readymade-array-type-that-stores-data-as-run-length-encoding-of-delta/63793 "2021-07-01T07:34:12Z")

</div>

I wonder in Julia, is there a ready-made array type that stores data internally as run-length-encoded deltas? E.g. This is literally a question from a colleague working in Python. I am not sharing any secrets as it’s j…

---

## [Substring replacement](https://discourse.julialang.org/t/substring-replacement/63794)

<div class="topic-metadata">

**Author:** [@dpkwhan](https://discourse.julialang.org/u/dpkwhan)\
**Replies:** 6\
**Last updated:** [June 30, 2021, 10:35pm UTC](https://discourse.julialang.org/t/substring-replacement/63794 "2021-06-30T22:35:31Z")

</div>

Why does the following not work? replace("2021-06-29T23:14:20", "-" =\> "", ":" =\> "")

---

## [Parse, don't validate](https://discourse.julialang.org/t/parse-dont-validate/63618)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 10\
**Last updated:** [June 30, 2021, 7:36pm UTC](https://discourse.julialang.org/t/parse-dont-validate/63618 "2021-06-30T19:36:28Z")

</div>

The Parse, don’t validate blog post came by on Hacker News again. As far as I understand, this is advertising to use type checking instead of checking the object each time. Are there valuable lessons to be learned in thi…

---

## [How to estimate Jaccard similarity/distances with MinHash.jl](https://discourse.julialang.org/t/how-to-estimate-jaccard-similarity-distances-with-minhash-jl/63843)

<div class="topic-metadata">

**Author:** [@rohan.m](https://discourse.julialang.org/u/rohan.m)\
**Replies:** 3\
**Last updated:** [June 30, 2021, 7:24pm UTC](https://discourse.julialang.org/t/how-to-estimate-jaccard-similarity-distances-with-minhash-jl/63843 "2021-06-30T19:24:55Z")

</div>

Hello, I want to rapidly estimate a distance matrix using Jaccard distance (1 - Jaccard similarity) for a large binary matrix (rows are genomes, columns are genes found in common across genomes). MinHash seems like the …

---

## [Unable to add package Oceananigans.jl](https://discourse.julialang.org/t/unable-to-add-package-oceananigans-jl/63827)

<div class="topic-metadata">

**Author:** [@SUMAN\_SHEKHAR](https://discourse.julialang.org/u/SUMAN_SHEKHAR)\
**Replies:** 4\
**Last updated:** [June 30, 2021, 4:19pm UTC](https://discourse.julialang.org/t/unable-to-add-package-oceananigans-jl/63827 "2021-06-30T16:19:01Z")

</div>

I have Julia v1.6.1 and I have tried to add Oceananigans package inside it but I am getting git errors that I am unable to crack. Here is the full error message- julia\> using Pkg julia\> Pkg.add("Oceananigans"); Pkg.sta…

---

## [Module/file/line for log message generated by a macro](https://discourse.julialang.org/t/module-file-line-for-log-message-generated-by-a-macro/63835)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [June 30, 2021, 1:40pm UTC](https://discourse.julialang.org/t/module-file-line-for-log-message-generated-by-a-macro/63835 "2021-06-30T13:40:11Z")

</div>

I have a module which exports a macro that checks something, implemented in a function, and warns if an invariant is not maintained, via @warn. I want to provide correct location information, but can’t figure it out: eg…

---

## [Multithreading in LoopVectorization.jl](https://discourse.julialang.org/t/multithreading-in-loopvectorization-jl/63815)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 8\
**Last updated:** [June 30, 2021, 1:19pm UTC](https://discourse.julialang.org/t/multithreading-in-loopvectorization-jl/63815 "2021-06-30T13:19:41Z")

</div>

I would like to give LoopVectorization.jl a try. As far as I understand, to speed up a computation which involves Threads.@threads for loop, I need to replace the macro Threads.@threads with @tturbo. Now, I would like t…

---

## [Why is Matrix multiplication with an UpperTriangular slower than with normal Matrix?](https://discourse.julialang.org/t/why-is-matrix-multiplication-with-an-uppertriangular-slower-than-with-normal-matrix/63824)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 2\
**Last updated:** [June 30, 2021, 1:14pm UTC](https://discourse.julialang.org/t/why-is-matrix-multiplication-with-an-uppertriangular-slower-than-with-normal-matrix/63824 "2021-06-30T13:14:55Z")

</div>

Why is Matrix multiplication with an UpperTriangular slower than with normal Matrix? I would expect it to be faster: using LinearAlgebra, BenchmarkTools A = randn(60,60); B = randn(60,60); @btime $A \* $B' # 19.693 μs (…

---

## [Slow \`convert\` for arrays. Use multiple dispatch instead?](https://discourse.julialang.org/t/slow-convert-for-arrays-use-multiple-dispatch-instead/63822)

<div class="topic-metadata">

**Author:** [@manuelbb-upb](https://discourse.julialang.org/u/manuelbb-upb)\
**Replies:** 3\
**Last updated:** [June 30, 2021, 1:09pm UTC](https://discourse.julialang.org/t/slow-convert-for-arrays-use-multiple-dispatch-instead/63822 "2021-06-30T13:09:27Z")

</div>

I was wondering why something like x = rand(10) convert(Vector{Float64}, x) is relatively slow, when x does not even need to be converted. I noticed that in Julia base the convert method is defined as convert(::Type{…

---

## [Read NULL as missing in dataframe](https://discourse.julialang.org/t/read-null-as-missing-in-dataframe/63823)

<div class="topic-metadata">

**Author:** [@Ismam](https://discourse.julialang.org/u/Ismam)\
**Replies:** 1\
**Last updated:** [June 30, 2021, 12:14pm UTC](https://discourse.julialang.org/t/read-null-as-missing-in-dataframe/63823 "2021-06-30T12:14:28Z")

</div>

Hi, I’m reading a csv file (originally obtained from SQL) that has the string “NULL” to signify no value. This is not an empty string (although I am curious how that gets tackled too). How do I read this string as a mi…

---

## [How to not precompile an optional dependency?](https://discourse.julialang.org/t/how-to-not-precompile-an-optional-dependency/63807)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [June 30, 2021, 8:32am UTC](https://discourse.julialang.org/t/how-to-not-precompile-an-optional-dependency/63807 "2021-06-30T08:32:16Z")

</div>

Hi, I’m working on a project that requires a proprietary solver (Gurobi and a license) for a particular feature. I would like other users to be able to use the package even though they do not have installed gurobi on th…

---

## [Why \`Int\` instead of \`UInt\` for indexing?](https://discourse.julialang.org/t/why-int-instead-of-uint-for-indexing/63589)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 13\
**Last updated:** [June 30, 2021, 7:05am UTC](https://discourse.julialang.org/t/why-int-instead-of-uint-for-indexing/63589 "2021-06-30T07:05:40Z")

</div>

julia\> typeof(length(\[\])) Int64 It seems like length(::Vector) is always nonnegative. Why is it Int64 and not UInt32 or UInt64?

---

## [Julia Package Flux](https://discourse.julialang.org/t/julia-package-flux/63767)

<div class="topic-metadata">

**Author:** [@narayan](https://discourse.julialang.org/u/narayan)\
**Replies:** 3\
**Last updated:** [June 30, 2021, 2:46am UTC](https://discourse.julialang.org/t/julia-package-flux/63767 "2021-06-30T02:46:17Z")

</div>

using Flux f(x) = 3x + 2 df(x) = gradient(f,x)\[1\] df(2) when I am running this code, I am getting an error - LoadError: UndefVarError: gradient not defined. However, if I change gradient by Flux.gradient, it works f…

---

## [How to catch this error?](https://discourse.julialang.org/t/how-to-catch-this-error/63721)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 6\
**Last updated:** [June 30, 2021, 1:10am UTC](https://discourse.julialang.org/t/how-to-catch-this-error/63721 "2021-06-30T01:10:36Z")

</div>

I am optimizing a complicated function. That function depends on 2 variables t1 and t2. I can derive first order conditions that result in a system of 2 equations. I can also derive conditions for when t1 \< t2, t1 \> t2, …

---

## [Any benchmark comparing Julia on Windows vs Linux vs OSX?](https://discourse.julialang.org/t/any-benchmark-comparing-julia-on-windows-vs-linux-vs-osx/18394)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 7\
**Last updated:** [June 29, 2021, 8:55pm UTC](https://discourse.julialang.org/t/any-benchmark-comparing-julia-on-windows-vs-linux-vs-osx/18394 "2021-06-29T20:55:24Z")

</div>

Is there any benchmark comparing the speed and memory usage of Julia on different Operating Systems?

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

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