# General Usage

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

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

**Page:** 1068

---

## [Troubleshooting libgit2](https://discourse.julialang.org/t/troubleshooting-libgit2/1542)

<div class="topic-metadata">

**Author:** [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Replies:** 5\
**Last updated:** [January 26, 2017, 3:19pm UTC](https://discourse.julialang.org/t/troubleshooting-libgit2/1542 "2017-01-26T15:19:12Z")

</div>

I am trying to troubleshoot libgit2 failing behind a proxy (see Pkg.add() through proxy fails on Julia 0.5, Windows). I am looking through the libgit2 functions (https://github.com/JuliaLang/julia/tree/master/base/libgi…

---

## [Readlines() in v 0.5 and 0.6](https://discourse.julialang.org/t/readlines-in-v-0-5-and-0-6/1699)

<div class="topic-metadata">

**Author:** [@Colin\_Beckingham](https://discourse.julialang.org/u/Colin_Beckingham)\
**Replies:** 2\
**Last updated:** [January 26, 2017, 2:21pm UTC](https://discourse.julialang.org/t/readlines-in-v-0-5-and-0-6/1699 "2017-01-26T14:21:50Z")

</div>

If I use readlines(\\ls\`)\` in v 0.5 (precompiled binary) there is no problem, however in v 0.6 (Version 0.6.0-dev.2375) I get \> readlines(\`ls\`) ERROR: MethodError: no method matching readlines(::Cmd) Closest candidates a…

---

## [Mutating with \`foldl\` undefined behaviour?](https://discourse.julialang.org/t/mutating-with-foldl-undefined-behaviour/1659)

<div class="topic-metadata">

**Author:** [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Replies:** 4\
**Last updated:** [January 26, 2017, 12:10am UTC](https://discourse.julialang.org/t/mutating-with-foldl-undefined-behaviour/1659 "2017-01-26T00:10:38Z")

</div>

help?\> foldl search: foldl mapfoldl foldr mapfoldr foldl(op, v0, itr) Like reduce, but with guaranteed left associativity. v0 will be used exactly once. Is it undefined behaviour for op to mutate one (or both) o…

---

## [Missing method isless(::String, ::Nullable{String})?](https://discourse.julialang.org/t/missing-method-isless-string-nullable-string/1692)

<div class="topic-metadata">

**Author:** [@aus](https://discourse.julialang.org/u/aus)\
**Replies:** 0\
**Last updated:** [January 25, 2017, 10:52pm UTC](https://discourse.julialang.org/t/missing-method-isless-string-nullable-string/1692 "2017-01-25T22:52:18Z")

</div>

While learning DataFrames.jl I experienced an issue with one of the examples I found in the documentation: using DataFrames, Query df = DataFrame(name=\["John", "Sally", "Roger"\], age=\[54., 34., 79.\], children=\[0, 2, 4\]…

---

## [Mktempdir() on AppVeyor on Windows](https://discourse.julialang.org/t/mktempdir-on-appveyor-on-windows/1662)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 7\
**Last updated:** [January 25, 2017, 5:48pm UTC](https://discourse.julialang.org/t/mktempdir-on-appveyor-on-windows/1662 "2017-01-25T17:48:51Z")

</div>

I decided to try and get my code running on Windows… On Appveyor, the following code: mktempdir() do tmpdir cd(tmpdir) info("running tests in: $(pwd())") run\_all\_tests() end appears to fail at the end, wit…

---

## [Comparison parsing AST](https://discourse.julialang.org/t/comparison-parsing-ast/1672)

<div class="topic-metadata">

**Author:** [@ZacLN](https://discourse.julialang.org/u/ZacLN)\
**Replies:** 5\
**Last updated:** [January 25, 2017, 3:58pm UTC](https://discourse.julialang.org/t/comparison-parsing-ast/1672 "2017-01-25T15:58:45Z")

</div>

Is there any reason for the two AST forms for comparisons? Expr(:call,:\<, :a, :b) and Expr(:comparison, :a, :\<, :b)both seem to generate the same code though the latter form only get’s generated in expressions with mult…

---

## [Test summary in julia 0.6](https://discourse.julialang.org/t/test-summary-in-julia-0-6/1461)

<div class="topic-metadata">

**Author:** [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Replies:** 3\
**Last updated:** [January 25, 2017, 8:43am UTC](https://discourse.julialang.org/t/test-summary-in-julia-0-6/1461 "2017-01-25T08:43:08Z")

</div>

I am trying to implement test code example from this page: http://docs.julialang.org/en/latest/stdlib/test.html julia\> using Base.Test julia\> foo(x) = length(x)^2 foo (generic function with 1 method) julia\> @testset "…

---

## [BigFloats parametrised by precision](https://discourse.julialang.org/t/bigfloats-parametrised-by-precision/1663)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 6\
**Last updated:** [January 25, 2017, 4:12am UTC](https://discourse.julialang.org/t/bigfloats-parametrised-by-precision/1663 "2017-01-25T04:12:20Z")

</div>

I vaguely remember that there have been several discussions about parametrising BigFloats according to their precision, and I think I recall that someone already has a package that does this. Could someone please point …

---

## [\`similar\` for Dict](https://discourse.julialang.org/t/similar-for-dict/1658)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 1\
**Last updated:** [January 24, 2017, 12:06pm UTC](https://discourse.julialang.org/t/similar-for-dict/1658 "2017-01-24T12:06:26Z")

</div>

similar for Dict does not seem to be documented in the manual, but it is defined in https://github.com/JuliaLang/julia/blob/master/base/dict.jl#L192. Should the manual be amended?

---

## [Use of \_default\_eltype](https://discourse.julialang.org/t/use-of--default-eltype/1624)

<div class="topic-metadata">

**Author:** [@FANG\_Colin](https://discourse.julialang.org/u/FANG_Colin)\
**Replies:** 3\
**Last updated:** [January 23, 2017, 5:11pm UTC](https://discourse.julialang.org/t/use-of--default-eltype/1624 "2017-01-23T17:11:13Z")

</div>

I have seen code in set, collect make use of \_default\_eltype(typeof(g)) which basically calls Core.Inference.... I don’t know Julia internal very well. My understanding is that Core.Inference is solely for compilation. …

---

## [Rsync'ing .julia/v0.5](https://discourse.julialang.org/t/rsyncing-julia-v0-5/1429)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [January 23, 2017, 4:33pm UTC](https://discourse.julialang.org/t/rsyncing-julia-v0-5/1429 "2017-01-23T16:33:03Z")

</div>

I develop and test code on my laptop, but use a server for computationally intensive numerical calculations. I was wondering if there would be any harm in rsyncing ~/.julia/v0.5 folders between the server and my laptop …

---

## [Symbol lookup error with non-standard location](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633)

<div class="topic-metadata">

**Author:** [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Replies:** 2\
**Last updated:** [January 23, 2017, 4:18am UTC](https://discourse.julialang.org/t/symbol-lookup-error-with-non-standard-location/1633 "2017-01-23T04:18:51Z")

</div>

I’m running into a problem using an extension module. I’ve installed julia using spack, which results in not using ~/.julia for packages (not sure if that’s relevant). In a travis build (and other, more standard instal…

---

## [Seeking more extensive docs on module/using/import](https://discourse.julialang.org/t/seeking-more-extensive-docs-on-module-using-import/1639)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 3\
**Last updated:** [January 22, 2017, 7:30pm UTC](https://discourse.julialang.org/t/seeking-more-extensive-docs-on-module-using-import/1639 "2017-01-22T19:30:07Z")

</div>

Suppose I have a module U of utility routines that are used by module A, which has my application. These are in files called u.jl and a.jl respectively. How do I include the utility routines in the application? It see…

---

## [Alternative to Base.summarysize?](https://discourse.julialang.org/t/alternative-to-base-summarysize/1635)

<div class="topic-metadata">

**Author:** [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Replies:** 1\
**Last updated:** [January 22, 2017, 4:35pm UTC](https://discourse.julialang.org/t/alternative-to-base-summarysize/1635 "2017-01-22T16:35:08Z")

</div>

I was wondering if there were any alternative to Base.summarysize, for trying to show the memory cost of an object. It looks like it is based on sizeof, instead of returning the actual amount of memory allocated for tha…

---

## [Which package changes the streaming to the plot (dynamically)?](https://discourse.julialang.org/t/which-package-changes-the-streaming-to-the-plot-dynamically/1590)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [January 22, 2017, 3:01pm UTC](https://discourse.julialang.org/t/which-package-changes-the-streaming-to-the-plot-dynamically/1590 "2017-01-22T15:01:21Z")

</div>

Which package changes the streaming to the plot (dynamically)? is it possibile ? paul

---

## [ERROR: LoadError: syntax: missing separator in array expression](https://discourse.julialang.org/t/error-loaderror-syntax-missing-separator-in-array-expression/1616)

<div class="topic-metadata">

**Author:** [@andrea](https://discourse.julialang.org/u/andrea)\
**Replies:** 2\
**Last updated:** [January 21, 2017, 8:39pm UTC](https://discourse.julialang.org/t/error-loaderror-syntax-missing-separator-in-array-expression/1616 "2017-01-21T20:39:23Z")

</div>

I’m pretty new in Julia: I’ve to integrate some MatLab code…I found an automatic ttranslator from MatLab to Julia. after the translation I got that error…on this line of code… fprintf(f\_initial,"#g ",x\[:,1)\] where x wa…

---

## [Environment for teaching](https://discourse.julialang.org/t/environment-for-teaching/1628)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 9\
**Last updated:** [January 21, 2017, 7:40pm UTC](https://discourse.julialang.org/t/environment-for-teaching/1628 "2017-01-21T19:40:23Z")

</div>

I will be teaching a course on numerical methods in dynamic programming, starting mid-February, for which I plan to use Julia. I am wondering what the most mature and hassle-free environment is for having an integrated…

---

## [How to write to file Array Any lika 1 row?](https://discourse.julialang.org/t/how-to-write-to-file-array-any-lika-1-row/1618)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 2\
**Last updated:** [January 21, 2017, 7:15pm UTC](https://discourse.julialang.org/t/how-to-write-to-file-array-any-lika-1-row/1618 "2017-01-21T19:15:11Z")

</div>

How to write to file Array Any lika 1 row without any null etc… jus body like one row julia\> f = open(“tmp/tmp.txt”, “w”) IOStream(\<file tmp/tmp.txt\>) julia\> write(f, temp\_rekord) 133 julia\> close(f) julia\> temp\_re…

---

## [Partial trace of multidimensional arrays](https://discourse.julialang.org/t/partial-trace-of-multidimensional-arrays/1614)

<div class="topic-metadata">

**Author:** [@bastikr](https://discourse.julialang.org/u/bastikr)\
**Replies:** 6\
**Last updated:** [January 21, 2017, 7:09pm UTC](https://discourse.julialang.org/t/partial-trace-of-multidimensional-arrays/1614 "2017-01-21T19:09:12Z")

</div>

I’m trying to improve the implementation of partial traces in QuantumOptics.jl that I’ve written some time ago. At that time Base.Cartesian was the recommended approach. However, it seems that now one could use iteration…

---

## [Finalizer and atexit for C library wrappers](https://discourse.julialang.org/t/finalizer-and-atexit-for-c-library-wrappers/772)

<div class="topic-metadata">

**Author:** [@friedmud](https://discourse.julialang.org/u/friedmud)\
**Replies:** 4\
**Last updated:** [January 21, 2017, 1:17am UTC](https://discourse.julialang.org/t/finalizer-and-atexit-for-c-library-wrappers/772 "2017-01-21T01:17:19Z")

</div>

I have created a module that wraps a large C library. I need to use object finalizers to run teardown functions from the C library for each Julia object I create that’s holding onto structs from the C library. I additi…

---

## [Want a field signature more specific than 'Function'](https://discourse.julialang.org/t/want-a-field-signature-more-specific-than-function/1562)

<div class="topic-metadata">

**Author:** [@IGBI](https://discourse.julialang.org/u/IGBI)\
**Replies:** 7\
**Last updated:** [January 21, 2017, 12:51am UTC](https://discourse.julialang.org/t/want-a-field-signature-more-specific-than-function/1562 "2017-01-21T00:51:38Z")

</div>

I have some predicate types that have a predicate field. I want my fields to be of type (t::T -\> Bool). Instead they’re of type Function. It all looks like this: abstract Foo{T} type unP{T} \<: Foo{T} p::Function en…

---

## [Persistent hash of julia object](https://discourse.julialang.org/t/persistent-hash-of-julia-object/1513)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 12\
**Last updated:** [January 20, 2017, 10:55pm UTC](https://discourse.julialang.org/t/persistent-hash-of-julia-object/1513 "2017-01-20T22:55:42Z")

</div>

I have julia objects and want to hash them such that: If two objects are equal, then their hashes are equal. The other way round is also true with overwhelming probability. The hash should not change across sessions. E…

---

## [Is there a way to "choose the indices" for broadcasting?](https://discourse.julialang.org/t/is-there-a-way-to-choose-the-indices-for-broadcasting/1317)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 4\
**Last updated:** [January 20, 2017, 10:06pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-choose-the-indices-for-broadcasting/1317 "2017-01-20T22:06:14Z")

</div>

As always, examples are best. With a loop I can do: for i in 1:3:12 tmp\[i\] = a\[i\]\*b\[i\] end Is there a way to make tmp .= a.\*b only update specific chosen indices? And as a slight extension, what about having tmp be…

---

## [Unexpected behavior defining a function on one line with semi-colons](https://discourse.julialang.org/t/unexpected-behavior-defining-a-function-on-one-line-with-semi-colons/1588)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 14\
**Last updated:** [January 20, 2017, 8:17pm UTC](https://discourse.julialang.org/t/unexpected-behavior-defining-a-function-on-one-line-with-semi-colons/1588 "2017-01-20T20:17:43Z")

</div>

EDIT: I was trying to confirm Taylor’s “barbaric” what would (or wouldn’t) happen similar to here; ran into other unexpected: julia\> f(x) = a=x; a=1; a="P"; # Why not last expression returned? julia\> f(2) 2 julia\> f…

---

## [Is there a simple way if a DataFrame (say empty as in just allocated) supports DataArray or NullableArray?](https://discourse.julialang.org/t/is-there-a-simple-way-if-a-dataframe-say-empty-as-in-just-allocated-supports-dataarray-or-nullablearray/1605)

<div class="topic-metadata">

**Author:** [@mwsohn](https://discourse.julialang.org/u/mwsohn)\
**Replies:** 2\
**Last updated:** [January 20, 2017, 2:40pm UTC](https://discourse.julialang.org/t/is-there-a-simple-way-if-a-dataframe-say-empty-as-in-just-allocated-supports-dataarray-or-nullablearray/1605 "2017-01-20T14:40:57Z")

</div>

The title says it all.

---

## [Narrowing types on a Dict](https://discourse.julialang.org/t/narrowing-types-on-a-dict/1608)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [January 20, 2017, 11:01am UTC](https://discourse.julialang.org/t/narrowing-types-on-a-dict/1608 "2017-01-20T11:01:10Z")

</div>

Suppose I am accumulating key-value pairs of a previously unknown type in a Dict{Any,Any} within a function. But before I return the result, I would like to narrow the type parameters as much as possible. Is there some …

---

## [XML parsing with Requests + LibExpat ... OS-dependent?](https://discourse.julialang.org/t/xml-parsing-with-requests-libexpat-os-dependent/1600)

<div class="topic-metadata">

**Author:** [@joshua\_jones](https://discourse.julialang.org/u/joshua_jones)\
**Replies:** 11\
**Last updated:** [January 20, 2017, 10:48am UTC](https://discourse.julialang.org/t/xml-parsing-with-requests-libexpat-os-dependent/1600 "2017-01-20T10:48:40Z")

</div>

Seems like LibExpat or Requests has some kind of OS-dependent behavior that’s utterly breaking my XML parsing. An example follows; works in Windows, pukes in Linux. Could someone please tell me what can be done to parse …

---

## [Multiplication broken upon upgrade to Julia 0.5.0](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604)

<div class="topic-metadata">

**Author:** [@Stephen\_Peele](https://discourse.julialang.org/u/Stephen_Peele)\
**Replies:** 8\
**Last updated:** [January 20, 2017, 10:30am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604 "2017-01-20T10:30:38Z")

</div>

Hello. I have a script that contains the following line: A\[k+1:n,k+1:n\] -= A\[k+1:n,k\] \* A\[k,k+1:n\] where k and n are integers and the values in the two-dimensional array are floats. Previously, in Julia 0.4.6, this wa…

---

## [Evaluate function of several variables on cartesian product?](https://discourse.julialang.org/t/evaluate-function-of-several-variables-on-cartesian-product/1572)

<div class="topic-metadata">

**Author:** [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Replies:** 4\
**Last updated:** [January 20, 2017, 10:23am UTC](https://discourse.julialang.org/t/evaluate-function-of-several-variables-on-cartesian-product/1572 "2017-01-20T10:23:44Z")

</div>

The title is not very good but what I want to is the following: H(x-\>f(x),x) #returns a vector H((x,y)-\>f(x,y),x,y) #returns a matrix of dimension (length(x),length(y)) H((x,y,z)-\>f(x,y,z),x,y,z) #returns a 3D matrix o…

---

## [Suprising assignment behavior](https://discourse.julialang.org/t/suprising-assignment-behavior/1591)

<div class="topic-metadata">

**Author:** [@s-broda](https://discourse.julialang.org/u/s-broda)\
**Replies:** 8\
**Last updated:** [January 20, 2017, 10:06am UTC](https://discourse.julialang.org/t/suprising-assignment-behavior/1591 "2017-01-20T10:06:13Z")

</div>

This is confusing (on 0.5.0): imagine calling a function that returns 2 values in a loop: julia\> f()=1,2 f (generic function with 1 method) julia\> a,b=f() (1,2) julia\> a 1 julia\> b 2 julia\> u=v=zeros(2,1);i=1; julia\>…

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

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