# General Usage

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

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

**Page:** 787

---

## [How to "fix" stacktraces for macros?](https://discourse.julialang.org/t/how-to-fix-stacktraces-for-macros/34454)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 12\
**Last updated:** [February 18, 2020, 7:44am UTC](https://discourse.julialang.org/t/how-to-fix-stacktraces-for-macros/34454 "2020-02-18T07:44:05Z")

</div>

When I time a function using TimerOutputs.jl’s @timeit, I get broken stacktraces when there is a compilation error inside the called function. Example: @timeit to "mesh loading" mesh = load\_mesh(restart\_filename) yie…

---

## [How to remove empty array of a list of array](https://discourse.julialang.org/t/how-to-remove-empty-array-of-a-list-of-array/34790)

<div class="topic-metadata">

**Author:** [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Replies:** 2\
**Last updated:** [February 18, 2020, 7:39am UTC](https://discourse.julialang.org/t/how-to-remove-empty-array-of-a-list-of-array/34790 "2020-02-18T07:39:31Z")

</div>

I have a vector that might look like these forms : list\_temp = Any\[(Any\[(“Bus1”, “Bus2"”), (“Bus2”, “Bus1”)\],), (Any,)\] list\_temp = Any\[(Any,), (Any\[(“Madagascar1”, “Madagascar2”)\],)\] I would like to remove any empt…

---

## [Force specialization on varargs when the arguments are not all of the same concrete type](https://discourse.julialang.org/t/force-specialization-on-varargs-when-the-arguments-are-not-all-of-the-same-concrete-type/34788)

<div class="topic-metadata">

**Author:** [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Replies:** 5\
**Last updated:** [February 18, 2020, 7:23am UTC](https://discourse.julialang.org/t/force-specialization-on-varargs-when-the-arguments-are-not-all-of-the-same-concrete-type/34788 "2020-02-18T07:23:32Z")

</div>

The manual page on Performance Tips (https://github.com/JuliaLang/julia/blob/master/doc/src/manual/performance-tips.md) says: This will not specialize: f\_vararg(x::Int...) = tuple(x...) but this will: g\_vararg(x::Va…

---

## [How to use CompressedSensing package by using function instead of measurement matrix?](https://discourse.julialang.org/t/how-to-use-compressedsensing-package-by-using-function-instead-of-measurement-matrix/34787)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 2\
**Last updated:** [February 18, 2020, 5:48am UTC](https://discourse.julialang.org/t/how-to-use-compressedsensing-package-by-using-function-instead-of-measurement-matrix/34787 "2020-02-18T05:48:26Z")

</div>

Hi, I am trying to use CompressedSensing package. I went through the examples in the documentation is as follows: n=1000 #Signal Dimensions m=400 #Measurement Dimension k=100 #Approximate Sparsity Signal = ze…

---

## [Is VegaLite.jl fully written in julia language?](https://discourse.julialang.org/t/is-vegalite-jl-fully-written-in-julia-language/34778)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 2\
**Last updated:** [February 17, 2020, 10:06pm UTC](https://discourse.julialang.org/t/is-vegalite-jl-fully-written-in-julia-language/34778 "2020-02-17T22:06:54Z")

</div>

Hi I have used VegaLite.jl to plot a choropleth map in Julia. And Geopandas to plot the same in Python. As I want to make a benchmark between both I would like to know if VegaLite.jl has been fully written in Julia or…

---

## [How to send an array from Splunk to a dataframe?](https://discourse.julialang.org/t/how-to-send-an-array-from-splunk-to-a-dataframe/34765)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 11\
**Last updated:** [February 17, 2020, 9:22pm UTC](https://discourse.julialang.org/t/how-to-send-an-array-from-splunk-to-a-dataframe/34765 "2020-02-17T21:22:18Z")

</div>

Hi I have used Splunk API (in Python) to retrive data. Then I am sending that data to a Dataframe. This is the code: results=pyimport("splunklib.results") kwargs\_oneshot = (earliest\_time= "2019-09-07T12:00:00.000-07:0…

---

## [Looping over rows and columns: what am I doing wrong?](https://discourse.julialang.org/t/looping-over-rows-and-columns-what-am-i-doing-wrong/34761)

<div class="topic-metadata">

**Author:** [@edwinb-ai](https://discourse.julialang.org/u/edwinb-ai)\
**Replies:** 4\
**Last updated:** [February 17, 2020, 8:42pm UTC](https://discourse.julialang.org/t/looping-over-rows-and-columns-what-am-i-doing-wrong/34761 "2020-02-17T20:42:08Z")

</div>

Following some of the Performance Tips in the main Julia documentation I was a trying the following code, timing it with BenchmarkTools.jl: using Random using BenchmarkTools b = rand(3, 100) function loop\_rows(a::Abst…

---

## [Colorize error output by default when running Julia script](https://discourse.julialang.org/t/colorize-error-output-by-default-when-running-julia-script/34456)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 6\
**Last updated:** [February 17, 2020, 3:44pm UTC](https://discourse.julialang.org/t/colorize-error-output-by-default-when-running-julia-script/34456 "2020-02-17T15:44:12Z")

</div>

On my system (Ubuntu 19.10), Julia does not colorize error output when run through the shebang of an executable script. That is, if I create a script foo.jl with a shebang as #!/usr/bin/env julia ... and run it as ./f…

---

## [Change Base Level Categorical Vector in GLM](https://discourse.julialang.org/t/change-base-level-categorical-vector-in-glm/18288)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 11\
**Last updated:** [February 17, 2020, 3:44pm UTC](https://discourse.julialang.org/t/change-base-level-categorical-vector-in-glm/18288 "2020-02-17T15:44:42Z")

</div>

Is there a way to change the base level of a categorical vector in GLM? It looks like the first level in the vector is chosen as the base level. I have tried to change the order of levels using levels! but it does not se…

---

## [Problem trying to build julia-1.3.1 from source](https://discourse.julialang.org/t/problem-trying-to-build-julia-1-3-1-from-source/34758)

<div class="topic-metadata">

**Author:** [@dslate](https://discourse.julialang.org/u/dslate)\
**Replies:** 0\
**Last updated:** [February 17, 2020, 2:20pm UTC](https://discourse.julialang.org/t/problem-trying-to-build-julia-1-3-1-from-source/34758 "2020-02-17T14:20:56Z")

</div>

For various reasons I would like to build julia-1.3.1 from source offline. So I downloaded and unpacked julia-1.3.1-full.tar.gz on my online machine, which is an x86\_64 workstation running Ubuntu Linux 16.04.6 LTS. I cd’…

---

## [Pkg crashes](https://discourse.julialang.org/t/pkg-crashes/34750)

<div class="topic-metadata">

**Author:** [@mih](https://discourse.julialang.org/u/mih)\
**Replies:** 5\
**Last updated:** [February 17, 2020, 1:38pm UTC](https://discourse.julialang.org/t/pkg-crashes/34750 "2020-02-17T13:38:13Z")

</div>

I’m new to Julia so please be patient with me. I tried to install the SQLite package by running the Julia repl using Pkg add SQLite. Unfortunately the repl crashes: Before I’m getting lots of errors: ‘unknown line …’, …

---

## [Pkg gc throws unknown string escape error](https://discourse.julialang.org/t/pkg-gc-throws-unknown-string-escape-error/34289)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 1\
**Last updated:** [February 17, 2020, 10:29am UTC](https://discourse.julialang.org/t/pkg-gc-throws-unknown-string-escape-error/34289 "2020-02-17T10:29:11Z")

</div>

Can someone give me a hint on how to fix this. Which file contains the wrong string escape? Julia Version 1.3.1 Commit 2d5741174c (2019-12-30 21:36 UTC) Platform Info: OS: Windows (x86\_64-w64-mingw32) CPU: Intel(R)…

---

## [Int numerical calculation speed slower than Float?](https://discourse.julialang.org/t/int-numerical-calculation-speed-slower-than-float/34705)

<div class="topic-metadata">

**Author:** [@nuclear718](https://discourse.julialang.org/u/nuclear718)\
**Replies:** 12\
**Last updated:** [February 17, 2020, 10:10am UTC](https://discourse.julialang.org/t/int-numerical-calculation-speed-slower-than-float/34705 "2020-02-17T10:10:24Z")

</div>

Why the calculation speed of “Int” matrix is much slower than “Float” matrix? IDE: Jupyter Julia version: 1.1.0 Code for Float: s=1000 d1=rand(s,s) d2=rand(s,s) @time (d1\*d2); Result: 0.032192 seconds (6 allocati…

---

## [Plotly() save in very low resolution](https://discourse.julialang.org/t/plotly-save-in-very-low-resolution/34742)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 2\
**Last updated:** [February 17, 2020, 8:13am UTC](https://discourse.julialang.org/t/plotly-save-in-very-low-resolution/34742 "2020-02-17T08:13:08Z")

</div>

Wouls somebody suggests, how to save plotly figure with reasonably high resolution? thank you.

---

## [Module version standard/convention](https://discourse.julialang.org/t/module-version-standard-convention/34686)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 3\
**Last updated:** [February 17, 2020, 12:07am UTC](https://discourse.julialang.org/t/module-version-standard-convention/34686 "2020-02-17T00:07:06Z")

</div>

In the Python world, you can find out the current version of a module by querying \_version\_ attribute of the module. Is there any reason why we shouldn’t adopt a similar standard/convention so that one can dynamically f…

---

## [Is it possible to "precompile" a method with a set of argument types?](https://discourse.julialang.org/t/is-it-possible-to-precompile-a-method-with-a-set-of-argument-types/34730)

<div class="topic-metadata">

**Author:** [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Replies:** 7\
**Last updated:** [February 16, 2020, 10:06pm UTC](https://discourse.julialang.org/t/is-it-possible-to-precompile-a-method-with-a-set-of-argument-types/34730 "2020-02-16T22:06:44Z")

</div>

I swear i saw a macro at some point that allowed you to precompile methods. However I haven’t been able to google for it. I do find lots on compileing my whole application or compiling to an executable. I’m trying to f…

---

## [Nesting @ncall](https://discourse.julialang.org/t/nesting-ncall/34724)

<div class="topic-metadata">

**Author:** [@Snir\_Gazit](https://discourse.julialang.org/u/Snir_Gazit)\
**Replies:** 0\
**Last updated:** [February 16, 2020, 2:21pm UTC](https://discourse.julialang.org/t/nesting-ncall/34724 "2020-02-16T14:21:58Z")

</div>

I would like to “nest” @ncall operations from Bese.Cartesian. The motivation is to create a statically sized Svector of Svectors. To that end, I tried the following: julia\> using StaticArrays julia\> using Base.Cartes…

---

## [Problem with replacing module and ambiguous methods](https://discourse.julialang.org/t/problem-with-replacing-module-and-ambiguous-methods/34712)

<div class="topic-metadata">

**Author:** [@EvgeniyMist](https://discourse.julialang.org/u/EvgeniyMist)\
**Replies:** 3\
**Last updated:** [February 16, 2020, 10:02am UTC](https://discourse.julialang.org/t/problem-with-replacing-module-and-ambiguous-methods/34712 "2020-02-16T10:02:12Z")

</div>

Initially, I wanted to create a structure similar to a linked list, but more complex, namely: mutable struct Move data::Int64 next\_moves::Union{Array{Move, 1}, Nothing} Move(data) = new(data, nothing) end N…

---

## [Syntax: use "^" instead of "\*\*" AND syntax: "^" is not a unary operator](https://discourse.julialang.org/t/syntax-use-instead-of-and-syntax-is-not-a-unary-operator/34258)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 8\
**Last updated:** [February 16, 2020, 1:06am UTC](https://discourse.julialang.org/t/syntax-use-instead-of-and-syntax-is-not-a-unary-operator/34258 "2020-02-16T01:06:03Z")

</div>

Hi I am translating Python into Julia. When converting this python line into Julia I get an error. oneshotsearch\_results = service.jobs.oneshot(searchquery\_oneshot, \*\*kwargs\_oneshot) syntax: use "^" instead of "\*\*" S…

---

## [Memory requirement in \`addprocs\` and loading packages](https://discourse.julialang.org/t/memory-requirement-in-addprocs-and-loading-packages/34695)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 0\
**Last updated:** [February 16, 2020, 12:52am UTC](https://discourse.julialang.org/t/memory-requirement-in-addprocs-and-loading-packages/34695 "2020-02-16T00:52:36Z")

</div>

My cluster jobs keep getting killed due to execd enforced h\_vmem limit. My script is below: using Distributed addprocs(8) println("loaded 8 cores...") @everywhere begin using DifferentialEquations using Thyros…

---

## [How can I add a legend](https://discourse.julialang.org/t/how-can-i-add-a-legend/34667)

<div class="topic-metadata">

**Author:** [@bayerndd](https://discourse.julialang.org/u/bayerndd)\
**Replies:** 3\
**Last updated:** [February 16, 2020, 12:01am UTC](https://discourse.julialang.org/t/how-can-i-add-a-legend/34667 "2020-02-16T00:01:24Z")

</div>

Hi! I plot a data, for example y = \[1, 2, 3, 999, 34, 35, 34, 23, 345, 234, 23\] and with classes=\[1, 2, 1, 2, 3, 1, 2, 3, …\] Then I write: plot(x, y, linecolor = classes) So I get a plot with one line with three diff…

---

## [Gadfly legend (key)](https://discourse.julialang.org/t/gadfly-legend-key/34649)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 2\
**Last updated:** [February 15, 2020, 8:05pm UTC](https://discourse.julialang.org/t/gadfly-legend-key/34649 "2020-02-15T20:05:07Z")

</div>

The new version of gadfly adds a white line around the colors in the Key (legend). How to remove it?!

---

## [Extracting HREFs from HTML?](https://discourse.julialang.org/t/extracting-hrefs-from-html/33670)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 0\
**Last updated:** [January 22, 2020, 5:10pm UTC](https://discourse.julialang.org/t/extracting-hrefs-from-html/33670 "2020-01-22T17:10:07Z")

</div>

Do you know examples of extracting hrefs (links) from html doc ? Regx or some package? Thanks, Paul

---

## [How to stop the notification of julia extension of vscode about "help to improve ..." without accepting it](https://discourse.julialang.org/t/how-to-stop-the-notification-of-julia-extension-of-vscode-about-help-to-improve-without-accepting-it/34671)

<div class="topic-metadata">

**Author:** [@AmirHosein](https://discourse.julialang.org/u/AmirHosein)\
**Replies:** 4\
**Last updated:** [February 15, 2020, 5:13pm UTC](https://discourse.julialang.org/t/how-to-stop-the-notification-of-julia-extension-of-vscode-about-help-to-improve-without-accepting-it/34671 "2020-02-15T17:13:37Z")

</div>

If you are using Julia on VS Code, then you are aware of the automatic notification of the Julia extension which asks you the following; To help improve the julia extension, you can anonymously send usage statistics to…

---

## [Best strategy to profile parallel code](https://discourse.julialang.org/t/best-strategy-to-profile-parallel-code/34582)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 5:02pm UTC](https://discourse.julialang.org/t/best-strategy-to-profile-parallel-code/34582 "2020-02-15T17:02:08Z")

</div>

Does anyone know a relatively cheap way to profile the parallel code? I’ve seen some old thread on StackOverflow: Julia: How to profile parallel code. The suggestion there was to add profiling to the functions which are…

---

## [Why is this case type-unstable?](https://discourse.julialang.org/t/why-is-this-case-type-unstable/34648)

<div class="topic-metadata">

**Author:** [@rvignolo](https://discourse.julialang.org/u/rvignolo)\
**Replies:** 6\
**Last updated:** [February 15, 2020, 4:42pm UTC](https://discourse.julialang.org/t/why-is-this-case-type-unstable/34648 "2020-02-15T16:42:28Z")

</div>

The following MWE behaves unexpectedly (for me): julia\> function f(t) return t end f (generic function with 1 method) julia\> @code\_warntype sum(f(1) for i in 1:2) Variables #self#::Core.Compiler.Const…

---

## [Optimization tips for my julia code. Can I make it even faster and/or memory efficient?](https://discourse.julialang.org/t/optimization-tips-for-my-julia-code-can-i-make-it-even-faster-and-or-memory-efficient/34614)

<div class="topic-metadata">

**Author:** [@PyDataBlog](https://discourse.julialang.org/u/PyDataBlog)\
**Replies:** 24\
**Last updated:** [February 15, 2020, 2:22pm UTC](https://discourse.julialang.org/t/optimization-tips-for-my-julia-code-can-i-make-it-even-faster-and-or-memory-efficient/34614 "2020-02-15T14:22:49Z")

</div>

Hi everyone, I have been learning Julia since January by trying to implement classic machine learning algorithms from scratch. My latest project is the KMeans clustering algorithm. I have been successful with this imple…

---

## [HTTP.get Error](https://discourse.julialang.org/t/http-get-error/34646)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 1\
**Last updated:** [February 15, 2020, 8:12am UTC](https://discourse.julialang.org/t/http-get-error/34646 "2020-02-15T08:12:01Z")

</div>

Version 0.7.0 (2018-08-08 06:46 UTC) Official http://julialang.org/ release x86\_64-w64-mingw32 WIN7 64 What wrong ? julia\> using HTTP julia\> using MbedTLS julia\> pomp="https://www.pomponik.pl/" "https://www.pomponik…

---

## [How would I divide each row of a Julia dataframe by that rows maximum and return a new dataframe](https://discourse.julialang.org/t/how-would-i-divide-each-row-of-a-julia-dataframe-by-that-rows-maximum-and-return-a-new-dataframe/34597)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 16\
**Last updated:** [February 15, 2020, 12:34am UTC](https://discourse.julialang.org/t/how-would-i-divide-each-row-of-a-julia-dataframe-by-that-rows-maximum-and-return-a-new-dataframe/34597 "2020-02-15T00:34:46Z")

</div>

Hi, I’ve been looking around and messing with map, eachrow and different things but I haven’t been able to figure it out. Essentially, if I have a N x M dataframe, I want to return a new N x M dataframe, except each va…

---

## [Redirection and shell commands](https://discourse.julialang.org/t/redirection-and-shell-commands/34651)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 0\
**Last updated:** [February 14, 2020, 9:27pm UTC](https://discourse.julialang.org/t/redirection-and-shell-commands/34651 "2020-02-14T21:27:00Z")

</div>

From the zsh command line, the following works: \> sed 's/BEGIN.\*END,//' file.csv \> file.csv from the Julia shell environment, it doesn’t: ;sed 's/BEGIN.\*END,//' file.csv \> file.csv sed: \>: No such file or directory T…

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

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