# General Usage

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

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

**Page:** 704

---

## [Image in REPL does not correct](https://discourse.julialang.org/t/image-in-repl-does-not-correct/46359)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 16\
**Last updated:** [September 11, 2020, 9:33pm UTC](https://discourse.julialang.org/t/image-in-repl-does-not-correct/46359 "2020-09-11T21:33:47Z")

</div>

When running the ImageInTerminal package I get these images: And when I start ImageView I receive the following alert: using ImageView Julia\>using ImageView \[ Info: Precompiling ImageView \[86fae568-95e7-573e-a6b2-d8…

---

## [Choice between abstract type and union of vectors of types to feed functions that operate on vectors of more than one type](https://discourse.julialang.org/t/choice-between-abstract-type-and-union-of-vectors-of-types-to-feed-functions-that-operate-on-vectors-of-more-than-one-type/46399)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 13\
**Last updated:** [September 11, 2020, 3:22pm UTC](https://discourse.julialang.org/t/choice-between-abstract-type-and-union-of-vectors-of-types-to-feed-functions-that-operate-on-vectors-of-more-than-one-type/46399 "2020-09-11T15:22:28Z")

</div>

I have two data structures, and some functions that have to operate on vectors of those data structures. One option is to define an abstract type as a supertype of both data structures. The other option is to create a ne…

---

## [Truncated labels in StatsPlots groupedbar plot](https://discourse.julialang.org/t/truncated-labels-in-statsplots-groupedbar-plot/46451)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [September 11, 2020, 12:01pm UTC](https://discourse.julialang.org/t/truncated-labels-in-statsplots-groupedbar-plot/46451 "2020-09-11T12:01:08Z")

</div>

In the plot below, the first and last characters of the labels on the x-axis are truncated. Is there any way around this aside from adding spaces? Thank you using StatsPlots, DataFrames pyplot() df = DataFrame(a=repeat…

---

## [Is there a transpiler from shell to Julia \`Cmd\`s?](https://discourse.julialang.org/t/is-there-a-transpiler-from-shell-to-julia-cmd-s/46427)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [September 11, 2020, 1:54pm UTC](https://discourse.julialang.org/t/is-there-a-transpiler-from-shell-to-julia-cmd-s/46427 "2020-09-11T13:54:15Z")

</div>

I am developing a package that can run shell commands. I know “shellout sucks” and using the shell is very unrecommended in Julia, but there’s time users want their code copied from scripts can just work. And transformin…

---

## [Help converting a transformation matrix](https://discourse.julialang.org/t/help-converting-a-transformation-matrix/46095)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 5\
**Last updated:** [September 11, 2020, 11:48am UTC](https://discourse.julialang.org/t/help-converting-a-transformation-matrix/46095 "2020-09-11T11:48:31Z")

</div>

For lack of a better alternative, I’m using Matlab’s image calibration toolbox. One of the things I’m after is the transformation matrix Matlab’s fitgeotrans outputs: tform = fitgeotrans(imagePoints, worldPoints, 'proje…

---

## [Status of Pkg speed improvements outside US in v1.5](https://discourse.julialang.org/t/status-of-pkg-speed-improvements-outside-us-in-v1-5/46395)

<div class="topic-metadata">

**Author:** [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Replies:** 19\
**Last updated:** [September 11, 2020, 7:40am UTC](https://discourse.julialang.org/t/status-of-pkg-speed-improvements-outside-us-in-v1-5/46395 "2020-09-11T07:40:41Z")

</div>

One of the improvements I was most looking forward to in v1.5 is the new Pkg infrastructure with expected speed improvements for non-US users. But so far my end-user experience is largely unchanged. Is this expected, or …

---

## [Understanding memory allocations](https://discourse.julialang.org/t/understanding-memory-allocations/46379)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 6\
**Last updated:** [September 11, 2020, 5:47am UTC](https://discourse.julialang.org/t/understanding-memory-allocations/46379 "2020-09-11T05:47:08Z")

</div>

I want fast code. :sunglasses: I will get a core meltdown. I try to understand why some code allocates while other doesn’t. Here is my little benchmark, and I cannot make head or tail of the results. b = Complex(1.,2…

---

## [BLAS vs CUBLAS benchmark](https://discourse.julialang.org/t/blas-vs-cublas-benchmark/46205)

<div class="topic-metadata">

**Author:** [@Szymon\_Zak](https://discourse.julialang.org/u/Szymon_Zak)\
**Replies:** 13\
**Last updated:** [September 11, 2020, 4:17am UTC](https://discourse.julialang.org/t/blas-vs-cublas-benchmark/46205 "2020-09-11T04:17:43Z")

</div>

Hello. I’m trying to compare BLAS and CUBLAS performance with Julia. For example, I want to compare matrix multiplication time. Let A, B, C will be \[NxN\] matrices. Which function, should I use to get something like C…

---

## [How to create tab space using @sprintf?](https://discourse.julialang.org/t/how-to-create-tab-space-using-sprintf/46421)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 6\
**Last updated:** [September 11, 2020, 12:13am UTC](https://discourse.julialang.org/t/how-to-create-tab-space-using-sprintf/46421 "2020-09-11T00:13:30Z")

</div>

For some reasons, I would like to stick to using sprintf and I need to write into a file when each line has a tab space in the beginning. Here is what I wrote but it doesn’t work: ff = open("test.txt", "w") ss = Array{…

---

## [How to capture a for loop index after break?](https://discourse.julialang.org/t/how-to-capture-a-for-loop-index-after-break/46342)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 22\
**Last updated:** [September 10, 2020, 11:02pm UTC](https://discourse.julialang.org/t/how-to-capture-a-for-loop-index-after-break/46342 "2020-09-10T23:02:38Z")

</div>

Is there a way to have a non-local scope loop index, so code similar to this: for i = 1:9 if i \> 3 break end end println(i) works and I don’t have to write: j = 0 for i = 1:9 if i \> 3 j = i break …

---

## [Package Manager: Erratic behavior?](https://discourse.julialang.org/t/package-manager-erratic-behavior/46340)

<div class="topic-metadata">

**Author:** [@gaspardelanuit](https://discourse.julialang.org/u/gaspardelanuit)\
**Replies:** 4\
**Last updated:** [September 10, 2020, 7:26pm UTC](https://discourse.julialang.org/t/package-manager-erratic-behavior/46340 "2020-09-10T19:26:10Z")

</div>

After installing the ShiftedArrays package I have observed that a bunch of the packages I have installed were downgraded (while some were upgraded). Most egregiously was plots which reverted to 0.28.4 from 1.6.3 I am a…

---

## [DamerauLevenshtein() vs Levenshtein() why the same distance?](https://discourse.julialang.org/t/dameraulevenshtein-vs-levenshtein-why-the-same-distance/46393)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 1\
**Last updated:** [September 10, 2020, 6:08pm UTC](https://discourse.julialang.org/t/dameraulevenshtein-vs-levenshtein-why-the-same-distance/46393 "2020-09-10T18:08:37Z")

</div>

I expected a shorter distance for Damerau Levenshtein because there is an exchange of two letters. Why are there the same results? julia\> compare("martha", "martht", DamerauLevenshtein()) 0.8333333333333334 julia\> comp…

---

## [Restart iteration in a for loop when an error is thrown](https://discourse.julialang.org/t/restart-iteration-in-a-for-loop-when-an-error-is-thrown/43850)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 14\
**Last updated:** [September 10, 2020, 4:36pm UTC](https://discourse.julialang.org/t/restart-iteration-in-a-for-loop-when-an-error-is-thrown/43850 "2020-09-10T16:36:17Z")

</div>

I have to run a for loop based on random numbers generation and inversion of a matrix. When the matrix is singular, my code stops, throwing a SingularException() error. If this occurs at a certain iteration of the loop, …

---

## [Tool to tell if a package has unused dependencies or using unused packages](https://discourse.julialang.org/t/tool-to-tell-if-a-package-has-unused-dependencies-or-using-unused-packages/36254)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 11\
**Last updated:** [September 10, 2020, 2:21pm UTC](https://discourse.julialang.org/t/tool-to-tell-if-a-package-has-unused-dependencies-or-using-unused-packages/36254 "2020-09-10T14:21:19Z")

</div>

When developing large projects, I sometimes 1) lose track of what packages I \]added but am not using any longer, and 2) what packages I’m using but not actually making use of. Is there a tool to detect these kind of sit…

---

## [Optimizing a package: how to get started](https://discourse.julialang.org/t/optimizing-a-package-how-to-get-started/46341)

<div class="topic-metadata">

**Author:** [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Replies:** 7\
**Last updated:** [September 10, 2020, 1:32pm UTC](https://discourse.julialang.org/t/optimizing-a-package-how-to-get-started/46341 "2020-09-10T13:32:37Z")

</div>

The improvements in Julia v1.5.1, tools like SnoopCompile.jl, and the recent posts by Tim Holy have motivated me to see if I can extract further performance from my plotting package Gaston. Being fairly new to this kind …

---

## [Scale axes in heatmap/plot](https://discourse.julialang.org/t/scale-axes-in-heatmap-plot/46375)

<div class="topic-metadata">

**Author:** [@marrdoc](https://discourse.julialang.org/u/marrdoc)\
**Replies:** 2\
**Last updated:** [September 10, 2020, 12:54pm UTC](https://discourse.julialang.org/t/scale-axes-in-heatmap-plot/46375 "2020-09-10T12:54:09Z")

</div>

I want to plot the magnitude of the values of a certain function with complex arguments. Thus, I created two LinRanges (for real and imaginary part) and fed the function with it to obtain a matrix. Now I plotted the fun…

---

## [How to write generic low-rank updates?](https://discourse.julialang.org/t/how-to-write-generic-low-rank-updates/46370)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 3\
**Last updated:** [September 10, 2020, 11:15am UTC](https://discourse.julialang.org/t/how-to-write-generic-low-rank-updates/46370 "2020-09-10T11:15:08Z")

</div>

I have to make computations with a low-rank update of a matrix A+uv. Is there a way to modify the statement x = A\*w + u \* (v\*w) so that it works generically for all reasonable types? u,v could be a vector and its adjo…

---

## [Julia Function](https://discourse.julialang.org/t/julia-function/46303)

<div class="topic-metadata">

**Author:** [@hola](https://discourse.julialang.org/u/hola)\
**Replies:** 10\
**Last updated:** [September 10, 2020, 10:03am UTC](https://discourse.julialang.org/t/julia-function/46303 "2020-09-10T10:03:50Z")

</div>

hi. kindly help with this. Stuck at it for hours. How can I implement a Julia function for the product of two matrices AB via dot products, linear combination of columns, linear combination of rows and sum of outer pro…

---

## [Something's buggy with array assignment .=?](https://discourse.julialang.org/t/somethings-buggy-with-array-assignment/46356)

<div class="topic-metadata">

**Author:** [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Replies:** 6\
**Last updated:** [September 10, 2020, 9:18am UTC](https://discourse.julialang.org/t/somethings-buggy-with-array-assignment/46356 "2020-09-10T09:18:50Z")

</div>

function testnc( init::Dict,eroot::Dict; regID::AbstractString="GLB", timeID::Union{Integer,Vector}=0, gres::Real=0 ) emod,epar,ereg,etime = erainitialize( init; modID="dsfc",parID="p\_sfc…

---

## [Types vs traits for dispatch](https://discourse.julialang.org/t/types-vs-traits-for-dispatch/46296)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 7\
**Last updated:** [September 10, 2020, 7:57am UTC](https://discourse.julialang.org/t/types-vs-traits-for-dispatch/46296 "2020-09-10T07:57:00Z")

</div>

I recently learned about the Tim Holy Trait Trick as one way to dispatch on “groups” of types outside of a type hierarchy. This seems more general to me than dispatch based on type hierarchy, but I’m not sure. Are there…

---

## [Finding the "minimal" necessary type of a vector and converting to it](https://discourse.julialang.org/t/finding-the-minimal-necessary-type-of-a-vector-and-converting-to-it/46338)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 4\
**Last updated:** [September 10, 2020, 6:11am UTC](https://discourse.julialang.org/t/finding-the-minimal-necessary-type-of-a-vector-and-converting-to-it/46338 "2020-09-10T06:11:24Z")

</div>

I am having a hard time finding the “minimal” type necessary for a vector and converting to it. By “minimal” I mean the type that can still hold all of the values without being too general. For example: String \> Float64…

---

## [Possible bug in type inference? (4 line MWE)](https://discourse.julialang.org/t/possible-bug-in-type-inference-4-line-mwe/46353)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 9\
**Last updated:** [September 10, 2020, 3:17am UTC](https://discourse.julialang.org/t/possible-bug-in-type-inference-4-line-mwe/46353 "2020-09-10T03:17:11Z")

</div>

Hello! I came across a weird type inference failure when using generators. Here is a MWE. function example() col = 2 ss = (col for \_ in 1:5) col += 3 return col, ss end function example2() col = 2 …

---

## [ForwardDiff: Error ForwardDiff.Tag How to transform a Dual Type to a Float](https://discourse.julialang.org/t/forwarddiff-error-forwarddiff-tag-how-to-transform-a-dual-type-to-a-float/45884)

<div class="topic-metadata">

**Author:** [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Replies:** 9\
**Last updated:** [September 10, 2020, 2:41am UTC](https://discourse.julialang.org/t/forwarddiff-error-forwarddiff-tag-how-to-transform-a-dual-type-to-a-float/45884 "2020-09-10T02:41:10Z")

</div>

Hallo, I am struggling to get the simple derivatives works. I looked at many examples of ForwardDiff but still failed to solve my problem. I am solving a Jacobian of a Triagonal Matrix by using numerical derivatives in…

---

## [Ahead-Of-Time (AOT) Compiler](https://discourse.julialang.org/t/ahead-of-time-aot-compiler/14212)

<div class="topic-metadata">

**Author:** [@nordlow](https://discourse.julialang.org/u/nordlow)\
**Replies:** 6\
**Last updated:** [September 9, 2020, 9:54pm UTC](https://discourse.julialang.org/t/ahead-of-time-aot-compiler/14212 "2020-09-09T21:54:30Z")

</div>

Are there any plans for implementing an ahead-of-time-compiler in Julia that can generate standalone executables? I believe such a feature would attract a very large set of new (system) programmers typically programming…

---

## [How to properly install the OpenCV package in Julia](https://discourse.julialang.org/t/how-to-properly-install-the-opencv-package-in-julia/24619)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 3\
**Last updated:** [September 9, 2020, 5:14pm UTC](https://discourse.julialang.org/t/how-to-properly-install-the-opencv-package-in-julia/24619 "2020-09-09T17:14:00Z")

</div>

How to properly install the OpenCv package in Julia. I want to correctly install the OpenCV package in Julia, but when I install OpenCV, I get this error. ERROR: The following package names could not be resolved: Ope…

---

## [What is the most performant way of bootstrapping a self-referential mutable struct?](https://discourse.julialang.org/t/what-is-the-most-performant-way-of-bootstrapping-a-self-referential-mutable-struct/46238)

<div class="topic-metadata">

**Author:** [@Lucas\_Queiroz](https://discourse.julialang.org/u/Lucas_Queiroz)\
**Replies:** 11\
**Last updated:** [September 9, 2020, 2:45pm UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-of-bootstrapping-a-self-referential-mutable-struct/46238 "2020-09-09T14:45:36Z")

</div>

Consider the self-referential struct below: mutable struct T field::T end The circularity in the way T was defined prevents me from ever constructing an object of type T. I have considered two ways out: mutable s…

---

## [What wrong ? range of cell fo String Array](https://discourse.julialang.org/t/what-wrong-range-of-cell-fo-string-array/46329)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 5\
**Last updated:** [September 9, 2020, 2:35pm UTC](https://discourse.julialang.org/t/what-wrong-range-of-cell-fo-string-array/46329 "2020-09-09T14:35:28Z")

</div>

julia\> kody5\[1\] "orbis sa 00-028 ul bracka 16 oddzial hotel aria w sosnowcu" julia\> findall(rx,kody5\[1\]) 1-element Array{UnitRange{Int64},1}: 10:15 julia\> kody5\[1\]findall(rx,kody5\[1\]) ERROR: MethodError: no method mat…

---

## [How to create a file where the columns are separated by equal space](https://discourse.julialang.org/t/how-to-create-a-file-where-the-columns-are-separated-by-equal-space/46240)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 4\
**Last updated:** [September 9, 2020, 1:48pm UTC](https://discourse.julialang.org/t/how-to-create-a-file-where-the-columns-are-separated-by-equal-space/46240 "2020-09-09T13:48:11Z")

</div>

Here is the code I use to create the file: ar = \[\[1, 85645, 197111, 197240\], \[1, 203753\],\[1, 24\]\] loop = 0 for i =1:3#length(ar) val = ar\[i\]' .-1 print(ff, "NetDegree : ", length(val), " ", …

---

## [Why do global variables impact performance so badly?](https://discourse.julialang.org/t/why-do-global-variables-impact-performance-so-badly/46293)

<div class="topic-metadata">

**Author:** [@originalsouth](https://discourse.julialang.org/u/originalsouth)\
**Replies:** 11\
**Last updated:** [September 9, 2020, 1:39pm UTC](https://discourse.julialang.org/t/why-do-global-variables-impact-performance-so-badly/46293 "2020-09-09T13:39:22Z")

</div>

I have two almost identical codes: #!/usr/bin/env julia using Random if(length(ARGS)==1) N=parse(Int64,ARGS\[1\]) else N=1000 end function play() r=0 counter=0.0 while r\<1.0 r+=rand(Float64)…

---

## [One column arrays and vectors](https://discourse.julialang.org/t/one-column-arrays-and-vectors/46321)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 3\
**Last updated:** [September 9, 2020, 1:31pm UTC](https://discourse.julialang.org/t/one-column-arrays-and-vectors/46321 "2020-09-09T13:31:59Z")

</div>

I have a function that accepts your choice of one column arrays or vectors. Now I want to add a method and dispatch on one column arrays or vectors to get my original method. How do I create a type to let me do that? Th…

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

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