# General Usage

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

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

**Page:** 383

---

## [How can I get the Token from the server](https://discourse.julialang.org/t/how-can-i-get-the-token-from-the-server/88840)

<div class="topic-metadata">

**Author:** [@hasanOryx](https://discourse.julialang.org/u/hasanOryx)\
**Replies:** 0\
**Last updated:** [October 17, 2022, 9:38am UTC](https://discourse.julialang.org/t/how-can-i-get-the-token-from-the-server/88840 "2022-10-17T09:38:49Z")

</div>

Working with Postman, using the configeration as shown at the screen shoot, I’m able to get the token from the server. How can I do this using Julia code?

---

## [DiffEqSensitivity.jl: Issues with ReverseDiffAdjoint sensealg](https://discourse.julialang.org/t/diffeqsensitivity-jl-issues-with-reversediffadjoint-sensealg/88774)

<div class="topic-metadata">

**Author:** [@nrontsis](https://discourse.julialang.org/u/nrontsis)\
**Replies:** 6\
**Last updated:** [October 17, 2022, 9:00am UTC](https://discourse.julialang.org/t/diffeqsensitivity-jl-issues-with-reversediffadjoint-sensealg/88774 "2022-10-17T09:00:50Z")

</div>

Hi all, I am starting out in DiffEqSensitivity, and I ran into the following issue. When computing gradients as per the following example I get StackOverFlow using ReverseDiff using OrdinaryDiffEq using DiffEqSensitivi…

---

## [Accessing attractor information using attractor mapper in DynamicalSystems.jl](https://discourse.julialang.org/t/accessing-attractor-information-using-attractor-mapper-in-dynamicalsystems-jl/88837)

<div class="topic-metadata">

**Author:** [@Lucalino](https://discourse.julialang.org/u/Lucalino)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 8:55am UTC](https://discourse.julialang.org/t/accessing-attractor-information-using-attractor-mapper-in-dynamicalsystems-jl/88837 "2022-10-17T08:55:54Z")

</div>

Hi, I am using the DynamicalSystems.jl function mapper = AttractorsViaRecurrences(ds, grid) and mapper(x0) to find a limit cycle of my dynamical system ds for some initial condition x0. Indeed, an attractor is found ( I…

---

## [Is it possible to preserve the fields and methods of a type when creating a subtype?](https://discourse.julialang.org/t/is-it-possible-to-preserve-the-fields-and-methods-of-a-type-when-creating-a-subtype/88719)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 4\
**Last updated:** [October 17, 2022, 7:50am UTC](https://discourse.julialang.org/t/is-it-possible-to-preserve-the-fields-and-methods-of-a-type-when-creating-a-subtype/88719 "2022-10-17T07:50:16Z")

</div>

Hi suppose I have a SubDataFrame A with columns A.Roll, A.Pitch, A.Yaw. Further suppose I create a new type in order to apply specific methods. struct Plane flight :: SubDataFrame end B = Plane(A) Is it possib…

---

## [DataType and Type{DataType}](https://discourse.julialang.org/t/datatype-and-type-datatype/88815)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 1\
**Last updated:** [October 17, 2022, 12:36am UTC](https://discourse.julialang.org/t/datatype-and-type-datatype/88815 "2022-10-17T00:36:58Z")

</div>

I have a confusing question so I will try to be as precise as possible in my wording. As far as I understand every value in Julia is of a single concrete type. Types themselves are also values. For example DataType is …

---

## [A family of function and its arguments as argument of other custom function](https://discourse.julialang.org/t/a-family-of-function-and-its-arguments-as-argument-of-other-custom-function/88792)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 8\
**Last updated:** [October 16, 2022, 10:49pm UTC](https://discourse.julialang.org/t/a-family-of-function-and-its-arguments-as-argument-of-other-custom-function/88792 "2022-10-16T22:49:14Z")

</div>

I am trying to define a function which one of its arguments is a class of other functions, with diverse parameters (for example, distribution functions). So, I don’t know how to pass these parameters because the paramete…

---

## [Cannot convert despite convert method being defined](https://discourse.julialang.org/t/cannot-convert-despite-convert-method-being-defined/88813)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 1\
**Last updated:** [October 16, 2022, 8:17pm UTC](https://discourse.julialang.org/t/cannot-convert-despite-convert-method-being-defined/88813 "2022-10-16T20:17:27Z")

</div>

I have the following sample code: struct Bar b:: Int64 end convert(::Type{Bar}, x::Int64) = Bar(x) struct Foo b::Bar end I execute it in the REPL. I then write f = Foo(1) I expect it to work because I have…

---

## [Can't get a transparent backgound in PlotlyJs](https://discourse.julialang.org/t/cant-get-a-transparent-backgound-in-plotlyjs/88757)

<div class="topic-metadata">

**Author:** [@1153dent](https://discourse.julialang.org/u/1153dent)\
**Replies:** 10\
**Last updated:** [October 16, 2022, 5:27pm UTC](https://discourse.julialang.org/t/cant-get-a-transparent-backgound-in-plotlyjs/88757 "2022-10-16T17:27:56Z")

</div>

trying to plot on a transparent background using PlotlyJs not having any luck. Can someone point me in the right direction please? using PlotlyJS make\_plot() = plot(scatter(x=1:10, y=rand(10)), …

---

## [Fun One Liners](https://discourse.julialang.org/t/fun-one-liners/28352)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 142\
**Last updated:** [October 16, 2022, 2:16pm UTC](https://discourse.julialang.org/t/fun-one-liners/28352 "2022-10-16T14:16:20Z")

</div>

Would it be fun to have a thread where people share really fancy one liners? I think so - I think it’d be a great way to show off some of Julia to newcomers but also share some cool code. I’ll kick the thread off with 2-…

---

## [Clarification on Setrdcache in Turing?](https://discourse.julialang.org/t/clarification-on-setrdcache-in-turing/88767)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 7\
**Last updated:** [October 16, 2022, 2:20pm UTC](https://discourse.julialang.org/t/clarification-on-setrdcache-in-turing/88767 "2022-10-16T14:20:53Z")

</div>

So, https://turing.ml/dev/docs/using-turing/autodiff says: However, note that the use of caching in certain types of models can lead to incorrect results and/or errors. Models for which the compiled tape can be safely …

---

## [Check Structural Identifiability with some fixed parameters](https://discourse.julialang.org/t/check-structural-identifiability-with-some-fixed-parameters/88782)

<div class="topic-metadata">

**Author:** [@mehdi\_lotfi](https://discourse.julialang.org/u/mehdi_lotfi)\
**Replies:** 3\
**Last updated:** [October 16, 2022, 11:49am UTC](https://discourse.julialang.org/t/check-structural-identifiability-with-some-fixed-parameters/88782 "2022-10-16T11:49:35Z")

</div>

I am using StructuralIdentifiability.jl package to check the Identifiability of ODE by fixing some model parameters. The model includes 7 variable states and 22 parameters of which 12 of those are fixed. (I defined fixed…

---

## [Free last part of a vector](https://discourse.julialang.org/t/free-last-part-of-a-vector/88793)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 1\
**Last updated:** [October 16, 2022, 5:48am UTC](https://discourse.julialang.org/t/free-last-part-of-a-vector/88793 "2022-10-16T05:48:13Z")

</div>

I have allocated a long vector, and filled it to nearly the end. I don’t need the last few, remaining elements. That memory can be freed. Is there a way to ‘chop off’ the last part of the vector – without creating a vi…

---

## [What's behind the scenes of the view (...) function?](https://discourse.julialang.org/t/whats-behind-the-scenes-of-the-view-function/88780)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 4\
**Last updated:** [October 16, 2022, 5:38am UTC](https://discourse.julialang.org/t/whats-behind-the-scenes-of-the-view-function/88780 "2022-10-16T05:38:55Z")

</div>

Since to (almost. Which not?) All the effects the following two assignments are equivalent, why, since view is faster and cheaper, is not \[ \] (ie getindex) defined in the same way? a=\[1,2,3\] b=a\[1:2\] b=view(a, 1:2) If …

---

## [Import same module as two independent identities](https://discourse.julialang.org/t/import-same-module-as-two-independent-identities/88132)

<div class="topic-metadata">

**Author:** [@DerongXu](https://discourse.julialang.org/u/DerongXu)\
**Replies:** 4\
**Last updated:** [October 16, 2022, 2:16am UTC](https://discourse.julialang.org/t/import-same-module-as-two-independent-identities/88132 "2022-10-16T02:16:31Z")

</div>

Suppose I have a module module A x=1 function set(y) global x x=y end end Is there a way to import A twice, so that I have two different variables A.x as following import A as A1 #A1.x=41 A1.set(41) import …

---

## [How to define a function with more than one optional arguments in Julia?](https://discourse.julialang.org/t/how-to-define-a-function-with-more-than-one-optional-arguments-in-julia/88784)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 13\
**Last updated:** [October 15, 2022, 11:41pm UTC](https://discourse.julialang.org/t/how-to-define-a-function-with-more-than-one-optional-arguments-in-julia/88784 "2022-10-15T23:41:30Z")

</div>

I am trying to understand the mechanism to define functions in Julia. For example function xyzpos(x, y, z=0) println("$x, $y, $z") end Note that xyzpos(1,2) \> 1, 2, 0 and xyzpos(1,2,z=3) \> 1, 2, 3 Up to here, …

---

## [Getting a specific item from a Set](https://discourse.julialang.org/t/getting-a-specific-item-from-a-set/88786)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 7\
**Last updated:** [October 15, 2022, 11:06pm UTC](https://discourse.julialang.org/t/getting-a-specific-item-from-a-set/88786 "2022-10-15T23:06:55Z")

</div>

Hi, I have a set filled with custom objects. How can I get a specific item from the set equal to another object? For example, I have a set of points. Then, I add a new point pp1. If pp1 already exists in the set, I wa…

---

## [Random math function](https://discourse.julialang.org/t/random-math-function/88689)

<div class="topic-metadata">

**Author:** [@qwerty](https://discourse.julialang.org/u/qwerty)\
**Replies:** 5\
**Last updated:** [October 15, 2022, 10:32pm UTC](https://discourse.julialang.org/t/random-math-function/88689 "2022-10-15T22:32:36Z")

</div>

Is there a Pkg that allows generating random mathematical functions from operators and constants or Symbols?

---

## [Is it possible to prefetch memory in Julia?](https://discourse.julialang.org/t/is-it-possible-to-prefetch-memory-in-julia/65566)

<div class="topic-metadata">

**Author:** [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Replies:** 13\
**Last updated:** [October 15, 2022, 9:54pm UTC](https://discourse.julialang.org/t/is-it-possible-to-prefetch-memory-in-julia/65566 "2022-10-15T21:54:14Z")

</div>

The title says it all! The only references I can find online are 5 years old and don’t work on Julia v1

---

## [Does a \`filterfirst\` or \`filtersingle\` function exist? Similar to c# Single()?](https://discourse.julialang.org/t/does-a-filterfirst-or-filtersingle-function-exist-similar-to-c-single/88690)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 16\
**Last updated:** [October 15, 2022, 8:09pm UTC](https://discourse.julialang.org/t/does-a-filterfirst-or-filtersingle-function-exist-similar-to-c-single/88690 "2022-10-15T20:09:25Z")

</div>

I’m wondering if the following functions already exist in Julia with another name? I’m often trying to grab a single element, so I find myself writing filter(...) -\> first a lot, but this is not safe because if the filt…

---

## [Hash of Dict with custom type as keys](https://discourse.julialang.org/t/hash-of-dict-with-custom-type-as-keys/68400)

<div class="topic-metadata">

**Author:** [@Adrien](https://discourse.julialang.org/u/Adrien)\
**Replies:** 4\
**Last updated:** [September 20, 2021, 2:36am UTC](https://discourse.julialang.org/t/hash-of-dict-with-custom-type-as-keys/68400 "2021-09-20T02:36:09Z")

</div>

I’m having an issue when trying to use hashes of Dict with custom type as keys. Here’s a minimal example that shows my problem: struct My x::Vector{Int} end Base.hash(m::My)=Base.hash(m.x) Base.:(==)(m::My,n::My)=m.x=…

---

## [Memory Allocation on Views for Arrays](https://discourse.julialang.org/t/memory-allocation-on-views-for-arrays/70887)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 5\
**Last updated:** [October 15, 2022, 2:14pm UTC](https://discourse.julialang.org/t/memory-allocation-on-views-for-arrays/70887 "2022-10-15T14:14:43Z")

</div>

Hi there, I would like to make a function that returns a view on an an 2-dimensional array. The view would change based on if the array has more rows and columns. MWE: using BenchmarkTools data1 = randn(100, 2) data2 =…

---

## [Is it possible to convert WebIO to a html file?](https://discourse.julialang.org/t/is-it-possible-to-convert-webio-to-a-html-file/88778)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 0\
**Last updated:** [October 15, 2022, 1:21pm UTC](https://discourse.julialang.org/t/is-it-possible-to-convert-webio-to-a-html-file/88778 "2022-10-15T13:21:55Z")

</div>

I’m trying to find ways of getting around vscode jupyter not supporting WebIO.jl. The idea is that iframes display just fine in the notebook so I’m trying to find a way to display something from say Interact.jl inside a…

---

## [Assigning struct to multiple variables](https://discourse.julialang.org/t/assigning-struct-to-multiple-variables/88763)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 6\
**Last updated:** [October 15, 2022, 12:33pm UTC](https://discourse.julialang.org/t/assigning-struct-to-multiple-variables/88763 "2022-10-15T12:33:20Z")

</div>

I would like to export a struct to variables. Say I have the following struct struct point x::Float64 y::Float64 end and I use it to define a point A=point(3.0,4.0) Is there a concise way to extract the…

---

## [Convert float to string with given decimal points](https://discourse.julialang.org/t/convert-float-to-string-with-given-decimal-points/88775)

<div class="topic-metadata">

**Author:** [@lieskjur](https://discourse.julialang.org/u/lieskjur)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 12:21pm UTC](https://discourse.julialang.org/t/convert-float-to-string-with-given-decimal-points/88775 "2022-10-15T12:21:05Z")

</div>

I am making some animations with the @animate macro and would like to display time in the title. Right now I am using string(round(t,digits=2)) but whenever the converted number has less than two decimals the text gets …

---

## [Tagbot unexpected internal error](https://discourse.julialang.org/t/tagbot-unexpected-internal-error/74680)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 10:29am UTC](https://discourse.julialang.org/t/tagbot-unexpected-internal-error/74680 "2022-10-15T10:29:13Z")

</div>

For some reason, tagbot is not working. Here is the error: Error: TagBot experienced an unexpected internal failure Traceback (most recent call last): File "/root/tagbot/action/\_\_main\_\_.py", line 94, in \<module\> r…

---

## [Eror UndefVarError: plot not defined](https://discourse.julialang.org/t/eror-undefvarerror-plot-not-defined/24936)

<div class="topic-metadata">

**Author:** [@math](https://discourse.julialang.org/u/math)\
**Replies:** 17\
**Last updated:** [October 15, 2022, 9:40am UTC](https://discourse.julialang.org/t/eror-undefvarerror-plot-not-defined/24936 "2022-10-15T09:40:36Z")

</div>

I am getting this error: UndefVarError: plot not defined Here is my code: # Packages using Pkg #using Plots using DifferentialEquations using PyPlot # Parameters i = 1.25 # 0.089;%nutrient input HG 4.5 gram per 4 day…

---

## [Best practices for error trapping and exception handling in Julia as of mid 2022](https://discourse.julialang.org/t/best-practices-for-error-trapping-and-exception-handling-in-julia-as-of-mid-2022/88754)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 4\
**Last updated:** [October 15, 2022, 6:53am UTC](https://discourse.julialang.org/t/best-practices-for-error-trapping-and-exception-handling-in-julia-as-of-mid-2022/88754 "2022-10-15T06:53:52Z")

</div>

Hey folks. I was trying to identify some best practices around error trapping or exception handling in Julia as of today, or at least mid-2022. I have found a bunch of blog posts on exception handling in Julia, for examp…

---

## [@spawn large memory allocation reduced when some code abstracted out in a function](https://discourse.julialang.org/t/spawn-large-memory-allocation-reduced-when-some-code-abstracted-out-in-a-function/88691)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 6\
**Last updated:** [October 15, 2022, 6:24am UTC](https://discourse.julialang.org/t/spawn-large-memory-allocation-reduced-when-some-code-abstracted-out-in-a-function/88691 "2022-10-15T06:24:38Z")

</div>

In another discussion, bizarre behavior that requires further attention and explanation came up. A recursive textbook implementation of quicksort makes no memory allocations as it modifies its argument input vector. H…

---

## [Why Makie's default color cycle not defined in ColorSchemes.jl?](https://discourse.julialang.org/t/why-makies-default-color-cycle-not-defined-in-colorschemes-jl/88711)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 3\
**Last updated:** [October 15, 2022, 6:14am UTC](https://discourse.julialang.org/t/why-makies-default-color-cycle-not-defined-in-colorschemes-jl/88711 "2022-10-15T06:14:35Z")

</div>

I notice here that the default color cycle is based on colors produced by wong\_colors, which is not available in ColorSchemes.jl. As pointed in this post, it is quite similar to ColorSchemes.seaborn\_colorblind6. Why not…

---

## [Developing a module the Julian way such that its functions are visible during development](https://discourse.julialang.org/t/developing-a-module-the-julian-way-such-that-its-functions-are-visible-during-development/88497)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 18\
**Last updated:** [October 15, 2022, 12:13am UTC](https://discourse.julialang.org/t/developing-a-module-the-julian-way-such-that-its-functions-are-visible-during-development/88497 "2022-10-15T00:13:26Z")

</div>

I’m writing a Julia package that contains one module. The module includes many source files and functions. I want to develop new functions in the module without having to export every required function within the module …

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

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