# General Usage

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

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

**Page:** 845

---

## [Cumulative count function?](https://discourse.julialang.org/t/cumulative-count-function/26979)

<div class="topic-metadata">

**Author:** [@PaulMainwood](https://discourse.julialang.org/u/PaulMainwood)\
**Replies:** 8\
**Last updated:** [July 31, 2019, 9:46pm UTC](https://discourse.julialang.org/t/cumulative-count-function/26979 "2019-07-31T21:46:51Z")

</div>

Is there a Julia function that can do a cumulative count of previous occurrences of each value an array? That is, something that would behave like this (using a mixed array as an example): cumcount(\[0, 5, 5, "foo", 5, …

---

## [Opeb pdf file](https://discourse.julialang.org/t/opeb-pdf-file/27005)

<div class="topic-metadata">

**Author:** [@Kelvyn88](https://discourse.julialang.org/u/Kelvyn88)\
**Replies:** 2\
**Last updated:** [July 31, 2019, 7:05pm UTC](https://discourse.julialang.org/t/opeb-pdf-file/27005 "2019-07-31T19:05:08Z")

</div>

Hi, I want to open a pdf file with the default application on windows 10. The shell command is: START “” “filename” but using “;” before the line didn’t work. Using in windows’s console works.

---

## [Weird UndefVarError in Julia 1.3 using HDF5.jl](https://discourse.julialang.org/t/weird-undefvarerror-in-julia-1-3-using-hdf5-jl/27047)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 2\
**Last updated:** [July 31, 2019, 6:15pm UTC](https://discourse.julialang.org/t/weird-undefvarerror-in-julia-1-3-using-hdf5-jl/27047 "2019-07-31T18:15:59Z")

</div>

Hello, consider the following MWE: using HDF5 u = rand(2, 3) h5open("foo.h5", "w") do f # write some data in \`foo\` du = similar(u) d\_create(f, "u", datatype(eltype(du)), ((2, 3, 10), (2, 3, -1,)), "chunk", (2, …

---

## [Best way to structure Julia code](https://discourse.julialang.org/t/best-way-to-structure-julia-code/26591)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 17\
**Last updated:** [July 31, 2019, 6:04pm UTC](https://discourse.julialang.org/t/best-way-to-structure-julia-code/26591 "2019-07-31T18:04:58Z")

</div>

Dear all, I am a bit sad that it was told here on the forum that adding a custom directory to the package search path would be depreciated. If I write a Julia program I would like to structure it by using a module for …

---

## [Setting the \`.gitconfig\` file to be used by Pkg/Pkg3](https://discourse.julialang.org/t/setting-the-gitconfig-file-to-be-used-by-pkg-pkg3/10795)

<div class="topic-metadata">

**Author:** [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Replies:** 1\
**Last updated:** [July 31, 2019, 2:57pm UTC](https://discourse.julialang.org/t/setting-the-gitconfig-file-to-be-used-by-pkg-pkg3/10795 "2019-07-31T14:57:55Z")

</div>

Is it possible to specify the gitconfig file to be used when running the add commands in Pkg or Pkg3? I’m running Julia under Cygwin, and get GitConfig errors when running add commands due to symlink issues (explained he…

---

## [How to overload push!](https://discourse.julialang.org/t/how-to-overload-push/26810)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 8\
**Last updated:** [July 31, 2019, 2:22pm UTC](https://discourse.julialang.org/t/how-to-overload-push/26810 "2019-07-31T14:22:14Z")

</div>

Hi folks, I’m trying to define an object that stores some data with associated time tags. The time tags are constrained to be in consecutive order. As a consequence I’ve defined a struct with the pertinent data fields, …

---

## [Metaprogramming Queryverse/Query Pipelines](https://discourse.julialang.org/t/metaprogramming-queryverse-query-pipelines/27032)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 7\
**Last updated:** [July 31, 2019, 1:47pm UTC](https://discourse.julialang.org/t/metaprogramming-queryverse-query-pipelines/27032 "2019-07-31T13:47:53Z")

</div>

Hello, I haven’t done any real metaprogramming yet (other than tinkering around with it) and I have a situation that I think could be a good fit for a metaprogramming solution. I’m working with a dataset in Queryverse a…

---

## [Pass a ref to tuple to ccall](https://discourse.julialang.org/t/pass-a-ref-to-tuple-to-ccall/27030)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 1\
**Last updated:** [July 31, 2019, 12:37pm UTC](https://discourse.julialang.org/t/pass-a-ref-to-tuple-to-ccall/27030 "2019-07-31T12:37:49Z")

</div>

I am calling an external C function that takes as an argument a pointer to an array of 4 chars and fills it with values. Myy initial attempt at a Julia wrapper was: @inline function XXH32toCanonical(h::UInt32)::NTuple{…

---

## [Julia package to wrap a C library](https://discourse.julialang.org/t/julia-package-to-wrap-a-c-library/26749)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 10\
**Last updated:** [July 31, 2019, 10:31am UTC](https://discourse.julialang.org/t/julia-package-to-wrap-a-c-library/26749 "2019-07-31T10:31:27Z")

</div>

I would like to use xxHash which has been ported to almost every language (link). The algorithm is straightforward and I could port it (using the Go version as reference). However, the original C version is highly op…

---

## [Generic decomposition for A \\ x](https://discourse.julialang.org/t/generic-decomposition-for-a-x/27023)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [July 31, 2019, 10:07am UTC](https://discourse.julialang.org/t/generic-decomposition-for-a-x/27023 "2019-07-31T10:07:05Z")

</div>

I have an algorithm where I have to perform A \* x and A \\ x a lot of times for the same A::AbstractMatrix. Importantly, A can be dense, triangular, sparse, etc. I would like to save a generic decomposition object for A …

---

## [VegaLite fails to launch bash !?](https://discourse.julialang.org/t/vegalite-fails-to-launch-bash/26954)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [July 31, 2019, 9:09am UTC](https://discourse.julialang.org/t/vegalite-fails-to-launch-bash/26954 "2019-07-31T09:09:34Z")

</div>

I am trying to run the basic example of VegaLite on Ubuntu 18.04: julia\> using VegaLite, VegaDatasets julia\> @vlplot( :point, x=:Horsepower, y=:Miles\_per\_Gallon, color=:Origi…

---

## [How to troubleshoot when precompilation takes a long time?](https://discourse.julialang.org/t/how-to-troubleshoot-when-precompilation-takes-a-long-time/27020)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 1\
**Last updated:** [July 31, 2019, 8:23am UTC](https://discourse.julialang.org/t/how-to-troubleshoot-when-precompilation-takes-a-long-time/27020 "2019-07-31T08:23:34Z")

</div>

I’m working on a module and it’s taking longer and longer to precompile (now taking more like a minute). The code base isn’t too big, and it’s certainly going to grow bigger soon. I wonder if there’s any way to speed t…

---

## [OrderedSet indexing](https://discourse.julialang.org/t/orderedset-indexing/27018)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 2\
**Last updated:** [July 31, 2019, 7:23am UTC](https://discourse.julialang.org/t/orderedset-indexing/27018 "2019-07-31T07:23:25Z")

</div>

Any idea why OrderedSet indexing is deprecated? If I follow the recommendation then I would have to keep a counter and iterate until I find the ith item? julia\> using DataStructures julia\> os = OrderedSet(\[2,3,1,4,7,…

---

## [Symbolic manipulations with Julia](https://discourse.julialang.org/t/symbolic-manipulations-with-julia/26939)

<div class="topic-metadata">

**Author:** [@Adam\_Haber](https://discourse.julialang.org/u/Adam_Haber)\
**Replies:** 7\
**Last updated:** [July 31, 2019, 4:17am UTC](https://discourse.julialang.org/t/symbolic-manipulations-with-julia/26939 "2019-07-31T04:17:41Z")

</div>

Hi, I’m looking for a symbolic manipulations library to do different sorts of analysis on a model. I’ve tried python SymPy but couldn’t get it to work; following a recent tweet by @cscherrer, I was wondering whether I c…

---

## [Reuse declarations](https://discourse.julialang.org/t/reuse-declarations/27001)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 10\
**Last updated:** [July 31, 2019, 12:33am UTC](https://discourse.julialang.org/t/reuse-declarations/27001 "2019-07-31T00:33:29Z")

</div>

I want to declare two structures, one of which contains many of the same elements of the other. In a simple example, it would be, for example: struct A a :: Int64 end struct B a :: Int64 b :: Float64 end What I …

---

## [Access fields of pointer to struct returned from ccall](https://discourse.julialang.org/t/access-fields-of-pointer-to-struct-returned-from-ccall/26985)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 4\
**Last updated:** [July 31, 2019, 12:20am UTC](https://discourse.julialang.org/t/access-fields-of-pointer-to-struct-returned-from-ccall/26985 "2019-07-31T00:20:31Z")

</div>

I am calling a C function that returns a pointer to a struct. I have mapped that struct to a corresponding Julia type (see code below), and when I call the function I get a Ptr{T}. How can access the fields of the retu…

---

## [Type instability using interpolation as field of struct](https://discourse.julialang.org/t/type-instability-using-interpolation-as-field-of-struct/27002)

<div class="topic-metadata">

**Author:** [@jbmuir](https://discourse.julialang.org/u/jbmuir)\
**Replies:** 6\
**Last updated:** [July 31, 2019, 12:00am UTC](https://discourse.julialang.org/t/type-instability-using-interpolation-as-field-of-struct/27002 "2019-07-31T00:00:20Z")

</div>

My application has a construct equivalent to the following MWE using Interpolations struct MyStruct{T\<:Real, IT\<:AbstractInterpolation{T,1}} x::Array{T,1} y::Array{T,1} itp::IT end MyStruct(x::Array{T,1},y…

---

## [How efficient is dictionary lookup in Julia?](https://discourse.julialang.org/t/how-efficient-is-dictionary-lookup-in-julia/26984)

<div class="topic-metadata">

**Author:** [@manuelma](https://discourse.julialang.org/u/manuelma)\
**Replies:** 6\
**Last updated:** [July 30, 2019, 11:32pm UTC](https://discourse.julialang.org/t/how-efficient-is-dictionary-lookup-in-julia/26984 "2019-07-30T23:32:24Z")

</div>

I have an application where I have to lookup keys in a dictionary several times, and depending on the particular case it could be that I lookup the same key hundreds of times. How much overhead should I expect? In Pytho…

---

## [QuadGK don't work in CUDA kernel](https://discourse.julialang.org/t/quadgk-dont-work-in-cuda-kernel/26754)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 6\
**Last updated:** [July 30, 2019, 9:05pm UTC](https://discourse.julialang.org/t/quadgk-dont-work-in-cuda-kernel/26754 "2019-07-30T21:05:37Z")

</div>

I have problem with executing Julia function: function biotSavartCalculation(x,y,z,Segment,I,SegmentsOnElement,segmentlength,Bx,By,Bz) xIndex=(blockIdx().x-1) \* blockDim().x + threadIdx().x yIndex=(blockIdx().y-1) \*…

---

## [What is the memory overhead of a mutable struct?](https://discourse.julialang.org/t/what-is-the-memory-overhead-of-a-mutable-struct/26963)

<div class="topic-metadata">

**Author:** [@Russ](https://discourse.julialang.org/u/Russ)\
**Replies:** 8\
**Last updated:** [July 30, 2019, 6:24pm UTC](https://discourse.julialang.org/t/what-is-the-memory-overhead-of-a-mutable-struct/26963 "2019-07-30T18:24:21Z")

</div>

I’m trying to figure out how much memory a mutable struct actually takes up. For example, in Java or C#, there’s a vptr and a syncroot/hash id, so the overhead is 8 or 16 bytes, depending on if it’s being run in 32 or 64…

---

## [Unusual slow Julia code compared to C++?](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987)

<div class="topic-metadata">

**Author:** [@KestutisMa](https://discourse.julialang.org/u/KestutisMa)\
**Replies:** 21\
**Last updated:** [July 30, 2019, 4:03pm UTC](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987 "2019-07-30T16:03:12Z")

</div>

Hello, We are investigating Gap Junctions channels in cells (during cardiac arrhythmia also propagation of excitation in neural networks). I am trying to implement our model in Julia, but first version ran about 10x sl…

---

## [Local Modules with Conflicting Names and Module Management](https://discourse.julialang.org/t/local-modules-with-conflicting-names-and-module-management/26942)

<div class="topic-metadata">

**Author:** [@conscientiousCode](https://discourse.julialang.org/u/conscientiousCode)\
**Replies:** 8\
**Last updated:** [July 30, 2019, 2:36pm UTC](https://discourse.julialang.org/t/local-modules-with-conflicting-names-and-module-management/26942 "2019-07-30T14:36:47Z")

</div>

Hello everyone, I am writing a midsize project that has quite a few modules and I just thought of a potential problem that I cannot see answered anywhere. Suppose I want to add two distinct sources to my LOAD\_PATH for m…

---

## [Overload x\[0:0.5:0.5\] .= 1 when x is not AbstractVector](https://discourse.julialang.org/t/overload-x-0-0-5-0-5-1-when-x-is-not-abstractvector/26980)

<div class="topic-metadata">

**Author:** [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Replies:** 1\
**Last updated:** [July 30, 2019, 2:28pm UTC](https://discourse.julialang.org/t/overload-x-0-0-5-0-5-1-when-x-is-not-abstractvector/26980 "2019-07-30T14:28:52Z")

</div>

I have a custom type QuasiArray that implements broadcasting, and expected x\[0:0.5:0.5\] .= 1 to lower to the functioning view(x,0:0.5:0.5) .= 1 Unfortunately this is not working as expected, and x\[0:0.5:0.5\] .= 1 app…

---

## [Loop vectorization depends on number of terms in stencil](https://discourse.julialang.org/t/loop-vectorization-depends-on-number-of-terms-in-stencil/26948)

<div class="topic-metadata">

**Author:** [@samtkaplan](https://discourse.julialang.org/u/samtkaplan)\
**Replies:** 1\
**Last updated:** [July 30, 2019, 12:57pm UTC](https://discourse.julialang.org/t/loop-vectorization-depends-on-number-of-terms-in-stencil/26948 "2019-07-30T12:57:31Z")

</div>

Hello, I was motivated by the recent blog post about the new threading infrastructure in Julia 1.3-alpha to try writing a Julia stencil code that I would normally end up writing in C. However, before getting a chance t…

---

## [Possibility to sort conditional output?](https://discourse.julialang.org/t/possibility-to-sort-conditional-output/26933)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 12\
**Last updated:** [July 30, 2019, 11:19am UTC](https://discourse.julialang.org/t/possibility-to-sort-conditional-output/26933 "2019-07-30T11:19:40Z")

</div>

First off, sorry if my title is bad, didn’t know what else to call it. Say I have a function with inputs like these: function readBi4Array(typ::Cat,SeekNull::Bool=false,Bi4Files::Array{String,1}=\_dirFiles()) Where “ty…

---

## [How can I solve error UndefVarError while I was using describe for DataFrames](https://discourse.julialang.org/t/how-can-i-solve-error-undefvarerror-while-i-was-using-describe-for-dataframes/26925)

<div class="topic-metadata">

**Author:** [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Replies:** 4\
**Last updated:** [July 30, 2019, 7:41am UTC](https://discourse.julialang.org/t/how-can-i-solve-error-undefvarerror-while-i-was-using-describe-for-dataframes/26925 "2019-07-30T07:41:45Z")

</div>

Hi, I am trying to use describe() function for DataFrame like describe(data). But I am getting error “UndefVarError: describe not defined”. What is the reason? I am using Atom with julia version 1.1.0. I am new to Juli…

---

## [Gradient of a normal (NOT vector) function that has vector arguments](https://discourse.julialang.org/t/gradient-of-a-normal-not-vector-function-that-has-vector-arguments/26621)

<div class="topic-metadata">

**Author:** [@Ujku\_KU](https://discourse.julialang.org/u/Ujku_KU)\
**Replies:** 10\
**Last updated:** [July 30, 2019, 1:52am UTC](https://discourse.julialang.org/t/gradient-of-a-normal-not-vector-function-that-has-vector-arguments/26621 "2019-07-30T01:52:19Z")

</div>

Hi guys, I am trying to implement a code in Julia (it’s my first in Julia) and I am having problems in computing the gradient of a function with vector arguments. I would like to compute the derivative in relation with…

---

## [Maxpool in Flux 0.8](https://discourse.julialang.org/t/maxpool-in-flux-0-8/26956)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [July 29, 2019, 9:28pm UTC](https://discourse.julialang.org/t/maxpool-in-flux-0-8/26956 "2019-07-29T21:28:51Z")

</div>

This line is from the model-zoo, mnist, conv example (source: https://github.com/FluxML/model-zoo/blob/42967f6767beee4092348fd41b1af33442b75924/vision/mnist/conv.jl#L44): Chain(..., x -\> maxpool(x, (2,2)), ...) It does…

---

## [Setting Variables from a Parameters Text File](https://discourse.julialang.org/t/setting-variables-from-a-parameters-text-file/26946)

<div class="topic-metadata">

**Author:** [@dburch](https://discourse.julialang.org/u/dburch)\
**Replies:** 5\
**Last updated:** [July 29, 2019, 9:24pm UTC](https://discourse.julialang.org/t/setting-variables-from-a-parameters-text-file/26946 "2019-07-29T21:24:10Z")

</div>

Is it possible to do this and how would I do it? I have a file populated with variable name, variable type, and variable value. name,type,value var1,Int64,44 var2,Float64,1.5 var3,String,Hello World I want to use…

---

## [Filling a preallocated array without allocations](https://discourse.julialang.org/t/filling-a-preallocated-array-without-allocations/26896)

<div class="topic-metadata">

**Author:** [@guilhermebodin](https://discourse.julialang.org/u/guilhermebodin)\
**Replies:** 7\
**Last updated:** [July 29, 2019, 6:05pm UTC](https://discourse.julialang.org/t/filling-a-preallocated-array-without-allocations/26896 "2019-07-29T18:05:28Z")

</div>

Hello, does anybody know if it is possible to fill a preallocated array without allocations? In other words, is there a way of performing this function loop without allocations mutable struct KF F::Array{Float64, 3…

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

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