# General Usage

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

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

**Page:** 967

---

## [Formatting Logging](https://discourse.julialang.org/t/formatting-logging/12093)

<div class="topic-metadata">

**Author:** [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)\
**Replies:** 1\
**Last updated:** [July 2, 2018, 12:53am UTC](https://discourse.julialang.org/t/formatting-logging/12093 "2018-07-02T00:53:15Z")

</div>

I was using printfmtln from Formatting.jl. Now I want to change my code to use MicroLogging.jl. Is there a neat way to do it? I need something like this printfmtln("{:2d}) Loss={:.6f} |β|={:.2f}", iter, loss(β), sum(ab…

---

## [Why isn't pmap faster than map in this example?](https://discourse.julialang.org/t/why-isnt-pmap-faster-than-map-in-this-example/12091)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 8\
**Last updated:** [July 1, 2018, 7:36pm UTC](https://discourse.julialang.org/t/why-isnt-pmap-faster-than-map-in-this-example/12091 "2018-07-01T19:36:51Z")

</div>

I have a function that computes the mean of each column of a matrix 100 times. However, the serial version is as fast as the parallel version on my machine (3.5 GHz Intel Core i5 with 4 cores) addprocs(3) @everywhere fu…

---

## [Support for 3D convolutional neural networks in Mocha](https://discourse.julialang.org/t/support-for-3d-convolutional-neural-networks-in-mocha/12062)

<div class="topic-metadata">

**Author:** [@pegger0709](https://discourse.julialang.org/u/pegger0709)\
**Replies:** 1\
**Last updated:** [July 1, 2018, 2:29am UTC](https://discourse.julialang.org/t/support-for-3d-convolutional-neural-networks-in-mocha/12062 "2018-07-01T02:29:08Z")

</div>

Hi everyone, I was looking for a package that made machine learning easy and when I stumbled upon Mocha, it looked so great I forgot to check to make sure it could do 3D convolutional nets as well (I’m analyzing MRI dat…

---

## [wait(::Task) deprecated in 0.7?](https://discourse.julialang.org/t/wait-task-deprecated-in-0-7/12083)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 2\
**Last updated:** [June 30, 2018, 8:56pm UTC](https://discourse.julialang.org/t/wait-task-deprecated-in-0-7/12083 "2018-06-30T20:56:34Z")

</div>

I found this on the build log for StringEncodings.jl. ┌ Warning: \`wait(t::Task)\` is deprecated, use \`fetch(t)\` instead. │ caller = wait(::OutputCollector) at OutputCollector.jl:158 └ @ BinaryProvider OutputCollector.j…

---

## [Question about Multi-threading Performance](https://discourse.julialang.org/t/question-about-multi-threading-performance/12075)

<div class="topic-metadata">

**Author:** [@Juser](https://discourse.julialang.org/u/Juser)\
**Replies:** 3\
**Last updated:** [June 30, 2018, 2:45pm UTC](https://discourse.julialang.org/t/question-about-multi-threading-performance/12075 "2018-06-30T14:45:01Z")

</div>

I was testing out some simple multithreaded code and noticed that in some instances the multithreaded version performs much more poorly than the single-threaded version. I’ve posted a minimum working example below. Does …

---

## [Maintaining iterator protocol for both 0.6 and 0.7](https://discourse.julialang.org/t/maintaining-iterator-protocol-for-both-0-6-and-0-7/12084)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 3\
**Last updated:** [June 30, 2018, 7:02pm UTC](https://discourse.julialang.org/t/maintaining-iterator-protocol-for-both-0-6-and-0-7/12084 "2018-06-30T19:02:05Z")

</div>

What’s the best way to make the code work under both 0.6 and 0.7 given the new iterator protocol? Should I just wrap the code around with something like if VERSION \< "0.7"? I used to have this: Base.start(d::CIDict) =…

---

## [Looping over different types with common behavior](https://discourse.julialang.org/t/looping-over-different-types-with-common-behavior/12068)

<div class="topic-metadata">

**Author:** [@IssamT](https://discourse.julialang.org/u/IssamT)\
**Replies:** 9\
**Last updated:** [June 30, 2018, 4:14pm UTC](https://discourse.julialang.org/t/looping-over-different-types-with-common-behavior/12068 "2018-06-30T16:14:28Z")

</div>

I consider two methods presented in the example below. As expected, the second one is better since it uses only concrete types. ABSTRACT COLLECTION 34.190 ms (999490 allocations: 15.25 MiB) CONCRETE COLLECTION 1.307…

---

## [Invalid ELF header (0.7.0 Beta built from source)](https://discourse.julialang.org/t/invalid-elf-header-0-7-0-beta-built-from-source/12054)

<div class="topic-metadata">

**Author:** [@Liso](https://discourse.julialang.org/u/Liso)\
**Replies:** 5\
**Last updated:** [June 30, 2018, 9:49am UTC](https://discourse.julialang.org/t/invalid-elf-header-0-7-0-beta-built-from-source/12054 "2018-06-30T09:49:52Z")

</div>

I get error when using ccall in 0.7.0 built from source: 0.7.0-beta.65\> ccall((:clock, "libc"), Int32, ()) ERROR: error compiling top-level scope: could not load library "libc" /usr/lib/x86\_64-linux-gnu/libc.so: invalid…

---

## [Lego Plot how to?](https://discourse.julialang.org/t/lego-plot-how-to/12055)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 4\
**Last updated:** [June 29, 2018, 8:48pm UTC](https://discourse.julialang.org/t/lego-plot-how-to/12055 "2018-06-29T20:48:10Z")

</div>

How to produce a lego plot (e.g. a histogram with 2d bins) in julia? See here for example plots.

---

## [Upper limit for size of static array](https://discourse.julialang.org/t/upper-limit-for-size-of-static-array/12069)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 2\
**Last updated:** [June 29, 2018, 3:43pm UTC](https://discourse.julialang.org/t/upper-limit-for-size-of-static-array/12069 "2018-06-29T15:43:35Z")

</div>

Hello, I tried to allocate large static arrays but failed as shown below. Is there a way to find out the upper limits? I couldn’t find related information around. julia\> using StaticArrays julia\> @SMatrix zeros(16, 16)…

---

## [Quoting symbols in a local scope](https://discourse.julialang.org/t/quoting-symbols-in-a-local-scope/12060)

<div class="topic-metadata">

**Author:** [@anon32405968](https://discourse.julialang.org/u/anon32405968)\
**Replies:** 1\
**Last updated:** [June 29, 2018, 1:10pm UTC](https://discourse.julialang.org/t/quoting-symbols-in-a-local-scope/12060 "2018-06-29T13:10:35Z")

</div>

How do symbols work in a local scope when quoted in a QuoteNode/Meta.quot/Expr(:quote), e.g. a for loop? This is a follow-up to my previous question. I want to add something to the docs that fills in the gaps I discovere…

---

## [Parallel computing on a subset of an array](https://discourse.julialang.org/t/parallel-computing-on-a-subset-of-an-array/11881)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 12\
**Last updated:** [June 29, 2018, 12:50pm UTC](https://discourse.julialang.org/t/parallel-computing-on-a-subset-of-an-array/11881 "2018-06-29T12:50:15Z")

</div>

Hello! I’m trying to do some parallel computation on the 2 first dimensions of a 3D array A\[j,k, t\]. To put things in context, the data are timeseries, where j and k are spatial grid points and t is the time dimension. …

---

## [What should I do to display all contents in Julia?](https://discourse.julialang.org/t/what-should-i-do-to-display-all-contents-in-julia/12042)

<div class="topic-metadata">

**Author:** [@dai](https://discourse.julialang.org/u/dai)\
**Replies:** 6\
**Last updated:** [June 29, 2018, 12:49pm UTC](https://discourse.julialang.org/t/what-should-i-do-to-display-all-contents-in-julia/12042 "2018-06-29T12:49:47Z")

</div>

Hello Everyone, Is there a command like “More on/off” in MATLAB. I use REPL console under Julia-cliant0.6.13 in Atom. When we refer contents of long variable, for simple example, x = rand(30,1) makes 30 x 1 array. I…

---

## [Comparison of Same Irrationals by \`\< , \> , \<=, \>=\` Throws Error](https://discourse.julialang.org/t/comparison-of-same-irrationals-by-throws-error/1342)

<div class="topic-metadata">

**Author:** [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Replies:** 6\
**Last updated:** [June 29, 2018, 12:01pm UTC](https://discourse.julialang.org/t/comparison-of-same-irrationals-by-throws-error/1342 "2018-06-29T12:01:14Z")

</div>

In julia 0.5, irrationals cannot be compared by itself other than equality. I think for completeness an irrational compared with itself with those methods should be defined. Is there any reason not to? Sample results in …

---

## [Performance discrepancy in sparse matrix product](https://discourse.julialang.org/t/performance-discrepancy-in-sparse-matrix-product/12048)

<div class="topic-metadata">

**Author:** [@Sean\_McBane](https://discourse.julialang.org/u/Sean_McBane)\
**Replies:** 4\
**Last updated:** [June 29, 2018, 9:37am UTC](https://discourse.julialang.org/t/performance-discrepancy-in-sparse-matrix-product/12048 "2018-06-29T09:37:26Z")

</div>

Hi all, I noticed the following performance discrepancy: julia\> using BenchmarkTools julia\> const A = sprand(500, 500, 0.01); julia\> const B = sprand(500, 500, 0.01); julia\> const C = full(A\*B); julia\> @benchmark A\*…

---

## [Return type of function created from eval cannot be inferred?](https://discourse.julialang.org/t/return-type-of-function-created-from-eval-cannot-be-inferred/12057)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 1\
**Last updated:** [June 29, 2018, 9:00am UTC](https://discourse.julialang.org/t/return-type-of-function-created-from-eval-cannot-be-inferred/12057 "2018-06-29T09:00:32Z")

</div>

I created two function by eval. dHx = eval(parse("n-\>zeros(Float64, n)")) dHy = eval(parse("n-\>ones(Float64, n)")) function dH(n, ind) if ind == 1 return dHx(n) else return dHy(n) end end It…

---

## [Is Dates.UTInstant UT1, UT2, or UTC?](https://discourse.julialang.org/t/is-dates-utinstant-ut1-ut2-or-utc/12051)

<div class="topic-metadata">

**Author:** [@janssen](https://discourse.julialang.org/u/janssen)\
**Replies:** 4\
**Last updated:** [June 29, 2018, 6:05am UTC](https://discourse.julialang.org/t/is-dates-utinstant-ut1-ut2-or-utc/12051 "2018-06-29T06:05:19Z")

</div>

The doctoring for Base.Dates.UTInstant simply says “based on UT time”. Anyone know what version of UT time is being used? Commonly on computers UTC or UT1.

---

## [What is wrong with my subtyping?](https://discourse.julialang.org/t/what-is-wrong-with-my-subtyping/12049)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [June 29, 2018, 12:12am UTC](https://discourse.julialang.org/t/what-is-wrong-with-my-subtyping/12049 "2018-06-29T00:12:40Z")

</div>

julia\> abstract type Code{T\<:Tuple} end julia\> abstract type Data{T\<:Code} \<: Code end ERROR: invalid subtyping in definition of Data Thanks

---

## [Llvmcall with immediate values](https://discourse.julialang.org/t/llvmcall-with-immediate-values/12044)

<div class="topic-metadata">

**Author:** [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Replies:** 2\
**Last updated:** [June 28, 2018, 9:01pm UTC](https://discourse.julialang.org/t/llvmcall-with-immediate-values/12044 "2018-06-28T21:01:50Z")

</div>

I wanted to use some llvm instructions that require immediate values. Example: using Base: llvmcall const \_u128 = NTuple{2, Base.VecElement{UInt64}} u128(x,y)=(convert(Base.VecElement{UInt64},x),convert(Base.VecElement{…

---

## [How to display Float64 with many digits in Julia 0.7](https://discourse.julialang.org/t/how-to-display-float64-with-many-digits-in-julia-0-7/12034)

<div class="topic-metadata">

**Author:** [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Replies:** 7\
**Last updated:** [June 28, 2018, 7:14pm UTC](https://discourse.julialang.org/t/how-to-display-float64-with-many-digits-in-julia-0-7/12034 "2018-06-28T19:14:52Z")

</div>

This question was posed and answered for Julia 0.6 here. In Julia 0.7, the same code does not solve the problem: julia\> VERSION v"0.7.0-beta.65" julia\> v = rand(3) 3-element Array{Float64,1}: 0.06063439006332505 0.3…

---

## [Distpatch on keyword arguments](https://discourse.julialang.org/t/distpatch-on-keyword-arguments/10581)

<div class="topic-metadata">

**Author:** [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Replies:** 3\
**Last updated:** [June 28, 2018, 4:50pm UTC](https://discourse.julialang.org/t/distpatch-on-keyword-arguments/10581 "2018-06-28T16:50:59Z")

</div>

Wouldn’t be possible to dispatch also on the keyword arguments? I mean julia\> foo(;x::Int = 0) = "Hello from Int x = $x kwarg" julia\> foo(;x::Float64 = 0.0) = "Hello from Float64 x = $x kwarg" AFAIK, this would not b…

---

## [Struggling to understand this Symbol behaviour - Scope determines error presence?](https://discourse.julialang.org/t/struggling-to-understand-this-symbol-behaviour-scope-determines-error-presence/11891)

<div class="topic-metadata">

**Author:** [@anon32405968](https://discourse.julialang.org/u/anon32405968)\
**Replies:** 13\
**Last updated:** [June 28, 2018, 3:55pm UTC](https://discourse.julialang.org/t/struggling-to-understand-this-symbol-behaviour-scope-determines-error-presence/11891 "2018-06-28T15:55:27Z")

</div>

Hi Julians, The question relates to Symbols and metaprogramming, been through the docs many times but still getting my head around it. I’ve been struggling to pinpoint a bug in my code for the last 2 days and at last I…

---

## [Why would I ever use deepcopy?](https://discourse.julialang.org/t/why-would-i-ever-use-deepcopy/12037)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 5\
**Last updated:** [June 28, 2018, 3:16pm UTC](https://discourse.julialang.org/t/why-would-i-ever-use-deepcopy/12037 "2018-06-28T15:16:42Z")

</div>

deepcopy is generally slower for arrays than creating a new array and copying the data from the old array, so why would I every use it then? deepcopy creates an ObjectIdDict internally which probably causes the main perf…

---

## [TCPSocket Keep Alive](https://discourse.julialang.org/t/tcpsocket-keep-alive/12005)

<div class="topic-metadata">

**Author:** [@randyzwitch](https://discourse.julialang.org/u/randyzwitch)\
**Replies:** 1\
**Last updated:** [June 28, 2018, 1:43pm UTC](https://discourse.julialang.org/t/tcpsocket-keep-alive/12005 "2018-06-28T13:43:42Z")

</div>

I’ve been working with the Thrift.jl package to create bindings for MapD. I am able to successfully connect to the database for many methods, but I am noticing that if I don’t submit a call for a few minutes, then I lose…

---

## [Recommended way to open a text file with unknown encoding in v0.7](https://discourse.julialang.org/t/recommended-way-to-open-a-text-file-with-unknown-encoding-in-v0-7/12030)

<div class="topic-metadata">

**Author:** [@cstook](https://discourse.julialang.org/u/cstook)\
**Replies:** 0\
**Last updated:** [June 28, 2018, 12:42pm UTC](https://discourse.julialang.org/t/recommended-way-to-open-a-text-file-with-unknown-encoding-in-v0-7/12030 "2018-06-28T12:42:23Z")

</div>

I need to open a text file which can be encoded either UTF-16LE or UTF-8. The first line of text is known. The following worked on v0.6, but now throws a StringIndexError on the if firstline\[1:8\] == "Circuit:" line. …

---

## [How high can Julia count? (code golf)](https://discourse.julialang.org/t/how-high-can-julia-count-code-golf/11763)

<div class="topic-metadata">

**Author:** [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Replies:** 23\
**Last updated:** [June 28, 2018, 12:35pm UTC](https://discourse.julialang.org/t/how-high-can-julia-count-code-golf/11763 "2018-06-28T12:35:34Z")

</div>

(I came across a fun code golf question that wasn’t just about minimizing byte count, and thought people here might enjoy it too.) Challenge: Your task is to write as many programs / functions / REPL snippets as you can…

---

## [Should we mimic R (, MATLAB, ...) functions?](https://discourse.julialang.org/t/should-we-mimic-r-matlab-functions/11934)

<div class="topic-metadata">

**Author:** [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Replies:** 20\
**Last updated:** [June 28, 2018, 12:16pm UTC](https://discourse.julialang.org/t/should-we-mimic-r-matlab-functions/11934 "2018-06-28T12:16:35Z")

</div>

I’m currently developing a small package that generates ANOVA tables from linear models. In R you have anova() from the stats package which basically performs an type I ANOVA and then there is drop1() which basically (us…

---

## [Ccall to libgsl fails](https://discourse.julialang.org/t/ccall-to-libgsl-fails/11957)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 4\
**Last updated:** [June 28, 2018, 12:05pm UTC](https://discourse.julialang.org/t/ccall-to-libgsl-fails/11957 "2018-06-28T12:05:14Z")

</div>

Hello, I am trying to use ccall in julia for the first time and I can’t make a simple call to libgsl: ccall((:gsl\_sf\_gamma\_inc\_Q, :libgsl), Cdouble, (Cdouble, Cdouble), 0.2, 0.2) returns: ERROR: LoadError: error compi…

---

## [Passing on function keyword collections in 0.7](https://discourse.julialang.org/t/passing-on-function-keyword-collections-in-0-7/12028)

<div class="topic-metadata">

**Author:** [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Replies:** 3\
**Last updated:** [June 28, 2018, 10:54am UTC](https://discourse.julialang.org/t/passing-on-function-keyword-collections-in-0-7/12028 "2018-06-28T10:54:35Z")

</div>

I have a function with multiple methods and one of those methods just prepares an input to pass it on to the main method. How do I pass on all the keyword arguments in 0.7? Here is a simple example. julia\> arg\_test(tes…

---

## [Defining a struct in a different module](https://discourse.julialang.org/t/defining-a-struct-in-a-different-module/12017)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [June 28, 2018, 5:42am UTC](https://discourse.julialang.org/t/defining-a-struct-in-a-different-module/12017 "2018-06-28T05:42:31Z")

</div>

Hi i would like to do the following: module DDF end struct DDF.XX end is there a way to do this? Thanks

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

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