# General Usage

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

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

**Page:** 1001

---

## [Catching stackoverflow error in recursive function](https://discourse.julialang.org/t/catching-stackoverflow-error-in-recursive-function/8631)

<div class="topic-metadata">

**Author:** [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Replies:** 7\
**Last updated:** [January 27, 2018, 12:07am UTC](https://discourse.julialang.org/t/catching-stackoverflow-error-in-recursive-function/8631 "2018-01-27T00:07:54Z")

</div>

Given the fact that A=Any\[\] push!(A,A) hash(A) ERROR: StackOverflowError: I thought it a nice exercise to try to handle recursive data structures. Since most use-cases are not recursive, let’s try to do this with an ex…

---

## [How to get the row AND column value for SparseMatrixCSC elements?](https://discourse.julialang.org/t/how-to-get-the-row-and-column-value-for-sparsematrixcsc-elements/8613)

<div class="topic-metadata">

**Author:** [@abshej](https://discourse.julialang.org/u/abshej)\
**Replies:** 15\
**Last updated:** [January 26, 2018, 11:12pm UTC](https://discourse.julialang.org/t/how-to-get-the-row-and-column-value-for-sparsematrixcsc-elements/8613 "2018-01-26T23:12:58Z")

</div>

a = sparse(b) a.rowvals rowvals only gives the indices of the rows and not the column. How to get the row and column indices as a pair, the way it is displayed when entire vector is called

---

## [Expressing "at least one of this type" on Julia master](https://discourse.julialang.org/t/expressing-at-least-one-of-this-type-on-julia-master/8624)

<div class="topic-metadata">

**Author:** [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Replies:** 1\
**Last updated:** [January 26, 2018, 8:47pm UTC](https://discourse.julialang.org/t/expressing-at-least-one-of-this-type-on-julia-master/8624 "2018-01-26T20:47:12Z")

</div>

https://github.com/JuliaLang/julia/pull/23117 removed a hack that was used in a number of places to express the concept of a set of arguments, at least one of which is of a particular type. For example, if I have a custo…

---

## [Issue with ExcelReaders-DataFrames interaction](https://discourse.julialang.org/t/issue-with-excelreaders-dataframes-interaction/8565)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 12\
**Last updated:** [January 26, 2018, 8:26pm UTC](https://discourse.julialang.org/t/issue-with-excelreaders-dataframes-interaction/8565 "2018-01-26T20:26:23Z")

</div>

I currently have DataFrames v0.10.1 and trying to update to current version. When I run the update I get the following error message: INFO: Updating METADATA... INFO: Computing changes... ERROR: Unsatisfiable requiremen…

---

## [Slow down when running several parallel julia processes which use BLAS (MWE is provided)](https://discourse.julialang.org/t/slow-down-when-running-several-parallel-julia-processes-which-use-blas-mwe-is-provided/8400)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 10\
**Last updated:** [January 26, 2018, 7:26pm UTC](https://discourse.julialang.org/t/slow-down-when-running-several-parallel-julia-processes-which-use-blas-mwe-is-provided/8400 "2018-01-26T19:26:43Z")

</div>

I observe a strange problem. I am doing Monte Carlo, so for now I start multiple julia processes from the bash, each of which gathers statistics. Running 4 processes in parallel I see a 4 times slow down in execution of…

---

## [Module dependency management](https://discourse.julialang.org/t/module-dependency-management/8614)

<div class="topic-metadata">

**Author:** [@kimran](https://discourse.julialang.org/u/kimran)\
**Replies:** 2\
**Last updated:** [January 26, 2018, 4:31pm UTC](https://discourse.julialang.org/t/module-dependency-management/8614 "2018-01-26T16:31:27Z")

</div>

What is the current best practice for module dependency management? Say I have a larger project, with many modules and a tree structure of module dependency How do I go about having the include and tracking (ala \[Revis…

---

## [Naming conventions for mathematical models](https://discourse.julialang.org/t/naming-conventions-for-mathematical-models/8568)

<div class="topic-metadata">

**Author:** [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Replies:** 3\
**Last updated:** [January 26, 2018, 12:58pm UTC](https://discourse.julialang.org/t/naming-conventions-for-mathematical-models/8568 "2018-01-26T12:58:40Z")

</div>

I need a different set of naming conventions when using Julia to write mathematical models than what is generally recommended for general purpose code. For example, it is often important to be able to distinguish at a gl…

---

## [Unending error message upon including script1 in script2 AND vice versa at the same time](https://discourse.julialang.org/t/unending-error-message-upon-including-script1-in-script2-and-vice-versa-at-the-same-time/8589)

<div class="topic-metadata">

**Author:** [@abshej](https://discourse.julialang.org/u/abshej)\
**Replies:** 19\
**Last updated:** [January 26, 2018, 11:37am UTC](https://discourse.julialang.org/t/unending-error-message-upon-including-script1-in-script2-and-vice-versa-at-the-same-time/8589 "2018-01-26T11:37:06Z")

</div>

I included script1.jl in script2.jl and script2.jl in script1.jl because both contained structs required in both the files. I got an unending “LoadError: LoadError: … : LoadError: StackOverlowError”. This makes sense bu…

---

## [Can we get a standard optimised function to map an array's elements randomly with n elements of another array each?](https://discourse.julialang.org/t/can-we-get-a-standard-optimised-function-to-map-an-arrays-elements-randomly-with-n-elements-of-another-array-each/8594)

<div class="topic-metadata">

**Author:** [@abshej](https://discourse.julialang.org/u/abshej)\
**Replies:** 6\
**Last updated:** [January 26, 2018, 9:05am UTC](https://discourse.julialang.org/t/can-we-get-a-standard-optimised-function-to-map-an-arrays-elements-randomly-with-n-elements-of-another-array-each/8594 "2018-01-26T09:05:28Z")

</div>

Can we an optimised standard function in the library for mapping/linking w elements of an array with n elements of another array each? Meaning a space’s elements should randomly get connected to another space with n lin…

---

## [Dagger, No speed increase, parallel computing](https://discourse.julialang.org/t/dagger-no-speed-increase-parallel-computing/8450)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 5\
**Last updated:** [January 26, 2018, 5:03am UTC](https://discourse.julialang.org/t/dagger-no-speed-increase-parallel-computing/8450 "2018-01-26T05:03:02Z")

</div>

I found no speed increase by using Dagger. Can anyone give some suggestions? The code and the results are as follows. addprocs() using Dagger @show workers() @everywhere function f1(x) sleep(1) rand()+x end …

---

## [3D array to heatmap](https://discourse.julialang.org/t/3d-array-to-heatmap/8579)

<div class="topic-metadata">

**Author:** [@Romero\_Azzalini](https://discourse.julialang.org/u/Romero_Azzalini)\
**Replies:** 5\
**Last updated:** [January 25, 2018, 11:27pm UTC](https://discourse.julialang.org/t/3d-array-to-heatmap/8579 "2018-01-25T23:27:19Z")

</div>

Hi, I’m kind of desperate, I have a 3D array formated like x,y,z and i want to show the z value in a squared heatmap. The columns are sorted like x:aaabbbccc, y:abcabcabc (but not just with 3 values, instead 600). How a…

---

## [Function for counting number of set bits?](https://discourse.julialang.org/t/function-for-counting-number-of-set-bits/8600)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 3\
**Last updated:** [January 25, 2018, 8:59pm UTC](https://discourse.julialang.org/t/function-for-counting-number-of-set-bits/8600 "2018-01-25T20:59:24Z")

</div>

i.e. the number of 1 bits in a bits-type. I read somewhere that this is actually an x86 instruction, so if that’s the case, I’d very much like to use that. I can’t seem to find this in the documentation…

---

## [Showing LaTeX docstrings at the REPL](https://discourse.julialang.org/t/showing-latex-docstrings-at-the-repl/8573)

<div class="topic-metadata">

**Author:** [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Replies:** 1\
**Last updated:** [January 25, 2018, 6:31am UTC](https://discourse.julialang.org/t/showing-latex-docstrings-at-the-repl/8573 "2018-01-25T06:31:17Z")

</div>

LaTeX in docstrings can look very nice in HTML in rendered documentation or IJulia. However, at the REPL, the raw LaTeX is displayed. Since rendering LaTeX in most terminals is problematic, I’m wondering if anyone has …

---

## [Weird behaviour of macrocall in expression](https://discourse.julialang.org/t/weird-behaviour-of-macrocall-in-expression/8562)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 6\
**Last updated:** [January 25, 2018, 12:44am UTC](https://discourse.julialang.org/t/weird-behaviour-of-macrocall-in-expression/8562 "2018-01-25T00:44:15Z")

</div>

Is this behavior expected? julia\> dump(Expr(:macrocall, :@inbounds)) Expr head: Symbol macrocall args: Array{Any}((1,)) 1: Expr head: Symbol macrocall args: Array{Any}((1,)) 1: Symbol @inboun…

---

## [Ref / Pointer Usage](https://discourse.julialang.org/t/ref-pointer-usage/8569)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 8\
**Last updated:** [January 25, 2018, 12:42am UTC](https://discourse.julialang.org/t/ref-pointer-usage/8569 "2018-01-25T00:42:42Z")

</div>

Hi, I would like to do the following julia\> type ZInt aint::Int end julia\> z = ZInt(4) ZInt(4) julia\> ref = Ref(z.aint) Base.RefValue{Int64}(4) julia\> ref.x = 3 3 julia\> z ZInt(4) I want the z t…

---

## [Help converting C code (i2c-dev)](https://discourse.julialang.org/t/help-converting-c-code-i2c-dev/6246)

<div class="topic-metadata">

**Author:** [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Replies:** 25\
**Last updated:** [January 24, 2018, 10:14pm UTC](https://discourse.julialang.org/t/help-converting-c-code-i2c-dev/6246 "2018-01-24T22:14:36Z")

</div>

I’m trying to convert the i2c-dev.h file into Julia. I am having problems converting a C union to Julia, a couple of structs, and how to pass a struct to a ccall(). I’ll show the C code first then the Julia code. The C …

---

## [Memory size of DistributedArray](https://discourse.julialang.org/t/memory-size-of-distributedarray/8085)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 1\
**Last updated:** [January 24, 2018, 2:49pm UTC](https://discourse.julialang.org/t/memory-size-of-distributedarray/8085 "2018-01-24T14:49:27Z")

</div>

I’m trying to figure out the memory size of a DistributedArray. Consider the following example: addprocs(2) @everywhere using DistributedArrays m = \[rand(10,10) for i in 1:10\] d = distribute(m) whos() indicates 168 byt…

---

## [Way to show where memory allocations occur?](https://discourse.julialang.org/t/way-to-show-where-memory-allocations-occur/2161)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 6\
**Last updated:** [January 24, 2018, 2:17pm UTC](https://discourse.julialang.org/t/way-to-show-where-memory-allocations-occur/2161 "2018-01-24T14:17:45Z")

</div>

I wonder if there is a nice way to show where in code memory allocations happen. @benchmark of BenchmarkTools.jl is useful for measuring the number of allocations, and in many cases I can identify the locations of memor…

---

## [Tuples of "any container" of a parametric type - give me the parameter](https://discourse.julialang.org/t/tuples-of-any-container-of-a-parametric-type-give-me-the-parameter/8560)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon](https://discourse.julialang.org/u/Philippe_Maincon)\
**Replies:** 6\
**Last updated:** [January 24, 2018, 12:19pm UTC](https://discourse.julialang.org/t/tuples-of-any-container-of-a-parametric-type-give-me-the-parameter/8560 "2018-01-24T12:19:26Z")

</div>

I wish to write a function foo, which takes, among arguments, a Tuple. Each element in the Tuple can be a scalar or an Array of arbitrary dimension. The scalars and array elements are all of the same type Mytype{Nmy} (…

---

## [Slow REPL after PyPlot](https://discourse.julialang.org/t/slow-repl-after-pyplot/7862)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 22\
**Last updated:** [January 24, 2018, 9:14am UTC](https://discourse.julialang.org/t/slow-repl-after-pyplot/7862 "2018-01-24T09:14:00Z")

</div>

I was using the REPL with 0.6.2 on MacOS, and noticed that if I create a plot with PyPlot, the REPL slows to a complete crawl, becoming unusable. This is after simple commands like: using PyPlot x = linspace(0,10)|\>col…

---

## [Converting an Int64 to a Time](https://discourse.julialang.org/t/converting-an-int64-to-a-time/8552)

<div class="topic-metadata">

**Author:** [@chasecb](https://discourse.julialang.org/u/chasecb)\
**Replies:** 2\
**Last updated:** [January 23, 2018, 9:36pm UTC](https://discourse.julialang.org/t/converting-an-int64-to-a-time/8552 "2018-01-23T21:36:05Z")

</div>

So if I do something like: my\_time = Dates.Time(12,1,1,1,1) my\_int = Dates.value(my\_time) How would I then get my\_int back to a Time object? Many thanks in advance. Chase CB

---

## [Exporting LaTeX tables](https://discourse.julialang.org/t/exporting-latex-tables/8526)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [January 23, 2018, 4:15pm UTC](https://discourse.julialang.org/t/exporting-latex-tables/8526 "2018-01-23T16:15:37Z")

</div>

Is there a package out there that helps writing LaTeX tables (tabular) from matrices and a bit of metadata? This method from Base.Markdown is almost there, but I need some rules etc. This would be trivial to write and pa…

---

## [Query.jl with filtering by missing values doesn't seem to work?](https://discourse.julialang.org/t/query-jl-with-filtering-by-missing-values-doesnt-seem-to-work/8507)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 8\
**Last updated:** [January 23, 2018, 3:05pm UTC](https://discourse.julialang.org/t/query-jl-with-filtering-by-missing-values-doesnt-seem-to-work/8507 "2018-01-23T15:05:56Z")

</div>

I’m probably missing something but I can’t figure out why this doesn’t work. I have a DataFrame and I want to use Query.jl to filter it by various criteria, including keeping/removing rows where certain columns are miss…

---

## [Embedding non-Base-Module Julia function in C](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449)

<div class="topic-metadata">

**Author:** [@standarddeviant](https://discourse.julialang.org/u/standarddeviant)\
**Replies:** 3\
**Last updated:** [January 23, 2018, 9:34am UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449 "2018-01-23T09:34:48Z")

</div>

The docs (as of 0.6) are pretty clear how to embed a julia function from the Base module: https://docs.julialang.org/en/release-0.6/manual/embedding/ I see that there are some convenience options for Base and Main, but…

---

## [Convert split result to array of strings](https://discourse.julialang.org/t/convert-split-result-to-array-of-strings/8508)

<div class="topic-metadata">

**Author:** [@ivo\_welch](https://discourse.julialang.org/u/ivo_welch)\
**Replies:** 6\
**Last updated:** [January 23, 2018, 2:57am UTC](https://discourse.julialang.org/t/convert-split-result-to-array-of-strings/8508 "2018-01-23T02:57:08Z")

</div>

must be obvious, but I have tried many julia\> d = Dict("One" =\> 1, "Two" =\> 2, "Three" =\> 3); String(keys(d)) ERROR: MethodError: Cannot \`convert\` an object of type Base.KeyIterator{Dict{String,Int64}} to an object of t…

---

## [Surface plot not showing up in script](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [January 23, 2018, 12:20am UTC](https://discourse.julialang.org/t/surface-plot-not-showing-up-in-script/8536 "2018-01-23T00:20:49Z")

</div>

with using Plots; pyplot() after I generate some gridded data, xx, yy, zz, I call surface(xx,yy,zz) Now, I find that if I run the script containing this code, the figure does not appear. If I include a savefig, the …

---

## [Help avoiding perturbation confusion with symbolic forward mode auto-differentiation (how to tag dual numbers)](https://discourse.julialang.org/t/help-avoiding-perturbation-confusion-with-symbolic-forward-mode-auto-differentiation-how-to-tag-dual-numbers/8529)

<div class="topic-metadata">

**Author:** [@Mason](https://discourse.julialang.org/u/Mason)\
**Replies:** 6\
**Last updated:** [January 23, 2018, 12:16am UTC](https://discourse.julialang.org/t/help-avoiding-perturbation-confusion-with-symbolic-forward-mode-auto-differentiation-how-to-tag-dual-numbers/8529 "2018-01-23T00:16:25Z")

</div>

Hey there, so I’m playing around with making my own symbolic math package and I’m attempting to do forward mode automatic differentiation on my symbolic functions. The problem is that I am struggling to find a clean way …

---

## [For loop not working as expected](https://discourse.julialang.org/t/for-loop-not-working-as-expected/8532)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 6\
**Last updated:** [January 22, 2018, 11:21pm UTC](https://discourse.julialang.org/t/for-loop-not-working-as-expected/8532 "2018-01-22T23:21:35Z")

</div>

My code is as below: using FinancialToolbox r=0.01\*0.303 q=0.01\*0.202 s=0.20 T=0.50 b=r-q S=1500 K=1000:5:2000 for i = 1:length(K) res1 = zeros(length(K)) res…

---

## [Best practices for handling arrays of points](https://discourse.julialang.org/t/best-practices-for-handling-arrays-of-points/8533)

<div class="topic-metadata">

**Author:** [@ajd](https://discourse.julialang.org/u/ajd)\
**Replies:** 3\
**Last updated:** [January 22, 2018, 10:04pm UTC](https://discourse.julialang.org/t/best-practices-for-handling-arrays-of-points/8533 "2018-01-22T22:04:24Z")

</div>

I’m working with arrays of d-dimensional StaticArrays (representing trajectories in d-space, for d a small integer). It seems that standard library functions are not set-up well to deal with this: as a simple example, I …

---

## [Scatter3d parameters](https://discourse.julialang.org/t/scatter3d-parameters/8537)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 0\
**Last updated:** [January 22, 2018, 10:04pm UTC](https://discourse.julialang.org/t/scatter3d-parameters/8537 "2018-01-22T22:04:02Z")

</div>

I’m trying to plot a point in 3D after generating a surface using surface. I am doing this with using Plots; pyplot() # generate data surface(xx,yy,u) # runs as expected scatter3d!(\[x0\],\[y0\],\[z0\]) Now, this execute…

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

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