# General Usage

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

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

**Page:** 874

---

## [Create a data frame with several self-defined types in Julia](https://discourse.julialang.org/t/create-a-data-frame-with-several-self-defined-types-in-julia/23345)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 4\
**Last updated:** [April 20, 2019, 2:47pm UTC](https://discourse.julialang.org/t/create-a-data-frame-with-several-self-defined-types-in-julia/23345 "2019-04-20T14:47:12Z")

</div>

I have a self-defined mutable struct as the following. @enum Fruits Apple Pear Orange I also have a .csv file, of which the second column is called fruitsCategories, which lists the categories of all the fruits. Then, …

---

## [How to convert DataValues.DataValue to Array? dane\_stat.data.values not works](https://discourse.julialang.org/t/how-to-convert-datavalues-datavalue-to-array-dane-stat-data-values-not-works/23233)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 7\
**Last updated:** [April 20, 2019, 2:33pm UTC](https://discourse.julialang.org/t/how-to-convert-datavalues-datavalue-to-array-dane-stat-data-values-not-works/23233 "2019-04-20T14:33:30Z")

</div>

I have somthing like below: How to convert dane\_stat.data to simple Array of Julia ? julia\> using ReadStat julia\> dane\_stat=read\_sav(savy\[j\]) julia\> typeof(dane\_stat.data) Array{Any,1} julia\> dane\_stat.data 958-element…

---

## [Generate matrices that satisfy multiple conditions](https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315)

<div class="topic-metadata">

**Author:** [@Mr.Robot](https://discourse.julialang.org/u/Mr.Robot)\
**Replies:** 2\
**Last updated:** [April 20, 2019, 6:04am UTC](https://discourse.julialang.org/t/generate-matrices-that-satisfy-multiple-conditions/23315 "2019-04-20T06:04:23Z")

</div>

Problem I am trying to verify the fact that an orthogonal upper (lower) triangular matrix has to be diagonal. Though it is pretty straightforward in maths, I could not correctly verify it using Julia. The way I could th…

---

## [How to improve performance of simple averaging function](https://discourse.julialang.org/t/how-to-improve-performance-of-simple-averaging-function/23303)

<div class="topic-metadata">

**Author:** [@flibe](https://discourse.julialang.org/u/flibe)\
**Replies:** 4\
**Last updated:** [April 19, 2019, 9:12pm UTC](https://discourse.julialang.org/t/how-to-improve-performance-of-simple-averaging-function/23303 "2019-04-19T21:12:40Z")

</div>

Dear All I have a program that is heavely based on functions like the my\_function! below. Is there a way to further improve speed and reduce memory allocation so as to make my\_function! as efficient as possible? using…

---

## [File read String error](https://discourse.julialang.org/t/file-read-string-error/23318)

<div class="topic-metadata">

**Author:** [@Stuart\_Rogers](https://discourse.julialang.org/u/Stuart_Rogers)\
**Replies:** 3\
**Last updated:** [April 19, 2019, 8:25pm UTC](https://discourse.julialang.org/t/file-read-string-error/23318 "2019-04-19T20:25:29Z")

</div>

I am getting the following error when I try to open and read in the contents of a text file as a String. I use Julia 0.6.4 on macOS. str = open(“ps\_4916\_p8.txt”) do file read(file,String) end ERROR: MethodError: Cann…

---

## [Quoting symbols](https://discourse.julialang.org/t/quoting-symbols/23308)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 6\
**Last updated:** [April 19, 2019, 4:59pm UTC](https://discourse.julialang.org/t/quoting-symbols/23308 "2019-04-19T16:59:10Z")

</div>

This seems like it should be simple, but it’s still tripping me up. I need to write a function that gives this result: julia\> f(:x) :(someArray\[:x\]) Interpolation gives me a “raw” x, and I’m having a surprisingly hard …

---

## [Generate random \`struct\`](https://discourse.julialang.org/t/generate-random-struct/23294)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 3\
**Last updated:** [April 19, 2019, 1:53pm UTC](https://discourse.julialang.org/t/generate-random-struct/23294 "2019-04-19T13:53:36Z")

</div>

I’m trying to implement an API which supports something along these lines: struct MyObject field\_one field\_two field\_three end using Distributions object\_dist = MyObject(field\_one = Normal(0, 2), field\_two…

---

## [Trouble registering package](https://discourse.julialang.org/t/trouble-registering-package/22896)

<div class="topic-metadata">

**Author:** [@joshua\_jones](https://discourse.julialang.org/u/joshua_jones)\
**Replies:** 10\
**Last updated:** [April 19, 2019, 11:13am UTC](https://discourse.julialang.org/t/trouble-registering-package/22896 "2019-04-19T11:13:13Z")

</div>

So, I’ve tried registering SeisIO.jl many times now over the course of 2+ years, including the new system that will take effect tomorrow, and it never seems to get registered. I checked for naming conflicts in the past …

---

## [Is there an easy way to parallelise matrix multiplication?](https://discourse.julialang.org/t/is-there-an-easy-way-to-parallelise-matrix-multiplication/23266)

<div class="topic-metadata">

**Author:** [@boutor2](https://discourse.julialang.org/u/boutor2)\
**Replies:** 8\
**Last updated:** [April 19, 2019, 8:53am UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-parallelise-matrix-multiplication/23266 "2019-04-19T08:53:34Z")

</div>

Hi, I am working with large sparse matrices (10^5 x 10^5). I would like to make full use of the cores / threads of my CPU to accelerate the multiplication process. As of now, I am using mul!: using SparseArrays,LinearA…

---

## [Constructor with default values for mutables which allows undefined values](https://discourse.julialang.org/t/constructor-with-default-values-for-mutables-which-allows-undefined-values/23290)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 5\
**Last updated:** [April 19, 2019, 6:24am UTC](https://discourse.julialang.org/t/constructor-with-default-values-for-mutables-which-allows-undefined-values/23290 "2019-04-19T06:24:47Z")

</div>

I’m looking for something like Base.@kwdef or Parameters.@with\_kw but which leaves unspecified arguments for mutables as #undef, i.e. it should do, @new\_kwdef mutable struct Foo x = 1 y end Foo() # should return …

---

## [Possible Bug regarding TypeVar?](https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [April 19, 2019, 6:04am UTC](https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283 "2019-04-19T06:04:50Z")

</div>

julia\> struct LL{T} x::T end julia\> emulate\_type(tv::TypeVar) = tv.ub == Any ? Union{tv,LL{tv}} : tv emulate\_type (generic function with 1 method) julia\> emulate\_type(TypeVar(:T)) Unreachable reached …

---

## [Fitting Student's t-Distributions](https://discourse.julialang.org/t/fitting-students-t-distributions/23289)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 1\
**Last updated:** [April 19, 2019, 2:45am UTC](https://discourse.julialang.org/t/fitting-students-t-distributions/23289 "2019-04-19T02:45:49Z")

</div>

In Distributions, the fit\_mle method has not yet been implemented for the Student’s t-distribution. Is there a package where fitting t-distributions may be possible?

---

## [Connectiong to the Hive metastore on hdfs using Hive.jl or Spark.jl](https://discourse.julialang.org/t/connectiong-to-the-hive-metastore-on-hdfs-using-hive-jl-or-spark-jl/21921)

<div class="topic-metadata">

**Author:** [@Fredo\_XVII](https://discourse.julialang.org/u/Fredo_XVII)\
**Replies:** 30\
**Last updated:** [April 18, 2019, 5:05pm UTC](https://discourse.julialang.org/t/connectiong-to-the-hive-metastore-on-hdfs-using-hive-jl-or-spark-jl/21921 "2019-04-18T17:05:48Z")

</div>

Hello, I am poc\`ing Julia at work and I am trying to test it on our Hadoop environment. I have Julia 1.0.3 and Julia 1.0 installed. Running Julia through miniconda on our edge node. Things that I have tried: Using …

---

## [Release 1.2.0?](https://discourse.julialang.org/t/release-1-2-0/23270)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 3\
**Last updated:** [April 18, 2019, 11:07am UTC](https://discourse.julialang.org/t/release-1-2-0/23270 "2019-04-18T11:07:58Z")

</div>

I cloned the Julia git repository and made a build. I get 1.3.0-DEV.63 Perhaps a stupid question - is there a stable 1.2.0 release? I can see a branch called backports-release-1-2 I guess what I am asking is what is t…

---

## [Unzipping single file with a shell command](https://discourse.julialang.org/t/unzipping-single-file-with-a-shell-command/23263)

<div class="topic-metadata">

**Author:** [@Jeremy](https://discourse.julialang.org/u/Jeremy)\
**Replies:** 6\
**Last updated:** [April 18, 2019, 9:49am UTC](https://discourse.julialang.org/t/unzipping-single-file-with-a-shell-command/23263 "2019-04-18T09:49:26Z")

</div>

I’m trying to update my package, ClimateDataIO, for Julia 0.7 and beyond but because of a problem with some function down the chain in ZipFile/CSV/etc. I’ve had to switch to a shell command to unzip the file that I want.…

---

## [Travis stalling building plots on julia 1.0 but not 1.1](https://discourse.julialang.org/t/travis-stalling-building-plots-on-julia-1-0-but-not-1-1/23244)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 4\
**Last updated:** [April 18, 2019, 6:31am UTC](https://discourse.julialang.org/t/travis-stalling-building-plots-on-julia-1-0-but-not-1-1/23244 "2019-04-18T06:31:39Z")

</div>

I have a package testing which fails with a weird error on julia 1.0 but not on 1.1. The error is occuring while building Plots.jl: No output has been received in the last 10m0s, this potentially indicates a stalled bui…

---

## [Suggestions for a good example of a realistic type instability for Julia demo?](https://discourse.julialang.org/t/suggestions-for-a-good-example-of-a-realistic-type-instability-for-julia-demo/23232)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 10\
**Last updated:** [April 17, 2019, 9:29pm UTC](https://discourse.julialang.org/t/suggestions-for-a-good-example-of-a-realistic-type-instability-for-julia-demo/23232 "2019-04-17T21:29:45Z")

</div>

I’m giving a brief demo on Julia for an audience that has never used it, and wanted a short and sweet example of a typical type-instability one might have in their code, and how to fix it. The problem is, the compiler’s …

---

## [Wrapper types function passthrough](https://discourse.julialang.org/t/wrapper-types-function-passthrough/23250)

<div class="topic-metadata">

**Author:** [@louisponet](https://discourse.julialang.org/u/louisponet)\
**Replies:** 8\
**Last updated:** [April 17, 2019, 9:21pm UTC](https://discourse.julialang.org/t/wrapper-types-function-passthrough/23250 "2019-04-17T21:21:23Z")

</div>

Hi All, I’m trying out something in an attempt to make an as unintrusive as possible threadsafe cache type. The basic idea is that upon creation it will generate as many caches with the initial value as there are threa…

---

## [Existence of Gamma function is nowhere mentioned in the documentation of SpecialFunctions.jl](https://discourse.julialang.org/t/existence-of-gamma-function-is-nowhere-mentioned-in-the-documentation-of-specialfunctions-jl/23254)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 8:51pm UTC](https://discourse.julialang.org/t/existence-of-gamma-function-is-nowhere-mentioned-in-the-documentation-of-specialfunctions-jl/23254 "2019-04-17T20:51:19Z")

</div>

SpecialFunctions does have the gamma function but I cannot find it mentioned in the documentation Was I bad at searching or is that really the case?

---

## [Is there any efficient way to generating the non-associative binary products ?](https://discourse.julialang.org/t/is-there-any-efficient-way-to-generating-the-non-associative-binary-products/23255)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 8:36pm UTC](https://discourse.julialang.org/t/is-there-any-efficient-way-to-generating-the-non-associative-binary-products/23255 "2019-04-17T20:36:54Z")

</div>

I want to generate all the non-associative product for any ordered list. The code is following struct X\<: Number first second function X(a,b) new(a,b) end end function XProduct(TL::Vector) if length(TL)\>1 h=vc…

---

## [Latex output of custom objets](https://discourse.julialang.org/t/latex-output-of-custom-objets/22875)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 8:22pm UTC](https://discourse.julialang.org/t/latex-output-of-custom-objets/22875 "2019-04-17T20:22:38Z")

</div>

I define a object and want to generate the latex output using Latexify.jl. The object is defined as following struct vecSym \<: Number name::String function vecSym(x::String) new(x) end end function Base.show(io::…

---

## [Filter out the nonzero elements in a dense axis array](https://discourse.julialang.org/t/filter-out-the-nonzero-elements-in-a-dense-axis-array/23252)

<div class="topic-metadata">

**Author:** [@yan25y](https://discourse.julialang.org/u/yan25y)\
**Replies:** 0\
**Last updated:** [April 17, 2019, 4:49pm UTC](https://discourse.julialang.org/t/filter-out-the-nonzero-elements-in-a-dense-axis-array/23252 "2019-04-17T16:49:20Z")

</div>

Here is the quoted code for a network problem that I’m working on using JuMP using Gurobi supply\_nodes=\["i1","i2","i3"\] s=\[4,3,2\] s\_dict=Dict() for i in 1:length(supply\_nodes) s\_dict\[supply\_nodes\[i\]\]=s\[i\] end dem…

---

## [Filter out the nonzero values in a dense axis array](https://discourse.julialang.org/t/filter-out-the-nonzero-values-in-a-dense-axis-array/22883)

<div class="topic-metadata">

**Author:** [@yan25y](https://discourse.julialang.org/u/yan25y)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 4:47pm UTC](https://discourse.julialang.org/t/filter-out-the-nonzero-values-in-a-dense-axis-array/22883 "2019-04-17T16:47:09Z")

</div>

Could someone help me figuring out how to filter out the nonzero values and its corresponding keys in this dense array? Thank you!

---

## [Documentation for comprehensions with if and/or w/o comma](https://discourse.julialang.org/t/documentation-for-comprehensions-with-if-and-or-w-o-comma/23236)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [April 17, 2019, 12:11pm UTC](https://discourse.julialang.org/t/documentation-for-comprehensions-with-if-and-or-w-o-comma/23236 "2019-04-17T12:11:59Z")

</div>

I was about to refer a colleague the docs on the non-array form of comprehensions (with multiple for, optionally if), but I can’t find it. Eg in julia\> \[(i = i, j = j) for i in 1:2, j in 1:3\] 2×3 Array{NamedTuple{(:i, :…

---

## [Shallow copy of a struct](https://discourse.julialang.org/t/shallow-copy-of-a-struct/23213)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 4\
**Last updated:** [April 17, 2019, 8:14am UTC](https://discourse.julialang.org/t/shallow-copy-of-a-struct/23213 "2019-04-17T08:14:14Z")

</div>

I have a set of mutable structures that are derived from an abstract type : T1 \<: AbstractT T2 \<: AbstractT T3 \<: AbstractT ... Tn \<: AbstractT I need to make a backup of an array of instances of these structures. I co…

---

## [Nearest complex positive semidefinite matrix](https://discourse.julialang.org/t/nearest-complex-positive-semidefinite-matrix/23228)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 7:29am UTC](https://discourse.julialang.org/t/nearest-complex-positive-semidefinite-matrix/23228 "2019-04-17T07:29:20Z")

</div>

There seem to be a lot of work on finding the nearest positive semidefinite matrix to a real symmetric matrix, but other than via an eigendecomposition, which is slow (as below), does anyone know of a way to find the nea…

---

## [Define function with multiple dispatch in terms of another function with same signatures](https://discourse.julialang.org/t/define-function-with-multiple-dispatch-in-terms-of-another-function-with-same-signatures/22675)

<div class="topic-metadata">

**Author:** [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Replies:** 12\
**Last updated:** [April 17, 2019, 4:03am UTC](https://discourse.julialang.org/t/define-function-with-multiple-dispatch-in-terms-of-another-function-with-same-signatures/22675 "2019-04-17T04:03:23Z")

</div>

Say I have a function, call it q and it has multiple signatures: q(a,b) q(b) ... And I have the relationship that p = 1 - q Is there a simpler way to define this other than to list out the same set of signatures? I.…

---

## [Tracking absolute index position durring dimension removal](https://discourse.julialang.org/t/tracking-absolute-index-position-durring-dimension-removal/23231)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 0\
**Last updated:** [April 17, 2019, 2:50am UTC](https://discourse.julialang.org/t/tracking-absolute-index-position-durring-dimension-removal/23231 "2019-04-17T02:50:28Z")

</div>

Alright Julia wizardettes/wizards. While working on my package I keep running into this problem; it’s a book keeping problem and it shows up a lot in numerical methods. Say we have a 2-array/matrix and we want to make co…

---

## [Tips for using PackageCompiler.jl on Windows](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 6\
**Last updated:** [April 17, 2019, 2:43am UTC](https://discourse.julialang.org/t/tips-for-using-packagecompiler-jl-on-windows/22295 "2019-04-17T02:43:03Z")

</div>

To compile packages using PackageCompiler.jl I found the following steps to be helpful Update PakcageCompiler to latest using \]dev https://github.com/JuliaLang/PackageCompiler.jl.git If you have compiled packages befo…

---

## [Old bug back . Instaling package on win 7 Julia 0.7](https://discourse.julialang.org/t/old-bug-back-instaling-package-on-win-7-julia-0-7/23166)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 5\
**Last updated:** [April 16, 2019, 11:11pm UTC](https://discourse.julialang.org/t/old-bug-back-instaling-package-on-win-7-julia-0-7/23166 "2019-04-16T23:11:22Z")

</div>

New Win7/64 Easy fix updated. .Net Framework 4.7 instaled \_ \_ \_ \_(\_)\_ | A fresh approach to technical computing (\_) | (\_) (\_) | Documentation: https://docs.julialang.org \_ \_ …

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

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