# General Usage

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

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

**Page:** 683

---

## [How can I force Pkg ( and LibGit2 ) to ignore SSL Verification (sslVerify)?](https://discourse.julialang.org/t/how-can-i-force-pkg-and-libgit2-to-ignore-ssl-verification-sslverify/25306)

<div class="topic-metadata">

**Author:** [@aussetg](https://discourse.julialang.org/u/aussetg)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 4:39pm UTC](https://discourse.julialang.org/t/how-can-i-force-pkg-and-libgit2-to-ignore-ssl-verification-sslverify/25306 "2020-11-02T16:39:15Z")

</div>

Hi, I’m behind a corporate proxy and SSL Verifications fail ( because they are MITMed ). Outside of Julia I can clone by using the corporate proxy and specifying sslVerify = false in .gitconfig. But apparently LibGit2 …

---

## [Character sequence for a unicode character](https://discourse.julialang.org/t/character-sequence-for-a-unicode-character/49452)

<div class="topic-metadata">

**Author:** [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Replies:** 7\
**Last updated:** [November 2, 2020, 3:03pm UTC](https://discourse.julialang.org/t/character-sequence-for-a-unicode-character/49452 "2020-11-02T15:03:15Z")

</div>

I’d like to get the keyboard input needed to write a unicode symbol. Alternatively, getting the help output of the symbol would be just as good. That is, for 𝒜 help?\> 𝒜 "𝒜" can be typed by \\scrA\<tab\> ... I’d like to ge…

---

## [Fault tolerant \`pmap\` when worker goes down](https://discourse.julialang.org/t/fault-tolerant-pmap-when-worker-goes-down/21648)

<div class="topic-metadata">

**Author:** [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Replies:** 4\
**Last updated:** [November 2, 2020, 2:28pm UTC](https://discourse.julialang.org/t/fault-tolerant-pmap-when-worker-goes-down/21648 "2020-11-02T14:28:41Z")

</div>

Is there a way to make pmap fault tolerant to procs going down? This example shows that the on\_error option does not capture this: julia\> using Distributed …

---

## [Distributed Simulations](https://discourse.julialang.org/t/distributed-simulations/49098)

<div class="topic-metadata">

**Author:** [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Replies:** 1\
**Last updated:** [November 2, 2020, 12:04pm UTC](https://discourse.julialang.org/t/distributed-simulations/49098 "2020-11-02T12:04:47Z")

</div>

Hello! I’m trying to parallelize this jacobi code but it is not working, can someone help me, please? using Distributed addprocs(2) @everywhere using LinearAlgebra @everywhere using DistributedArrays @everywhere n=5 @e…

---

## [Having a submodule import a top-level module](https://discourse.julialang.org/t/having-a-submodule-import-a-top-level-module/48266)

<div class="topic-metadata">

**Author:** [@jonathan-laurent](https://discourse.julialang.org/u/jonathan-laurent)\
**Replies:** 3\
**Last updated:** [November 2, 2020, 11:34am UTC](https://discourse.julialang.org/t/having-a-submodule-import-a-top-level-module/48266 "2020-11-02T11:34:47Z")

</div>

After experimenting a bit with the module system, I found that it was possible to write code as the following: module TestPackage export x, y x = 0 module Sub using TestPackage z = x # z = y # error! …

---

## [PGFPlotsX.jl to LaTeX](https://discourse.julialang.org/t/pgfplotsx-jl-to-latex/49449)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 4\
**Last updated:** [November 2, 2020, 11:31am UTC](https://discourse.julialang.org/t/pgfplotsx-jl-to-latex/49449 "2020-11-02T11:31:19Z")

</div>

Hi everyone, I am want to try using PGFPlotsX.jl via Plots.jl to export .tex files that are to be included in my LyX document. But if I try to use \\input{myplot.tex} in my file, I get the following error messages: I …

---

## [Gadfly histogram binwidth](https://discourse.julialang.org/t/gadfly-histogram-binwidth/49450)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [November 2, 2020, 11:23am UTC](https://discourse.julialang.org/t/gadfly-histogram-binwidth/49450 "2020-11-02T11:23:26Z")

</div>

How can I specify the binwidth in a Gadfly histogram? I don’t see it in the docs.

---

## [What's wrong with this macro?](https://discourse.julialang.org/t/whats-wrong-with-this-macro/49419)

<div class="topic-metadata">

**Author:** [@giancarloantonucci](https://discourse.julialang.org/u/giancarloantonucci)\
**Replies:** 8\
**Last updated:** [November 2, 2020, 10:46am UTC](https://discourse.julialang.org/t/whats-wrong-with-this-macro/49419 "2020-11-02T10:46:44Z")

</div>

In theory, I have a macro that allows me to interpret @← a = f(b...) as either f!(a, b...) or a = f(b...) depending on whether f! is defined or not. My attempt at writing such a macro is macro ←(input) # expre…

---

## [Extract floating point number from .png image](https://discourse.julialang.org/t/extract-floating-point-number-from-png-image/49436)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 2\
**Last updated:** [November 2, 2020, 5:03am UTC](https://discourse.julialang.org/t/extract-floating-point-number-from-png-image/49436 "2020-11-02T05:03:14Z")

</div>

Hi all, I’ve got a .png file (actually lots of them) that contain lots of numbers that are expressed like floating points, e.g. “32.34”. I’d like to get those numbers. I’ve been reading the docs for JuliaImages and I su…

---

## [When Julia gets within 1-3x of C/C++ speed, why is C/C++ usually faster?](https://discourse.julialang.org/t/when-julia-gets-within-1-3x-of-c-c-speed-why-is-c-c-usually-faster/49341)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 11\
**Last updated:** [November 2, 2020, 4:58am UTC](https://discourse.julialang.org/t/when-julia-gets-within-1-3x-of-c-c-speed-why-is-c-c-usually-faster/49341 "2020-11-02T04:58:47Z")

</div>

A notion that I’m getting from blogs and published papers comparing Julia with other languages in practical use cases is that Julia gets within 1-3x of the speed of the fastest implementation in C/C++ (though it’s worth …

---

## [Updating to v1.5](https://discourse.julialang.org/t/updating-to-v1-5/49434)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 3\
**Last updated:** [November 2, 2020, 4:37am UTC](https://discourse.julialang.org/t/updating-to-v1-5/49434 "2020-11-02T04:37:44Z")

</div>

How do I update to v1.5. Do I go through the REPL, or do I need to install a new software package? I’m currently using Windows 10(I can look up the version numbers if need be).

---

## [Synchronize the distributed inner loop](https://discourse.julialang.org/t/synchronize-the-distributed-inner-loop/49159)

<div class="topic-metadata">

**Author:** [@libensvivit](https://discourse.julialang.org/u/libensvivit)\
**Replies:** 3\
**Last updated:** [November 2, 2020, 3:01am UTC](https://discourse.julialang.org/t/synchronize-the-distributed-inner-loop/49159 "2020-11-02T03:01:29Z")

</div>

Hi, I have the following loop nest where I wait for the inner loop to finish before the outer loop proceeds. @time begin for var in 1:10 @sync @distributed for i in 1:100 work(i) end end end If I hav…

---

## [BitVector vs Vector{Bool} as default on comparison operations](https://discourse.julialang.org/t/bitvector-vs-vector-bool-as-default-on-comparison-operations/49431)

<div class="topic-metadata">

**Author:** [@Yamen](https://discourse.julialang.org/u/Yamen)\
**Replies:** 8\
**Last updated:** [November 2, 2020, 2:30am UTC](https://discourse.julialang.org/t/bitvector-vs-vector-bool-as-default-on-comparison-operations/49431 "2020-11-02T02:30:10Z")

</div>

Comparison operations on numeric Vectors return BitVectors by default: const a = rand(100\_000) const b = rand(100\_000) test1(a, b) = a .\> b julia\> @btime test1($a,$b) 24.901 μs (3 allocations: 16.59 KiB) 100000-elem…

---

## [Why is the following behaviour not a bug?](https://discourse.julialang.org/t/why-is-the-following-behaviour-not-a-bug/49169)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 19\
**Last updated:** [November 2, 2020, 12:00am UTC](https://discourse.julialang.org/t/why-is-the-following-behaviour-not-a-bug/49169 "2020-11-02T00:00:52Z")

</div>

I just observed the following on v1.4 (so apologies if it is gone on v1.5). julia\> x = \[ rand(0:9, 2) for a = 1:3 \] 3-element Array{Array{Int64,1},1}: \[3, 8\] \[2, 4\] \[3, 1\] julia\> x\[1,1\] 2-element Array{Int64,1}: 3 …

---

## [Unable to make multiple lines in Plots](https://discourse.julialang.org/t/unable-to-make-multiple-lines-in-plots/49401)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 7\
**Last updated:** [November 1, 2020, 7:38pm UTC](https://discourse.julialang.org/t/unable-to-make-multiple-lines-in-plots/49401 "2020-11-01T19:38:49Z")

</div>

I tried to plot 2 lines on the same graph using Plots f(x)=x^2 d(x)=2x plot(f) plot!(d) But when I try to run this I get an error. ERROR: UndefVarError: plot! not defined Stacktrace: \[1\] top-level scope at REPL\[673…

---

## [How to check if GLM will be able to run OLS beforehand?](https://discourse.julialang.org/t/how-to-check-if-glm-will-be-able-to-run-ols-beforehand/48432)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 8\
**Last updated:** [November 1, 2020, 7:32pm UTC](https://discourse.julialang.org/t/how-to-check-if-glm-will-be-able-to-run-ols-beforehand/48432 "2020-11-01T19:32:56Z")

</div>

Dear all, I use the GLM package to compute a simple OLS regression with simulated data inside a loop. In some cases, the simulated data is such that OLS cannot be computed because PosDefException: matrix is not positive…

---

## [How to transition from Emacs / Vim to VSCode?](https://discourse.julialang.org/t/how-to-transition-from-emacs-vim-to-vscode/49373)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [November 1, 2020, 1:34am UTC](https://discourse.julialang.org/t/how-to-transition-from-emacs-vim-to-vscode/49373 "2020-11-01T01:34:11Z")

</div>

I’ve used Emacs to start a project with several .jl source files, and I’ve been testing code in the terminal. I’d like to try VSCode. But if I open these .jl files in VSCode simultaneously, VSCode will give auto-completi…

---

## [How to add all dependencies of a package to global environment?](https://discourse.julialang.org/t/how-to-add-all-dependencies-of-a-package-to-global-environment/19725)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 17\
**Last updated:** [October 31, 2020, 10:05pm UTC](https://discourse.julialang.org/t/how-to-add-all-dependencies-of-a-package-to-global-environment/19725 "2020-10-31T22:05:15Z")

</div>

Suppose I have a package A which depends on B and C. If I run add A, then B and C are activate only in A’s environment. This means that if I do using B or using C from the global environment, it will fail. Is there an e…

---

## [HTTP, Send headers in HTTP.Response](https://discourse.julialang.org/t/http-send-headers-in-http-response/49389)

<div class="topic-metadata">

**Author:** [@Jea](https://discourse.julialang.org/u/Jea)\
**Replies:** 0\
**Last updated:** [October 31, 2020, 9:40pm UTC](https://discourse.julialang.org/t/http-send-headers-in-http-response/49389 "2020-10-31T21:40:30Z")

</div>

I want send my headers in the HTTP.Reponse() HTTP.Response(200, "Working") Where i have to send the headers??

---

## [Package for limits](https://discourse.julialang.org/t/package-for-limits/49286)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 23\
**Last updated:** [October 31, 2020, 9:37pm UTC](https://discourse.julialang.org/t/package-for-limits/49286 "2020-10-31T21:37:36Z")

</div>

What is a package that can be used to find the limit of a function? I thought ForwardDiff.jl might have this feature but I couldn’t find it in the documentation.

---

## [Loop faster than \`reduce\`?](https://discourse.julialang.org/t/loop-faster-than-reduce/48927)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 7\
**Last updated:** [October 31, 2020, 9:12pm UTC](https://discourse.julialang.org/t/loop-faster-than-reduce/48927 "2020-10-31T21:12:56Z")

</div>

Hello, Is there a way to do better than such a loop: for t in 2:n jarray = jack(t, jarray) end I tried jarray = reduce((a, t) -\> jack(t, a), 2:n; init = jarray), but this is slower than the loop.

---

## [Why did I use \`local\`?](https://discourse.julialang.org/t/why-did-i-use-local/49381)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 2\
**Last updated:** [October 31, 2020, 8:46pm UTC](https://discourse.julialang.org/t/why-did-i-use-local/49381 "2020-10-31T20:46:51Z")

</div>

Hello, I’m trying to refresh an old code of mine, about 5 years old. I found this function: ## sort array M with respect to colon j function sortbycol(M,j) local col, perm col = M\[:,j\] perm = sortperm(col)\[2\] r…

---

## [Using a function in PyJulia](https://discourse.julialang.org/t/using-a-function-in-pyjulia/49330)

<div class="topic-metadata">

**Author:** [@Rita\_Paz](https://discourse.julialang.org/u/Rita_Paz)\
**Replies:** 4\
**Last updated:** [October 31, 2020, 8:09pm UTC](https://discourse.julialang.org/t/using-a-function-in-pyjulia/49330 "2020-10-31T20:09:25Z")

</div>

I want to use a function defined in a Julia file with PyJulia. Running the code gives the following error: RuntimeError: \<PyCall.jlwrap (in a Julia function called from Python) JULIA: UndefVarError: pqrfact not define…

---

## [Calling a function](https://discourse.julialang.org/t/calling-a-function/48875)

<div class="topic-metadata">

**Author:** [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)\
**Replies:** 4\
**Last updated:** [October 31, 2020, 7:19pm UTC](https://discourse.julialang.org/t/calling-a-function/48875 "2020-10-31T19:19:36Z")

</div>

I am trying to call a function. I have installed the package JuAFEM. The function file is already there. https://github.com/KristofferC/JuAFEM.jl/blob/master/src/Grid/grid\_generators.jl My code using JuAFEM generate\_…

---

## [Julia equivalent of the R function \`model.matrix\`](https://discourse.julialang.org/t/julia-equivalent-of-the-r-function-model-matrix/49325)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 2\
**Last updated:** [October 31, 2020, 7:08pm UTC](https://discourse.julialang.org/t/julia-equivalent-of-the-r-function-model-matrix/49325 "2020-10-31T19:08:16Z")

</div>

Hello, Is there a Julia function equivalent to the R function model.matrix? This R function returns the design matrix of a linear regression model. For example model.matrix(~ group + treatment + group:treatment, data = …

---

## [Run test subsets with \`Pkg.test\`](https://discourse.julialang.org/t/run-test-subsets-with-pkg-test/7050)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 15\
**Last updated:** [October 31, 2020, 6:52pm UTC](https://discourse.julialang.org/t/run-test-subsets-with-pkg-test/7050 "2020-10-31T18:52:52Z")

</div>

It doesn’t seem to be possible to define groups of tests and then run only a given group of tests with Pkg.test. Is there an alternative recommended mechanism to achieve this goal? Here is the use-case. I have a large p…

---

## [How to sum array of tuples](https://discourse.julialang.org/t/how-to-sum-array-of-tuples/49378)

<div class="topic-metadata">

**Author:** [@derikk](https://discourse.julialang.org/u/derikk)\
**Replies:** 5\
**Last updated:** [October 31, 2020, 6:39pm UTC](https://discourse.julialang.org/t/how-to-sum-array-of-tuples/49378 "2020-10-31T18:39:52Z")

</div>

I have an array of tuples of weight and bias gradients for my neural network (so, an array of matrix-vector tuples). How can I sum over them, ideally without an explicit loop? As a small example, let arr = \[(rand(2,2),…

---

## [Unexpected Tullio behavior](https://discourse.julialang.org/t/unexpected-tullio-behavior/49371)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 6\
**Last updated:** [October 31, 2020, 5:17pm UTC](https://discourse.julialang.org/t/unexpected-tullio-behavior/49371 "2020-10-31T17:17:35Z")

</div>

In the program below, I had expected a, a2 to produce the same result, but they don’t. It appears that Tullio (which I like!) does not deal with vectors of matrices in the way that I had expected. The output is: \[ Inf…

---

## [Why doesn't first(Array, Int64) work?](https://discourse.julialang.org/t/why-doesnt-first-array-int64-work/49355)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 6\
**Last updated:** [October 31, 2020, 10:08am UTC](https://discourse.julialang.org/t/why-doesnt-first-array-int64-work/49355 "2020-10-31T10:08:26Z")

</div>

Why don’t these do the same thing? julia\> \[1,2,3\]\[1:2\] 2-element Array{Int64,1}: 1 2 julia\> first(\[1,2,3\], 2) ERROR: MethodError: no method matching first(::Array{Int64,1}, ::Int64) Closest candidates are: first(::…

---

## [GPU-friendly one-hot encoding](https://discourse.julialang.org/t/gpu-friendly-one-hot-encoding/49312)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 12\
**Last updated:** [October 31, 2020, 9:14am UTC](https://discourse.julialang.org/t/gpu-friendly-one-hot-encoding/49312 "2020-10-31T09:14:03Z")

</div>

Given a vector of indices I want to get a matrix where only one element with corresponding index is one and others are zeros. On CPU it’s pretty easy, e.g.: function onehot(s::AbstractVector, n\_dims::Int=maximum(s)) …

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

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