# General Usage

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

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

**Page:** 463

---

## [Documenting useful packages, such as Match.jl and ConcurrentUtils.jl](https://discourse.julialang.org/t/documenting-useful-packages-such-as-match-jl-and-concurrentutils-jl/79232)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [April 8, 2022, 4:04pm UTC](https://discourse.julialang.org/t/documenting-useful-packages-such-as-match-jl-and-concurrentutils-jl/79232 "2022-04-08T16:04:28Z")

</div>

I suggest documenting the availability of packages (useful for most), centrally somewhere, such as I did at: https://en.wikibooks.org/w/index.php?title=Introducing\_Julia&oldid=4046435 For now I only added a few package…

---

## [Is there something like pywin32 in Julia?](https://discourse.julialang.org/t/is-there-something-like-pywin32-in-julia/37024)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 2\
**Last updated:** [April 8, 2022, 3:33pm UTC](https://discourse.julialang.org/t/is-there-something-like-pywin32-in-julia/37024 "2022-04-08T15:33:35Z")

</div>

Is there something like pywin32 in Julia? I want to use the stmafm ole/com interface. PyCall could work, but I am curious if there is a Julia native option.

---

## [Combining SimpleTraits.jl traits on one type](https://discourse.julialang.org/t/combining-simpletraits-jl-traits-on-one-type/73644)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 5\
**Last updated:** [April 8, 2022, 2:49pm UTC](https://discourse.julialang.org/t/combining-simpletraits-jl-traits-on-one-type/73644 "2022-04-08T14:49:37Z")

</div>

I recently got a little into SimpleTraits - and I like it quite well. But I have a question considering the combination of traits. Consider the following MWE (just noticed, maybe AbstractA is not necessary in general) u…

---

## [Zygote for Dictionaries does not work (specifically the Pullback)](https://discourse.julialang.org/t/zygote-for-dictionaries-does-not-work-specifically-the-pullback/79222)

<div class="topic-metadata">

**Author:** [@Eriklw](https://discourse.julialang.org/u/Eriklw)\
**Replies:** 0\
**Last updated:** [April 8, 2022, 1:15pm UTC](https://discourse.julialang.org/t/zygote-for-dictionaries-does-not-work-specifically-the-pullback/79222 "2022-04-08T13:15:31Z")

</div>

The pullback function does not seem to work for dictionaries, while the gradient does. Is that true or am I doing somthing wrong? Example for the gradient: inp = Dict{Any, Any}(1 =\> 1, 2 =\> 1) f(x) = x\[1\] \* x\[2\] \* 5 g…

---

## [KeyError when writing Parquet files to S3](https://discourse.julialang.org/t/keyerror-when-writing-parquet-files-to-s3/79187)

<div class="topic-metadata">

**Author:** [@a.frist](https://discourse.julialang.org/u/a.frist)\
**Replies:** 1\
**Last updated:** [April 8, 2022, 1:09pm UTC](https://discourse.julialang.org/t/keyerror-when-writing-parquet-files-to-s3/79187 "2022-04-08T13:09:53Z")

</div>

I’m trying to write a parquet file to S3 and I’m just not sure exactly what the issue is. This code has worked in the past and there doesn’t seem to be a significant change to the underlying data. Potentially, all the va…

---

## [How to get a typed empty array?](https://discourse.julialang.org/t/how-to-get-a-typed-empty-array/79206)

<div class="topic-metadata">

**Author:** [@Katamari](https://discourse.julialang.org/u/Katamari)\
**Replies:** 5\
**Last updated:** [April 8, 2022, 9:19am UTC](https://discourse.julialang.org/t/how-to-get-a-typed-empty-array/79206 "2022-04-08T09:19:44Z")

</div>

I need an empty array with type Tuple{Float64} to solve the following problem. I want to scatter points using CairoMakie. The following code works: using CairoMakie scatter(\[(1, 1)\]) The following code doesn’t work: …

---

## [Bug in DistributedArrays? Pushing to first local part pushes to all local parts](https://discourse.julialang.org/t/bug-in-distributedarrays-pushing-to-first-local-part-pushes-to-all-local-parts/79201)

<div class="topic-metadata">

**Author:** [@jsbryan4](https://discourse.julialang.org/u/jsbryan4)\
**Replies:** 1\
**Last updated:** [April 8, 2022, 7:28am UTC](https://discourse.julialang.org/t/bug-in-distributedarrays-pushing-to-first-local-part-pushes-to-all-local-parts/79201 "2022-04-08T07:28:54Z")

</div>

I found what I believe to be a bug in DistributedArrays. I am trying to push to the first local part of an array but it ends up pushing to all of the local parts. using Distributed addprocs(4) @everywhere using Distribu…

---

## [String indexing bug?](https://discourse.julialang.org/t/string-indexing-bug/79198)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 4\
**Last updated:** [April 8, 2022, 5:22am UTC](https://discourse.julialang.org/t/string-indexing-bug/79198 "2022-04-08T05:22:49Z")

</div>

str = "(θ,)" str\[3\] results in ERROR: StringIndexError: invalid index \[3\], valid nearby indices \[2\]=\>'θ', \[4\]=\>',' Stacktrace: \[1\] string\_index\_err(s::String, i::Int64) @ Base ./strings/string.jl:12 \[2\] getindex\_c…

---

## [Speeding up contraction mapping](https://discourse.julialang.org/t/speeding-up-contraction-mapping/79134)

<div class="topic-metadata">

**Author:** [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Replies:** 7\
**Last updated:** [April 8, 2022, 12:27am UTC](https://discourse.julialang.org/t/speeding-up-contraction-mapping/79134 "2022-04-08T00:27:21Z")

</div>

Hello everyone, I’m implementing the demand estimation for Berry-Levinsohn-Pakes (1995) for my research, and it would be great to get some help on this. While my code works, it takes a while, and so I was looking to spe…

---

## [First steps into Machine Learning?](https://discourse.julialang.org/t/first-steps-into-machine-learning/79153)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 4\
**Last updated:** [April 7, 2022, 8:25pm UTC](https://discourse.julialang.org/t/first-steps-into-machine-learning/79153 "2022-04-07T20:25:38Z")

</div>

Hi everyone!. So … I am a ML newbie (I actually have just finished reading Jeremy Watt’s book and was able to understand some of it). Now I would like to do some computational testing, for example I have a task I need t…

---

## [Getting the boundary of fonts as points](https://discourse.julialang.org/t/getting-the-boundary-of-fonts-as-points/79114)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 8\
**Last updated:** [April 7, 2022, 4:29pm UTC](https://discourse.julialang.org/t/getting-the-boundary-of-fonts-as-points/79114 "2022-04-07T16:29:59Z")

</div>

I want to plot letters/fonts as curves, hence access to a more point-like representation. I’m looking for a way to get a point\[all pixels\] or curve\[boundary\] representation of fonts maybe normalised within a unit box, n…

---

## [Closing a TCP stream (behavior difference from NodeJS?)](https://discourse.julialang.org/t/closing-a-tcp-stream-behavior-difference-from-nodejs/79140)

<div class="topic-metadata">

**Author:** [@guille](https://discourse.julialang.org/u/guille)\
**Replies:** 2\
**Last updated:** [April 7, 2022, 4:09pm UTC](https://discourse.julialang.org/t/closing-a-tcp-stream-behavior-difference-from-nodejs/79140 "2022-04-07T16:09:20Z")

</div>

Heya! I had a (hopefully) simple question regarding the behavior of close on a TCP stream. We have some server which is taking inputs from a client and the spec requires us drop a connection if the client sends some mal…

---

## [Current OpenBLAS Versions (January 2022) do not support Intel gen 11 performantly?](https://discourse.julialang.org/t/current-openblas-versions-january-2022-do-not-support-intel-gen-11-performantly/75104)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 50\
**Last updated:** [April 7, 2022, 2:35pm UTC](https://discourse.julialang.org/t/current-openblas-versions-january-2022-do-not-support-intel-gen-11-performantly/75104 "2022-04-07T14:35:27Z")

</div>

julia\> BLAS.get\_config() LinearAlgebra.BLAS.LBTConfig Libraries: └ \[ILP64\] libopenblas64\_.dll julia\> A=randn(10000,10000); julia\> @elapsed A\*A 31.8050192 julia\> @elapsed A\*A 32.776766 julia\> using MKL julia\> @elapse…

---

## [How to define a macro that evaluates in local scope](https://discourse.julialang.org/t/how-to-define-a-macro-that-evaluates-in-local-scope/79173)

<div class="topic-metadata">

**Author:** [@jpdoane](https://discourse.julialang.org/u/jpdoane)\
**Replies:** 2\
**Last updated:** [April 7, 2022, 2:32pm UTC](https://discourse.julialang.org/t/how-to-define-a-macro-that-evaluates-in-local-scope/79173 "2022-04-07T14:32:51Z")

</div>

I am trying to write a custom benchmarking macro, but as a first step I cannot seem to write even a trivial macro that transparently executes an arbitrary expression. Specifically if the expression is a variable assign…

---

## [How to handle vector like in numpy?](https://discourse.julialang.org/t/how-to-handle-vector-like-in-numpy/79167)

<div class="topic-metadata">

**Author:** [@egor](https://discourse.julialang.org/u/egor)\
**Replies:** 5\
**Last updated:** [April 7, 2022, 1:56pm UTC](https://discourse.julialang.org/t/how-to-handle-vector-like-in-numpy/79167 "2022-04-07T13:56:31Z")

</div>

Hello everyone, in python, I often use this construction from numpy to select the necessary elements of an array: counter = (array \>= threshold).sum() Is there something similar for vectors in julia or is it just to us…

---

## [Methods of a function that has both optional positional argument and keyword argument](https://discourse.julialang.org/t/methods-of-a-function-that-has-both-optional-positional-argument-and-keyword-argument/78869)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 6\
**Last updated:** [April 7, 2022, 1:45pm UTC](https://discourse.julialang.org/t/methods-of-a-function-that-has-both-optional-positional-argument-and-keyword-argument/78869 "2022-04-07T13:45:41Z")

</div>

I know keyword arguments don’t invoke multiple dispatch. So methods with the same positional arguments except keyword arguments can overload each other: julia\> f(a) = a f (generic function with 1 method) julia\> methods…

---

## [Reduce the allocation to zero](https://discourse.julialang.org/t/reduce-the-allocation-to-zero/79160)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 7\
**Last updated:** [April 7, 2022, 1:07pm UTC](https://discourse.julialang.org/t/reduce-the-allocation-to-zero/79160 "2022-04-07T13:07:29Z")

</div>

I have a question about whether it’s possible to reduce the following simple case allocation to zero a = rand(5) b = rand(5) c = rand(5) d = rand(5) N = rand(8) @time acl = sum(a) \* (N\[1\] - N\[5\]) + sum(b) \* (N\[2\] - N\[6…

---

## [How to get a functions keyword argument types?](https://discourse.julialang.org/t/how-to-get-a-functions-keyword-argument-types/78781)

<div class="topic-metadata">

**Author:** [@onetonfoot](https://discourse.julialang.org/u/onetonfoot)\
**Replies:** 1\
**Last updated:** [April 7, 2022, 12:59pm UTC](https://discourse.julialang.org/t/how-to-get-a-functions-keyword-argument-types/78781 "2022-04-07T12:59:16Z")

</div>

How can I get the types for the keyword arguments of a function? For example, with normal arguments I can use f(x::Int) = x methods(f)\[1\].sig #Tuple{typeof(f), Int64} I’m looking for something along the lines of g(x::…

---

## [Bind UDP socket to interface](https://discourse.julialang.org/t/bind-udp-socket-to-interface/79164)

<div class="topic-metadata">

**Author:** [@Tine](https://discourse.julialang.org/u/Tine)\
**Replies:** 0\
**Last updated:** [April 7, 2022, 12:42pm UTC](https://discourse.julialang.org/t/bind-udp-socket-to-interface/79164 "2022-04-07T12:42:06Z")

</div>

Is it possible to bind a UDP socket to a specific ethernet interface? I looked at the option to call the C-function setsockopt() from Julia using ccall, but how do I do this, if this is at all possible? I want somethin…

---

## [Inexplicable pause in Julia execution](https://discourse.julialang.org/t/inexplicable-pause-in-julia-execution/79076)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 4\
**Last updated:** [April 7, 2022, 8:06am UTC](https://discourse.julialang.org/t/inexplicable-pause-in-julia-execution/79076 "2022-04-07T08:06:06Z")

</div>

I have an application that checks for files placed in a certain directory and then processes the files and waits for the next file. Yesterday we fixed a bug and set the program to work again. This morning when I checke…

---

## [Reducing getindex allocation \[edit: when using an array as index\]](https://discourse.julialang.org/t/reducing-getindex-allocation-edit-when-using-an-array-as-index/79116)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 17\
**Last updated:** [April 7, 2022, 7:54am UTC](https://discourse.julialang.org/t/reducing-getindex-allocation-edit-when-using-an-array-as-index/79116 "2022-04-07T07:54:33Z")

</div>

I need to access a matrix millions of times, and I noticed that most of the allocations of my code come exactly from this. My code is similar to the following example const A = rand(10,10) function get\_number(idx) @inb…

---

## [Incomplete page rendering](https://discourse.julialang.org/t/incomplete-page-rendering/79027)

<div class="topic-metadata">

**Author:** [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Replies:** 1\
**Last updated:** [April 7, 2022, 7:25am UTC](https://discourse.julialang.org/t/incomplete-page-rendering/79027 "2022-04-07T07:25:56Z")

</div>

Benifiting from the convenint pkg Franklin, I created a personal site to collect daily notes. In the site, a mysite/notes/index.md is used to list the note items. The full content of mysite/notes/index.md is presented as…

---

## [Disable vscode blue wave warning "The included file can not be found."](https://discourse.julialang.org/t/disable-vscode-blue-wave-warning-the-included-file-can-not-be-found/79087)

<div class="topic-metadata">

**Author:** [@Himbeersternchen](https://discourse.julialang.org/u/Himbeersternchen)\
**Replies:** 2\
**Last updated:** [April 6, 2022, 1:49pm UTC](https://discourse.julialang.org/t/disable-vscode-blue-wave-warning-the-included-file-can-not-be-found/79087 "2022-04-06T13:49:00Z")

</div>

Hi Guys, i have in a julia scripts main.jl the code line @everywhere include(“test/test\_functions.jl”) and i ran it in REPL or terminal, it’s no problem (this project must be ran in the project folder not in the test …

---

## [Documenting a parametric callable struct](https://discourse.julialang.org/t/documenting-a-parametric-callable-struct/79135)

<div class="topic-metadata">

**Author:** [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Replies:** 2\
**Last updated:** [April 7, 2022, 5:41am UTC](https://discourse.julialang.org/t/documenting-a-parametric-callable-struct/79135 "2022-04-07T05:41:19Z")

</div>

I want to document a callable, parametric struct, but the docstring for the function does not show up. This question is similar to Documenting a functor / callable struct, but the fix (https://github.com/JuliaLang/julia…

---

## [Limit number of threads from Threads.@threads](https://discourse.julialang.org/t/limit-number-of-threads-from-threads-threads/79118)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 4\
**Last updated:** [April 6, 2022, 10:38pm UTC](https://discourse.julialang.org/t/limit-number-of-threads-from-threads-threads/79118 "2022-04-06T22:38:26Z")

</div>

Is there any way to limit the number of threads used in Threads.@threads loops (for instance, use at most 3 threads)? I have a nested function where both inner and outer function does multithreading, but due to memory c…

---

## [BifurcationKit.jl incorrect automatic branch switching at simple branch point](https://discourse.julialang.org/t/bifurcationkit-jl-incorrect-automatic-branch-switching-at-simple-branch-point/78721)

<div class="topic-metadata">

**Author:** [@sceptri](https://discourse.julialang.org/u/sceptri)\
**Replies:** 8\
**Last updated:** [April 6, 2022, 8:46pm UTC](https://discourse.julialang.org/t/bifurcationkit-jl-incorrect-automatic-branch-switching-at-simple-branch-point/78721 "2022-04-06T20:46:02Z")

</div>

Hello, I have a simple 2D system and I tried continuation from simple branch points using Plots, BifurcationKit, Setfield, ForwardDiff, Parameters const BK = BifurcationKit function f(x,p) @unpack a,g,γ,r,d = p M,C =…

---

## [Can't make head nor tails of this error message: package won't compile](https://discourse.julialang.org/t/cant-make-head-nor-tails-of-this-error-message-package-wont-compile/79121)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 2\
**Last updated:** [April 6, 2022, 8:25pm UTC](https://discourse.julialang.org/t/cant-make-head-nor-tails-of-this-error-message-package-wont-compile/79121 "2022-04-06T20:25:53Z")

</div>

Failed to precompile CovidSim\_ilm \[top-level\] to /Users/lewis/.julia/compiled/v1.7/jl\_B3U1A7. Stacktrace: \[1\] error(s::String) @ Base ./error.jl:33 \[2\] compilecache(pkg::Base.PkgId, path::String, internal\_stderr…

---

## [Understanding @time memory allocations](https://discourse.julialang.org/t/understanding-time-memory-allocations/79075)

<div class="topic-metadata">

**Author:** [@qt\_codes](https://discourse.julialang.org/u/qt_codes)\
**Replies:** 7\
**Last updated:** [April 6, 2022, 5:44pm UTC](https://discourse.julialang.org/t/understanding-time-memory-allocations/79075 "2022-04-06T17:44:35Z")

</div>

I am timing a function in my code am confused as to why my memory allocations while compiling go up when I make the input smaller. The function is called twice, so I can look at pre and post compiling. @time begin m…

---

## [Registering information to a module global dict using macros](https://discourse.julialang.org/t/registering-information-to-a-module-global-dict-using-macros/77766)

<div class="topic-metadata">

**Author:** [@mkschleg](https://discourse.julialang.org/u/mkschleg)\
**Replies:** 1\
**Last updated:** [April 6, 2022, 4:44pm UTC](https://discourse.julialang.org/t/registering-information-to-a-module-global-dict-using-macros/77766 "2022-04-06T16:44:07Z")

</div>

Hello! I’m trying to get some convenience functionality working for a macro I’m working on. What I want to do is register a key and where this key occurs in both the internal package and external uses of the package. You…

---

## [Efficiently interpreting byte-packed buffer](https://discourse.julialang.org/t/efficiently-interpreting-byte-packed-buffer/78975)

<div class="topic-metadata">

**Author:** [@nhardy](https://discourse.julialang.org/u/nhardy)\
**Replies:** 31\
**Last updated:** [April 6, 2022, 4:41pm UTC](https://discourse.julialang.org/t/efficiently-interpreting-byte-packed-buffer/78975 "2022-04-06T16:41:06Z")

</div>

tl;dr Is there a built-in way to interpret (or instantiate from) a byte-packed buffer to a Julia struct? If not, is there an efficient, non-allocating method to instantiate a new struct from the buffer data? I am repl…

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

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