# General Usage

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

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

**Page:** 806

---

## [WTF plots causing Signal desktop app to run?](https://discourse.julialang.org/t/wtf-plots-causing-signal-desktop-app-to-run/32126)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 6\
**Last updated:** [December 11, 2019, 5:55pm UTC](https://discourse.julialang.org/t/wtf-plots-causing-signal-desktop-app-to-run/32126 "2019-12-11T17:55:21Z")

</div>

I am relatively new to Julia, I try to use it every so often. Right now I have a problem where I’m solving some diffusion problems and have some data that I want to plot. So, Queryverse looks nice, and I decide to try t…

---

## [Best practices for using random number generators with threads](https://discourse.julialang.org/t/best-practices-for-using-random-number-generators-with-threads/32158)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 0\
**Last updated:** [December 11, 2019, 4:23pm UTC](https://discourse.julialang.org/t/best-practices-for-using-random-number-generators-with-threads/32158 "2019-12-11T16:23:02Z")

</div>

In a single-threaded simulation it is common to pass the random number generator, of type AbstractRNG as the first argument in the method that actually performs the simulation and have another method without this argumen…

---

## [Map vs list comprehension](https://discourse.julialang.org/t/map-vs-list-comprehension/916)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 23\
**Last updated:** [December 11, 2019, 12:22pm UTC](https://discourse.julialang.org/t/map-vs-list-comprehension/916 "2019-12-11T12:22:11Z")

</div>

What is the difference between map(v -\> f(v), lst) and \[f(v) for v in lst\]? I have seen this discussion but the focus was on speed and memory allocation.

---

## [Tricky signature for convertible types](https://discourse.julialang.org/t/tricky-signature-for-convertible-types/32145)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 3\
**Last updated:** [December 11, 2019, 12:00pm UTC](https://discourse.julialang.org/t/tricky-signature-for-convertible-types/32145 "2019-12-11T12:00:01Z")

</div>

Hi, I’m trying to figure out whether its possible to write a signature for a function f(x, y) such that y can be converted to x via convert. Actually it is a bit simpler: I want to constraint x and y to be both either \<:…

---

## [Dot syntax with tuples](https://discourse.julialang.org/t/dot-syntax-with-tuples/15222)

<div class="topic-metadata">

**Author:** [@nantonel](https://discourse.julialang.org/u/nantonel)\
**Replies:** 4\
**Last updated:** [December 11, 2019, 6:25am UTC](https://discourse.julialang.org/t/dot-syntax-with-tuples/15222 "2019-12-11T06:25:27Z")

</div>

In Julia 0.6 the it was possible to do: julia\> x = ones(2), zeros(3,4); julia\> x .+ 3 (\[4.0, 4.0\], \[3.0 3.0 3.0 3.0; 3.0 3.0 3.0 3.0; 3.0 3.0 3.0 3.0\]) Now in 1.0 this is no longer possible: julia\> x .+ 3 ERROR: Me…

---

## [RData load error](https://discourse.julialang.org/t/rdata-load-error/32133)

<div class="topic-metadata">

**Author:** [@ggrolt](https://discourse.julialang.org/u/ggrolt)\
**Replies:** 0\
**Last updated:** [December 11, 2019, 5:08am UTC](https://discourse.julialang.org/t/rdata-load-error/32133 "2019-12-11T05:08:41Z")

</div>

Hi, I’m trying to read in some xz compressed data using the RData package. I have a module with the line include(“constants.jl”) Inside constants.jl is the following: using CodecXz using RData const x = RData.lo…

---

## [Find the index of a bin where a value between two bin value](https://discourse.julialang.org/t/find-the-index-of-a-bin-where-a-value-between-two-bin-value/32080)

<div class="topic-metadata">

**Author:** [@yusri-dh](https://discourse.julialang.org/u/yusri-dh)\
**Replies:** 2\
**Last updated:** [December 11, 2019, 5:08am UTC](https://discourse.julialang.org/t/find-the-index-of-a-bin-where-a-value-between-two-bin-value/32080 "2019-12-11T05:08:37Z")

</div>

Is there any related function in julia like numpy.digitize? Basically I want to find the index of a bin where a value between two bin value. Here is the example from numpy \>\>\> my\_list = \[3,2,56,4,32,4,7,88,4,3,4\] \>\>\> b…

---

## [CPLEX evaluate solution quality (get basis condition number kappa value)](https://discourse.julialang.org/t/cplex-evaluate-solution-quality-get-basis-condition-number-kappa-value/32128)

<div class="topic-metadata">

**Author:** [@Bastian\_Moya](https://discourse.julialang.org/u/Bastian_Moya)\
**Replies:** 0\
**Last updated:** [December 11, 2019, 2:23am UTC](https://discourse.julialang.org/t/cplex-evaluate-solution-quality-get-basis-condition-number-kappa-value/32128 "2019-12-11T02:23:47Z")

</div>

There is a way to evaluate the solution quality in CPLEX which is getting a kappa value. I have been trying getting this with CPX\_PARAM\_MIPKAPPASTATS command with the following line: m = Model(with\_optimizer(CPLEX.Optim…

---

## [Functions, Modules, and Scope](https://discourse.julialang.org/t/functions-modules-and-scope/32112)

<div class="topic-metadata">

**Author:** [@manderson](https://discourse.julialang.org/u/manderson)\
**Replies:** 5\
**Last updated:** [December 11, 2019, 12:44am UTC](https://discourse.julialang.org/t/functions-modules-and-scope/32112 "2019-12-11T00:44:59Z")

</div>

Alright, so I have been working on an algorithm with lots of variables and lots of repeated function calls, so I put all of my functions into a module and everything works just fine. As I’m nearing the publishing of a pa…

---

## [Regex performance on Windows 10](https://discourse.julialang.org/t/regex-performance-on-windows-10/32113)

<div class="topic-metadata">

**Author:** [@Dictino](https://discourse.julialang.org/u/Dictino)\
**Replies:** 0\
**Last updated:** [December 10, 2019, 6:53pm UTC](https://discourse.julialang.org/t/regex-performance-on-windows-10/32113 "2019-12-10T18:53:52Z")

</div>

Hi This is my first post here so sorry if this is not a good place for this question. I’ve observed that there is an important performance difference between Windows 10 and Linux in regex match performance MWE: module…

---

## [Documenter colors for backticked code](https://discourse.julialang.org/t/documenter-colors-for-backticked-code/32073)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 6\
**Last updated:** [December 10, 2019, 8:41pm UTC](https://discourse.julialang.org/t/documenter-colors-for-backticked-code/32073 "2019-12-10T20:41:33Z")

</div>

After an update to the newest version of Documenter.jl some things changed, most of which are positive changes. The colors of backticked code (e.g. a\_typical\_variable) has changed. It is now foreground red, and used to b…

---

## [Optimize benchmark-code](https://discourse.julialang.org/t/optimize-benchmark-code/32105)

<div class="topic-metadata">

**Author:** [@Johannes](https://discourse.julialang.org/u/Johannes)\
**Replies:** 11\
**Last updated:** [December 10, 2019, 8:25pm UTC](https://discourse.julialang.org/t/optimize-benchmark-code/32105 "2019-12-10T20:25:31Z")

</div>

Hey all, I found this benchmark comparing different languages in economics and I wonder whether the underlying Julia code can be optimized further (full repository is available here): ## Basic RBC model with full deprec…

---

## [SharedArrays crashes on Julia 1.3 Windows](https://discourse.julialang.org/t/sharedarrays-crashes-on-julia-1-3-windows/32099)

<div class="topic-metadata">

**Author:** [@Diger](https://discourse.julialang.org/u/Diger)\
**Replies:** 13\
**Last updated:** [December 10, 2019, 8:05pm UTC](https://discourse.julialang.org/t/sharedarrays-crashes-on-julia-1-3-windows/32099 "2019-12-10T20:05:15Z")

</div>

Even though people will always tell you to upgrade to the latest version, this is the reason I hate updating old but working stuff… So since I updated from 1.0 to 1.3 SharedArrays doesn’t work anymore. using SharedArray…

---

## [Reluctance to switch to Julia; PyPy and Cython](https://discourse.julialang.org/t/reluctance-to-switch-to-julia-pypy-and-cython/12420)

<div class="topic-metadata">

**Author:** [@Thomas\_Benardo](https://discourse.julialang.org/u/Thomas_Benardo)\
**Replies:** 35\
**Last updated:** [December 10, 2019, 6:58pm UTC](https://discourse.julialang.org/t/reluctance-to-switch-to-julia-pypy-and-cython/12420 "2019-12-10T18:58:26Z")

</div>

Im quite reluctant to completely switch to Julia and the main reason being static compilation. Python is fast enough with {fully-compatible} PyPy(close to Julia if given chance to warm up) {limited} Python can be stat…

---

## ["Press Enter to start a new session. - Julia has exited." error](https://discourse.julialang.org/t/press-enter-to-start-a-new-session-julia-has-exited-error/32107)

<div class="topic-metadata">

**Author:** [@lko](https://discourse.julialang.org/u/lko)\
**Replies:** 2\
**Last updated:** [December 10, 2019, 6:14pm UTC](https://discourse.julialang.org/t/press-enter-to-start-a-new-session-julia-has-exited-error/32107 "2019-12-10T18:14:48Z")

</div>

I’m a new user, trying to set up Julia/Juno under Ubuntu 18.04 derivative. Julia runs fine when started in a terminal, by when I start up atom, I just get "Press Enter to start a new session. Julia has exited". I’ve …

---

## [Promote constructor causing stack overflow](https://discourse.julialang.org/t/promote-constructor-causing-stack-overflow/32070)

<div class="topic-metadata">

**Author:** [@doomphoenix-qxz](https://discourse.julialang.org/u/doomphoenix-qxz)\
**Replies:** 2\
**Last updated:** [December 10, 2019, 4:01pm UTC](https://discourse.julialang.org/t/promote-constructor-causing-stack-overflow/32070 "2019-12-10T16:01:05Z")

</div>

julia\> struct parametrict{T} a::T b::T end julia\> parametrict(a::Real, b::Real) = parametrict(promote(a, b)...) parametrict julia\> parametrict(0.5, 0.5) ERROR: StackOverflowErr…

---

## [Developping non registered packages: should I always do dev package?](https://discourse.julialang.org/t/developping-non-registered-packages-should-i-always-do-dev-package/32013)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 9\
**Last updated:** [December 10, 2019, 2:11pm UTC](https://discourse.julialang.org/t/developping-non-registered-packages-should-i-always-do-dev-package/32013 "2019-12-10T14:11:31Z")

</div>

Hello everyone, I have a few questions regarding the use of Pkg. I know there are some other threads with similar titles but I could not really find a clear answer to my questions. It’s also hard to make a MWE, since m…

---

## [Best way to access docstings (like ? mode)](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [December 10, 2019, 1:17pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096 "2019-12-10T13:17:40Z")

</div>

In the emacs interface julia-repl.el currently we access docstrings with @docs, eg when the user requests help for foo, @docs foo is sent to the Julia REPL. But this does not work for keywords like break or continue, …

---

## [haskey(Dict) allocates when key is a struct](https://discourse.julialang.org/t/haskey-dict-allocates-when-key-is-a-struct/32093)

<div class="topic-metadata">

**Author:** [@kuba](https://discourse.julialang.org/u/kuba)\
**Replies:** 4\
**Last updated:** [December 10, 2019, 12:52pm UTC](https://discourse.julialang.org/t/haskey-dict-allocates-when-key-is-a-struct/32093 "2019-12-10T12:52:30Z")

</div>

Hi! I’ve noticed that if a key in a Dict is a structure, the haskey function allocates memory: d = Dict{Int64, Int64}() @allocated haskey(d, 0) # 0 when key is an Int struct Key value :: Int64 end d = Dict{Key,…

---

## [Compile\_package fails on nonregistered package](https://discourse.julialang.org/t/compile-package-fails-on-nonregistered-package/21530)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 5\
**Last updated:** [December 9, 2019, 9:15pm UTC](https://discourse.julialang.org/t/compile-package-fails-on-nonregistered-package/21530 "2019-12-09T21:15:57Z")

</div>

I am trying to use compile\_package or compile\_incremental from PackageCompiler.jl to compile an internal package that is not registered in METADATA. When trying compile\_increemental, the process fails with \[ Info: used …

---

## [Date / DateTime not defined](https://discourse.julialang.org/t/date-datetime-not-defined/23516)

<div class="topic-metadata">

**Author:** [@ilias](https://discourse.julialang.org/u/ilias)\
**Replies:** 2\
**Last updated:** [April 25, 2019, 3:54pm UTC](https://discourse.julialang.org/t/date-datetime-not-defined/23516 "2019-04-25T15:54:05Z")

</div>

I got the following error when running: julia\> t = Date(2014, 1, 31) ERROR: UndefVarError: Date not defined Stacktrace: \[1\] top-level scope at none:0 Julia version 1.1.0 Is there any possible explanation for this? I …

---

## [Different behaviours in Linux and MacOs with Julia embedded in C++](https://discourse.julialang.org/t/different-behaviours-in-linux-and-macos-with-julia-embedded-in-c/18101)

<div class="topic-metadata">

**Author:** [@vitreo12](https://discourse.julialang.org/u/vitreo12)\
**Replies:** 18\
**Last updated:** [December 9, 2019, 11:28pm UTC](https://discourse.julialang.org/t/different-behaviours-in-linux-and-macos-with-julia-embedded-in-c/18101 "2019-12-09T23:28:32Z")

</div>

Hello everyone, I am currently embedding Julia inside of some cross-platform C++ shared libraries that will be loaded by an already developed application with calls to dlopen(). I am experiencing different behaviours wi…

---

## [Printing the name of an array](https://discourse.julialang.org/t/printing-the-name-of-an-array/32046)

<div class="topic-metadata">

**Author:** [@WEEZEERAE](https://discourse.julialang.org/u/WEEZEERAE)\
**Replies:** 3\
**Last updated:** [December 9, 2019, 10:53pm UTC](https://discourse.julialang.org/t/printing-the-name-of-an-array/32046 "2019-12-09T22:53:22Z")

</div>

hey people, I tried to print the name of an array, as I realized it is actually giving me out the values, i.e.: A = \[5,4,6,7\] print(A,“=”, something) → \[5,4,6,7\] = something but i would rather have something like: …

---

## [Debugging RemoteChannel memory error during distributed computation](https://discourse.julialang.org/t/debugging-remotechannel-memory-error-during-distributed-computation/32062)

<div class="topic-metadata">

**Author:** [@grahamas](https://discourse.julialang.org/u/grahamas)\
**Replies:** 0\
**Last updated:** [December 9, 2019, 7:05pm UTC](https://discourse.julialang.org/t/debugging-remotechannel-memory-error-during-distributed-computation/32062 "2019-12-09T19:05:39Z")

</div>

I have no idea how to debug this problem, so any even vague “that sounds like…” is appreciated. My program works when distributed within a single node, but fails when given tasks/cpus that span two nodes. I unfortunatel…

---

## [Is this possible to fix "type instability" with IndexedTable operations?](https://discourse.julialang.org/t/is-this-possible-to-fix-type-instability-with-indexedtable-operations/32063)

<div class="topic-metadata">

**Author:** [@bashonubuntu](https://discourse.julialang.org/u/bashonubuntu)\
**Replies:** 0\
**Last updated:** [December 9, 2019, 7:25pm UTC](https://discourse.julialang.org/t/is-this-possible-to-fix-type-instability-with-indexedtable-operations/32063 "2019-12-09T19:25:14Z")

</div>

Consider the following code and its @code\_warntype t = table(\[1,1,2,2\], \[1,2,1,2\], \[1,2,3,4\], names=\[:a,:b,:c\], pkey = (:a, :b)) function my\_function(t::T) where {T\<:IndexedTable} IndexedTables.select(t, Indexe…

---

## [MATLAB.JL : LoadError: UndefRefError:](https://discourse.julialang.org/t/matlab-jl-loaderror-undefreferror/31831)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 12\
**Last updated:** [December 9, 2019, 6:44pm UTC](https://discourse.julialang.org/t/matlab-jl-loaderror-undefreferror/31831 "2019-12-09T18:44:17Z")

</div>

Hello everybody, I cannot use MATLAB.jl due to the error : \> ERROR: LoadError: UndefRefError: access to undefined reference Would you tell me ow to fix this problem in Win10? Best regards,

---

## [Use julia array in SQLite Query](https://discourse.julialang.org/t/use-julia-array-in-sqlite-query/32049)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 1\
**Last updated:** [December 9, 2019, 5:10pm UTC](https://discourse.julialang.org/t/use-julia-array-in-sqlite-query/32049 "2019-12-09T17:10:23Z")

</div>

I asked this before in Slack, but failed to write down the answer. As penance, I vow to write this up as a PR to the SQLite docs :laughing: I’d like to use an existing vector as part of a SQLite.Query. Eg: julia\> using…

---

## [Buffers are People Too: IO Package Developers, Please Consider In-Memory Operations](https://discourse.julialang.org/t/buffers-are-people-too-io-package-developers-please-consider-in-memory-operations/32051)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 4\
**Last updated:** [December 9, 2019, 4:10pm UTC](https://discourse.julialang.org/t/buffers-are-people-too-io-package-developers-please-consider-in-memory-operations/32051 "2019-12-09T16:10:43Z")

</div>

I wanted to bring the following to the attention of anyone who might be developing any IO-related package. Today with “microservices” and docker containers being common, it is often the case that IO takes place over a n…

---

## [Specifying that a function which can take a vector or scalar as input](https://discourse.julialang.org/t/specifying-that-a-function-which-can-take-a-vector-or-scalar-as-input/32042)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 4\
**Last updated:** [December 9, 2019, 4:04pm UTC](https://discourse.julialang.org/t/specifying-that-a-function-which-can-take-a-vector-or-scalar-as-input/32042 "2019-12-09T16:04:38Z")

</div>

I frequently find myself writing functions which are fundamentally not that different for scalars or vectors. Take this for example: julia\> function silly\_print(x) for i = 1:length(x) println(x\[i\]) end e…

---

## [Selecting the Set from an Array of integers](https://discourse.julialang.org/t/selecting-the-set-from-an-array-of-integers/32050)

<div class="topic-metadata">

**Author:** [@Diger](https://discourse.julialang.org/u/Diger)\
**Replies:** 2\
**Last updated:** [December 9, 2019, 3:24pm UTC](https://discourse.julialang.org/t/selecting-the-set-from-an-array-of-integers/32050 "2019-12-09T15:24:46Z")

</div>

I have the Array A=\[0,0,0,2,1,0,1,3,2,3,4,5,1,7,1\] for which the Set is S=\[0,1,2,3,4,5,7\] Set(A) doesn’t work in that I get an object Set(\[…\]), but the resulting thing should still be an Array as before. How do I do …

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

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