# General Usage

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

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

**Page:** 804

---

## [Julia style? Arrays/matrix vs structs](https://discourse.julialang.org/t/julia-style-arrays-matrix-vs-structs/32424)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 19\
**Last updated:** [December 18, 2019, 8:08pm UTC](https://discourse.julialang.org/t/julia-style-arrays-matrix-vs-structs/32424 "2019-12-18T20:08:33Z")

</div>

Suppose I want to write a simulation of a bunch of particles interacting. I could for example represent them in an array of say 3x1000 floats for position and another for velocity. Maybe a third array would have some ide…

---

## [Creating a function from a subset of the methods of another function](https://discourse.julialang.org/t/creating-a-function-from-a-subset-of-the-methods-of-another-function/32403)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 7\
**Last updated:** [December 18, 2019, 6:10pm UTC](https://discourse.julialang.org/t/creating-a-function-from-a-subset-of-the-methods-of-another-function/32403 "2019-12-18T18:10:32Z")

</div>

lets say i have a function f with a lot methods: julia\>methods(f) #invented output \[1\] f(x::Int64, y::Int64) in PackageA at \\.julia\\packages\\PackageA\\yPcDQ\\src\\functions.jl:43 \[2\] f(x::Float64, y::Float64) in Main at RE…

---

## [Face this run time error](https://discourse.julialang.org/t/face-this-run-time-error/32418)

<div class="topic-metadata">

**Author:** [@imrankhan\_juliaLang](https://discourse.julialang.org/u/imrankhan_juliaLang)\
**Replies:** 3\
**Last updated:** [December 18, 2019, 4:34pm UTC](https://discourse.julialang.org/t/face-this-run-time-error/32418 "2019-12-18T16:34:46Z")

</div>

I face this error in MJL pakage

---

## [Julia 1.3 selection of datafarme's column with :Col is deprecated](https://discourse.julialang.org/t/julia-1-3-selection-of-datafarmes-column-with-col-is-deprecated/32430)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 5\
**Last updated:** [December 18, 2019, 12:58pm UTC](https://discourse.julialang.org/t/julia-1-3-selection-of-datafarmes-column-with-col-is-deprecated/32430 "2019-12-18T12:58:39Z")

</div>

Hello, I recently upgraded to Julia 1.3. Before I was using df\[:Column\] to select a dataframe’s column, but now I get the error: Julia \> Warning: getindex(df::DataFrame, col\_ind::ColumnIndex)is deprecated, usedf\[!, col…

---

## [A list of plots as an argument for the plot-command of Plots.jl](https://discourse.julialang.org/t/a-list-of-plots-as-an-argument-for-the-plot-command-of-plots-jl/32433)

<div class="topic-metadata">

**Author:** [@Volker](https://discourse.julialang.org/u/Volker)\
**Replies:** 2\
**Last updated:** [December 18, 2019, 10:48am UTC](https://discourse.julialang.org/t/a-list-of-plots-as-an-argument-for-the-plot-command-of-plots-jl/32433 "2019-12-18T10:48:25Z")

</div>

If you consider the following code, you will get a list of plots. using Plots plotly() var\_names = \["var1", "var2", "var3"\] # initialize regression matrices for training, validation and test X1 = rand(20, 3) X2 = r…

---

## [How to run Julia in Android Studio](https://discourse.julialang.org/t/how-to-run-julia-in-android-studio/32426)

<div class="topic-metadata">

**Author:** [@William\_willson](https://discourse.julialang.org/u/William_willson)\
**Replies:** 3\
**Last updated:** [December 18, 2019, 8:32am UTC](https://discourse.julialang.org/t/how-to-run-julia-in-android-studio/32426 "2019-12-18T08:32:01Z")

</div>

I want to use Julia for app development so anyone can help me in that to use it

---

## [What is the type of #undef](https://discourse.julialang.org/t/what-is-the-type-of-undef/32411)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 9\
**Last updated:** [December 18, 2019, 7:14am UTC](https://discourse.julialang.org/t/what-is-the-type-of-undef/32411 "2019-12-18T07:14:43Z")

</div>

struct MMX x MMX() = new() end t = MMX() \> MMX(#undef) typeof(t.x) Basically I am asking what is the type of field x in this case?

---

## [Writing effective parallel code](https://discourse.julialang.org/t/writing-effective-parallel-code/32407)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 8\
**Last updated:** [December 18, 2019, 4:38am UTC](https://discourse.julialang.org/t/writing-effective-parallel-code/32407 "2019-12-18T04:38:41Z")

</div>

I’m trying to think more seriously about writing Julia code that is either thread or worker parallel to make better use of high thread machines or individual cluster nodes with many CPUs. While I recognize that in genera…

---

## [Pkg.add("Gtk") / Unsatisfiable requirement](https://discourse.julialang.org/t/pkg-add-gtk-unsatisfiable-requirement/32394)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [December 17, 2019, 9:18pm UTC](https://discourse.julialang.org/t/pkg-add-gtk-unsatisfiable-requirement/32394 "2019-12-17T21:18:42Z")

</div>

import Pkg Pkg.add(“Gtk”) results in… ERROR: Unsatisfiable requirements detected for package Homebrew \[d9be37ee\]: Homebrew \[d9be37ee\] log: ├─possible versions are: \[0.6.4, 0.6.6, 0.7.0-0.7.1\] or uninstalled ├─restr…

---

## [Tips/guidance for identifying the source of a deadlock when multithreading?](https://discourse.julialang.org/t/tips-guidance-for-identifying-the-source-of-a-deadlock-when-multithreading/32358)

<div class="topic-metadata">

**Author:** [@vlandau](https://discourse.julialang.org/u/vlandau)\
**Replies:** 0\
**Last updated:** [December 16, 2019, 10:34pm UTC](https://discourse.julialang.org/t/tips-guidance-for-identifying-the-source-of-a-deadlock-when-multithreading/32358 "2019-12-16T22:34:27Z")

</div>

I suspect that my Julia package, Omniscape.jl, is running into a deadlock when testing on Windows in Julia 1.3 (everything passes in 1.2) in Travis and Appveyor. Basically, it just hangs a few dozen iterations into a @th…

---

## [How to recompile a package I am developing](https://discourse.julialang.org/t/how-to-recompile-a-package-i-am-developing/32385)

<div class="topic-metadata">

**Author:** [@gmouts](https://discourse.julialang.org/u/gmouts)\
**Replies:** 2\
**Last updated:** [December 17, 2019, 2:54pm UTC](https://discourse.julialang.org/t/how-to-recompile-a-package-i-am-developing/32385 "2019-12-17T14:54:49Z")

</div>

I guess it is an elementary question but I couldn’t figure it out. I am developing a package. How can I tell Julia to recompile it after I made some changes to the code?

---

## [MethodError: no method matching length(::CSV.Row{false})](https://discourse.julialang.org/t/methoderror-no-method-matching-length-csv-row-false/32386)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [December 17, 2019, 2:57pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-length-csv-row-false/32386 "2019-12-17T14:57:56Z")

</div>

using CSV using DataFrames fln = "myfln.csv" for (i,row) in enumerate(CSV.File(fln)) if df.Resource\[i\] == 1 push!(df1,row) elseif df.Resource\[i\] == 2 push!(df2,row) elseif df.Resource\[i\] == …

---

## [GraphViz.jl](https://discourse.julialang.org/t/graphviz-jl/32374)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [December 17, 2019, 8:22am UTC](https://discourse.julialang.org/t/graphviz-jl/32374 "2019-12-17T08:22:34Z")

</div>

I would like to use GraphViz.jl, however Pkg.add(“GraphViz”) results in ERROR: The following package names could not be resolved: \* GraphViz (not found in project, manifest or registry) Please specify by known \`name=u…

---

## [PackageCompiler error on Windows - Task cannot be serialized](https://discourse.julialang.org/t/packagecompiler-error-on-windows-task-cannot-be-serialized/32031)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 2\
**Last updated:** [December 17, 2019, 6:42am UTC](https://discourse.julialang.org/t/packagecompiler-error-on-windows-task-cannot-be-serialized/32031 "2019-12-17T06:42:39Z")

</div>

I know there were older posts about this, but I could not find a solution. Has anyone managed to compile Plots to a system image on windows? I tried on a fresh install of Julia 1.3 (.julia folder deleted and added only t…

---

## [Collections of quadratic expressions causes @expression to throw error](https://discourse.julialang.org/t/collections-of-quadratic-expressions-causes-expression-to-throw-error/32359)

<div class="topic-metadata">

**Author:** [@Stivanification](https://discourse.julialang.org/u/Stivanification)\
**Replies:** 2\
**Last updated:** [December 16, 2019, 11:51pm UTC](https://discourse.julialang.org/t/collections-of-quadratic-expressions-causes-expression-to-throw-error/32359 "2019-12-16T23:51:27Z")

</div>

Hi, As the title says, I’m getting an error trying to create an array of quadratic expressions in JuMP. I’m using julia v1.1.0 and JuMP v0.20.1. Minimal example: using JuMP model = Model() @variables(model, begin …

---

## [What means 'at' and 'rt' in \`@cfunction\`?](https://discourse.julialang.org/t/what-means-at-and-rt-in-cfunction/32345)

<div class="topic-metadata">

**Author:** [@swissr](https://discourse.julialang.org/u/swissr)\
**Replies:** 2\
**Last updated:** [December 16, 2019, 9:56pm UTC](https://discourse.julialang.org/t/what-means-at-and-rt-in-cfunction/32345 "2019-12-16T21:56:29Z")

</div>

A tiny detail, but I wonder, for what the “at” and “rt” argument names stand in the cfunction macro? From the help (@cfunction(callable, ReturnType, (ArgumentTypes...,)) -\> Ptr{Cvoid}…) I would have thought “argument ty…

---

## [Relative/absolute tolerance per element](https://discourse.julialang.org/t/relative-absolute-tolerance-per-element/32356)

<div class="topic-metadata">

**Author:** [@fishy](https://discourse.julialang.org/u/fishy)\
**Replies:** 0\
**Last updated:** [December 16, 2019, 9:32pm UTC](https://discourse.julialang.org/t/relative-absolute-tolerance-per-element/32356 "2019-12-16T21:32:12Z")

</div>

I am using differentialequations.jl as the core of a 6DOF simulator for my company. We need to evaluate the behaviour of some very different sized vehicles and thus can run the solver with different tolerances. The state…

---

## [How do I skip an iteration of enumerator](https://discourse.julialang.org/t/how-do-i-skip-an-iteration-of-enumerator/32341)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 4\
**Last updated:** [December 16, 2019, 5:58pm UTC](https://discourse.julialang.org/t/how-do-i-skip-an-iteration-of-enumerator/32341 "2019-12-16T17:58:15Z")

</div>

Hi, I have the problem that I have an array which is changing during a loop and I have to skip certain elements. What is the best way to do this? a = \[1,2,3\] itr = Iterators.Stateful(a) for (i,el) in enumerate(itr) …

---

## [Subtyping with union as type parameter](https://discourse.julialang.org/t/subtyping-with-union-as-type-parameter/32326)

<div class="topic-metadata">

**Author:** [@rapus95](https://discourse.julialang.org/u/rapus95)\
**Replies:** 3\
**Last updated:** [December 16, 2019, 5:48pm UTC](https://discourse.julialang.org/t/subtyping-with-union-as-type-parameter/32326 "2019-12-16T17:48:31Z")

</div>

abstract type AbstractGrid{T, F, V} \<: AbstractArray{Union{T,Missing},2} end Why the Union{T,Missing} impedes the compilation here? I always get a UndefRefError: access to undefined reference. EDIT: Seems to be relate…

---

## [Having trouble installing the PortAudio package](https://discourse.julialang.org/t/having-trouble-installing-the-portaudio-package/31969)

<div class="topic-metadata">

**Author:** [@CoffeeTurtle1](https://discourse.julialang.org/u/CoffeeTurtle1)\
**Replies:** 30\
**Last updated:** [December 16, 2019, 3:54pm UTC](https://discourse.julialang.org/t/having-trouble-installing-the-portaudio-package/31969 "2019-12-16T15:54:24Z")

</div>

Hello, I cannot add the PortAudio package. When I run add https://github.com/JuliaAudio/PortAudio.jl I get this error: ERROR: failed to clone from https://github.com/JuliaAudio/PortAudio.jl, error: GitError(Code:ERROR…

---

## [Example for the Depth first multithread implementation performance gain as a motivation](https://discourse.julialang.org/t/example-for-the-depth-first-multithread-implementation-performance-gain-as-a-motivation/32328)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 3\
**Last updated:** [December 16, 2019, 3:12pm UTC](https://discourse.julialang.org/t/example-for-the-depth-first-multithread-implementation-performance-gain-as-a-motivation/32328 "2019-12-16T15:12:57Z")

</div>

Hello, I have found the following discussion on Julias multithread task scheduler implementation: https://news.ycombinator.com/item?id=20507628 As far as I can read from the comments, the main advantage and the “new th…

---

## [Strange type-inference](https://discourse.julialang.org/t/strange-type-inference/32334)

<div class="topic-metadata">

**Author:** [@tomhaber](https://discourse.julialang.org/u/tomhaber)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 12:49pm UTC](https://discourse.julialang.org/t/strange-type-inference/32334 "2019-12-16T12:49:40Z")

</div>

Hey, While trying to optimize some code, I ran into some strangely inferred types. The actual example behaves slightly different, but the following excerpt is equally strange. abstract type Node end mutable struct Job…

---

## [Receiving PyObject instead of Sym while appending result of a sympify to an empty list!](https://discourse.julialang.org/t/receiving-pyobject-instead-of-sym-while-appending-result-of-a-sympify-to-an-empty-list/32331)

<div class="topic-metadata">

**Author:** [@AmirHosein](https://discourse.julialang.org/u/AmirHosein)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 12:26pm UTC](https://discourse.julialang.org/t/receiving-pyobject-instead-of-sym-while-appending-result-of-a-sympify-to-an-empty-list/32331 "2019-12-16T12:26:55Z")

</div>

I’m using Julia version 1.1.1 and SymPy package version 1.0.7. There is an interesting behavior that I encountered while writing some codes in Julia which I’m going to share here and ask if there is a better way to deal …

---

## [Standard methods for input stream from console, serveing for OJ practice](https://discourse.julialang.org/t/standard-methods-for-input-stream-from-console-serveing-for-oj-practice/32329)

<div class="topic-metadata">

**Author:** [@LibraNeptune](https://discourse.julialang.org/u/LibraNeptune)\
**Replies:** 0\
**Last updated:** [December 16, 2019, 10:54am UTC](https://discourse.julialang.org/t/standard-methods-for-input-stream-from-console-serveing-for-oj-practice/32329 "2019-12-16T10:54:15Z")

</div>

Several types: Single-digit of numeric value input One-by-one numeric values input \[numeric array, split by blank\] Multiple lines of numeric values or component input mixed with strings Large-scale data input All the…

---

## [Julia 1.0.2 after installed JuliaPro 1.0.2.1](https://discourse.julialang.org/t/julia-1-0-2-after-installed-juliapro-1-0-2-1/18210)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 5\
**Last updated:** [December 16, 2019, 8:55am UTC](https://discourse.julialang.org/t/julia-1-0-2-after-installed-juliapro-1-0-2-1/18210 "2019-12-16T08:55:39Z")

</div>

When I run Julia inside Atom: I receive the following alert: Julia Client – Internal Error LoadError: ArgumentError: Package TokenManager not found in current path: - Run \`import Pkg; Pkg.add("TokenManager")\` to insta…

---

## [@generated function not picking up all the methods](https://discourse.julialang.org/t/generated-function-not-picking-up-all-the-methods/32318)

<div class="topic-metadata">

**Author:** [@fjarri](https://discourse.julialang.org/u/fjarri)\
**Replies:** 2\
**Last updated:** [December 16, 2019, 6:56am UTC](https://discourse.julialang.org/t/generated-function-not-picking-up-all-the-methods/32318 "2019-12-16T06:56:13Z")

</div>

The code: module Test func(x) = false @generated function test(x::T) where T if Base.invokelatest(func, T) :( 1 ) else :( 0 ) end end function test2(x::T) where T if func(T) 1 …

---

## [Defining broadcast for custom types - the example in the docs fails](https://discourse.julialang.org/t/defining-broadcast-for-custom-types-the-example-in-the-docs-fails/32291)

<div class="topic-metadata">

**Author:** [@fjarri](https://discourse.julialang.org/u/fjarri)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 1:12am UTC](https://discourse.julialang.org/t/defining-broadcast-for-custom-types-the-example-in-the-docs-fails/32291 "2019-12-16T01:12:01Z")

</div>

I’m using the example from the docs: struct ArrayAndChar{T,N} \<: AbstractArray{T,N} data::Array{T,N} char::Char end Base.size(A::ArrayAndChar) = size(A.data) Base.getindex(A::ArrayAndChar{T,N}, inds::Vararg{Int…

---

## [Keeping threads busy with 1.3 multiprocessing](https://discourse.julialang.org/t/keeping-threads-busy-with-1-3-multiprocessing/32253)

<div class="topic-metadata">

**Author:** [@babazaroni](https://discourse.julialang.org/u/babazaroni)\
**Replies:** 10\
**Last updated:** [December 16, 2019, 12:37am UTC](https://discourse.julialang.org/t/keeping-threads-busy-with-1-3-multiprocessing/32253 "2019-12-16T00:37:23Z")

</div>

I’m filtering 185 large historical monthly csv files and am allocating a thread to process a month. When I make an initial 185 thread requests, the system starts out allocating all available threads (8 on my machine) bu…

---

## [Unexpected solution for fewer equations than unknowns](https://discourse.julialang.org/t/unexpected-solution-for-fewer-equations-than-unknowns/32310)

<div class="topic-metadata">

**Author:** [@omortis](https://discourse.julialang.org/u/omortis)\
**Replies:** 4\
**Last updated:** [December 15, 2019, 10:58pm UTC](https://discourse.julialang.org/t/unexpected-solution-for-fewer-equations-than-unknowns/32310 "2019-12-15T22:58:38Z")

</div>

Hello, The following system has many solutions, per simple Gaussian reduction: x - 3y + z = 1 x + y + 2z = 14 Yet Julia actually gives me a unique solution: julia\> A = \[1 -3 1; 1 1 2\]; u = \[1, 14\]; julia\> A 2×3 A…

---

## [Anybody else find the new where syntax less than satisfactory?](https://discourse.julialang.org/t/anybody-else-find-the-new-where-syntax-less-than-satisfactory/4897)

<div class="topic-metadata">

**Author:** [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)\
**Replies:** 14\
**Last updated:** [December 15, 2019, 8:59pm UTC](https://discourse.julialang.org/t/anybody-else-find-the-new-where-syntax-less-than-satisfactory/4897 "2019-12-15T20:59:19Z")

</div>

things like same\_type(x::T, y::T) where {T} = true myappend(v::Vector{T}, x::T) where {T} = \[v…, x\] mytypeof(x::T) where {T} = T I find utterly confusing… It’s only really readable when there is an actual constraint…

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

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