# General Usage

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

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

**Page:** 906

---

## [PyPlot Animation using ArtistAnimation](https://discourse.julialang.org/t/pyplot-animation-using-artistanimation/19261)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 0\
**Last updated:** [January 4, 2019, 5:42am UTC](https://discourse.julialang.org/t/pyplot-animation-using-artistanimation/19261 "2019-01-04T05:42:45Z")

</div>

Can anyone tell me why the code below is not working (novice here)? The objective is to use PyPlot’s ArtistAnimation function to create a simple animation. I can do it with FuncAnimation, but it is important for my app…

---

## [Power function not inlined optimally](https://discourse.julialang.org/t/power-function-not-inlined-optimally/19264)

<div class="topic-metadata">

**Author:** [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Replies:** 5\
**Last updated:** [January 4, 2019, 4:26pm UTC](https://discourse.julialang.org/t/power-function-not-inlined-optimally/19264 "2019-01-04T16:26:18Z")

</div>

The following function: julia\> f(x)=x^5, x^3 f (generic function with 1 method) is compiled into: julia\> @code\_llvm f(2) ; Function f ; Location: REPL\[10\]:1 define void @julia\_f\_35717(\[2 x i64\]\* noalias nocapture sre…

---

## [More v0.7 woes - cannot import Plots in notebook with more than one worker](https://discourse.julialang.org/t/more-v0-7-woes-cannot-import-plots-in-notebook-with-more-than-one-worker/19259)

<div class="topic-metadata">

**Author:** [@ronubi](https://discourse.julialang.org/u/ronubi)\
**Replies:** 4\
**Last updated:** [January 4, 2019, 1:45pm UTC](https://discourse.julialang.org/t/more-v0-7-woes-cannot-import-plots-in-notebook-with-more-than-one-worker/19259 "2019-01-04T13:45:54Z")

</div>

I created a notebook kernel with two workers, and now cannot import Plots Here’s the error: On worker 2: InitError: LoadError: MethodError: no method matching show(::Base.PipeEndpoint, ::MIME{Symbol("text/html")}, ::S…

---

## [Guidelines to distinguish concrete from abstract types](https://discourse.julialang.org/t/guidelines-to-distinguish-concrete-from-abstract-types/19162)

<div class="topic-metadata">

**Author:** [@gcalderone](https://discourse.julialang.org/u/gcalderone)\
**Replies:** 3\
**Last updated:** [January 4, 2019, 10:00am UTC](https://discourse.julialang.org/t/guidelines-to-distinguish-concrete-from-abstract-types/19162 "2019-01-04T10:00:35Z")

</div>

Is there any proposed guideline to name types and distinguish whether is it a concrete or abstract type? This would be useful to check whether a package has been developed following this rule: Style Guide · The Julia L…

---

## [Implementing own \`size()\` function for a \`struct\` and its performance](https://discourse.julialang.org/t/implementing-own-size-function-for-a-struct-and-its-performance/19008)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 14\
**Last updated:** [January 4, 2019, 8:45am UTC](https://discourse.julialang.org/t/implementing-own-size-function-for-a-struct-and-its-performance/19008 "2019-01-04T08:45:20Z")

</div>

I am trying to have a struct for one of my types, that (among others for the nonMWE) keeps an array as a value. I would like to have a size function that works on the encapsulated array. The MWE is as follows import Bas…

---

## [Correct way of using value type argument](https://discourse.julialang.org/t/correct-way-of-using-value-type-argument/19239)

<div class="topic-metadata">

**Author:** [@aortizb](https://discourse.julialang.org/u/aortizb)\
**Replies:** 9\
**Last updated:** [January 4, 2019, 8:21am UTC](https://discourse.julialang.org/t/correct-way-of-using-value-type-argument/19239 "2019-01-04T08:21:18Z")

</div>

In a separate post (https://discourse.julialang.org/t/type-stability-issues-when-using-staticarrays/19126), I learned some things about value type argument. I still have a doubt. In the following code, it seems to me tha…

---

## [Documenter workflow question](https://discourse.julialang.org/t/documenter-workflow-question/19242)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 4\
**Last updated:** [January 4, 2019, 7:29am UTC](https://discourse.julialang.org/t/documenter-workflow-question/19242 "2019-01-04T07:29:39Z")

</div>

I’ve started using Documenter.jl to build up documentation for a (non-public) package I maintain. Because of the somewhat limited tools available to me and my team, I think I’ve come to the conclusion that the best way t…

---

## [Suggestions needed on analysing large number of csv files](https://discourse.julialang.org/t/suggestions-needed-on-analysing-large-number-of-csv-files/19183)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 25\
**Last updated:** [January 4, 2019, 1:58am UTC](https://discourse.julialang.org/t/suggestions-needed-on-analysing-large-number-of-csv-files/19183 "2019-01-04T01:58:03Z")

</div>

I have 100 csv files. They have the same column names. Of the columns, about 40 are attributes, and 10 are results. I need to go through all the rows of these files and sum up the results that correspond to the same a…

---

## [@simd with array views](https://discourse.julialang.org/t/simd-with-array-views/19207)

<div class="topic-metadata">

**Author:** [@Duls91](https://discourse.julialang.org/u/Duls91)\
**Replies:** 5\
**Last updated:** [January 4, 2019, 1:17am UTC](https://discourse.julialang.org/t/simd-with-array-views/19207 "2019-01-04T01:17:19Z")

</div>

Hello everyone and Happy New Year! I have a decrease in performance in my cross-correlation function when I use array views. I am comparing functions without views, with views and one with the classical imfilter from Im…

---

## [Prefered pattern for generators?](https://discourse.julialang.org/t/prefered-pattern-for-generators/18749)

<div class="topic-metadata">

**Author:** [@ninjaaron](https://discourse.julialang.org/u/ninjaaron)\
**Replies:** 12\
**Last updated:** [January 3, 2019, 5:40pm UTC](https://discourse.julialang.org/t/prefered-pattern-for-generators/18749 "2019-01-03T17:40:53Z")

</div>

Hi. First thread. we all know the generator pattern from Python and elsewhere. def mygenerator(): for i in range(10): yield i I know the “proper” way to do this is to write a struct with a method on Base.i…

---

## [Tab autocomplete in Pkg REPL-mode](https://discourse.julialang.org/t/tab-autocomplete-in-pkg-repl-mode/19214)

<div class="topic-metadata">

**Author:** [@jjstickel](https://discourse.julialang.org/u/jjstickel)\
**Replies:** 3\
**Last updated:** [January 3, 2019, 4:16pm UTC](https://discourse.julialang.org/t/tab-autocomplete-in-pkg-repl-mode/19214 "2019-01-03T16:16:52Z")

</div>

I mostly run julia from the REPL in a system shell (Mac or Linux). Doing include("path/to/envir\[tab\] ... will complete the path or show options if not unique. However, in Pkg mode (i.e., via ‘\]’), tab autocomplete doesn’…

---

## [Type stability issues when using StaticArrays](https://discourse.julialang.org/t/type-stability-issues-when-using-staticarrays/19126)

<div class="topic-metadata">

**Author:** [@aortizb](https://discourse.julialang.org/u/aortizb)\
**Replies:** 24\
**Last updated:** [January 3, 2019, 3:36pm UTC](https://discourse.julialang.org/t/type-stability-issues-when-using-staticarrays/19126 "2019-01-03T15:36:34Z")

</div>

Hi all: looking at some piece of a code I am developing, I wanted to make sure that there is no type stability issues. So, in the process of reviewing of my code I found a type stability issue when using StaticArrays. Be…

---

## [How to detect if an object is a user-defined struct](https://discourse.julialang.org/t/how-to-detect-if-an-object-is-a-user-defined-struct/19165)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 17\
**Last updated:** [January 3, 2019, 1:58pm UTC](https://discourse.julialang.org/t/how-to-detect-if-an-object-is-a-user-defined-struct/19165 "2019-01-03T13:58:17Z")

</div>

Hi, I’m building a function that receives an object as input, and depending on whether the type of this object is standard or user-defined (=composite type defined by the user through a struct) it must do one thing or a…

---

## [Current differences in ::T vs T where T](https://discourse.julialang.org/t/current-differences-in-t-vs-t-where-t/19231)

<div class="topic-metadata">

**Author:** [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Replies:** 3\
**Last updated:** [January 3, 2019, 10:25am UTC](https://discourse.julialang.org/t/current-differences-in-t-vs-t-where-t/19231 "2019-01-03T10:25:01Z")

</div>

I was asked what was the current status of the differences between, magic(obj::Any) = zero(typeof(obj)) and magic(obj::T) where T = zero(T) I believe in 0.6 there were some issues being worked out with performance de…

---

## [Trouble scoping functions with module statement in v0.7](https://discourse.julialang.org/t/trouble-scoping-functions-with-module-statement-in-v0-7/19212)

<div class="topic-metadata">

**Author:** [@ronubi](https://discourse.julialang.org/u/ronubi)\
**Replies:** 1\
**Last updated:** [January 2, 2019, 11:27pm UTC](https://discourse.julialang.org/t/trouble-scoping-functions-with-module-statement-in-v0-7/19212 "2019-01-02T23:27:22Z")

</div>

Not sure if this is good practice, but in v0.6 I used module to create a scoping level so that a group of related included code wouldn’t have name conflicts with anything else I was writing. Specifically: module m …

---

## [Understanding of mutable struct](https://discourse.julialang.org/t/understanding-of-mutable-struct/19206)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 4\
**Last updated:** [January 2, 2019, 11:04pm UTC](https://discourse.julialang.org/t/understanding-of-mutable-struct/19206 "2019-01-02T23:04:50Z")

</div>

Suppose I define a mutable struc as follows: mutable struct Np \<: Number a::Float64 b::Int c::ComplexF64 d::Float64 end Assigning numerical values: np = Np(1.2, 3, 1+4im, 3 ); which results in: \> julia\> …

---

## [Broadcasted assignment of custom types](https://discourse.julialang.org/t/broadcasted-assignment-of-custom-types/19198)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 10\
**Last updated:** [January 2, 2019, 7:54pm UTC](https://discourse.julialang.org/t/broadcasted-assignment-of-custom-types/19198 "2019-01-02T19:54:32Z")

</div>

This works natively: a = Vector{Int}(undef, 2) a .= 2 However, this does not work, failing with a cryptic error: struct Foo x::Int end a = Vector{Foo}(undef, 2) a .= Foo(2) #= ERROR: MethodError: no method matchin…

---

## [Strange behavior with array calls](https://discourse.julialang.org/t/strange-behavior-with-array-calls/19200)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 8\
**Last updated:** [January 2, 2019, 5:19pm UTC](https://discourse.julialang.org/t/strange-behavior-with-array-calls/19200 "2019-01-02T17:19:42Z")

</div>

Why is getindex(g,x) slower than g\[x\]? julia\> g = \[1,2,3\] 3-element Array{Int64,1}: 1 2 3 julia\> f(g,x) = g\[x\] julia\> @btime f($g,2) 0.025 ns (0 allocations: 0 bytes) 2 julia\> @btime getindex($g,2) 1.813 ns (0…

---

## [How to use getproperty efficiently?](https://discourse.julialang.org/t/how-to-use-getproperty-efficiently/19177)

<div class="topic-metadata">

**Author:** [@anon43133060](https://discourse.julialang.org/u/anon43133060)\
**Replies:** 10\
**Last updated:** [January 2, 2019, 4:11pm UTC](https://discourse.julialang.org/t/how-to-use-getproperty-efficiently/19177 "2019-01-02T16:11:15Z")

</div>

Inspired by Zero-Cost Abstractions I tried to implement field based access for a dictionary. It kinda works, but could it be improved? Why isn’t the last function working as fast as it should? I’m using julia v1.0.3. us…

---

## [Custom flatten version is faster than \`flatten()\`](https://discourse.julialang.org/t/custom-flatten-version-is-faster-than-flatten/16048)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 4\
**Last updated:** [January 2, 2019, 9:38am UTC](https://discourse.julialang.org/t/custom-flatten-version-is-faster-than-flatten/16048 "2019-01-02T09:38:39Z")

</div>

Consider an array of matrices i.e. a = \[rand(3, 3) for i = 1:1000\]. I have two ways to “flatten” this array: function naive\_flatten(a) ret = Array{Float64}(undef, 0) @inbounds for i=1:length(a) append!(…

---

## [Need help to write a conic constraint](https://discourse.julialang.org/t/need-help-to-write-a-conic-constraint/19181)

<div class="topic-metadata">

**Author:** [@asavasci](https://discourse.julialang.org/u/asavasci)\
**Replies:** 0\
**Last updated:** [January 2, 2019, 8:04am UTC](https://discourse.julialang.org/t/need-help-to-write-a-conic-constraint/19181 "2019-01-02T08:04:12Z")

</div>

Hello Everyone, I am getting error when I try to code the conic constraint as @constraint(m, soc\[t=1:T, i=1:N\], norm( \[ 2\*p\[t,i\], \[g\[t,i\]-u\[t,i\]\]) \<= g\[t,i\]+u\[t,i\] ) the error message : JuMP does not support mixing…

---

## [There is a bug in this function and I can't figure out what it is](https://discourse.julialang.org/t/there-is-a-bug-in-this-function-and-i-cant-figure-out-what-it-is/19150)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 5\
**Last updated:** [January 2, 2019, 5:00am UTC](https://discourse.julialang.org/t/there-is-a-bug-in-this-function-and-i-cant-figure-out-what-it-is/19150 "2019-01-02T05:00:40Z")

</div>

This is related to my previous question which was lacking a lot of information and was not reproducible. In short, in Julia’s Distributed library, I believe there is a bug that’s preventing me from connecting to our univ…

---

## [UniformScaling to identity matrix](https://discourse.julialang.org/t/uniformscaling-to-identity-matrix/19112)

<div class="topic-metadata">

**Author:** [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Replies:** 2\
**Last updated:** [January 1, 2019, 10:13pm UTC](https://discourse.julialang.org/t/uniformscaling-to-identity-matrix/19112 "2019-01-01T22:13:28Z")

</div>

Sometimes, it is necessary to convert a UniformScaling to an actual matrix of values. In these cases, I call some form of Matrix(I, n, n). While this is not that bad, it can make otherwise very readable code slightly le…

---

## [Type stable code is more expensive than type unstable code. Why?](https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171)

<div class="topic-metadata">

**Author:** [@aortizb](https://discourse.julialang.org/u/aortizb)\
**Replies:** 4\
**Last updated:** [January 1, 2019, 9:00pm UTC](https://discourse.julialang.org/t/type-stable-code-is-more-expensive-than-type-unstable-code-why/19171 "2019-01-01T21:00:27Z")

</div>

I wrote a small code (following the advices I got from other post) just for learning some things about type stability. The two first definitions of foo() are type stable. The third definition is not. However, the type un…

---

## [Confusing error message](https://discourse.julialang.org/t/confusing-error-message/18997)

<div class="topic-metadata">

**Author:** [@peters](https://discourse.julialang.org/u/peters)\
**Replies:** 3\
**Last updated:** [January 1, 2019, 8:43pm UTC](https://discourse.julialang.org/t/confusing-error-message/18997 "2019-01-01T20:43:20Z")

</div>

Am I only one who has been confused with the following error message? julia\> pi = 3 ERROR: cannot assign variable MathConstants.pi from module Main The error message sounds like, I cannot assign the variable pi (to so…

---

## [How to edit source code of Julia](https://discourse.julialang.org/t/how-to-edit-source-code-of-julia/19156)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 6\
**Last updated:** [January 1, 2019, 4:19pm UTC](https://discourse.julialang.org/t/how-to-edit-source-code-of-julia/19156 "2019-01-01T16:19:19Z")

</div>

I believe I may have found a bug in Julia source code but I can’t pinpoint the exact line (\[see this topic\])(There is a bug in this function and I can't figure out what it is). What I want to do is modify the Distributed…

---

## [Concatenating matrices](https://discourse.julialang.org/t/concatenating-matrices/19157)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 3\
**Last updated:** [January 1, 2019, 10:55am UTC](https://discourse.julialang.org/t/concatenating-matrices/19157 "2019-01-01T10:55:13Z")

</div>

I have a list of matrices passed into a function. I want to vertically concatenate them into a single matrix. I used to be able to do this: foo = \[\[1 2; 3 4; 5 6\], \[7 8; 9 10; 11 12\]\] A = \[\] for m in foo A = \[A; m\] …

---

## [Constructors for Primitive types](https://discourse.julialang.org/t/constructors-for-primitive-types/19139)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 5\
**Last updated:** [December 31, 2018, 9:25pm UTC](https://discourse.julialang.org/t/constructors-for-primitive-types/19139 "2018-12-31T21:25:31Z")

</div>

My goal is to have my own primitive integer type, for which I need to specialize dispatch. primitive type Basis{V,G} \<: Unsigned 16 end How do I create a constructor for it? The documentation does not explain how. jul…

---

## [Julia v1.0 builds for 64-bit ARM?](https://discourse.julialang.org/t/julia-v1-0-builds-for-64-bit-arm/13550)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 5\
**Last updated:** [December 31, 2018, 2:26pm UTC](https://discourse.julialang.org/t/julia-v1-0-builds-for-64-bit-arm/13550 "2018-12-31T14:26:54Z")

</div>

Just a quick question, will there be official 64-bit ARM (armv8-a) builds of Julia v1.0? Cheers, Oliver

---

## [Refreshing Gtk widget from inside a loop](https://discourse.julialang.org/t/refreshing-gtk-widget-from-inside-a-loop/19117)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 4\
**Last updated:** [December 31, 2018, 11:48am UTC](https://discourse.julialang.org/t/refreshing-gtk-widget-from-inside-a-loop/19117 "2018-12-31T11:48:13Z")

</div>

I placed within the main GtkWindow a GtkEntry widget to show the step position (what is already done) within a running function. However it shows only the fist and the last step position. And I could not figure out how t…

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

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