# General Usage

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

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

**Page:** 495

---

## [A macro to unroll by hand but not by hand?](https://discourse.julialang.org/t/a-macro-to-unroll-by-hand-but-not-by-hand/74633)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 24\
**Last updated:** [January 19, 2022, 7:43pm UTC](https://discourse.julialang.org/t/a-macro-to-unroll-by-hand-but-not-by-hand/74633 "2022-01-19T19:43:34Z")

</div>

Hey, I have a computation that we already discussed there and which still takes up more than half of my total runtime (so days…). I did found a very clunky way to cut in half it’s runtime by manually unrolling a loop, …

---

## [IJulia notebook using a system image?](https://discourse.julialang.org/t/ijulia-notebook-using-a-system-image/74797)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 7\
**Last updated:** [January 19, 2022, 2:53pm UTC](https://discourse.julialang.org/t/ijulia-notebook-using-a-system-image/74797 "2022-01-19T14:53:38Z")

</div>

I’m starting to explore using notebooks for teaching (econometrics) purposes. There are some nice resources out there to steal ideas from, for example, GitHub - PaulSoderlind/JuliaTutorial: Julia Tutorial for Finance …

---

## [Add a prefix to every \`println()\` output](https://discourse.julialang.org/t/add-a-prefix-to-every-println-output/74463)

<div class="topic-metadata">

**Author:** [@Sushant-Padha](https://discourse.julialang.org/u/Sushant-Padha)\
**Replies:** 7\
**Last updated:** [January 19, 2022, 2:51pm UTC](https://discourse.julialang.org/t/add-a-prefix-to-every-println-output/74463 "2022-01-19T14:51:25Z")

</div>

When using logging macros with Julia, I noticed that the output is framed, i.e., it uses certain unicode characters as prefix to create a one-sided frame, like so: julia\> warning = """Lorem ipsum dolor sit amet, consect…

---

## [Generate function with keyword arguments from \`Symbolics\` expression](https://discourse.julialang.org/t/generate-function-with-keyword-arguments-from-symbolics-expression/74556)

<div class="topic-metadata">

**Author:** [@adomasbaliuka](https://discourse.julialang.org/u/adomasbaliuka)\
**Replies:** 3\
**Last updated:** [January 19, 2022, 1:14pm UTC](https://discourse.julialang.org/t/generate-function-with-keyword-arguments-from-symbolics-expression/74556 "2022-01-19T13:14:31Z")

</div>

In what is now clearly a fool’s errand, I’m trying to copy and type out equations from publications, render them as LaTeX and then transform them into Julia code, with as little room for accidental errors as possible. (M…

---

## [Inheritance in Parametric Types](https://discourse.julialang.org/t/inheritance-in-parametric-types/74811)

<div class="topic-metadata">

**Author:** [@davibarreira](https://discourse.julialang.org/u/davibarreira)\
**Replies:** 7\
**Last updated:** [January 19, 2022, 12:56pm UTC](https://discourse.julialang.org/t/inheritance-in-parametric-types/74811 "2022-01-19T12:56:38Z")

</div>

Friends, I have a small conundrum in terms on code design, and some input is more than welcomed. So, I’m developing a plotting library, and I have a struct called Marker. Now, the code implements different markers, e.g.…

---

## [Knet on Julia 1.7.0 (?)](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860)

<div class="topic-metadata">

**Author:** [@mazzanti](https://discourse.julialang.org/u/mazzanti)\
**Replies:** 2\
**Last updated:** [January 19, 2022, 12:07pm UTC](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860 "2022-01-19T12:07:12Z")

</div>

Hi, I just wanted to give Knet a go in my ubuntu machine running Julia 1.7.0, but surprisingly things fail… I just installed it as standard @(v1.7) pkg\> add Knet @(v1.7) pkg\> test Knet @(v1.7) pkg\> test Knet … Test…

---

## [Julia - not able to capture looped back UDP packets in Wireshark](https://discourse.julialang.org/t/julia-not-able-to-capture-looped-back-udp-packets-in-wireshark/74553)

<div class="topic-metadata">

**Author:** [@VinodV](https://discourse.julialang.org/u/VinodV)\
**Replies:** 2\
**Last updated:** [January 19, 2022, 11:09am UTC](https://discourse.julialang.org/t/julia-not-able-to-capture-looped-back-udp-packets-in-wireshark/74553 "2022-01-19T11:09:53Z")

</div>

I have a UDP sender program here: #UDPSender.jl using Sockets sock = UDPSocket() bind(sock,IPv4(200,120,1,1),1025) data = \[0x00, 0x20, 0x00, 0x10, 0x00, 0x01, 0x00, 0x3f, 0x00, 0x08, 0x00, 0x00, 0x0b, 0xb8, 0x64, 0x00\]…

---

## [Embedded Julia segmentation fault when loading BSON file](https://discourse.julialang.org/t/embedded-julia-segmentation-fault-when-loading-bson-file/74795)

<div class="topic-metadata">

**Author:** [@AnHeuermann](https://discourse.julialang.org/u/AnHeuermann)\
**Replies:** 3\
**Last updated:** [January 19, 2022, 10:49am UTC](https://discourse.julialang.org/t/embedded-julia-segmentation-fault-when-loading-bson-file/74795 "2022-01-19T10:49:32Z")

</div>

Description I have some Julia function that I want to call from C. I have saved some Julia variable inside a BSON file that needs to be loaded before that Julia function is called. Calling Julia from C works and loading…

---

## [JuliaOptics performance discussion](https://discourse.julialang.org/t/juliaoptics-performance-discussion/74835)

<div class="topic-metadata">

**Author:** [@martin.d.maas](https://discourse.julialang.org/u/martin.d.maas)\
**Replies:** 7\
**Last updated:** [January 19, 2022, 4:20am UTC](https://discourse.julialang.org/t/juliaoptics-performance-discussion/74835 "2022-01-19T04:20:24Z")

</div>

Hi! I just happened to remember that this abandoned package came out in this forum during a discussion of performance benchmarks, and users’ expectations of performance in Julia vs other languages. As I happened to be …

---

## [Why are there allocations in my loop depending upon how I set a variable?](https://discourse.julialang.org/t/why-are-there-allocations-in-my-loop-depending-upon-how-i-set-a-variable/74819)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 18\
**Last updated:** [January 18, 2022, 11:32pm UTC](https://discourse.julialang.org/t/why-are-there-allocations-in-my-loop-depending-upon-how-i-set-a-variable/74819 "2022-01-18T23:32:46Z")

</div>

A little demo: The thing I am trying to wrap my head around is that I observed that a broadcast to combine three vectors would allocate in a loop: @time for step in 1:nsteps @. U1 = U0 + dt\*V0 + ((dt^2)/2)\*A0…

---

## [How to bind to the hotkey ctrl + backspace in the REPL?](https://discourse.julialang.org/t/how-to-bind-to-the-hotkey-ctrl-backspace-in-the-repl/74836)

<div class="topic-metadata">

**Author:** [@akriegman](https://discourse.julialang.org/u/akriegman)\
**Replies:** 0\
**Last updated:** [January 18, 2022, 10:18pm UTC](https://discourse.julialang.org/t/how-to-bind-to-the-hotkey-ctrl-backspace-in-the-repl/74836 "2022-01-18T22:18:54Z")

</div>

Following the directions in the documentation, I added the following into my startup.jl in order to make ctrl + backspace delete the previous word and ctrl + delete delete the next word: using REPL using REPL.LineEdit …

---

## [\`undefined reference\` and \`bad reloc address\` errors while using BinaryBuilder](https://discourse.julialang.org/t/undefined-reference-and-bad-reloc-address-errors-while-using-binarybuilder/74828)

<div class="topic-metadata">

**Author:** [@danielmatz](https://discourse.julialang.org/u/danielmatz)\
**Replies:** 3\
**Last updated:** [January 18, 2022, 9:45pm UTC](https://discourse.julialang.org/t/undefined-reference-and-bad-reloc-address-errors-while-using-binarybuilder/74828 "2022-01-18T21:45:18Z")

</div>

I’m trying to use BinaryBuilder for a private package, but I am getting some errors that I don’t understand. I can’t share the code, but I’m hoping that something in the error message or in my build\_tarballs.jl or makefi…

---

## [Stray Julia processes (with high cpu usages)](https://discourse.julialang.org/t/stray-julia-processes-with-high-cpu-usages/33303)

<div class="topic-metadata">

**Author:** [@goedman](https://discourse.julialang.org/u/goedman)\
**Replies:** 16\
**Last updated:** [January 18, 2022, 9:08pm UTC](https://discourse.julialang.org/t/stray-julia-processes-with-high-cpu-usages/33303 "2022-01-18T21:08:27Z")

</div>

Post High CPU Usage on Startup - VSCode OSX triggered my post. As the link mentions, the post was about "high-cpu-usage-on-startup-vscode-osx”. I responded but didn’t want to hijack that thread so deleted my post and dec…

---

## [Macros for Gtk.jl MIA](https://discourse.julialang.org/t/macros-for-gtk-jl-mia/74824)

<div class="topic-metadata">

**Author:** [@das](https://discourse.julialang.org/u/das)\
**Replies:** 5\
**Last updated:** [January 18, 2022, 8:58pm UTC](https://discourse.julialang.org/t/macros-for-gtk-jl-mia/74824 "2022-01-18T20:58:21Z")

</div>

I can’t find the macros for Gtk. Does anyone know where they are, how to download, install and invoke them. Without them, few of the examples will work. Many thanks.

---

## [Why do \`$\`s in BenchmarkTools change allocations so dramatically?](https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 14\
**Last updated:** [January 18, 2022, 7:38pm UTC](https://discourse.julialang.org/t/why-do-s-in-benchmarktools-change-allocations-so-dramatically/74779 "2022-01-18T19:38:27Z")

</div>

EDIT: PLEASE IGNORE THIS ENTIRE THREAD. I will start another one. Weird. I have a copy of vectors. using LinearAlgebra using BenchmarkTools N = 10 U1 = rand(N) U0 = rand(N) @btime copyto!(U1, U0) @btime $U1 .= $U0…

---

## [Find definition in julia](https://discourse.julialang.org/t/find-definition-in-julia/74827)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 0\
**Last updated:** [January 18, 2022, 7:04pm UTC](https://discourse.julialang.org/t/find-definition-in-julia/74827 "2022-01-18T19:04:24Z")

</div>

For function calls, I can find the definition with @less @edit @which and others. But for other kinds of names bound to values, is it possible to find the definition? Vscode sometimes does it with “jump to definition”, …

---

## [Message about "Triggering TagBot for merged registry pull request"](https://discourse.julialang.org/t/message-about-triggering-tagbot-for-merged-registry-pull-request/60301)

<div class="topic-metadata">

**Author:** [@grahamstark](https://discourse.julialang.org/u/grahamstark)\
**Replies:** 2\
**Last updated:** [January 18, 2022, 5:23pm UTC](https://discourse.julialang.org/t/message-about-triggering-tagbot-for-merged-registry-pull-request/60301 "2022-01-18T17:23:10Z")

</div>

Hi everyone, I have a registered package: (it’s an economics thing…) I get the following message from TagBot: Triggering TagBot for merged registry pull request This extra notification is being sent because I ex…

---

## [Is there a way to speed up this matrix (with only 1 & 0) multiplication & power operation?](https://discourse.julialang.org/t/is-there-a-way-to-speed-up-this-matrix-with-only-1-0-multiplication-power-operation/74747)

<div class="topic-metadata">

**Author:** [@Endeavour](https://discourse.julialang.org/u/Endeavour)\
**Replies:** 20\
**Last updated:** [January 18, 2022, 5:00pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-speed-up-this-matrix-with-only-1-0-multiplication-power-operation/74747 "2022-01-18T17:00:56Z")

</div>

I have a matrix (cost\_mat\[~600,~600\]) with only 1 & 0 as its elements. You can think that each element of the matrix is individually put as 1 (with probability p) or 0. I need to find out (cost\_mat^N) where N(~600) is a …

---

## [What method call do I use to invoke a prediction based on a trained model?](https://discourse.julialang.org/t/what-method-call-do-i-use-to-invoke-a-prediction-based-on-a-trained-model/74812)

<div class="topic-metadata">

**Author:** [@bauhaus9](https://discourse.julialang.org/u/bauhaus9)\
**Replies:** 1\
**Last updated:** [January 18, 2022, 4:21pm UTC](https://discourse.julialang.org/t/what-method-call-do-i-use-to-invoke-a-prediction-based-on-a-trained-model/74812 "2022-01-18T16:21:03Z")

</div>

I’ve been going through a (canned video) neural network course that uses Flux and it instructs me how to load the training and test data (from the bundled MNIST data) and how to use the Flux Chain command to create all o…

---

## [OpenBLAS malloc](https://discourse.julialang.org/t/openblas-malloc/74804)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 5\
**Last updated:** [January 18, 2022, 2:23pm UTC](https://discourse.julialang.org/t/openblas-malloc/74804 "2022-01-18T14:23:15Z")

</div>

I got this: OpenBLAS: malloc failed in dsyrk\_thread\_UT julia\> versioninfo() Julia Version 1.7.0 Commit 3bf9d17731 (2021-11-30 12:12 UTC) Platform Info: OS: Windows (x86\_64-w64-mingw32) CPU: Intel(R) Core(TM) i5-620…

---

## [Perform multiple replacements on a string in a single pass](https://discourse.julialang.org/t/perform-multiple-replacements-on-a-string-in-a-single-pass/43247)

<div class="topic-metadata">

**Author:** [@nstgc](https://discourse.julialang.org/u/nstgc)\
**Replies:** 19\
**Last updated:** [January 18, 2022, 2:13pm UTC](https://discourse.julialang.org/t/perform-multiple-replacements-on-a-string-in-a-single-pass/43247 "2022-01-18T14:13:17Z")

</div>

I have a couple of scripts which perform multiple replacements on the same string. It seems as though this can be sped up by searching for all potential matches. For example, something like julia\>replace("123",\[r"1" =\> …

---

## [Using Julia's clipboard() function with numerical data in columns](https://discourse.julialang.org/t/using-julias-clipboard-function-with-numerical-data-in-columns/59223)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 13\
**Last updated:** [January 18, 2022, 1:47pm UTC](https://discourse.julialang.org/t/using-julias-clipboard-function-with-numerical-data-in-columns/59223 "2022-01-18T13:47:43Z")

</div>

When copying to clipboard numeric columnar data similar to (but in larger sizes): 675.7 2962 636.6 2961 565.9 2964 517.5 2956 from a Win10 text editor to the REPL via Julia’s clipboard() function, the following str…

---

## [Interpolation inside string inside quote](https://discourse.julialang.org/t/interpolation-inside-string-inside-quote/74791)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 1\
**Last updated:** [January 18, 2022, 10:27am UTC](https://discourse.julialang.org/t/interpolation-inside-string-inside-quote/74791 "2022-01-18T10:27:09Z")

</div>

macro test() name="foo" quote "a string containing $name" end end On running this macro I would expect to receive “a string containing foo”. However all I get is UndefVarError: name not defined. How could I t…

---

## [Building a chatbot with Julia, recommend starting points](https://discourse.julialang.org/t/building-a-chatbot-with-julia-recommend-starting-points/74717)

<div class="topic-metadata">

**Author:** [@tatsumaru](https://discourse.julialang.org/u/tatsumaru)\
**Replies:** 6\
**Last updated:** [January 18, 2022, 10:13am UTC](https://discourse.julialang.org/t/building-a-chatbot-with-julia-recommend-starting-points/74717 "2022-01-18T10:13:23Z")

</div>

Hello everyone, I am new to programming and decided to pick Julia as my first programming language. My goal is to build an online chatbot which is aimed at interfacing with a specific website which doesn’t have an API a…

---

## [Shift series annotations in a plot for readability](https://discourse.julialang.org/t/shift-series-annotations-in-a-plot-for-readability/74787)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 2\
**Last updated:** [January 18, 2022, 9:14am UTC](https://discourse.julialang.org/t/shift-series-annotations-in-a-plot-for-readability/74787 "2022-01-18T09:14:19Z")

</div>

Using Plots, series annotations are displayed exactly on top of the data points; this does not please my eye. Example: using Plots plot(\[1,2,3\], \[3,1,2\], series\_annotations=\["a", "b", "c"\]) Is there a way to shift th…

---

## [Help with NonlinearSolve.jl](https://discourse.julialang.org/t/help-with-nonlinearsolve-jl/74735)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 11\
**Last updated:** [January 18, 2022, 4:59am UTC](https://discourse.julialang.org/t/help-with-nonlinearsolve-jl/74735 "2022-01-18T04:59:52Z")

</div>

I am getting a cryptic error when trying to solve this system: using StaticArrays using NonlinearSolve 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 en…

---

## [Can I use reverse and Iterators.reverse at the same time?](https://discourse.julialang.org/t/can-i-use-reverse-and-iterators-reverse-at-the-same-time/74778)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 7\
**Last updated:** [January 18, 2022, 4:31am UTC](https://discourse.julialang.org/t/can-i-use-reverse-and-iterators-reverse-at-the-same-time/74778 "2022-01-18T04:31:05Z")

</div>

Can I have the methods for Base.reverse and Base.iterators.reverse available at the same time under just the name reverse? How? Observe: julia\> methods(reverse) # 10 methods for generic function "reverse": \[1\] revers…

---

## [macOS M1, Julia 1.6, and swtch\_pri](https://discourse.julialang.org/t/macos-m1-julia-1-6-and-swtch-pri/59826)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 1\
**Last updated:** [January 18, 2022, 1:38am UTC](https://discourse.julialang.org/t/macos-m1-julia-1-6-and-swtch-pri/59826 "2022-01-18T01:38:29Z")

</div>

Hi all, Using a MacBook Air M1 and Julia 1.6. I’m running a fairly complex scientific code that does a ton of matrix vector calculations. When I profile it and display the results using PProf, it shows that approximate…

---

## [Obfuscate Julia module and import it Python](https://discourse.julialang.org/t/obfuscate-julia-module-and-import-it-python/73026)

<div class="topic-metadata">

**Author:** [@Aju](https://discourse.julialang.org/u/Aju)\
**Replies:** 9\
**Last updated:** [January 17, 2022, 11:39pm UTC](https://discourse.julialang.org/t/obfuscate-julia-module-and-import-it-python/73026 "2022-01-17T23:39:06Z")

</div>

Hi everybody, I am intending to write a Julia module or a main function that performs a particular task (connects to a device and performs numerical calculations). I would like to import this Julia module in Python and…

---

## [CBinding error](https://discourse.julialang.org/t/cbinding-error/74688)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 11\
**Last updated:** [January 17, 2022, 6:32pm UTC](https://discourse.julialang.org/t/cbinding-error/74688 "2022-01-17T18:32:31Z")

</div>

@c\_str is exported by CBinding but doesn’t appear to want to show up. Also in the examples for CBinding (all of the examples) there something like: using assimp\_jll but that means i have to generate assimp\_jll, and th…

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

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