# General Usage

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

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

**Page:** 1077

---

## [Download command does not follow redirects on Windows](https://discourse.julialang.org/t/download-command-does-not-follow-redirects-on-windows/485)

<div class="topic-metadata">

**Author:** [@eftekhari](https://discourse.julialang.org/u/eftekhari)\
**Replies:** 5\
**Last updated:** [November 23, 2016, 7:58am UTC](https://discourse.julialang.org/t/download-command-does-not-follow-redirects-on-windows/485 "2016-11-23T07:58:24Z")

</div>

I have a package that needs to download a library from sourceforge. On windows, the download command does not follow redirects. I found that the microsoft function that is used by Julia is not able to follow redirects. I…

---

## [Solution for redefinition of functions being used in other functions?](https://discourse.julialang.org/t/solution-for-redefinition-of-functions-being-used-in-other-functions/469)

<div class="topic-metadata">

**Author:** [@angelv](https://discourse.julialang.org/u/angelv)\
**Replies:** 9\
**Last updated:** [November 23, 2016, 4:30am UTC](https://discourse.julialang.org/t/solution-for-redefinition-of-functions-being-used-in-other-functions/469 "2016-11-23T04:30:41Z")

</div>

Hi, I’ve searched around the old mailing lists, and I understand that this is a well-known issue, and that I think it is solved? for v 0.6, but for those still at 0.5, is there any solution/hack/advice? For example, wo…

---

## [Overwriting functions](https://discourse.julialang.org/t/overwriting-functions/404)

<div class="topic-metadata">

**Author:** [@akis](https://discourse.julialang.org/u/akis)\
**Replies:** 7\
**Last updated:** [November 22, 2016, 11:53pm UTC](https://discourse.julialang.org/t/overwriting-functions/404 "2016-11-22T23:53:13Z")

</div>

Note: This post is intended as a FAQ entry in wiki format to get improved by the community. Relevant pages of the Julia Documentation: Functions, Methods Relevant Julia principles by design: Different types get diffe…

---

## [Problem registering a new package](https://discourse.julialang.org/t/problem-registering-a-new-package/401)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 9\
**Last updated:** [November 21, 2016, 11:23pm UTC](https://discourse.julialang.org/t/problem-registering-a-new-package/401 "2016-11-21T23:23:44Z")

</div>

HI all, I recently (a few days ago) attempted to register a new package I’ve written - DependentBootstrap. However, I can’t see any sign of it in the offical METADATA, nor can I see a pull request for it on the official…

---

## [Looking for good macro examples](https://discourse.julialang.org/t/looking-for-good-macro-examples/450)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 11\
**Last updated:** [November 21, 2016, 7:38pm UTC](https://discourse.julialang.org/t/looking-for-good-macro-examples/450 "2016-11-21T19:38:29Z")

</div>

I still develop my Julia macros by trial and error, and since they are a bit different from Common Lisp macros, I am realizing that I need to learn a different way for idiomatic usage. The principle is the same as in CL,…

---

## [What does \_\_precompile\_\_ do?](https://discourse.julialang.org/t/what-does---precompile---do/282)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 4\
**Last updated:** [November 21, 2016, 5:57pm UTC](https://discourse.julialang.org/t/what-does---precompile---do/282 "2016-11-21T17:57:02Z")

</div>

I am curious to understand better how \_\_precompile\_\_() works. For example if I have a module containing f(x::Int) = ... f(x::Number) = ... f(x) = ... g(x::Float32) = f(x) Is it true that machine code for f(::Int) is c…

---

## [What are valid type parameters?](https://discourse.julialang.org/t/what-are-valid-type-parameters/471)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [November 21, 2016, 3:20pm UTC](https://discourse.julialang.org/t/what-are-valid-type-parameters/471 "2016-11-21T15:20:24Z")

</div>

I am trying to stuff quite a bit of information into parameters of a type, in the hope that dispatching on this will create efficient code. Doing this, I ran into the question of what is allowed, exactly. Is the followi…

---

## [Intersect() is slow for large arrays](https://discourse.julialang.org/t/intersect-is-slow-for-large-arrays/442)

<div class="topic-metadata">

**Author:** [@innerlee](https://discourse.julialang.org/u/innerlee)\
**Replies:** 5\
**Last updated:** [November 21, 2016, 11:18am UTC](https://discourse.julialang.org/t/intersect-is-slow-for-large-arrays/442 "2016-11-21T11:18:13Z")

</div>

julia\> a=rand(1000000); julia\> b=rand(1000000); julia\> @time setdiff(a, setdiff(a, b)) # this is fast 1.021180 seconds (77.65 k allocations: 100.853 MB, 19.28% gc time) 0-element Array{Float64,1} julia\> @time inters…

---

## [Create a row matrix of vectors](https://discourse.julialang.org/t/create-a-row-matrix-of-vectors/165)

<div class="topic-metadata">

**Author:** [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Replies:** 5\
**Last updated:** [November 21, 2016, 7:56am UTC](https://discourse.julialang.org/t/create-a-row-matrix-of-vectors/165 "2016-11-21T07:56:51Z")

</div>

I’d like to be able to create a row matrix holding vectors (the purpose is to pass them as series to Plots, but the question is general). However, I get issues with concatenation. I can create a vector of different-lengt…

---

## [Help with macro](https://discourse.julialang.org/t/help-with-macro/429)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [November 21, 2016, 5:21am UTC](https://discourse.julialang.org/t/help-with-macro/429 "2016-11-21T05:21:15Z")

</div>

I am trying to write a macro which would transform @enum\_and\_dict(foo, foodict, "A" =\> A, "B" =\> B) to @enum foo A B foodict = Dict("A" =\> A, "B" =\> B) I have tried this: macro enum\_and\_dict(enumname, dictvar, pairs…

---

## [Vectorization Advice](https://discourse.julialang.org/t/vectorization-advice/457)

<div class="topic-metadata">

**Author:** [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Replies:** 0\
**Last updated:** [November 21, 2016, 12:33am UTC](https://discourse.julialang.org/t/vectorization-advice/457 "2016-11-21T00:33:25Z")

</div>

I have a sample code here, where blockedLoop\_5\_2\_16 vectorizes but hilbertLoop\_5\_2\_16 doesn’t (using julia 0.4, neither vectorize on 0.6, issue filed here). Any advise on how to get it to vectorize? What I have tried s…

---

## [Pmap that uses workers() AND the master process for computation?](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 2\
**Last updated:** [November 20, 2016, 7:54pm UTC](https://discourse.julialang.org/t/pmap-that-uses-workers-and-the-master-process-for-computation/408 "2016-11-20T19:54:01Z")

</div>

i understand that pmap distributes tasks among workers() by default. in particular, ?pmap say\` If a worker pool is not specified, all available workers, i.e., the default worker pool is used. Is it possible to define…

---

## [Code generation: unnecessary comment lines when using "quote"](https://discourse.julialang.org/t/code-generation-unnecessary-comment-lines-when-using-quote/398)

<div class="topic-metadata">

**Author:** [@wrgr](https://discourse.julialang.org/u/wrgr)\
**Replies:** 4\
**Last updated:** [November 19, 2016, 11:34pm UTC](https://discourse.julialang.org/t/code-generation-unnecessary-comment-lines-when-using-quote/398 "2016-11-19T23:34:04Z")

</div>

Trying to generate a type in 2 ways: Expr(:type, false, :Oo, Expr(:block, :(field::Int))) and quote immutable Oo field::Int end end I’ve got 2 functionally equivalent, but different results for Expr and quote …

---

## [How slow push! is?](https://discourse.julialang.org/t/how-slow-push-is/424)

<div class="topic-metadata">

**Author:** [@pint](https://discourse.julialang.org/u/pint)\
**Replies:** 3\
**Last updated:** [November 18, 2016, 11:36pm UTC](https://discourse.julialang.org/t/how-slow-push-is/424 "2016-11-18T23:36:28Z")

</div>

suppose you need to build an array of unknown size. elements come in one by one, then an eof comes. the question is, how bad push!() is from performance viewpoint? the performant way to do this is to preallocate the arra…

---

## [Interactive development](https://discourse.julialang.org/t/interactive-development/313)

<div class="topic-metadata">

**Author:** [@jkroso](https://discourse.julialang.org/u/jkroso)\
**Replies:** 6\
**Last updated:** [November 18, 2016, 3:44pm UTC](https://discourse.julialang.org/t/interactive-development/313 "2016-11-18T15:44:01Z")

</div>

When redefining a subfunction I always have to go back and redefine the top level function since otherwise it continues to use the old definition of the subfunction. Is there a way around this? I have played with @noinli…

---

## [Memory usage with SharedArray: \`htop\` shows allocation on all processes?](https://discourse.julialang.org/t/memory-usage-with-sharedarray-htop-shows-allocation-on-all-processes/413)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 5\
**Last updated:** [November 18, 2016, 2:54pm UTC](https://discourse.julialang.org/t/memory-usage-with-sharedarray-htop-shows-allocation-on-all-processes/413 "2016-11-18T14:54:07Z")

</div>

Hi all, i’m trying to understand how much memory I am consuming on a single machine when allocating a shared array. i show htop output after each step. launch julia PID USER PRI NI VIRT RES S CPU% MEM% T…

---

## [\`pmap\` with shared arrays in side a custom type?](https://discourse.julialang.org/t/pmap-with-shared-arrays-in-side-a-custom-type/399)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 2\
**Last updated:** [November 18, 2016, 9:30am UTC](https://discourse.julialang.org/t/pmap-with-shared-arrays-in-side-a-custom-type/399 "2016-11-18T09:30:57Z")

</div>

Hi all, I have got the following example problem: I have a custom type with a shared array I want to distribute computation among n workers My computation requires me to know which job I am running (i.e. the first job…

---

## [Question regarding multiple dispatch \[was Strange and dangerous behavior redefining a function\]](https://discourse.julialang.org/t/question-regarding-multiple-dispatch-was-strange-and-dangerous-behavior-redefining-a-function/264)

<div class="topic-metadata">

**Author:** [@davide](https://discourse.julialang.org/u/davide)\
**Replies:** 8\
**Last updated:** [November 18, 2016, 8:02am UTC](https://discourse.julialang.org/t/question-regarding-multiple-dispatch-was-strange-and-dangerous-behavior-redefining-a-function/264 "2016-11-18T08:02:13Z")

</div>

Hi, I am running Julia v. 0.5.1-pre+27 and I stumbled in this unexpected behavior: I defined a function in Julia REPL, e.g.: f(a,b::Int64)=a\*b and I ran it once, e.g.: f(3,4) Then I modified the function: f(a,b)=a…

---

## [Test specific test sets in Julia v0.5](https://discourse.julialang.org/t/test-specific-test-sets-in-julia-v0-5/378)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 5\
**Last updated:** [November 17, 2016, 10:33pm UTC](https://discourse.julialang.org/t/test-specific-test-sets-in-julia-v0-5/378 "2016-11-17T22:33:07Z")

</div>

In Julia v0.5 we can group tests with @testset "Group 1" begin @test ... @test ... end @testset "Group 2" begin ... end Is there any way to only test a specific group like Pkg.test("Foo", "Group 1")? This is par…

---

## [View bounds checking](https://discourse.julialang.org/t/view-bounds-checking/393)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 3\
**Last updated:** [November 17, 2016, 8:50pm UTC](https://discourse.julialang.org/t/view-bounds-checking/393 "2016-11-17T20:50:03Z")

</div>

View’s docstring: view(A, inds…) Like getindex, but returns a view into the parent array A with the given indices instead of making a copy. Calling getindex or setindex! on the returned SubArray computes the indices t…

---

## [Audio echo and feedback cancelation](https://discourse.julialang.org/t/audio-echo-and-feedback-cancelation/272)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 4\
**Last updated:** [November 17, 2016, 3:54pm UTC](https://discourse.julialang.org/t/audio-echo-and-feedback-cancelation/272 "2016-11-17T15:54:07Z")

</div>

Hi all, I am trying to use PortAudio.jl to build a system that immediately plays back audio from a microphone to the speakers. The long term plan is to be able to add funny effects and things like pitch correction. The …

---

## [Seemingly Random Precompilation Errors: "does not support precompilation but is imported by a module that does"](https://discourse.julialang.org/t/seemingly-random-precompilation-errors-does-not-support-precompilation-but-is-imported-by-a-module-that-does/360)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 6\
**Last updated:** [November 16, 2016, 9:35pm UTC](https://discourse.julialang.org/t/seemingly-random-precompilation-errors-does-not-support-precompilation-but-is-imported-by-a-module-that-does/360 "2016-11-16T21:35:59Z")

</div>

Something that has been happening to me for awhile is that, every once in awhile, I have things no working due to this kind of precompilation error: INFO: Recompiling stale cache file /home/crackauc/.julia/lib/v0.5/Data…

---

## [Moving data to a parallel process](https://discourse.julialang.org/t/moving-data-to-a-parallel-process/356)

<div class="topic-metadata">

**Author:** [@TsurHerman](https://discourse.julialang.org/u/TsurHerman)\
**Replies:** 1\
**Last updated:** [November 16, 2016, 3:11pm UTC](https://discourse.julialang.org/t/moving-data-to-a-parallel-process/356 "2016-11-16T15:11:16Z")

</div>

I have a 2 process and a long running repeated computation, over data that is mostly stationary. long\_run(pos,V,F) V and F are static huge arrays , they do not change over time. pos is a small 4x4 array that changes f…

---

## [Where do I put my functions?](https://discourse.julialang.org/t/where-do-i-put-my-functions/328)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 8\
**Last updated:** [November 16, 2016, 2:58pm UTC](https://discourse.julialang.org/t/where-do-i-put-my-functions/328 "2016-11-16T14:58:26Z")

</div>

Hello! very newbie question here. Say I have a project in “Project” folder, with a couple of “.jl” files that are considered the main program(s). Now, I’d like to write some functions that will be called by the main pro…

---

## [Understanding the use of Union with parametric types](https://discourse.julialang.org/t/understanding-the-use-of-union-with-parametric-types/337)

<div class="topic-metadata">

**Author:** [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Replies:** 3\
**Last updated:** [November 16, 2016, 9:11am UTC](https://discourse.julialang.org/t/understanding-the-use-of-union-with-parametric-types/337 "2016-11-16T09:11:47Z")

</div>

Hi I’m trying to understand a MethodError I encountered after setting an argument type of a method to be the union of two types, one of which is a parametric type. The following mwe reproduces the issue. Consider the fo…

---

## [Weird error, very lost](https://discourse.julialang.org/t/weird-error-very-lost/298)

<div class="topic-metadata">

**Author:** [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Replies:** 3\
**Last updated:** [November 15, 2016, 3:02am UTC](https://discourse.julialang.org/t/weird-error-very-lost/298 "2016-11-15T03:02:01Z")

</div>

For some reason Y\[idx1,c\] and Y\[idx2,c\] are returning single, large Ints (even though idx1 and idx2 are ranges). This does not happen if I run the code manually (run each line in julia REPL, rather than calling function…

---

## [How to work with \`Base.Generator\` efficiently](https://discourse.julialang.org/t/how-to-work-with-base-generator-efficiently/248)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 6\
**Last updated:** [November 14, 2016, 7:42pm UTC](https://discourse.julialang.org/t/how-to-work-with-base-generator-efficiently/248 "2016-11-14T19:42:55Z")

</div>

I was calculating some statistics on an irregular data stored in a Dict, when I learned that StatsBase.countmap does not support generators. Since it is time I learned how to use them, I thought I would implement a metho…

---

## [Accessor for x-\>x\[2\]](https://discourse.julialang.org/t/accessor-for-x-x-2/252)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 11\
**Last updated:** [November 12, 2016, 6:33pm UTC](https://discourse.julialang.org/t/accessor-for-x-x-2/252 "2016-11-12T18:33:51Z")

</div>

Writing code like sort(collect(dictionary), by = x-\>x\[2\]) frequently I miss CL:SECOND from Common Lisp. Were named accessors of this kind considered? Or is there a standard way to automagically make a closure of field …

---

## [Testing typestability](https://discourse.julialang.org/t/testing-typestability/255)

<div class="topic-metadata">

**Author:** [@Evizero](https://discourse.julialang.org/u/Evizero)\
**Replies:** 3\
**Last updated:** [November 11, 2016, 4:26pm UTC](https://discourse.julialang.org/t/testing-typestability/255 "2016-11-11T16:26:33Z")

</div>

Is there such a thing as @test\_code\_warntype or something similar that basically just tells me if the return value of the function is “red” or not? What is the current best practice to test this kind of assumption using B…

---

## [Style question: defining methods for \`tryparse\`, \`parse\`](https://discourse.julialang.org/t/style-question-defining-methods-for-tryparse-parse/214)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 10\
**Last updated:** [November 11, 2016, 4:56am UTC](https://discourse.julialang.org/t/style-question-defining-methods-for-tryparse-parse/214 "2016-11-11T04:56:11Z")

</div>

I am parsing some datasets and it would feel quite natural to define things like immutable DateFormat format::String end tryparse(DateFormat("yyyymmdd"), "19800101") # =\> Nullable{Date}(1980,1,1) This would allow …

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

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