# General Usage

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

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

**Page:** 869

---

## [Arithmetic modulo primes](https://discourse.julialang.org/t/arithmetic-modulo-primes/23895)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 6\
**Last updated:** [May 7, 2019, 8:05pm UTC](https://discourse.julialang.org/t/arithmetic-modulo-primes/23895 "2019-05-07T20:05:48Z")

</div>

Hi Does Julia have a package for arithmetic modulo primes (Zp)? I found a repository for Mod(:val, :mod) (link) but that requires storing the prime as a field of each variable. I would like to instantiate variable fro…

---

## [Unexpected push behavior](https://discourse.julialang.org/t/unexpected-push-behavior/23967)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [May 7, 2019, 3:15pm UTC](https://discourse.julialang.org/t/unexpected-push-behavior/23967 "2019-05-07T15:15:20Z")

</div>

Consider the following bit of code: using Random # starting point X₀ = \[-1.0,0.0\]; X\_vals = \[X₀\] X = similar(X₀) n = 5; Random.seed!(100); @. X = X₀; for j in 1:n @. X = X + randn(); println(j, ": X\[1\] = ", …

---

## [Current state of Cxx.jl?](https://discourse.julialang.org/t/current-state-of-cxx-jl/19466)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 26\
**Last updated:** [May 7, 2019, 2:47pm UTC](https://discourse.julialang.org/t/current-state-of-cxx-jl/19466 "2019-05-07T14:47:48Z")

</div>

I’d like to inquire about the current state of Cxx.jl. I’m aware of #390, but not really understand when or how the issues will be resolved. My goal is to implement a small interface for the Kinect sensor (primarily for…

---

## [Travis CI configuration with new Project.toml file](https://discourse.julialang.org/t/travis-ci-configuration-with-new-project-toml-file/23942)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 3\
**Last updated:** [May 7, 2019, 2:38pm UTC](https://discourse.julialang.org/t/travis-ci-configuration-with-new-project-toml-file/23942 "2019-05-07T14:38:51Z")

</div>

Hello! I’m trying to migrate my package to the new registration system. I generated a Project.toml file that seems adequate. However, I’m having a strange bug during the CI process. It basically says that Pkg is not fou…

---

## [Parameterize type with value (not type)](https://discourse.julialang.org/t/parameterize-type-with-value-not-type/23963)

<div class="topic-metadata">

**Author:** [@kkmann](https://discourse.julialang.org/u/kkmann)\
**Replies:** 1\
**Last updated:** [May 7, 2019, 12:07pm UTC](https://discourse.julialang.org/t/parameterize-type-with-value-not-type/23963 "2019-05-07T12:07:04Z")

</div>

Hey, I want to implement a parametric type (container of defined length), i.e., something like MyContainer{Int64, 2}(\[1, 1\]) should be a valid call to a constructor. To me this looks very similar to the Array types (al…

---

## [Distributed computing in the Windows Subsystem for Linux](https://discourse.julialang.org/t/distributed-computing-in-the-windows-subsystem-for-linux/23723)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 14\
**Last updated:** [May 7, 2019, 10:44am UTC](https://discourse.julialang.org/t/distributed-computing-in-the-windows-subsystem-for-linux/23723 "2019-05-07T10:44:32Z")

</div>

I have noticed that running Distributed-enabled computations in the WSL is very much sub-optimal. I have a fast Windows 10 machine with 16 cores (which runs the simulation in the WSL), and when running a single worker, …

---

## [Iterating over dict in parallel](https://discourse.julialang.org/t/iterating-over-dict-in-parallel/23912)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 3\
**Last updated:** [May 7, 2019, 9:16am UTC](https://discourse.julialang.org/t/iterating-over-dict-in-parallel/23912 "2019-05-07T09:16:49Z")

</div>

I expected the following to work: using Distributed addprocs(4) d = Dict("a" =\> 1, "b" =\> 2) @sync @distributed for (k, v) in d println(k) end But receive this error: ERROR: On worker 2: KeyError: key 1:1 not fou…

---

## [\`StackOverflowError\` with Revise.jl](https://discourse.julialang.org/t/stackoverflowerror-with-revise-jl/23947)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 5\
**Last updated:** [May 7, 2019, 8:30am UTC](https://discourse.julialang.org/t/stackoverflowerror-with-revise-jl/23947 "2019-05-07T08:30:30Z")

</div>

Hi everyone, I started to use Revise some weeks ago, really awesome to get a faster dev cycle (without julia restarts and re-precompiles all the time)! The problem now is that I always get this warning when working on my…

---

## [Creating and naming Precompiled environment](https://discourse.julialang.org/t/creating-and-naming-precompiled-environment/23935)

<div class="topic-metadata">

**Author:** [@alewolf](https://discourse.julialang.org/u/alewolf)\
**Replies:** 0\
**Last updated:** [May 6, 2019, 9:51pm UTC](https://discourse.julialang.org/t/creating-and-naming-precompiled-environment/23935 "2019-05-06T21:51:06Z")

</div>

Hi everyone, I am relatively new to Julia - and everytime I solve a problem, I find a new one :slight\_smile: Currently, I want to create and name an environment where some pacakges are precomplied: CSV, DataFrames,Que…

---

## [Complexifying pi](https://discourse.julialang.org/t/complexifying-pi/23885)

<div class="topic-metadata">

**Author:** [@tobydriscoll](https://discourse.julialang.org/u/tobydriscoll)\
**Replies:** 24\
**Last updated:** [May 6, 2019, 6:11pm UTC](https://discourse.julialang.org/t/complexifying-pi/23885 "2019-05-06T18:11:57Z")

</div>

I want to make a type that internally stores values in a Complex form. I assumed that I should simply convert any Real input. However, some math constants give an error doing this: julia\> Complex(2.0f0) 2.0f0 + 0.0f0im …

---

## [CSV read performance vs Pandas](https://discourse.julialang.org/t/csv-read-performance-vs-pandas/21667)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 29\
**Last updated:** [May 6, 2019, 2:40pm UTC](https://discourse.julialang.org/t/csv-read-performance-vs-pandas/21667 "2019-05-06T14:40:04Z")

</div>

Any idea why Pandas’ CSV parser is so awesome? Below is my test for a 20MB file with 100,000 rows x 12 columns, mostly Float64’s. julia\> @benchmark CSV.read("/tmp/test.csv") BenchmarkTools.Trial: memory estimate: 1…

---

## [Using strip.()](https://discourse.julialang.org/t/using-strip/23910)

<div class="topic-metadata">

**Author:** [@remi-garcia](https://discourse.julialang.org/u/remi-garcia)\
**Replies:** 5\
**Last updated:** [May 6, 2019, 2:33pm UTC](https://discourse.julialang.org/t/using-strip/23910 "2019-05-06T14:33:39Z")

</div>

A particular case of strip. is not working. julia\> a = " abc , (de f) , gh " " abc , (de f) , gh " julia\> b = split(a, ',') 3-element Array{SubString{String},1}: " abc " " (de f) " " gh " julia\> strip…

---

## [How to get the source of code loading warnings?](https://discourse.julialang.org/t/how-to-get-the-source-of-code-loading-warnings/23884)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 5\
**Last updated:** [May 6, 2019, 1:18pm UTC](https://discourse.julialang.org/t/how-to-get-the-source-of-code-loading-warnings/23884 "2019-05-06T13:18:11Z")

</div>

I get this warning in one of my apps, seems to be Pkg related: ┌ Warning: Package Genie does not have SearchLight in its dependencies: │ - If you have Genie checked out for development and have │ added SearchLight as …

---

## [Working on a pattern for interface-based dispatch that uses code-generation. Is this efficient?](https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904)

<div class="topic-metadata">

**Author:** [@ninjaaron](https://discourse.julialang.org/u/ninjaaron)\
**Replies:** 7\
**Last updated:** [May 6, 2019, 12:22pm UTC](https://discourse.julialang.org/t/working-on-a-pattern-for-interface-based-dispatch-that-uses-code-generation-is-this-efficient/23904 "2019-05-06T12:22:33Z")

</div>

I’m not a super fan of inheritance-based polymorphism. I tend to like interface-based polymorphism like Go’s interfaces and Haskell’s type classes, et al. I realize retrofitting these features in Julia is thought to be …

---

## [3d Plot with Plots.jl and GR backend](https://discourse.julialang.org/t/3d-plot-with-plots-jl-and-gr-backend/23903)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 5\
**Last updated:** [May 6, 2019, 11:39am UTC](https://discourse.julialang.org/t/3d-plot-with-plots-jl-and-gr-backend/23903 "2019-05-06T11:39:49Z")

</div>

I am trying to build a 3d plot using the following code but the plot does not get displayed except the blank grid. This code is taken from a book that uses plotly. using Plots, StatsBase, Random, Distributions Random.se…

---

## [If \`X\` is a module, why \`X.X\` also refers to \`X\`?](https://discourse.julialang.org/t/if-x-is-a-module-why-x-x-also-refers-to-x/23892)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 9\
**Last updated:** [May 6, 2019, 11:33am UTC](https://discourse.julialang.org/t/if-x-is-a-module-why-x-x-also-refers-to-x/23892 "2019-05-06T11:33:03Z")

</div>

What’s the point of this? julia\> module X end Main.X julia\> X Main.X julia\> X.X Main.X julia\> X.X.X Main.X Because of this, I cannot define a function X() within X, for example.

---

## [Documenter.jl: Linking to specific files and Documentation of Scripts](https://discourse.julialang.org/t/documenter-jl-linking-to-specific-files-and-documentation-of-scripts/23847)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 3\
**Last updated:** [May 6, 2019, 8:40am UTC](https://discourse.julialang.org/t/documenter-jl-linking-to-specific-files-and-documentation-of-scripts/23847 "2019-05-06T08:40:15Z")

</div>

I am currently writing a package and want to document everything from the beginning on. Documenter.jl is great for that. I am currently writing and example script that also reproduces a previous result (from code in Mat…

---

## [JuliaStats/StatsModels package missing?](https://discourse.julialang.org/t/juliastats-statsmodels-package-missing/23880)

<div class="topic-metadata">

**Author:** [@jthomasnull](https://discourse.julialang.org/u/jthomasnull)\
**Replies:** 8\
**Last updated:** [May 6, 2019, 7:37am UTC](https://discourse.julialang.org/t/juliastats-statsmodels-package-missing/23880 "2019-05-06T07:37:08Z")

</div>

I can’t install StatsModels in julia 1.1; when I try Pkg.add(“StatsModels”) it asks me for a github login, and no matter what I put in it fails. Looking at github for JuliaStats/StatsModels.jl, I get a 404 error, althoug…

---

## [Julia function performance behaving strange when combining broadcasting, a NamedTuple of Parameters, and a function as argument](https://discourse.julialang.org/t/julia-function-performance-behaving-strange-when-combining-broadcasting-a-namedtuple-of-parameters-and-a-function-as-argument/23888)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 2\
**Last updated:** [May 6, 2019, 7:12am UTC](https://discourse.julialang.org/t/julia-function-performance-behaving-strange-when-combining-broadcasting-a-namedtuple-of-parameters-and-a-function-as-argument/23888 "2019-05-06T07:12:25Z")

</div>

I have the following simplified example taken from real code that calculates a function over a difference for a vector of inputs and a function input params = (a=2,b=3) # calc(p::NamedTuple, t) = p.a\*t^2+p.b\*t^3 # Examp…

---

## [Strange behavior in module \_\_init\_\_](https://discourse.julialang.org/t/strange-behavior-in-module-init/23887)

<div class="topic-metadata">

**Author:** [@Alexander\_Belopolsky](https://discourse.julialang.org/u/Alexander_Belopolsky)\
**Replies:** 1\
**Last updated:** [May 6, 2019, 3:51am UTC](https://discourse.julialang.org/t/strange-behavior-in-module-init/23887 "2019-05-06T03:51:59Z")

</div>

I created a simple module with just the following code: $ cat X/src/X.jl module X function \_\_init\_\_() @show Ptr{UInt8}(0x123456789abcdef0) end end # module When I run it directly from the command line, I get expe…

---

## [Using CLMUL instruction](https://discourse.julialang.org/t/using-clmul-instruction/23876)

<div class="topic-metadata">

**Author:** [@tkluck](https://discourse.julialang.org/u/tkluck)\
**Replies:** 10\
**Last updated:** [May 6, 2019, 2:24am UTC](https://discourse.julialang.org/t/using-clmul-instruction/23876 "2019-05-06T02:24:27Z")

</div>

Is there an easy way to use the carry-less multiplication instruction on platforms where it is available? I’m implementing this operation in pure Julia at the moment: https://github.com/tkluck/GaloisFields.jl/blob/d9f0d…

---

## [Help me make a regex, instead of this?](https://discourse.julialang.org/t/help-me-make-a-regex-instead-of-this/23878)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 13\
**Last updated:** [May 5, 2019, 8:12pm UTC](https://discourse.julialang.org/t/help-me-make-a-regex-instead-of-this/23878 "2019-05-05T20:12:19Z")

</div>

Hey guys, so imagine you have an array like this when reading your directory: 603-element Array{String,1}: "PartFluidOut\_0000.vtk" "PartFluidOut\_0001.vtk" "PartFluidOut\_0002.vtk" "PartFluidOut\_0003.vtk" "PartFluidO…

---

## [Problem with plotting in Jupyter notebook](https://discourse.julialang.org/t/problem-with-plotting-in-jupyter-notebook/23866)

<div class="topic-metadata">

**Author:** [@JuanDiegoDC](https://discourse.julialang.org/u/JuanDiegoDC)\
**Replies:** 1\
**Last updated:** [May 5, 2019, 7:49pm UTC](https://discourse.julialang.org/t/problem-with-plotting-in-jupyter-notebook/23866 "2019-05-05T19:49:17Z")

</div>

Hi! I’m relatively new to Julia and have been using the Plots library extensively for creating my visualizations on Jupyter notebooks. Everything was flowing nicely, until very recently when my plots began to encounter…

---

## [Memory leak from threading but not pmap](https://discourse.julialang.org/t/memory-leak-from-threading-but-not-pmap/23839)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 6\
**Last updated:** [May 5, 2019, 3:45am UTC](https://discourse.julialang.org/t/memory-leak-from-threading-but-not-pmap/23839 "2019-05-05T03:45:21Z")

</div>

I have a function that takes a set of parameters, runs a simulation, and returns 5 values in a named tuple. It does no IO and only calls rand() with a seeded RNG that is explicitly passed to hopefully avoid any unsafe t…

---

## [Convert String to Byte Array using two bytes per character](https://discourse.julialang.org/t/convert-string-to-byte-array-using-two-bytes-per-character/23828)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 9\
**Last updated:** [May 4, 2019, 7:40pm UTC](https://discourse.julialang.org/t/convert-string-to-byte-array-using-two-bytes-per-character/23828 "2019-05-04T19:40:53Z")

</div>

Hi guys! I need to convert a string to a byte array, but using always two bytes per character. For example, in Julia, I have: julia\> Vector{UInt8}("Teste") 5-element Array{UInt8,1}: 0x54 0x65 0x73 0x74 0x65 Howev…

---

## [Ambiguity error on vcat()](https://discourse.julialang.org/t/ambiguity-error-on-vcat/23845)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 8\
**Last updated:** [May 4, 2019, 7:05pm UTC](https://discourse.julialang.org/t/ambiguity-error-on-vcat/23845 "2019-05-04T19:05:18Z")

</div>

I have this error ERROR: MethodError: vcat(::Array{Real,2}, ::TrackedArray{…,Array{Float32,2}}) is ambiguous. Candidates: vcat(364::AbstractArray, x::Union{TrackedArray, TrackedReal}, xs::Union{Number, AbstractArray}.…

---

## [Help me write ℒ](https://discourse.julialang.org/t/help-me-write/23840)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 4\
**Last updated:** [May 4, 2019, 1:06pm UTC](https://discourse.julialang.org/t/help-me-write/23840 "2019-05-04T13:06:24Z")

</div>

i need to use this character (ℒ), but i don’t know how to write this symbol using the \\ + tab combination, anyone?. adding to this question, how can i obtain the appropiate command to write a symbol if i have the symbol…

---

## [Optimizing code for NMF (Non-negative Matrix Factorization)](https://discourse.julialang.org/t/optimizing-code-for-nmf-non-negative-matrix-factorization/23765)

<div class="topic-metadata">

**Author:** [@Mr.Robot](https://discourse.julialang.org/u/Mr.Robot)\
**Replies:** 9\
**Last updated:** [May 4, 2019, 3:37am UTC](https://discourse.julialang.org/t/optimizing-code-for-nmf-non-negative-matrix-factorization/23765 "2019-05-04T03:37:05Z")

</div>

Problem I am trying to implemented majorization-minimization (MM) algorithm to solve the NMF problem \\min\_{\\mathbf{V},\\mathbf{W}}\\Vert \\mathbf{X}-\\mathbf{VW}\\Vert\_F^2=\\sum\_i\\sum\_j(x\_{ij}-\\sum\_k v\_{ik}w\_{kj})^2 The opt…

---

## [Effective simulation of putting n-1 balls in n boxes uniformly at random](https://discourse.julialang.org/t/effective-simulation-of-putting-n-1-balls-in-n-boxes-uniformly-at-random/23774)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 12\
**Last updated:** [May 4, 2019, 1:07am UTC](https://discourse.julialang.org/t/effective-simulation-of-putting-n-1-balls-in-n-boxes-uniformly-at-random/23774 "2019-05-04T01:07:14Z")

</div>

I am trying to learn Julia so I wrote a bit code to test its performance. In the following code snippet I created a function balls\_in\_box to simulate putting n-1 balls in n boxes uniformly at random. One my machine, on…

---

## [Epanechnikov kernel density](https://discourse.julialang.org/t/epanechnikov-kernel-density/23818)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [May 3, 2019, 10:15pm UTC](https://discourse.julialang.org/t/epanechnikov-kernel-density/23818 "2019-05-03T22:15:47Z")

</div>

I am trying to use a Epanechnikov kernel density estimator in KernelDensity.jl. Surprisingly, this is not implemented, but it should be possible to accomplish by extending the function kernel\_dist. I have been unable to…

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

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