# General Usage

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

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

**Page:** 781

---

## [uniformScaling non identity matrices](https://discourse.julialang.org/t/uniformscaling-non-identity-matrices/35532)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 2\
**Last updated:** [March 4, 2020, 6:29pm UTC](https://discourse.julialang.org/t/uniformscaling-non-identity-matrices/35532 "2020-03-04T18:29:57Z")

</div>

How do I create efficient representations like the uniformScaling type for non identity matrices? for example how would I create the matrices X=\[0 1;1 0\] Z=\[1 0;0 -1\] as well as \[1 0;0 0\] and \[0 0;0 1\] with similar …

---

## [Clarification on the differences between \`Ptr\` and \`Ref\`](https://discourse.julialang.org/t/clarification-on-the-differences-between-ptr-and-ref/35531)

<div class="topic-metadata">

**Author:** [@kdheepak](https://discourse.julialang.org/u/kdheepak)\
**Replies:** 1\
**Last updated:** [March 4, 2020, 6:14pm UTC](https://discourse.julialang.org/t/clarification-on-the-differences-between-ptr-and-ref/35531 "2020-03-04T18:14:28Z")

</div>

I have a question regarding ccall, Ptr, Ref and pointer\_to\_objref. Let’s say I have a function that is like so mutable struct UserData x::Int end function foo(bar, userdata, err) ccall((:foo, liblibrary), Cvoi…

---

## [Getting all digits from a BigInt](https://discourse.julialang.org/t/getting-all-digits-from-a-bigint/35528)

<div class="topic-metadata">

**Author:** [@dmoura](https://discourse.julialang.org/u/dmoura)\
**Replies:** 3\
**Last updated:** [March 4, 2020, 5:54pm UTC](https://discourse.julialang.org/t/getting-all-digits-from-a-bigint/35528 "2020-03-04T17:54:23Z")

</div>

I am trying to collect and then sum all the digits from a BigInt. Example: sum all digits of 2^1000000 Intuitively, my first solution was using the digits function: @time sum(digits(BigInt(2)^1000000)) 29.189925 seco…

---

## [V1.3.1 no gain using multithread](https://discourse.julialang.org/t/v1-3-1-no-gain-using-multithread/35401)

<div class="topic-metadata">

**Author:** [@wizebt](https://discourse.julialang.org/u/wizebt)\
**Replies:** 33\
**Last updated:** [March 4, 2020, 3:04pm UTC](https://discourse.julialang.org/t/v1-3-1-no-gain-using-multithread/35401 "2020-03-04T15:04:04Z")

</div>

Hi desperately trying to understand what is blocking scaling when using multithreading in a simple for loop. Taken from a real linear interpolation function I’m using. I need to enable multithreading to substantialy redu…

---

## [Thread collision on data?](https://discourse.julialang.org/t/thread-collision-on-data/35514)

<div class="topic-metadata">

**Author:** [@dataPulverizer](https://discourse.julialang.org/u/dataPulverizer)\
**Replies:** 3\
**Last updated:** [March 4, 2020, 12:26pm UTC](https://discourse.julialang.org/t/thread-collision-on-data/35514 "2020-03-04T12:26:10Z")

</div>

I’m trying to do a map-reduce style coding but I’m not getting exactly the same output with serial and parallel code and suspect that there is thread collision on data. I am trying to collate results indexing a data stru…

---

## [Slow parallel fractals](https://discourse.julialang.org/t/slow-parallel-fractals/35479)

<div class="topic-metadata">

**Author:** [@eaubanel](https://discourse.julialang.org/u/eaubanel)\
**Replies:** 7\
**Last updated:** [March 4, 2020, 12:25pm UTC](https://discourse.julialang.org/t/slow-parallel-fractals/35479 "2020-03-04T12:25:20Z")

</div>

Trying @threads and @distributed with my favourite parallel test case. Can’t figure out why @threads is so slow and allocates so much memory and why @distributed is so slow. function genFractal(α, n=100) niter = 255…

---

## [Communicating julia and python for deep learning](https://discourse.julialang.org/t/communicating-julia-and-python-for-deep-learning/35510)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 1\
**Last updated:** [March 4, 2020, 12:13pm UTC](https://discourse.julialang.org/t/communicating-julia-and-python-for-deep-learning/35510 "2020-03-04T12:13:37Z")

</div>

Hi all, I was learning to make normal python code communicate with julia. But, I don’t know how this will happen for deep learning. For example, opencv in python can be communicated with julia using using PyCall cv2 = …

---

## [\-0 and 0 are not equivalent in the eye of isequal() while applied in find\*() functions](https://discourse.julialang.org/t/0-and-0-are-not-equivalent-in-the-eye-of-isequal-while-applied-in-find-functions/35513)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 2\
**Last updated:** [March 4, 2020, 12:13pm UTC](https://discourse.julialang.org/t/0-and-0-are-not-equivalent-in-the-eye-of-isequal-while-applied-in-find-functions/35513 "2020-03-04T12:13:02Z")

</div>

a=\[0.0, -0.0, -0.0, -3.0, 1.0, -0.0\] b=findall(isequal(0),a) #can only identify 0 c=findall(isequal(-0),a) #only for -0 bc=findall(isequal(-0)||isequal(0),a) #how can I pick all 0 in order in bc instead of #concatenna…

---

## [Providing Artifacts basics](https://discourse.julialang.org/t/providing-artifacts-basics/35459)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 12\
**Last updated:** [March 4, 2020, 11:40am UTC](https://discourse.julialang.org/t/providing-artifacts-basics/35459 "2020-03-04T11:40:05Z")

</div>

What is the recommended way to download and extract some binaries and build a simple Julia wrapper package around it? I read the excellent blog post on the artifact system, but it is still unclear how to proceed. In part…

---

## [Current best practices for resource acquizition and cleanup?](https://discourse.julialang.org/t/current-best-practices-for-resource-acquizition-and-cleanup/35509)

<div class="topic-metadata">

**Author:** [@AdamR](https://discourse.julialang.org/u/AdamR)\
**Replies:** 0\
**Last updated:** [March 4, 2020, 10:16am UTC](https://discourse.julialang.org/t/current-best-practices-for-resource-acquizition-and-cleanup/35509 "2020-03-04T10:16:43Z")

</div>

I took me by surprise that with DBInterface.execute(db, sql) as q # do stuff with q end does not deterministically finalize (destruct) q. After digging deeper (e.g. https://github.com/JuliaLang/julia/is…

---

## [Killed julia process with threads](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [March 4, 2020, 9:22am UTC](https://discourse.julialang.org/t/killed-julia-process-with-threads/35508 "2020-03-04T09:22:20Z")

</div>

I am calculating slices of a multivariate function, with and without threads (here, commented out): function calculate\_slice(f, x, i, xl, xu; n = 50) z = range(xl, xu; length = n) fz = zeros(n) #=Threads.@th…

---

## [LoadError: DimensionMismatch](https://discourse.julialang.org/t/loaderror-dimensionmismatch/35507)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 3\
**Last updated:** [March 4, 2020, 8:53am UTC](https://discourse.julialang.org/t/loaderror-dimensionmismatch/35507 "2020-03-04T08:53:04Z")

</div>

Hi everyone, I was trying to rewrite the following python code: import numpy as np import cv2 import matplotlib.pyplot as plt img = cv2.imread('/home/julia\_Hands\_on/cat3.jpg') img\_tinted = img \* \[1, 0.95, 0.9\] print(…

---

## [How to save Set to file?](https://discourse.julialang.org/t/how-to-save-set-to-file/35506)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 2\
**Last updated:** [March 4, 2020, 8:35am UTC](https://discourse.julialang.org/t/how-to-save-set-to-file/35506 "2020-03-04T08:35:05Z")

</div>

How to save Set ? julia\> Sunikalne Set(\[“WYMYŚLA”, “PRZEPRZĘGAJĄCE”\]) julia\> typeof(Sunikalne) Set{String} julia\> eltype(Sunikalne) String julia\> write(“Sunikalne.txt”,Sunikalne) ERROR: MethodError: no method mat…

---

## [Subplot in Julia](https://discourse.julialang.org/t/subplot-in-julia/35505)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 1\
**Last updated:** [March 4, 2020, 7:07am UTC](https://discourse.julialang.org/t/subplot-in-julia/35505 "2020-03-04T07:07:10Z")

</div>

Hi all, I’m trying to rewrite the following python code to julia. import numpy as np import cv2 import matplotlib.pyplot as plt img = cv2.imread('/home/julia\_Hands\_on/cat3.jpg') img\_tinted = img \* \[1, 0.95, 0.9\] # S…

---

## [MbedTLS unsatisfiable requirements](https://discourse.julialang.org/t/mbedtls-unsatisfiable-requirements/35495)

<div class="topic-metadata">

**Author:** [@joshua\_jones](https://discourse.julialang.org/u/joshua_jones)\
**Replies:** 4\
**Last updated:** [March 4, 2020, 6:36am UTC](https://discourse.julialang.org/t/mbedtls-unsatisfiable-requirements/35495 "2020-03-04T06:36:32Z")

</div>

Using Pkg.update() on SeisIO.jl updates MbedTLS to a version that breaks Travis-CI tests in all Julia versions, and Appveyor tests in some Julia versions (e.g. compare this Appveyor build to this Travis-CI build). The on…

---

## [Python-Julia communication](https://discourse.julialang.org/t/python-julia-communication/35502)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 4\
**Last updated:** [March 4, 2020, 6:05am UTC](https://discourse.julialang.org/t/python-julia-communication/35502 "2020-03-04T06:05:26Z")

</div>

Hi all, I have the following python code: import cv2 img = cv2.imread("/home/g2-test/julia\_Hands\_on/cat3.jpg") cv2.imshow("original image", img) img2 = cv2.cvtColor(img, cv2.COLOR\_BGR2GRAY) cv2.imshow("gray scale imag…

---

## [Why julia exit from REPL?](https://discourse.julialang.org/t/why-julia-exit-from-repl/35445)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 15\
**Last updated:** [March 3, 2020, 11:20pm UTC](https://discourse.julialang.org/t/why-julia-exit-from-repl/35445 "2020-03-03T23:20:07Z")

</div>

Hi, an oddity in the early morning … I am in REPL (on windows 10). Julia exit from REPL … but why??? julia\> x = 1 1 julia\> x = \[1,2,3,4\] C:\\vmswap\\juliaPrj\\querere\> It exits ? … due to what ??? Did something break…

---

## [The REPL broke again](https://discourse.julialang.org/t/the-repl-broke-again/35489)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 11:15pm UTC](https://discourse.julialang.org/t/the-repl-broke-again/35489 "2020-03-03T23:15:25Z")

</div>

I can not believe it … the REPL broke again … I worked this time with Visual Studio Code and Julia in the afternoon and everything was fine, reboot tonight, and here you are again that the REPL does not work … this time …

---

## [A thought on function chaining with constant Arguments](https://discourse.julialang.org/t/a-thought-on-function-chaining-with-constant-arguments/35396)

<div class="topic-metadata">

**Author:** [@FPGro](https://discourse.julialang.org/u/FPGro)\
**Replies:** 13\
**Last updated:** [March 3, 2020, 10:58pm UTC](https://discourse.julialang.org/t/a-thought-on-function-chaining-with-constant-arguments/35396 "2020-03-03T22:58:45Z")

</div>

Hello folks, and thanks for your oppinion in advance. First, I’m pretty new to Julia so you may forgive me the style if you will :slight\_smile: While learning the language and creating the first functionalities, I came…

---

## [Annotate data points in a y matrix with several series](https://discourse.julialang.org/t/annotate-data-points-in-a-y-matrix-with-several-series/35481)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 1\
**Last updated:** [March 3, 2020, 10:25pm UTC](https://discourse.julialang.org/t/annotate-data-points-in-a-y-matrix-with-several-series/35481 "2020-03-03T22:25:10Z")

</div>

Are there a way to do \[println($(a\[i,j\])) for i in 1:10, j in 1:3\]? a=zeros(10,3) \[println("$(a\[i,:\])") for i in 1:10\]#works \[println("$(a\[i,j\])") for i in 1:10, for j in 1:3\] #nope \[println("$(a\[i,j\])") for i in 1:10,…

---

## [Converting image files to svg?](https://discourse.julialang.org/t/converting-image-files-to-svg/35428)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 8\
**Last updated:** [March 3, 2020, 8:18pm UTC](https://discourse.julialang.org/t/converting-image-files-to-svg/35428 "2020-03-03T20:18:21Z")

</div>

Is there a way to convert image files to .svg? FileIO.jl seems to cover many of the file types I have (wmf, eps, png, bmp, bdf, etc.) with load and save. Any other package I can use? E.g., via savefig in Plots?

---

## [How to create a simple map with custom "base" shapefile + data to plot on a separate CSV file](https://discourse.julialang.org/t/how-to-create-a-simple-map-with-custom-base-shapefile-data-to-plot-on-a-separate-csv-file/34580)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [March 3, 2020, 6:26pm UTC](https://discourse.julialang.org/t/how-to-create-a-simple-map-with-custom-base-shapefile-data-to-plot-on-a-separate-csv-file/34580 "2020-03-03T18:26:15Z")

</div>

Hello, is it possible with Julia to plot a map based on a custom shapefile and a data file ? The simplest case is where we want to plot some “regional data” and the background colour represents the data, like in the atta…

---

## [Is that an issue in promote()?](https://discourse.julialang.org/t/is-that-an-issue-in-promote/35446)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 13\
**Last updated:** [March 3, 2020, 4:01pm UTC](https://discourse.julialang.org/t/is-that-an-issue-in-promote/35446 "2020-03-03T16:01:56Z")

</div>

julia\> promote(1,missing) ERROR: promotion of types Int64 and Missing failed to change any arguments Stacktrace: \[1\] error(::String, ::String, ::String) at ./error.jl:42 \[2\] sametype\_error(::Tuple{Int64,Missing}) at ./…

---

## [Could not open file](https://discourse.julialang.org/t/could-not-open-file/16283)

<div class="topic-metadata">

**Author:** [@orhan\_abar](https://discourse.julialang.org/u/orhan_abar)\
**Replies:** 1\
**Last updated:** [March 3, 2020, 2:29pm UTC](https://discourse.julialang.org/t/could-not-open-file/16283 "2020-03-03T14:29:48Z")

</div>

Hello, I just install julia yesterday and I am trying to run a .jl file but I keep getting “could not open file” error. I am checking the directory with pwd() and it is correct. My juliatest.jl file is there. But canno…

---

## [MethodError: no method matching -(::VariableRef, ::Nothing)](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126)

<div class="topic-metadata">

**Author:** [@alkin](https://discourse.julialang.org/u/alkin)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 12:36pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-variableref-nothing/35126 "2020-03-03T12:36:35Z")

</div>

I am new to julia and I am still trying to learn about it. I tried to use a user-defined function in my constraint. Basically, the lookup function returns the value of the same index as the input in the array: functio…

---

## [Communicating Python and Julia](https://discourse.julialang.org/t/communicating-python-and-julia/35455)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 5\
**Last updated:** [March 3, 2020, 12:27pm UTC](https://discourse.julialang.org/t/communicating-python-and-julia/35455 "2020-03-03T12:27:59Z")

</div>

Hi everyone. For converting python code to C, we have Cython. Similarly, there is no such package to convert python to Julia(correct me if I’m wrong). Thus, I want my python code to communicate with Julia. I came throug…

---

## [After scaling the vector still not summing up to 1](https://discourse.julialang.org/t/after-scaling-the-vector-still-not-summing-up-to-1/35460)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 1\
**Last updated:** [March 3, 2020, 12:14pm UTC](https://discourse.julialang.org/t/after-scaling-the-vector-still-not-summing-up-to-1/35460 "2020-03-03T12:14:00Z")

</div>

a=\[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.000999000999000999, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, …

---

## [Best julia editor in windows, for a beginner?](https://discourse.julialang.org/t/best-julia-editor-in-windows-for-a-beginner/35448)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 2\
**Last updated:** [March 3, 2020, 12:10pm UTC](https://discourse.julialang.org/t/best-julia-editor-in-windows-for-a-beginner/35448 "2020-03-03T12:10:32Z")

</div>

I mainly work in windows 10 (but … on my desktop i also have a mac mini, with Catalina os). I am reinstalled Julia/Juno due to some strange behaviour … and i was thinking … … for a beginner, what is the best editor for…

---

## [Calculated type parameter warntype](https://discourse.julialang.org/t/calculated-type-parameter-warntype/35440)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 6\
**Last updated:** [March 3, 2020, 7:37am UTC](https://discourse.julialang.org/t/calculated-type-parameter-warntype/35440 "2020-03-03T07:37:49Z")

</div>

in the following, I’m trying to put some calculated values as type parameters: julia\> struct A{Plus, Minus} A(x, y) = new{x + y, x - y}() end julia\> A(2, 3) A{5,-1}() julia\> @code\_warntype A(2, 3) Va…

---

## [Change the order of the rows Array](https://discourse.julialang.org/t/change-the-order-of-the-rows-array/35449)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 0\
**Last updated:** [March 3, 2020, 10:04am UTC](https://discourse.julialang.org/t/change-the-order-of-the-rows-array/35449 "2020-03-03T10:04:18Z")

</div>

This code works, but my iterator is part of a large array and I am looking for any simplest way to scroll tables rows than with hat like below? (for any event rows to move to end ) julia\> lista 5×1 Array{Int64,2}: 1 …

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

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