# General Usage

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

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

**Page:** 831

---

## [makeAnagram, there is an error that i cannot find in my code](https://discourse.julialang.org/t/makeanagram-there-is-an-error-that-i-cannot-find-in-my-code/29032)

<div class="topic-metadata">

**Author:** [@Fuad\_Sami](https://discourse.julialang.org/u/Fuad_Sami)\
**Replies:** 14\
**Last updated:** [September 21, 2019, 7:47pm UTC](https://discourse.julialang.org/t/makeanagram-there-is-an-error-that-i-cannot-find-in-my-code/29032 "2019-09-21T19:47:28Z")

</div>

i need to write a function for two strings, and , that may or may not be of the same length, determine the minimum number of character deletions required to make and anagrams. Any characters can be deleted from either…

---

## [The way to deploy the user-defined package](https://discourse.julialang.org/t/the-way-to-deploy-the-user-defined-package/28986)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 4\
**Last updated:** [September 21, 2019, 7:36pm UTC](https://discourse.julialang.org/t/the-way-to-deploy-the-user-defined-package/28986 "2019-09-21T19:36:27Z")

</div>

I have created two packages created as follows. (1) Create PackageA step1: generate PackageA step2: add code step3: cd PackageA dev . # deploy PackageA (2) Create PackageB depending on PackageA step1: gener…

---

## [Potential performance regression wrt 0.6: Products involving diagonal matrices MUCH slower than with general sparse matrices](https://discourse.julialang.org/t/potential-performance-regression-wrt-0-6-products-involving-diagonal-matrices-much-slower-than-with-general-sparse-matrices/29005)

<div class="topic-metadata">

**Author:** [@FHulsemann](https://discourse.julialang.org/u/FHulsemann)\
**Replies:** 7\
**Last updated:** [September 21, 2019, 5:09pm UTC](https://discourse.julialang.org/t/potential-performance-regression-wrt-0-6-products-involving-diagonal-matrices-much-slower-than-with-general-sparse-matrices/29005 "2019-09-21T17:09:20Z")

</div>

Hello. It so happens that I need to normalize sparse (real) matrices from time to time. Moving to v0.7 (and later), I have come across some surprising behaviour involving Diagonal (sparse) matrices. This example illustr…

---

## [Generating multithreaded functions?](https://discourse.julialang.org/t/generating-multithreaded-functions/28717)

<div class="topic-metadata">

**Author:** [@Sheemon7](https://discourse.julialang.org/u/Sheemon7)\
**Replies:** 2\
**Last updated:** [September 21, 2019, 2:16pm UTC](https://discourse.julialang.org/t/generating-multithreaded-functions/28717 "2019-09-21T14:16:46Z")

</div>

Is it possible to somehow generate functions with a multithreaded for-loop with @threads macro (or any other construct with the same fuctionality)? The straightforward way fails julia\> @generated function f(x::Integer)…

---

## [Where is error message on the remote worker?](https://discourse.julialang.org/t/where-is-error-message-on-the-remote-worker/28898)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 14\
**Last updated:** [September 20, 2019, 6:28pm UTC](https://discourse.julialang.org/t/where-is-error-message-on-the-remote-worker/28898 "2019-09-20T18:28:15Z")

</div>

The following code should give an error since foo is not defined on process 2. using Distributed addprocs() function foo() return 1 end remote\_do(foo, 2) I expect some error message somewhere, but the above code…

---

## [Make pkg\> test . run the tests for the current project](https://discourse.julialang.org/t/make-pkg-test-run-the-tests-for-the-current-project/29009)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 2\
**Last updated:** [September 20, 2019, 5:00pm UTC](https://discourse.julialang.org/t/make-pkg-test-run-the-tests-for-the-current-project/29009 "2019-09-20T17:00:57Z")

</div>

@kristoffer.carlsson Just a thought: not sure if there’s a reason why pkg\> test only works with packages, but in my opinion, it would be very elegant if pkg\> test . would run the tests for the current project too. We’d…

---

## [JuliaDB offline usage](https://discourse.julialang.org/t/juliadb-offline-usage/28995)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 2\
**Last updated:** [September 20, 2019, 12:10pm UTC](https://discourse.julialang.org/t/juliadb-offline-usage/28995 "2019-09-20T12:10:57Z")

</div>

When using JuliaDB without a network connection, I get the following error message. The error seems to be that \_\_init\_\_() in the MemPool.jl package includes a getipaddr call which errors offline. Is JuliaDB.jl supposed …

---

## [Bad performance for dispatch-heavy code](https://discourse.julialang.org/t/bad-performance-for-dispatch-heavy-code/28989)

<div class="topic-metadata">

**Author:** [@erezsh](https://discourse.julialang.org/u/erezsh)\
**Replies:** 12\
**Last updated:** [September 20, 2019, 11:49am UTC](https://discourse.julialang.org/t/bad-performance-for-dispatch-heavy-code/28989 "2019-09-20T11:49:17Z")

</div>

I’m trying to write a compiler in Julia, and I’m getting very bad performance. Because it’s a multi-stage compiler, most of the code is just the same function for different types of ast. I made sure most of the structs …

---

## [Updating a static array, in a nested function without making a temporary array?](https://discourse.julialang.org/t/updating-a-static-array-in-a-nested-function-without-making-a-temporary-array/28980)

<div class="topic-metadata">

**Author:** [@Hieuphung](https://discourse.julialang.org/u/Hieuphung)\
**Replies:** 4\
**Last updated:** [September 20, 2019, 6:58am UTC](https://discourse.julialang.org/t/updating-a-static-array-in-a-nested-function-without-making-a-temporary-array/28980 "2019-09-20T06:58:40Z")

</div>

have been banging my head against a wall trying to use static arrays in julia. They are fast but updating them is a pain. This is no surprise, they are meant to be immutable! But it is continuously recommended to me th…

---

## [ANN: FinEtools (finite element library) design documentation (updated link)](https://discourse.julialang.org/t/ann-finetools-finite-element-library-design-documentation-updated-link/7194)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [September 20, 2019, 4:59am UTC](https://discourse.julialang.org/t/ann-finetools-finite-element-library-design-documentation-updated-link/7194 "2019-09-20T04:59:48Z")

</div>

For those who would like to explore FinEtools: I started writing up the documentation of the design of the library. https://petrkryslucsd.github.io/FinEtools.jl My aim is to make it rather easy to understand why thi…

---

## [Compile-time for large SizedArray (StaticArrays.jl)](https://discourse.julialang.org/t/compile-time-for-large-sizedarray-staticarrays-jl/28945)

<div class="topic-metadata">

**Author:** [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Replies:** 3\
**Last updated:** [September 20, 2019, 1:22am UTC](https://discourse.julialang.org/t/compile-time-for-large-sizedarray-staticarrays-jl/28945 "2019-09-20T01:22:14Z")

</div>

I noticed compile time rapidly increases for large SizedArrays. For example: julia\> using StaticArrays julia\> bench(a) = @time maximum(a) bench (generic function with 1 method) julia\> bench(randn(1\_000, 1\_000)) 0.0…

---

## [AxisArrays, iterate over all dimensions except certain ones?](https://discourse.julialang.org/t/axisarrays-iterate-over-all-dimensions-except-certain-ones/28487)

<div class="topic-metadata">

**Author:** [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Replies:** 2\
**Last updated:** [September 19, 2019, 9:53pm UTC](https://discourse.julialang.org/t/axisarrays-iterate-over-all-dimensions-except-certain-ones/28487 "2019-09-19T21:53:38Z")

</div>

Is there an easy way to iterate over all axes except certain ones? I.e. the negation of the inputs? My use case is a general function that works on images with an arbitrary number of dimensions, but needs to iterate over…

---

## [How to make a wrapper around a non-thread safe C library thread-safe](https://discourse.julialang.org/t/how-to-make-a-wrapper-around-a-non-thread-safe-c-library-thread-safe/28950)

<div class="topic-metadata">

**Author:** [@fabiangans](https://discourse.julialang.org/u/fabiangans)\
**Replies:** 2\
**Last updated:** [September 19, 2019, 7:59pm UTC](https://discourse.julialang.org/t/how-to-make-a-wrapper-around-a-non-thread-safe-c-library-thread-safe/28950 "2019-09-19T19:59:55Z")

</div>

Dear all, I am looking for hints how to make the NetCDF.jl prepared for the new threading in Julia 1.3. The package is a wrapper around a C library which is not thread-safe, so I think one has to make sure that only one…

---

## [Idiomatic use of \`iterate\`](https://discourse.julialang.org/t/idiomatic-use-of-iterate/28951)

<div class="topic-metadata">

**Author:** [@krcools](https://discourse.julialang.org/u/krcools)\
**Replies:** 9\
**Last updated:** [September 19, 2019, 7:08pm UTC](https://discourse.julialang.org/t/idiomatic-use-of-iterate/28951 "2019-09-19T19:08:40Z")

</div>

I want to insert item in a linked list containing balls before the first red ball. The precise implementation of the list is not too important. I in particular did not use the list provided by Datastructures.jl, but my o…

---

## [Suggestions for manipulating an array](https://discourse.julialang.org/t/suggestions-for-manipulating-an-array/28946)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 7\
**Last updated:** [September 19, 2019, 4:56pm UTC](https://discourse.julialang.org/t/suggestions-for-manipulating-an-array/28946 "2019-09-19T16:56:16Z")

</div>

Hey guys and girls I have this case, where I have a row vector N, which I want to rewrite to a matrix of these forms: N = \[N1 N2 N3 N4\] N2D = \[N1 0 N2 0 N3 0 N4 0; 0 N1 0 N2 0 N3 0 N4\]; N3D = \[N1 0 0 N2 0 0 N3…

---

## [Replace registered package](https://discourse.julialang.org/t/replace-registered-package/28830)

<div class="topic-metadata">

**Author:** [@ppascal97](https://discourse.julialang.org/u/ppascal97)\
**Replies:** 7\
**Last updated:** [September 19, 2019, 4:05pm UTC](https://discourse.julialang.org/t/replace-registered-package/28830 "2019-09-19T16:05:43Z")

</div>

Hi everyone ! I have been developping the package NOMAD.jl for a few months and I’d like to register it officially. The issue is that someone has already registered a package named NOMAD.jl. I’m in touch with this perso…

---

## [When embedding, do jl\_array\_t\*, jl\_sym\_t\* and jl\_value\_t\*-representing-a-type need to be wrapped in RefValue{Any} when rooting?](https://discourse.julialang.org/t/when-embedding-do-jl-array-t-jl-sym-t-and-jl-value-t-representing-a-type-need-to-be-wrapped-in-refvalue-any-when-rooting/28896)

<div class="topic-metadata">

**Author:** [@JJB](https://discourse.julialang.org/u/JJB)\
**Replies:** 2\
**Last updated:** [September 19, 2019, 2:09pm UTC](https://discourse.julialang.org/t/when-embedding-do-jl-array-t-jl-sym-t-and-jl-value-t-representing-a-type-need-to-be-wrapped-in-refvalue-any-when-rooting/28896 "2019-09-19T14:09:09Z")

</div>

From Embedding Julia · The Julia Language, it seems if I want a long-lasting object not to be collected by the Julia garbage collector when embedding Julia in C++, I need to store that object in an IdDict bound to a glob…

---

## [Why can I just write BigInt("12345")](https://discourse.julialang.org/t/why-can-i-just-write-bigint-12345/28941)

<div class="topic-metadata">

**Author:** [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Replies:** 14\
**Last updated:** [September 19, 2019, 1:28pm UTC](https://discourse.julialang.org/t/why-can-i-just-write-bigint-12345/28941 "2019-09-19T13:28:17Z")

</div>

According to Mathematicians No Longer Stumped By The Number 3 Just on the heels of finding three cubed numbers that \[sum to 42\], scientists have passed another important milestone by finding three enormous cubes that su…

---

## [CImGui.PlotLines and CImGui.PlotHistogram problems](https://discourse.julialang.org/t/cimgui-plotlines-and-cimgui-plothistogram-problems/28831)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 8\
**Last updated:** [September 19, 2019, 8:09am UTC](https://discourse.julialang.org/t/cimgui-plotlines-and-cimgui-plothistogram-problems/28831 "2019-09-19T08:09:44Z")

</div>

I have a problem with these CImGui functions. It should plot my Array, but it take every second second value from my Array, and every second value from “I don’t know?” I checked my array values and there’s any problem w…

---

## [Minimizing long compile time/Precompiling](https://discourse.julialang.org/t/minimizing-long-compile-time-precompiling/28861)

<div class="topic-metadata">

**Author:** [@JTomlinson](https://discourse.julialang.org/u/JTomlinson)\
**Replies:** 3\
**Last updated:** [September 19, 2019, 7:23am UTC](https://discourse.julialang.org/t/minimizing-long-compile-time-precompiling/28861 "2019-09-19T07:23:02Z")

</div>

I have some code for a research project of mine that takes quite a long time to compile. Here is a recent example @time generateMnli(Pk, bd22, 0.0) @time generateMnli(Pk, bd22, 0.0) 434.282438 seconds (502.49 M allocat…

---

## [Partial parametric methods?](https://discourse.julialang.org/t/partial-parametric-methods/28911)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 5\
**Last updated:** [September 19, 2019, 7:19am UTC](https://discourse.julialang.org/t/partial-parametric-methods/28911 "2019-09-19T07:19:21Z")

</div>

Not sure if the title of the topic accurately reflects what I’m looking for, but this is what I have in mind: I have a parametric type, HashMap{T,R} (it’s basically a custom Dict{T,R} type). I want to define method…

---

## [How to save a plot structure](https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 4\
**Last updated:** [September 18, 2019, 11:21pm UTC](https://discourse.julialang.org/t/how-to-save-a-plot-structure/28694 "2019-09-18T23:21:04Z")

</div>

I’d like to save a plot but not as an image file, basically I want to be able to save a Plot p, end my julia session, open a new one, load Plot p and then edit it with new series for example. I tried to use BSON like th…

---

## [Benchmarking with interpolated variable faster than hardcoded literal value](https://discourse.julialang.org/t/benchmarking-with-interpolated-variable-faster-than-hardcoded-literal-value/28927)

<div class="topic-metadata">

**Author:** [@milesf](https://discourse.julialang.org/u/milesf)\
**Replies:** 1\
**Last updated:** [September 18, 2019, 11:04pm UTC](https://discourse.julialang.org/t/benchmarking-with-interpolated-variable-faster-than-hardcoded-literal-value/28927 "2019-09-18T23:04:29Z")

</div>

Consistently observing that using an interpolated variable to iterate over for i = 1:n is faster than using a literal for i = 1:10. It’s about 7.5 ns vs 6 ns, so not much absolute difference, but somewhat significant rel…

---

## [Adding a package while using Revise.jl crashes](https://discourse.julialang.org/t/adding-a-package-while-using-revise-jl-crashes/28900)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 4\
**Last updated:** [September 18, 2019, 7:49pm UTC](https://discourse.julialang.org/t/adding-a-package-while-using-revise-jl-crashes/28900 "2019-09-18T19:49:35Z")

</div>

I load Revise.jl in my startup file as follows: # ensure that every Julia session uses Revise atreplinit() do repl try @eval using Revise @async Revise.wait\_steal\_repl\_backend() catch end end…

---

## [Dir failing in shell mode (Win, 1.0)](https://discourse.julialang.org/t/dir-failing-in-shell-mode-win-1-0/14989)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 5\
**Last updated:** [September 18, 2019, 7:08pm UTC](https://discourse.julialang.org/t/dir-failing-in-shell-mode-win-1-0/14989 "2019-09-18T19:08:14Z")

</div>

Not a windows user, just doing some tests on the platform – but isn’t this supposed to work? shell\> dir ERROR: IOError: could not spawn \`dir\`: no such file or directory (ENOENT) Stacktrace: \[1\] \_jl\_spawn(::String, ::Ar…

---

## [Confusion about prod()](https://discourse.julialang.org/t/confusion-about-prod/28906)

<div class="topic-metadata">

**Author:** [@ddejohn](https://discourse.julialang.org/u/ddejohn)\
**Replies:** 8\
**Last updated:** [September 18, 2019, 6:28pm UTC](https://discourse.julialang.org/t/confusion-about-prod/28906 "2019-09-18T18:28:02Z")

</div>

What am I misunderstanding about prod() that poly2 gives a reducing over empty collection error? # WORKS function poly(i, x, xx) p = 1 for j in 1:i-1 p \*= (x-xx\[j\]) end return p end # REDUCING O…

---

## [Issue with LinearAlgebra's \`\\\`](https://discourse.julialang.org/t/issue-with-linearalgebras/28901)

<div class="topic-metadata">

**Author:** [@srb](https://discourse.julialang.org/u/srb)\
**Replies:** 7\
**Last updated:** [September 18, 2019, 5:46pm UTC](https://discourse.julialang.org/t/issue-with-linearalgebras/28901 "2019-09-18T17:46:59Z")

</div>

I’m having some trouble with the \\ operator for matrices. Supposedly, for two matrices A and B it should give x satisfying Ax = B. However, julia\> A = \[0 1 4; 1 3 5; 3 7 7\] 3×3 Array{Int64,2}: 0 1 4 1 3 5 3 7 7…

---

## [Convenient way to create a copy of an immutable struct with a changed field](https://discourse.julialang.org/t/convenient-way-to-create-a-copy-of-an-immutable-struct-with-a-changed-field/28899)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 3\
**Last updated:** [September 18, 2019, 4:04pm UTC](https://discourse.julialang.org/t/convenient-way-to-create-a-copy-of-an-immutable-struct-with-a-changed-field/28899 "2019-09-18T16:04:40Z")

</div>

It might sound a bit weird but I am facing the following issue quite often: Given a largish struct: struct Foo a b c d e f g h i j end And a bunch of them in a Vector foos = \[…

---

## [Maxwell Fit, Julia](https://discourse.julialang.org/t/maxwell-fit-julia/28835)

<div class="topic-metadata">

**Author:** [@Romero\_Azzalini](https://discourse.julialang.org/u/Romero_Azzalini)\
**Replies:** 5\
**Last updated:** [September 18, 2019, 4:00pm UTC](https://discourse.julialang.org/t/maxwell-fit-julia/28835 "2019-09-18T16:00:02Z")

</div>

Hi, I would love to make a Maxwell Fit to my data in Julia, unfortunately I’m lost here… I’ve seen a fit in Python with scipy, but I’ve no idea how to use PyCall… Best, Hannes

---

## [Plotting a differential equation using Sympy.jl and Plots.jl](https://discourse.julialang.org/t/plotting-a-differential-equation-using-sympy-jl-and-plots-jl/28876)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 9\
**Last updated:** [September 18, 2019, 3:41pm UTC](https://discourse.julialang.org/t/plotting-a-differential-equation-using-sympy-jl-and-plots-jl/28876 "2019-09-18T15:41:53Z")

</div>

I was just checking out some parts of the Julia ecosystem and wanted to plot the solutions to some simple linear first order ordinary differential equations that were solved by Sympy. So if I have a growth equation like …

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

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