# General Usage

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

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

**Page:** 444

---

## [Naive lookup table with lots of allocations](https://discourse.julialang.org/t/naive-lookup-table-with-lots-of-allocations/65457)

<div class="topic-metadata">

**Author:** [@daviddoij](https://discourse.julialang.org/u/daviddoij)\
**Replies:** 11\
**Last updated:** [May 30, 2022, 3:30am UTC](https://discourse.julialang.org/t/naive-lookup-table-with-lots-of-allocations/65457 "2022-05-30T03:30:48Z")

</div>

Hi there, going through project euler problems, I’ve implemented a working solution for problem 17: function num2letters(num) nums = Dict( 0 =\> "", 1 =\> "one", 2 =\> "two", 3 =\> "three", 4 =\> "four", 5 =\> "f…

---

## [WebIO Installation Problem](https://discourse.julialang.org/t/webio-installation-problem/81892)

<div class="topic-metadata">

**Author:** [@rnayebi](https://discourse.julialang.org/u/rnayebi)\
**Replies:** 0\
**Last updated:** [May 30, 2022, 1:21am UTC](https://discourse.julialang.org/t/webio-installation-problem/81892 "2022-05-30T01:21:16Z")

</div>

I was trying to use the @manipulate macro using the Interact package in my regular Jupyter Notebook. But I was having trouble with this. I tried uninstalling and reinstalling as instructed to here IJulia (Jupyter) · WebI…

---

## [ArgumentError: invalid index: 1.0 of type Float64](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862)

<div class="topic-metadata">

**Author:** [@kip0d](https://discourse.julialang.org/u/kip0d)\
**Replies:** 3\
**Last updated:** [May 29, 2022, 11:51pm UTC](https://discourse.julialang.org/t/argumenterror-invalid-index-1-0-of-type-float64/81862 "2022-05-29T23:51:02Z")

</div>

Hi all, I get that error when I’m trying to run this code: filename="channelABCD\_2021-12-31\_10-20-45.wav" y,Fs = wavread(filename) Y=y\[1:3.6e7,2\] ERROR: ArgumentError: invalid index: 1.0 of type Float64 Thank you for…

---

## [Destructuring Type Parameters](https://discourse.julialang.org/t/destructuring-type-parameters/81881)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 3\
**Last updated:** [May 29, 2022, 11:43pm UTC](https://discourse.julialang.org/t/destructuring-type-parameters/81881 "2022-05-29T23:43:57Z")

</div>

Is there any way to destructure type parameters when defining parametric types and methods. Something along the lines of struct Foo{U{T}} end # Examples Foo{Vector{Int}}() Foo{AbstractArray{Int}}() I know this parti…

---

## [ReTest, module system issues](https://discourse.julialang.org/t/retest-module-system-issues/81885)

<div class="topic-metadata">

**Author:** [@jcbritobr](https://discourse.julialang.org/u/jcbritobr)\
**Replies:** 26\
**Last updated:** [May 29, 2022, 11:22pm UTC](https://discourse.julialang.org/t/retest-module-system-issues/81885 "2022-05-29T23:22:39Z")

</div>

Hello, good afternoon, I’m trying to test some modules, but I’m having issues with ReTest and the module system. I had this custom modules and is all added to “.” path. RunTests.jl file, I’m getting the UndefVarError: …

---

## [How to restrict type parameter to be subclass of a parameterized type](https://discourse.julialang.org/t/how-to-restrict-type-parameter-to-be-subclass-of-a-parameterized-type/81854)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 1\
**Last updated:** [May 29, 2022, 9:15am UTC](https://discourse.julialang.org/t/how-to-restrict-type-parameter-to-be-subclass-of-a-parameterized-type/81854 "2022-05-29T09:15:18Z")

</div>

I am looking to perform something like this: abstract type Foo{T} end struct Bar{T, U} \<: Foo{U} bar :: U end struct Baz{T} \<: Foo{U} where T \<: Foo{U} where U baz :: U end That is I would like to parameteriz…

---

## [Sampling from Turing model combining discrete and continuous variables fails on second loop through the model](https://discourse.julialang.org/t/sampling-from-turing-model-combining-discrete-and-continuous-variables-fails-on-second-loop-through-the-model/81889)

<div class="topic-metadata">

**Author:** [@Canaan\_Breiss](https://discourse.julialang.org/u/Canaan_Breiss)\
**Replies:** 0\
**Last updated:** [May 29, 2022, 9:35pm UTC](https://discourse.julialang.org/t/sampling-from-turing-model-combining-discrete-and-continuous-variables-fails-on-second-loop-through-the-model/81889 "2022-05-29T21:35:13Z")

</div>

Hi, I’m trying to write a model that simultaneously estimates the mean of two underlying components, while also inferring component membership, with by-subject random intercepts. The data I have are synthetic, 120 subjec…

---

## [Error in Pkg.update()](https://discourse.julialang.org/t/error-in-pkg-update/81837)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 3\
**Last updated:** [May 29, 2022, 8:18pm UTC](https://discourse.julialang.org/t/error-in-pkg-update/81837 "2022-05-29T20:18:31Z")

</div>

What’s wrong with this problem? julia\> using Pkg julia\> Pkg.update() Updating registry at \`~/.julia/registries/General.toml\` ┌ Warning: could not download https://pkg.julialang.org/registries │ exception = Connec…

---

## [Stipple plotting markers with color](https://discourse.julialang.org/t/stipple-plotting-markers-with-color/81320)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 15\
**Last updated:** [May 29, 2022, 5:30pm UTC](https://discourse.julialang.org/t/stipple-plotting-markers-with-color/81320 "2022-05-29T17:30:08Z")

</div>

How the markers can be plotted with color based on a third variable (in addition of x and y)? import Stipple import Stipple: @with\_kw, @reactors, R, ChannelName import Genie import StippleUI import StipplePlotly @Stipp…

---

## [How to embed a .png file in README.md](https://discourse.julialang.org/t/how-to-embed-a-png-file-in-readme-md/81859)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [May 29, 2022, 10:50am UTC](https://discourse.julialang.org/t/how-to-embed-a-png-file-in-readme-md/81859 "2022-05-29T10:50:58Z")

</div>

What is the best way of embedding a .png file in a README.md file for a package on Github? I currently use: \<p align="center"\>\<img src="./docs/kite\_power\_tools.png" width="500" /\>\</p\> That works fine on github: GitHub…

---

## [Plotting a thematic map with a continuous color scale](https://discourse.julialang.org/t/plotting-a-thematic-map-with-a-continuous-color-scale/81695)

<div class="topic-metadata">

**Author:** [@Brinkhuis](https://discourse.julialang.org/u/Brinkhuis)\
**Replies:** 9\
**Last updated:** [May 29, 2022, 10:19am UTC](https://discourse.julialang.org/t/plotting-a-thematic-map-with-a-continuous-color-scale/81695 "2022-05-29T10:19:31Z")

</div>

I would like to plot a thematic map (choropleth) using Plots.jl. The DataFrame df I use has 3 columns: geometry, value1 and value2. The column geometry is of element type Polygon (data was read using the Shapefile packag…

---

## [Rhombic Dodecahedron](https://discourse.julialang.org/t/rhombic-dodecahedron/81743)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 1\
**Last updated:** [May 29, 2022, 8:50am UTC](https://discourse.julialang.org/t/rhombic-dodecahedron/81743 "2022-05-29T08:50:09Z")

</div>

Dear all, I was wondering whether there an existing package that allows to generate shapes such as rhombic dodecahedron. I am trying to make a 3D model (Cartesian regular mesh) in which I would like to identify cell ce…

---

## [Does Julia has the similar command \`clear all\` or \`cls\` in matlab?](https://discourse.julialang.org/t/does-julia-has-the-similar-command-clear-all-or-cls-in-matlab/81809)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 8\
**Last updated:** [May 29, 2022, 1:03am UTC](https://discourse.julialang.org/t/does-julia-has-the-similar-command-clear-all-or-cls-in-matlab/81809 "2022-05-29T01:03:08Z")

</div>

Dear all, Does Julia has the similar command clear all or cls in matlab? I want to clear all the variable or packages which are used.

---

## [Extracting type parameters from type with many parameters](https://discourse.julialang.org/t/extracting-type-parameters-from-type-with-many-parameters/81843)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 6\
**Last updated:** [May 29, 2022, 12:07am UTC](https://discourse.julialang.org/t/extracting-type-parameters-from-type-with-many-parameters/81843 "2022-05-29T00:07:05Z")

</div>

I’ve got a type with six type parameters, something like this: struct MyType{A \<: S, a0, a1, B \<: T, b0, b1} end My problem is that I want access to the type parameters in functions which take MyType values as argument…

---

## [Reading and writing Apache arrow files](https://discourse.julialang.org/t/reading-and-writing-apache-arrow-files/81838)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [May 28, 2022, 8:01pm UTC](https://discourse.julialang.org/t/reading-and-writing-apache-arrow-files/81838 "2022-05-28T20:01:40Z")

</div>

Hello, I am writing my log files in apache arrow format using Arrow.jl User Manual · Arrow.jl Now I want to read it in Python, see Feather File Format — Apache Arrow v9.0.0 But the Python documentation mentions differ…

---

## [Using serial ports](https://discourse.julialang.org/t/using-serial-ports/81604)

<div class="topic-metadata">

**Author:** [@nhardy](https://discourse.julialang.org/u/nhardy)\
**Replies:** 8\
**Last updated:** [May 28, 2022, 7:04pm UTC](https://discourse.julialang.org/t/using-serial-ports/81604 "2022-05-28T19:04:12Z")

</div>

So, I am trying to stream data from a device over a serial port (RS232 via USB) in realtime. I saw two packages to talk to serial ports, SerialPorts (a wrapper on the Python SerialPorts package) and LibSerialPorts (a wra…

---

## [Initiate an array of functions](https://discourse.julialang.org/t/initiate-an-array-of-functions/81834)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 4\
**Last updated:** [May 28, 2022, 3:15pm UTC](https://discourse.julialang.org/t/initiate-an-array-of-functions/81834 "2022-05-28T15:15:53Z")

</div>

I have func1 and func2. When I create an array of the functions, like: julia\> A = \[func1, func2\] 2-element Vector{Function}: func1 (generic function with 4 methods) func2 (generic function with 4 methods) That is g…

---

## [Portable Julia](https://discourse.julialang.org/t/portable-julia/45339)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 22\
**Last updated:** [May 28, 2022, 1:36pm UTC](https://discourse.julialang.org/t/portable-julia/45339 "2022-05-28T13:36:55Z")

</div>

I noticed that a portable Julia is now available for the Windows platform. I think this might lead to a Julia-on-a-stick, but a little bit more work is required, I think. I started putting together a bash script for th…

---

## [Why is dot plus faster?](https://discourse.julialang.org/t/why-is-dot-plus-faster/81830)

<div class="topic-metadata">

**Author:** [@thisismygitrepo](https://discourse.julialang.org/u/thisismygitrepo)\
**Replies:** 6\
**Last updated:** [May 28, 2022, 12:57pm UTC](https://discourse.julialang.org/t/why-is-dot-plus-faster/81830 "2022-05-28T12:57:52Z")

</div>

I’m experimenting with differnt expression and I can’t explain why the dot + is faster than just + in the simple case of matrix addition. using BenchmarkTools A = rand(100, 100) B = rand(100, 100) function no\_dot(A,…

---

## [Mid-chain array comprehensions affect (join) broadcasting behavior?](https://discourse.julialang.org/t/mid-chain-array-comprehensions-affect-join-broadcasting-behavior/81829)

<div class="topic-metadata">

**Author:** [@kostas-emman](https://discourse.julialang.org/u/kostas-emman)\
**Replies:** 0\
**Last updated:** [May 28, 2022, 10:36am UTC](https://discourse.julialang.org/t/mid-chain-array-comprehensions-affect-join-broadcasting-behavior/81829 "2022-05-28T10:36:36Z")

</div>

I could do what is presented here in a different way (e.g. using replace) but please bear with me since I am more interested in the intuition behind the behavior presented below. I use Julia 1.7.3. If I have a 2-elemen…

---

## [The following package names could not be resolved: \* Makie (not found in project, manifest or registry)](https://discourse.julialang.org/t/the-following-package-names-could-not-be-resolved-makie-not-found-in-project-manifest-or-registry/48682)

<div class="topic-metadata">

**Author:** [@zlq178](https://discourse.julialang.org/u/zlq178)\
**Replies:** 3\
**Last updated:** [May 28, 2022, 10:37am UTC](https://discourse.julialang.org/t/the-following-package-names-could-not-be-resolved-makie-not-found-in-project-manifest-or-registry/48682 "2022-05-28T10:37:11Z")

</div>

I want to add “Makie” package,But it shows me such error: The following package names could not be resolved: \* Makie (not found in project, manifest or registry) My Julia version is 1.5.1-1 How can I solve it?

---

## [How can I determine the free memory?](https://discourse.julialang.org/t/how-can-i-determine-the-free-memory/81819)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [May 28, 2022, 6:56am UTC](https://discourse.julialang.org/t/how-can-i-determine-the-free-memory/81819 "2022-05-28T06:56:39Z")

</div>

Is there a way to determine the free and the used memory with Julia? Perhaps even free heap and free stack?

---

## [Efficiency for calling Julia from python and purely run Julia](https://discourse.julialang.org/t/efficiency-for-calling-julia-from-python-and-purely-run-julia/81484)

<div class="topic-metadata">

**Author:** [@Geositta](https://discourse.julialang.org/u/Geositta)\
**Replies:** 20\
**Last updated:** [May 28, 2022, 2:51am UTC](https://discourse.julialang.org/t/efficiency-for-calling-julia-from-python-and-purely-run-julia/81484 "2022-05-28T02:51:32Z")

</div>

I have the follow Julia code using BenchmarkTools, LoopVectorization, TensorOperations function test7(A) @tensor B\[i,j,k,l\] := 0.1\*A\[i,j,k,l\] + 0.2\*A\[j,i,k,l\] B end @btime test7(A) setup=(n=30; A=rand(Flo…

---

## [Is it possible to see performant string processing without sacrificing ease of use in Julia one day?](https://discourse.julialang.org/t/is-it-possible-to-see-performant-string-processing-without-sacrificing-ease-of-use-in-julia-one-day/81698)

<div class="topic-metadata">

**Author:** [@ReneganRonin](https://discourse.julialang.org/u/ReneganRonin)\
**Replies:** 7\
**Last updated:** [May 28, 2022, 2:46am UTC](https://discourse.julialang.org/t/is-it-possible-to-see-performant-string-processing-without-sacrificing-ease-of-use-in-julia-one-day/81698 "2022-05-28T02:46:07Z")

</div>

I have heard a lot that string performance in Julia is bad. So is it possible to see performant string processing without sacrificing ease of use in Julia one day?

---

## [Simple conversion from Time to Period?](https://discourse.julialang.org/t/simple-conversion-from-time-to-period/81781)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 10\
**Last updated:** [May 27, 2022, 10:01pm UTC](https://discourse.julialang.org/t/simple-conversion-from-time-to-period/81781 "2022-05-27T22:01:23Z")

</div>

I could do Time(12).instant, but that is probably not good practice. Doing Time(12) - Time(0) seems odd. Is there some proper way to convert Time to Period? One thing that motivates this question is that I want to calcu…

---

## [How does Vector{Int64}(undef, 20) differ in a multi-threaded environment?](https://discourse.julialang.org/t/how-does-vector-int64-undef-20-differ-in-a-multi-threaded-environment/81802)

<div class="topic-metadata">

**Author:** [@finb](https://discourse.julialang.org/u/finb)\
**Replies:** 4\
**Last updated:** [May 27, 2022, 8:45pm UTC](https://discourse.julialang.org/t/how-does-vector-int64-undef-20-differ-in-a-multi-threaded-environment/81802 "2022-05-27T20:45:50Z")

</div>

I’m running a program that allocates an array of 20 integers, which I want to be initialized with zeros. So to start off with, I did this: myfunc(Vector{Int64}(undef, 20)) This worked as the array would be filled with …

---

## [Check that every subtype has a method defined](https://discourse.julialang.org/t/check-that-every-subtype-has-a-method-defined/81811)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 0\
**Last updated:** [May 27, 2022, 7:26pm UTC](https://discourse.julialang.org/t/check-that-every-subtype-has-a-method-defined/81811 "2022-05-27T19:26:12Z")

</div>

Say I have an abstract type with some structs, and I want to make sure some method is defined on every subtype. For example: abstract type Shape end struct Square \<: Shape length::Float64 end struct Circle \<: Shape…

---

## [What is the cleanest/best way to implement dynamic loading of Julia code?](https://discourse.julialang.org/t/what-is-the-cleanest-best-way-to-implement-dynamic-loading-of-julia-code/81579)

<div class="topic-metadata">

**Author:** [@Euhan](https://discourse.julialang.org/u/Euhan)\
**Replies:** 13\
**Last updated:** [May 27, 2022, 7:04pm UTC](https://discourse.julialang.org/t/what-is-the-cleanest-best-way-to-implement-dynamic-loading-of-julia-code/81579 "2022-05-27T19:04:15Z")

</div>

I am writing here to ask for advice on how to achieve loading of Julia code during runtime. This is not a question on how exactly any particular mechanism works but rather I ask for a more high-level advice before commit…

---

## [Offset array package with offsets in the type?](https://discourse.julialang.org/t/offset-array-package-with-offsets-in-the-type/81772)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 12\
**Last updated:** [May 27, 2022, 6:43pm UTC](https://discourse.julialang.org/t/offset-array-package-with-offsets-in-the-type/81772 "2022-05-27T18:43:45Z")

</div>

I’m a bit disappointed to realize that in OffsetArrays the offsets are a struct field instead of a type parameter. Do any alternative packages exist?

---

## [Problems with Optimising Function](https://discourse.julialang.org/t/problems-with-optimising-function/81601)

<div class="topic-metadata">

**Author:** [@mauri5566](https://discourse.julialang.org/u/mauri5566)\
**Replies:** 2\
**Last updated:** [May 27, 2022, 6:05pm UTC](https://discourse.julialang.org/t/problems-with-optimising-function/81601 "2022-05-27T18:05:15Z")

</div>

I’m having a tough time optimising and parallelising this function that executes a simplex extrusion (solid modeling). Anything to make it faster would be great, even a couple macros. function extrudeSimplicial(model::L…

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

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