# General Usage

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

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

**Page:** 822

---

## [Libdl.dlopen can't find dependencies on workers while loading a shared library even though ldd detects the correct paths](https://discourse.julialang.org/t/libdl-dlopen-cant-find-dependencies-on-workers-while-loading-a-shared-library-even-though-ldd-detects-the-correct-paths/30156)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [October 22, 2019, 6:40am UTC](https://discourse.julialang.org/t/libdl-dlopen-cant-find-dependencies-on-workers-while-loading-a-shared-library-even-though-ldd-detects-the-correct-paths/30156 "2019-10-22T06:40:19Z")

</div>

I’m trying to call a fortran code that depends on lapack, blas, fftw3 etc that is compiled so a “.so” file on Linux. I am trying to run it on a SLURM cluster after submitting a job interactively. I can load the on a sing…

---

## [Create lead and lag variable in DataFrame](https://discourse.julialang.org/t/create-lead-and-lag-variable-in-dataframe/8658)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 14\
**Last updated:** [October 22, 2019, 5:05am UTC](https://discourse.julialang.org/t/create-lead-and-lag-variable-in-dataframe/8658 "2019-10-22T05:05:39Z")

</div>

I am trying to create a lag and lead variable in DataFrame, in R and Python this can be easily done with lag, lead, and shift function, but I still could not get it done in Julia. My code is like this (does not work): …

---

## [Question about using the name "flux" in package name](https://discourse.julialang.org/t/question-about-using-the-name-flux-in-package-name/30060)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 3\
**Last updated:** [October 21, 2019, 10:27pm UTC](https://discourse.julialang.org/t/question-about-using-the-name-flux-in-package-name/30060 "2019-10-21T22:27:24Z")

</div>

Hi, So I’ve made a package for which I think there is a remote chance that someone might find useful, so I would like to register it. I’m however getting cold feet due to the name I chose back when I just wanted to sta…

---

## [Unexpected scope issue](https://discourse.julialang.org/t/unexpected-scope-issue/30145)

<div class="topic-metadata">

**Author:** [@marcusps](https://discourse.julialang.org/u/marcusps)\
**Replies:** 2\
**Last updated:** [October 21, 2019, 8:20pm UTC](https://discourse.julialang.org/t/unexpected-scope-issue/30145 "2019-10-21T20:20:29Z")

</div>

If I try to run the following a = 1:10 while length(a)\>0 \[0 for i in a\] a = first(a)+1:last(a) end I get an UndefVarError: a not defined error. If I add a global a like so a = 1:10 while length(a)\>0 global a …

---

## [Use a Histogram as a function](https://discourse.julialang.org/t/use-a-histogram-as-a-function/30059)

<div class="topic-metadata">

**Author:** [@bobweek](https://discourse.julialang.org/u/bobweek)\
**Replies:** 4\
**Last updated:** [October 21, 2019, 4:51pm UTC](https://discourse.julialang.org/t/use-a-histogram-as-a-function/30059 "2019-10-21T16:51:24Z")

</div>

I would like to see built-in functionality that allows me to use a Histogram as a function that returns the weight of the histogram at a given point in state space. The closest thing i can find is the kde() function fr…

---

## [What's going on with the installation of HTTP package?](https://discourse.julialang.org/t/whats-going-on-with-the-installation-of-http-package/30137)

<div class="topic-metadata">

**Author:** [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)\
**Replies:** 1\
**Last updated:** [October 21, 2019, 3:41pm UTC](https://discourse.julialang.org/t/whats-going-on-with-the-installation-of-http-package/30137 "2019-10-21T15:41:34Z")

</div>

Hi, I upgraded an old project from julia 0.6 to 0.7. I could resolve most of the deprecations but I ran into the problem that I was using the package HttpServer.jl and that cannot be installed anymore via Pkg. So I trie…

---

## [Question with DiffEqBiological](https://discourse.julialang.org/t/question-with-diffeqbiological/30119)

<div class="topic-metadata">

**Author:** [@David\_Wang](https://discourse.julialang.org/u/David_Wang)\
**Replies:** 5\
**Last updated:** [October 21, 2019, 1:11pm UTC](https://discourse.julialang.org/t/question-with-diffeqbiological/30119 "2019-10-21T13:11:40Z")

</div>

Hi all, I have been running into a problem with the DiffEqBiological package. The following code always returns “ERROR: LoadError: Base.Meta.ParseError(”+1")": rn = @reaction\_network begin 1.0, 0 → M end whereas th…

---

## [Pin dependency at current state](https://discourse.julialang.org/t/pin-dependency-at-current-state/30128)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 3\
**Last updated:** [October 21, 2019, 1:03pm UTC](https://discourse.julialang.org/t/pin-dependency-at-current-state/30128 "2019-10-21T13:03:54Z")

</div>

I want my project Project to depend on an unregistered and untagged version of a registered package ToolBox. Is this a valid way to accomplish this? pkg\>add ToolBox#master pkg\>pin ToolBox When I would at a later time i…

---

## [Equivalent to Perl Use Strict](https://discourse.julialang.org/t/equivalent-to-perl-use-strict/30129)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 1\
**Last updated:** [October 21, 2019, 11:15am UTC](https://discourse.julialang.org/t/equivalent-to-perl-use-strict/30129 "2019-10-21T11:15:04Z")

</div>

Is there an equivalent in Julia of the Perl Use Strict compiler flag? This means that all variables must be declared. Very useful for the case I just had where I mistyped a variable name when assigning a string value (i…

---

## [Is this bitcast function sane and safe?](https://discourse.julialang.org/t/is-this-bitcast-function-sane-and-safe/30045)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 9\
**Last updated:** [October 21, 2019, 7:45am UTC](https://discourse.julialang.org/t/is-this-bitcast-function-sane-and-safe/30045 "2019-10-21T07:45:22Z")

</div>

I would like to take the bits of one struct and reinterpret them as the bits of another type. Semantically the following does the desired job: function check\_bitcast(T, s) S = typeof(s) isbitstype(T) || throw(Ar…

---

## [Cannot open Julia Observer](https://discourse.julialang.org/t/cannot-open-julia-observer/30053)

<div class="topic-metadata">

**Author:** [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Replies:** 3\
**Last updated:** [October 20, 2019, 9:32pm UTC](https://discourse.julialang.org/t/cannot-open-julia-observer/30053 "2019-10-20T21:32:59Z")

</div>

Cannot open Julia Observer from within https://julialang.org/ page. Get always: 504 ERROR The request could not be satisfied. Also trying to open Julia Observer using Chrome fails, too. Any suggestions?

---

## [Array containing references?](https://discourse.julialang.org/t/array-containing-references/30091)

<div class="topic-metadata">

**Author:** [@nmatzke](https://discourse.julialang.org/u/nmatzke)\
**Replies:** 7\
**Last updated:** [October 20, 2019, 8:39pm UTC](https://discourse.julialang.org/t/array-containing-references/30091 "2019-10-20T20:39:51Z")

</div>

Hi all, Is there a way to store references in an array? Basically, I would like to have a huge array of event rates (array A), however the rates are specified in just a few parameters (e.g. a,b,c,d,e) which are referre…

---

## [Abstract type functions](https://discourse.julialang.org/t/abstract-type-functions/30113)

<div class="topic-metadata">

**Author:** [@PeterD](https://discourse.julialang.org/u/PeterD)\
**Replies:** 2\
**Last updated:** [October 20, 2019, 7:39pm UTC](https://discourse.julialang.org/t/abstract-type-functions/30113 "2019-10-20T19:39:40Z")

</div>

With the new Julia 1.3 release candidates out, I’m trying to take advantage of defining a function on an abstract type. However struggling big time to figure out how to leverage it when also using modules. The below exa…

---

## [RecipesBase: Text in plot recipe?](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 5\
**Last updated:** [October 20, 2019, 10:14am UTC](https://discourse.julialang.org/t/recipesbase-text-in-plot-recipe/30092 "2019-10-20T10:14:28Z")

</div>

Is there a way to add text to a plot recipe? I’ve tried @annotate and a variety of things without success. The docs don’t mention it - that I can find anyways : Recipes · Plots

---

## [What options can I tweak to make Juno feel less lethargic?](https://discourse.julialang.org/t/what-options-can-i-tweak-to-make-juno-feel-less-lethargic/30077)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 13\
**Last updated:** [October 20, 2019, 9:41am UTC](https://discourse.julialang.org/t/what-options-can-i-tweak-to-make-juno-feel-less-lethargic/30077 "2019-10-20T09:41:28Z")

</div>

I open up Juno and I try using CSV and it feels like 30s has passed before it can register the action. Normally, in Julia REPL it only takes about 3s. What options can I choose to helpo with this? I tried cycler, it did…

---

## [Why does Juno make my code run slower than in VScode?](https://discourse.julialang.org/t/why-does-juno-make-my-code-run-slower-than-in-vscode/7846)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 18\
**Last updated:** [October 20, 2019, 9:29am UTC](https://discourse.julialang.org/t/why-does-juno-make-my-code-run-slower-than-in-vscode/7846 "2019-10-20T09:29:56Z")

</div>

I have the below code and I run it in Juno it takes 3.7 seconds and I run it in VScode it’s 1.48 seconds. Is the issue Juno? Does Juno intercept the results in such a way to make it run slower? Both are running Julia 0…

---

## [Fastest way to draw on Gtk.jl 'canvas' with plots produced from Plots.jl?](https://discourse.julialang.org/t/fastest-way-to-draw-on-gtk-jl-canvas-with-plots-produced-from-plots-jl/29420)

<div class="topic-metadata">

**Author:** [@mantzaris](https://discourse.julialang.org/u/mantzaris)\
**Replies:** 28\
**Last updated:** [October 20, 2019, 8:11am UTC](https://discourse.julialang.org/t/fastest-way-to-draw-on-gtk-jl-canvas-with-plots-produced-from-plots-jl/29420 "2019-10-20T08:11:28Z")

</div>

I am using Gtk to display on a canvas images which are plots/figures produced in Plots via GR. The workflow I use is to save the figure to a png, and then load it in the draw function for Gtk where the canvas surface is …

---

## [Do you wish you were running Sublime Text 3?](https://discourse.julialang.org/t/do-you-wish-you-were-running-sublime-text-3/30096)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 0\
**Last updated:** [October 20, 2019, 6:32am UTC](https://discourse.julialang.org/t/do-you-wish-you-were-running-sublime-text-3/30096 "2019-10-20T06:32:13Z")

</div>

But the configuration seems like a hassle? If your environment is 64-bit Windows, you are in luck. I have posted HERE a configured portable Sublime Text 3. All one has to do is download the zip file, unpack, and run the …

---

## [Inaccurate sampling of profiler?](https://discourse.julialang.org/t/inaccurate-sampling-of-profiler/30030)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 4\
**Last updated:** [October 19, 2019, 10:02pm UTC](https://discourse.julialang.org/t/inaccurate-sampling-of-profiler/30030 "2019-10-19T22:02:54Z")

</div>

I try to benchmark multiplication between matrices and multilication between one matrix and one number. Here’s the code: using LinearAlgebra BLAS.set\_num\_threads(1) A = rand(ComplexF64, 1000, 1000) B = rand(ComplexF64…

---

## [Code loading with workers and modules](https://discourse.julialang.org/t/code-loading-with-workers-and-modules/30064)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 7\
**Last updated:** [October 19, 2019, 2:07pm UTC](https://discourse.julialang.org/t/code-loading-with-workers-and-modules/30064 "2019-10-19T14:07:10Z")

</div>

I’m a bit lost on how to load code into worker processes. I’m getting the error: KeyError: key \[mypackagename\] \[502b64d0-c436-11e9-3033-a3ceb19233e3\] not found This is resulting from a pmap call inside a function in an…

---

## [Why does this method signature turns 2 methods instead of 1?](https://discourse.julialang.org/t/why-does-this-method-signature-turns-2-methods-instead-of-1/30085)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 5\
**Last updated:** [October 19, 2019, 6:11pm UTC](https://discourse.julialang.org/t/why-does-this-method-signature-turns-2-methods-instead-of-1/30085 "2019-10-19T18:11:27Z")

</div>

julia\> f(x::Int) = "A" f (generic function with 2 methods) julia\> f(x::Union{Int,Float64}) = "B" f (generic function with 3 methods) julia\> methods(f,Tuple{Union{Int,Float64}}) # 2 methods for generic function "f": \[1\]…

---

## [Managing Single and Multithreaded Implementations](https://discourse.julialang.org/t/managing-single-and-multithreaded-implementations/30083)

<div class="topic-metadata">

**Author:** [@sjkelly](https://discourse.julialang.org/u/sjkelly)\
**Replies:** 1\
**Last updated:** [October 19, 2019, 4:07pm UTC](https://discourse.julialang.org/t/managing-single-and-multithreaded-implementations/30083 "2019-10-19T16:07:13Z")

</div>

As a library maintainer what are some good idioms for managing implementations of single threaded and multi threaded algorithm implementations? Yesterday I implemented an algorithm three ways, with channels, locks, and …

---

## [InexactError when trying to define in DynamicalSystems.jl](https://discourse.julialang.org/t/inexacterror-when-trying-to-define-in-dynamicalsystems-jl/30076)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 2\
**Last updated:** [October 19, 2019, 2:37pm UTC](https://discourse.julialang.org/t/inexacterror-when-trying-to-define-in-dynamicalsystems-jl/30076 "2019-10-19T14:37:42Z")

</div>

I am trying to create a dynamical system using the DynamicalSystems.jl package. However, I am encountering a very basic problem when trying to define a system. using DynamicalSystems; function L63\_eom!(du, u, p, t) …

---

## [Pkg.installed() in nightlies](https://discourse.julialang.org/t/pkg-installed-in-nightlies/30072)

<div class="topic-metadata">

**Author:** [@zgornel](https://discourse.julialang.org/u/zgornel)\
**Replies:** 2\
**Last updated:** [October 19, 2019, 11:28am UTC](https://discourse.julialang.org/t/pkg-installed-in-nightlies/30072 "2019-10-19T11:28:21Z")

</div>

Pkg.installed() seems to be missing from julia 1.4+. Was it moved or renamed?

---

## [Xor performance](https://discourse.julialang.org/t/xor-performance/29830)

<div class="topic-metadata">

**Author:** [@lalvim](https://discourse.julialang.org/u/lalvim)\
**Replies:** 3\
**Last updated:** [October 18, 2019, 6:40pm UTC](https://discourse.julialang.org/t/xor-performance/29830 "2019-10-18T18:40:08Z")

</div>

Hello. I am developing a method that uses a compact representation of bitwise arrays instead of using boolean or even float vectors. One of the advantages, besides compression, is the xor operation that operates efficien…

---

## [Use of eval in closed module and "incremental compilation may be broken"](https://discourse.julialang.org/t/use-of-eval-in-closed-module-and-incremental-compilation-may-be-broken/30028)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 5\
**Last updated:** [October 18, 2019, 5:09pm UTC](https://discourse.julialang.org/t/use-of-eval-in-closed-module-and-incremental-compilation-may-be-broken/30028 "2019-10-18T17:09:44Z")

</div>

In Package A we would like to offer facilities to write metadata about models of a specific type that would be written in other packages, say B. To do this we have something like this In Package A: module A input\_type…

---

## [Evaluate expression with variables from a dictionary](https://discourse.julialang.org/t/evaluate-expression-with-variables-from-a-dictionary/30047)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 7\
**Last updated:** [October 18, 2019, 4:29pm UTC](https://discourse.julialang.org/t/evaluate-expression-with-variables-from-a-dictionary/30047 "2019-10-18T16:29:01Z")

</div>

I have a set of variables stored in a Dict{Symbol, Any} like this: data = Dict( :a=\>1, :b=\>2, :c=\>3 # etc. ) Then I’ve got a set of calculations that are defined as expressions with variable names that m…

---

## [Can I make this code use multiple threads?](https://discourse.julialang.org/t/can-i-make-this-code-use-multiple-threads/30049)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 3\
**Last updated:** [October 18, 2019, 12:57pm UTC](https://discourse.julialang.org/t/can-i-make-this-code-use-multiple-threads/30049 "2019-10-18T12:57:09Z")

</div>

I have an expensive evaluation function, that takes long to compute and I run this over multiple objects. In theory these comuptations are independent of each other (though they use the same arguments for the evaluation)…

---

## [Javascript parser](https://discourse.julialang.org/t/javascript-parser/30052)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 0\
**Last updated:** [October 18, 2019, 11:20am UTC](https://discourse.julialang.org/t/javascript-parser/30052 "2019-10-18T11:20:00Z")

</div>

Hi, does anyobody know about parser for javascript, which would output AST?

---

## [How to store many variables of type AffineMap?](https://discourse.julialang.org/t/how-to-store-many-variables-of-type-affinemap/30016)

<div class="topic-metadata">

**Author:** [@Moses](https://discourse.julialang.org/u/Moses)\
**Replies:** 2\
**Last updated:** [October 18, 2019, 6:15am UTC](https://discourse.julialang.org/t/how-to-store-many-variables-of-type-affinemap/30016 "2019-10-18T06:15:37Z")

</div>

Dear community. This is following up on an earlier question of me (here). I opened this thread, because my current question no longer fits the original one. My problem is that I need to loop through a stack of a few hu…

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

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