# General Usage

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

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

**Page:** 1070

---

## [Can't deserialize serialized data](https://discourse.julialang.org/t/cant-deserialize-serialized-data/1500)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [January 15, 2017, 8:09pm UTC](https://discourse.julialang.org/t/cant-deserialize-serialized-data/1500 "2017-01-15T20:09:56Z")

</div>

I am running a serialize/deserialize pair in 0.5.0, and deserializing fails with the error message below. julia\> open(joinpath("00002\_dump.jls"), "w") do io serialize(io, matched\_data) end julia\> dd =…

---

## [Performance of \`Pkg.status()\` when package directory is NFS mounted](https://discourse.julialang.org/t/performance-of-pkg-status-when-package-directory-is-nfs-mounted/1496)

<div class="topic-metadata">

**Author:** [@josefsachs](https://discourse.julialang.org/u/josefsachs)\
**Replies:** 1\
**Last updated:** [January 15, 2017, 5:03pm UTC](https://discourse.julialang.org/t/performance-of-pkg-status-when-package-directory-is-nfs-mounted/1496 "2017-01-15T17:03:40Z")

</div>

When my Julia package directory is on a local filesystem, Pkg.status() takes 2 seconds, but when it is located on an NFS mounted filesystem Pkg.status() takes over 170 seconds. Is this just a fact of life, or is there …

---

## [Inspect parameter type in container-like class](https://discourse.julialang.org/t/inspect-parameter-type-in-container-like-class/1492)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 7\
**Last updated:** [January 15, 2017, 4:51pm UTC](https://discourse.julialang.org/t/inspect-parameter-type-in-container-like-class/1492 "2017-01-15T16:51:58Z")

</div>

I have a very common problem for which I still don’t have a clear solution in Julia: abstract AbstractFoo{N,T} dimension{N,T}(::AbstractFoo{N,T}) = N coordtype{N,T}(::AbstractFoo{N,T}) = T abstract AbstractContainer{F}…

---

## [Assigning an array works in REPL but not in .jl script run from terminal](https://discourse.julialang.org/t/assigning-an-array-works-in-repl-but-not-in-jl-script-run-from-terminal/1440)

<div class="topic-metadata">

**Author:** [@phillefjonk](https://discourse.julialang.org/u/phillefjonk)\
**Replies:** 5\
**Last updated:** [January 15, 2017, 2:28pm UTC](https://discourse.julialang.org/t/assigning-an-array-works-in-repl-but-not-in-jl-script-run-from-terminal/1440 "2017-01-15T14:28:37Z")

</div>

I want to include an assignment of a multidimensional array (an array of arrays) to a variable in a script and run that script from the terminal. I try the assignment in REPL, which works flawlessly. Assigning the first…

---

## [About module creation](https://discourse.julialang.org/t/about-module-creation/1490)

<div class="topic-metadata">

**Author:** [@FANG\_Colin](https://discourse.julialang.org/u/FANG_Colin)\
**Replies:** 2\
**Last updated:** [January 15, 2017, 7:52am UTC](https://discourse.julialang.org/t/about-module-creation/1490 "2017-01-15T07:52:13Z")

</div>

I saw the use of Module() somewhere and it seems an equivalent of module A end However, it is not documented at all. Is Module(name) a recommended way to create modules programmatically? Also, I’d like to know how cos…

---

## [Project build practices](https://discourse.julialang.org/t/project-build-practices/1483)

<div class="topic-metadata">

**Author:** [@trans](https://discourse.julialang.org/u/trans)\
**Replies:** 2\
**Last updated:** [January 14, 2017, 10:21pm UTC](https://discourse.julialang.org/t/project-build-practices/1483 "2017-01-14T22:21:16Z")

</div>

Can’t seem to find any good overviews on setting up a Julia project that talks about handling dependencies, compiling, build scripts, etc. So I’m groping my way through it. Presently I am trying to use the BuildExecutabl…

---

## [The mechanics of dispatch](https://discourse.julialang.org/t/the-mechanics-of-dispatch/1484)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 1\
**Last updated:** [January 14, 2017, 6:50pm UTC](https://discourse.julialang.org/t/the-mechanics-of-dispatch/1484 "2017-01-14T18:50:47Z")

</div>

I’d like to understand the mechanics of runtime dispatching with untyped or partially-typed arguments a bit better. I found some useful information here and here, with the money quotes being It does a full method signa…

---

## [Julia 0.6 does not respect JULIA\_PKDIR environmnt variable?](https://discourse.julialang.org/t/julia-0-6-does-not-respect-julia-pkdir-environmnt-variable/1475)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 2\
**Last updated:** [January 14, 2017, 3:01am UTC](https://discourse.julialang.org/t/julia-0-6-does-not-respect-julia-pkdir-environmnt-variable/1475 "2017-01-14T03:01:56Z")

</div>

Hi, Contrary to all previous Julia versions, 0.6 writes the .julia dir under (my case) C:\\Users\\j.julia but I have clearly sated that I want it on a different directory as indicated in JULIA\_PKDIR = c:\\j.julia Repeat…

---

## [Different Dicts hashing to the same value](https://discourse.julialang.org/t/different-dicts-hashing-to-the-same-value/1441)

<div class="topic-metadata">

**Author:** [@samuel-massinon](https://discourse.julialang.org/u/samuel-massinon)\
**Replies:** 6\
**Last updated:** [January 13, 2017, 11:15pm UTC](https://discourse.julialang.org/t/different-dicts-hashing-to-the-same-value/1441 "2017-01-13T23:15:57Z")

</div>

While trying to do a puzzle problem, I notice that two different Dicts resulted in the same hash(...) value, even though the Dicts are not equivalent, as shown below. julia\> VERSION v"0.5.0" julia\> a = Dict(Dict(3 =\> 4…

---

## [Method for == without import?](https://discourse.julialang.org/t/method-for-without-import/1467)

<div class="topic-metadata">

**Author:** [@pint](https://discourse.julialang.org/u/pint)\
**Replies:** 1\
**Last updated:** [January 13, 2017, 6:30pm UTC](https://discourse.julialang.org/t/method-for-without-import/1467 "2017-01-13T18:30:50Z")

</div>

so i tried Base.==(...) = ... Base.(==)(...) = .... function Base.==(...) ... function Base.(==)(...) ... to no avail. if i import Base.==, then all of the above works without Base. not a big deal, but would be nice wi…

---

## [Redefinition of + with custom types delivers errors](https://discourse.julialang.org/t/redefinition-of-with-custom-types-delivers-errors/1466)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 1\
**Last updated:** [January 13, 2017, 4:38pm UTC](https://discourse.julialang.org/t/redefinition-of-with-custom-types-delivers-errors/1466 "2017-01-13T16:38:09Z")

</div>

Hi folks, I was trying to implement my own add function for my own data types but that seems to deliver errors that I can’t find the reason for. Just look at this example type mine x :: Int8 z :: Float64 mi…

---

## [Transfer Float64 matrix to double \*\*arg in C](https://discourse.julialang.org/t/transfer-float64-matrix-to-double-arg-in-c/1463)

<div class="topic-metadata">

**Author:** [@robertfeldt](https://discourse.julialang.org/u/robertfeldt)\
**Replies:** 4\
**Last updated:** [January 13, 2017, 4:06pm UTC](https://discourse.julialang.org/t/transfer-float64-matrix-to-double-arg-in-c/1463 "2017-01-13T16:06:12Z")

</div>

I’ve been trying to transfer a Julia matrix of Float64 to a C function that has a “double \*\*arg” but it does not work as intended so help would be appreciated. C function I want to call (simplified body just to get idea…

---

## [Linspace and irrationals with Float32](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 2\
**Last updated:** [January 13, 2017, 3:43pm UTC](https://discourse.julialang.org/t/linspace-and-irrationals-with-float32/1464 "2017-01-13T15:43:57Z")

</div>

The following line throws an error julia\> 2π\*linspace(0.0f0, 1.0f0, 2) ERROR: MethodError: no method matching LinSpace{T\<:AbstractFloat}(::Float64, ::Float64, ::Float32, ::Float32) but this is fine julia\> 2(π\*linspace…

---

## [Include a script from external file in different scopes](https://discourse.julialang.org/t/include-a-script-from-external-file-in-different-scopes/1431)

<div class="topic-metadata">

**Author:** [@ucecmqu](https://discourse.julialang.org/u/ucecmqu)\
**Replies:** 7\
**Last updated:** [January 13, 2017, 2:48pm UTC](https://discourse.julialang.org/t/include-a-script-from-external-file-in-different-scopes/1431 "2017-01-13T14:48:43Z")

</div>

Hello everyone, I am currently working on a script in which the same function “g” has to be evaluated multiple times, also within other functions. 1. a=3 2. function g(y) 3. a\*y 4. end 5. function f(x,y) 6. funct…

---

## [How can I find the reason why docs aren't deployed?](https://discourse.julialang.org/t/how-can-i-find-the-reason-why-docs-arent-deployed/1454)

<div class="topic-metadata">

**Author:** [@bicycle1885](https://discourse.julialang.org/u/bicycle1885)\
**Replies:** 5\
**Last updated:** [January 13, 2017, 2:10pm UTC](https://discourse.julialang.org/t/how-can-i-find-the-reason-why-docs-arent-deployed/1454 "2017-01-13T14:10:53Z")

</div>

Hi, I’m now working on a new package Automa.jl and struggling to deploy docs on GitHub pages using Documenter.jl. I read the manual of Documenter.jl and I believe it was properly configured. However, all TravisCI build …

---

## [Parallel IO](https://discourse.julialang.org/t/parallel-io/1390)

<div class="topic-metadata">

**Author:** [@barche](https://discourse.julialang.org/u/barche)\
**Replies:** 6\
**Last updated:** [January 13, 2017, 8:12am UTC](https://discourse.julialang.org/t/parallel-io/1390 "2017-01-13T08:12:48Z")

</div>

Is there something in place to support parallel IO? I’m currently thinking in the context of MPI, where it is nice to have functionality such as only printing on the first rank or prefixing lines with the process rank. O…

---

## [Allowing python to call the output of cfunction](https://discourse.julialang.org/t/allowing-python-to-call-the-output-of-cfunction/1376)

<div class="topic-metadata">

**Author:** [@JoshLangsfeld](https://discourse.julialang.org/u/JoshLangsfeld)\
**Replies:** 5\
**Last updated:** [January 12, 2017, 8:03pm UTC](https://discourse.julialang.org/t/allowing-python-to-call-the-output-of-cfunction/1376 "2017-01-12T20:03:20Z")

</div>

This is really a PyCall question instead of a pure Julia question but maybe others will find it useful. Basically, I’m interested in the following steps: Define a one-argument Julia function. Obtain a Ptr{Void} to it u…

---

## [Understanding benchmark results](https://discourse.julialang.org/t/understanding-benchmark-results/1375)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 12\
**Last updated:** [January 12, 2017, 5:10pm UTC](https://discourse.julialang.org/t/understanding-benchmark-results/1375 "2017-01-12T17:10:36Z")

</div>

Hello, I was “refactoring” my code by re-ordering the data and did some benchmarking to make sure I wasn’t doing too much harm to the speed of the code. I have some “conflicting” results. Short story for the refactoring…

---

## [Map to generator](https://discourse.julialang.org/t/map-to-generator/1411)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [January 12, 2017, 4:46am UTC](https://discourse.julialang.org/t/map-to-generator/1411 "2017-01-12T04:46:10Z")

</div>

I find generators useful when I want to avoid intermediate results. However, when the transformation is already wrapped in a function, (f(x) for x in xs) feels redundant. Is there a “standard” way to use a function lik…

---

## [Callback to WinAPI](https://discourse.julialang.org/t/callback-to-winapi/1381)

<div class="topic-metadata">

**Author:** [@phlavenk](https://discourse.julialang.org/u/phlavenk)\
**Replies:** 5\
**Last updated:** [January 11, 2017, 11:03am UTC](https://discourse.julialang.org/t/callback-to-winapi/1381 "2017-01-11T11:03:46Z")

</div>

Hi, I’m trying to rewrite the following code from https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/ from Python to Julia import ctypes EnumWindows = ctypes.windll.user32.EnumWindows …

---

## [Recovering parameter type from parameter list](https://discourse.julialang.org/t/recovering-parameter-type-from-parameter-list/1343)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 15\
**Last updated:** [January 11, 2017, 7:14am UTC](https://discourse.julialang.org/t/recovering-parameter-type-from-parameter-list/1343 "2017-01-11T07:14:52Z")

</div>

Suppose I want to be generic as follows: # concepts abstract AbstractFoo{N,T} abstract AbstractContainer{F} # partial specialization where we fix T = Float64 immutable Foo{N} \<: AbstractFoo{N,Float64} end # a containe…

---

## [In-place matrix multiplication compatible with 0.5 and 0.6](https://discourse.julialang.org/t/in-place-matrix-multiplication-compatible-with-0-5-and-0-6/1403)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 3\
**Last updated:** [January 10, 2017, 7:53pm UTC](https://discourse.julialang.org/t/in-place-matrix-multiplication-compatible-with-0-5-and-0-6/1403 "2017-01-10T19:53:25Z")

</div>

I want to perform in-place matrix multiplications where the matrices can be sparse or dense. As a simple case, consider evaluating residuals from a regression model resid .= y - X\*β where resid is a pre-allocated dens…

---

## [Error loading module on remote workers](https://discourse.julialang.org/t/error-loading-module-on-remote-workers/1049)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 9\
**Last updated:** [January 10, 2017, 6:56pm UTC](https://discourse.julialang.org/t/error-loading-module-on-remote-workers/1049 "2017-01-10T18:56:31Z")

</div>

I’m trying to upgrade from Julia v0.4 to v0.5. On v0.4 I just added remote workers and then typed using Module to make Module available on all workers I have a clean install of Julia 0.5 on remote machine, no packages …

---

## [Efficiency and limits of varargs and "..."](https://discourse.julialang.org/t/efficiency-and-limits-of-varargs-and/1393)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [January 10, 2017, 4:01pm UTC](https://discourse.julialang.org/t/efficiency-and-limits-of-varargs-and/1393 "2017-01-10T16:01:26Z")

</div>

I am getting into the habit of writing functions that take varargs, eg foo(xs...) = reduce(some\_op, map(some\_function, xs)) and then either calling them as foo(1,2) for a small number of arguments, or foo(some\_vector..…

---

## [\`subtypes\` of concrete type](https://discourse.julialang.org/t/subtypes-of-concrete-type/1389)

<div class="topic-metadata">

**Author:** [@ZacLN](https://discourse.julialang.org/u/ZacLN)\
**Replies:** 2\
**Last updated:** [January 10, 2017, 1:15pm UTC](https://discourse.julialang.org/t/subtypes-of-concrete-type/1389 "2017-01-10T13:15:59Z")

</div>

I have an example that calls Docs.doc across all of Base/Core and it ends up spending ~90% of it’s time with expensive calls to subtypes. Is there a particular reason why subtypes attempts to find subtypes of concrete…

---

## [PkgDev.submit: curl error](https://discourse.julialang.org/t/pkgdev-submit-curl-error/1386)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 1\
**Last updated:** [January 10, 2017, 12:52pm UTC](https://discourse.julialang.org/t/pkgdev-submit-curl-error/1386 "2017-01-10T12:52:32Z")

</div>

I am trying to use PkgDev.submit to submit a PR from Windows 7 (following the instructions at http://docs.julialang.org/en/latest/manual/packages.html#Making-changes-to-an-existing-package-1) and I get the following erro…

---

## [How to specify no quotes around strings in writedlm()](https://discourse.julialang.org/t/how-to-specify-no-quotes-around-strings-in-writedlm/1380)

<div class="topic-metadata">

**Author:** [@ekbrown](https://discourse.julialang.org/u/ekbrown)\
**Replies:** 2\
**Last updated:** [January 10, 2017, 6:31am UTC](https://discourse.julialang.org/t/how-to-specify-no-quotes-around-strings-in-writedlm/1380 "2017-01-10T06:31:22Z")

</div>

I’m new to Julia and am trying to write an array to a .csv file on the hard drive so that the strings are not quoted. I don’t see that there is an argument in writedlm() to specify this. Here is the Python code that I’m …

---

## [Redirecting stderr on windows](https://discourse.julialang.org/t/redirecting-stderr-on-windows/1299)

<div class="topic-metadata">

**Author:** [@phlavenk](https://discourse.julialang.org/u/phlavenk)\
**Replies:** 3\
**Last updated:** [January 9, 2017, 6:33pm UTC](https://discourse.julialang.org/t/redirecting-stderr-on-windows/1299 "2017-01-09T18:33:15Z")

</div>

I need to capture stdout and stderr of a win32 program i execute (either using open or spawn). I’ve followed the recomendation in #11824 and tried following: julia\> function popen3(cmd::Cmd) in = Pipe() …

---

## [Parametric type with parametric type field](https://discourse.julialang.org/t/parametric-type-with-parametric-type-field/1321)

<div class="topic-metadata">

**Author:** [@pearcemc](https://discourse.julialang.org/u/pearcemc)\
**Replies:** 2\
**Last updated:** [January 9, 2017, 2:31pm UTC](https://discourse.julialang.org/t/parametric-type-with-parametric-type-field/1321 "2017-01-09T14:31:54Z")

</div>

Suppose I want to define a type like: abstract AbstractSubThing{T} type SubThing{T} \<: AbstractSubThing item::T end # the trouble type WrapThing{Tx, Ty\<:AbstractSubThing{Tx}} sub::Ty outer::Tx end #ERROR: Un…

---

## [How to return a response with custom headers in Mux.jl?](https://discourse.julialang.org/t/how-to-return-a-response-with-custom-headers-in-mux-jl/1361)

<div class="topic-metadata">

**Author:** [@amellnik](https://discourse.julialang.org/u/amellnik)\
**Replies:** 1\
**Last updated:** [January 9, 2017, 12:50am UTC](https://discourse.julialang.org/t/how-to-return-a-response-with-custom-headers-in-mux-jl/1361 "2017-01-09T00:50:35Z")

</div>

Has anyone been able to get this working? I can do it with HttpServer, but I can’t figure out how to return them in Mux. For example @app test = ( Mux.defaults, page("/test", req -\> Dict("body"=\>"meh")), M…

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

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