# General Usage

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

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

**Page:** 872

---

## [When and where should we use semicolon](https://discourse.julialang.org/t/when-and-where-should-we-use-semicolon/23597)

<div class="topic-metadata">

**Author:** [@Mr.Robot](https://discourse.julialang.org/u/Mr.Robot)\
**Replies:** 5\
**Last updated:** [April 27, 2019, 1:32pm UTC](https://discourse.julialang.org/t/when-and-where-should-we-use-semicolon/23597 "2019-04-27T13:32:43Z")

</div>

Problem This might be a somehow uninteresting question. But when I read other people’s code snippets, I find that the use of semicolon does not follow certain patterns and seems to be a little random for me. I know semi…

---

## [TextParse Error with Inf/-Inf](https://discourse.julialang.org/t/textparse-error-with-inf-inf/23460)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 4\
**Last updated:** [April 27, 2019, 4:02am UTC](https://discourse.julialang.org/t/textparse-error-with-inf-inf/23460 "2019-04-27T04:02:08Z")

</div>

I encountered an issue using JuliaDB v0.12.0 on Julia v1.1. Whenever I try to read a CSV with numbers and Inf/-Inf mixed in, the parser fails saying that Inf cannot be parsed as a Float64 and thus doesn’t match either F…

---

## [Plots & PyPlot?](https://discourse.julialang.org/t/plots-pyplot/23510)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 15\
**Last updated:** [April 27, 2019, 2:28am UTC](https://discourse.julialang.org/t/plots-pyplot/23510 "2019-04-27T02:28:41Z")

</div>

Plots vs. PyPlot seems to have changed… In the past, the following worked (Julia 1.1.0): using Plots pyplot() This doesn’t work any more – if I do this, I get a lengthy error message: ┌ Warning: Error requiring PyPlo…

---

## [Display of arrays with row and column names](https://discourse.julialang.org/t/display-of-arrays-with-row-and-column-names/1961)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 9\
**Last updated:** [April 27, 2019, 12:29am UTC](https://discourse.julialang.org/t/display-of-arrays-with-row-and-column-names/1961 "2019-04-27T00:29:41Z")

</div>

I’m aware of some previous threads discussing this topic, but I do not find any way to conveniently reproduce what I can do with Octave, e.g., octave:1\> cnames=\["this"; "that"\]; octave:2\> a = rand(3,2); octave:3\> pretty…

---

## [Dependency problem with FIllArrays](https://discourse.julialang.org/t/dependency-problem-with-fillarrays/23238)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 41\
**Last updated:** [April 26, 2019, 8:41pm UTC](https://discourse.julialang.org/t/dependency-problem-with-fillarrays/23238 "2019-04-26T20:41:32Z")

</div>

I am in the process of switching my packages to using Project.toml. When trying to add to the project.toml of ControlSystemIdentification.jl, I get the following problem (ControlSystemIdentification) pkg\> add LinearAlg…

---

## [Style question: replacing multidimensional collect with broadcast](https://discourse.julialang.org/t/style-question-replacing-multidimensional-collect-with-broadcast/23464)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 7\
**Last updated:** [April 25, 2019, 7:44am UTC](https://discourse.julialang.org/t/style-question-replacing-multidimensional-collect-with-broadcast/23464 "2019-04-25T07:44:28Z")

</div>

What’s the recommended way of writing something like \[f(i, j) for i in 1:I, j in 1:J\] using broadcasting? Eg f.(1:I, (1:J)') f.(1:I, permutedims(1:J)) ? This is purely a style question. Transpose feels icky (relies …

---

## [Writedlm gives wrong output](https://discourse.julialang.org/t/writedlm-gives-wrong-output/23528)

<div class="topic-metadata">

**Author:** [@JianghuiDu](https://discourse.julialang.org/u/JianghuiDu)\
**Replies:** 6\
**Last updated:** [April 26, 2019, 1:33pm UTC](https://discourse.julialang.org/t/writedlm-gives-wrong-output/23528 "2019-04-26T13:33:32Z")

</div>

I use writedlm to save my matrices in .txt files and I found that occasionally the outputs are wrong, specifically the place of the decimal points. It happens for example 0.04 is saved as 0.4. It only happens the first t…

---

## [Binary output](https://discourse.julialang.org/t/binary-output/23276)

<div class="topic-metadata">

**Author:** [@Mikel\_Antonana](https://discourse.julialang.org/u/Mikel_Antonana)\
**Replies:** 3\
**Last updated:** [April 26, 2019, 1:30pm UTC](https://discourse.julialang.org/t/binary-output/23276 "2019-04-26T13:30:25Z")

</div>

If you’re dealing with large amounts of data, typically, you don’t want to write big ASCII files. You want to write things as binary file (it takes less space to do that). In most programming language that’s easy but i…

---

## [Type union over set of values](https://discourse.julialang.org/t/type-union-over-set-of-values/23551)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [April 26, 2019, 12:20pm UTC](https://discourse.julialang.org/t/type-union-over-set-of-values/23551 "2019-04-26T12:20:03Z")

</div>

How can I denote the set of types Val{x} where x is a Symbol? Something like Val{S} where {S isa Symbol}, but this is not a legal expression. Is there a way to express such a Union type in Julia? This is a particular e…

---

## [Creating sub-arrays by comparing multiple arrays DataFrames](https://discourse.julialang.org/t/creating-sub-arrays-by-comparing-multiple-arrays-dataframes/23518)

<div class="topic-metadata">

**Author:** [@eed](https://discourse.julialang.org/u/eed)\
**Replies:** 4\
**Last updated:** [April 26, 2019, 10:11am UTC](https://discourse.julialang.org/t/creating-sub-arrays-by-comparing-multiple-arrays-dataframes/23518 "2019-04-26T10:11:01Z")

</div>

Hi I am very new to Julia, and have some experience with Matlab. However, I have been struggling to perform the following: I have two DataFrames X and Y that I have created (imported from txt file) . Let’s say X is th…

---

## [Function declaration inside loop](https://discourse.julialang.org/t/function-declaration-inside-loop/23535)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 2\
**Last updated:** [April 26, 2019, 8:19am UTC](https://discourse.julialang.org/t/function-declaration-inside-loop/23535 "2019-04-26T08:19:21Z")

</div>

Having a function declaration inside a loop seems to me somewhat awkward, …but it works. Which would be a better/recommended way оf doing this? using Optim euribor = \[0.201 0.335 0.406 0.516 0.652 0.805 0.964 1.119 1.26…

---

## [PackageCompiler image validity](https://discourse.julialang.org/t/packagecompiler-image-validity/23540)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 0\
**Last updated:** [April 26, 2019, 7:38am UTC](https://discourse.julialang.org/t/packagecompiler-image-validity/23540 "2019-04-26T07:38:40Z")

</div>

As advised by several here, I built a PackageCompiler image for Plots,GR to alleviate the time-to-first-plot problem. I notice that when I start Julia using -J path/to/sys.dll, I end up in a dedicated environment (Packag…

---

## [Formatting Float64 output with CSV.write()](https://discourse.julialang.org/t/formatting-float64-output-with-csv-write/23479)

<div class="topic-metadata">

**Author:** [@Alessio\_Bellisomi](https://discourse.julialang.org/u/Alessio_Bellisomi)\
**Replies:** 11\
**Last updated:** [April 26, 2019, 6:33am UTC](https://discourse.julialang.org/t/formatting-float64-output-with-csv-write/23479 "2019-04-26T06:33:39Z")

</div>

Hello, I am using the CSV package to export a DataFrame. One of the columns has DataType Float64, so it get exported using scientific notation format and the software that reads it (SQL Server bcp) cannot read it proper…

---

## [Unsatisfiable requirements for FixedEffectModels package](https://discourse.julialang.org/t/unsatisfiable-requirements-for-fixedeffectmodels-package/23519)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 1\
**Last updated:** [April 26, 2019, 6:10am UTC](https://discourse.julialang.org/t/unsatisfiable-requirements-for-fixedeffectmodels-package/23519 "2019-04-26T06:10:19Z")

</div>

I am trying to register a new version of FixedEffectModels but tests fails with Julia 1.0.3 (due to Unsatisfiable requirements with Distributions.jl) and tests fail with Julia Nightly (because ofUnsatisfiable requirem…

---

## [Type annotations in struct vs. struct fields](https://discourse.julialang.org/t/type-annotations-in-struct-vs-struct-fields/23530)

<div class="topic-metadata">

**Author:** [@joemiller](https://discourse.julialang.org/u/joemiller)\
**Replies:** 4\
**Last updated:** [April 26, 2019, 1:23am UTC](https://discourse.julialang.org/t/type-annotations-in-struct-vs-struct-fields/23530 "2019-04-26T01:23:39Z")

</div>

Hey everyone. I’ve been curious for a while about the performance implications and behavior of the following types of structs: struct MyType1{Int64,Float64} a::Int64 b::Float64 end versus struct MyType2{T1\<:In…

---

## [Travis testing fails: Related to the addition of Project.toml?](https://discourse.julialang.org/t/travis-testing-fails-related-to-the-addition-of-project-toml/23524)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [April 25, 2019, 9:49pm UTC](https://discourse.julialang.org/t/travis-testing-fails-related-to-the-addition-of-project-toml/23524 "2019-04-25T21:49:15Z")

</div>

I run successfully import Pkg; Pkg.clone("https://github.com/PetrKryslUCSD/FinEtools.jl.git") Pkg.test("FinEtools"; coverage=true); locally on Linux. Surprisingly, this same incantation fails on Travis (both Linux and …

---

## [Perfomance issue when executing a script](https://discourse.julialang.org/t/perfomance-issue-when-executing-a-script/23494)

<div class="topic-metadata">

**Author:** [@phil1](https://discourse.julialang.org/u/phil1)\
**Replies:** 3\
**Last updated:** [April 25, 2019, 6:18pm UTC](https://discourse.julialang.org/t/perfomance-issue-when-executing-a-script/23494 "2019-04-25T18:18:05Z")

</div>

I write a simple script, plotex.jl to produce a plot: using Plots pyplot() # Switch to using the PyPlot.jl backend plot1 = plot(rand(10,10),linewidth=2,title=“Plot 1”) display(plot1) When I type the code manually into …

---

## [Tuple Type with unordered parameters](https://discourse.julialang.org/t/tuple-type-with-unordered-parameters/23427)

<div class="topic-metadata">

**Author:** [@neyhay](https://discourse.julialang.org/u/neyhay)\
**Replies:** 5\
**Last updated:** [April 25, 2019, 6:16pm UTC](https://discourse.julialang.org/t/tuple-type-with-unordered-parameters/23427 "2019-04-25T18:16:19Z")

</div>

Is it possible to define a Tuple Type based only on the parameters of the Tuple and not the order? For example: Tuple{Float64, Char} == Tuple{Char, Float64} evaluates false, but I would like to create the possibility th…

---

## [Use PackageCompiler to produce EXE on non-VM, execute on VM gives "ERROR: Unable to find compatible target in system image"](https://discourse.julialang.org/t/use-packagecompiler-to-produce-exe-on-non-vm-execute-on-vm-gives-error-unable-to-find-compatible-target-in-system-image/23521)

<div class="topic-metadata">

**Author:** [@jonbarkerlondon](https://discourse.julialang.org/u/jonbarkerlondon)\
**Replies:** 2\
**Last updated:** [April 25, 2019, 5:00pm UTC](https://discourse.julialang.org/t/use-packagecompiler-to-produce-exe-on-non-vm-execute-on-vm-gives-error-unable-to-find-compatible-target-in-system-image/23521 "2019-04-25T17:00:15Z")

</div>

Compile on my win10 x64 desktop, Copy the .EXE to WinServer2012 x64 VM Execute the EXE on the VM I receive the error above. I guess this is due to different CPU features or something between the 2 computers. Any recom…

---

## [Solving ODEs arising from spherical and cylindrical systems?](https://discourse.julialang.org/t/solving-odes-arising-from-spherical-and-cylindrical-systems/23462)

<div class="topic-metadata">

**Author:** [@ArjunNarayanan](https://discourse.julialang.org/u/ArjunNarayanan)\
**Replies:** 8\
**Last updated:** [April 25, 2019, 10:13am UTC](https://discourse.julialang.org/t/solving-odes-arising-from-spherical-and-cylindrical-systems/23462 "2019-04-25T10:13:30Z")

</div>

I want to know what is the correct way of solving an ODE of the following form using DifferentialEquations. Consider for example the ODE satisfied by a function u(r) (prime indicates a derivative) u'' + \\frac{u'}{r} -…

---

## [Package manager: what are "explicit requirements"?](https://discourse.julialang.org/t/package-manager-what-are-explicit-requirements/18616)

<div class="topic-metadata">

**Author:** [@yha](https://discourse.julialang.org/u/yha)\
**Replies:** 24\
**Last updated:** [April 25, 2019, 4:57am UTC](https://discourse.julialang.org/t/package-manager-what-are-explicit-requirements/18616 "2019-04-25T04:57:30Z")

</div>

I sometimes run into “Unsatisfiable requirements” error when adding some package A, where the description mentions that some package B has “explicit requirements”. When this happens, I found that removing package B and i…

---

## [Are Vararg only allowed as a final argument and if so why?](https://discourse.julialang.org/t/are-vararg-only-allowed-as-a-final-argument-and-if-so-why/23490)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 6\
**Last updated:** [April 25, 2019, 1:11am UTC](https://discourse.julialang.org/t/are-vararg-only-allowed-as-a-final-argument-and-if-so-why/23490 "2019-04-25T01:11:49Z")

</div>

For example julia\> f(x::Vararg{Int,N}, y::Float64) where {N} = (x, y) ERROR: ArgumentError: Vararg on non-final argument in method definition for f at REPL\[9\]:1 In principle the method signature is not ambiguous so it…

---

## [Search path for executable](https://discourse.julialang.org/t/search-path-for-executable/3511)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 15\
**Last updated:** [April 24, 2019, 11:58pm UTC](https://discourse.julialang.org/t/search-path-for-executable/3511 "2019-04-24T23:58:43Z")

</div>

Is there a more or less portable way of getting the path of an executable if available? When is\_unix(), I guess something like function find\_in\_path(program) try chomp(readstring(\`which $program\`)) catch …

---

## [Check if NDSparse key exists](https://discourse.julialang.org/t/check-if-ndsparse-key-exists/23488)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 4\
**Last updated:** [April 24, 2019, 11:55pm UTC](https://discourse.julialang.org/t/check-if-ndsparse-key-exists/23488 "2019-04-24T23:55:14Z")

</div>

If I have an NDSparse table, can I check if a key exists similar to dictionaries? With a dictionary (d) I can use haskey(d) but with a table (tab) haskey(tab) results in an error. I know I can do a try catch statement …

---

## [Specify a generic array range](https://discourse.julialang.org/t/specify-a-generic-array-range/23489)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [April 24, 2019, 10:49pm UTC](https://discourse.julialang.org/t/specify-a-generic-array-range/23489 "2019-04-24T22:49:24Z")

</div>

Hi, I’m building a function where as input I feed an array whose dimensions are not known a priori, but that is going to be of length 100 in each dimension. So it can be, as an input a=rand(100) or a=rand(100,100) or a…

---

## [How do I reference a custom call operator?](https://discourse.julialang.org/t/how-do-i-reference-a-custom-call-operator/23400)

<div class="topic-metadata">

**Author:** [@dzhang314](https://discourse.julialang.org/u/dzhang314)\
**Replies:** 8\
**Last updated:** [April 24, 2019, 9:00pm UTC](https://discourse.julialang.org/t/how-do-i-reference-a-custom-call-operator/23400 "2019-04-24T21:00:50Z")

</div>

Suppose I’ve defined a data type in Julia with its own call operator. struct Adder x::Int end @noinline function (a::Adder)(y::Int) a.x + y end How do I refer to the call operator I’ve just defined as a functi…

---

## [Named Tuple Constructor type unstable?](https://discourse.julialang.org/t/named-tuple-constructor-type-unstable/23461)

<div class="topic-metadata">

**Author:** [@bjack205](https://discourse.julialang.org/u/bjack205)\
**Replies:** 7\
**Last updated:** [April 24, 2019, 4:34pm UTC](https://discourse.julialang.org/t/named-tuple-constructor-type-unstable/23461 "2019-04-24T16:34:41Z")

</div>

I’m getting some odd type instability when using the NamedTuple constructor NamedTuple{symbol}(values) Here’s a simple example: using IteractiveUtils names = (:x,:y) vals = (rand(2,2), rand(2,2)) create\_nt(names,vals)…

---

## [Help with refactoring function into macro](https://discourse.julialang.org/t/help-with-refactoring-function-into-macro/23447)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 8\
**Last updated:** [April 24, 2019, 4:24pm UTC](https://discourse.julialang.org/t/help-with-refactoring-function-into-macro/23447 "2019-04-24T16:24:12Z")

</div>

Hi - yet another help request in regards to macros. I’ve been trying multiple approaches to no avail. Let’s say I have a code like this: module Z export z function z(m = @\_\_MODULE\_\_, a='a'; c...) "$m :: $a & $(c..…

---

## [\`test\_throws\` with macros after PR 23533](https://discourse.julialang.org/t/test-throws-with-macros-after-pr-23533/5878)

<div class="topic-metadata">

**Author:** [@fcard](https://discourse.julialang.org/u/fcard)\
**Replies:** 2\
**Last updated:** [April 24, 2019, 1:13pm UTC](https://discourse.julialang.org/t/test-throws-with-macros-after-pr-23533/5878 "2019-04-24T13:13:45Z")

</div>

Due to a recent change (this one, I think?), errors resulting from a macro seem to be wrapped inside a LoadError macro m() error("err") end 0.6: julia\> @m ERROR: err 0.7-dev: julia\> @m ERROR: LoadError: err Stackt…

---

## [Understanding an "Unsatisfiable requirements" problems](https://discourse.julialang.org/t/understanding-an-unsatisfiable-requirements-problems/23438)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [April 24, 2019, 1:47pm UTC](https://discourse.julialang.org/t/understanding-an-unsatisfiable-requirements-problems/23438 "2019-04-24T13:47:57Z")

</div>

I think I painted myself into a corner somehow with package requirements. The error message for trying to test TransformVariables#master is pkg\> test TransformVariables Testing TransformVariables Resolving package v…

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

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