# General Usage

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

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

**Page:** 830

---

## [Field specialization given parametric composite types](https://discourse.julialang.org/t/field-specialization-given-parametric-composite-types/29151)

<div class="topic-metadata">

**Author:** [@doit](https://discourse.julialang.org/u/doit)\
**Replies:** 2\
**Last updated:** [September 25, 2019, 11:19am UTC](https://discourse.julialang.org/t/field-specialization-given-parametric-composite-types/29151 "2019-09-25T11:19:53Z")

</div>

Hi there, I would like to define a set of structs, which share their name (and thus type), but specialize their fields depending on their parametric type: # abstract specialization types (of which there may be more tha…

---

## [Shared-memory parallelization with large matrix](https://discourse.julialang.org/t/shared-memory-parallelization-with-large-matrix/29076)

<div class="topic-metadata">

**Author:** [@Sam](https://discourse.julialang.org/u/Sam)\
**Replies:** 9\
**Last updated:** [September 24, 2019, 6:33pm UTC](https://discourse.julialang.org/t/shared-memory-parallelization-with-large-matrix/29076 "2019-09-24T18:33:03Z")

</div>

Hi! I am currently writing a program that looks something like this Threads.@threads for i = 1:m a\[m\] = f(args, matrix\[:,:,m\]) end Where f is a function that runs some calculations, matrix is a large (e.g. 3000x…

---

## [Missing docstrings with Documenter](https://discourse.julialang.org/t/missing-docstrings-with-documenter/29122)

<div class="topic-metadata">

**Author:** [@pulsipher](https://discourse.julialang.org/u/pulsipher)\
**Replies:** 2\
**Last updated:** [September 24, 2019, 11:45pm UTC](https://discourse.julialang.org/t/missing-docstrings-with-documenter/29122 "2019-09-24T23:45:05Z")

</div>

I am building documentation for my package InfiniteOpt.jl, but I have 4 docstrings that Documenter cannot find for some reason. These correspond to the last 4 function references I make on my Model Transcription page (do…

---

## [How to read big-endian data](https://discourse.julialang.org/t/how-to-read-big-endian-data/29132)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 5\
**Last updated:** [September 24, 2019, 11:13pm UTC](https://discourse.julialang.org/t/how-to-read-big-endian-data/29132 "2019-09-24T23:13:30Z")

</div>

Hello, I have an IOStream and I want to read a series of floats that are stored in big-endian order, while my computer is usually little-endian. So there are a few parts to my question: If I know that the computer is …

---

## [Can't run a Python code on Julia using PyCall](https://discourse.julialang.org/t/cant-run-a-python-code-on-julia-using-pycall/29061)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 6\
**Last updated:** [September 24, 2019, 9:40pm UTC](https://discourse.julialang.org/t/cant-run-a-python-code-on-julia-using-pycall/29061 "2019-09-24T21:40:57Z")

</div>

Hi everybody, since Julia is able to connect with Python using PyCall i was trying to apply that on a python code on julia for a smith decomposition but i can’t run it even tho everything seem fine to me, here’s the cod…

---

## [How to export programatically-generated variables from a module](https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 1\
**Last updated:** [September 24, 2019, 6:52pm UTC](https://discourse.julialang.org/t/how-to-export-programatically-generated-variables-from-a-module/29118 "2019-09-24T18:52:45Z")

</div>

There might be a much simpler solution to this that doesn’t even involve metaprogramming, but what I’m trying to do is generate some variables within a module that will hold data frames and then make those variables avai…

---

## [Concatenate DataFrame columns dynamically](https://discourse.julialang.org/t/concatenate-dataframe-columns-dynamically/29106)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 9\
**Last updated:** [September 24, 2019, 5:49pm UTC](https://discourse.julialang.org/t/concatenate-dataframe-columns-dynamically/29106 "2019-09-24T17:49:14Z")

</div>

Hello, amazing Julia community! :smiley: I’m stumped this morning on what I thought would be a fairly trivial task: I am trying to write a function that creates a new column in a DataFrame, the values of which are simpl…

---

## [Get non-missing type in the case of parametric type](https://discourse.julialang.org/t/get-non-missing-type-in-the-case-of-parametric-type/29109)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 4\
**Last updated:** [September 24, 2019, 3:04pm UTC](https://discourse.julialang.org/t/get-non-missing-type-in-the-case-of-parametric-type/29109 "2019-09-24T15:04:14Z")

</div>

So I was looking at how to get T from a Union{Missing,T} and came up with nonmissing(TT::Type{Union{Missing,T}}) where T = T nonmissing(TT::Type{T}) where T = T (PS: incidentally I found that @bkamins had answered some…

---

## [Design Pattern the Julian way?](https://discourse.julialang.org/t/design-pattern-the-julian-way/29002)

<div class="topic-metadata">

**Author:** [@atthom](https://discourse.julialang.org/u/atthom)\
**Replies:** 16\
**Last updated:** [September 24, 2019, 11:02am UTC](https://discourse.julialang.org/t/design-pattern-the-julian-way/29002 "2019-09-24T11:02:27Z")

</div>

Design Patterns are the firsts building blocks when developing an application. There are a few of them, most developers recognize or use them when building a medium/large application. They are listed here: Software des…

---

## [Marking types as scalar for broadcasting, Ref vs. Tuple?](https://discourse.julialang.org/t/marking-types-as-scalar-for-broadcasting-ref-vs-tuple/29105)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 2\
**Last updated:** [September 24, 2019, 12:50pm UTC](https://discourse.julialang.org/t/marking-types-as-scalar-for-broadcasting-ref-vs-tuple/29105 "2019-09-24T12:50:49Z")

</div>

The typical method of marking a type as scalar for broadcasting seems to be Base.Broadcast.broadcastable(x::MyType) = Ref(x) I’ve experimented a bit with Base.Broadcast.broadcastable(x::MyType) = (x,) as an alternati…

---

## [Non-compact printing in logs in non-interactive sessions](https://discourse.julialang.org/t/non-compact-printing-in-logs-in-non-interactive-sessions/29104)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [September 24, 2019, 10:46am UTC](https://discourse.julialang.org/t/non-compact-printing-in-logs-in-non-interactive-sessions/29104 "2019-09-24T10:46:23Z")

</div>

In a long-running process I need to write out occasional numeric data. I found that it is printed compactly. MWE: tamas@tamas-vivobook ~/src/mu % julia -e 'x = collect(1.0:50.0); @info "logging" x' ┌ Info: logging │ x…

---

## [How to reshape() using an array instead of a tuple / Alt: How to convert an array into a tuple](https://discourse.julialang.org/t/how-to-reshape-using-an-array-instead-of-a-tuple-alt-how-to-convert-an-array-into-a-tuple/29101)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 5\
**Last updated:** [September 24, 2019, 9:20am UTC](https://discourse.julialang.org/t/how-to-reshape-using-an-array-instead-of-a-tuple-alt-how-to-convert-an-array-into-a-tuple/29101 "2019-09-24T09:20:32Z")

</div>

Hello, I have something like this: data = \[ ... long array of numbers ... \] dims = \[1024,256,128\] # (for example) I want to reshape the data and ideally I would like to do this: reshape(data,dims) The problem I hav…

---

## [Basic question about different type annotations in function declarations](https://discourse.julialang.org/t/basic-question-about-different-type-annotations-in-function-declarations/29086)

<div class="topic-metadata">

**Author:** [@SEA](https://discourse.julialang.org/u/SEA)\
**Replies:** 5\
**Last updated:** [September 23, 2019, 9:25pm UTC](https://discourse.julialang.org/t/basic-question-about-different-type-annotations-in-function-declarations/29086 "2019-09-23T21:25:18Z")

</div>

I wanted to clarify my understanding of the following ways of defining a function. f(x) = … f(x::T) where {T} = … f(x::Any) = … Is it true that 1. and 2. are equivalent if there are no type restrictions in …

---

## [Cleaning up strings via piping...?](https://discourse.julialang.org/t/cleaning-up-strings-via-piping/29089)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 2\
**Last updated:** [September 23, 2019, 8:08pm UTC](https://discourse.julialang.org/t/cleaning-up-strings-via-piping/29089 "2019-09-23T20:08:40Z")

</div>

I’m hoping to get some tips for cleaning up strings (maybe with piping). For example, take the following vector: dirtydata = \["O' Malley's Irish Pub", "El Sueño", "123 & ABC & 100%", 1.23, missing, 12\] What I would lik…

---

## [Raspberry PI - failed to map segment from shared object](https://discourse.julialang.org/t/raspberry-pi-failed-to-map-segment-from-shared-object/28888)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 4\
**Last updated:** [September 23, 2019, 6:04pm UTC](https://discourse.julialang.org/t/raspberry-pi-failed-to-map-segment-from-shared-object/28888 "2019-09-23T18:04:34Z")

</div>

We have some problems using our package on a Raspebrry Pi. jarl@pirog:~/archive/julia-1.2.0/bin $ ./julia \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | …

---

## [What are those magic variables in lowered code?](https://discourse.julialang.org/t/what-are-those-magic-variables-in-lowered-code/29083)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 1\
**Last updated:** [September 23, 2019, 5:37pm UTC](https://discourse.julialang.org/t/what-are-those-magic-variables-in-lowered-code/29083 "2019-09-23T17:37:23Z")

</div>

I’m trying to understand the result of @code\_lowered macro. Consider this simple example: julia\> mutable struct Foo value end julia\> foo = Foo(1) Foo(1) julia\> @code\_lowered(foo.value = 2) CodeInfo(…

---

## [Opaque pointers and ccall mem. management](https://discourse.julialang.org/t/opaque-pointers-and-ccall-mem-management/29081)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 0\
**Last updated:** [September 23, 2019, 4:47pm UTC](https://discourse.julialang.org/t/opaque-pointers-and-ccall-mem-management/29081 "2019-09-23T16:47:03Z")

</div>

What is the recommended julia side of C-API opaque pointer? I’d like to have a julia type for it. z1 = ccall((lib, allocateNewO), Ptr{NewO},(Uint64, ), newNumber); with NewO without structure. Can julia be convince…

---

## [Symplectic integrators](https://discourse.julialang.org/t/symplectic-integrators/29056)

<div class="topic-metadata">

**Author:** [@bojohnson02](https://discourse.julialang.org/u/bojohnson02)\
**Replies:** 2\
**Last updated:** [September 23, 2019, 2:25pm UTC](https://discourse.julialang.org/t/symplectic-integrators/29056 "2019-09-23T14:25:31Z")

</div>

In DifferentialEquations do the symplectic integrators require separable Hamiltonians? I’ve tried using a couple algorithms like Yoshida6 or KahanLi6 with a non-separable system and haven’t gotten good results when compa…

---

## [EUNBORNBRANCH error when adding private package](https://discourse.julialang.org/t/eunbornbranch-error-when-adding-private-package/28958)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 5\
**Last updated:** [September 23, 2019, 1:44pm UTC](https://discourse.julialang.org/t/eunbornbranch-error-when-adding-private-package/28958 "2019-09-23T13:44:45Z")

</div>

We’ve been using the package manager heavily ever since 1.0, with a dedicated private git server that contains bare git repos. Everything has always worked fine, but suddenly I find myself unable to add one of our packag…

---

## [Array{Float64}(undef, X) gives wrong results](https://discourse.julialang.org/t/array-float64-undef-x-gives-wrong-results/28991)

<div class="topic-metadata">

**Author:** [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)\
**Replies:** 9\
**Last updated:** [September 23, 2019, 8:08am UTC](https://discourse.julialang.org/t/array-float64-undef-x-gives-wrong-results/28991 "2019-09-23T08:08:16Z")

</div>

I am writing a complex hydrological model in JUILIA. https://github.com/joseph-pollacco/HyCatch-1D/tree/master/JULIA Problem in file: In file WaterBalance.jl I was finding that when I run the model from the Julia REP…

---

## [Map over namedtuple keys and values: confusing error](https://discourse.julialang.org/t/map-over-namedtuple-keys-and-values-confusing-error/26866)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 10\
**Last updated:** [September 23, 2019, 8:07am UTC](https://discourse.julialang.org/t/map-over-namedtuple-keys-and-values-confusing-error/26866 "2019-09-23T08:07:45Z")

</div>

Hi! I want to map a function, which gets a Pair, over both keys and values of a namedtuple, and the most obvious way seems to be using, well, pairs: f(p) = (p.first, p.second) nt = (A=5, B=6) pairs(nt) |\> collect 2-ele…

---

## [When is it better to use non-concrete types in structs?](https://discourse.julialang.org/t/when-is-it-better-to-use-non-concrete-types-in-structs/29041)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 11\
**Last updated:** [September 23, 2019, 8:00am UTC](https://discourse.julialang.org/t/when-is-it-better-to-use-non-concrete-types-in-structs/29041 "2019-09-23T08:00:25Z")

</div>

I recently read the excellent post by @quinnj : I was surprised to learn that DataFrames.jl uses structs with AbstractArrays fields to cut down in compilation time without hurting runtime performance. This is quite a s…

---

## [Problem using Documenter.jl](https://discourse.julialang.org/t/problem-using-documenter-jl/29052)

<div class="topic-metadata">

**Author:** [@ARYADEEPTA\_DE](https://discourse.julialang.org/u/ARYADEEPTA_DE)\
**Replies:** 9\
**Last updated:** [September 23, 2019, 7:51am UTC](https://discourse.julialang.org/t/problem-using-documenter-jl/29052 "2019-09-23T07:51:18Z")

</div>

I am doing a project in julia, and was attempting to use doctest.jl for documentation. I was following the intstructions on github, and had everything working until running make.jl from the docs directory. Here is the co…

---

## [Online playground](https://discourse.julialang.org/t/online-playground/29024)

<div class="topic-metadata">

**Author:** [@vishr](https://discourse.julialang.org/u/vishr)\
**Replies:** 4\
**Last updated:** [September 23, 2019, 7:17am UTC](https://discourse.julialang.org/t/online-playground/29024 "2019-09-23T07:17:26Z")

</div>

Folks, I wanted to share https://code.labstack.com/julia , an online Julia programming playground. I hope you will find it useful. Thanks.

---

## [Strip out YAML blocks](https://discourse.julialang.org/t/strip-out-yaml-blocks/29059)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 4\
**Last updated:** [September 23, 2019, 7:10am UTC](https://discourse.julialang.org/t/strip-out-yaml-blocks/29059 "2019-09-23T07:10:51Z")

</div>

Is there an easy way to strip yaml blocks from markdown files, or more concretely - anything between and including the first and second occurence of --- and ---.

---

## [Reducing redundant typing when returning named tuples](https://discourse.julialang.org/t/reducing-redundant-typing-when-returning-named-tuples/29054)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 1\
**Last updated:** [September 23, 2019, 1:18am UTC](https://discourse.julialang.org/t/reducing-redundant-typing-when-returning-named-tuples/29054 "2019-09-23T01:18:40Z")

</div>

I think there was a post about this a while back but I’m not sure if it was before named tuples were in base or not and I also cannot find it. Say I create local variables a, b, and c inside a function. I want to return…

---

## [DataFrames Error: Warning: \`T\` is deprecated, use \`nonmissingtype\` instead](https://discourse.julialang.org/t/dataframes-error-warning-t-is-deprecated-use-nonmissingtype-instead/29053)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 2\
**Last updated:** [September 23, 2019, 12:03am UTC](https://discourse.julialang.org/t/dataframes-error-warning-t-is-deprecated-use-nonmissingtype-instead/29053 "2019-09-23T00:03:55Z")

</div>

I’ve been getting this error a lot lately (I think since I updated my DataFrames package). Has anyone else run into this? ┌ Warning: \`T\` is deprecated, use \`nonmissingtype\` instead. │ caller = compacttype(::Type, ::In…

---

## [Strange behavior of setindex() inside a function or a loop?](https://discourse.julialang.org/t/strange-behavior-of-setindex-inside-a-function-or-a-loop/29042)

<div class="topic-metadata">

**Author:** [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Replies:** 2\
**Last updated:** [September 22, 2019, 2:28pm UTC](https://discourse.julialang.org/t/strange-behavior-of-setindex-inside-a-function-or-a-loop/29042 "2019-09-22T14:28:04Z")

</div>

I’m not sure if this is a known issue or I’ve missed something obvious, but the following functions didn’t work as I expected. f() works correctly without a return value, but once I add return tt I get the original tuple…

---

## [Documenter - @autodocs example evaluation - functions order](https://discourse.julialang.org/t/documenter-autodocs-example-evaluation-functions-order/28529)

<div class="topic-metadata">

**Author:** [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Replies:** 2\
**Last updated:** [September 22, 2019, 1:02am UTC](https://discourse.julialang.org/t/documenter-autodocs-example-evaluation-functions-order/28529 "2019-09-22T01:02:37Z")

</div>

I have two questions regarding @autodocs in Documenter. How can I evaluate the examples in the docstrings when I use @autodocs? The order of functions that appear when I use @index and @autodocs is based on alphabe…

---

## [Memory Allocation and Interpolation](https://discourse.julialang.org/t/memory-allocation-and-interpolation/29015)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 4\
**Last updated:** [September 21, 2019, 10:21pm UTC](https://discourse.julialang.org/t/memory-allocation-and-interpolation/29015 "2019-09-21T22:21:44Z")

</div>

I’ve got some code where I need to perform interpolations at every step of a loop (it’s the integration in time of a PDE). While the code works, currently with Dierckx, I was wondering if any of the interpolation packag…

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

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