# General Usage

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

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

**Page:** 729

---

## [How to Get Outputs from ccall](https://discourse.julialang.org/t/how-to-get-outputs-from-ccall/42864)

<div class="topic-metadata">

**Author:** [@duncanam](https://discourse.julialang.org/u/duncanam)\
**Replies:** 2\
**Last updated:** [July 10, 2020, 8:10pm UTC](https://discourse.julialang.org/t/how-to-get-outputs-from-ccall/42864 "2020-07-10T20:10:45Z")

</div>

Hi, I’m trying to port some MATLAB code over to Julia that relies on some of MATLAB’s calllib() functions. However, I am confused how I am supposed to get multiple outputs out of Julia’s ccall() function as we are only a…

---

## [Correct way to wait for a Timer callback to execute](https://discourse.julialang.org/t/correct-way-to-wait-for-a-timer-callback-to-execute/42320)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 2\
**Last updated:** [July 10, 2020, 7:36pm UTC](https://discourse.julialang.org/t/correct-way-to-wait-for-a-timer-callback-to-execute/42320 "2020-07-10T19:36:20Z")

</div>

Use case in case it matters is to have non-flaky unit tests without having to over-abstract things (which is why I’d prefer to not have some boolean iscallbackdone inside the callback). function testtimer() ss = "" …

---

## [Multiplication performance](https://discourse.julialang.org/t/multiplication-performance/42862)

<div class="topic-metadata">

**Author:** [@Joao\_Barata](https://discourse.julialang.org/u/Joao_Barata)\
**Replies:** 8\
**Last updated:** [July 10, 2020, 6:42pm UTC](https://discourse.julialang.org/t/multiplication-performance/42862 "2020-07-10T18:42:05Z")

</div>

Hey guys, Here is a very simple code I’m using: function tax\_labor(τ0\_y::Real,τ1\_y::Real,ρ\_τ::Real,barρ::Real,earn::Real,rent::Real) τ0\_y\*(earn - min(ρ\_τ\*rent,barρ))^(1.0-τ1\_y) end If I do @btime, I get 9.6 ns. No…

---

## [iPython in Julia](https://discourse.julialang.org/t/ipython-in-julia/42841)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 8\
**Last updated:** [July 10, 2020, 5:50pm UTC](https://discourse.julialang.org/t/ipython-in-julia/42841 "2020-07-10T17:50:30Z")

</div>

Is there anything similar to iPython in Julia (not iJulia I suppose).

---

## [Unitful, dispatch on u"1/s" and u"rad/s"](https://discourse.julialang.org/t/unitful-dispatch-on-u-1-s-and-u-rad-s/42851)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 2\
**Last updated:** [July 10, 2020, 5:02pm UTC](https://discourse.julialang.org/t/unitful-dispatch-on-u-1-s-and-u-rad-s/42851 "2020-07-10T17:02:33Z")

</div>

Hello everyone, This is a follow up question from this topic. Now instead of just the unit I would like to have different quantities. Let me explain. I want to dispatch on units of 1/s and rad/s. Now I do the followi…

---

## [Matrix multiplication and element-wise operations without extra pre-allocation of memory](https://discourse.julialang.org/t/matrix-multiplication-and-element-wise-operations-without-extra-pre-allocation-of-memory/42855)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 5\
**Last updated:** [July 10, 2020, 5:45pm UTC](https://discourse.julialang.org/t/matrix-multiplication-and-element-wise-operations-without-extra-pre-allocation-of-memory/42855 "2020-07-10T17:45:35Z")

</div>

Hi, I would like to perform the following element operations to a matrix W (m rows and n columns): W(i, j) := a\*W(i, j) - b\*d(j)y(i), where a and b are scalars, d(j) are the elements of a vector d with n elements, and…

---

## [Parallel program with external software works from REPL but not from command line](https://discourse.julialang.org/t/parallel-program-with-external-software-works-from-repl-but-not-from-command-line/42757)

<div class="topic-metadata">

**Author:** [@PlasmaJoe](https://discourse.julialang.org/u/PlasmaJoe)\
**Replies:** 7\
**Last updated:** [July 10, 2020, 5:13pm UTC](https://discourse.julialang.org/t/parallel-program-with-external-software-works-from-repl-but-not-from-command-line/42757 "2020-07-10T17:13:28Z")

</div>

I’m trying to set up Julia to interact with an external program. I need to run the external program a lot and I have access to a cluster so since the external program only uses one core I think it makes sense to distribu…

---

## [Linear algebra performance issue](https://discourse.julialang.org/t/linear-algebra-performance-issue/42353)

<div class="topic-metadata">

**Author:** [@vinhphunguyen](https://discourse.julialang.org/u/vinhphunguyen)\
**Replies:** 20\
**Last updated:** [July 10, 2020, 3:39pm UTC](https://discourse.julialang.org/t/linear-algebra-performance-issue/42353 "2020-07-10T15:39:38Z")

</div>

Hello all, I need to compute a 3x3 matrix many many times, it is given by P = J x sigma x inv(F)‘, where J is a scalar, sigma and F are 3x3 matrices; A’ =\> transpose of A. What is the best way to compute this P as f…

---

## [ERROR: LoadError: Need an adjoint for constructor EnsembleSolution](https://discourse.julialang.org/t/error-loaderror-need-an-adjoint-for-constructor-ensemblesolution/42611)

<div class="topic-metadata">

**Author:** [@yanz4](https://discourse.julialang.org/u/yanz4)\
**Replies:** 9\
**Last updated:** [July 10, 2020, 3:11pm UTC](https://discourse.julialang.org/t/error-loaderror-need-an-adjoint-for-constructor-ensemblesolution/42611 "2020-07-10T15:11:49Z")

</div>

I wish to use Flux.training to optimize a parameter in parallel ensemble simulation, but it shows adjoint error as below: ERROR: LoadError: Need an adjoint for constructor EnsembleSolution{Float64,2,Array{ODESolution{F…

---

## [Solve the System of Equations (J' J + μI) x = J'v](https://discourse.julialang.org/t/solve-the-system-of-equations-j-j-i-x-jv/42766)

<div class="topic-metadata">

**Author:** [@Norman](https://discourse.julialang.org/u/Norman)\
**Replies:** 6\
**Last updated:** [July 10, 2020, 2:36pm UTC](https://discourse.julialang.org/t/solve-the-system-of-equations-j-j-i-x-jv/42766 "2020-07-10T14:36:44Z")

</div>

I have a square sparse matrix J of size n \* n where n can be around 1 million. μ is a scalar. I is the identity matrix. v is a vector. The system to be solved is (J'J + μI) x = J'v What I have now is the following: H…

---

## [Can you prevent Julia from erroring out when solving ODE problem, if Domain Error arises?](https://discourse.julialang.org/t/can-you-prevent-julia-from-erroring-out-when-solving-ode-problem-if-domain-error-arises/42842)

<div class="topic-metadata">

**Author:** [@cbasile21](https://discourse.julialang.org/u/cbasile21)\
**Replies:** 2\
**Last updated:** [July 10, 2020, 1:41pm UTC](https://discourse.julialang.org/t/can-you-prevent-julia-from-erroring-out-when-solving-ode-problem-if-domain-error-arises/42842 "2020-07-10T13:41:33Z")

</div>

say you have a parameter in a ODE system of equations. x = (u\[1\]) ^ 0.8 du\[1\] = x - k\_elim (Downstream effects are unaffected ( lets pretend) – So is Good output I dont want to waste. du\[2\]= (…) As an example. Let…

---

## [How to merge docstrings of constructors with and without type parameters?](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [July 10, 2020, 10:28am UTC](https://discourse.julialang.org/t/how-to-merge-docstrings-of-constructors-with-and-without-type-parameters/42830 "2020-07-10T10:28:04Z")

</div>

I have a struct struct HalfIntArray{T,N,A\<:AbstractArray} \<: AbstractHalfIntegerArray{T,N} parent :: A offsets :: NTuple{N,HalfInt} end for which I have two different sets of constructors: """ docstring 1 """ …

---

## [Syntactic sugar for dispatch on a single type parameter](https://discourse.julialang.org/t/syntactic-sugar-for-dispatch-on-a-single-type-parameter/42719)

<div class="topic-metadata">

**Author:** [@michakraus](https://discourse.julialang.org/u/michakraus)\
**Replies:** 8\
**Last updated:** [July 10, 2020, 8:37am UTC](https://discourse.julialang.org/t/syntactic-sugar-for-dispatch-on-a-single-type-parameter/42719 "2020-07-10T08:37:29Z")

</div>

I have some code using traits, where I want to dispatch on a specific type parameter of a function argument. Is there a shortcut for omitting the other parameters, if the one I want to dispatch on is not the first parame…

---

## [Gradient of fields in data structure](https://discourse.julialang.org/t/gradient-of-fields-in-data-structure/42820)

<div class="topic-metadata">

**Author:** [@mopg](https://discourse.julialang.org/u/mopg)\
**Replies:** 2\
**Last updated:** [July 10, 2020, 6:40am UTC](https://discourse.julialang.org/t/gradient-of-fields-in-data-structure/42820 "2020-07-10T06:40:11Z")

</div>

I am trying to do some design optimization using a gradient-based method. For that I have written an analysis code that has a ton of parameters (some of which I want to optimize), that are stored in data structures (stru…

---

## [Multithreading shuffle](https://discourse.julialang.org/t/multithreading-shuffle/42699)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 7\
**Last updated:** [July 10, 2020, 6:31am UTC](https://discourse.julialang.org/t/multithreading-shuffle/42699 "2020-07-10T06:31:32Z")

</div>

I wanted to port a parallel in-place shuffle algorithm, mergeshuffle: paper, repo it basically works by splitting the array into k subarrays, shuffling them in parallel. Followed by merging neighboring subarrays (in a …

---

## [Using Blink for web scraping à la Selenium?](https://discourse.julialang.org/t/using-blink-for-web-scraping-a-la-selenium/30094)

<div class="topic-metadata">

**Author:** [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Replies:** 7\
**Last updated:** [July 10, 2020, 5:24am UTC](https://discourse.julialang.org/t/using-blink-for-web-scraping-a-la-selenium/30094 "2020-07-10T05:24:10Z")

</div>

I have been a user of RSelenium for web scraping websites which make use of JavaScript. I am considering implementing a Julia binding for Selenium, but I wanted to first check whether Blink would work as a web-driver to …

---

## [Juno REPL on Windows](https://discourse.julialang.org/t/juno-repl-on-windows/42823)

<div class="topic-metadata">

**Author:** [@fusion809](https://discourse.julialang.org/u/fusion809)\
**Replies:** 0\
**Last updated:** [July 10, 2020, 5:17am UTC](https://discourse.julialang.org/t/juno-repl-on-windows/42823 "2020-07-10T05:17:18Z")

</div>

I normally use Linux, but today I’m trying to run Juno on Windows 10 and the REPL is proving to be pain. I have uber-juno installed in Atom, and I’ve even manually run: pkg\> add Juno pkg\> add Atom pkg\> add LanguageServe…

---

## [Difficulty with cookies and setting login information](https://discourse.julialang.org/t/difficulty-with-cookies-and-setting-login-information/42804)

<div class="topic-metadata">

**Author:** [@mantzaris](https://discourse.julialang.org/u/mantzaris)\
**Replies:** 0\
**Last updated:** [July 9, 2020, 9:14pm UTC](https://discourse.julialang.org/t/difficulty-with-cookies-and-setting-login-information/42804 "2020-07-09T21:14:51Z")

</div>

I am having difficulty using HTTP.jl to login to a page by passing the username and the password. This is the site’s HTML for the login form: \<form id="login\_form" name="login\_form" class="form-horizontal" method="post"…

---

## [Reducing package loading time](https://discourse.julialang.org/t/reducing-package-loading-time/42774)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 4\
**Last updated:** [July 10, 2020, 12:43am UTC](https://discourse.julialang.org/t/reducing-package-loading-time/42774 "2020-07-10T00:43:08Z")

</div>

I run my Julia application as: julia st.jl The st.jl file starts with: t0 = time\_ns() using StaticArrays, LoopVectorization using SIMD, Formatting using BSON: @save, @load t1 = time\_ns() It takes over 3s for this p…

---

## [Julia Syntax highlighting on websites](https://discourse.julialang.org/t/julia-syntax-highlighting-on-websites/42666)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 16\
**Last updated:** [July 9, 2020, 10:45pm UTC](https://discourse.julialang.org/t/julia-syntax-highlighting-on-websites/42666 "2020-07-09T22:45:01Z")

</div>

I recently encountered an issue when trying to do syntax highlighting Julia code on my blog. An example: A C++ example: Both are done with Franklin.jl using highlightjs. I recon that Documenter has the same pro…

---

## [Memory allocation: funny counting](https://discourse.julialang.org/t/memory-allocation-funny-counting/32027)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [July 9, 2020, 9:44pm UTC](https://discourse.julialang.org/t/memory-allocation-funny-counting/32027 "2020-07-09T21:44:42Z")

</div>

With Julia 1.3, julia --track-allocation=user. 0 lambda = E \* nu / (1 + nu) / (1 - 2\*(nu)); 0 mu = E / 2. / (1+nu); 860578 mI = diagm(0=\>\[1, 1, 1, 0.5, 0.5, 0.5\]); 768 m1m1 = \_m1…

---

## [Setdiff along a dimension](https://discourse.julialang.org/t/setdiff-along-a-dimension/42801)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 2\
**Last updated:** [July 9, 2020, 9:25pm UTC](https://discourse.julialang.org/t/setdiff-along-a-dimension/42801 "2020-07-09T21:25:30Z")

</div>

Hello, I am transferring some code from Matlab. In Matlab, the function setdiff can take as input two 2D-arrays A and B, and returns the rows of A that are not in B. In Julia, setdiff is working on collection of iterab…

---

## [Multigrid solver prototype (GMG) and simple Lid Cavity solver](https://discourse.julialang.org/t/multigrid-solver-prototype-gmg-and-simple-lid-cavity-solver/41969)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 37\
**Last updated:** [July 9, 2020, 1:48pm UTC](https://discourse.julialang.org/t/multigrid-solver-prototype-gmg-and-simple-lid-cavity-solver/41969 "2020-07-09T13:48:21Z")

</div>

The following GitHub - triscale-innov/LidJul.jl: GMG, Poisson solver and Lid cavity repo contains a simple Julia implementation of a Geometric Multi-Grid (GMG) solver. This solver is compared with available Julia linear …

---

## [Using VSCode and its linter on my project](https://discourse.julialang.org/t/using-vscode-and-its-linter-on-my-project/42800)

<div class="topic-metadata">

**Author:** [@jonathan-laurent](https://discourse.julialang.org/u/jonathan-laurent)\
**Replies:** 0\
**Last updated:** [July 9, 2020, 7:46pm UTC](https://discourse.julialang.org/t/using-vscode-and-its-linter-on-my-project/42800 "2020-07-09T19:46:24Z")

</div>

Hi, I am trying to use Julia’s vscode plugin to develop my AlphaZero.jl package but I am running into a few bumps. My repo is organized in a pretty standard way: I have a src folder that defines the AlphaZero module an…

---

## [Calculating all possible combinations](https://discourse.julialang.org/t/calculating-all-possible-combinations/42789)

<div class="topic-metadata">

**Author:** [@Alex\_Z](https://discourse.julialang.org/u/Alex_Z)\
**Replies:** 8\
**Last updated:** [July 9, 2020, 6:52pm UTC](https://discourse.julialang.org/t/calculating-all-possible-combinations/42789 "2020-07-09T18:52:04Z")

</div>

Hello. I’m having trouble finding an efficient way to calculate all possible combinations from a set of vectors. When they are small using kron\[a,b,c\] where a,b and c are vectors yields good results but the problem occ…

---

## [Importing modules that depend on modules](https://discourse.julialang.org/t/importing-modules-that-depend-on-modules/42660)

<div class="topic-metadata">

**Author:** [@tonygem96](https://discourse.julialang.org/u/tonygem96)\
**Replies:** 2\
**Last updated:** [July 9, 2020, 12:56pm UTC](https://discourse.julialang.org/t/importing-modules-that-depend-on-modules/42660 "2020-07-09T12:56:58Z")

</div>

I am fairly new to Julia and have ran into pickle when importing modules that are cross dependent. I have two modules A and B. In B, there is a function, Foo(), that takes a type, T , defined in A. Therefore I import A …

---

## [Improving macro programming](https://discourse.julialang.org/t/improving-macro-programming/42755)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 10\
**Last updated:** [July 9, 2020, 10:10am UTC](https://discourse.julialang.org/t/improving-macro-programming/42755 "2020-07-09T10:10:26Z")

</div>

I’m learning macro programming and as an experiment I programmed up a macro version of map!. It works, but seems clunky with all the escapes. What would be a more elegant way of programming the macro? I can define lo…

---

## [Reproducible simulations in a tarball with toml-file](https://discourse.julialang.org/t/reproducible-simulations-in-a-tarball-with-toml-file/42775)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 3\
**Last updated:** [July 9, 2020, 7:37am UTC](https://discourse.julialang.org/t/reproducible-simulations-in-a-tarball-with-toml-file/42775 "2020-07-09T07:37:44Z")

</div>

We have a use-case which should not be totally uncommon: We have a couple of julia scripts that illustrate / simulate something in a research paper. In our case it reproduces some figures in the paper. In order for a rea…

---

## [A question about TimeSeriesClustering.jl](https://discourse.julialang.org/t/a-question-about-timeseriesclustering-jl/42734)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 2\
**Last updated:** [July 9, 2020, 6:41am UTC](https://discourse.julialang.org/t/a-question-about-timeseriesclustering-jl/42734 "2020-07-09T06:41:56Z")

</div>

using TimeSeriesClustering ts\_input\_data = load\_timeseries\_data("D:\\\\mycode\\\\code\\\\。。。。.csv"; T=24, years=\[2016\]) ERROR: LoadError: MethodError: objects of type Bool are not callable Stacktrace: \[1\] find\_column\_na…

---

## [Machine Precision ... and 0 in Julia](https://discourse.julialang.org/t/machine-precision-and-0-in-julia/42767)

<div class="topic-metadata">

**Author:** [@danicaratelli](https://discourse.julialang.org/u/danicaratelli)\
**Replies:** 3\
**Last updated:** [July 9, 2020, 5:03am UTC](https://discourse.julialang.org/t/machine-precision-and-0-in-julia/42767 "2020-07-09T05:03:40Z")

</div>

Hello, I have a question about whether there is a way around the following problem. If I take different linear combinations of the same vector I should get the same vector as a result. However, applying the linear combi…

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

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