# General Usage

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

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

**Page:** 910

---

## [I need your Help!](https://discourse.julialang.org/t/i-need-your-help/18744)

<div class="topic-metadata">

**Author:** [@RedCat](https://discourse.julialang.org/u/RedCat)\
**Replies:** 2\
**Last updated:** [December 17, 2018, 3:08pm UTC](https://discourse.julialang.org/t/i-need-your-help/18744 "2018-12-17T15:08:43Z")

</div>

I wrote Runge-Kutta order 4 code with Julia. and I also wrote with Matlab. And I compared time. I thought that Julia is fater than Matlab. But actually Matlab is vary vary fater than Julia. I have thought there exist s…

---

## [Designing APIs. defining new methods versus passing in functions](https://discourse.julialang.org/t/designing-apis-defining-new-methods-versus-passing-in-functions/18699)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 10\
**Last updated:** [December 17, 2018, 1:55pm UTC](https://discourse.julialang.org/t/designing-apis-defining-new-methods-versus-passing-in-functions/18699 "2018-12-17T13:55:16Z")

</div>

I have previously been conflicted on what I think are two general kinds of APIs in julia. For the sake of an example, take the sort function: sort(v; alg::Algorithm=defalg(v), lt=isless, by=identity, rev::Bool=false, or…

---

## [Installing Julia Packafge from codebase](https://discourse.julialang.org/t/installing-julia-packafge-from-codebase/18741)

<div class="topic-metadata">

**Author:** [@srungarapu\_vamsi](https://discourse.julialang.org/u/srungarapu_vamsi)\
**Replies:** 0\
**Last updated:** [December 17, 2018, 1:49pm UTC](https://discourse.julialang.org/t/installing-julia-packafge-from-codebase/18741 "2018-12-17T13:49:17Z")

</div>

Hi, I have installed JuliaPro on my windows machine. I am interested in going through codebase of GitHub - JuliaStats/MultivariateStats.jl: A Julia package for multivariate statistics and data analysis (e.g. dimension …

---

## [Growing mmaped arrays](https://discourse.julialang.org/t/growing-mmaped-arrays/18709)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 6\
**Last updated:** [December 17, 2018, 6:47am UTC](https://discourse.julialang.org/t/growing-mmaped-arrays/18709 "2018-12-17T06:47:38Z")

</div>

I have to write a lot of objects into a large array and mutate them. The array will grow constantly and will eventually be too large for memory. The most convenient way to do this is Mmap but it seems that it is not poss…

---

## [What is a DataType exactly and why isn't a Vector a DataType?](https://discourse.julialang.org/t/what-is-a-datatype-exactly-and-why-isnt-a-vector-a-datatype/18727)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 4\
**Last updated:** [December 17, 2018, 2:59am UTC](https://discourse.julialang.org/t/what-is-a-datatype-exactly-and-why-isnt-a-vector-a-datatype/18727 "2018-12-17T02:59:38Z")

</div>

Topic says it all. Thanks

---

## [Problem with 2d wavelets example](https://discourse.julialang.org/t/problem-with-2d-wavelets-example/18730)

<div class="topic-metadata">

**Author:** [@ayarodionov](https://discourse.julialang.org/u/ayarodionov)\
**Replies:** 0\
**Last updated:** [December 17, 2018, 2:34am UTC](https://discourse.julialang.org/t/problem-with-2d-wavelets-example/18730 "2018-12-17T02:34:32Z")

</div>

Hi All I’m trying to run transform2d.jl example using Wavelets using Images # for imread and imwrite img = imread(“lena.tiff”) x = permutedims(img.data, \[ndims(img.data):-1:1\]) L = 2 xts = wplotim(x, L, POfilter(…

---

## [Problem with using Images. ](https://discourse.julialang.org/t/problem-with-using-images/18713)

<div class="topic-metadata">

**Author:** [@ayarodionov](https://discourse.julialang.org/u/ayarodionov)\
**Replies:** 2\
**Last updated:** [December 16, 2018, 8:21pm UTC](https://discourse.julialang.org/t/problem-with-using-images/18713 "2018-12-16T20:21:05Z")

</div>

Hi All I’m doing my first step in the julia programming. I love the concept of the language but all my baby steps are so hard that I’m close to give up. For example, very simple test I picked up form http://juliaima…

---

## [Dynamic Union](https://discourse.julialang.org/t/dynamic-union/18642)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 9\
**Last updated:** [December 16, 2018, 6:58pm UTC](https://discourse.julialang.org/t/dynamic-union/18642 "2018-12-16T18:58:48Z")

</div>

Hi, I can do this in coding phase. const SymExpr = Union{Symbol,Expr} :s isa SymExpr # returns true :(x+1) isa SymExpr # returns true 1 isa SymExpr # returns false I want a dynamic Union so that I can add Int to it at…

---

## [Interleaving bits (Z-order curve,morton code).Transpose binary matrix](https://discourse.julialang.org/t/interleaving-bits-z-order-curve-morton-code-transpose-binary-matrix/18458)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 8\
**Last updated:** [December 16, 2018, 1:51pm UTC](https://discourse.julialang.org/t/interleaving-bits-z-order-curve-morton-code-transpose-binary-matrix/18458 "2018-12-16T13:51:35Z")

</div>

Hi I am trying to make the fastest code to UN-interleaving every 4 bits of a UInt64. So if I have the binary representation of my Int as : ABCD/EFGH/IJKL/MNOP/QRST/UVWX (letters are 0 and 1) I am looking for something…

---

## [Calling JL\_GC\_PUSH1 multiple times](https://discourse.julialang.org/t/calling-jl-gc-push1-multiple-times/18666)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 6\
**Last updated:** [December 16, 2018, 11:35am UTC](https://discourse.julialang.org/t/calling-jl-gc-push1-multiple-times/18666 "2018-12-16T11:35:59Z")

</div>

Hi guys, I am creating a C++ software that calls multiple functions of my Julia package. Something like: jl\_init(); jl\_eval\_string("using SatelliteToolbox"); jl\_module\_t\* SatelliteToolbox = (jl\_mod…

---

## [Sorting lines by ID seems slow](https://discourse.julialang.org/t/sorting-lines-by-id-seems-slow/18705)

<div class="topic-metadata">

**Author:** [@tblz](https://discourse.julialang.org/u/tblz)\
**Replies:** 2\
**Last updated:** [December 16, 2018, 3:18am UTC](https://discourse.julialang.org/t/sorting-lines-by-id-seems-slow/18705 "2018-12-16T03:18:26Z")

</div>

Am trying to sort a file that looks like this: sc285168\_1 # 660 # 1046 # -1 # ID=285168\_1;partial=00; sc29363\_1 # 57 # 887 # 1 # ID=29363\_1;partial=00; sc316197\_1 # 17 # 418 # 1 # ID=316197\_1;partial=00; sc273994\_1 …

---

## [Write to the file the structure of the form (key =\> value) followed by reading using Mmap.mmap](https://discourse.julialang.org/t/write-to-the-file-the-structure-of-the-form-key-value-followed-by-reading-using-mmap-mmap/18680)

<div class="topic-metadata">

**Author:** [@1112](https://discourse.julialang.org/u/1112)\
**Replies:** 12\
**Last updated:** [December 16, 2018, 1:35am UTC](https://discourse.julialang.org/t/write-to-the-file-the-structure-of-the-form-key-value-followed-by-reading-using-mmap-mmap/18680 "2018-12-16T01:35:02Z")

</div>

There are two numbers B and A. You must save their file as \[B =\> A\]. Then, using Mmap.mmap, read this file and search B, if B is found to get a value A. Please tell me how to do it. I can not understand how nested array…

---

## [What functions/packages should I use to sort and "group by" as fast as possible...?](https://discourse.julialang.org/t/what-functions-packages-should-i-use-to-sort-and-group-by-as-fast-as-possible/18687)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 4\
**Last updated:** [December 16, 2018, 1:05am UTC](https://discourse.julialang.org/t/what-functions-packages-should-i-use-to-sort-and-group-by-as-fast-as-possible/18687 "2018-12-16T01:05:07Z")

</div>

I’m looking for fast functions to group by or sort large dataframes with several columns of strings (with few different values) or numbers. There are many packages and options: Base, ShortStrings, SortingLab, FastGroupB…

---

## [Cp (copy file) function force keyword gives you too much power](https://discourse.julialang.org/t/cp-copy-file-function-force-keyword-gives-you-too-much-power/18200)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 3\
**Last updated:** [December 15, 2018, 9:09pm UTC](https://discourse.julialang.org/t/cp-copy-file-function-force-keyword-gives-you-too-much-power/18200 "2018-12-15T21:09:39Z")

</div>

With great power comes great responsibility – some guy I recently got myself into big trouble using the force keyword. the documentation is clear, it will delete the destination. My misunderstanding was that the desti…

---

## [GR error using basic plot: GKS: Rectangle definition is invalid](https://discourse.julialang.org/t/gr-error-using-basic-plot-gks-rectangle-definition-is-invalid/18004)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 7\
**Last updated:** [December 15, 2018, 8:45pm UTC](https://discourse.julialang.org/t/gr-error-using-basic-plot-gks-rectangle-definition-is-invalid/18004 "2018-12-15T20:45:19Z")

</div>

julia\> y=\[19.8, 10.0\] 2-element Array{Float64,1}: 19.8 10.0 julia\> plot(y) invalid range GKS: Rectangle definition is invalid in routine SET\_WINDOW julia\> y=\[10.0, 19.8\] 2-element Array{Float64,1}: 10.0 19.8 julia\>…

---

## [Performance of typed keyword arguments](https://discourse.julialang.org/t/performance-of-typed-keyword-arguments/11579)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 10\
**Last updated:** [December 15, 2018, 4:36pm UTC](https://discourse.julialang.org/t/performance-of-typed-keyword-arguments/11579 "2018-12-15T16:36:03Z")

</div>

Hello, I have tried this code and I am really confused why the keyword version is slo slow even when I provide a type to it. using BenchmarkTools f1(x) = exp(x) f2(x::Number) = exp(x) f3(x::Float64) = exp(x) v1(;x=2.5…

---

## [Convenient way to explore package dir tree with many .mem files](https://discourse.julialang.org/t/convenient-way-to-explore-package-dir-tree-with-many-mem-files/18678)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [December 15, 2018, 3:36pm UTC](https://discourse.julialang.org/t/convenient-way-to-explore-package-dir-tree-with-many-mem-files/18678 "2018-12-15T15:36:54Z")

</div>

I ran code from a package starting julia with julia --track-allocations=user. This created a bunch of .mem files in the package directory tree. Is there a convenient way to quickly locate the lines that are allocating t…

---

## [How to include more modules in one package?](https://discourse.julialang.org/t/how-to-include-more-modules-in-one-package/18664)

<div class="topic-metadata">

**Author:** [@Eugeleo](https://discourse.julialang.org/u/Eugeleo)\
**Replies:** 6\
**Last updated:** [December 15, 2018, 11:48am UTC](https://discourse.julialang.org/t/how-to-include-more-modules-in-one-package/18664 "2018-12-15T11:48:00Z")

</div>

I’m making my first package for Julia (text generator based on Markov chains) and I’d like it to export two modules: Markovify and Markovify.Tokenizer, so that both will be available to be used in the users code. How do …

---

## [Julia falling asleep during optimization (blackboxoptim)](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135)

<div class="topic-metadata">

**Author:** [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)\
**Replies:** 15\
**Last updated:** [December 15, 2018, 7:20am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135 "2018-12-15T07:20:26Z")

</div>

When I’m running an optimization (by running a file using the include command on terminal) , I find the code inexplicably pauses and will only restart if I hit a key while in the REPL. Almost like it’s fallen asleep. I’m…

---

## [Incorrectly Inferred Return Type](https://discourse.julialang.org/t/incorrectly-inferred-return-type/18668)

<div class="topic-metadata">

**Author:** [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Replies:** 2\
**Last updated:** [December 14, 2018, 7:28pm UTC](https://discourse.julialang.org/t/incorrectly-inferred-return-type/18668 "2018-12-14T19:28:33Z")

</div>

I have a case where code\_warntype shows a function returning a difference concrete type from what it actually returns. Here is the code: abstract type AbstractFoo end mutable struct FooBase \<: AbstractFoo a::Int #…

---

## [How to manage multiple connections from a server socket ?](https://discourse.julialang.org/t/how-to-manage-multiple-connections-from-a-server-socket/18657)

<div class="topic-metadata">

**Author:** [@simoes](https://discourse.julialang.org/u/simoes)\
**Replies:** 0\
**Last updated:** [December 14, 2018, 2:06pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-connections-from-a-server-socket/18657 "2018-12-14T14:06:48Z")

</div>

Hi there. I need to make a server at julia, but i can’t find a way to receive multiple connections in parallel to my communication code. In the code below: The server is capable to receive connections outside the @as…

---

## [Reinterpret UInt64 as SVector{8,UInt8}](https://discourse.julialang.org/t/reinterpret-uint64-as-svector-8-uint8/18652)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 2\
**Last updated:** [December 14, 2018, 11:53am UTC](https://discourse.julialang.org/t/reinterpret-uint64-as-svector-8-uint8/18652 "2018-12-14T11:53:50Z")

</div>

I’d like to reinterpret a UInt64 as a SVector{8, UInt8}: julia\> reinterpret(SVector{8, UInt8}, UInt64(1235189)) ERROR: bitcast: target type not a leaf primitive type Stacktrace: \[1\] reinterpret(::Type{SArray{Tuple{8},U…

---

## [Constants not propagated when taking a slice of a tuple](https://discourse.julialang.org/t/constants-not-propagated-when-taking-a-slice-of-a-tuple/18618)

<div class="topic-metadata">

**Author:** [@cnliao](https://discourse.julialang.org/u/cnliao)\
**Replies:** 11\
**Last updated:** [December 14, 2018, 7:10am UTC](https://discourse.julialang.org/t/constants-not-propagated-when-taking-a-slice-of-a-tuple/18618 "2018-12-14T07:10:06Z")

</div>

I wrote some functions that shifts tuples and run into the following: shiftleft(x1, xs...) = (xs..., x1) # (1,2,3) -\> (2,3,1) shiftright1(xs...) = (xs\[end\], xs\[1:end-1\]...) # (1,2,3) -\> (3,1,2) shiftright2(xs...) = (xs\[…

---

## [Distributed array of arrays](https://discourse.julialang.org/t/distributed-array-of-arrays/18649)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 0\
**Last updated:** [December 14, 2018, 6:07am UTC](https://discourse.julialang.org/t/distributed-array-of-arrays/18649 "2018-12-14T06:07:24Z")

</div>

I’m wondering how to manage shared memory for a distributed process that fills a matrix of vectors - where each process works on a separate vector but finally combines them into the matrix of vectors. I was imagining @d…

---

## [Multiply many-matrices by many-vectors](https://discourse.julialang.org/t/multiply-many-matrices-by-many-vectors/18542)

<div class="topic-metadata">

**Author:** [@GregVernon](https://discourse.julialang.org/u/GregVernon)\
**Replies:** 33\
**Last updated:** [December 14, 2018, 12:44am UTC](https://discourse.julialang.org/t/multiply-many-matrices-by-many-vectors/18542 "2018-12-14T00:44:10Z")

</div>

All, I have a critical portion of code that essentially involves the multiplication of many pre-computed matrices by many pre-computed vectors. Each matrix multiplies the same, entire list of vectors. Each matrix is t…

---

## [Inconsistent behavior of Range](https://discourse.julialang.org/t/inconsistent-behavior-of-range/18632)

<div class="topic-metadata">

**Author:** [@aharoun](https://discourse.julialang.org/u/aharoun)\
**Replies:** 5\
**Last updated:** [December 13, 2018, 7:17pm UTC](https://discourse.julialang.org/t/inconsistent-behavior-of-range/18632 "2018-12-13T19:17:13Z")

</div>

Following expression gives inconsistent results for different values of n. r = 0.0:pi/n:pi I expect it to be length n+1 and include pi. For instance, for n=24 and n=26 the behavior is as I expected, but for n=25 it do…

---

## [DataFrame has NA, what best to do?](https://discourse.julialang.org/t/dataframe-has-na-what-best-to-do/18621)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 8\
**Last updated:** [December 13, 2018, 5:19pm UTC](https://discourse.julialang.org/t/dataframe-has-na-what-best-to-do/18621 "2018-12-13T17:19:56Z")

</div>

I read in a dataframe with CSV.read that contains some “NA” elements. CSV.read categorized those columns with NA’s as String. So it’s easy for me to remove the rows with the NA’s by comparing the string of every elemen…

---

## [Code working in 0.6.4 crashes in 0.7](https://discourse.julialang.org/t/code-working-in-0-6-4-crashes-in-0-7/18629)

<div class="topic-metadata">

**Author:** [@korowjev](https://discourse.julialang.org/u/korowjev)\
**Replies:** 2\
**Last updated:** [December 13, 2018, 3:50pm UTC](https://discourse.julialang.org/t/code-working-in-0-6-4-crashes-in-0-7/18629 "2018-12-13T15:50:43Z")

</div>

Hello, thanks in advance for any guidance provided. I was migrating some code from 0.6.4 to 0.7, as a previous step to moving to 1.0: the very same code works on 0.6.4 but crashes on 0.7. To be honest, I don’t fully und…

---

## [Hints for an old programmer new to Julia](https://discourse.julialang.org/t/hints-for-an-old-programmer-new-to-julia/18606)

<div class="topic-metadata">

**Author:** [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Replies:** 7\
**Last updated:** [December 13, 2018, 3:40pm UTC](https://discourse.julialang.org/t/hints-for-an-old-programmer-new-to-julia/18606 "2018-12-13T15:40:53Z")

</div>

First, let me say I love Julia! It is a terrific new tool in my box for Machine Learning :smiley: I am an old time programmer who is used to type safety and static type checking, and with Julia, I am experiencing many …

---

## [Why x\[\[1,2\]\] = \[0,0\] works?](https://discourse.julialang.org/t/why-x-1-2-0-0-works/18615)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 2\
**Last updated:** [December 13, 2018, 1:21pm UTC](https://discourse.julialang.org/t/why-x-1-2-0-0-works/18615 "2018-12-13T13:21:40Z")

</div>

Why this works: julia\> x = collect(1:5); julia\> x\[\[1,2\]\] = \[0,0\] 2-element Array{Int64,1}: 0 0 julia\> x 5-element Array{Int64,1}: 0 0 3 4 5 I thought x\[\[1,2\]\] = \[0,0\] should be a syntax error (the correct sy…

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

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