# General Usage

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

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

**Page:** 1041

---

## [Why the re-definition of some methods of f make the other methods un-exported?](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554)

<div class="topic-metadata">

**Author:** [@DrKrar](https://discourse.julialang.org/u/DrKrar)\
**Replies:** 2\
**Last updated:** [June 29, 2017, 11:17pm UTC](https://discourse.julialang.org/t/why-the-re-definition-of-some-methods-of-f-make-the-other-methods-un-exported/4554 "2017-06-29T23:17:00Z")

</div>

is this a bug or a usual behavior. Version 0.7.0-DEV.772 julia\> module M export f f() = 1 f(x::Int)= x f(x::Float64) = x end M julia\> using M julia\> f()=2 f (generic function with 1 method) julia\> f() 2 ju…

---

## [Help with a macro inside module on 0.6](https://discourse.julialang.org/t/help-with-a-macro-inside-module-on-0-6/4569)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 4\
**Last updated:** [June 30, 2017, 6:07pm UTC](https://discourse.julialang.org/t/help-with-a-macro-inside-module-on-0-6/4569 "2017-06-30T18:07:16Z")

</div>

Hello, this macro inside the module works on 0.5 (prints 3101). But on 0.6, module MM export tt macro bla(l) quote println($(esc(l)),m) end end function tt() m=101 @bla 3 end end using MM tt() exits wi…

---

## [\`broadcast\` with iterators?](https://discourse.julialang.org/t/broadcast-with-iterators/4567)

<div class="topic-metadata">

**Author:** [@fasiha](https://discourse.julialang.org/u/fasiha)\
**Replies:** 3\
**Last updated:** [June 30, 2017, 6:05pm UTC](https://discourse.julialang.org/t/broadcast-with-iterators/4567 "2017-06-30T18:05:02Z")

</div>

Start with x = randn(6, 4). This works: broadcast((x,tup) -\> x \* tup\[1\] \* tup\[2\], x, collect(Base.product(0:5, 0:3))) But of course I’d like to do this without that collect (and, eventually, in-place, overwriting x) b…

---

## [Why is the returntype of length not always an integer?](https://discourse.julialang.org/t/why-is-the-returntype-of-length-not-always-an-integer/4566)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 4\
**Last updated:** [June 30, 2017, 3:43pm UTC](https://discourse.julialang.org/t/why-is-the-returntype-of-length-not-always-an-integer/4566 "2017-06-30T15:43:00Z")

</div>

julia\> code\_warntype(length, (Range,)) ... end::Union{AbstractArray{T\<:Number,2},AbstractString,Number}

---

## [BitArray unboxing](https://discourse.julialang.org/t/bitarray-unboxing/4558)

<div class="topic-metadata">

**Author:** [@tastelessjolt](https://discourse.julialang.org/u/tastelessjolt)\
**Replies:** 3\
**Last updated:** [June 30, 2017, 10:11am UTC](https://discourse.julialang.org/t/bitarray-unboxing/4558 "2017-06-30T10:11:06Z")

</div>

Is casting to this struct enough? typedef struct { jl\_array\_t \*chunks; int64\_t len; jl\_value\_t \*dims; } jl\_bit\_array\_t; Like, I tried this typedef struct { jl\_array\_t \*chunks; int64\_t len; jl\_valu…

---

## [Alternatives to ZMQ for 32bit to 64bit library interface](https://discourse.julialang.org/t/alternatives-to-zmq-for-32bit-to-64bit-library-interface/4552)

<div class="topic-metadata">

**Author:** [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Replies:** 2\
**Last updated:** [June 30, 2017, 4:56am UTC](https://discourse.julialang.org/t/alternatives-to-zmq-for-32bit-to-64bit-library-interface/4552 "2017-06-30T04:56:59Z")

</div>

I need to call a 32bit library from Julia. However, I need to run Julia as a 64bit process (to call several other libraries). I cannot (AFAIK) ccall a 32bit binary from 64bit Julia. One solution I have is to write a C++…

---

## [Require failed to create a usable precompiled cached file](https://discourse.julialang.org/t/require-failed-to-create-a-usable-precompiled-cached-file/4548)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 2\
**Last updated:** [June 29, 2017, 10:01pm UTC](https://discourse.julialang.org/t/require-failed-to-create-a-usable-precompiled-cached-file/4548 "2017-06-29T22:01:50Z")

</div>

During the 0.6 alpha process, it seemed that every time I downloaded a new Julia version, using ScikitLearn would fail with the error: Module ScikitLearn declares precompile(true) but require failed to create a usable pr…

---

## [Cxx: dereferencing CppPtr, accessing fields, using C++ operators](https://discourse.julialang.org/t/cxx-dereferencing-cppptr-accessing-fields-using-c-operators/4402)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 7\
**Last updated:** [June 29, 2017, 9:55pm UTC](https://discourse.julialang.org/t/cxx-dereferencing-cppptr-accessing-fields-using-c-operators/4402 "2017-06-29T21:55:44Z")

</div>

Here’s a (not so minimal) piece of code using Cxx.jl to use as an example. I include some questions in a REPL transcript below. Please let me know if I’m using Cxx not as intended. using Cxx cxx""" #include \<stddef.h\> …

---

## [@everywhere using MyLib fails when procs on remote node](https://discourse.julialang.org/t/everywhere-using-mylib-fails-when-procs-on-remote-node/4515)

<div class="topic-metadata">

**Author:** [@alha02](https://discourse.julialang.org/u/alha02)\
**Replies:** 7\
**Last updated:** [June 29, 2017, 9:13pm UTC](https://discourse.julialang.org/t/everywhere-using-mylib-fails-when-procs-on-remote-node/4515 "2017-06-29T21:13:37Z")

</div>

I am having troubles loading my package on remote nodes with multiple procs: julia\> @everywhere using MyLib INFO: Precompiling module MyLib. WARNING: Node state is inconsistent: node 2 failed to load cache from /home/al…

---

## [Embedding Julia in Matlab](https://discourse.julialang.org/t/embedding-julia-in-matlab/4475)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 7\
**Last updated:** [June 29, 2017, 9:11pm UTC](https://discourse.julialang.org/t/embedding-julia-in-matlab/4475 "2017-06-29T21:11:40Z")

</div>

In need to port code from Matlab to Julia, and as intermediate step it would e very useful to be able to call Julia functions from Matlab. The project https://github.com/twadleigh/mexjulia has the aim to make this pos…

---

## [Running examples from a cloned package](https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [June 29, 2017, 5:06pm UTC](https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539 "2017-06-29T17:06:58Z")

</div>

What is the proper way of running examples from a cloned package? If I write some examples of the use of the package, and they are included when the package is cloned, how does the user conveniently run those examples…

---

## [Julia import large out-of-memory csv data](https://discourse.julialang.org/t/julia-import-large-out-of-memory-csv-data/4532)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 11\
**Last updated:** [June 29, 2017, 2:43pm UTC](https://discourse.julialang.org/t/julia-import-large-out-of-memory-csv-data/4532 "2017-06-29T14:43:57Z")

</div>

I am a new Julia user and a PhD in Finance, and I would like to use Julia in my future financial research. I have been using R for most of my research projects. I was wondering if Julia has a package similar to Sparklyr…

---

## [How fast is \`unshift!\` for a \`Vector\`?](https://discourse.julialang.org/t/how-fast-is-unshift-for-a-vector/4542)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 3\
**Last updated:** [June 29, 2017, 2:32pm UTC](https://discourse.julialang.org/t/how-fast-is-unshift-for-a-vector/4542 "2017-06-29T14:32:51Z")

</div>

unshift! adds an element at the front of a Vector, which requires shifting the whole contents of the Vector to the right. This feels like is should be slow (or, rather, slooow). However, some naive benchmarking indicate…

---

## [How to write to the YAML file?](https://discourse.julialang.org/t/how-to-write-to-the-yaml-file/4540)

<div class="topic-metadata">

**Author:** [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)\
**Replies:** 1\
**Last updated:** [June 29, 2017, 12:30pm UTC](https://discourse.julialang.org/t/how-to-write-to-the-yaml-file/4540 "2017-06-29T12:30:21Z")

</div>

I have yaml file conf.yaml and now I want to rerwrite/change value of key. I used the YAML.jl package but emitting julia objects to YAML not yet implemented. I have about 300 files with some different keys. Any idea? Th…

---

## [Efficiently deleting a column or row in a matrix](https://discourse.julialang.org/t/efficiently-deleting-a-column-or-row-in-a-matrix/4534)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 8\
**Last updated:** [June 29, 2017, 8:46am UTC](https://discourse.julialang.org/t/efficiently-deleting-a-column-or-row-in-a-matrix/4534 "2017-06-29T08:46:34Z")

</div>

What is the most efficient way to delete a column or a row in a matrix without reallocating the whole matrix?

---

## [SparseMatrixCSC allocation](https://discourse.julialang.org/t/sparsematrixcsc-allocation/4478)

<div class="topic-metadata">

**Author:** [@tastelessjolt](https://discourse.julialang.org/u/tastelessjolt)\
**Replies:** 12\
**Last updated:** [June 29, 2017, 8:00am UTC](https://discourse.julialang.org/t/sparsematrixcsc-allocation/4478 "2017-06-29T08:00:32Z")

</div>

How to allocate an uninitialised SparseMatrixCSC in the C Embedding API? I mean I couldn’t find/create the type variable for SparseMatrixCSC.

---

## [Julia Embedding in Windows (winsock2.h not found)](https://discourse.julialang.org/t/julia-embedding-in-windows-winsock2-h-not-found/4513)

<div class="topic-metadata">

**Author:** [@tastelessjolt](https://discourse.julialang.org/u/tastelessjolt)\
**Replies:** 3\
**Last updated:** [June 29, 2017, 2:22am UTC](https://discourse.julialang.org/t/julia-embedding-in-windows-winsock2-h-not-found/4513 "2017-06-29T02:22:19Z")

</div>

What more directories should I include? And will Julia embedding work with visual studio’s compiler? This is actually for an interface for Scilab, a language like Matlab. I used cflags, ldflags, ldlibs from julia-confi…

---

## [Equivalent of numpy.ascontiguousarray in Julia](https://discourse.julialang.org/t/equivalent-of-numpy-ascontiguousarray-in-julia/4525)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 6\
**Last updated:** [June 28, 2017, 9:51pm UTC](https://discourse.julialang.org/t/equivalent-of-numpy-ascontiguousarray-in-julia/4525 "2017-06-28T21:51:45Z")

</div>

I would like to change a non-contiguous array to a contiguous one. What is the fastest way to do that in Julia?

---

## [How to build Julia to use vector instructions for multiple workers: "Target architecture mismatch"](https://discourse.julialang.org/t/how-to-build-julia-to-use-vector-instructions-for-multiple-workers-target-architecture-mismatch/4521)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 2\
**Last updated:** [June 28, 2017, 9:12pm UTC](https://discourse.julialang.org/t/how-to-build-julia-to-use-vector-instructions-for-multiple-workers-target-architecture-mismatch/4521 "2017-06-28T21:12:06Z")

</div>

If I set in my Make.user MARCH=x86-64 I can get Julia to launch on multiple workers without simd vectorization working If I remove that line or set it to MARCH=native I can get simd vectorization on the main worker bu…

---

## [How to add date-time to Base.info](https://discourse.julialang.org/t/how-to-add-date-time-to-base-info/4517)

<div class="topic-metadata">

**Author:** [@kimran](https://discourse.julialang.org/u/kimran)\
**Replies:** 0\
**Last updated:** [June 28, 2017, 1:14pm UTC](https://discourse.julialang.org/t/how-to-add-date-time-to-base-info/4517 "2017-06-28T13:14:43Z")

</div>

Lets say I want the current date time displayed, when I call info I think I could use logging(io,kind=:info) to redirect info messages to another IOStream But I cannot figure out how to implement this IOStream that w…

---

## [What is a unionall type?](https://discourse.julialang.org/t/what-is-a-unionall-type/721)

<div class="topic-metadata">

**Author:** [@Tem\_Pl](https://discourse.julialang.org/u/Tem_Pl)\
**Replies:** 11\
**Last updated:** [June 28, 2017, 5:33pm UTC](https://discourse.julialang.org/t/what-is-a-unionall-type/721 "2017-06-28T17:33:12Z")

</div>

What is a unionall type?

---

## [Cumsum with list comprehension](https://discourse.julialang.org/t/cumsum-with-list-comprehension/4516)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 1\
**Last updated:** [June 28, 2017, 1:18pm UTC](https://discourse.julialang.org/t/cumsum-with-list-comprehension/4516 "2017-06-28T13:18:42Z")

</div>

Why does this work: julia\> sum(i for i in 1:3) 6 but not this: julia\> cumsum(i for i in 1:3) ERROR: MethodError: no method matching cumsum(::Base.Generator{UnitRange{Int64},##13#14})

---

## [Help defining Functor type](https://discourse.julialang.org/t/help-defining-functor-type/4509)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 8\
**Last updated:** [June 28, 2017, 10:23am UTC](https://discourse.julialang.org/t/help-defining-functor-type/4509 "2017-06-28T10:23:28Z")

</div>

I am almost there, but this is my first time using StaticArrays.jl and I am not sure I got the concepts right: using StaticArrays: SMatrix """ EllipsoidDistance(\[a₁, a₂, ...\], \[θ₁, θ₂, ...\]) A distance defined by …

---

## [Very Mysterious Memory Allocation](https://discourse.julialang.org/t/very-mysterious-memory-allocation/4511)

<div class="topic-metadata">

**Author:** [@Nitin\_Arora](https://discourse.julialang.org/u/Nitin_Arora)\
**Replies:** 6\
**Last updated:** [June 28, 2017, 7:39am UTC](https://discourse.julialang.org/t/very-mysterious-memory-allocation/4511 "2017-06-28T07:39:05Z")

</div>

I had a similar issue couple of years and looks like its back. See the MWE function below: function getdW{T\<:AbstractFloat}(k::T,work::AbstractVector{T}) local sqrt2l = 1.41421356237309510 local K2c0 = 0.75424…

---

## [Preventing broadcast from creating anonymous functions on lowering for a custom type](https://discourse.julialang.org/t/preventing-broadcast-from-creating-anonymous-functions-on-lowering-for-a-custom-type/4508)

<div class="topic-metadata">

**Author:** [@fjarri](https://discourse.julialang.org/u/fjarri)\
**Replies:** 2\
**Last updated:** [June 28, 2017, 4:38am UTC](https://discourse.julialang.org/t/preventing-broadcast-from-creating-anonymous-functions-on-lowering-for-a-custom-type/4508 "2017-06-28T04:38:16Z")

</div>

I want to implement my own type that behaves similarly to an Array, in particular participates in the same arithmetic expressions. Except, instead of eager evaluation, the arithmetic operations should just return an expr…

---

## [JuliaPro installation stuck when installing from China](https://discourse.julialang.org/t/juliapro-installation-stuck-when-installing-from-china/3884)

<div class="topic-metadata">

**Author:** [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)\
**Replies:** 6\
**Last updated:** [June 28, 2017, 4:32am UTC](https://discourse.julialang.org/t/juliapro-installation-stuck-when-installing-from-china/3884 "2017-06-28T04:32:33Z")

</div>

I am posting for a friend who tried installing JuliaPro in mainland China. He said the installation got to the stage of copying files and the progress froze, getting nowhere for 2 hours before he shut it down. His netwo…

---

## [Pkg.update() build errors for multiple packages after update to Julia v0.6](https://discourse.julialang.org/t/pkg-update-build-errors-for-multiple-packages-after-update-to-julia-v0-6/4504)

<div class="topic-metadata">

**Author:** [@holder66](https://discourse.julialang.org/u/holder66)\
**Replies:** 5\
**Last updated:** [June 28, 2017, 1:45am UTC](https://discourse.julialang.org/t/pkg-update-build-errors-for-multiple-packages-after-update-to-julia-v0-6/4504 "2017-06-28T01:45:47Z")

</div>

MacOS 10.12.5; I installed the Julia v0.6 binary, ran Pkg.update(), copied the REQUIRE file from ~/.julia/v0.5 to /v0.6, ran Pkg.update() again, and got multiple load errors, culminating in a summary: WARNING: Rmath, De…

---

## [Calling gc() in global scope from a function](https://discourse.julialang.org/t/calling-gc-in-global-scope-from-a-function/4483)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 7\
**Last updated:** [June 28, 2017, 12:58am UTC](https://discourse.julialang.org/t/calling-gc-in-global-scope-from-a-function/4483 "2017-06-28T00:58:40Z")

</div>

I am trying to call gc() to clean the global scope but from inside a function. Is such a thing possible?

---

## [Help with IntervalArithmetic](https://discourse.julialang.org/t/help-with-intervalarithmetic/4497)

<div class="topic-metadata">

**Author:** [@mgameiro](https://discourse.julialang.org/u/mgameiro)\
**Replies:** 13\
**Last updated:** [June 27, 2017, 10:54pm UTC](https://discourse.julialang.org/t/help-with-intervalarithmetic/4497 "2017-06-27T22:54:07Z")

</div>

I am using the IntervalArithmetic packaged and I need to convert a vector and a matrix of floats to a vector and matrix of intervals. Is there a simple way to do this? More specifically, let’s say I have v = \[1; 2.1\] …

---

## [Anyone still using julia-repl in Emacs with v0.5.\*?](https://discourse.julialang.org/t/anyone-still-using-julia-repl-in-emacs-with-v0-5/4492)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [June 27, 2017, 1:48pm UTC](https://discourse.julialang.org/t/anyone-still-using-julia-repl-in-emacs-with-v0-5/4492 "2017-06-27T13:48:53Z")

</div>

If you are not using Emacs, you can ignore this topic. julia-repl contained a workaround for the CHA ANSI term sequence which did not play well with ansi-term in Emacs. This was fixed in v0.6.0. I am in the process of g…

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

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