# General Usage

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

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

**Page:** 354

---

## [Type-Instability when calling \`fieldtypes\`](https://discourse.julialang.org/t/type-instability-when-calling-fieldtypes/91881)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 0\
**Last updated:** [December 20, 2022, 1:05am UTC](https://discourse.julialang.org/t/type-instability-when-calling-fieldtypes/91881 "2022-12-20T01:05:21Z")

</div>

Is there a way to make fieldtypes not be type-unstable here? julia\> struct Foo{A,B} a::A; b::B end julia\> ft1(o::T) where T = Tuple(T.types) ft1 (generic function with 1 method) julia\> ft2(o::T) where T = fieldtypes(T…

---

## [@which not found in my module](https://discourse.julialang.org/t/which-not-found-in-my-module/91878)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [December 20, 2022, 12:09am UTC](https://discourse.julialang.org/t/which-not-found-in-my-module/91878 "2022-12-20T00:09:37Z")

</div>

I would like to use @which from within a macro to find out where a particular function is called from. But I get a message that the macro is not found. How is this handled? Thanks.

---

## [Is it Possible to Create a Snippet / small plot inside a plot with Plots?](https://discourse.julialang.org/t/is-it-possible-to-create-a-snippet-small-plot-inside-a-plot-with-plots/91838)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 10:50pm UTC](https://discourse.julialang.org/t/is-it-possible-to-create-a-snippet-small-plot-inside-a-plot-with-plots/91838 "2022-12-19T22:50:31Z")

</div>

Hi all, I want to create a plot like this: I have the code to create the big plot (the circumscribed polygon), is it possible to crop a part and put it at designated area, like putting a legend on topleft? Then put t…

---

## [Is there a generic way to remove the unit from a number?](https://discourse.julialang.org/t/is-there-a-generic-way-to-remove-the-unit-from-a-number/33277)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 8\
**Last updated:** [December 19, 2022, 10:31pm UTC](https://discourse.julialang.org/t/is-there-a-generic-way-to-remove-the-unit-from-a-number/33277 "2022-12-19T22:31:46Z")

</div>

Is there a generic way to remove the unit from a number? Note that x / oneunit(x) sometimes doesn’t work. For instance, if you look at the Furlongs testing example defined in https://github.com/JuliaLang/julia/blob/mast…

---

## [Access docstring within a macro](https://discourse.julialang.org/t/access-docstring-within-a-macro/90362)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 5\
**Last updated:** [December 19, 2022, 9:26pm UTC](https://discourse.julialang.org/t/access-docstring-within-a-macro/90362 "2022-12-19T21:26:24Z")

</div>

Hello Is there any way to access the docstring accompanying a macro at call place? It would be something like this: macro MyMacro(arg) # Do something with my docs # It does not mean that I want to append the outer doc …

---

## [Reading HTML file for parsing](https://discourse.julialang.org/t/reading-html-file-for-parsing/91873)

<div class="topic-metadata">

**Author:** [@edas](https://discourse.julialang.org/u/edas)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 8:10pm UTC](https://discourse.julialang.org/t/reading-html-file-for-parsing/91873 "2022-12-19T20:10:20Z")

</div>

I want to read html file and then parse it (not sure if use word “parse” correctly). I saved example.com to file example.html Also using EzXML library using Cascadia, Gumbo, HTTP,AbstractTrees using EzXML r = EzXML.r…

---

## [Increase the ‘aggressiveness’ of the garbage collection?](https://discourse.julialang.org/t/increase-the-aggressiveness-of-the-garbage-collection/91750)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 9\
**Last updated:** [December 19, 2022, 6:39pm UTC](https://discourse.julialang.org/t/increase-the-aggressiveness-of-the-garbage-collection/91750 "2022-12-19T18:39:48Z")

</div>

I am working with large arrays, and repeatedly resort to calling GC.gc() manually in cases like this: A = load\_large\_array(); do\_stuff\_with\_large\_array!(A) save\_results(A) A = nothing GC.gc() A = load\_another\_large\_arr…

---

## [Julia not finding it's own artifacts](https://discourse.julialang.org/t/julia-not-finding-its-own-artifacts/91863)

<div class="topic-metadata">

**Author:** [@ndusek](https://discourse.julialang.org/u/ndusek)\
**Replies:** 3\
**Last updated:** [December 19, 2022, 5:29pm UTC](https://discourse.julialang.org/t/julia-not-finding-its-own-artifacts/91863 "2022-12-19T17:29:16Z")

</div>

I am trying to run Circuitscape using Julia (v1.7.2) via the JuliaCall package in R and am getting the following error (as reported from within R): Error: Error happens in Julia. InitError: could not load library "/home…

---

## [A comparison operator (\>, \<, ==...) as a function argument?](https://discourse.julialang.org/t/a-comparison-operator-as-a-function-argument/91858)

<div class="topic-metadata">

**Author:** [@Fred](https://discourse.julialang.org/u/Fred)\
**Replies:** 3\
**Last updated:** [December 19, 2022, 3:29pm UTC](https://discourse.julialang.org/t/a-comparison-operator-as-a-function-argument/91858 "2022-12-19T15:29:40Z")

</div>

Hi ! Is there a way to use a a comparison operator (\>, \<, ==…) as a function argument ? for example f(2,5,\>=) function compare(x,y, operator)::Bool return x operator y # 2\>=5, return false Thanks !

---

## [Is there a Julia package similar to the R package htmlwidgets?](https://discourse.julialang.org/t/is-there-a-julia-package-similar-to-the-r-package-htmlwidgets/91857)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 0\
**Last updated:** [December 19, 2022, 2:19pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-similar-to-the-r-package-htmlwidgets/91857 "2022-12-19T14:19:16Z")

</div>

Hello, The R package htmlwidgets allows to pass some R objects to a JavaScript file (with the help of JSON), and then this JavaScript file creates a HTML widget which is then rendered in a HTML file. It is often used to…

---

## [For CalculusWithJulia, is there Riemann' Midpoint method?](https://discourse.julialang.org/t/for-calculuswithjulia-is-there-riemann-midpoint-method/91001)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 10\
**Last updated:** [December 19, 2022, 1:47pm UTC](https://discourse.julialang.org/t/for-calculuswithjulia-is-there-riemann-midpoint-method/91001 "2022-12-19T13:47:34Z")

</div>

I read this: https://docs.juliahub.com/CalculusWithJulia/AZHbv/0.0.5/integrals/area.html and I want to calculate Riemann sum for several functions, comparing the Left Right Midpoint methods. Is the midpoint method a…

---

## [Symbol(String($symbol)) in quotes](https://discourse.julialang.org/t/symbol-string-symbol-in-quotes/91855)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 1:36pm UTC](https://discourse.julialang.org/t/symbol-string-symbol-in-quotes/91855 "2022-12-19T13:36:15Z")

</div>

Hi all :slight\_smile: I need the following: quote :symbol end is there a better way for doing this: julia\> symbol = :symbol :symbol julia\> quote Symbol(String($symbol)) end quote Symbol(St…

---

## [Is there a Package that can Help Us Plot a 3-Dimensional Object or just 2-D object from a JPG input?](https://discourse.julialang.org/t/is-there-a-package-that-can-help-us-plot-a-3-dimensional-object-or-just-2-d-object-from-a-jpg-input/91852)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [December 19, 2022, 1:20pm UTC](https://discourse.julialang.org/t/is-there-a-package-that-can-help-us-plot-a-3-dimensional-object-or-just-2-d-object-from-a-jpg-input/91852 "2022-12-19T13:20:28Z")

</div>

Hi all, I actually want to create a plot of this Lightning’ weapon from FF XIII. With Plots, PyPlot, GLMakie, whatever possible. Thus, with the plot if possible the 3-dimensional one (integralling the 2-D input or an…

---

## [Convert serialized objects to a newer package version](https://discourse.julialang.org/t/convert-serialized-objects-to-a-newer-package-version/91847)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 2\
**Last updated:** [December 19, 2022, 1:19pm UTC](https://discourse.julialang.org/t/convert-serialized-objects-to-a-newer-package-version/91847 "2022-12-19T13:19:15Z")

</div>

I have a file with serialized structs that were slightly changed between package versions: type parameter change & field rename. So, they can only be deserialized using the old package version. After deserializing, I’d …

---

## [Why can't some functions (CSV.File()) be precompiled?](https://discourse.julialang.org/t/why-cant-some-functions-csv-file-be-precompiled/91851)

<div class="topic-metadata">

**Author:** [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Replies:** 0\
**Last updated:** [December 19, 2022, 1:17pm UTC](https://discourse.julialang.org/t/why-cant-some-functions-csv-file-be-precompiled/91851 "2022-12-19T13:17:48Z")

</div>

Hi all! I’m using PackageCompiler to speed up my Julia initialization time. I first run the code I usually run in a session with --trace-compile=~/Julia/trace-compilation.jl, then I create the sysimage with using Pack…

---

## [Documention around Julia build](https://discourse.julialang.org/t/documention-around-julia-build/91806)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 7\
**Last updated:** [December 19, 2022, 12:26pm UTC](https://discourse.julialang.org/t/documention-around-julia-build/91806 "2022-12-19T12:26:02Z")

</div>

Hi, I was wondering if there is documentation on how Julia is built. I am not referring on how to build Juliawhich is already done here: I am thinking more about documenting what really happens when you run “make” I …

---

## [Building Julia from source](https://discourse.julialang.org/t/building-julia-from-source/91747)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 20\
**Last updated:** [December 19, 2022, 11:02am UTC](https://discourse.julialang.org/t/building-julia-from-source/91747 "2022-12-19T11:02:42Z")

</div>

Hi, I have the following questions regarding building Julia from source: 1/ Is there a way to build a “light” version of Julia, for example without the documentation or even the REPL? If yes, how? 2/ Is there an optio…

---

## [Is there something in Julia similar to the as-patterns in Haskell?](https://discourse.julialang.org/t/is-there-something-in-julia-similar-to-the-as-patterns-in-haskell/91785)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 10\
**Last updated:** [December 19, 2022, 8:45am UTC](https://discourse.julialang.org/t/is-there-something-in-julia-similar-to-the-as-patterns-in-haskell/91785 "2022-12-19T08:45:29Z")

</div>

Hello, In Haskell we can write an argument of a function as pair@(x,y). That means that pair is the pair with the two elements x and y. Is there something similar in Julia? For example if I have a list of pairs, I would…

---

## [Using GitHub.jl with GitHub Actions errors due to auth failure](https://discourse.julialang.org/t/using-github-jl-with-github-actions-errors-due-to-auth-failure/91746)

<div class="topic-metadata">

**Author:** [@logankilpatrick](https://discourse.julialang.org/u/logankilpatrick)\
**Replies:** 3\
**Last updated:** [December 19, 2022, 7:20am UTC](https://discourse.julialang.org/t/using-github-jl-with-github-actions-errors-due-to-auth-failure/91746 "2022-12-19T07:20:00Z")

</div>

Hey folks, I am trying to get a repo setup to automate sending invites to an org through GitHub.jl, everything works fine locally, but when I move it to a GitHub action, all of a sudden GitHub.jl cannot authenticate desp…

---

## [Variable accessibility within loops](https://discourse.julialang.org/t/variable-accessibility-within-loops/91830)

<div class="topic-metadata">

**Author:** [@ejlongman](https://discourse.julialang.org/u/ejlongman)\
**Replies:** 1\
**Last updated:** [December 19, 2022, 5:32am UTC](https://discourse.julialang.org/t/variable-accessibility-within-loops/91830 "2022-12-19T05:32:49Z")

</div>

Hello, The following code runs for iteration 1, printing the “mindi” variable. However, it throws an error for iteration 2. It says mindi is undefined. Why is the variable inaccessible for the second iteration? maxite…

---

## [What do you use to embed Julia code in LaTeX?](https://discourse.julialang.org/t/what-do-you-use-to-embed-julia-code-in-latex/23992)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 56\
**Last updated:** [December 18, 2022, 2:04pm UTC](https://discourse.julialang.org/t/what-do-you-use-to-embed-julia-code-in-latex/23992 "2022-12-18T14:04:37Z")

</div>

I wonder if anyone here has interesting tips or tricks for embedding Julia code in LaTeX, e.g. fancy color schemes, running code inline for presentations, automatic display of figures with captions, etc.

---

## [How to Determine or Approximate a Functions from Scatter Plots?](https://discourse.julialang.org/t/how-to-determine-or-approximate-a-functions-from-scatter-plots/91769)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 9\
**Last updated:** [December 18, 2022, 1:23pm UTC](https://discourse.julialang.org/t/how-to-determine-or-approximate-a-functions-from-scatter-plots/91769 "2022-12-18T13:23:17Z")

</div>

Hi all, I am using this code to plot a lot of data and connect the scatter plot: using Plots, LaTeXStrings, Plots.PlotMeasures gr() using Plots x = \[10/60, 20/60, 30/60, 40/60, 50/60, 60/60, 70/60, 80/60, 80/60, 90/6…

---

## [How to Plot Trapezoidal and Simpson's rule plot with given curve or function?](https://discourse.julialang.org/t/how-to-plot-trapezoidal-and-simpsons-rule-plot-with-given-curve-or-function/91767)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [December 18, 2022, 12:30pm UTC](https://discourse.julialang.org/t/how-to-plot-trapezoidal-and-simpsons-rule-plot-with-given-curve-or-function/91767 "2022-12-18T12:30:36Z")

</div>

Hi all, I want to know how to plot the partitions and the trapezoids when I have the input of the function only and the number of interval? This is the images that I want to achieve I have this code for starter, bu…

---

## [How to Make Table with Computation Result in Julia (Using DataFrames Package or similar ones)](https://discourse.julialang.org/t/how-to-make-table-with-computation-result-in-julia-using-dataframes-package-or-similar-ones/91808)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [December 18, 2022, 11:20am UTC](https://discourse.julialang.org/t/how-to-make-table-with-computation-result-in-julia-using-dataframes-package-or-similar-ones/91808 "2022-12-18T11:20:22Z")

</div>

Hi all, I have recently modify the code to calculate all methods to approximate definite integral, my question is how to create a table with the resulting computation for different partitions (4, 8, 16). This is the co…

---

## [How to constrain the type parameters for this function](https://discourse.julialang.org/t/how-to-constrain-the-type-parameters-for-this-function/91801)

<div class="topic-metadata">

**Author:** [@babaq](https://discourse.julialang.org/u/babaq)\
**Replies:** 6\
**Last updated:** [December 18, 2022, 2:36am UTC](https://discourse.julialang.org/t/how-to-constrain-the-type-parameters-for-this-function/91801 "2022-12-18T02:36:19Z")

</div>

given an example function function foo(a,b) ... end a would accept vector of real numbers, such as Vector{Int64}, Vector{Float64}, ... b should be Integer while elements of a are Integers, and Integer or Float while…

---

## [Preventing Loss of Image Quality When Using \`imresize\`?](https://discourse.julialang.org/t/preventing-loss-of-image-quality-when-using-imresize/91793)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 1\
**Last updated:** [December 17, 2022, 9:57pm UTC](https://discourse.julialang.org/t/preventing-loss-of-image-quality-when-using-imresize/91793 "2022-12-17T21:57:25Z")

</div>

Hi folks, I am trying to shrink an image using Images and Interpolations. Whenever I shrink the image, the image is very blurry or the quality is just not so great. Here is what I am doing: using Images using Interpola…

---

## [Is there any plot package that supports multithreading now?](https://discourse.julialang.org/t/is-there-any-plot-package-that-supports-multithreading-now/91787)

<div class="topic-metadata">

**Author:** [@YiboXia](https://discourse.julialang.org/u/YiboXia)\
**Replies:** 2\
**Last updated:** [December 17, 2022, 7:04pm UTC](https://discourse.julialang.org/t/is-there-any-plot-package-that-supports-multithreading-now/91787 "2022-12-17T19:04:51Z")

</div>

Hi guys! I have now parallelized all codes about computation except plotting. I am trying to find a way to boost the plotting. Is there any plot package that supports multithreading now? and I also want to know if Maki…

---

## [Error: expected equal sign after key](https://discourse.julialang.org/t/error-expected-equal-sign-after-key/91786)

<div class="topic-metadata">

**Author:** [@MarawanEmara](https://discourse.julialang.org/u/MarawanEmara)\
**Replies:** 1\
**Last updated:** [December 17, 2022, 6:01pm UTC](https://discourse.julialang.org/t/error-expected-equal-sign-after-key/91786 "2022-12-17T18:01:31Z")

</div>

Hello. I am attempting to run /test/tutorial.jl from GitHub - LouisBouvier/WarcraftShortestPaths.jl. I have done everything including the decompression of the data and activating the environment using Pkg.activate(“.”),…

---

## [Design Q: Order of arguments: input data and algorithm type](https://discourse.julialang.org/t/design-q-order-of-arguments-input-data-and-algorithm-type/91768)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 4\
**Last updated:** [December 17, 2022, 4:17pm UTC](https://discourse.julialang.org/t/design-q-order-of-arguments-input-data-and-algorithm-type/91768 "2022-12-17T16:17:34Z")

</div>

Hey all, (wasn’t sure in which category to post it) We are doing a lot of refactoring across many JuliaDynamics packages at the moment. A question that always comes up in the refactoring concerns the order of arguments…

---

## [Operators and things](https://discourse.julialang.org/t/operators-and-things/91760)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [December 17, 2022, 3:42pm UTC](https://discourse.julialang.org/t/operators-and-things/91760 "2022-12-17T15:42:04Z")

</div>

It looks like if on wants to define a new operator, the choice of the operator symbol is limited: This comes from the documentation (PDF). I wonder why it is not possible to define an operator with a name? For inst…

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

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