# General Usage

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

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

**Page:** 603

---

## [Dropdown key](https://discourse.julialang.org/t/dropdown-key/60731)

<div class="topic-metadata">

**Author:** [@saraflgarcia](https://discourse.julialang.org/u/saraflgarcia)\
**Replies:** 0\
**Last updated:** [May 7, 2021, 4:14pm UTC](https://discourse.julialang.org/t/dropdown-key/60731 "2021-05-07T16:14:40Z")

</div>

How can I get the current key of a dropdown widget? using Interact d = dropdown(OrderedDict(“one” =\> 1, “two” =\> 2)) getindex(d) #gets current value getkey(d) #not works… Thanks

---

## [Uniform scaling inplace addition with matrix](https://discourse.julialang.org/t/uniform-scaling-inplace-addition-with-matrix/59928)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 13\
**Last updated:** [May 7, 2021, 1:01pm UTC](https://discourse.julialang.org/t/uniform-scaling-inplace-addition-with-matrix/59928 "2021-05-07T13:01:41Z")

</div>

I want to do an inplace add of a multiple of the identity to a matrix. I can get the efficiency I want with a view of the diagonal: using LinearAlgebra function f1!(A,s) D = view(A, diagind(A, 0)) D .+= s; end ju…

---

## [real-time camera acquisition and processing, howto](https://discourse.julialang.org/t/real-time-camera-acquisition-and-processing-howto/20398)

<div class="topic-metadata">

**Author:** [@Stefan\_Karlsson](https://discourse.julialang.org/u/Stefan_Karlsson)\
**Replies:** 16\
**Last updated:** [May 7, 2021, 12:40pm UTC](https://discourse.julialang.org/t/real-time-camera-acquisition-and-processing-howto/20398 "2021-05-07T12:40:13Z")

</div>

This is the same issue that is covered by my stackoverflow post. I have searched to best of my ability online, especially this discourse and stackoverflow. I am new to Julia. I want to use the REPL to learn, and then de…

---

## [How to implement AD for this function?](https://discourse.julialang.org/t/how-to-implement-ad-for-this-function/60623)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 9\
**Last updated:** [May 7, 2021, 9:03am UTC](https://discourse.julialang.org/t/how-to-implement-ad-for-this-function/60623 "2021-05-07T09:03:51Z")

</div>

I am solving a system of equations with the iterative proportional fitting procedure. That means that at each iteration I solve for a subset of the variables μ0m, then hold those fixed and solve for the other subset of v…

---

## [Change a function without the actual evaluation ...?](https://discourse.julialang.org/t/change-a-function-without-the-actual-evaluation/60657)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 7:32am UTC](https://discourse.julialang.org/t/change-a-function-without-the-actual-evaluation/60657 "2021-05-07T07:32:37Z")

</div>

Hi. I’d like to know if there is a way to convert a function to a different form without the actual evaluation. For example, I’m trying to make an API of DifferentialEquations.jl. However, I encountered a serious perfo…

---

## [Problem in Pluto](https://discourse.julialang.org/t/problem-in-pluto/60683)

<div class="topic-metadata">

**Author:** [@Vos](https://discourse.julialang.org/u/Vos)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 7:17am UTC](https://discourse.julialang.org/t/problem-in-pluto/60683 "2021-05-07T07:17:12Z")

</div>

Good evening to all, I have a problem with my code. What I wrote is supposed to draw “lines” connecting the edge of the large rectangle with the edge of the small rectangle, like this: But sometimes it gives me th…

---

## [Ending @async task externally](https://discourse.julialang.org/t/ending-async-task-externally/60693)

<div class="topic-metadata">

**Author:** [@ligert123](https://discourse.julialang.org/u/ligert123)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 6:19am UTC](https://discourse.julialang.org/t/ending-async-task-externally/60693 "2021-05-07T06:19:04Z")

</div>

Hello, does anyone know how to close an async task from within another thread? ive been trying to do it using methods like an endless loop with a bool array that is passed in externally but that doesnt seem to work. Any…

---

## [A bug in ForwardDiff?](https://discourse.julialang.org/t/a-bug-in-forwarddiff/60691)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 2\
**Last updated:** [May 7, 2021, 3:45am UTC](https://discourse.julialang.org/t/a-bug-in-forwarddiff/60691 "2021-05-07T03:45:59Z")

</div>

Consider this: using ForwardDiff function f!(F, x) F\[1\] = (x\[1\]+3)\*(x\[2\]^3-7)+18 F\[2\] = sin(x\[2\]\*exp(x\[1\])-1) return F end F = Array{Float64}(undef, 2) x = \[1, 1\] Now let’s compute the Jacobian. The docum…

---

## [Debugging with DifferentialEquations.jl](https://discourse.julialang.org/t/debugging-with-differentialequations-jl/60563)

<div class="topic-metadata">

**Author:** [@Fathya.Salih](https://discourse.julialang.org/u/Fathya.Salih)\
**Replies:** 1\
**Last updated:** [May 6, 2021, 11:35pm UTC](https://discourse.julialang.org/t/debugging-with-differentialequations-jl/60563 "2021-05-06T23:35:14Z")

</div>

I have been trying to debug an ODE solver code that looks something like this: u0 = zeros(100) function f(u, p, t) a, b, c, d = p println("t = ", t) # Applying BC and finding ODE RHS apply\_bc(u, a, b, c, d) en…

---

## [Best approach to smooth array? None of my approaches are very useful](https://discourse.julialang.org/t/best-approach-to-smooth-array-none-of-my-approaches-are-very-useful/17633)

<div class="topic-metadata">

**Author:** [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Replies:** 18\
**Last updated:** [May 6, 2021, 10:23pm UTC](https://discourse.julialang.org/t/best-approach-to-smooth-array-none-of-my-approaches-are-very-useful/17633 "2021-05-06T22:23:23Z")

</div>

Hi! I´ve been trying this week to get something accomplished but I cannot get it done. Problem: I have group of variables coming from a NetCDF. When imported using NCDatasets, I get arrays of 64 bits with a size (128,1…

---

## [Some observer's thoughts on developments of Julia packages and modules](https://discourse.julialang.org/t/some-observers-thoughts-on-developments-of-julia-packages-and-modules/60660)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 8\
**Last updated:** [May 6, 2021, 8:46pm UTC](https://discourse.julialang.org/t/some-observers-thoughts-on-developments-of-julia-packages-and-modules/60660 "2021-05-06T20:46:22Z")

</div>

Recently excellent package DataFrames.jl arrived at version 1.0.0 (today it is v1.1.0), which make me wonder about time that such development takes. Complaining about not having it sooner, when you have such excellent, o…

---

## [Julia 1.6.0 package manager - error message "noise" in custom Docker image on add/update](https://discourse.julialang.org/t/julia-1-6-0-package-manager-error-message-noise-in-custom-docker-image-on-add-update/58037)

<div class="topic-metadata">

**Author:** [@twadleigh](https://discourse.julialang.org/u/twadleigh)\
**Replies:** 13\
**Last updated:** [May 6, 2021, 7:54pm UTC](https://discourse.julialang.org/t/julia-1-6-0-package-manager-error-message-noise-in-custom-docker-image-on-add-update/58037 "2021-05-06T19:54:24Z")

</div>

I just bumped the julia version to 1.6.0 in a Docker image we use in my organization. I now see repetitions of the same error message when doing package operations. For instance: (@v1.6) pkg\> update Updating registr…

---

## [TimeSeries Analysis](https://discourse.julialang.org/t/timeseries-analysis/60670)

<div class="topic-metadata">

**Author:** [@statspy](https://discourse.julialang.org/u/statspy)\
**Replies:** 0\
**Last updated:** [May 6, 2021, 5:47pm UTC](https://discourse.julialang.org/t/timeseries-analysis/60670 "2021-05-06T17:47:03Z")

</div>

Hello, Whats the best package recommendation to work with time series in Julia? I checked Julia Observer but I didn’t find any consensus about it. Thanks

---

## [Why using \`+=\` instead of \`=\` generates slow code?](https://discourse.julialang.org/t/why-using-instead-of-generates-slow-code/60664)

<div class="topic-metadata">

**Author:** [@1115](https://discourse.julialang.org/u/1115)\
**Replies:** 5\
**Last updated:** [May 6, 2021, 5:02pm UTC](https://discourse.julialang.org/t/why-using-instead-of-generates-slow-code/60664 "2021-05-06T17:02:38Z")

</div>

I have two functions, their only difference is one uses += and another uses =, but are making a \> 4x performance difference. The + is much faster than sin and cos and I suppose the following two functions should not make…

---

## [Code runtime constantly increasing with time](https://discourse.julialang.org/t/code-runtime-constantly-increasing-with-time/60437)

<div class="topic-metadata">

**Author:** [@ff1991](https://discourse.julialang.org/u/ff1991)\
**Replies:** 16\
**Last updated:** [May 6, 2021, 5:00pm UTC](https://discourse.julialang.org/t/code-runtime-constantly-increasing-with-time/60437 "2021-05-06T17:00:56Z")

</div>

Hello Everyone, I am fairly new to Julia, so sorry if the problem I would like to ask about may seem a bit general. I have actually written a plasma simulation code which is unfortunately too much detailed and consisti…

---

## [How do you access a struct field name in a string](https://discourse.julialang.org/t/how-do-you-access-a-struct-field-name-in-a-string/60666)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 1\
**Last updated:** [May 6, 2021, 4:11pm UTC](https://discourse.julialang.org/t/how-do-you-access-a-struct-field-name-in-a-string/60666 "2021-05-06T16:11:30Z")

</div>

Suppose I had the follow struct: struct Employee ID::Int32 name::String end Is it possible to access a field name while embedded in a string? svetlana = Employee(1,"Queen Svetlana") # prints Employee Name: svetlana.…

---

## [How to measure energy consumption of computations?](https://discourse.julialang.org/t/how-to-measure-energy-consumption-of-computations/60578)

<div class="topic-metadata">

**Author:** [@scheidan1](https://discourse.julialang.org/u/scheidan1)\
**Replies:** 7\
**Last updated:** [May 6, 2021, 4:02pm UTC](https://discourse.julialang.org/t/how-to-measure-energy-consumption-of-computations/60578 "2021-05-06T16:02:51Z")

</div>

Developing models and running simulations is a core activity of our research department. Faster languages (Julia) and better algorithms result typically not in less computation, but in more ambitious targets. During a d…

---

## [3D Plot Title Issue (Makie.jl)](https://discourse.julialang.org/t/3d-plot-title-issue-makie-jl/60661)

<div class="topic-metadata">

**Author:** [@Arryk](https://discourse.julialang.org/u/Arryk)\
**Replies:** 4\
**Last updated:** [May 6, 2021, 3:56pm UTC](https://discourse.julialang.org/t/3d-plot-title-issue-makie-jl/60661 "2021-05-06T15:56:34Z")

</div>

I have some simple code to plot the earth in 3D using Makie.jl using GLMakie, FileIO, Colors, GeometryBasics # Plot related libraries # Earth Image const earth\_img = load(download("https://svs.gsfc.nasa.gov/vis/a000000…

---

## [Precompilation techniques for speeding up the first run (Heroku deployments and PackageCompiler)](https://discourse.julialang.org/t/precompilation-techniques-for-speeding-up-the-first-run-heroku-deployments-and-packagecompiler/29327)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 18\
**Last updated:** [May 6, 2021, 3:19pm UTC](https://discourse.julialang.org/t/precompilation-techniques-for-speeding-up-the-first-run-heroku-deployments-and-packagecompiler/29327 "2021-05-06T15:19:20Z")

</div>

I’m using a Dockerfile to deploy a Genie app on a host and among other commands, I deploy the app with: RUN julia -e "using Pkg; pkg\\"activate . \\"; pkg\\"instantiate\\"; pkg\\"precompile\\"; " However, upon starting the a…

---

## [Set inconsistencies with structs](https://discourse.julialang.org/t/set-inconsistencies-with-structs/60637)

<div class="topic-metadata">

**Author:** [@lklein](https://discourse.julialang.org/u/lklein)\
**Replies:** 4\
**Last updated:** [May 6, 2021, 2:36pm UTC](https://discourse.julialang.org/t/set-inconsistencies-with-structs/60637 "2021-05-06T14:36:33Z")

</div>

Hi all, I was working with sets and self defined structs and noticed the following: julia\> struct A a end Base.:(==)(a::A,b::A) = true set = Set{A}() push!(set, A(1)) Set{A} with 1 element: A(1) …

---

## [Enbedding julia in C++ , how to call savefig function?](https://discourse.julialang.org/t/enbedding-julia-in-c-how-to-call-savefig-function/60648)

<div class="topic-metadata">

**Author:** [@dbertini](https://discourse.julialang.org/u/dbertini)\
**Replies:** 0\
**Last updated:** [May 6, 2021, 1:26pm UTC](https://discourse.julialang.org/t/enbedding-julia-in-c-how-to-call-savefig-function/60648 "2021-05-06T13:26:48Z")

</div>

Hi I am trying to use the julia C interface in orger to call Julia from within my C++ program. I would like to save some plots but it does not seems to work. Here is a snapshot of the code i used so far: { // here u…

---

## [Help with binary trees benchmark games example](https://discourse.julialang.org/t/help-with-binary-trees-benchmark-games-example/37307)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 53\
**Last updated:** [May 6, 2021, 12:27pm UTC](https://discourse.julialang.org/t/help-with-binary-trees-benchmark-games-example/37307 "2021-05-06T12:27:15Z")

</div>

Hey guys, I happened to look at the Julia benchmarks on the Benchmarks Game website lately. Overall, the Julia results are extremely intimidating. I dare say, a lot of the Julia examples, aside from being blazing fast,…

---

## [Built in function to sort the results of index in](https://discourse.julialang.org/t/built-in-function-to-sort-the-results-of-index-in/60624)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [May 6, 2021, 11:39am UTC](https://discourse.julialang.org/t/built-in-function-to-sort-the-results-of-index-in/60624 "2021-05-06T11:39:11Z")

</div>

x =\[2 3 4 5 6 7 8\] z = \[2 6 5\] y= indexin(z,x) is there a built in function to sort the results of indexin

---

## [How to dispatch on typed vectors](https://discourse.julialang.org/t/how-to-dispatch-on-typed-vectors/60633)

<div class="topic-metadata">

**Author:** [@florian](https://discourse.julialang.org/u/florian)\
**Replies:** 5\
**Last updated:** [May 6, 2021, 10:30am UTC](https://discourse.julialang.org/t/how-to-dispatch-on-typed-vectors/60633 "2021-05-06T10:30:35Z")

</div>

How can I write a function that works on Vector{T1} as well as Vector{Union{T1, T2}}? So for example I want the function to work on \["hello", "world", missing\] as well as \`\[“hello”, “world”\]. I can’t dispatch to the in…

---

## [Weighted linear regression with confidence interval](https://discourse.julialang.org/t/weighted-linear-regression-with-confidence-interval/60610)

<div class="topic-metadata">

**Author:** [@Okarin99](https://discourse.julialang.org/u/Okarin99)\
**Replies:** 6\
**Last updated:** [May 6, 2021, 8:56am UTC](https://discourse.julialang.org/t/weighted-linear-regression-with-confidence-interval/60610 "2021-05-06T08:56:35Z")

</div>

Hi, is there a way to do weighted linear regression and predict the confidence interval in Julia? I think with glm it is only implemented for non weighted linear regression. Thank you for your answers and have a nice d…

---

## [Indexing vector elements of a matrix](https://discourse.julialang.org/t/indexing-vector-elements-of-a-matrix/60631)

<div class="topic-metadata">

**Author:** [@Simcha](https://discourse.julialang.org/u/Simcha)\
**Replies:** 2\
**Last updated:** [May 6, 2021, 8:39am UTC](https://discourse.julialang.org/t/indexing-vector-elements-of-a-matrix/60631 "2021-05-06T08:39:29Z")

</div>

I can’t seem to access all elements of equal index in a matrix in an intuitive way. What I have is a matrix of vectors “scan” Matrix{Vector{Float64}} (alias for Array{Array{Float64, 1}, 2}) Accessing all elements of t…

---

## [Working directory and output issues with Weave.jl](https://discourse.julialang.org/t/working-directory-and-output-issues-with-weave-jl/60540)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 1\
**Last updated:** [May 6, 2021, 7:57am UTC](https://discourse.julialang.org/t/working-directory-and-output-issues-with-weave-jl/60540 "2021-05-06T07:57:58Z")

</div>

I’m trying to set up a workflow with Weave.jl but struggle with some aspects. The first is that my file is includeing some other code in the same directory like include("some\_file.jl"). So the script needs to be run wit…

---

## [Histogram of dates in Plots.jl](https://discourse.julialang.org/t/histogram-of-dates-in-plots-jl/60527)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 8\
**Last updated:** [May 6, 2021, 3:06am UTC](https://discourse.julialang.org/t/histogram-of-dates-in-plots-jl/60527 "2021-05-06T03:06:22Z")

</div>

I’ve come across this problem many times, but I can’t find any mentions of it anywhere on here or the Plots repo. Consider: julia\> using Plots julia\> histogram(rand(Date(2000, 1, 1):Day(1):Date(2001, 1, 1), 100)) He…

---

## [Return with an image from an asset folder within a package](https://discourse.julialang.org/t/return-with-an-image-from-an-asset-folder-within-a-package/60604)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 4\
**Last updated:** [May 5, 2021, 9:13pm UTC](https://discourse.julialang.org/t/return-with-an-image-from-an-asset-folder-within-a-package/60604 "2021-05-05T21:13:47Z")

</div>

Hello, I am working on my first package. I wish to add a few functions returning an image or some data taken from within the package itself. For example, I want to display an image in an HTML as shown here: function …

---

## [Difficulty installing polyhedra](https://discourse.julialang.org/t/difficulty-installing-polyhedra/60562)

<div class="topic-metadata">

**Author:** [@healyp](https://discourse.julialang.org/u/healyp)\
**Replies:** 2\
**Last updated:** [May 5, 2021, 7:19pm UTC](https://discourse.julialang.org/t/difficulty-installing-polyhedra/60562 "2021-05-05T19:19:12Z")

</div>

I am getting a lot of conflicts when I try to install polyhedra. If anybody had any leads or suggestions I would be very grateful. Some of the (long) list of conflicts are: (@v1.6) pkg\> add Polyhedra Resolving pac…

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

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