# General Usage

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

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

**Page:** 860

---

## [How to define an everywhere defined function within a function](https://discourse.julialang.org/t/how-to-define-an-everywhere-defined-function-within-a-function/25044)

<div class="topic-metadata">

**Author:** [@dkarrasch](https://discourse.julialang.org/u/dkarrasch)\
**Replies:** 8\
**Last updated:** [June 7, 2019, 2:50pm UTC](https://discourse.julialang.org/t/how-to-define-an-everywhere-defined-function-within-a-function/25044 "2019-06-07T14:50:48Z")

</div>

In my package, I’d like to offer a convenience function like this: function gaussian(σ::Real=1.0) @eval function (x) exp(-abs2(x) / $(float(4σ))) end end I want the @eval because I don’t want the 4σ to …

---

## [Fast evaluation of multiple functions on multiple arguments](https://discourse.julialang.org/t/fast-evaluation-of-multiple-functions-on-multiple-arguments/25040)

<div class="topic-metadata">

**Author:** [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Replies:** 10\
**Last updated:** [June 7, 2019, 2:36pm UTC](https://discourse.julialang.org/t/fast-evaluation-of-multiple-functions-on-multiple-arguments/25040 "2019-06-07T14:36:46Z")

</div>

In my application I often have a bunch of functions that I need to evaluate on many arguments (i.e. each combination of function and argument). I thought of extending the Base.map function as follows: function Base.map…

---

## [How to deal with a Nullable DataFrame?](https://discourse.julialang.org/t/how-to-deal-with-a-nullable-dataframe/25013)

<div class="topic-metadata">

**Author:** [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Replies:** 3\
**Last updated:** [June 7, 2019, 9:43am UTC](https://discourse.julialang.org/t/how-to-deal-with-a-nullable-dataframe/25013 "2019-06-07T09:43:23Z")

</div>

I have a pretty huge csv file that contains missing values. In this case, the data of my dataframe becomes Nullable types. I have tried to apply the operation : df = unique!(df\[:city\]) LoadError: e\[91mMethodError: no …

---

## [Exp() of nonsquare matrix](https://discourse.julialang.org/t/exp-of-nonsquare-matrix/25036)

<div class="topic-metadata">

**Author:** [@hytonwons](https://discourse.julialang.org/u/hytonwons)\
**Replies:** 3\
**Last updated:** [June 7, 2019, 8:02am UTC](https://discourse.julialang.org/t/exp-of-nonsquare-matrix/25036 "2019-06-07T08:02:46Z")

</div>

Hi, I ran into an issue on exp() of a matrix. Here is a minimal reproducible example, and I’m using Julia 1.0.3: using LinearAlgebra exp(Matrix(1.0I, 2, 1)) The error I got is: DimensionMismatch("matrix is not squa…

---

## [How to use CairoMakie?](https://discourse.julialang.org/t/how-to-use-cairomakie/25001)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 6\
**Last updated:** [June 6, 2019, 9:17pm UTC](https://discourse.julialang.org/t/how-to-use-cairomakie/25001 "2019-06-06T21:17:55Z")

</div>

I can’t figure out, how to use Makie with CairoMakie and neither found tutorials on it. What I tried: (RealTimePlot-julia) pkg\> st Status \`C:\\Users\\EMI\\Documents\\cstamas\_SVN\\cstamas\\JuliaRobotics\\RealTimePlot-julia…

---

## [Using Module names for dispatch](https://discourse.julialang.org/t/using-module-names-for-dispatch/25010)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 6\
**Last updated:** [June 6, 2019, 5:28pm UTC](https://discourse.julialang.org/t/using-module-names-for-dispatch/25010 "2019-06-06T17:28:58Z")

</div>

I’m working on a metapackage (HermitianDiagonalization.jl) that implements a bunch of methods based on the functionality of some third-party packages (Arpack, ArnoldiMethod, etc…), provided they have been loaded by the u…

---

## [Efficiently Calculate Matrices Defined Recursively](https://discourse.julialang.org/t/efficiently-calculate-matrices-defined-recursively/25006)

<div class="topic-metadata">

**Author:** [@Joseph\_Saia](https://discourse.julialang.org/u/Joseph_Saia)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 12:48pm UTC](https://discourse.julialang.org/t/efficiently-calculate-matrices-defined-recursively/25006 "2019-06-06T12:48:11Z")

</div>

In my work I frequently have to calculate a long sequence (about N=10^6) of small matrices (about 3x3) that are defined recursively like X\_t = f(X\_{t-1}). The object of interest is the entire chain of matrices so I need …

---

## [Waiting for lock on pidfile .jlassetregistry.lock](https://discourse.julialang.org/t/waiting-for-lock-on-pidfile-jlassetregistry-lock/24962)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 9:23am UTC](https://discourse.julialang.org/t/waiting-for-lock-on-pidfile-jlassetregistry-lock/24962 "2019-06-06T09:23:55Z")

</div>

A module of mine is using several other modules/packages. When I load my module @everywhere I get infos about “waiting for lock on pidfile .jlassetregistry.lock”. Can someone help me understand this? Can I find out whi…

---

## [How to install matlab in julia and how to occupy it](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 6\
**Last updated:** [June 6, 2019, 8:36am UTC](https://discourse.julialang.org/t/how-to-install-matlab-in-julia-and-how-to-occupy-it/24994 "2019-06-06T08:36:28Z")

</div>

I need Matlab in julia…

---

## [Type defintions of composite types with concrete dimensions](https://discourse.julialang.org/t/type-defintions-of-composite-types-with-concrete-dimensions/24991)

<div class="topic-metadata">

**Author:** [@Volker](https://discourse.julialang.org/u/Volker)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 8:04am UTC](https://discourse.julialang.org/t/type-defintions-of-composite-types-with-concrete-dimensions/24991 "2019-06-06T08:04:35Z")

</div>

Hello, I would like to improve the performance of my code. And now starting to make stable types. Is it possible to create types with a concrete dimension in a struct with other fields of the struct? I know that this is…

---

## [How can I evaluate a Julia function with sin/cos as real value?](https://discourse.julialang.org/t/how-can-i-evaluate-a-julia-function-with-sin-cos-as-real-value/24988)

<div class="topic-metadata">

**Author:** [@Nha\_Dinh\_Cao](https://discourse.julialang.org/u/Nha_Dinh_Cao)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 12:39am UTC](https://discourse.julialang.org/t/how-can-i-evaluate-a-julia-function-with-sin-cos-as-real-value/24988 "2019-06-06T00:39:16Z")

</div>

Hi everyone, I have a Julia function like f(x) = x + sin(x), and then I try to type f(2), which returns 2 + sin(2). I think it is great, but is there anything to make it returns a single real number? Thank you. It would…

---

## [Standard streams much slower in Windows than in Linux](https://discourse.julialang.org/t/standard-streams-much-slower-in-windows-than-in-linux/24924)

<div class="topic-metadata">

**Author:** [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Replies:** 4\
**Last updated:** [June 5, 2019, 9:52pm UTC](https://discourse.julialang.org/t/standard-streams-much-slower-in-windows-than-in-linux/24924 "2019-06-05T21:52:21Z")

</div>

While testing Gaston in Windows, I discovered that it was running much slower than in Linux. A simple plot in Windows could take a few seconds, while in Linux it is basically instantaneous. Some tests seemed to point to …

---

## [Can a FunctionWrapper be used with a function that isn't type stable?](https://discourse.julialang.org/t/can-a-functionwrapper-be-used-with-a-function-that-isnt-type-stable/24977)

<div class="topic-metadata">

**Author:** [@danielmatz](https://discourse.julialang.org/u/danielmatz)\
**Replies:** 2\
**Last updated:** [June 5, 2019, 9:36pm UTC](https://discourse.julialang.org/t/can-a-functionwrapper-be-used-with-a-function-that-isnt-type-stable/24977 "2019-06-05T21:36:40Z")

</div>

I’ve been experimenting with using FunctionWrappers.jl. When I try to create a FunctionWrapper for a function that doesn’t have a stable return type, I get a segfault. Is that a limitation of FunctionWrapper, or is tha…

---

## [Problem with a variable](https://discourse.julialang.org/t/problem-with-a-variable/24954)

<div class="topic-metadata">

**Author:** [@opihor](https://discourse.julialang.org/u/opihor)\
**Replies:** 2\
**Last updated:** [June 5, 2019, 2:17pm UTC](https://discourse.julialang.org/t/problem-with-a-variable/24954 "2019-06-05T14:17:09Z")

</div>

Why this code doesn’t work ? I have the error : maxL not defined " maxL=0 for j in 1:size(jobs\_in\_file,1) if ((ordered\_jobs\[j\].start\_time + ordered\_jobs\[j\].proc) \> ordered\_jobs\[j\].due) maxl1 = maxL + 0 maxL = max(o…

---

## [How to test whether a function is dispatched correctly?](https://discourse.julialang.org/t/how-to-test-whether-a-function-is-dispatched-correctly/24959)

<div class="topic-metadata">

**Author:** [@1115](https://discourse.julialang.org/u/1115)\
**Replies:** 14\
**Last updated:** [June 5, 2019, 2:04pm UTC](https://discourse.julialang.org/t/how-to-test-whether-a-function-is-dispatched-correctly/24959 "2019-06-05T14:04:20Z")

</div>

e.g. foo(x::Int) = fpp(x) foo(x::Float64) = fqq(x) @test iscalled(foo, 1.0, fqq)

---

## [How to take values from imgui inputs?](https://discourse.julialang.org/t/how-to-take-values-from-imgui-inputs/24938)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 1\
**Last updated:** [June 5, 2019, 8:13am UTC](https://discourse.julialang.org/t/how-to-take-values-from-imgui-inputs/24938 "2019-06-05T08:13:54Z")

</div>

Hi, I want to use some values from imgui inputs: CImGui.Begin("Pop-up menu") CImGui.Button("Stacked modals..") && CImGui.OpenPopup("Stacked 1") if CImGui.BeginPopupModal("Stacked 1", C\_NULL, CImGui.ImGuiWind…

---

## [ReadOnlyMemoryError with SubArray](https://discourse.julialang.org/t/readonlymemoryerror-with-subarray/24914)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 10\
**Last updated:** [June 5, 2019, 7:31am UTC](https://discourse.julialang.org/t/readonlymemoryerror-with-subarray/24914 "2019-06-05T07:31:59Z")

</div>

I’m getting a ReadOnlyMemoryError from: julia\> t .-= t\[1\] ERROR: ReadOnlyMemoryError() Stacktrace: \[1\] - at ./float.jl:397 \[inlined\] \[2\] \_broadcast\_getindex\_evalf at ./broadcast.jl:578 \[inlined\] \[3\] \_broadcast\_getind…

---

## [\`tempdir()\` differences in Windows and Linux](https://discourse.julialang.org/t/tempdir-differences-in-windows-and-linux/24930)

<div class="topic-metadata">

**Author:** [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Replies:** 6\
**Last updated:** [June 5, 2019, 6:49am UTC](https://discourse.julialang.org/t/tempdir-differences-in-windows-and-linux/24930 "2019-06-05T06:49:23Z")

</div>

Using Julia v1.1.0 on Windows 10, tempdir() returns a path with a separator at the end: julia\> tempdir() “C:\\Users\\mxbiee\\AppData\\Local\\Temp\\” and on Linux, it doesn’t: julia\> tempdir() “/tmp” This caused some mild…

---

## [String substitution with interpolation](https://discourse.julialang.org/t/string-substitution-with-interpolation/24949)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 1\
**Last updated:** [June 5, 2019, 6:36am UTC](https://discourse.julialang.org/t/string-substitution-with-interpolation/24949 "2019-06-05T06:36:57Z")

</div>

Hello, I’d like to have something like: foo(rs::String, t::String) = replace(rs, r"(aa|bb)" =\> s"\\1$(t)") Note the replacement string uses both a substitution (\\1) and an interpolation ($t). This does not seem to be al…

---

## [Proposal: broadcast operator for primitive types](https://discourse.julialang.org/t/proposal-broadcast-operator-for-primitive-types/24917)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 8\
**Last updated:** [June 5, 2019, 6:36am UTC](https://discourse.julialang.org/t/proposal-broadcast-operator-for-primitive-types/24917 "2019-06-05T06:36:14Z")

</div>

Hi! I was coding something today, and I have a variable V which can be of many types (Int, Float32, Float64, and so on). However, I need to limit the value of this variable. What I did was: V \> +10 && (V = eltype(V)(+1…

---

## [Long-Term Stable Support](https://discourse.julialang.org/t/long-term-stable-support/24941)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 8\
**Last updated:** [June 5, 2019, 6:06am UTC](https://discourse.julialang.org/t/long-term-stable-support/24941 "2019-06-05T06:06:03Z")

</div>

Hi everyone! I’m quite new to Julia and programming in general, with enough experience in Matlab with OOP and can understand the flow of C++ code. So please forgive any demonstrated inability to express what my question …

---

## [Can you have Julia in console mode and Juno and be able to open them both at the same time?](https://discourse.julialang.org/t/can-you-have-julia-in-console-mode-and-juno-and-be-able-to-open-them-both-at-the-same-time/24867)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 4\
**Last updated:** [June 5, 2019, 5:44am UTC](https://discourse.julialang.org/t/can-you-have-julia-in-console-mode-and-juno-and-be-able-to-open-them-both-at-the-same-time/24867 "2019-06-05T05:44:08Z")

</div>

Can you have Julia in console mode and Juno and be able to open them both at the same time? I require to use both 1.- Julia in cosola mode 2.- Juno (IDE) How can I do it because I only have Julia in console mode and …

---

## [How do I re-activate the primary/default environment? (Pkg3)](https://discourse.julialang.org/t/how-do-i-re-activate-the-primary-default-environment-pkg3/24933)

<div class="topic-metadata">

**Author:** [@anon32405968](https://discourse.julialang.org/u/anon32405968)\
**Replies:** 1\
**Last updated:** [June 4, 2019, 6:44pm UTC](https://discourse.julialang.org/t/how-do-i-re-activate-the-primary-default-environment-pkg3/24933 "2019-06-04T18:44:32Z")

</div>

If I want to update my Julia module’s Manifest I can navigate to its root directory, press \] to go into package mode, then activate . to activate its directory, and finally I can add the package. Let’s say I don’t have …

---

## [Go from \`pkg\>\` prompt to \`julia\>\` prompt?](https://discourse.julialang.org/t/go-from-pkg-prompt-to-julia-prompt/24929)

<div class="topic-metadata">

**Author:** [@curious](https://discourse.julialang.org/u/curious)\
**Replies:** 5\
**Last updated:** [June 4, 2019, 6:35pm UTC](https://discourse.julialang.org/t/go-from-pkg-prompt-to-julia-prompt/24929 "2019-06-04T18:35:05Z")

</div>

Very basic question. How does one go from pkg\> prompt to julia\> prompt in the Julia REPL? For example, if I just press enter at an empty shell\> prompt, it takes me back to julia\> prompt. Currently, to go from pkg\> to jul…

---

## [Possible bug in dropmissing!](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 7\
**Last updated:** [June 4, 2019, 6:07pm UTC](https://discourse.julialang.org/t/possible-bug-in-dropmissing/24817 "2019-06-04T18:07:04Z")

</div>

I am dropping rows containing missing values from a dataframe. In 122607 rows, 29 rows contain at least one missing value. I can confirm this 2 ways. First, I wrote a function that counts rows containing 1 or more mis…

---

## [Weave: continue after error](https://discourse.julialang.org/t/weave-continue-after-error/24923)

<div class="topic-metadata">

**Author:** [@ksamtsak](https://discourse.julialang.org/u/ksamtsak)\
**Replies:** 2\
**Last updated:** [June 4, 2019, 4:45pm UTC](https://discourse.julialang.org/t/weave-continue-after-error/24923 "2019-06-04T16:45:53Z")

</div>

I’m using Weave.jl to generate a walkthrough of a design process. It’s natural in a walkthrough to want to include code that produces an error and then say, X causes an error, let’s do Y. However, it doesn’t look like …

---

## [Cant push! JuliaInterpreter.compiled\_methods](https://discourse.julialang.org/t/cant-push-juliainterpreter-compiled-methods/24901)

<div class="topic-metadata">

**Author:** [@Bokken](https://discourse.julialang.org/u/Bokken)\
**Replies:** 2\
**Last updated:** [June 4, 2019, 11:30am UTC](https://discourse.julialang.org/t/cant-push-juliainterpreter-compiled-methods/24901 "2019-06-04T11:30:07Z")

</div>

How can I add a function to JuliaInterpreter.compiled\_methods? function println\_(x) println(x) end push!(JuliaInterpreter.compiled\_methods,println\_) ----\> MethodError: Cannot convert an object of type typeof(println…

---

## [Julia-client pinned version](https://discourse.julialang.org/t/julia-client-pinned-version/24912)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 2\
**Last updated:** [June 4, 2019, 10:45am UTC](https://discourse.julialang.org/t/julia-client-pinned-version/24912 "2019-06-04T10:45:46Z")

</div>

Hi, I am using JuliaPro and the Settings says that some packages like julia-client and ink are not being checked for updates. If I type Pkg.free(“julia-client”), I get an error The following package names could not be…

---

## [Argument destructuring and anonymous functions](https://discourse.julialang.org/t/argument-destructuring-and-anonymous-functions/24893)

<div class="topic-metadata">

**Author:** [@tanders](https://discourse.julialang.org/u/tanders)\
**Replies:** 8\
**Last updated:** [June 4, 2019, 7:16am UTC](https://discourse.julialang.org/t/argument-destructuring-and-anonymous-functions/24893 "2019-06-04T07:16:15Z")

</div>

Dear all, It seems that argument destructuring (Functions · The Julia Language) works for named but not anonymous functions (see examples below). Is there a reason for that, or am I just missing something as a newbie? T…

---

## [Way to recreate OrderedDict under new sorting function?](https://discourse.julialang.org/t/way-to-recreate-ordereddict-under-new-sorting-function/24900)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 2\
**Last updated:** [June 4, 2019, 3:37am UTC](https://discourse.julialang.org/t/way-to-recreate-ordereddict-under-new-sorting-function/24900 "2019-06-04T03:37:43Z")

</div>

Lets say you have an ordered dict: using DataStructures cur\_dict = OrderedDict() And you then do two rounds of key inserts: foreach(cur\_value -\> cur\_dict\[cur\_value\] = cur\_value+rand()/2, 1:2:9) foreach(cur\_value -\> cu…

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

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