# General Usage

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

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

**Page:** 615

---

## [Solution concept for "world age" problem occuring with @generated and macros](https://discourse.julialang.org/t/solution-concept-for-world-age-problem-occuring-with-generated-and-macros/57408)

<div class="topic-metadata">

**Author:** [@rryi](https://discourse.julialang.org/u/rryi)\
**Replies:** 7\
**Last updated:** [April 12, 2021, 7:37pm UTC](https://discourse.julialang.org/t/solution-concept-for-world-age-problem-occuring-with-generated-and-macros/57408 "2021-04-12T19:37:38Z")

</div>

This is not a beginner’s question, it is a question to advanced julia users whether my concept below is a valid and generalizable approach. And if the answers turn out to be positive, it might help others to overcome …

---

## [How can I use \\= with factorizations?](https://discourse.julialang.org/t/how-can-i-use-with-factorizations/59126)

<div class="topic-metadata">

**Author:** [@giancarloantonucci](https://discourse.julialang.org/u/giancarloantonucci)\
**Replies:** 7\
**Last updated:** [April 12, 2021, 6:11pm UTC](https://discourse.julialang.org/t/how-can-i-use-with-factorizations/59126 "2021-04-12T18:11:07Z")

</div>

As per title. For example, this works: using LinearAlgebra A = rand(3, 3) b = rand(3) @show b b \\= A @show b b = \[0.09019616214492654, 0.2564457656075061, 0.7120782534101571\] b = \[0.5468125936523385 1.4817879951917017…

---

## [FFT for Unitful vector](https://discourse.julialang.org/t/fft-for-unitful-vector/59044)

<div class="topic-metadata">

**Author:** [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Replies:** 10\
**Last updated:** [April 12, 2021, 5:25pm UTC](https://discourse.julialang.org/t/fft-for-unitful-vector/59044 "2021-04-12T17:25:48Z")

</div>

I am trying to use Unitful package to better track units of my physical quantities, and I am a bit confused: Here is example: using Unitful trajectory = trajectory .\* u"m" fft(trajectory) I got the following error: …

---

## [ModelingToolkit + IntervalConstraintProgramming: how to build expressions and contractors without "world age" problems or ambiguities](https://discourse.julialang.org/t/modelingtoolkit-intervalconstraintprogramming-how-to-build-expressions-and-contractors-without-world-age-problems-or-ambiguities/59007)

<div class="topic-metadata">

**Author:** [@cvanaret](https://discourse.julialang.org/u/cvanaret)\
**Replies:** 8\
**Last updated:** [April 12, 2021, 5:23pm UTC](https://discourse.julialang.org/t/modelingtoolkit-intervalconstraintprogramming-how-to-build-expressions-and-contractors-without-world-age-problems-or-ambiguities/59007 "2021-04-12T17:23:30Z")

</div>

Hi, I’m facing a problem of “world age” that my Julia experience doesn’t allow me to comprehend very well. Here is a MWE that uses the ModelingToolkit and IntervalConstraintProgramming packages: using ModelingToolkit u…

---

## [Specializing broadcasting for a scalar function](https://discourse.julialang.org/t/specializing-broadcasting-for-a-scalar-function/59121)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 5\
**Last updated:** [April 12, 2021, 4:37pm UTC](https://discourse.julialang.org/t/specializing-broadcasting-for-a-scalar-function/59121 "2021-04-12T16:37:13Z")

</div>

Let’s say I have a function function f(a, b) temp = do\_something\_expensive(a) do\_other\_thing(temp, b) end I like writing scalar functions because they don’t obscure the logic with additional loops. But in thi…

---

## [Change button color on odd clicks](https://discourse.julialang.org/t/change-button-color-on-odd-clicks/59123)

<div class="topic-metadata">

**Author:** [@saraflgarcia](https://discourse.julialang.org/u/saraflgarcia)\
**Replies:** 0\
**Last updated:** [April 12, 2021, 4:26pm UTC](https://discourse.julialang.org/t/change-button-color-on-odd-clicks/59123 "2021-04-12T16:26:53Z")

</div>

Hello everyone, With Julia Interact, how can I change button color on odd clicks? Here’s my unsuccessful attempt: heart(color) = button(latex(“\\heartsuit”), style=Dict(:color =\> color, :backgroundColor =\> “white”, …

---

## [Rethinking optimization, lower ok for all Julia code (for e.g. faster startup) as a default?](https://discourse.julialang.org/t/rethinking-optimization-lower-ok-for-all-julia-code-for-e-g-faster-startup-as-a-default/39843)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 7\
**Last updated:** [April 12, 2021, 3:26pm UTC](https://discourse.julialang.org/t/rethinking-optimization-lower-ok-for-all-julia-code-for-e-g-faster-startup-as-a-default/39843 "2021-04-12T15:26:43Z")

</div>

Clearly lower optimization wouldn’t be faster always, or we would always use lower levels. As of version 1.5 it doesn’t need to be one global setting, and since we can tune I suggest changing the default. E.g. for some r…

---

## [Why is this simple function twice as slow as its Python version](https://discourse.julialang.org/t/why-is-this-simple-function-twice-as-slow-as-its-python-version/59004)

<div class="topic-metadata">

**Author:** [@Semi](https://discourse.julialang.org/u/Semi)\
**Replies:** 97\
**Last updated:** [April 12, 2021, 3:23pm UTC](https://discourse.julialang.org/t/why-is-this-simple-function-twice-as-slow-as-its-python-version/59004 "2021-04-12T15:23:04Z")

</div>

I’m in the planing stages for writing a piece of scientific software and I would like to use Julia for it, but I’m surprised how much slower Julia is from Python when tested on this simple code: function test(n::Int64,k…

---

## [Is there have an intuitive way to plot an animation plots by frame when using PlotlyJS?](https://discourse.julialang.org/t/is-there-have-an-intuitive-way-to-plot-an-animation-plots-by-frame-when-using-plotlyjs/59102)

<div class="topic-metadata">

**Author:** [@xinzhicaishu](https://discourse.julialang.org/u/xinzhicaishu)\
**Replies:** 0\
**Last updated:** [April 12, 2021, 1:27pm UTC](https://discourse.julialang.org/t/is-there-have-an-intuitive-way-to-plot-an-animation-plots-by-frame-when-using-plotlyjs/59102 "2021-04-12T13:27:04Z")

</div>

I’m a newer in studying Julia, hopefully hearing your reply! oh, BTW, I have read a Github example from this and reference from this, but I can’t reproduce some examples in Plotly.js animation course, some advise useful? …

---

## [Turning Expressions into Functions](https://discourse.julialang.org/t/turning-expressions-into-functions/49558)

<div class="topic-metadata">

**Author:** [@1ozturkbe](https://discourse.julialang.org/u/1ozturkbe)\
**Replies:** 17\
**Last updated:** [April 12, 2021, 12:41pm UTC](https://discourse.julialang.org/t/turning-expressions-into-functions/49558 "2021-04-12T12:41:16Z")

</div>

I have the following Expression: ex = :(sum(x\[i\] for i=1:4)- y\[1\] \* y\[2\] + z) which I would like to evaluate over some data x, y, z. I have tried doing direct substitution through symbolic manipulations, but it is abys…

---

## [Solving symbolic equations](https://discourse.julialang.org/t/solving-symbolic-equations/57978)

<div class="topic-metadata">

**Author:** [@blakerbuchanan](https://discourse.julialang.org/u/blakerbuchanan)\
**Replies:** 10\
**Last updated:** [April 12, 2021, 10:56am UTC](https://discourse.julialang.org/t/solving-symbolic-equations/57978 "2021-04-12T10:56:31Z")

</div>

I am interested in manipulating symbolic differential equations, but can’t seem to identify a package that provides the functionality I am looking for. I am particularly interested in this functionality for defining a dy…

---

## [Calling a simple method with unused type parameters unexpectedly allocates memory](https://discourse.julialang.org/t/calling-a-simple-method-with-unused-type-parameters-unexpectedly-allocates-memory/59050)

<div class="topic-metadata">

**Author:** [@aciobanas](https://discourse.julialang.org/u/aciobanas)\
**Replies:** 5\
**Last updated:** [April 12, 2021, 11:03am UTC](https://discourse.julialang.org/t/calling-a-simple-method-with-unused-type-parameters-unexpectedly-allocates-memory/59050 "2021-04-12T11:03:00Z")

</div>

Hello, I am trying to understand why the calling of a relatively simple method with unused type parameters allocates memory, while the same method with no type parameters does not. I have a method that is aiming at com…

---

## [Earth engine Authenticate() error](https://discourse.julialang.org/t/earth-engine-authenticate-error/59091)

<div class="topic-metadata">

**Author:** [@praveen1](https://discourse.julialang.org/u/praveen1)\
**Replies:** 0\
**Last updated:** [April 12, 2021, 10:46am UTC](https://discourse.julialang.org/t/earth-engine-authenticate-error/59091 "2021-04-12T10:46:11Z")

</div>

using PyCall; ee = pyimport(“ee”); ee.Authenticate(); To authorize access needed by Earth Engine, open the following URL in a web browser and follow the instructions. If the web browser does not start automatically, p…

---

## [Efficient parallelization of in place transforms](https://discourse.julialang.org/t/efficient-parallelization-of-in-place-transforms/59062)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [April 12, 2021, 4:50am UTC](https://discourse.julialang.org/t/efficient-parallelization-of-in-place-transforms/59062 "2021-04-12T04:50:22Z")

</div>

I wanted to revisit this discussion from Pmap with in place functions that I started 2 years ago. Generalizing a bit, suppose I have an in place transform f!(x) and array of data, xvals, on which I want to apply the tra…

---

## [Warnings about unused parameter in method](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956)

<div class="topic-metadata">

**Author:** [@kumarbalachandran](https://discourse.julialang.org/u/kumarbalachandran)\
**Replies:** 2\
**Last updated:** [April 12, 2021, 4:09am UTC](https://discourse.julialang.org/t/warnings-about-unused-parameter-in-method/58956 "2021-04-12T04:09:31Z")

</div>

So I have a declaration as below abstract type C end struct A \<:C x::Float64 y::Float64 end function pattern(ant::A, pos::Float64) return pos^2 end struct B \<: C x::Float64 y::Float64 …

---

## [Text to data-structure declaritively](https://discourse.julialang.org/t/text-to-data-structure-declaritively/59066)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 0\
**Last updated:** [April 12, 2021, 2:16am UTC](https://discourse.julialang.org/t/text-to-data-structure-declaritively/59066 "2021-04-12T02:16:10Z")

</div>

To convert: X = "John.Smith,20" to a named tuple Tup = (First\_Name = "John", Last\_Name = "Smith", Age = 20 ) I usually do something like: Tup = (First\_Name, Last\_Name, Age) = @pipe split("John.Smith,20", '.' ) |\>…

---

## [PyPlot Backend issue](https://discourse.julialang.org/t/pyplot-backend-issue/59060)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 0\
**Last updated:** [April 11, 2021, 11:28pm UTC](https://discourse.julialang.org/t/pyplot-backend-issue/59060 "2021-04-11T23:28:58Z")

</div>

For this issue: julia\> using Plots julia\> pyplot() ┌ Warning: PyPlot is using tkagg backend, which is known to cause crashes on MacOS (#410); use the MPLBACKEND environment variable to request a different backend. └ @ …

---

## [How do I read the names of functions and their signature from a imported .jl file?](https://discourse.julialang.org/t/how-do-i-read-the-names-of-functions-and-their-signature-from-a-imported-jl-file/59056)

<div class="topic-metadata">

**Author:** [@heisenberg1](https://discourse.julialang.org/u/heisenberg1)\
**Replies:** 1\
**Last updated:** [April 11, 2021, 8:04pm UTC](https://discourse.julialang.org/t/how-do-i-read-the-names-of-functions-and-their-signature-from-a-imported-jl-file/59056 "2021-04-11T20:04:27Z")

</div>

Basically I import a .jl file into a .jl file, read the function names and their signature of the imported .jl file, and give them as output.

---

## [Avoid ambiguous function type allocation without losing abstract type](https://discourse.julialang.org/t/avoid-ambiguous-function-type-allocation-without-losing-abstract-type/59040)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 5\
**Last updated:** [April 11, 2021, 7:08pm UTC](https://discourse.julialang.org/t/avoid-ambiguous-function-type-allocation-without-losing-abstract-type/59040 "2021-04-11T19:08:00Z")

</div>

I’m using a multiple dispatch on an abstract type (AbstractBody) to switch between two behaviours. I need to store a performance critical function in one case, but don’t need to store anything in the other case. I’ve im…

---

## [Using macros to explode a struct into a tuple of its members](https://discourse.julialang.org/t/using-macros-to-explode-a-struct-into-a-tuple-of-its-members/58997)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 8\
**Last updated:** [April 11, 2021, 3:37pm UTC](https://discourse.julialang.org/t/using-macros-to-explode-a-struct-into-a-tuple-of-its-members/58997 "2021-04-11T15:37:46Z")

</div>

So, I would like use a macro to convert a struct into a tuple of its members let boo be the following struct boo a b c end and collect defined as follows macro collect(x) :( tuple($x.a,$x.b,$x.c) ) end @col…

---

## [Any Pretty Dataframe printing?](https://discourse.julialang.org/t/any-pretty-dataframe-printing/59027)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 3\
**Last updated:** [April 11, 2021, 2:45pm UTC](https://discourse.julialang.org/t/any-pretty-dataframe-printing/59027 "2021-04-11T14:45:24Z")

</div>

Hello, I like so much the PrettyTables.jl . I like the old-fashion look, with very readable fonts. I also like very much the body\_hlines option that separates rows into groups for readability. (I like the vertical li…

---

## [Logarithmic scaling with plotly](https://discourse.julialang.org/t/logarithmic-scaling-with-plotly/59026)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 4\
**Last updated:** [April 11, 2021, 11:06am UTC](https://discourse.julialang.org/t/logarithmic-scaling-with-plotly/59026 "2021-04-11T11:06:58Z")

</div>

I want to create my own recipe for bodeplots, where both the x and y axis normally has logarithmic scaling. So I can easily create a plot with with an exponential relation: using Plots plotly() xs = 0:0.001:10 ys = exp…

---

## [Dispatch on type tuples in runtime?](https://discourse.julialang.org/t/dispatch-on-type-tuples-in-runtime/58652)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 18\
**Last updated:** [April 11, 2021, 8:19am UTC](https://discourse.julialang.org/t/dispatch-on-type-tuples-in-runtime/58652 "2021-04-11T08:19:39Z")

</div>

getvalue(::typeof(sin), ::Float64) = 1 getvalue(::typeof(sin), ::Number) = 2 getvalue(::MyStruct, args...) = 3 Julia has an awesome type system that lets us very flexibly dispatch on function signatures - all the follow…

---

## [Package used to work, after update to 1.6 it doesnt anymore](https://discourse.julialang.org/t/package-used-to-work-after-update-to-1-6-it-doesnt-anymore/58920)

<div class="topic-metadata">

**Author:** [@meck](https://discourse.julialang.org/u/meck)\
**Replies:** 15\
**Last updated:** [April 11, 2021, 7:38am UTC](https://discourse.julialang.org/t/package-used-to-work-after-update-to-1-6-it-doesnt-anymore/58920 "2021-04-11T07:38:59Z")

</div>

ERROR: LoadError: InitError: could not load library "/home/meck/.julia/artifacts/0a7f440ba143b238cc3dd0def2956d34d76755f3/lib/libnetcdf.so" libmbedcrypto.so.5: cannot open shared object file: No such file or directory St…

---

## [Why is the function evaluation with more allocations faster?](https://discourse.julialang.org/t/why-is-the-function-evaluation-with-more-allocations-faster/58934)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 6\
**Last updated:** [April 11, 2021, 7:24am UTC](https://discourse.julialang.org/t/why-is-the-function-evaluation-with-more-allocations-faster/58934 "2021-04-11T07:24:16Z")

</div>

I have a pretty basic question - I’m evaluating some function over an array of inputs. @inline function f(x) y = @. log(x) return @. exp(y) end This results in extra allocations, and I thought avoiding allocations wou…

---

## ["Undefined behaviour" in Julia; does it e.g. apply to signed overflow addition?](https://discourse.julialang.org/t/undefined-behaviour-in-julia-does-it-e-g-apply-to-signed-overflow-addition/59015)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [April 11, 2021, 7:09am UTC](https://discourse.julialang.org/t/undefined-behaviour-in-julia-does-it-e-g-apply-to-signed-overflow-addition/59015 "2021-04-11T07:09:42Z")

</div>

Compared to e.g. C and C++20 - Wikipedia, how much undefined behavior does Julia have? signed integers are now defined to be represented using two’s complement (signed integer overflow remains undefined behavior) Jul…

---

## [Bug in LightGraphs.SimpleGraphs.random\_regular\_digraph](https://discourse.julialang.org/t/bug-in-lightgraphs-simplegraphs-random-regular-digraph/58901)

<div class="topic-metadata">

**Author:** [@Oko](https://discourse.julialang.org/u/Oko)\
**Replies:** 1\
**Last updated:** [April 11, 2021, 3:09am UTC](https://discourse.julialang.org/t/bug-in-lightgraphs-simplegraphs-random-regular-digraph/58901 "2021-04-11T03:09:48Z")

</div>

I am trying to use LightGraphs.SimpleGraphs.random\_regular\_digraph Method random\_regular\_digraph to create a regular random digraph. Julia version is 1.6.0 on Red Hat Linux. I am running on a single thread. I am very t…

---

## [How can I parse a \`Socket.TCPSocket\` into an \`HTTP.Request\` in Julia?](https://discourse.julialang.org/t/how-can-i-parse-a-socket-tcpsocket-into-an-http-request-in-julia/59017)

<div class="topic-metadata">

**Author:** [@apoor](https://discourse.julialang.org/u/apoor)\
**Replies:** 0\
**Last updated:** [April 11, 2021, 2:56am UTC](https://discourse.julialang.org/t/how-can-i-parse-a-socket-tcpsocket-into-an-http-request-in-julia/59017 "2021-04-11T02:56:43Z")

</div>

I’m trying to get the both the client request and IP address from http requests to my HTTP.jl server (based on the basic server example in the docs). using HTTP using Sockets const APP = HTTP.Router() # My request han…

---

## [Initializing OnlineStats Series with statistics](https://discourse.julialang.org/t/initializing-onlinestats-series-with-statistics/58792)

<div class="topic-metadata">

**Author:** [@jarapo](https://discourse.julialang.org/u/jarapo)\
**Replies:** 3\
**Last updated:** [April 11, 2021, 12:55am UTC](https://discourse.julialang.org/t/initializing-onlinestats-series-with-statistics/58792 "2021-04-11T00:55:01Z")

</div>

Premise: I am running experiments that involve with Monte Carlo sampling on clusters, and I am collecting the mean and variance using OnlineStats. It takes a long time and I get time out errors on our clusters, so I wa…

---

## [Converting string of bytes to integer](https://discourse.julialang.org/t/converting-string-of-bytes-to-integer/58962)

<div class="topic-metadata">

**Author:** [@SudhakarKuma](https://discourse.julialang.org/u/SudhakarKuma)\
**Replies:** 6\
**Last updated:** [April 11, 2021, 12:18am UTC](https://discourse.julialang.org/t/converting-string-of-bytes-to-integer/58962 "2021-04-11T00:18:04Z")

</div>

I am working on interfacing Arduino with Julia. There is a particular experiment of reading the values from a sensor connected to Arduino. For this, I have written a function in Julia 1.6.0. This function reads the valu…

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

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