# General Usage

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

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

**Page:** 850

---

## [Question: JuliaDB and regression models](https://discourse.julialang.org/t/question-juliadb-and-regression-models/17723)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 16\
**Last updated:** [July 16, 2019, 10:43am UTC](https://discourse.julialang.org/t/question-juliadb-and-regression-models/17723 "2019-07-16T10:43:50Z")

</div>

How do you use JuliaDB for tasks such as fitting a regression model with random effects? (like MixedEffects.jl but with datasets larger than memory)

---

## [ERROR: The following package names could not be resolved:](https://discourse.julialang.org/t/error-the-following-package-names-could-not-be-resolved/26409)

<div class="topic-metadata">

**Author:** [@min](https://discourse.julialang.org/u/min)\
**Replies:** 3\
**Last updated:** [July 16, 2019, 10:10am UTC](https://discourse.julialang.org/t/error-the-following-package-names-could-not-be-resolved/26409 "2019-07-16T10:10:07Z")

</div>

julia\> Pkg.add(“Ijulia”) Cloning default registries into C:\\Users\\default.DESKTOP-D2HJFCT\\.julia Cloning registry from “GitHub - JuliaRegistries/General: The official registry of general Julia packages” Added registry…

---

## [Immutable expression issue](https://discourse.julialang.org/t/immutable-expression-issue/26396)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 3\
**Last updated:** [July 16, 2019, 12:47am UTC](https://discourse.julialang.org/t/immutable-expression-issue/26396 "2019-07-16T00:47:58Z")

</div>

Dear all, how can define immutable in Julia 1.1.0? e.g.; immutable MySingleton end ERROR: syntax: extra token "MySingleton" after end of expression Best regards

---

## [Best way to generate a julia file full of wrapper functions](https://discourse.julialang.org/t/best-way-to-generate-a-julia-file-full-of-wrapper-functions/26390)

<div class="topic-metadata">

**Author:** [@Deuxis](https://discourse.julialang.org/u/Deuxis)\
**Replies:** 1\
**Last updated:** [July 15, 2019, 10:07pm UTC](https://discourse.julialang.org/t/best-way-to-generate-a-julia-file-full-of-wrapper-functions/26390 "2019-07-15T22:07:02Z")

</div>

I have an API defined in an XML. On the low level it only uses a few simple functions for passing messages, and the entire XML declares higher level functions that should be wrappers around them. How should I generate a …

---

## [Cuda - 2D and 3D grid and block dimensions](https://discourse.julialang.org/t/cuda-2d-and-3d-grid-and-block-dimensions/26392)

<div class="topic-metadata">

**Author:** [@wiktorkujawa](https://discourse.julialang.org/u/wiktorkujawa)\
**Replies:** 1\
**Last updated:** [July 15, 2019, 9:41pm UTC](https://discourse.julialang.org/t/cuda-2d-and-3d-grid-and-block-dimensions/26392 "2019-07-15T21:41:39Z")

</div>

Is in Julia equivalent of CUDA C: dim3 grid( 512 ); // 512 x 1 x 1 dim3 block( 1024, 1024 ); // 1024 x 1024 x 1 ?

---

## [Pkg not defined when building packages even though I did use pkg](https://discourse.julialang.org/t/pkg-not-defined-when-building-packages-even-though-i-did-use-pkg/26371)

<div class="topic-metadata">

**Author:** [@Alexandre\_Chen](https://discourse.julialang.org/u/Alexandre_Chen)\
**Replies:** 6\
**Last updated:** [July 15, 2019, 5:03pm UTC](https://discourse.julialang.org/t/pkg-not-defined-when-building-packages-even-though-i-did-use-pkg/26371 "2019-07-15T17:03:55Z")

</div>

See picture below

---

## [Seemingly unnecessary code cruft in a compiled higher-order function](https://discourse.julialang.org/t/seemingly-unnecessary-code-cruft-in-a-compiled-higher-order-function/26357)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 9\
**Last updated:** [July 15, 2019, 3:08pm UTC](https://discourse.julialang.org/t/seemingly-unnecessary-code-cruft-in-a-compiled-higher-order-function/26357 "2019-07-15T15:08:53Z")

</div>

Read this post if you care about zero-cost abstractions. This is a test of Julia’s ability to produce highly optimized code for higher-order functions, taking a function as an argument. The two functions are equivalent,…

---

## [Logging issue with Juno and Revise](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 3\
**Last updated:** [July 15, 2019, 1:07pm UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280 "2019-07-15T13:07:34Z")

</div>

I’ve created a custom logger, which doesn’t show @debug messages with Revise in Juno. If I include() the source file, it works in the REPL and Juno too. If I includet with Revise, then works in REPL, but not in Juno. l…

---

## [Having trouble to run a file outside the directory](https://discourse.julialang.org/t/having-trouble-to-run-a-file-outside-the-directory/26381)

<div class="topic-metadata">

**Author:** [@tosalonijain](https://discourse.julialang.org/u/tosalonijain)\
**Replies:** 2\
**Last updated:** [July 15, 2019, 12:48pm UTC](https://discourse.julialang.org/t/having-trouble-to-run-a-file-outside-the-directory/26381 "2019-07-15T12:48:57Z")

</div>

I have an internal package that I have developed. Now, I want to use that package in other files. I am doing: include("Package.jl") But even after that I am not able to use the modalities of my package. I am only able …

---

## [How to redirect the output of run to a file](https://discourse.julialang.org/t/how-to-redirect-the-output-of-run-to-a-file/3765)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 8\
**Last updated:** [July 15, 2019, 12:17pm UTC](https://discourse.julialang.org/t/how-to-redirect-the-output-of-run-to-a-file/3765 "2019-07-15T12:17:20Z")

</div>

MWE: suppose I wanted to do something equivalent to the shell command ls /tmp \> /tmp/list in Julia. I came up with open(io-\>run(pipeline(\`ls /tmp\`, stdout=io)), "/tmp/list", "w") but I fear that I am overcomplicating…

---

## [Vline! with subplots](https://discourse.julialang.org/t/vline-with-subplots/25479)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [July 15, 2019, 10:10am UTC](https://discourse.julialang.org/t/vline-with-subplots/25479 "2019-07-15T10:10:58Z")

</div>

Hi- When I try to add vertical lines to subplots, the lines only apply to the first subplot. Is there a way to add vertical lines to each subplot? Here is a MWE: using DataFrames,StatsPlots df = DataFrame(g=rand(1:3,1…

---

## [How to find the centroid of a list of nodes?](https://discourse.julialang.org/t/how-to-find-the-centroid-of-a-list-of-nodes/26354)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 3\
**Last updated:** [July 15, 2019, 8:43am UTC](https://discourse.julialang.org/t/how-to-find-the-centroid-of-a-list-of-nodes/26354 "2019-07-15T08:43:32Z")

</div>

This is probably a naive question. I was a bit confused about this link to find the centroid of a triangle: Program to find the Centroid of the triangle - GeeksforGeeks I was reading a piece of code to calculate the cen…

---

## [Editing an array with multiple threads](https://discourse.julialang.org/t/editing-an-array-with-multiple-threads/25364)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 13\
**Last updated:** [July 15, 2019, 8:31am UTC](https://discourse.julialang.org/t/editing-an-array-with-multiple-threads/25364 "2019-07-15T08:31:31Z")

</div>

Is it possible to update the values of an array (of ints) (size is known and fixed in advanced) using multiple threads in a safe way? I can’t partition parts of the array to only be touched by certain threads as any thre…

---

## [Round to multiple of integer](https://discourse.julialang.org/t/round-to-multiple-of-integer/26372)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [July 15, 2019, 7:32am UTC](https://discourse.julialang.org/t/round-to-multiple-of-integer/26372 "2019-07-15T07:32:47Z")

</div>

I frequently find it useful to round to multiple of an integer, most commnly 5, powers of 10, and similar. First, I usually use something like round\_to(n, x) = round(Int, x / n) \* n Is there a better implementation? J…

---

## [How to use Userdefined Symbolic function in Julia](https://discourse.julialang.org/t/how-to-use-userdefined-symbolic-function-in-julia/26375)

<div class="topic-metadata">

**Author:** [@Sivakumar](https://discourse.julialang.org/u/Sivakumar)\
**Replies:** 0\
**Last updated:** [July 15, 2019, 7:26am UTC](https://discourse.julialang.org/t/how-to-use-userdefined-symbolic-function-in-julia/26375 "2019-07-15T07:26:14Z")

</div>

I am new to Julia. For my research problem, I have defined a function and try to call in Julia. function dens(x,l) return lexp(-xl) end using SymEngine x = symbols(:x) a = dens(x,5) a1 = mcall(float(m"integrate(de…

---

## [Interpolations.jl: Saving the object](https://discourse.julialang.org/t/interpolations-jl-saving-the-object/26368)

<div class="topic-metadata">

**Author:** [@krenova](https://discourse.julialang.org/u/krenova)\
**Replies:** 0\
**Last updated:** [July 15, 2019, 3:27am UTC](https://discourse.julialang.org/t/interpolations-jl-saving-the-object/26368 "2019-07-15T03:27:47Z")

</div>

Hi, I’m using the Interpolations.jl package to approximate a dynamic programming value function and intend to save the interpolated approximation automatically upon completion of the algorithm with the JLD2 package. I …

---

## [Function Plot - error message](https://discourse.julialang.org/t/function-plot-error-message/26359)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [July 14, 2019, 10:19pm UTC](https://discourse.julialang.org/t/function-plot-error-message/26359 "2019-07-14T22:19:09Z")

</div>

Dear all, I have instaled the Package Gadfly to draw some graphics. I have run: Pkg.add("Gadfly") using Gadfly plot(y=\[1,2,3\]) and a message of error is presented: ERROR: UndefVarError: plot not defined Stacktrace: …

---

## [Dispatch on Value allocating](https://discourse.julialang.org/t/dispatch-on-value-allocating/26337)

<div class="topic-metadata">

**Author:** [@cshenton](https://discourse.julialang.org/u/cshenton)\
**Replies:** 9\
**Last updated:** [July 14, 2019, 9:58pm UTC](https://discourse.julialang.org/t/dispatch-on-value-allocating/26337 "2019-07-14T21:58:57Z")

</div>

I want to provide a function that will value dispatch on a handful of int values (3,4,5). That works fine, but when I wrap that function so that the caller doesn’t have to put in Val(3) when calling there are allocations…

---

## [Concatening matrix in a loop](https://discourse.julialang.org/t/concatening-matrix-in-a-loop/26347)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 5\
**Last updated:** [July 14, 2019, 7:54pm UTC](https://discourse.julialang.org/t/concatening-matrix-in-a-loop/26347 "2019-07-14T19:54:08Z")

</div>

Dear users, I need to build a matrix using a loop, like this: X = zeros(3,1) for i=1:10 x = rand(3,1) X = \[X x\] end i.e., I need to build the columns of X using a looping. What’s the better way to do its?

---

## [Test if a module is a child of another module](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346)

<div class="topic-metadata">

**Author:** [@tencnivel](https://discourse.julialang.org/u/tencnivel)\
**Replies:** 2\
**Last updated:** [July 14, 2019, 3:53pm UTC](https://discourse.julialang.org/t/test-if-a-module-is-a-child-of-another-module/26346 "2019-07-14T15:53:36Z")

</div>

Hello, On the following example, how would you test if a module has another module as a parent or grand parent? module MyModule module MySubModule module MySubSubModule end end end NOTE: I would p…

---

## [Will field extraction be recognized as a loop invariant?](https://discourse.julialang.org/t/will-field-extraction-be-recognized-as-a-loop-invariant/26345)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 3\
**Last updated:** [July 14, 2019, 3:26pm UTC](https://discourse.julialang.org/t/will-field-extraction-be-recognized-as-a-loop-invariant/26345 "2019-07-14T15:26:14Z")

</div>

In the following example struct Foo colind::Int A::Matrix{Float64} v::Vector{Float64} end function copycol!(foo::Foo) for i in eachindex(foo.v) foo.v\[i\] = foo.A\[i, foo.colind\] end foo en…

---

## [Vector comprehension example](https://discourse.julialang.org/t/vector-comprehension-example/26344)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 2\
**Last updated:** [July 14, 2019, 2:38pm UTC](https://discourse.julialang.org/t/vector-comprehension-example/26344 "2019-07-14T14:38:31Z")

</div>

The following is the code. v=\[2,3,4\] v\[\[true for i in v\]\] It would return a 3-element Array{Int64,1}, \[2,3,4\]. It looks a bit strange to me. Originally, I thought it would return a matrix. I was wondering, how do you u…

---

## [Can't \`\]dev\` my own package](https://discourse.julialang.org/t/cant-dev-my-own-package/26340)

<div class="topic-metadata">

**Author:** [@yha](https://discourse.julialang.org/u/yha)\
**Replies:** 8\
**Last updated:** [July 14, 2019, 1:24pm UTC](https://discourse.julialang.org/t/cant-dev-my-own-package/26340 "2019-07-14T13:24:13Z")

</div>

I’m trying to share an unregistered package that’s hosted as a private github repository. After \]adding the package from the github URL on a machine where it was not previously developed, I try to \]dev it, I get the fol…

---

## [Can a function tell if an argument is in an enum or otherwise get the base type?](https://discourse.julialang.org/t/can-a-function-tell-if-an-argument-is-in-an-enum-or-otherwise-get-the-base-type/26332)

<div class="topic-metadata">

**Author:** [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)\
**Replies:** 1\
**Last updated:** [July 14, 2019, 4:51am UTC](https://discourse.julialang.org/t/can-a-function-tell-if-an-argument-is-in-an-enum-or-otherwise-get-the-base-type/26332 "2019-07-14T04:51:19Z")

</div>

I have a generic function that logs some data into a binary file for a user. Naturally, I need to know how many bits the type needs. This is easy to do for most types. However, I’m unclear on what to do when the user pas…

---

## [Customizing Broadcasting Recursively for Collections of Arrays](https://discourse.julialang.org/t/customizing-broadcasting-recursively-for-collections-of-arrays/25724)

<div class="topic-metadata">

**Author:** [@SEA](https://discourse.julialang.org/u/SEA)\
**Replies:** 9\
**Last updated:** [July 13, 2019, 5:16pm UTC](https://discourse.julialang.org/t/customizing-broadcasting-recursively-for-collections-of-arrays/25724 "2019-07-13T17:16:45Z")

</div>

I previously asked this question and am aware of the section in the manual about customizing broadcasting. However, rather than defining a new type which behaves like a single array, I would like to define broadcasting …

---

## [Problems with Plot](https://discourse.julialang.org/t/problems-with-plot/26319)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [July 13, 2019, 12:50pm UTC](https://discourse.julialang.org/t/problems-with-plot/26319 "2019-07-13T12:50:07Z")

</div>

Dear all, I have a problem with Julia 1.0.4 When I run this command to plot a simple figure and I have already installed the package “Plots”. using Plots x=0:0.1:1 y=sin.(x) plot(x,y) appear a huge error below. Anyo…

---

## [Crash when creating a GtkFontChooserDialog](https://discourse.julialang.org/t/crash-when-creating-a-gtkfontchooserdialog/26307)

<div class="topic-metadata">

**Author:** [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Replies:** 0\
**Last updated:** [July 12, 2019, 10:56pm UTC](https://discourse.julialang.org/t/crash-when-creating-a-gtkfontchooserdialog/26307 "2019-07-12T22:56:27Z")

</div>

I’m trying to create a (default) GtkFontChooserDialog: using Gtk GtkBuilder(buffer="""\<?xml version="1.0" encoding="UTF-8"?\> \<!-- Generated with glade 3.22.1 --\> \<interface\> \<requires lib="gtk+" version="3.20"/\> \<o…

---

## [ODBC.jl and Stored Procedures](https://discourse.julialang.org/t/odbc-jl-and-stored-procedures/26305)

<div class="topic-metadata">

**Author:** [@MarkovChains](https://discourse.julialang.org/u/MarkovChains)\
**Replies:** 0\
**Last updated:** [July 12, 2019, 10:13pm UTC](https://discourse.julialang.org/t/odbc-jl-and-stored-procedures/26305 "2019-07-12T22:13:53Z")

</div>

I couldn’t find anything about this elsewhere, but is it possible to return data from a SQL Server stored procedure through ODBC.jl? I have a SP that returns data via a “select \* from #temp” line at the end, but when I t…

---

## [JuliaDB loading data](https://discourse.julialang.org/t/juliadb-loading-data/26281)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 15\
**Last updated:** [July 12, 2019, 6:03pm UTC](https://discourse.julialang.org/t/juliadb-loading-data/26281 "2019-07-12T18:03:03Z")

</div>

I am trying out Julia DB, but am unable to read data. Any ideas what is going wrong here? loadndsparse is running into an error (the error also happens when I sue Float64 for all types). using JuliaDB using CSV #using…

---

## [Macros vs. Functions with @eval(return )](https://discourse.julialang.org/t/macros-vs-functions-with-eval-return/26247)

<div class="topic-metadata">

**Author:** [@anon32405968](https://discourse.julialang.org/u/anon32405968)\
**Replies:** 8\
**Last updated:** [July 12, 2019, 5:00pm UTC](https://discourse.julialang.org/t/macros-vs-functions-with-eval-return/26247 "2019-07-12T17:00:07Z")

</div>

For my use case (generating a struct of four FunctionWrappers from a parsed string) I can use the following two syntaxes interchangeably, and the resulting FunctionWrappers themselves benchmark to the same thing using Be…

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

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