# General Usage

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

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

**Page:** 794

---

## [How to create a regex from a string with metacharacters?](https://discourse.julialang.org/t/how-to-create-a-regex-from-a-string-with-metacharacters/33898)

<div class="topic-metadata">

**Author:** [@Dictino](https://discourse.julialang.org/u/Dictino)\
**Replies:** 2\
**Last updated:** [January 28, 2020, 7:22pm UTC](https://discourse.julialang.org/t/how-to-create-a-regex-from-a-string-with-metacharacters/33898 "2020-01-28T19:22:13Z")

</div>

Hi I need to look for a set of sub-strings in a long text and there are two obvious options at hand: regex and findfirst. findfirst is nice and does exactly the thing I want, but it is a bit slow (10 times slower that …

---

## [CSV.jl's CSV write seems slow](https://discourse.julialang.org/t/csv-jls-csv-write-seems-slow/7643)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 32\
**Last updated:** [January 28, 2020, 7:09pm UTC](https://discourse.julialang.org/t/csv-jls-csv-write-seems-slow/7643 "2020-01-28T19:09:04Z")

</div>

updated code with suggestions by ScottPJones The below took about 100~200 seconds but in R’s data.table’s fwrite the same is done in 2 seconds. It is quite a big discrepancy. I am curious as to what need to change befo…

---

## [Collection of objects with a trait](https://discourse.julialang.org/t/collection-of-objects-with-a-trait/33863)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [January 28, 2020, 6:12pm UTC](https://discourse.julialang.org/t/collection-of-objects-with-a-trait/33863 "2020-01-28T18:12:56Z")

</div>

Has anyone given some thought how to work with collections of objects that have a (set of) trait(s)? How to create, maintain, iterate… What would a Base.iterate extension look like?

---

## [Question about Functors](https://discourse.julialang.org/t/question-about-functors/33876)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 7\
**Last updated:** [January 28, 2020, 4:41pm UTC](https://discourse.julialang.org/t/question-about-functors/33876 "2020-01-28T16:41:44Z")

</div>

I am trying to solve an economic model. The algorithm involves an iterative two-step procedure, like a back-and-forth optimization. There are lots of inputs and moving parts. I created a struct to keep track of it all. W…

---

## [Unexpected behaviour while benchmarking](https://discourse.julialang.org/t/unexpected-behaviour-while-benchmarking/33890)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 1\
**Last updated:** [January 28, 2020, 4:31pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-while-benchmarking/33890 "2020-01-28T16:31:16Z")

</div>

Hi fine folks! While investigating improvements for another topic i just posted about here I ran into some unexpected behaviour while benchmarking the code with BenchmarkTools. I have a function rolling\_optima which I …

---

## [Question: Why \`for n in 10 @show n end\` is valid rather than getting error](https://discourse.julialang.org/t/question-why-for-n-in-10-show-n-end-is-valid-rather-than-getting-error/33895)

<div class="topic-metadata">

**Author:** [@terasakisatoshi](https://discourse.julialang.org/u/terasakisatoshi)\
**Replies:** 2\
**Last updated:** [January 28, 2020, 4:14pm UTC](https://discourse.julialang.org/t/question-why-for-n-in-10-show-n-end-is-valid-rather-than-getting-error/33895 "2020-01-28T16:14:52Z")

</div>

When I study Julia with respect to for loop syntax as an exercise, some wired things happen. Consider this julia code: for i in 1:10 @show i end Of course it will output with i=1, i=2, …, i=10 as a result. More p…

---

## [Avoid SSL verification?](https://discourse.julialang.org/t/avoid-ssl-verification/33872)

<div class="topic-metadata">

**Author:** [@rvignolo](https://discourse.julialang.org/u/rvignolo)\
**Replies:** 2\
**Last updated:** [January 28, 2020, 3:20pm UTC](https://discourse.julialang.org/t/avoid-ssl-verification/33872 "2020-01-28T15:20:07Z")

</div>

Hi! How can I avoid SSL verification in this case: (@v1.4) pkg\> add WinRPM Updating registry at \`C:\\Users\\ramirov\\.julia\\registries\\General\` Updating git-repo \`https://github.com/JuliaRegistries/General.git\` Re…

---

## [LinearMaps: Transpose function not working the same as forward function](https://discourse.julialang.org/t/linearmaps-transpose-function-not-working-the-same-as-forward-function/33759)

<div class="topic-metadata">

**Author:** [@lineycroc](https://discourse.julialang.org/u/lineycroc)\
**Replies:** 13\
**Last updated:** [January 28, 2020, 3:18pm UTC](https://discourse.julialang.org/t/linearmaps-transpose-function-not-working-the-same-as-forward-function/33759 "2020-01-28T15:18:41Z")

</div>

I am running into an error while trying to create a LinearMap where if I put the same function in both the forward and transpose operator arguments, the forward map works but the transpose does not. My eventual goal is t…

---

## [Problem with savefig from Plots package](https://discourse.julialang.org/t/problem-with-savefig-from-plots-package/33877)

<div class="topic-metadata">

**Author:** [@sergevic](https://discourse.julialang.org/u/sergevic)\
**Replies:** 2\
**Last updated:** [January 28, 2020, 3:11pm UTC](https://discourse.julialang.org/t/problem-with-savefig-from-plots-package/33877 "2020-01-28T15:11:28Z")

</div>

I had the following code that worked well until today. I didn’t change anything, only Julia version. using Plots using Printf function plotrand(t) plot(rand(10),rand(10)) sav=@sprintf("%d",t) savefi…

---

## [2 problems with Flux](https://discourse.julialang.org/t/2-problems-with-flux/33887)

<div class="topic-metadata">

**Author:** [@Andrea\_Pagnani](https://discourse.julialang.org/u/Andrea_Pagnani)\
**Replies:** 4\
**Last updated:** [January 28, 2020, 1:19pm UTC](https://discourse.julialang.org/t/2-problems-with-flux/33887 "2020-01-28T13:19:53Z")

</div>

Dearests I am encountering some problems with Flux. I am working on Julia 1.3.1 Zygote v0.4.6, Flux v0.10.1, CuArrays v1.6.0. No gpus for the time being. The (not-so) minimal partially working example is the followin…

---

## [Indexing AxisArrays by integer values (which don't start at 1...)](https://discourse.julialang.org/t/indexing-axisarrays-by-integer-values-which-dont-start-at-1/33749)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 9\
**Last updated:** [January 28, 2020, 1:08pm UTC](https://discourse.julialang.org/t/indexing-axisarrays-by-integer-values-which-dont-start-at-1/33749 "2020-01-28T13:08:56Z")

</div>

I use Axis Arrays for my modelling, but I’ve stumbled onto an annoying problem: using AxisArrays Y = \[2019,2020\] # years x = \[1, 2\] A = AxisArray(x, Y) A\[2019\] # ERROR: BoundsError: attempt to access 2-element Array{…

---

## [Indexing Array](https://discourse.julialang.org/t/indexing-array/33866)

<div class="topic-metadata">

**Author:** [@Arega\_Getaneh](https://discourse.julialang.org/u/Arega_Getaneh)\
**Replies:** 10\
**Last updated:** [January 28, 2020, 1:09am UTC](https://discourse.julialang.org/t/indexing-array/33866 "2020-01-28T01:09:05Z")

</div>

Use square brackets \[\] for indexing an Array. Stacktrace: \[1\] mapreduce\_first(::Array{Float64,2}, ::Function, ::Int64) at .\\reduce.jl:301 \[2\] mapreduce(::Array{Float64,2}, ::Function, ::Int64) at .\\reduce.jl:328 \[3\] …

---

## [How to plot in for loop (or map)](https://discourse.julialang.org/t/how-to-plot-in-for-loop-or-map/33881)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 4\
**Last updated:** [January 28, 2020, 12:38am UTC](https://discourse.julialang.org/t/how-to-plot-in-for-loop-or-map/33881 "2020-01-28T00:38:09Z")

</div>

would somebody help to plot plots in for loop? here is a simple not working example: x=0:0.1:1 plot(x,x) for i=2:3 plot!(x,i.\*x) end

---

## [Extract relevant lines from large file using IDs from other file](https://discourse.julialang.org/t/extract-relevant-lines-from-large-file-using-ids-from-other-file/33859)

<div class="topic-metadata">

**Author:** [@swuyts](https://discourse.julialang.org/u/swuyts)\
**Replies:** 10\
**Last updated:** [January 27, 2020, 11:35pm UTC](https://discourse.julialang.org/t/extract-relevant-lines-from-large-file-using-ids-from-other-file/33859 "2020-01-27T23:35:02Z")

</div>

Hi there, I am new to Julia but interested to learn. I would like to extract lines from a large file (32gb; File B) based on an ID (File A) that is stored in another file. \> FileA ID01 ID02 ID03 ... IDXX \> FileB ID05…

---

## [Macro that generates additional methods of the same function](https://discourse.julialang.org/t/macro-that-generates-additional-methods-of-the-same-function/33873)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 2\
**Last updated:** [January 27, 2020, 8:58pm UTC](https://discourse.julialang.org/t/macro-that-generates-additional-methods-of-the-same-function/33873 "2020-01-27T20:58:43Z")

</div>

Here is a macro that works almost as intended: macro gen\_argfilt(func, tpl) return quote function arg\_filt(dat::Union{Model\_data, Batch\_view},nnw::Wgts, hp::Hyper\_parameters…

---

## [Sharing a python dataframe in Julia](https://discourse.julialang.org/t/sharing-a-python-dataframe-in-julia/33836)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 11\
**Last updated:** [January 27, 2020, 8:07pm UTC](https://discourse.julialang.org/t/sharing-a-python-dataframe-in-julia/33836 "2020-01-27T20:07:09Z")

</div>

Hi there, I have a small dataframe in a python script ( 300 rows each row probably about 1k). I am new to Julia so uncertain as to how to share the memory space between the python script and a julia program. I was goi…

---

## [Load modules in several workers](https://discourse.julialang.org/t/load-modules-in-several-workers/17521)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 19\
**Last updated:** [January 27, 2020, 7:47pm UTC](https://discourse.julialang.org/t/load-modules-in-several-workers/17521 "2020-01-27T19:47:02Z")

</div>

Hi folks, I’m just running into (another) problem, this time related to loading modules in several workers at the same time. I have this simple module module My\_mod export My\_Type, f mutable struct My\_type x::Int e…

---

## [Casting Int64 to UInt64](https://discourse.julialang.org/t/casting-int64-to-uint64/33856)

<div class="topic-metadata">

**Author:** [@Niclas\_Wiberg](https://discourse.julialang.org/u/Niclas_Wiberg)\
**Replies:** 5\
**Last updated:** [January 27, 2020, 5:06pm UTC](https://discourse.julialang.org/t/casting-int64-to-uint64/33856 "2020-01-27T17:06:52Z")

</div>

What is the best way to cast an Int64 to an UInt64, preserving the binary representation? For instance, given -1 as input I would like to get 0xffffffffffffffff. Given -256 as input I would like to get 0xffffffffffffff0…

---

## [Optimize dot(::Vector{Float64}, ::Vector{ForwardDiff.Dual})](https://discourse.julialang.org/t/optimize-dot-vector-float64-vector-forwarddiff-dual/33846)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [January 27, 2020, 2:56pm UTC](https://discourse.julialang.org/t/optimize-dot-vector-float64-vector-forwarddiff-dual/33846 "2020-01-27T14:56:28Z")

</div>

I identified a bottleneck in my code — calculating dot products of a vector of floats and some ForwardDiff.Duals. I have not been able to improve on the generic dot (which, of course, is not surprising in Julia, as the b…

---

## [Memory consumtion Rational{BigInt} on bernoulli number example](https://discourse.julialang.org/t/memory-consumtion-rational-bigint-on-bernoulli-number-example/33812)

<div class="topic-metadata">

**Author:** [@mwolff](https://discourse.julialang.org/u/mwolff)\
**Replies:** 14\
**Last updated:** [January 27, 2020, 1:51pm UTC](https://discourse.julialang.org/t/memory-consumtion-rational-bigint-on-bernoulli-number-example/33812 "2020-01-27T13:51:43Z")

</div>

I got a little bored yesterday and tried some examples from rosettacode http://rosettacode.org/wiki/Bernoulli\_numbers#Julia to test the performance against the Python code. Was kind of disappointing, Python worked better…

---

## [In places style question](https://discourse.julialang.org/t/in-places-style-question/33822)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 7\
**Last updated:** [January 27, 2020, 1:11pm UTC](https://discourse.julialang.org/t/in-places-style-question/33822 "2020-01-27T13:11:14Z")

</div>

Suppose I have a function that performs an place transformation on the first variable function f!(x,y) # code here x end This function can result in an error, so I would like to return a flag, variable, alertin…

---

## [How to use google translator from Julia level?](https://discourse.julialang.org/t/how-to-use-google-translator-from-julia-level/33837)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [January 27, 2020, 12:51pm UTC](https://discourse.julialang.org/t/how-to-use-google-translator-from-julia-level/33837 "2020-01-27T12:51:19Z")

</div>

How to use google translator from Julia level? How to impersonate a browser? to transalte dog for german I am expecting to get Hund :slight\_smile: Paul

---

## [Running several Julia engines](https://discourse.julialang.org/t/running-several-julia-engines/33094)

<div class="topic-metadata">

**Author:** [@tanya](https://discourse.julialang.org/u/tanya)\
**Replies:** 6\
**Last updated:** [January 27, 2020, 11:00am UTC](https://discourse.julialang.org/t/running-several-julia-engines/33094 "2020-01-27T11:00:34Z")

</div>

Not sure I am using correct terms/language to describe the problem, but I will try. I want to run several Julia processes on one PC (Monte Carlo simulations). When I do it in Matlab, I simply start several Labs, and the…

---

## [Clang warning](https://discourse.julialang.org/t/clang-warning/33815)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 1\
**Last updated:** [January 27, 2020, 6:18am UTC](https://discourse.julialang.org/t/clang-warning/33815 "2020-01-27T06:18:46Z")

</div>

I’m taking a dip in the Clang waters, ┌ Warning: not wrapping CLCursor (CLMacroInstantiation) RLAPI └ @ Clang ~/.julia/packages/Clang/CiPzM/src/wrap\_c.jl:443 ┌ Warning: not wrapping CLCursor (CLMacroInstantiation) RLAPI…

---

## [DSP.jl: analog filter design](https://discourse.julialang.org/t/dsp-jl-analog-filter-design/33646)

<div class="topic-metadata">

**Author:** [@kumarbalachandran](https://discourse.julialang.org/u/kumarbalachandran)\
**Replies:** 11\
**Last updated:** [January 27, 2020, 5:54am UTC](https://discourse.julialang.org/t/dsp-jl-analog-filter-design/33646 "2020-01-27T05:54:14Z")

</div>

I am using the following on Julia 1.3.1: using DSP fs=4\*5000e6 responsetype = Highpass(4000e6; fs=fs) designmethod = Elliptic(8, 1.0, 40.0) fil=analogfilter(responsetype, designmethod) rng=range(3100…

---

## [Listing all names available in a module, part 2](https://discourse.julialang.org/t/listing-all-names-available-in-a-module-part-2/33796)

<div class="topic-metadata">

**Author:** [@gcv](https://discourse.julialang.org/u/gcv)\
**Replies:** 2\
**Last updated:** [January 27, 2020, 12:46am UTC](https://discourse.julialang.org/t/listing-all-names-available-in-a-module-part-2/33796 "2020-01-27T00:46:50Z")

</div>

Follow-up to Listing all names available in a module. I need a way to introspect all names available in a module, including names implicitly brought in with using. The names function is helpful, but does not go all the …

---

## [Why is \`\]dev\` downgrading my package?](https://discourse.julialang.org/t/why-is-dev-downgrading-my-package/33748)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 3\
**Last updated:** [January 26, 2020, 4:39pm UTC](https://discourse.julialang.org/t/why-is-dev-downgrading-my-package/33748 "2020-01-26T16:39:31Z")

</div>

I want to \]dev the latest version of a package released on General. When I \]add the package, the latest version gets downloaded. However, when \]dev it, the package gets downgraded to a previous version. What is happeni…

---

## [Registry: support resolving dependencies also when Versions.toml file is empty by using master](https://discourse.julialang.org/t/registry-support-resolving-dependencies-also-when-versions-toml-file-is-empty-by-using-master/33446)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 4\
**Last updated:** [January 25, 2020, 9:25pm UTC](https://discourse.julialang.org/t/registry-support-resolving-dependencies-also-when-versions-toml-file-is-empty-by-using-master/33446 "2020-01-25T21:25:23Z")

</div>

this is a follow up idea on Can Versions.toml point to git branch instead of fixed git commit? concretely does the current registry already work with an empty Versions.toml file in the restricted situation of just addin…

---

## [JuliaDB parsing unix epoch field](https://discourse.julialang.org/t/juliadb-parsing-unix-epoch-field/33805)

<div class="topic-metadata">

**Author:** [@toms](https://discourse.julialang.org/u/toms)\
**Replies:** 0\
**Last updated:** [January 26, 2020, 10:07am UTC](https://discourse.julialang.org/t/juliadb-parsing-unix-epoch-field/33805 "2020-01-26T10:07:36Z")

</div>

Hello Julia community, I’m trying to loadndsparse a csv file with a unix epoch field and turn it into a Julia DateTime . What would be the correct way to do this in Julia? I’ve tried using the colparsers option but am…

---

## [Remove blank lines in REPL](https://discourse.julialang.org/t/remove-blank-lines-in-repl/10996)

<div class="topic-metadata">

**Author:** [@r4f](https://discourse.julialang.org/u/r4f)\
**Replies:** 2\
**Last updated:** [January 26, 2020, 9:34am UTC](https://discourse.julialang.org/t/remove-blank-lines-in-repl/10996 "2020-01-26T09:34:11Z")

</div>

Does anybody know a way to get rid of the blank line in the REPL which appears everytime before an input prompt (except for example when using print(sth))? I like to use julia as a quick calculator-tool from the termina…

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

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