# General Usage

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

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

**Page:** 710

---

## [Package interface best practice: More functions or more arguments?](https://discourse.julialang.org/t/package-interface-best-practice-more-functions-or-more-arguments/45452)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 3\
**Last updated:** [August 25, 2020, 7:57am UTC](https://discourse.julialang.org/t/package-interface-best-practice-more-functions-or-more-arguments/45452 "2020-08-25T07:57:06Z")

</div>

For my package JSONLines.jl I am considering a refactoring and provide 3 options to read a JSONLines file: Iterator over an mmaped file. Basically returns the mmaped file at first and implements an iterator that produc…

---

## [Correct way of parallelizing on a HPC remote cluster machine](https://discourse.julialang.org/t/correct-way-of-parallelizing-on-a-hpc-remote-cluster-machine/45294)

<div class="topic-metadata">

**Author:** [@trathi](https://discourse.julialang.org/u/trathi)\
**Replies:** 8\
**Last updated:** [August 25, 2020, 3:08am UTC](https://discourse.julialang.org/t/correct-way-of-parallelizing-on-a-hpc-remote-cluster-machine/45294 "2020-08-25T03:08:09Z")

</div>

I want to know what is the correct way of running a julia script (which has some part that requires parallelization) on a HPC cluster remote machine. My PBS script looks like: #!/bin/bash -l #PBS -l walltime=01:00:00,n…

---

## [Cygwin not displaying graphic characters correctly](https://discourse.julialang.org/t/cygwin-not-displaying-graphic-characters-correctly/38991)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 1\
**Last updated:** [August 25, 2020, 1:51am UTC](https://discourse.julialang.org/t/cygwin-not-displaying-graphic-characters-correctly/38991 "2020-08-25T01:51:11Z")

</div>

This post will have a very small audience, but that audience will be very interested :slight\_smile: So i upgraded my cygwin and it broke character display in the julia repl. What was particularly annoying is that the d…

---

## [Profiling compilation/inference](https://discourse.julialang.org/t/profiling-compilation-inference/44496)

<div class="topic-metadata">

**Author:** [@mhauru](https://discourse.julialang.org/u/mhauru)\
**Replies:** 10\
**Last updated:** [August 24, 2020, 10:07pm UTC](https://discourse.julialang.org/t/profiling-compilation-inference/44496 "2020-08-24T22:07:29Z")

</div>

I have a package for which running the test script results in around 20 minutes of compilation. Presumably somewhere in my package there’s something that’s giving inference a very hard time. I’ve done some work trying to…

---

## [Help with interpolation](https://discourse.julialang.org/t/help-with-interpolation/45474)

<div class="topic-metadata">

**Author:** [@acvalerio](https://discourse.julialang.org/u/acvalerio)\
**Replies:** 2\
**Last updated:** [August 24, 2020, 9:11pm UTC](https://discourse.julialang.org/t/help-with-interpolation/45474 "2020-08-24T21:11:05Z")

</div>

I’m looking for a function similar to interp1 in Matlab, and browsing the web I found the following piece of code that supposedly do the job: using Interpolations function interp1(X, V, Xq) knots = (X,) itp = in…

---

## [Defining a array type](https://discourse.julialang.org/t/defining-a-array-type/45472)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 7\
**Last updated:** [August 24, 2020, 8:49pm UTC](https://discourse.julialang.org/t/defining-a-array-type/45472 "2020-08-24T20:49:29Z")

</div>

Newbie question, but how can I define an array type (like Java or C)? I know is posible to do in local variables like: function f(X::Int64) Y::Int64 = 0 end How to define an array type? Thanks!

---

## [Error using GLM and Distributed](https://discourse.julialang.org/t/error-using-glm-and-distributed/45459)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 3\
**Last updated:** [August 24, 2020, 6:02pm UTC](https://discourse.julialang.org/t/error-using-glm-and-distributed/45459 "2020-08-24T18:02:46Z")

</div>

Dear all, I am trying to parallelise my code and I find this kind of problem. My not-parallelised code can be represented as: using DataFrames, GLM function foo(df::DataFrame) ols = lm(@formula(A ~ 1.0), df) …

---

## [Soss - Examples/tutorials](https://discourse.julialang.org/t/soss-examples-tutorials/45461)

<div class="topic-metadata">

**Author:** [@franco](https://discourse.julialang.org/u/franco)\
**Replies:** 2\
**Last updated:** [August 24, 2020, 5:46pm UTC](https://discourse.julialang.org/t/soss-examples-tutorials/45461 "2020-08-24T17:46:50Z")

</div>

I am moving a graduate course I teach on statistics from frequentist to Bayesian and from Python to Julia. I mostly work with Python in my day job and have only implemented some basic Bayesian models with PyMC3. I was l…

---

## [Adding Hidden Fields to Parametric Types](https://discourse.julialang.org/t/adding-hidden-fields-to-parametric-types/45448)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 8\
**Last updated:** [August 24, 2020, 1:50pm UTC](https://discourse.julialang.org/t/adding-hidden-fields-to-parametric-types/45448 "2020-08-24T13:50:39Z")

</div>

Say I want to define a macro which adds a hidden field to a user defined type. See the minimal working example below module Foo """ Modify ex by pushing hidden field. """ function push\_hidded\_field!(ex) paramex = …

---

## [Writing to DataFrames and CSV files](https://discourse.julialang.org/t/writing-to-dataframes-and-csv-files/36238)

<div class="topic-metadata">

**Author:** [@Smith](https://discourse.julialang.org/u/Smith)\
**Replies:** 14\
**Last updated:** [August 24, 2020, 12:38pm UTC](https://discourse.julialang.org/t/writing-to-dataframes-and-csv-files/36238 "2020-08-24T12:38:31Z")

</div>

Hi, I am looking to write output of a function for different runs to one CSV file. Using the DelimitedFiles package, I can write results to separate CSV files for each run. However, I want to write results from all runs …

---

## [Broadcast assignment for a custom array type without linear indices fails](https://discourse.julialang.org/t/broadcast-assignment-for-a-custom-array-type-without-linear-indices-fails/45361)

<div class="topic-metadata">

**Author:** [@hwjsnc](https://discourse.julialang.org/u/hwjsnc)\
**Replies:** 2\
**Last updated:** [August 24, 2020, 11:28am UTC](https://discourse.julialang.org/t/broadcast-assignment-for-a-custom-array-type-without-linear-indices-fails/45361 "2020-08-24T11:28:44Z")

</div>

I just did some housekeeping for one of my packages that defines a custom array type. In doing so, I ran my test suite and it fails for julia 1.5 where it worked for 1.3. I haven’t done a full detailed analysis of the pr…

---

## [Print name of type w/o parameters, Julia 1.0-master](https://discourse.julialang.org/t/print-name-of-type-w-o-parameters-julia-1-0-master/45447)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [August 24, 2020, 11:19am UTC](https://discourse.julialang.org/t/print-name-of-type-w-o-parameters-julia-1-0-master/45447 "2020-08-24T11:19:46Z")

</div>

Given a parametric type T I would like to print (or, equivalently, obtain as a String) the name of this type without parameters. The purpose is pretty-printing a complicated type. I need a generic solution, not one that…

---

## [Pass through function name to different type](https://discourse.julialang.org/t/pass-through-function-name-to-different-type/45437)

<div class="topic-metadata">

**Author:** [@mopg](https://discourse.julialang.org/u/mopg)\
**Replies:** 10\
**Last updated:** [August 24, 2020, 6:37am UTC](https://discourse.julialang.org/t/pass-through-function-name-to-different-type/45437 "2020-08-24T06:37:31Z")

</div>

I am making a type that holds another type as one of its fields, like so struct A a::Float64 end f(a::A, x::Real) = A.a \* x # plus whole other bunch of functions with similar arguments g(a::A, x::Real) = ... h(a::A…

---

## [Method Error when using solve in DifferentialEquations.jl](https://discourse.julialang.org/t/method-error-when-using-solve-in-differentialequations-jl/45435)

<div class="topic-metadata">

**Author:** [@anon22248738](https://discourse.julialang.org/u/anon22248738)\
**Replies:** 7\
**Last updated:** [August 24, 2020, 12:51am UTC](https://discourse.julialang.org/t/method-error-when-using-solve-in-differentialequations-jl/45435 "2020-08-24T00:51:04Z")

</div>

I’m working through the first example in the Ordinary Differential Equations section of DifferentialEquations.jl documentation, and when I call solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8), I get MethodError: no method m…

---

## [DataFrame Row Indexing and Transaction Data Aggregation](https://discourse.julialang.org/t/dataframe-row-indexing-and-transaction-data-aggregation/44942)

<div class="topic-metadata">

**Author:** [@RodBiren](https://discourse.julialang.org/u/RodBiren)\
**Replies:** 12\
**Last updated:** [August 24, 2020, 12:28am UTC](https://discourse.julialang.org/t/dataframe-row-indexing-and-transaction-data-aggregation/44942 "2020-08-24T00:28:32Z")

</div>

Hello, Still learning the language, but I am excited to do some processing of financial data that I have not been pleased with doing in excel. I have a DataFrame of transaction data in the form of: 38838×7 DataFrame │…

---

## [CUDA Speed drop](https://discourse.julialang.org/t/cuda-speed-drop/45412)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 4\
**Last updated:** [August 23, 2020, 8:28pm UTC](https://discourse.julialang.org/t/cuda-speed-drop/45412 "2020-08-23T20:28:22Z")

</div>

Hey, I found this interesting phenomenon, can anyone explain the situation? using BenchmarkTools BenchmarkTools.DEFAULT\_PARAMETERS.seconds = 2.50 using CUDA arit100(x::AbstractArray, y::AbstractArray) = for i=1:100 x …

---

## [Help correcting REPL character display](https://discourse.julialang.org/t/help-correcting-repl-character-display/45400)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 7\
**Last updated:** [August 23, 2020, 8:01pm UTC](https://discourse.julialang.org/t/help-correcting-repl-character-display/45400 "2020-08-23T20:01:01Z")

</div>

Does anybody have any suggestions on what to do to get this to display better/correctly? This is what things look like when I’m on my HPC cluster. Unfortunately, that means I likely have limited control to do much to fix…

---

## [Shared Sparse Arrays?](https://discourse.julialang.org/t/shared-sparse-arrays/45420)

<div class="topic-metadata">

**Author:** [@anon92994695](https://discourse.julialang.org/u/anon92994695)\
**Replies:** 0\
**Last updated:** [August 23, 2020, 4:09pm UTC](https://discourse.julialang.org/t/shared-sparse-arrays/45420 "2020-08-23T16:09:03Z")

</div>

Wasn’t sure if this should be in performance or first steps so feel free to relocate it. Are there any current/recommended implementations that handle altering sparse arrays in a parallel loop? I did some searches and d…

---

## [Question about optimal number of clusters](https://discourse.julialang.org/t/question-about-optimal-number-of-clusters/45418)

<div class="topic-metadata">

**Author:** [@abcde](https://discourse.julialang.org/u/abcde)\
**Replies:** 3\
**Last updated:** [August 23, 2020, 3:24pm UTC](https://discourse.julialang.org/t/question-about-optimal-number-of-clusters/45418 "2020-08-23T15:24:02Z")

</div>

As is known to all, clustering is a kind of unsupervised learning method, including k-means, DBSCAN, etc., where the class number of clustering “K” needs to be set in advance. There are many ways to estimate the best “k…

---

## [Performance Issues - Rayleigh Compressible](https://discourse.julialang.org/t/performance-issues-rayleigh-compressible/45397)

<div class="topic-metadata">

**Author:** [@axsano](https://discourse.julialang.org/u/axsano)\
**Replies:** 3\
**Last updated:** [August 23, 2020, 3:20pm UTC](https://discourse.julialang.org/t/performance-issues-rayleigh-compressible/45397 "2020-08-23T15:20:53Z")

</div>

I have this function called Rayleigh Compressible that is used to perform analysis of fluid flow stability, using LinearAlgebra function rayleighc(Ω, U, M, dU, D, D2) Λ = zeros(ComplexF64, 3\*size(D, 1), length(Ω));…

---

## [Publish packages without complete commit history](https://discourse.julialang.org/t/publish-packages-without-complete-commit-history/45407)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 9\
**Last updated:** [August 23, 2020, 12:43pm UTC](https://discourse.julialang.org/t/publish-packages-without-complete-commit-history/45407 "2020-08-23T12:43:46Z")

</div>

First the question itself: is there a way, currently existing or planned, to publish/register a package without making the whole commit history available to everyone? Basically, something like pypi does: it only uploads …

---

## [Strange memory allocation pattern for arrays of different types](https://discourse.julialang.org/t/strange-memory-allocation-pattern-for-arrays-of-different-types/45403)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 7\
**Last updated:** [August 23, 2020, 9:59am UTC](https://discourse.julialang.org/t/strange-memory-allocation-pattern-for-arrays-of-different-types/45403 "2020-08-23T09:59:54Z")

</div>

Here is en example where I create a few arrays: module Test2 const N = 10^6 r1 = zeros(UInt8, N) d1 = ones(Float32, N) r2 = zeros(UInt8, N) d2 = ones(Float32, N) r3 = zeros(UInt8, N) d3 = ones(Float32, N) println(poi…

---

## [Invoke user defined package functions on distributed workers](https://discourse.julialang.org/t/invoke-user-defined-package-functions-on-distributed-workers/45388)

<div class="topic-metadata">

**Author:** [@Jack](https://discourse.julialang.org/u/Jack)\
**Replies:** 2\
**Last updated:** [August 23, 2020, 12:26am UTC](https://discourse.julialang.org/t/invoke-user-defined-package-functions-on-distributed-workers/45388 "2020-08-23T00:26:26Z")

</div>

Greetings! I created a package ModelUtils and hope to run it in multiple workers. In this package, a function called linear\_regression being exported. The module is under src folder and has the following content modul…

---

## [Getting the most utilization out of a GPU](https://discourse.julialang.org/t/getting-the-most-utilization-out-of-a-gpu/45340)

<div class="topic-metadata">

**Author:** [@s-baumann](https://discourse.julialang.org/u/s-baumann)\
**Replies:** 2\
**Last updated:** [August 22, 2020, 11:02pm UTC](https://discourse.julialang.org/t/getting-the-most-utilization-out-of-a-gpu/45340 "2020-08-22T23:02:27Z")

</div>

I am using a relatively high spec GPU (1080-TI) but cannot get it to run at utilizations of more than 5% (according to task manager). I believe that it is being used (rather than the CPU) because the “GPU memory” goes up…

---

## [Is there a way to include \`⅔\` in function name?](https://discourse.julialang.org/t/is-there-a-way-to-include-in-function-name/45378)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 3\
**Last updated:** [August 22, 2020, 9:47pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-include-in-function-name/45378 "2020-08-22T21:47:40Z")

</div>

I want to define a function named ^⅔, which means using SymPy: Sym ^⅔(x::Sym) = x^(2 // 3) ^⅔(x::Number) = x^(2 / 3) That is, I need 2 // 3 for pretty-printing expressions in fractionals, but 2 / 3 for speed in real c…

---

## [Didn't there used to be a toolbar for Julia in VS code?](https://discourse.julialang.org/t/didnt-there-used-to-be-a-toolbar-for-julia-in-vs-code/45374)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [August 22, 2020, 5:32pm UTC](https://discourse.julialang.org/t/didnt-there-used-to-be-a-toolbar-for-julia-in-vs-code/45374 "2020-08-22T17:32:34Z")

</div>

I thought there used to be a toolbar. I can’t find any setting to get it back (obviously it isn’t presently displayed). Any clues? Thanks.

---

## [How to find and replace (Regx) in string abcdac only 'a' who is not before 'c'?](https://discourse.julialang.org/t/how-to-find-and-replace-regx-in-string-abcdac-only-a-who-is-not-before-c/45354)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 6\
**Last updated:** [August 22, 2020, 2:11pm UTC](https://discourse.julialang.org/t/how-to-find-and-replace-regx-in-string-abcdac-only-a-who-is-not-before-c/45354 "2020-08-22T14:11:42Z")

</div>

Ho to find and repalce (Regx) in string abcdac only a who is not before c ? Paul

---

## [Multiple fields per line in struct declaration](https://discourse.julialang.org/t/multiple-fields-per-line-in-struct-declaration/45345)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 3\
**Last updated:** [August 22, 2020, 7:53am UTC](https://discourse.julialang.org/t/multiple-fields-per-line-in-struct-declaration/45345 "2020-08-22T07:53:21Z")

</div>

I have a struct with many fields, which can be logically grouped, like this, but more fields: mutable struct Limits vMin::Float32 vMax::Float32 aMin::Float32 aMax::Float32 end Is there any way to write it simil…

---

## [PackageCompiler.jl \`create\_app\` use path of the binary](https://discourse.julialang.org/t/packagecompiler-jl-create-app-use-path-of-the-binary/45348)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 3\
**Last updated:** [August 22, 2020, 6:47am UTC](https://discourse.julialang.org/t/packagecompiler-jl-create-app-use-path-of-the-binary/45348 "2020-08-22T06:47:09Z")

</div>

I made an app using PackageCompiler.create\_app and it works really nice. My app requires a database which is a file, and I would like to use the file in the same folder as the binary… However when I run ~/bin/MyApp T…

---

## [Why doesn't multithreading help here?](https://discourse.julialang.org/t/why-doesnt-multithreading-help-here/45286)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 12\
**Last updated:** [August 22, 2020, 2:44am UTC](https://discourse.julialang.org/t/why-doesnt-multithreading-help-here/45286 "2020-08-22T02:44:13Z")

</div>

Hello— A very common computational issue for me is that I want to assemble kernel matrices with pretty expensive kernel functions. I have tried various ways to do this efficiently in parallel, but I can’t seem to write …

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

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