# General Usage

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

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

**Page:** 802

---

## [Putting results of diffrent arrays for one variable in one array](https://discourse.julialang.org/t/putting-results-of-diffrent-arrays-for-one-variable-in-one-array/32708)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 13\
**Last updated:** [December 26, 2019, 1:32pm UTC](https://discourse.julialang.org/t/putting-results-of-diffrent-arrays-for-one-variable-in-one-array/32708 "2019-12-26T13:32:15Z")

</div>

Basically i have this small piece of code when i get: function scan\_maker(A) m = JuMP.Model(solver=ClpSolver(PrimalTolerance=1e-3, DualTolerance=1e-3, InfeasibleReturn=1, PresolveType=1)) # m = Model(solver=Guro…

---

## [Exercise in DiffEqTutorials, "Failed to build the parameter derivatives"](https://discourse.julialang.org/t/exercise-in-diffeqtutorials-failed-to-build-the-parameter-derivatives/32711)

<div class="topic-metadata">

**Author:** [@yuxi.liu](https://discourse.julialang.org/u/yuxi.liu)\
**Replies:** 1\
**Last updated:** [December 26, 2019, 12:42pm UTC](https://discourse.julialang.org/t/exercise-in-diffeqtutorials-failed-to-build-the-parameter-derivatives/32711 "2019-12-26T12:42:53Z")

</div>

This is from the tutorial of DiffEqTutorials, Callbacks and Events, exercise 2: using DifferentialEquations, ParameterizedFunctions ball! = @ode\_def BallBounce begin dy = v dv = -g + k\*v end g e k throws error ┌ …

---

## [TimeSeries.jl: How to set the meta field in TimeArray (of TimeSeries.jl) after the array is constructed?](https://discourse.julialang.org/t/timeseries-jl-how-to-set-the-meta-field-in-timearray-of-timeseries-jl-after-the-array-is-constructed/32703)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 1\
**Last updated:** [December 26, 2019, 11:09am UTC](https://discourse.julialang.org/t/timeseries-jl-how-to-set-the-meta-field-in-timearray-of-timeseries-jl-after-the-array-is-constructed/32703 "2019-12-26T11:09:13Z")

</div>

Is it possible to set the meta field in a TimeArray (of the TimeSeries.jl package) after the array is defined? The only discussion of meta field in the manual is in the section on constructors. But what if my time array…

---

## [Tips to create beautiful, publication-quality plots](https://discourse.julialang.org/t/tips-to-create-beautiful-publication-quality-plots/32384)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 28\
**Last updated:** [December 26, 2019, 12:54am UTC](https://discourse.julialang.org/t/tips-to-create-beautiful-publication-quality-plots/32384 "2019-12-26T00:54:37Z")

</div>

Edit: an equivalent blog post is available here, as suggested by colleagues: https://nextjournal.com/leandromartinez98/tips-to-create-beautiful-publication-quality-plots-in-julia I was about to send an e-mail to my st…

---

## [Can't test package: "in manifest but not in project"](https://discourse.julialang.org/t/cant-test-package-in-manifest-but-not-in-project/32663)

<div class="topic-metadata">

**Author:** [@yha](https://discourse.julialang.org/u/yha)\
**Replies:** 3\
**Last updated:** [December 25, 2019, 7:46pm UTC](https://discourse.julialang.org/t/cant-test-package-in-manifest-but-not-in-project/32663 "2019-12-25T19:46:37Z")

</div>

I have the registered CircularArrays package deved, but I can’t test it, and can’t make sense of the error message (v1.3) pkg\> status CircularArrays Status \`C:\\Users\\sternlab\\.julia\\environments\\v1.3\\Project.toml\` …

---

## [How to check if all fields of a Tuple are the same](https://discourse.julialang.org/t/how-to-check-if-all-fields-of-a-tuple-are-the-same/32700)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 2\
**Last updated:** [December 25, 2019, 7:41pm UTC](https://discourse.julialang.org/t/how-to-check-if-all-fields-of-a-tuple-are-the-same/32700 "2019-12-25T19:41:35Z")

</div>

Let’s say you have julia\> t = (\[1, 2\], \["a", "b"\]) (\[1, 2\], \["a", "b"\]) julia\> typeof(t) Tuple{Array{Int64,1},Array{String,1}} Let’s say I have a function that takes in a tuple of abstract arrays, and I really need th…

---

## [Breaking a list into chunks of size N](https://discourse.julialang.org/t/breaking-a-list-into-chunks-of-size-n/32697)

<div class="topic-metadata">

**Author:** [@PseudoCodeNerd](https://discourse.julialang.org/u/PseudoCodeNerd)\
**Replies:** 2\
**Last updated:** [December 25, 2019, 6:05pm UTC](https://discourse.julialang.org/t/breaking-a-list-into-chunks-of-size-n/32697 "2019-12-25T18:05:38Z")

</div>

Hello there ! I’m trying to break a list into chunks of size N . Here’s the code which I’ve written julia\> function chunk(arr,n) \[arr\[i \* n:(i + 1) \* n\] for i in \[(length(arr)+n-1)//n\]\] end Can someone…

---

## [Parallel loop in numeric order](https://discourse.julialang.org/t/parallel-loop-in-numeric-order/32592)

<div class="topic-metadata">

**Author:** [@Diger](https://discourse.julialang.org/u/Diger)\
**Replies:** 7\
**Last updated:** [December 25, 2019, 3:53pm UTC](https://discourse.julialang.org/t/parallel-loop-in-numeric-order/32592 "2019-12-25T15:53:13Z")

</div>

Running a loop is in numeric order for i=1:100 println(i) end Is it possible to run a parallel loop in order? @sync @distributed for i=1:100 println(i) end I figure it is not fully possible to fully run it in ord…

---

## [Inferring the type of an operation for \`struct\` fields](https://discourse.julialang.org/t/inferring-the-type-of-an-operation-for-struct-fields/32694)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 4\
**Last updated:** [December 25, 2019, 3:26pm UTC](https://discourse.julialang.org/t/inferring-the-type-of-an-operation-for-struct-fields/32694 "2019-12-25T15:26:01Z")

</div>

I have a struct struct Test divisor::Int64 dividend::Int64 result::Float64 end Test(divisor, dividend) = Test(divisor, dividend, divisor/dividend) I want to make a template out of this struct such that inst…

---

## [Julia 1.3 order of magnitude slowdown in function](https://discourse.julialang.org/t/julia-1-3-order-of-magnitude-slowdown-in-function/32691)

<div class="topic-metadata">

**Author:** [@joshua\_jones](https://discourse.julialang.org/u/joshua_jones)\
**Replies:** 1\
**Last updated:** [December 25, 2019, 1:19pm UTC](https://discourse.julialang.org/t/julia-1-3-order-of-magnitude-slowdown-in-function/32691 "2019-12-25T13:19:59Z")

</div>

Cross-posted from https://github.com/JuliaLang/julia/issues/34195 I’m noticing an order-of-magnitude slowdown in a custom function to parse “sample list” files (one ASCII value per line) to Float32 arrays. Any ideas wha…

---

## [BoundsError: attempt to access 0-element Array{JuMP.Variable,1} at index \[1\]](https://discourse.julialang.org/t/boundserror-attempt-to-access-0-element-array-jump-variable-1-at-index-1/32683)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 0\
**Last updated:** [December 25, 2019, 7:30am UTC](https://discourse.julialang.org/t/boundserror-attempt-to-access-0-element-array-jump-variable-1-at-index-1/32683 "2019-12-25T07:30:24Z")

</div>

i have this function: function prob(na) b = T0\*na setc(-b) total = 0.0 for x in Channel(scan) nab = vi2\*x + b #the photon numbers for each item in the sum in the note (10) …

---

## [Is there a tool to organize imports/using statements?](https://discourse.julialang.org/t/is-there-a-tool-to-organize-imports-using-statements/32670)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [December 25, 2019, 7:56am UTC](https://discourse.julialang.org/t/is-there-a-tool-to-organize-imports-using-statements/32670 "2019-12-25T07:56:44Z")

</div>

Hi, I have bunch of modules which uses using …SomeOtherModule however I want to transform them into using …SomeOtherModule: f1,f2 which shows exactly which functions and fields are being used from that particular mo…

---

## [Where does where go?](https://discourse.julialang.org/t/where-does-where-go/32570)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 5\
**Last updated:** [December 25, 2019, 6:26am UTC](https://discourse.julialang.org/t/where-does-where-go/32570 "2019-12-25T06:26:27Z")

</div>

I generally write function signatures with the where-clause outside of the arguments list. Is there any reason why one would put that inside the function signature? e.g. foo(x::T where T) = 1 foo(x::T) where T = 2 fo…

---

## [Why is Base.summarysize not loaded like Base.summary?](https://discourse.julialang.org/t/why-is-base-summarysize-not-loaded-like-base-summary/32674)

<div class="topic-metadata">

**Author:** [@yuxi.liu](https://discourse.julialang.org/u/yuxi.liu)\
**Replies:** 1\
**Last updated:** [December 25, 2019, 4:43am UTC](https://discourse.julialang.org/t/why-is-base-summarysize-not-loaded-like-base-summary/32674 "2019-12-25T04:43:32Z")

</div>

When I start up julia REPL, Base.summary is loaded and I can use it directly like summary, but Base.summarysize must be used like Base.summarysize, else: julia\> summarysize ERROR: UndefVarError: summarysize not defined

---

## [Undefined variable of function side while loop](https://discourse.julialang.org/t/undefined-variable-of-function-side-while-loop/32668)

<div class="topic-metadata">

**Author:** [@locluong09](https://discourse.julialang.org/u/locluong09)\
**Replies:** 3\
**Last updated:** [December 24, 2019, 10:15pm UTC](https://discourse.julialang.org/t/undefined-variable-of-function-side-while-loop/32668 "2019-12-24T22:15:42Z")

</div>

I have a function inside a while loop like the code below, but get problem ERROR: UndefVarError: Pre\_predict not defined. Pre\_predict = zeros(Row, Col) while true N,S,W,E,C,Q = construct\_Tran\_matrix(Pre\_init, \*\*Pre\_…

---

## [Understanding/fixing delayed trigger of Revise.revise in manual mode](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661)

<div class="topic-metadata">

**Author:** [@garborg](https://discourse.julialang.org/u/garborg)\
**Replies:** 2\
**Last updated:** [December 24, 2019, 6:56pm UTC](https://discourse.julialang.org/t/understanding-fixing-delayed-trigger-of-revise-revise-in-manual-mode/32661 "2019-12-24T18:56:26Z")

</div>

I’m having trouble getting Revise.revise() to take effect (right away) when either called in a loop, a script, or a wrapper function that also calls the (non-inlined) function that needs revising. I put together a self-…

---

## [How to deal with Zygote sometimes "pirating" its own adjoints with worse ones?](https://discourse.julialang.org/t/how-to-deal-with-zygote-sometimes-pirating-its-own-adjoints-with-worse-ones/32579)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 3\
**Last updated:** [December 24, 2019, 3:14pm UTC](https://discourse.julialang.org/t/how-to-deal-with-zygote-sometimes-pirating-its-own-adjoints-with-worse-ones/32579 "2019-12-24T15:14:33Z")

</div>

The situation I’m in is that I have some custom arrays and some custom implementation of multiplication, e.g. function (A::CustomMatrix \* b::CustomVector) some\_specialized\_code() end Now if I use Zygote to derivati…

---

## [How to make a function defined from getindex type safe?](https://discourse.julialang.org/t/how-to-make-a-function-defined-from-getindex-type-safe/32647)

<div class="topic-metadata">

**Author:** [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Replies:** 4\
**Last updated:** [December 24, 2019, 1:17pm UTC](https://discourse.julialang.org/t/how-to-make-a-function-defined-from-getindex-type-safe/32647 "2019-12-24T13:17:29Z")

</div>

testv = \[1,2,3,4,5\] testf(n) = testv\[n+1\] @code\_warntype testf(4) This gives me Variables #self#::Core.Compiler.Const(testf, false) n::Int64 Body::Any 1 ─ %1 = (n + 1)::Int64 │ %2 = Base.getindex(Main.testv, %1)…

---

## [Debugger.jl, @bp does not work](https://discourse.julialang.org/t/debugger-jl-bp-does-not-work/22154)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 8\
**Last updated:** [March 21, 2019, 6:13pm UTC](https://discourse.julialang.org/t/debugger-jl-bp-does-not-work/22154 "2019-03-21T18:13:49Z")

</div>

I get an error when I try to debug a Julia file from REPL as follows. The source file main.jl # main.jl using Debugger function my\_add(a::Int, b::Int) @bp # want to stop here c = a + b return c…

---

## [Multithreading and fetch() type stability](https://discourse.julialang.org/t/multithreading-and-fetch-type-stability/32465)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 11\
**Last updated:** [December 23, 2019, 8:30pm UTC](https://discourse.julialang.org/t/multithreading-and-fetch-type-stability/32465 "2019-12-23T20:30:42Z")

</div>

Hello, I was poking around at the new @spawn macro and multithreading in general. I did a @code\_warntype on a function were i’d set up some task with t = @spawn fun(args). The signature of fun is (n::Int)::Int in the …

---

## [Implementing FashionMNIST in Flux ! Help needed](https://discourse.julialang.org/t/implementing-fashionmnist-in-flux-help-needed/32627)

<div class="topic-metadata">

**Author:** [@PseudoCodeNerd](https://discourse.julialang.org/u/PseudoCodeNerd)\
**Replies:** 0\
**Last updated:** [December 23, 2019, 6:03pm UTC](https://discourse.julialang.org/t/implementing-fashionmnist-in-flux-help-needed/32627 "2019-12-23T18:03:31Z")

</div>

Hello there People at Julia ! I was recently able to successfully run a MNIST ml program using Flux. I wanna move towards using FashionMNIST data-set (which is considered to be a tougher MNIST to benchmark on). Can anyb…

---

## [Sublime Text 3 for Linux: portable and preconfigured for Julia](https://discourse.julialang.org/t/sublime-text-3-for-linux-portable-and-preconfigured-for-julia/30306)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [December 23, 2019, 4:14pm UTC](https://discourse.julialang.org/t/sublime-text-3-for-linux-portable-and-preconfigured-for-julia/30306 "2019-12-23T16:14:28Z")

</div>

https://github.com/PetrKryslUCSD/HowToUseJuliaWithSublimeText3 Feedback will be appreciated.

---

## [ForwardDiff and Array of Arrays](https://discourse.julialang.org/t/forwarddiff-and-array-of-arrays/32602)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [December 23, 2019, 3:59pm UTC](https://discourse.julialang.org/t/forwarddiff-and-array-of-arrays/32602 "2019-12-23T15:59:07Z")

</div>

Is it possible to get ForwardDiff to work with arrays of arrays? I’m thinking about something like this: using LinearAlgebra using ForwardDiff using Random function f(X) return X\[1\]⋅cross(X\[2\],X\[3\]) end Random.se…

---

## [How to use the output of log\_fit in abline plotted in a loglog plot in Julia](https://discourse.julialang.org/t/how-to-use-the-output-of-log-fit-in-abline-plotted-in-a-loglog-plot-in-julia/32562)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 4\
**Last updated:** [December 23, 2019, 12:58pm UTC](https://discourse.julialang.org/t/how-to-use-the-output-of-log-fit-in-abline-plotted-in-a-loglog-plot-in-julia/32562 "2019-12-23T12:58:27Z")

</div>

Dear community, For log\_fit, the equation is log y=a+b\*log x, whose output coefficients are ‘a’ and ‘b’. Slope ‘b’ is applied in view of log x, so how can I plot the non-linear regression in a loglog plot on scale of x? …

---

## [Subtyping of Tuple's with abstract types and type variables](https://discourse.julialang.org/t/subtyping-of-tuples-with-abstract-types-and-type-variables/32596)

<div class="topic-metadata">

**Author:** [@bug-brain](https://discourse.julialang.org/u/bug-brain)\
**Replies:** 2\
**Last updated:** [December 23, 2019, 10:45am UTC](https://discourse.julialang.org/t/subtyping-of-tuples-with-abstract-types-and-type-variables/32596 "2019-12-23T10:45:42Z")

</div>

When checking for subtype relations of tuples with 2 or elements Julia does not find a match for a type variable on the right side if the types on the left side are abstract or have a common super type. The below example…

---

## [Null stream implementation](https://discourse.julialang.org/t/null-stream-implementation/32610)

<div class="topic-metadata">

**Author:** [@scelles](https://discourse.julialang.org/u/scelles)\
**Replies:** 2\
**Last updated:** [December 23, 2019, 8:33am UTC](https://discourse.julialang.org/t/null-stream-implementation/32610 "2019-12-23T08:33:25Z")

</div>

Hello, I’m looking for a Julia implementation of a stream (inheriting from IO) that acts like /dev/null (but usable for any OS). It would just ignore anything that is streamed to it (ie it should redirect file IO to no…

---

## [2 dimensional array to one dimensional](https://discourse.julialang.org/t/2-dimensional-array-to-one-dimensional/32574)

<div class="topic-metadata">

**Author:** [@imrankhan\_juliaLang](https://discourse.julialang.org/u/imrankhan_juliaLang)\
**Replies:** 6\
**Last updated:** [December 23, 2019, 2:56am UTC](https://discourse.julialang.org/t/2-dimensional-array-to-one-dimensional/32574 "2019-12-23T02:56:28Z")

</div>

how can i make 2 dimensional array to one dimensional Like arr = \[\[1,2\], \[3,4\]\] To one, two, three, four = something to transport NB: Is like numpy ravel method

---

## [Compiler performance tips](https://discourse.julialang.org/t/compiler-performance-tips/32559)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 3\
**Last updated:** [December 23, 2019, 1:11am UTC](https://discourse.julialang.org/t/compiler-performance-tips/32559 "2019-12-23T01:11:53Z")

</div>

Hi! I find the julia performance tips page very useful. I am wondering if there is a similar document with some tips in order to reduce compiler latency and start up times. E.g., which patterns to use, which to avoid, e…

---

## [Unable to install PackageCompiler](https://discourse.julialang.org/t/unable-to-install-packagecompiler/32587)

<div class="topic-metadata">

**Author:** [@johannspies](https://discourse.julialang.org/u/johannspies)\
**Replies:** 2\
**Last updated:** [December 22, 2019, 11:31pm UTC](https://discourse.julialang.org/t/unable-to-install-packagecompiler/32587 "2019-12-22T23:31:32Z")

</div>

I am not able to install PackageCompiler: (v1.3) pkg\> rm -m PackageCompiler Updating \`~/.julia/environments/v1.3/Project.toml\` \[0cdbb3b1\] - JuliaManager v0.1.1 Updating \`~/.julia/environments/v1.3/Manifest.toml\` …

---

## [Coimbination of categories / nominal features encoding](https://discourse.julialang.org/t/coimbination-of-categories-nominal-features-encoding/32447)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 12\
**Last updated:** [December 22, 2019, 7:06pm UTC](https://discourse.julialang.org/t/coimbination-of-categories-nominal-features-encoding/32447 "2019-12-22T19:06:13Z")

</div>

There is CategoricalArray that supports only mutually exclusive categories (you can have only one caterory from a dictionary). But what if I need to store a combinations of several binary features, say: “Visible”: tru…

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

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