# General Usage

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

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

**Page:** 890

---

## [Distinguishing anonymous functions inside types](https://discourse.julialang.org/t/distinguishing-anonymous-functions-inside-types/21216)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 15\
**Last updated:** [February 26, 2019, 10:28pm UTC](https://discourse.julialang.org/t/distinguishing-anonymous-functions-inside-types/21216 "2019-02-26T22:28:51Z")

</div>

Suppose I do the following (extracted from actual code): julia\> struct MyTest{F} f::F end julia\> function initialize(x::T) where {T} return MyTest(i-\>(i==0) ? x : zero(x)) end initia…

---

## [Can't run Julia on mid-2012 MacBook Air, macOS 10.14.3: malloc: \*\*\* error for object 0x1079269e8: pointer being freed was not allocated](https://discourse.julialang.org/t/cant-run-julia-on-mid-2012-macbook-air-macos-10-14-3-malloc-error-for-object-0x1079269e8-pointer-being-freed-was-not-allocated/20630)

<div class="topic-metadata">

**Author:** [@samgreen](https://discourse.julialang.org/u/samgreen)\
**Replies:** 11\
**Last updated:** [February 26, 2019, 9:16pm UTC](https://discourse.julialang.org/t/cant-run-julia-on-mid-2012-macbook-air-macos-10-14-3-malloc-error-for-object-0x1079269e8-pointer-being-freed-was-not-allocated/20630 "2019-02-26T21:16:58Z")

</div>

Any attempt to run Julia (1.0, 1.1, nightly) fails with a malloc error on my mid-2012 MacBook Air: $ julia julia(3402,0x10a9c35c0) malloc: \*\*\* error for object 0x1079269e8: pointer being freed was not allocated julia(34…

---

## [Unexpected change of string(X::Array{String}) behave in Julia 1.1 (a bug?)](https://discourse.julialang.org/t/unexpected-change-of-string-x-array-string-behave-in-julia-1-1-a-bug/21233)

<div class="topic-metadata">

**Author:** [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 9:10pm UTC](https://discourse.julialang.org/t/unexpected-change-of-string-x-array-string-behave-in-julia-1-1-a-bug/21233 "2019-02-26T21:10:44Z")

</div>

In Julia 1.1 julia\> string(\["aaa", "bba"\]) 2-element Array{String,1}: "aaa" "bba" However, in Julia 1.0 julia\> string(\["aaa", "bba"\]) "\[\\"aaa\\", \\"bba\\"\]" I didn’t expect there is still such breaking change in Juli…

---

## [Call an entire python script from Julia?](https://discourse.julialang.org/t/call-an-entire-python-script-from-julia/21223)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [February 26, 2019, 6:37pm UTC](https://discourse.julialang.org/t/call-an-entire-python-script-from-julia/21223 "2019-02-26T18:37:08Z")

</div>

shell \> cat calendar.py # Python program to display calendar of given month of the year # import module import calendar yy = 2014 mm = 11 # To ask month and year from the user # yy = int(input("Enter year: ")) # mm = …

---

## [Activating a project with modules already in use](https://discourse.julialang.org/t/activating-a-project-with-modules-already-in-use/21222)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 3\
**Last updated:** [February 26, 2019, 6:04pm UTC](https://discourse.julialang.org/t/activating-a-project-with-modules-already-in-use/21222 "2019-02-26T18:04:26Z")

</div>

Hello, I have a question. What if I do: using Package1, Pkg Pkg.activate("path") using Package1 What happens if the project I activated in path has also a version of Package1 added and this version is different from th…

---

## [How to add package pyeval in julia?](https://discourse.julialang.org/t/how-to-add-package-pyeval-in-julia/21221)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [February 26, 2019, 5:31pm UTC](https://discourse.julialang.org/t/how-to-add-package-pyeval-in-julia/21221 "2019-02-26T17:31:32Z")

</div>

I tried the following so far. julia\> import Pkg julia\> Pkg.add("pyeval") Updating registry at \`~/.julia/registries/General\` Updating git-repo \`https://github.com/JuliaRegistries/General.git\` ERROR: The following pa…

---

## [Recommended style guide for naming functions is not practical](https://discourse.julialang.org/t/recommended-style-guide-for-naming-functions-is-not-practical/21206)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 25\
**Last updated:** [February 26, 2019, 5:18pm UTC](https://discourse.julialang.org/t/recommended-style-guide-for-naming-functions-is-not-practical/21206 "2019-02-26T17:18:59Z")

</div>

I’ve been thinking about this a lot lately, as I’m getting closer to a Genie v1.0 release and I want to finalize and stabilize the API. And I have a big big big problem with the recommended guidelines for naming function…

---

## [Preserving matrix structure while using Boolean arrays](https://discourse.julialang.org/t/preserving-matrix-structure-while-using-boolean-arrays/21220)

<div class="topic-metadata">

**Author:** [@jfan](https://discourse.julialang.org/u/jfan)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 4:52pm UTC](https://discourse.julialang.org/t/preserving-matrix-structure-while-using-boolean-arrays/21220 "2019-02-26T16:52:44Z")

</div>

Let’s say, x 5x3 Array{Int64,2}: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 c 5x3 BitArray{2}: true true false false false false false false false false true false true false true U…

---

## [Disabling Suite Sparse GPUQR dependency](https://discourse.julialang.org/t/disabling-suite-sparse-gpuqr-dependency/21215)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 0\
**Last updated:** [February 26, 2019, 2:54pm UTC](https://discourse.julialang.org/t/disabling-suite-sparse-gpuqr-dependency/21215 "2019-02-26T14:54:07Z")

</div>

I am having the following error when trying to build Julia: /usr/bin/ld: cannot find -lSuiteSparse\_GPURuntime /usr/bin/ld: cannot find -lGPUQREngine This doesn’t look like something that should be required for me. How …

---

## [What are my options to create a UI for an optimization problem written using JuMP?](https://discourse.julialang.org/t/what-are-my-options-to-create-a-ui-for-an-optimization-problem-written-using-jump/21188)

<div class="topic-metadata">

**Author:** [@Lonewolf92](https://discourse.julialang.org/u/Lonewolf92)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 3:09pm UTC](https://discourse.julialang.org/t/what-are-my-options-to-create-a-ui-for-an-optimization-problem-written-using-jump/21188 "2019-02-26T15:09:44Z")

</div>

I have developed an optimization model for a freight network and want to create a very simple UI for the model. The UI must allow a layman to upload the inputs (like supply and demands) and get the results, plots. What a…

---

## [Is it time consuming to call python functions from Julia compared with coding with julia directly?](https://discourse.julialang.org/t/is-it-time-consuming-to-call-python-functions-from-julia-compared-with-coding-with-julia-directly/21207)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [February 26, 2019, 10:56am UTC](https://discourse.julialang.org/t/is-it-time-consuming-to-call-python-functions-from-julia-compared-with-coding-with-julia-directly/21207 "2019-02-26T10:56:58Z")

</div>

I hope this is not a naive question. Any comments are greatly appreciated.

---

## [LaTeXStrings: mix Tex and value of pre-existing variable in string](https://discourse.julialang.org/t/latexstrings-mix-tex-and-value-of-pre-existing-variable-in-string/21201)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 2\
**Last updated:** [February 26, 2019, 9:04am UTC](https://discourse.julialang.org/t/latexstrings-mix-tex-and-value-of-pre-existing-variable-in-string/21201 "2019-02-26T09:04:43Z")

</div>

I’m trying to use LaTeXStrings in Julia 1.1 and PyPlot to programmatically label various subplots. For example, I have a collection of indexed variables \\omega\_i and \\tau\_i, but I only want to plot a specific subset of t…

---

## [Custom indices range for arrays](https://discourse.julialang.org/t/custom-indices-range-for-arrays/21203)

<div class="topic-metadata">

**Author:** [@MrRobot](https://discourse.julialang.org/u/MrRobot)\
**Replies:** 3\
**Last updated:** [February 26, 2019, 8:59am UTC](https://discourse.julialang.org/t/custom-indices-range-for-arrays/21203 "2019-02-26T08:59:54Z")

</div>

The Julia manual talks about being able to define custom unit ranges Arrays with custom indices · The Julia Language. There are at least 3 packages that deal with this. 1) GitHub - JuliaArrays/CustomUnitRanges.jl: Packa…

---

## [How to find the number of elements in a pointer to array from C?](https://discourse.julialang.org/t/how-to-find-the-number-of-elements-in-a-pointer-to-array-from-c/21195)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 3\
**Last updated:** [February 26, 2019, 1:34am UTC](https://discourse.julialang.org/t/how-to-find-the-number-of-elements-in-a-pointer-to-array-from-c/21195 "2019-02-26T01:34:47Z")

</div>

julia\> D = GMT.ogrfeatures2GMTdataset(colomb); ERROR: BoundsError: attempt to access 119-element Array{GMT.GMTdataset,1} at index \[127\] The thing happens at an instruction like this unsafe\_wrap(Array, x, np) and is caus…

---

## [Method error in Optim inside a function](https://discourse.julialang.org/t/method-error-in-optim-inside-a-function/21194)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 0\
**Last updated:** [February 26, 2019, 12:36am UTC](https://discourse.julialang.org/t/method-error-in-optim-inside-a-function/21194 "2019-02-26T00:36:49Z")

</div>

I programmed a saddle-finding function using Optim. It works fairly well, but when I try to use box optimization, it gives me a methods error. What is the problem? This works: function saddle2(f::Function, initx, inity…

---

## [Provide parameters and user-defined functions to neural\_ode in DiffEqFlux.jl](https://discourse.julialang.org/t/provide-parameters-and-user-defined-functions-to-neural-ode-in-diffeqflux-jl/21184)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 1\
**Last updated:** [February 25, 2019, 8:45pm UTC](https://discourse.julialang.org/t/provide-parameters-and-user-defined-functions-to-neural-ode-in-diffeqflux-jl/21184 "2019-02-25T20:45:42Z")

</div>

Hello, First, I would like to thanks the developers of DiffEqFlux.jl, this is an amazing work! I want to use the function neural\_ode to model the right-hand side of an ODE for transport of a particle : \\frac{dx}{dt} =…

---

## [Converting DateTime from custom time zone to UTC](https://discourse.julialang.org/t/converting-datetime-from-custom-time-zone-to-utc/21181)

<div class="topic-metadata">

**Author:** [@robertdj](https://discourse.julialang.org/u/robertdj)\
**Replies:** 3\
**Last updated:** [February 25, 2019, 7:54pm UTC](https://discourse.julialang.org/t/converting-datetime-from-custom-time-zone-to-utc/21181 "2019-02-25T19:54:20Z")

</div>

With the TimeZones package I can make a ZonedDateTime that has information about my timezone: t = ZonedDateTime(2019, 2, 25, 12, 34, 56, localzone()) I am in Central European Time so the above command returns 2019-02-2…

---

## [Disable fast-math for a specific function](https://discourse.julialang.org/t/disable-fast-math-for-a-specific-function/21160)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 6\
**Last updated:** [February 25, 2019, 4:05pm UTC](https://discourse.julialang.org/t/disable-fast-math-for-a-specific-function/21160 "2019-02-25T16:05:45Z")

</div>

I’ve written a large numeric simulation that benefits substantially from starting Julia with --math-mode=fast (79% speed-up). I know this flag can be dangerous, but up until now, everything has worked well. I’d now l…

---

## [Creating boxplot with or without notch (Plots, StatsPlots)](https://discourse.julialang.org/t/creating-boxplot-with-or-without-notch-plots-statsplots/20383)

<div class="topic-metadata">

**Author:** [@orhan\_abar](https://discourse.julialang.org/u/orhan_abar)\
**Replies:** 9\
**Last updated:** [February 25, 2019, 5:07pm UTC](https://discourse.julialang.org/t/creating-boxplot-with-or-without-notch-plots-statsplots/20383 "2019-02-25T17:07:17Z")

</div>

I am trying to create a plot which contains 3 boxplots. First one has 21 data point, second one has 26 and third one has 21 data points. I can create each one seperately using StatsPlots library. When I try to combine …

---

## [Replace (as opposed to add to) the default environment](https://discourse.julialang.org/t/replace-as-opposed-to-add-to-the-default-environment/21175)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 3\
**Last updated:** [February 25, 2019, 3:38pm UTC](https://discourse.julialang.org/t/replace-as-opposed-to-add-to-the-default-environment/21175 "2019-02-25T15:38:50Z")

</div>

One of the reasons to introduce Pkg3 and the code loading rules was to make projects more reproducible. This is why the following behaviour surprised me: when I switch to a new environment (\] activate myenv), it is adde…

---

## [Example / Image for EC2 GPU with Julia?](https://discourse.julialang.org/t/example-image-for-ec2-gpu-with-julia/21124)

<div class="topic-metadata">

**Author:** [@philip](https://discourse.julialang.org/u/philip)\
**Replies:** 4\
**Last updated:** [February 25, 2019, 2:00pm UTC](https://discourse.julialang.org/t/example-image-for-ec2-gpu-with-julia/21124 "2019-02-25T14:00:22Z")

</div>

I’m wondering if anyone with experience with GPU programming has examples of spinning up Amazon EC2 instances with GPUs and successfully running Julia on them. I take it the package installation process for getting Julia…

---

## [Logical operators in julia](https://discourse.julialang.org/t/logical-operators-in-julia/21141)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 8\
**Last updated:** [February 24, 2019, 5:32pm UTC](https://discourse.julialang.org/t/logical-operators-in-julia/21141 "2019-02-24T17:32:12Z")

</div>

Why the code below does not work in julia 1.0.3? it used to work earlier. data\_full\[(data\_full\[:is\_minor\] .== 1 ) & (data\_full\[:LA\_INC\] .\<= 0),:\] MethodError: no method matching &(::BitArray{1}, ::BitArray{1}) Closest …

---

## [Pkg: KeyError: key "git-tree-sha1" not found](https://discourse.julialang.org/t/pkg-keyerror-key-git-tree-sha1-not-found/21145)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 0\
**Last updated:** [February 24, 2019, 2:48pm UTC](https://discourse.julialang.org/t/pkg-keyerror-key-git-tree-sha1-not-found/21145 "2019-02-24T14:48:47Z")

</div>

In order to fix the error below, I need to merge #21692 which removes v0.0.4 of Grassmann The problem is that v0.0.4 points to a git sha1 which does not exist anymore, because of a force push (v1.1) pkg\> up Updating …

---

## [Julia equivalent to R %in%](https://discourse.julialang.org/t/julia-equivalent-to-r-in/21138)

<div class="topic-metadata">

**Author:** [@Graham\_W\_Griffiths](https://discourse.julialang.org/u/Graham_W_Griffiths)\
**Replies:** 3\
**Last updated:** [February 24, 2019, 1:13pm UTC](https://discourse.julialang.org/t/julia-equivalent-to-r-in/21138 "2019-02-24T13:13:47Z")

</div>

I am trying to find the Julia equivalent to the R statement: which(A %in% B) Any help appreciated

---

## [Structured array in PyCall](https://discourse.julialang.org/t/structured-array-in-pycall/21118)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 1\
**Last updated:** [February 24, 2019, 10:38am UTC](https://discourse.julialang.org/t/structured-array-in-pycall/21118 "2019-02-24T10:38:47Z")

</div>

I need to interface with a Python API which returns a structured array. Currently PyCall just returns PyObject array(..., dtype=...). Is it reasonably possible to convert it to some Julia-native format, like array of nam…

---

## [Buffering streams in Julia?](https://discourse.julialang.org/t/buffering-streams-in-julia/21129)

<div class="topic-metadata">

**Author:** [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)\
**Replies:** 1\
**Last updated:** [February 24, 2019, 1:26am UTC](https://discourse.julialang.org/t/buffering-streams-in-julia/21129 "2019-02-24T01:26:15Z")

</div>

Julia has a builtin API for streams. Is there an existing library that provides something similar to the bufio API in Go’s standard library, which makes it easy to add a buffering layer to encapsulate any given stream? T…

---

## [Enable caching on Appveyor](https://discourse.julialang.org/t/enable-caching-on-appveyor/20730)

<div class="topic-metadata">

**Author:** [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Replies:** 6\
**Last updated:** [February 23, 2019, 11:40pm UTC](https://discourse.julialang.org/t/enable-caching-on-appveyor/20730 "2019-02-23T23:40:58Z")

</div>

I have a package with some large dependencies that takes anywhere from 30 mins to hitting the 1h auto-cancel time limit on appveyor. It would be really nice to cache the built versions of the larger/slower dependencies o…

---

## [Plots.jl Interact with (pyplot) backend directly to turn off axes](https://discourse.julialang.org/t/plots-jl-interact-with-pyplot-backend-directly-to-turn-off-axes/21123)

<div class="topic-metadata">

**Author:** [@mopg](https://discourse.julialang.org/u/mopg)\
**Replies:** 0\
**Last updated:** [February 23, 2019, 9:30pm UTC](https://discourse.julialang.org/t/plots-jl-interact-with-pyplot-backend-directly-to-turn-off-axes/21123 "2019-02-23T21:30:19Z")

</div>

I’m using Plots.jl to draw a 3D plot (with PyPlot backend) and I’d like to turn off the axes. Note that this question is similar to Removing axes in Plots.jl 3D plot, Removing Grid and Plot Manipulation on PyPlot 3D Figu…

---

## [Query.jl extremely slow](https://discourse.julialang.org/t/query-jl-extremely-slow/21078)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 6\
**Last updated:** [February 23, 2019, 5:32pm UTC](https://discourse.julialang.org/t/query-jl-extremely-slow/21078 "2019-02-23T17:32:32Z")

</div>

I’m trying to use Query.jl for some basic filtering, but couldn’t get the result even after a very long wait. After reducing the number of columns, I get the output, but still it’s much much slower than plain DataFrame f…

---

## [Long-term support release (v1.0.3)](https://discourse.julialang.org/t/long-term-support-release-v1-0-3/21103)

<div class="topic-metadata">

**Author:** [@abuAnat](https://discourse.julialang.org/u/abuAnat)\
**Replies:** 1\
**Last updated:** [February 23, 2019, 7:31am UTC](https://discourse.julialang.org/t/long-term-support-release-v1-0-3/21103 "2019-02-23T07:31:25Z")

</div>

In the download page it is stated: Long-term support release (v1.0.3). What does that mean? should we stick to this version? Will the next stable release be (v2.0.x)?

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

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