# Latest

**URL:** https://discourse.julialang.org/latest.md?page=1433

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

**Page:** 1434

---

## [How can I parse a \`UnitfulQuantity\` to return a unit describing only the \`Time\` dimension?](https://discourse.julialang.org/t/how-can-i-parse-a-unitfulquantity-to-return-a-unit-describing-only-the-time-dimension/58780)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [April 7, 2021, 6:17pm UTC](https://discourse.julialang.org/t/how-can-i-parse-a-unitfulquantity-to-return-a-unit-describing-only-the-time-dimension/58780 "2021-04-07T18:17:04Z")

</div>

I have a function where I want to parse a Unitful.Quantity argument provided by the user for only the Time dimensioned unit. For example… f(1u"km/s") # should return u"s" f(1u"km/d") # should return u"d" Is this suppor…

---

## [Passing functions as default arguments to functions in sibling modules](https://discourse.julialang.org/t/passing-functions-as-default-arguments-to-functions-in-sibling-modules/58769)

<div class="topic-metadata">

**Author:** [@MattWillFlood](https://discourse.julialang.org/u/MattWillFlood)\
**Replies:** 1\
**Last updated:** [April 7, 2021, 6:02pm UTC](https://discourse.julialang.org/t/passing-functions-as-default-arguments-to-functions-in-sibling-modules/58769 "2021-04-07T18:02:03Z")

</div>

Hi Guys :slightly\_smiling\_face: Is there a way to pass a function from a submodule (saved in a separate file) as a default argument to a sibling function? :thinking: As an example, say that my module is structured as f…

---

## [JuMP mutually exclusive indices iterated over the same set](https://discourse.julialang.org/t/jump-mutually-exclusive-indices-iterated-over-the-same-set/58198)

<div class="topic-metadata">

**Author:** [@Paris\_Pijuan](https://discourse.julialang.org/u/Paris_Pijuan)\
**Replies:** 5\
**Last updated:** [April 7, 2021, 5:05pm UTC](https://discourse.julialang.org/t/jump-mutually-exclusive-indices-iterated-over-the-same-set/58198 "2021-04-07T17:05:01Z")

</div>

Hello, I am new here and a relatively new Julia user. I have a constraint in a model I am writing where I have variables twice indexed over the same set, but I need the indices to iterate mutually exclusively. The code …

---

## [Dynamic "for"](https://discourse.julialang.org/t/dynamic-for/58701)

<div class="topic-metadata">

**Author:** [@marllos](https://discourse.julialang.org/u/marllos)\
**Replies:** 11\
**Last updated:** [April 7, 2021, 4:30pm UTC](https://discourse.julialang.org/t/dynamic-for/58701 "2021-04-07T16:30:35Z")

</div>

Hello everyone! How do I write the code below using @nloops or other Base.Cartesian elements? I’ve made several attempts. My goal is to generalize to n nested for’s. function test() for i\_1 = 0:1 for i\_2 = 0:1 fo…

---

## [How to freeze a single weight of a layer?](https://discourse.julialang.org/t/how-to-freeze-a-single-weight-of-a-layer/58279)

<div class="topic-metadata">

**Author:** [@March-08](https://discourse.julialang.org/u/March-08)\
**Replies:** 5\
**Last updated:** [April 7, 2021, 4:24pm UTC](https://discourse.julialang.org/t/how-to-freeze-a-single-weight-of-a-layer/58279 "2021-04-07T16:24:11Z")

</div>

Is there a way to freeze one single weight instead of an entire layer ? Flux.delete! function is able to freeze just the layer and not one single parameter. function micronet() simplenet = gpu(Chain( Dense(2…

---

## [In Julia, how to create a function that saves its own internal state?](https://discourse.julialang.org/t/in-julia-how-to-create-a-function-that-saves-its-own-internal-state/58457)

<div class="topic-metadata">

**Author:** [@erwanlecarpentier](https://discourse.julialang.org/u/erwanlecarpentier)\
**Replies:** 10\
**Last updated:** [April 7, 2021, 3:48pm UTC](https://discourse.julialang.org/t/in-julia-how-to-create-a-function-that-saves-its-own-internal-state/58457 "2021-04-07T15:48:37Z")

</div>

Hey! I would like to create a function with an internal state, but I do not want to have to initialize this internal state outside of the function (I want to rely only on calls to this function and I do not want the fun…

---

## [Up-arrow previous command completion in Bash](https://discourse.julialang.org/t/up-arrow-previous-command-completion-in-bash/58682)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 13\
**Last updated:** [April 6, 2021, 8:06pm UTC](https://discourse.julialang.org/t/up-arrow-previous-command-completion-in-bash/58682 "2021-04-06T20:06:20Z")

</div>

I got addicted to the up-arrow auto-completion of the previous commands that is available in the Julia REPL. Is there a simple way to reproduce that in Bash?

---

## [Cannot convert String to series data for plotting](https://discourse.julialang.org/t/cannot-convert-string-to-series-data-for-plotting/58763)

<div class="topic-metadata">

**Author:** [@quantiota](https://discourse.julialang.org/u/quantiota)\
**Replies:** 0\
**Last updated:** [April 7, 2021, 3:12pm UTC](https://discourse.julialang.org/t/cannot-convert-string-to-series-data-for-plotting/58763 "2021-04-07T15:12:38Z")

</div>

hey trying to work with JuliaDB by example from just added a first column for the curency market. month = 1 window = Dates.Hour(1) # 1) subset data (lazy) date\_range = DateTime(2019, 1):Dates.Millisecond(1):DateTime…

---

## [Animation Problem](https://discourse.julialang.org/t/animation-problem/58419)

<div class="topic-metadata">

**Author:** [@Vos](https://discourse.julialang.org/u/Vos)\
**Replies:** 11\
**Last updated:** [April 7, 2021, 2:39pm UTC](https://discourse.julialang.org/t/animation-problem/58419 "2021-04-07T14:39:16Z")

</div>

Hello to all, I hope you are well I would like to create a little game in which there would be some animation. To do this I would like to use Luxor. On the Luxor website there is a sample code but the problem is that i…

---

## [Converting existing Package from old Pkg to new Pkg](https://discourse.julialang.org/t/converting-existing-package-from-old-pkg-to-new-pkg/58743)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 4\
**Last updated:** [April 7, 2021, 2:27pm UTC](https://discourse.julialang.org/t/converting-existing-package-from-old-pkg-to-new-pkg/58743 "2021-04-07T14:27:34Z")

</div>

Hello everyone, I couldn’t find an up to date answer to this question. I have this very old package generated under julia 0.6. How can I update to Pkg3 without loosing git history and without changing the name? Many …

---

## [Ctime() in Windows 10](https://discourse.julialang.org/t/ctime-in-windows-10/58755)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 0\
**Last updated:** [April 7, 2021, 2:20pm UTC](https://discourse.julialang.org/t/ctime-in-windows-10/58755 "2021-04-07T14:20:40Z")

</div>

It appears that the ctime() function does not provide the correct “creation time” of a file in Windows 10 (using Julia v1.6). I was wondering if anyone has successfully done a ccall to kernel32.dll to get the correct cr…

---

## [How to create array of arrays](https://discourse.julialang.org/t/how-to-create-array-of-arrays/58745)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 4\
**Last updated:** [April 7, 2021, 12:39pm UTC](https://discourse.julialang.org/t/how-to-create-array-of-arrays/58745 "2021-04-07T12:39:43Z")

</div>

How to create a array of arrays. I am trying this. julia\> a =\[2,3\] 2-element Array{Int64,1}: 2 3 julia\> b=\[\] 0-element Array{Any,1} julia\> push!(b,a) 1-element Array{Any,1}: \[2, 3\] julia\> empty!(a) 0-element Array…

---

## [Why putting a function argument first](https://discourse.julialang.org/t/why-putting-a-function-argument-first/58700)

<div class="topic-metadata">

**Author:** [@qsong](https://discourse.julialang.org/u/qsong)\
**Replies:** 7\
**Last updated:** [April 7, 2021, 12:24pm UTC](https://discourse.julialang.org/t/why-putting-a-function-argument-first/58700 "2021-04-07T12:24:21Z")

</div>

Although it appears #1 convention on style guide of the docs to write functions for a long time till Julia 1.6 now, it brings difficulty on some user cases like manipulating data and piping. I was wondering if it would m…

---

## [Optimization code](https://discourse.julialang.org/t/optimization-code/58744)

<div class="topic-metadata">

**Author:** [@dires](https://discourse.julialang.org/u/dires)\
**Replies:** 1\
**Last updated:** [April 7, 2021, 12:10pm UTC](https://discourse.julialang.org/t/optimization-code/58744 "2021-04-07T12:10:45Z")

</div>

I have got a warning message below, ┌ Warning: with\_optimizer is deprecated. Adapt the following example to update your code: │ with\_optimizer(Ipopt.Optimizer) becomes Ipopt.Optimizer. │ caller = top-level scope at …

---

## [Array assignment is alias and assignment semantics](https://discourse.julialang.org/t/array-assignment-is-alias-and-assignment-semantics/58735)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 7\
**Last updated:** [April 7, 2021, 11:26am UTC](https://discourse.julialang.org/t/array-assignment-is-alias-and-assignment-semantics/58735 "2021-04-07T11:26:38Z")

</div>

Why? I started this post because I found that array assignment created an alias, leading to an unexpected problem. I wasn’t sure if this was a bug. But it’s now clear that it is the expected behavior. So my goals are …

---

## [Adding package to project by identifying directory (from outside)](https://discourse.julialang.org/t/adding-package-to-project-by-identifying-directory-from-outside/58747)

<div class="topic-metadata">

**Author:** [@Mrion](https://discourse.julialang.org/u/Mrion)\
**Replies:** 2\
**Last updated:** [April 7, 2021, 11:37am UTC](https://discourse.julialang.org/t/adding-package-to-project-by-identifying-directory-from-outside/58747 "2021-04-07T11:37:09Z")

</div>

Hi! Is there a way to add package to project from outside of project? Something like Pkg.add(required\_package, path\_to\_project\_where\_package\_should\_be\_added)

---

## [For-loop vs list-comprehension](https://discourse.julialang.org/t/for-loop-vs-list-comprehension/58702)

<div class="topic-metadata">

**Author:** [@pedrobtz](https://discourse.julialang.org/u/pedrobtz)\
**Replies:** 15\
**Last updated:** [April 7, 2021, 10:56am UTC](https://discourse.julialang.org/t/for-loop-vs-list-comprehension/58702 "2021-04-07T10:56:12Z")

</div>

Why isn’t the list-comprehension as fast as the for-loop? using Random using BenchmarkTools y = zeros(UInt8,256); y\[UInt8('A')\] = UInt8('U'); y\[UInt8('C')\] = UInt8('G'); y\[UInt8('G')\] = UInt8('C'); y\[UInt8('T')\] = UInt…

---

## [\`Using\` doesn't work inside custom module](https://discourse.julialang.org/t/using-doesnt-work-inside-custom-module/58742)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 2\
**Last updated:** [April 7, 2021, 10:52am UTC](https://discourse.julialang.org/t/using-doesnt-work-inside-custom-module/58742 "2021-04-07T10:52:00Z")

</div>

I want to export a function from a custom module that uses some package inside itself, but it works in a unexpected way for me module A export f using StatsBase f(x) = StatsBase.sample(\[x,0\]) end using .A f(1) Output …

---

## [Referencing local variable before assignment results in unexpected behavior](https://discourse.julialang.org/t/referencing-local-variable-before-assignment-results-in-unexpected-behavior/58088)

<div class="topic-metadata">

**Author:** [@instrnts](https://discourse.julialang.org/u/instrnts)\
**Replies:** 58\
**Last updated:** [April 7, 2021, 9:53am UTC](https://discourse.julialang.org/t/referencing-local-variable-before-assignment-results-in-unexpected-behavior/58088 "2021-04-07T09:53:13Z")

</div>

Julia version: 1.6.0 I recently had a bug in my code, after isolating the bug, it came down to a piece of code that looks like this: function outer(n) function inner() n = n + 1 end inner() re…

---

## [(Plots) how to set color of y-axis border and ticks](https://discourse.julialang.org/t/plots-how-to-set-color-of-y-axis-border-and-ticks/58730)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [April 7, 2021, 9:32am UTC](https://discourse.julialang.org/t/plots-how-to-set-color-of-y-axis-border-and-ticks/58730 "2021-04-07T09:32:04Z")

</div>

Hi, I’m using Plots with GR backend. I’d like to know how to set the color of y-axis border and ticks.

---

## [Is this impossible for Zygote Adjoint to handle](https://discourse.julialang.org/t/is-this-impossible-for-zygote-adjoint-to-handle/57878)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 4\
**Last updated:** [April 7, 2021, 9:16am UTC](https://discourse.julialang.org/t/is-this-impossible-for-zygote-adjoint-to-handle/57878 "2021-04-07T09:16:00Z")

</div>

The example below I got out of the documentation somewhere. It appears to compute the gradient when done with the QuadratureAdjoint() I don’t get an error. When I switch to the ZygoteAdjoint() I get the error: ERROR: …

---

## [Getting the name of a Struct / Scoping Issues with Custom Structs](https://discourse.julialang.org/t/getting-the-name-of-a-struct-scoping-issues-with-custom-structs/58706)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 3\
**Last updated:** [April 6, 2021, 8:56pm UTC](https://discourse.julialang.org/t/getting-the-name-of-a-struct-scoping-issues-with-custom-structs/58706 "2021-04-06T20:56:55Z")

</div>

Hi there, I have a scoping issues, and did not manage to find a solution on my own. I was hoping that someone more knowledgeable might have a quick solution for this: I define an abstract type AbstractModel in a modul…

---

## [Supertype method call inside subtype method with same name](https://discourse.julialang.org/t/supertype-method-call-inside-subtype-method-with-same-name/58720)

<div class="topic-metadata">

**Author:** [@Sunny](https://discourse.julialang.org/u/Sunny)\
**Replies:** 2\
**Last updated:** [April 7, 2021, 8:33am UTC](https://discourse.julialang.org/t/supertype-method-call-inside-subtype-method-with-same-name/58720 "2021-04-07T08:33:39Z")

</div>

I defined some struct that is the subtype of Parent. There is a method I’d like to change for the Child type but at the same time I want it to call the same method for Parent type. What is the correct way to get this …

---

## [How to change the default JULIA\_NUM\_THREADS variable? How to call a multi thread julia from a python script?](https://discourse.julialang.org/t/how-to-change-the-default-julia-num-threads-variable-how-to-call-a-multi-thread-julia-from-a-python-script/58727)

<div class="topic-metadata">

**Author:** [@Noodle](https://discourse.julialang.org/u/Noodle)\
**Replies:** 1\
**Last updated:** [April 7, 2021, 7:23am UTC](https://discourse.julialang.org/t/how-to-change-the-default-julia-num-threads-variable-how-to-call-a-multi-thread-julia-from-a-python-script/58727 "2021-04-07T07:23:22Z")

</div>

Hello everyone, Is there a way to change the DEFAULT number of threads (default is 1) so that every time I use julia.exe it always starts with 4 threads? I know we could manually set it by set JULIA\_NUM\_THREADS = 4 an…

---

## [Lead balloon](https://discourse.julialang.org/t/lead-balloon/58729)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 3\
**Last updated:** [April 7, 2021, 6:39am UTC](https://discourse.julialang.org/t/lead-balloon/58729 "2021-04-07T06:39:28Z")

</div>

Mythbusters made a lead balloon and I wanted to reproduce it. using Unitful using GeometryBasics using PeriodicTable using PhysicalConstants.CODATA2018: g\_n struct Shell inner thickness end struct Object s…

---

## [KeyError when indexing from an OrderedDict in for loop](https://discourse.julialang.org/t/keyerror-when-indexing-from-an-ordereddict-in-for-loop/58731)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 3\
**Last updated:** [April 7, 2021, 6:15am UTC](https://discourse.julialang.org/t/keyerror-when-indexing-from-an-ordereddict-in-for-loop/58731 "2021-04-07T06:15:53Z")

</div>

How can I access or index an OrderedDict? I tried as below but returning keyerror using DataStructures price = OrderedDict( "s1" =\> 0, "s2" =\> 0, "s3" =\> 0, "s4" =\> 5 ) for s in 1:length(S) price\[s\] end Returns …

---

## [Odd behavior from ControlSystemIdentification and JuMP on version 1.6](https://discourse.julialang.org/t/odd-behavior-from-controlsystemidentification-and-jump-on-version-1-6/58714)

<div class="topic-metadata">

**Author:** [@jcert](https://discourse.julialang.org/u/jcert)\
**Replies:** 4\
**Last updated:** [April 7, 2021, 4:58am UTC](https://discourse.julialang.org/t/odd-behavior-from-controlsystemidentification-and-jump-on-version-1-6/58714 "2021-04-07T04:58:14Z")

</div>

Hello, I am preparing a short tutorial on how to use Julia for Control Systems and I was using Julia 1.5 and it was working ok. Then I decided to test version 1.6 to see if it would make it load faster (considering that …

---

## [Optimizing remainder with constant modulus implementation](https://discourse.julialang.org/t/optimizing-remainder-with-constant-modulus-implementation/58586)

<div class="topic-metadata">

**Author:** [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Replies:** 2\
**Last updated:** [April 6, 2021, 2:10pm UTC](https://discourse.julialang.org/t/optimizing-remainder-with-constant-modulus-implementation/58586 "2021-04-06T14:10:53Z")

</div>

Hi performance people! I am implementing the remainder routines for constant modulus from this paper by Lemire et al. in Julia from their C examples. Below is the original C implementation followed by my julia translati…

---

## [\[ANN\] IterationControl.jl](https://discourse.julialang.org/t/ann-iterationcontrol-jl/58342)

<div class="topic-metadata">

**Author:** [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Replies:** 3\
**Last updated:** [April 7, 2021, 1:42am UTC](https://discourse.julialang.org/t/ann-iterationcontrol-jl/58342 "2021-04-07T01:42:33Z")

</div>

IterationControl.jl is a lightweight package for controlling iterative algorithms, with a view to training and optimizing machine learning models. It builds on our earlier package EarlyStopping.jl. This package is simi…

---

## [How to get the directory of an indirect dependency](https://discourse.julialang.org/t/how-to-get-the-directory-of-an-indirect-dependency/58708)

<div class="topic-metadata">

**Author:** [@danielmatz](https://discourse.julialang.org/u/danielmatz)\
**Replies:** 3\
**Last updated:** [April 7, 2021, 12:49am UTC](https://discourse.julialang.org/t/how-to-get-the-directory-of-an-indirect-dependency/58708 "2021-04-07T00:49:55Z")

</div>

I’m trying to write a script that analyzes all of the dependencies of a Julia project, including the indirect dependencies. I see how I can use pathof to get the path to the direct dependencies, but how can I do this for…

[Previous page](https://discourse.julialang.org/latest.md?page=1432)

[Next page](https://discourse.julialang.org/latest.md?page=1434)
