# General Usage

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

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

**Page:** 950

---

## [Range checking / bounds (of a variable) checking](https://discourse.julialang.org/t/range-checking-bounds-of-a-variable-checking/13931)

<div class="topic-metadata">

**Author:** [@scelles](https://discourse.julialang.org/u/scelles)\
**Replies:** 5\
**Last updated:** [August 23, 2018, 2:01pm UTC](https://discourse.julialang.org/t/range-checking-bounds-of-a-variable-checking/13931 "2018-08-23T14:01:09Z")

</div>

Hello, In my old memories, I recall that Ada (programming language) provide a concept of “range” for checking that a numerical value stored in a variable is always between a lower bound and an upper bound. This kind of…

---

## [How to use a return type annotation in a function declaration before the type is defined (dependency injection)](https://discourse.julialang.org/t/how-to-use-a-return-type-annotation-in-a-function-declaration-before-the-type-is-defined-dependency-injection/12813)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 8\
**Last updated:** [August 23, 2018, 1:49pm UTC](https://discourse.julialang.org/t/how-to-use-a-return-type-annotation-in-a-function-declaration-before-the-type-is-defined-dependency-injection/12813 "2018-08-23T13:49:03Z")

</div>

I hope I’ll be able to explain clearly enough what I’m looking for – it’s a bit tricky without getting into a lot of details about the use case. It’s basically about dependency injection. Say that I have a module and wi…

---

## [About standard libraries](https://discourse.julialang.org/t/about-standard-libraries/13932)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 11\
**Last updated:** [August 23, 2018, 1:43pm UTC](https://discourse.julialang.org/t/about-standard-libraries/13932 "2018-08-23T13:43:28Z")

</div>

Where can I find a list of current standard libraries?

---

## [GLM in Julia 0.7](https://discourse.julialang.org/t/glm-in-julia-0-7/13844)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 8\
**Last updated:** [August 23, 2018, 1:21pm UTC](https://discourse.julialang.org/t/glm-in-julia-0-7/13844 "2018-08-23T13:21:30Z")

</div>

I am trying to run some regressions in Julia 0.7 + Atom. I added the package GLM. The command ols = lm(@formula(Y ~ X), data) gives the error UndefVarError: At\_mul\_B! not defined I have seen this issue mentioned some…

---

## [Zero and one do not respect precision of BigFloat](https://discourse.julialang.org/t/zero-and-one-do-not-respect-precision-of-bigfloat/13927)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 2\
**Last updated:** [August 23, 2018, 12:37pm UTC](https://discourse.julialang.org/t/zero-and-one-do-not-respect-precision-of-bigfloat/13927 "2018-08-23T12:37:30Z")

</div>

I would have hoped that zero and one would generate a BigFloat with the same precision as its argument. julia\> precision(zero(BigFloat(1, 1000))) 256 julia\> precision(one(BigFloat(1, 1000))) 256 Is this a bug?

---

## [IterTools.jl Partition type stability?](https://discourse.julialang.org/t/itertools-jl-partition-type-stability/13847)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 3\
**Last updated:** [August 22, 2018, 5:39pm UTC](https://discourse.julialang.org/t/itertools-jl-partition-type-stability/13847 "2018-08-22T17:39:28Z")

</div>

Trying some code like: function test\_loop(event\_times) out = 0.0 for (i, event\_time) in partition(event\_times, 2, 1) out += i + event\_time end return out end @code\_warntype test\_loop(\[1.1, 1.8, …

---

## [Current array index inside broadcast?](https://discourse.julialang.org/t/current-array-index-inside-broadcast/13923)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 0\
**Last updated:** [August 23, 2018, 8:34am UTC](https://discourse.julialang.org/t/current-array-index-inside-broadcast/13923 "2018-08-23T08:34:44Z")

</div>

I’m broadcasting over 2d arrays to use GPUArrays if they are passed in. I often need the current index for accessing other arrays and relative locations. Any ideas on the easiest, lowest overhead way to do this? Here …

---

## [System wide Pkg installation](https://discourse.julialang.org/t/system-wide-pkg-installation/1402)

<div class="topic-metadata">

**Author:** [@ianabc](https://discourse.julialang.org/u/ianabc)\
**Replies:** 9\
**Last updated:** [August 23, 2018, 7:53am UTC](https://discourse.julialang.org/t/system-wide-pkg-installation/1402 "2018-08-23T07:53:53Z")

</div>

Is there a way to install packages system wide alongside those added by users without duplication? I’d really like to be able to install (and precompile) a selection of commonly used packages in a system wide directory,…

---

## [Easiest way to make tenth(), hundredth(), etc to go alongside first() and second()?](https://discourse.julialang.org/t/easiest-way-to-make-tenth-hundredth-etc-to-go-alongside-first-and-second/13905)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 5\
**Last updated:** [August 23, 2018, 5:39am UTC](https://discourse.julialang.org/t/easiest-way-to-make-tenth-hundredth-etc-to-go-alongside-first-and-second/13905 "2018-08-23T05:39:28Z")

</div>

So first is an extremely useful function, and so is last. Some languages, like rails, even have a second() function. This has led to some controversy on the subject: ruby - Rails lists have .first and .second – is the…

---

## [What is the proper incantation of \[compat\]](https://discourse.julialang.org/t/what-is-the-proper-incantation-of-compat/13914)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [August 23, 2018, 5:33am UTC](https://discourse.julialang.org/t/what-is-the-proper-incantation-of-compat/13914 "2018-08-23T05:33:56Z")

</div>

I’ve had \[compat\] julia 0.7 in my Project.toml. However, \]dev resulted in an error: (v0.7) pkg\> dev ./FinEtools ERROR: Pkg.TOML.ParserError(149, 150, "expected \`=\`, but found \`0\`") When I removed it, the package mana…

---

## [Glfw library doesn't include timer related methods?](https://discourse.julialang.org/t/glfw-library-doesnt-include-timer-related-methods/13858)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 1\
**Last updated:** [August 22, 2018, 9:55pm UTC](https://discourse.julialang.org/t/glfw-library-doesnt-include-timer-related-methods/13858 "2018-08-22T21:55:12Z")

</div>

glfwGetTime, glfwSetTime, glfwGetTimerValue, glfwGetTimerFrequency, at the least, there might be others. when looking through the code the only thing i found related to timers was the event loop timeout.

---

## [Undef consistency: x == undef vs isassigned(x)](https://discourse.julialang.org/t/undef-consistency-x-undef-vs-isassigned-x/13896)

<div class="topic-metadata">

**Author:** [@r\_v](https://discourse.julialang.org/u/r_v)\
**Replies:** 16\
**Last updated:** [August 22, 2018, 9:32pm UTC](https://discourse.julialang.org/t/undef-consistency-x-undef-vs-isassigned-x/13896 "2018-08-22T21:32:49Z")

</div>

julia\> a = resize!(\[\], 1) 1-element Array{Any,1}: #undef julia\> b = \[undef\] 1-element Array{UndefInitializer,1}: array initializer with undefined values So, I would assume that if I can julia\> b\[1\] == undef true Th…

---

## [Plotting on Server](https://discourse.julialang.org/t/plotting-on-server/13869)

<div class="topic-metadata">

**Author:** [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 7:37pm UTC](https://discourse.julialang.org/t/plotting-on-server/13869 "2018-08-22T19:37:30Z")

</div>

I am trying to install and run julia 0.6.4 on a cluster at school. (Firstly I had to specify package directory away from my home folder in \\scratch to accomodate the 5GB.) Then I installed Plots.jl and Plotly.jl. However…

---

## [how can i use latex in julia v1.0](https://discourse.julialang.org/t/how-can-i-use-latex-in-julia-v1-0/13340)

<div class="topic-metadata">

**Author:** [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Replies:** 10\
**Last updated:** [August 22, 2018, 7:36pm UTC](https://discourse.julialang.org/t/how-can-i-use-latex-in-julia-v1-0/13340 "2018-08-22T19:36:17Z")

</div>

i want to write in latex a title in a plot so title("(Omega\_d )^2 " i try to use \\Omega and press tab to choose the greek letter … but the subscript \_d i can not julia v1.0 do not accept L"\\Omega\_d" any ideas ?

---

## [Anoymous Functions Slow in sort](https://discourse.julialang.org/t/anoymous-functions-slow-in-sort/13891)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 3\
**Last updated:** [August 22, 2018, 5:05pm UTC](https://discourse.julialang.org/t/anoymous-functions-slow-in-sort/13891 "2018-08-22T17:05:07Z")

</div>

Is it expected that an anonymous function is 300x slower than a named function in sort? For example: test = rand(1000) my\_id(x) = x sort(test, by = x -\> x) # 0.074194 sec sort(test, by = identity) # 0.000070 sec sort…

---

## [HTTP Package](https://discourse.julialang.org/t/http-package/13892)

<div class="topic-metadata">

**Author:** [@clinton](https://discourse.julialang.org/u/clinton)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 5:00pm UTC](https://discourse.julialang.org/t/http-package/13892 "2018-08-22T17:00:36Z")

</div>

I’m trying to write a script that uses the HTTP package to download a bunch of files off a website. I seem to be getting a ECONNRESET error when I try to download the file. Any chance someone might know what is going on …

---

## [Difference in dispatching on Union type vs. subtype of Union type](https://discourse.julialang.org/t/difference-in-dispatching-on-union-type-vs-subtype-of-union-type/13889)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 6\
**Last updated:** [August 22, 2018, 3:37pm UTC](https://discourse.julialang.org/t/difference-in-dispatching-on-union-type-vs-subtype-of-union-type/13889 "2018-08-22T15:37:28Z")

</div>

Hello, I would like to dispatch on the Union type, if I explicitly write it down, it works: julia\> T = Union{\<:Number, Ref{\<:Number}} Union{Ref{#s13} where #s13\<:Number, #s12} where #s12\<:Number julia\> f(x::T, y::T) = …

---

## [Set printing debug messages programmatically](https://discourse.julialang.org/t/set-printing-debug-messages-programmatically/13875)

<div class="topic-metadata">

**Author:** [@ulysses](https://discourse.julialang.org/u/ulysses)\
**Replies:** 1\
**Last updated:** [August 22, 2018, 3:11pm UTC](https://discourse.julialang.org/t/set-printing-debug-messages-programmatically/13875 "2018-08-22T15:11:49Z")

</div>

Is there a way to turn on @debug-printing programmatically instead of using env variable JULIA\_DEBUG? My attempt was using Base.CoreLogging: disable\_logging, BelowMinLevel disable\_logging(BelowMinLevel) @debug("hi") bu…

---

## [Error occurs when using MAT's matwrite and HDF5](https://discourse.julialang.org/t/error-occurs-when-using-mats-matwrite-and-hdf5/13761)

<div class="topic-metadata">

**Author:** [@Caesar\_KG](https://discourse.julialang.org/u/Caesar_KG)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 2:27pm UTC](https://discourse.julialang.org/t/error-occurs-when-using-mats-matwrite-and-hdf5/13761 "2018-08-22T14:27:08Z")

</div>

I’m writing mat files in a loop. The following error occurs somewhere after a few successful outputs. All the files have the same framework except for its size. But their size are also comparable. ======================…

---

## [How do I use getpass?](https://discourse.julialang.org/t/how-do-i-use-getpass/13880)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 12\
**Last updated:** [August 22, 2018, 2:22pm UTC](https://discourse.julialang.org/t/how-do-i-use-getpass/13880 "2018-08-22T14:22:41Z")

</div>

In v0.6.x, I used Base.getpass to prompt the user for a password, then just used string interpolation to pass the password to create a login cookie. I think this was possible because previously, getpass just returned a s…

---

## [Embedding: jl\_init exits on Windows for Julia 0.7](https://discourse.julialang.org/t/embedding-jl-init-exits-on-windows-for-julia-0-7/13819)

<div class="topic-metadata">

**Author:** [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Replies:** 7\
**Last updated:** [August 22, 2018, 10:14am UTC](https://discourse.julialang.org/t/embedding-jl-init-exits-on-windows-for-julia-0-7/13819 "2018-08-22T10:14:48Z")

</div>

I have a proprietary GUI application, written in C++ with QT, to which I have added Julia as a computing backend. This works fine on Linux for Julia 0.6 and 0.7 and on Windows for Julia 0.6. On Windows with Julia 0.7, ho…

---

## [Floating types in Julia](https://discourse.julialang.org/t/floating-types-in-julia/13873)

<div class="topic-metadata">

**Author:** [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Replies:** 1\
**Last updated:** [August 22, 2018, 8:13am UTC](https://discourse.julialang.org/t/floating-types-in-julia/13873 "2018-08-22T08:13:39Z")

</div>

I have a constant value: M\_LN2 = 0.693147180559945309417 I tried storing it as: M\_LN2 = BigFloat(0.693147180559945309417) The result seems to be adding too many extra digits: 6.9314718055994528622676398299518041312…

---

## [New Package manager dependency errors](https://discourse.julialang.org/t/new-package-manager-dependency-errors/13862)

<div class="topic-metadata">

**Author:** [@jdlara-berkeley](https://discourse.julialang.org/u/jdlara-berkeley)\
**Replies:** 0\
**Last updated:** [August 22, 2018, 1:06am UTC](https://discourse.julialang.org/t/new-package-manager-dependency-errors/13862 "2018-08-22T01:06:10Z")

</div>

It is not completely clear to me how to manage dependencies in the new package manager. I have in the manifest of our package a dependency with a specific branch and version. (PowerSystems) pkg\> st -m Project PowerSyste…

---

## [A single value that acts like a vector?](https://discourse.julialang.org/t/a-single-value-that-acts-like-a-vector/13859)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 2\
**Last updated:** [August 22, 2018, 12:25am UTC](https://discourse.julialang.org/t/a-single-value-that-acts-like-a-vector/13859 "2018-08-22T00:25:07Z")

</div>

I am pretty sure this is a common type to use, but what is the name of something like fill(5.0, 100) where the array itself is just 5 pointers to the same place memory? Something that acts like a vector, but doesn’t al…

---

## [using JuMP - LoadError: UndefVarError: start not defined](https://discourse.julialang.org/t/using-jump-loaderror-undefvarerror-start-not-defined/13853)

<div class="topic-metadata">

**Author:** [@Stefano\_C](https://discourse.julialang.org/u/Stefano_C)\
**Replies:** 3\
**Last updated:** [August 21, 2018, 10:19pm UTC](https://discourse.julialang.org/t/using-jump-loaderror-undefvarerror-start-not-defined/13853 "2018-08-21T22:19:29Z")

</div>

Hello, I’ve just installed julia 1.0.0. When running “using JuMP” I get the following error: \[ Info: Precompiling JuMP \[4076af6c-e467-56ae-b986-b466b2749572\] ERROR: LoadError: LoadError: UndefVarError: start not defin…

---

## [Cartesian indices, linear indices, and sparse matrices](https://discourse.julialang.org/t/cartesian-indices-linear-indices-and-sparse-matrices/13781)

<div class="topic-metadata">

**Author:** [@briochemc](https://discourse.julialang.org/u/briochemc)\
**Replies:** 5\
**Last updated:** [August 21, 2018, 9:14pm UTC](https://discourse.julialang.org/t/cartesian-indices-linear-indices-and-sparse-matrices/13781 "2018-08-21T21:14:39Z")

</div>

I will go with a minimal working example and ask questions in bold as I go through it. Before v0.7, I had this working code: A = sparse(\[1,3,4\],\[2,4,3\], \[1,2,3\], 4,5) idx = find(A) # make a sparse matrix using subindic…

---

## [Image Processing Question](https://discourse.julialang.org/t/image-processing-question/13798)

<div class="topic-metadata">

**Author:** [@koenigjaeger](https://discourse.julialang.org/u/koenigjaeger)\
**Replies:** 8\
**Last updated:** [August 21, 2018, 8:46pm UTC](https://discourse.julialang.org/t/image-processing-question/13798 "2018-08-21T20:46:52Z")

</div>

I am converting my filtered back-projection algorithm (Tomographic reconstruction - Wikipedia) from python3 to julia. I’ve already seen major improvements in the projection part of the algorithm (was 20mins with python n…

---

## [Suppressing Stack Trace and Parts](https://discourse.julialang.org/t/suppressing-stack-trace-and-parts/13851)

<div class="topic-metadata">

**Author:** [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Replies:** 0\
**Last updated:** [August 21, 2018, 8:05pm UTC](https://discourse.julialang.org/t/suppressing-stack-trace-and-parts/13851 "2018-08-21T20:05:48Z")

</div>

I have some error messages (@asserts), where I do not need/want the stack trace to be printed out. I would like to see stacktrace lines related only to my own function, not the ones that are triggered later by the i…

---

## [Does redefining Base.values break Julia too easily?](https://discourse.julialang.org/t/does-redefining-base-values-break-julia-too-easily/13845)

<div class="topic-metadata">

**Author:** [@Henri\_Laurie](https://discourse.julialang.org/u/Henri_Laurie)\
**Replies:** 1\
**Last updated:** [August 21, 2018, 8:01pm UTC](https://discourse.julialang.org/t/does-redefining-base-values-break-julia-too-easily/13845 "2018-08-21T20:01:47Z")

</div>

Hi all — I was a bit surprised that old code using “values” as a variable name wouldn’t run under 0.7. Probably rather late to the party, I found out there is now a function Base.values. Being a tad perverse, I tried t…

---

## [BinDeps provider for hwloc library on Windows](https://discourse.julialang.org/t/bindeps-provider-for-hwloc-library-on-windows/13832)

<div class="topic-metadata">

**Author:** [@schnetter](https://discourse.julialang.org/u/schnetter)\
**Replies:** 2\
**Last updated:** [August 21, 2018, 5:39pm UTC](https://discourse.julialang.org/t/bindeps-provider-for-hwloc-library-on-windows/13832 "2018-08-21T17:39:40Z")

</div>

I maintain Julia bindings for the hwloc library at https://github.com/JuliaParallel/Hwloc.jl. Installing hwloc works fine on Linux and Darwin (macOS), but fails on Windows. I have a Windows desktop for experimenting, but…

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

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