# General Usage

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

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

**Page:** 639

---

## [How to overload .=?](https://discourse.julialang.org/t/how-to-overload/55864)

<div class="topic-metadata">

**Author:** [@verseve](https://discourse.julialang.org/u/verseve)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 8:35pm UTC](https://discourse.julialang.org/t/how-to-overload/55864 "2021-02-23T20:35:06Z")

</div>

I would like to overload broadcasted assignment (.=). What is the correct way to do this, while still using .=? Is this possible?

---

## [Hi all I have this piece of multithreaded code, however it is only executing the f](https://discourse.julialang.org/t/hi-all-i-have-this-piece-of-multithreaded-code-however-it-is-only-executing-the-f/55878)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 8:33pm UTC](https://discourse.julialang.org/t/hi-all-i-have-this-piece-of-multithreaded-code-however-it-is-only-executing-the-f/55878 "2021-02-23T20:33:57Z")

</div>

Hi all I have this piece of multithreaded code, however it is only executing the first queue in \_queues. Could anyone give any pointer :slightly\_smiling\_face: ? function execute\_queues!() @async begin amqp\_c…

---

## [Why? isa(\[(x,1),(y,1)\], Array{Tuple{Stuff,Number},1}) = false](https://discourse.julialang.org/t/why-isa-x-1-y-1-array-tuple-stuff-number-1-false/55777)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 25\
**Last updated:** [February 23, 2021, 6:51pm UTC](https://discourse.julialang.org/t/why-isa-x-1-y-1-array-tuple-stuff-number-1-false/55777 "2021-02-23T18:51:50Z")

</div>

Hello, I do not understand the output of this script: struct Stuff a end x = Stuff("x") y = Stuff("y") test1 = isa(1, Number) test2 = isa((x,1), Tuple{Stuff,Number}) test3 = isa(\[(x,1),(y,1)\], Array{Tuple{Stuff,N…

---

## [If I have a DataFrame and want to get \`unique\` columns but treat each column as a](https://discourse.julialang.org/t/if-i-have-a-dataframe-and-want-to-get-unique-columns-but-treat-each-column-as-a/55852)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 3:15pm UTC](https://discourse.julialang.org/t/if-i-have-a-dataframe-and-want-to-get-unique-columns-but-treat-each-column-as-a/55852 "2021-02-23T15:15:26Z")

</div>

if I have a DataFrame and want to get unique columns but treat each column as a separate entity, what is the best way to do it? MATLAB has a convenience argument unique(A(:,1:2),'rows') (yuk!) … but I can’t find an equi…

---

## [What (..) in variables and parameters means in ModelingToolkit](https://discourse.julialang.org/t/what-in-variables-and-parameters-means-in-modelingtoolkit/55874)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 6:39pm UTC](https://discourse.julialang.org/t/what-in-variables-and-parameters-means-in-modelingtoolkit/55874 "2021-02-23T18:39:02Z")

</div>

Transcribing part of a Slack conversation here (slackhole, Slack threads suck, etc): \[airpmb:\] Could you help me understand what the (..) syntax for variables and parameters declaration means? Docs say Note that @pa…

---

## [Status of "let" statements before Threads.@threads](https://discourse.julialang.org/t/status-of-let-statements-before-threads-threads/55813)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 6:33pm UTC](https://discourse.julialang.org/t/status-of-let-statements-before-threads-threads/55813 "2021-02-23T18:33:10Z")

</div>

Hello! I found myself using a lot of let statements before multi-threaded for-loops with the Threads.@threads command in my code. I wanted to know if these were still useful in the present version of julia now. Does an…

---

## [Write CSV with columns in a specific order](https://discourse.julialang.org/t/write-csv-with-columns-in-a-specific-order/55308)

<div class="topic-metadata">

**Author:** [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 3:17pm UTC](https://discourse.julialang.org/t/write-csv-with-columns-in-a-specific-order/55308 "2021-02-23T15:17:21Z")

</div>

Hi all, I currently have some code which reads in a csv and does some manipulation and I want to then output my new dataframe in a specific order by column. Currently I have column headers from the input: Country, Reg…

---

## [How to list all methods defined in a file, including extension methods](https://discourse.julialang.org/t/how-to-list-all-methods-defined-in-a-file-including-extension-methods/55855)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 2:36pm UTC](https://discourse.julialang.org/t/how-to-list-all-methods-defined-in-a-file-including-extension-methods/55855 "2021-02-23T14:36:01Z")

</div>

Hello, I already found here a trick for how to list functions defined in a given Julia file: I can go further for methods using methods(f, \[types\], \[module\]) . However, I can’t figure out how to also get the extens…

---

## [Question) How can I multiply a vector to a stochastic matrix?](https://discourse.julialang.org/t/question-how-can-i-multiply-a-vector-to-a-stochastic-matrix/55782)

<div class="topic-metadata">

**Author:** [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Replies:** 12\
**Last updated:** [February 23, 2021, 2:14pm UTC](https://discourse.julialang.org/t/question-how-can-i-multiply-a-vector-to-a-stochastic-matrix/55782 "2021-02-23T14:14:26Z")

</div>

I finally managed to use tauchen function. However, the type of outcome is Discrete Markov Chain stochastic matrix of type Array{Float64,2}: I tried to multiply a scalar, a vector, or any kind of algebra on it, but Juli…

---

## [Fast hamming distance function in Julia that returns a distance matrix](https://discourse.julialang.org/t/fast-hamming-distance-function-in-julia-that-returns-a-distance-matrix/55716)

<div class="topic-metadata">

**Author:** [@giac](https://discourse.julialang.org/u/giac)\
**Replies:** 12\
**Last updated:** [February 21, 2021, 6:20pm UTC](https://discourse.julialang.org/t/fast-hamming-distance-function-in-julia-that-returns-a-distance-matrix/55716 "2021-02-21T18:20:28Z")

</div>

I am trying to compute the hamming distance on a very large dataset. I need to get back a distance matrix between rows in order to run further analysis on this matrix. For my purposes, it is useful that the data are sto…

---

## [Evaluate Piecewise Functions Effciently](https://discourse.julialang.org/t/evaluate-piecewise-functions-effciently/55832)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 11:54am UTC](https://discourse.julialang.org/t/evaluate-piecewise-functions-effciently/55832 "2021-02-23T11:54:46Z")

</div>

Dear all, I have a very basic (maybe stupid) question. I need to evaluate a piecewise function many times. My naive approach is to do something like: function myPiecewise(a,b) if a \< 0 return 0.5\*a + b else …

---

## [Getting Char bytes without allocation](https://discourse.julialang.org/t/getting-char-bytes-without-allocation/55791)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 6\
**Last updated:** [February 23, 2021, 8:44am UTC](https://discourse.julialang.org/t/getting-char-bytes-without-allocation/55791 "2021-02-23T08:44:46Z")

</div>

How can I get the bytes in a UTF-8 character like 'é' without allocating? My use case is a for loop on all characters in a string. The loop must sometimes access the bytes directly: for c in str # Do some work …

---

## [Is there a difference between \`T::Type\` and \`::Type{T} ... where T\` in a method si](https://discourse.julialang.org/t/is-there-a-difference-between-t-type-and-type-t-where-t-in-a-method-si/55825)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 23, 2021, 7:26am UTC](https://discourse.julialang.org/t/is-there-a-difference-between-t-type-and-type-t-where-t-in-a-method-si/55825 "2021-02-23T07:26:24Z")

</div>

Is there a difference between T::Type and ::Type{T} ... where T in a method signature? Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back…

---

## [Use @\_\_FILE\_\_ in pasted code in REPL](https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 6\
**Last updated:** [February 23, 2021, 7:18am UTC](https://discourse.julialang.org/t/use-file-in-pasted-code-in-repl/55824 "2021-02-23T07:18:16Z")

</div>

I no longer use Atom or VSCode. My current workflow is to send codes on a Julia script to an open Julia REPL. I want to set the current folder to be my working directory. Using cd(dirname(@\_\_FILE\_\_)) in this manner does …

---

## [Conversion of properties of a NamedTuple or struct](https://discourse.julialang.org/t/conversion-of-properties-of-a-namedtuple-or-struct/55769)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [February 23, 2021, 5:43am UTC](https://discourse.julialang.org/t/conversion-of-properties-of-a-namedtuple-or-struct/55769 "2021-02-23T05:43:41Z")

</div>

I want write a piece of code that will receive large arrays of “state variables” from finite element codes, and do a conversion on all the e.g. Float64 appearing in this data structure. There are many element types, I d…

---

## [How to pass in a function as an argument to a function?](https://discourse.julialang.org/t/how-to-pass-in-a-function-as-an-argument-to-a-function/55816)

<div class="topic-metadata">

**Author:** [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Replies:** 8\
**Last updated:** [February 23, 2021, 3:48am UTC](https://discourse.julialang.org/t/how-to-pass-in-a-function-as-an-argument-to-a-function/55816 "2021-02-23T03:48:10Z")

</div>

Hello So I have this function - function late\_time\_value(slope, x\_init::Float64, y\_init::Float64, dx::Float64 = 0.01, tf::Float64 = 100) N = floor(Integer, tf/dt) sol\_x = zeros(N) sol\_y = zeros(N) …

---

## [Agents: UndefVarError: plotabm not defined](https://discourse.julialang.org/t/agents-undefvarerror-plotabm-not-defined/54318)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 12\
**Last updated:** [February 23, 2021, 3:15am UTC](https://discourse.julialang.org/t/agents-undefvarerror-plotabm-not-defined/54318 "2021-02-23T03:15:42Z")

</div>

Executing the example Game of Life given in Agents (https://juliadynamics.github.io/Agents.jl/stable/examples/game\_of\_life\_2D\_CA/) I always get the error message: UndefVarError: plotabm not defined. I started the exampl…

---

## [Variables and for loops in Pluto.jl](https://discourse.julialang.org/t/variables-and-for-loops-in-pluto-jl/55814)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 2:11am UTC](https://discourse.julialang.org/t/variables-and-for-loops-in-pluto-jl/55814 "2021-02-23T02:11:13Z")

</div>

I’m trying to run a loop in Pluto, but I’m having a problem with multiple deffinitions, from the way that Pluto passes on variables. begin f(x)=x^2-x-20 plot(f,4:.001:12,legend=false) x=11 # initial value of x # may …

---

## [Package dependency question](https://discourse.julialang.org/t/package-dependency-question/55809)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 12:11am UTC](https://discourse.julialang.org/t/package-dependency-question/55809 "2021-02-23T00:11:10Z")

</div>

Let’s say that I installed package A that depends on package B. After a while, package A no longer depends on package B. All the other packages also do not depend on package B. Will package B be uninstalled automatically…

---

## [How can I display all Float64 multidimensional arrays as vectors?](https://discourse.julialang.org/t/how-can-i-display-all-float64-multidimensional-arrays-as-vectors/55787)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 22, 2021, 11:37pm UTC](https://discourse.julialang.org/t/how-can-i-display-all-float64-multidimensional-arrays-as-vectors/55787 "2021-02-22T23:37:10Z")

</div>

How can I display all Float64 multidimensional arrays as vectors? I tried the following but it stackoverflows: Base.show(io::IO, x::Array{Float64}) = print(io, vec(x)) Probably it is running into a deadlock. Note that…

---

## [Different output of printf on Julia nightly build](https://discourse.julialang.org/t/different-output-of-printf-on-julia-nightly-build/55807)

<div class="topic-metadata">

**Author:** [@Norman](https://discourse.julialang.org/u/Norman)\
**Replies:** 0\
**Last updated:** [February 22, 2021, 10:53pm UTC](https://discourse.julialang.org/t/different-output-of-printf-on-julia-nightly-build/55807 "2021-02-22T22:53:48Z")

</div>

Hi, I find that @printf is giving me a different output on a nightly build version of Julia. For the released versions, I get the following: julia\> using Printf julia\> v = 1e-6 1.0e-6 julia\> @printf "\<1e%2.2d" ceil(I…

---

## [Some questions on Transducers.jl](https://discourse.julialang.org/t/some-questions-on-transducers-jl/55622)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 6\
**Last updated:** [February 22, 2021, 10:43pm UTC](https://discourse.julialang.org/t/some-questions-on-transducers-jl/55622 "2021-02-22T22:43:22Z")

</div>

I’m recently interested in Transducers.jl. However, I cannot understand some methods provided in the package. For example, anybody can explain foldxl example in detail? I cannot figure out how the answer comes. Also, …

---

## [CSV.read Error - provide a valid sink argument](https://discourse.julialang.org/t/csv-read-error-provide-a-valid-sink-argument/50157)

<div class="topic-metadata">

**Author:** [@Vaclav\_Dekanovsky](https://discourse.julialang.org/u/Vaclav_Dekanovsky)\
**Replies:** 11\
**Last updated:** [February 22, 2021, 10:04pm UTC](https://discourse.julialang.org/t/csv-read-error-provide-a-valid-sink-argument/50157 "2021-02-22T22:04:29Z")

</div>

I’ve just installed Julia on Win-64 and I try to read a CSV file. The following code works: using CSVFiles, FileIO, DataFrames df = load("C:\\\\...\\\\file.csv") |\> DataFrame But I wonder what is missing in this code: \[…

---

## [Pyjulia, Django, and segfaults](https://discourse.julialang.org/t/pyjulia-django-and-segfaults/25313)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 8\
**Last updated:** [February 22, 2021, 7:52pm UTC](https://discourse.julialang.org/t/pyjulia-django-and-segfaults/25313 "2021-02-22T19:52:15Z")

</div>

I work at a very small (3 devs) startup. Our backend is Python / Django. We have some computation-intensive code for demand estimation which we’ve written in Julia, and we want to integrate that code into our Django back…

---

## [Hello! I've built a web app using Genie + Stipple and I would like to deploy it to](https://discourse.julialang.org/t/hello-ive-built-a-web-app-using-genie-stipple-and-i-would-like-to-deploy-it-to/54459)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 17\
**Last updated:** [February 22, 2021, 6:16pm UTC](https://discourse.julialang.org/t/hello-ive-built-a-web-app-using-genie-stipple-and-i-would-like-to-deploy-it-to/54459 "2021-02-22T18:16:01Z")

</div>

Hello! I’ve built a web app using Genie + Stipple and I would like to deploy it to my website (i.e. with a julia process running in the background). Has anyone done this before? Note that the original poster on Slack ca…

---

## [How to remove comments from a Julia file?](https://discourse.julialang.org/t/how-to-remove-comments-from-a-julia-file/55783)

<div class="topic-metadata">

**Author:** [@NightMachinary](https://discourse.julialang.org/u/NightMachinary)\
**Replies:** 3\
**Last updated:** [February 22, 2021, 5:24pm UTC](https://discourse.julialang.org/t/how-to-remove-comments-from-a-julia-file/55783 "2021-02-22T17:24:25Z")

</div>

I am processing some Julia code with regexes, to convert the colorschemes in Colorschemes.jl to go objects. I want to remove the comments before feeding the Julia code to my zsh script. What are the options? PS: For the…

---

## [Dates.format broadcasting is slow](https://discourse.julialang.org/t/dates-format-broadcasting-is-slow/55778)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 5\
**Last updated:** [February 22, 2021, 2:37pm UTC](https://discourse.julialang.org/t/dates-format-broadcasting-is-slow/55778 "2021-02-22T14:37:43Z")

</div>

In my use case below, Dates.format is rather slow when applied to a vector. I was wondering if there is a better way to broadcast this. I am well aware, that my custom function uses ‘additional knowledge’ (few unique …

---

## [Parallel implementation of Transducers.jl](https://discourse.julialang.org/t/parallel-implementation-of-transducers-jl/55767)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [February 22, 2021, 9:55am UTC](https://discourse.julialang.org/t/parallel-implementation-of-transducers-jl/55767 "2021-02-22T09:55:14Z")

</div>

I’m developing a package for general-purpose simulator based on lazy evaluation using Transducers.jl. (For the background, take a look at this.) Now, I’m trying to implement Transducers.jl for parallel simulation. I’d…

---

## [What is the interpretation of Turing's std, naive\_se, mcse?](https://discourse.julialang.org/t/what-is-the-interpretation-of-turings-std-naive-se-mcse/52252)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [February 22, 2021, 10:06am UTC](https://discourse.julialang.org/t/what-is-the-interpretation-of-turings-std-naive-se-mcse/52252 "2021-02-22T10:06:22Z")

</div>

An MCMC chain summary gives Summary Statistics parameters mean std naive\_se mcse ess rhat Symbol Float64 Float64 Float64 Float64 Float64 Float64 What is the diffe…

---

## [MPI Permission denied](https://discourse.julialang.org/t/mpi-permission-denied/55760)

<div class="topic-metadata">

**Author:** [@hideakiv](https://discourse.julialang.org/u/hideakiv)\
**Replies:** 1\
**Last updated:** [February 22, 2021, 9:34am UTC](https://discourse.julialang.org/t/mpi-permission-denied/55760 "2021-02-22T09:34:47Z")

</div>

I am using MPI.jl and call the file in the REPL as follows. julia\> mpiexec(cmd -\>run(\`$cmd -np 2 $(Base.julia\_cmd()) $("script.jl")\`)) Sometimes, I get back the following error: ERROR: LoadError: SystemError: opening …

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

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