# General Usage

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

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

**Page:** 323

---

## [Please critique my FizzBuzz!](https://discourse.julialang.org/t/please-critique-my-fizzbuzz/30987)

<div class="topic-metadata">

**Author:** [@Adriel](https://discourse.julialang.org/u/Adriel)\
**Replies:** 17\
**Last updated:** [November 16, 2019, 1:56am UTC](https://discourse.julialang.org/t/please-critique-my-fizzbuzz/30987 "2019-11-16T01:56:15Z")

</div>

(For anyone needing an excuse to procrastinate.) Is this a very julian way to write this? How could it be improved? function fizzbuzz(i, ps) s = \[p.second for p in ps if p.first(i)\] |\> join return isempty(s) ? …

---

## [Ignore\_derivatives of entire module with ChainRules.jl](https://discourse.julialang.org/t/ignore-derivatives-of-entire-module-with-chainrules-jl/95341)

<div class="topic-metadata">

**Author:** [@hshackle](https://discourse.julialang.org/u/hshackle)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 4:06pm UTC](https://discourse.julialang.org/t/ignore-derivatives-of-entire-module-with-chainrules-jl/95341 "2023-02-28T16:06:33Z")

</div>

I’m trying to get reverse differentiation up and running on some simulations. Central to the code is a module that does a lot of array manipulation and bit shifting, which are things that Zygote.jl will complain about. N…

---

## [Errors when using sysimage with Makie master](https://discourse.julialang.org/t/errors-when-using-sysimage-with-makie-master/95132)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 2\
**Last updated:** [February 28, 2023, 4:01pm UTC](https://discourse.julialang.org/t/errors-when-using-sysimage-with-makie-master/95132 "2023-02-28T16:01:20Z")

</div>

I’m trying to stay on the bleeding edge with Makie master, yet minimize my TTFP. I’m creating a sysimage with basically the following (the Pkg.activate(temp=true) is an attempt to make this as reproducible as possible): …

---

## [Writing with NPZ](https://discourse.julialang.org/t/writing-with-npz/95340)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 3:33pm UTC](https://discourse.julialang.org/t/writing-with-npz/95340 "2023-02-28T15:33:54Z")

</div>

I am trying to write a dictionary element that is a list of lists of Float64. Here is my MWE: import NPZ d = Dict{String, Vector{Vector{Float64}}}("tdnn" =\> \[\]) push!(d\["tdnn"\], \[1.,2.,3.\]) push!(d\["tdnn"\], \[4.,2.,3.\]…

---

## [Joinpath fails on splitdrive output](https://discourse.julialang.org/t/joinpath-fails-on-splitdrive-output/95328)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 4\
**Last updated:** [February 28, 2023, 1:46pm UTC](https://discourse.julialang.org/t/joinpath-fails-on-splitdrive-output/95328 "2023-02-28T13:46:44Z")

</div>

I would have expected joinpath(splitdrive(pwd())) == pwd(). On Julia 1.8.5 julia\> pwd() "C:\\\\Users\\\\mzaffalon" julia\> joinpath(splitdrive(pwd())) "\\\\Users\\\\mzaffalon" julia\> joinpath(splitpath(pwd())) == pwd() true I…

---

## [Does GeometryBasics work with SVectors?](https://discourse.julialang.org/t/does-geometrybasics-work-with-svectors/95327)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 1:19pm UTC](https://discourse.julialang.org/t/does-geometrybasics-work-with-svectors/95327 "2023-02-28T13:19:06Z")

</div>

I tried to construct a rectangle from boundary points but it doesn’t seem to recognize SVectors.

---

## [Computing Symbolic Integral with SymPy](https://discourse.julialang.org/t/computing-symbolic-integral-with-sympy/95307)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [February 28, 2023, 12:36pm UTC](https://discourse.julialang.org/t/computing-symbolic-integral-with-sympy/95307 "2023-02-28T12:36:33Z")

</div>

Hi all, I just want to know why the solution in the manual for number 17 and 18 are different with the one I computed with Julia? using SymPy @syms x, v, z, t v1(v) = (6v+9)/(3v^2 + 9v) v2(z) = z/(2z^2 + 8) v3(x) = …

---

## [DateTime: Time division](https://discourse.julialang.org/t/datetime-time-division/95285)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 9\
**Last updated:** [February 28, 2023, 11:36am UTC](https://discourse.julialang.org/t/datetime-time-division/95285 "2023-02-28T11:36:03Z")

</div>

I was wondering how division works on time intervals. My naïve thought doesn’t work using Dates hr = Dates.Hour(1) t1 = DateTime(2023, 1, 3) r = 7.4 t2 = t1 + hr/r # -\>InexactError: Int64(0.13513513513513511) The foll…

---

## [Building OpenBLAS for PowerPC Defaults to Power8](https://discourse.julialang.org/t/building-openblas-for-powerpc-defaults-to-power8/93972)

<div class="topic-metadata">

**Author:** [@bmgroth](https://discourse.julialang.org/u/bmgroth)\
**Replies:** 10\
**Last updated:** [February 28, 2023, 10:21am UTC](https://discourse.julialang.org/t/building-openblas-for-powerpc-defaults-to-power8/93972 "2023-02-28T10:21:26Z")

</div>

I am trying to get OpenBLAS to compile for Power10. However, it seems OpenBLAS is defaulting to Power8 compilation, which is ~2x slower than the implementation for Power10 as it has MMA support for BLAS 3 routines like …

---

## [Transformers.jl: causal mask on decoder](https://discourse.julialang.org/t/transformers-jl-causal-mask-on-decoder/95212)

<div class="topic-metadata">

**Author:** [@Rrdd](https://discourse.julialang.org/u/Rrdd)\
**Replies:** 4\
**Last updated:** [February 28, 2023, 7:16am UTC](https://discourse.julialang.org/t/transformers-jl-causal-mask-on-decoder/95212 "2023-02-28T07:16:22Z")

</div>

hi, I am new to Transformers.jl and try to follow the tutorial (Tutorial · Transformers.jl). I wonder where I can find more details about this call t = decoder\_trf(e, m, attention\_mask, cross\_attention\_mask) In particu…

---

## [Why is my own simplified IO type slower than Base.IOBuffer?](https://discourse.julialang.org/t/why-is-my-own-simplified-io-type-slower-than-base-iobuffer/95308)

<div class="topic-metadata">

**Author:** [@cadaverous](https://discourse.julialang.org/u/cadaverous)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 6:35am UTC](https://discourse.julialang.org/t/why-is-my-own-simplified-io-type-slower-than-base-iobuffer/95308 "2023-02-28T06:35:09Z")

</div>

I am trying to extend Base to include an IO buffer type, similar to DevNull, which just throws away all data written to it, but keeps track of a pointer, in order to find the serialized size of an object. (as suggested i…

---

## [Performance of variants of findall](https://discourse.julialang.org/t/performance-of-variants-of-findall/31659)

<div class="topic-metadata">

**Author:** [@j2b2](https://discourse.julialang.org/u/j2b2)\
**Replies:** 15\
**Last updated:** [February 28, 2023, 6:04am UTC](https://discourse.julialang.org/t/performance-of-variants-of-findall/31659 "2023-02-28T06:04:02Z")

</div>

Here is a small session: julia\> using BenchmarkTools julia\> A = rand(100, 100) 100×100 Array{Float64,2} \[...\] julia\> @btime findall(A .\> 0.5) 39.951 μs (7 allocations: 85.06 KiB) 5077-element Array{CartesianIndex{2…

---

## [How to get Simplified variance of a random variable?](https://discourse.julialang.org/t/how-to-get-simplified-variance-of-a-random-variable/95071)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [February 28, 2023, 5:14am UTC](https://discourse.julialang.org/t/how-to-get-simplified-variance-of-a-random-variable/95071 "2023-02-28T05:14:53Z")

</div>

Hi all, I want to use Julia to get the end result like this: the Expectation of (X - \\mu)^{2} will be computed at the end to become: E(X^{2}) - \\mu^{2} but how? this is my try out: using SymPy # https://docs.symp…

---

## [Failed: Error validating submit job request](https://discourse.julialang.org/t/failed-error-validating-submit-job-request/95216)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 4:38am UTC](https://discourse.julialang.org/t/failed-error-validating-submit-job-request/95216 "2023-02-28T04:38:49Z")

</div>

I want to run Pluto notebook on JULIAHUB but on clicking Start it shows Failed: Error validating submit job request What should i do ? I have already added Credit card in payments section.

---

## [Where is the \`pdf\` function in Distribution.jl implemented?](https://discourse.julialang.org/t/where-is-the-pdf-function-in-distribution-jl-implemented/23896)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 6\
**Last updated:** [February 28, 2023, 4:38am UTC](https://discourse.julialang.org/t/where-is-the-pdf-function-in-distribution-jl-implemented/23896 "2023-02-28T04:38:13Z")

</div>

Hello Julia community, julia\> pdf(Normal(), 0.3) 0.38138781546052414 I want to know how the pdf function is implemented, but the source code for Distribution.jl tells me nothing (in fact it looks like an infinite loop)…

---

## [Method Error? objects of type Vector{Float64} are not callable Use square brackets \[\] for indexing an Array](https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305)

<div class="topic-metadata">

**Author:** [@Andrew\_S1](https://discourse.julialang.org/u/Andrew_S1)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 4:03am UTC](https://discourse.julialang.org/t/method-error-objects-of-type-vector-float64-are-not-callable-use-square-brackets-for-indexing-an-array/95305 "2023-02-28T04:03:43Z")

</div>

I am writing a function for the Runge-Kutta method (Rk4) and when I try to put values into the equation I get a method error. function explicit\_rk4(f::Function, yo::Vector, t\_final::Real, N::Int) t=range(0, t\_final, N+…

---

## [\`let x\` without assignment (\`let x = 1\`)](https://discourse.julialang.org/t/let-x-without-assignment-let-x-1/95297)

<div class="topic-metadata">

**Author:** [@maxchendt](https://discourse.julialang.org/u/maxchendt)\
**Replies:** 1\
**Last updated:** [February 28, 2023, 1:34am UTC](https://discourse.julialang.org/t/let-x-without-assignment-let-x-1/95297 "2023-02-28T01:34:01Z")

</div>

Example from Let Blocks var1 = let x display(@isdefined x) #false for i in 1:5 (i == 4) && (x = i; break) end x end we see that x is undefined before the a…

---

## [PartitionedArrays and DifferentialEquations](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853)

<div class="topic-metadata">

**Author:** [@bmxam](https://discourse.julialang.org/u/bmxam)\
**Replies:** 3\
**Last updated:** [February 27, 2023, 10:02pm UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853 "2023-02-27T22:02:27Z")

</div>

Hi everyone, Are there any example combining DifferentialEquations and PartitionedArrays? Of course I’ve tried myself, but I’ve encountered obstacles because DifferentialEquations implies explicit indexing a\[i\] while P…

---

## [Multiplication, sum and Cholesky decomposition of sparse matrices](https://discourse.julialang.org/t/multiplication-sum-and-cholesky-decomposition-of-sparse-matrices/95196)

<div class="topic-metadata">

**Author:** [@andresdrenik](https://discourse.julialang.org/u/andresdrenik)\
**Replies:** 4\
**Last updated:** [February 27, 2023, 8:10pm UTC](https://discourse.julialang.org/t/multiplication-sum-and-cholesky-decomposition-of-sparse-matrices/95196 "2023-02-27T20:10:38Z")

</div>

I’m trying to solve a system of differential equations involving variational inequalities. I’m currently using the LCP solver in LCPsolve.jl. I’ve profiled my code and found that the bottleneck is in lines 216-219 here. …

---

## [How to guarantee that using @Threads/@tspawnat will create threads that work on different Cores?](https://discourse.julialang.org/t/how-to-guarantee-that-using-threads-tspawnat-will-create-threads-that-work-on-different-cores/95280)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 18\
**Last updated:** [February 27, 2023, 6:21pm UTC](https://discourse.julialang.org/t/how-to-guarantee-that-using-threads-tspawnat-will-create-threads-that-work-on-different-cores/95280 "2023-02-27T18:21:25Z")

</div>

I am defining julia -t 2 before running my julia code which contains @Threads/@tspawnat to let some works run on the two threads. However, these two threads could be ruining on the same core and I am wondering if there …

---

## [Neo4j Connection](https://discourse.julialang.org/t/neo4j-connection/95031)

<div class="topic-metadata">

**Author:** [@SergeantMike67](https://discourse.julialang.org/u/SergeantMike67)\
**Replies:** 5\
**Last updated:** [February 27, 2023, 5:08pm UTC](https://discourse.julialang.org/t/neo4j-connection/95031 "2023-02-27T17:08:30Z")

</div>

Does anybody have experience trying to connect with a Neo4j database on a port other than the default provided for in Neo4j.jl? I can’t make heads or tails of it and Julia keeps yelling at me that I am doing it wrong, w…

---

## [Help with custom packets over raw sockets](https://discourse.julialang.org/t/help-with-custom-packets-over-raw-sockets/95205)

<div class="topic-metadata">

**Author:** [@Fragamir](https://discourse.julialang.org/u/Fragamir)\
**Replies:** 1\
**Last updated:** [February 27, 2023, 4:27pm UTC](https://discourse.julialang.org/t/help-with-custom-packets-over-raw-sockets/95205 "2023-02-27T16:27:14Z")

</div>

Hi, I’m trying to write some custom packets (That I have already created and verified they are valid) to the network, I have tried using both tap interfaces and raw sockets. I created the raw socket following this thre…

---

## [Fastest way to convert an MVector/NTuple to a different sized SVector/NTuple?](https://discourse.julialang.org/t/fastest-way-to-convert-an-mvector-ntuple-to-a-different-sized-svector-ntuple/95240)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 8\
**Last updated:** [February 27, 2023, 3:35pm UTC](https://discourse.julialang.org/t/fastest-way-to-convert-an-mvector-ntuple-to-a-different-sized-svector-ntuple/95240 "2023-02-27T15:35:35Z")

</div>

I have tried a number of things to convert an MVector to an SVector and they all result in various numbers of allocations and/or poor performance. My understanding is that an MVector is just a tuple wrapped in a struct. …

---

## [Display @code\_warntype output in docs](https://discourse.julialang.org/t/display-code-warntype-output-in-docs/95264)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 2\
**Last updated:** [February 27, 2023, 2:25pm UTC](https://discourse.julialang.org/t/display-code-warntype-output-in-docs/95264 "2023-02-27T14:25:35Z")

</div>

Hi! How would one go about displaying the output of @code\_warntype in a Documenter-generated webpage? From what I can tell, there are two obstacles: @code\_warntype prints its output in the REPL instead of returning …

---

## [A better git workflow?](https://discourse.julialang.org/t/a-better-git-workflow/95248)

<div class="topic-metadata">

**Author:** [@uje](https://discourse.julialang.org/u/uje)\
**Replies:** 3\
**Last updated:** [February 27, 2023, 10:56am UTC](https://discourse.julialang.org/t/a-better-git-workflow/95248 "2023-02-27T10:56:12Z")

</div>

Having a defined Git workflow is crucial for efficient and organized software development. As a developer working on Julia projects and other open-source projects, not having a defined workflow has been frustrating and h…

---

## [Can the threads generated by @tspawnat synchronized by channel?](https://discourse.julialang.org/t/can-the-threads-generated-by-tspawnat-synchronized-by-channel/95043)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 15\
**Last updated:** [February 27, 2023, 10:34am UTC](https://discourse.julialang.org/t/can-the-threads-generated-by-tspawnat-synchronized-by-channel/95043 "2023-02-27T10:34:11Z")

</div>

I want to use and test multi-threading with synchronization between them using channel channels as in the example MWE, in which nthreads()=3. Each thread executes for-loop and while-loop inside it. In each iteration of …

---

## [Using parametric abstract type instead of function](https://discourse.julialang.org/t/using-parametric-abstract-type-instead-of-function/95227)

<div class="topic-metadata">

**Author:** [@harsh\_kumar](https://discourse.julialang.org/u/harsh_kumar)\
**Replies:** 6\
**Last updated:** [February 27, 2023, 10:21am UTC](https://discourse.julialang.org/t/using-parametric-abstract-type-instead-of-function/95227 "2023-02-27T10:21:11Z")

</div>

I have a function that takes an arg and callable type (shown below). I need to pass additional parameter information with the function. One of the clean ways that worked with Julia, is to define an abstract type with a p…

---

## [NeuralPDE.jl: "Transfer Learning with Neural Adapter" is out of date](https://discourse.julialang.org/t/neuralpde-jl-transfer-learning-with-neural-adapter-is-out-of-date/95262)

<div class="topic-metadata">

**Author:** [@Yahia\_Fouda](https://discourse.julialang.org/u/Yahia_Fouda)\
**Replies:** 0\
**Last updated:** [February 27, 2023, 10:16am UTC](https://discourse.julialang.org/t/neuralpde-jl-transfer-learning-with-neural-adapter-is-out-of-date/95262 "2023-02-27T10:16:39Z")

</div>

I am trying to run the tutorial: https://docs.sciml.ai/NeuralPDE/stable/tutorials/neural\_adapter/, but it seems out of date as stated in the warning message. Is there any up-to-date tutorial for using NeuralPDE.neural\_…

---

## [Hosting Pluto Notebooks online](https://discourse.julialang.org/t/hosting-pluto-notebooks-online/94529)

<div class="topic-metadata">

**Author:** [@mmj](https://discourse.julialang.org/u/mmj)\
**Replies:** 11\
**Last updated:** [February 27, 2023, 9:10am UTC](https://discourse.julialang.org/t/hosting-pluto-notebooks-online/94529 "2023-02-27T09:10:52Z")

</div>

Hello. I am currently working on a Pluto notebook, and I chose to use Pluto because of the excellent interactivity it allows. I am wondering how I can make the notebook available online. I have seen online that Binder i…

---

## [PSA: Julia 1.9 Change in argument processing --](https://discourse.julialang.org/t/psa-julia-1-9-change-in-argument-processing/95253)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 0\
**Last updated:** [February 27, 2023, 7:00am UTC](https://discourse.julialang.org/t/psa-julia-1-9-change-in-argument-processing/95253 "2023-02-27T07:00:13Z")

</div>

@MilesCranmer discovered a bug in pyjulia that only manifested in Julia 1.9 due to a correction in argument processing. Suppose we have a file printargs.jl with the following content. println(ARGS) If you placed a -- …

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

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