# General Usage

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

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

**Page:** 478

---

## [Libc.FILE for stdout](https://discourse.julialang.org/t/libc-file-for-stdout/22482)

<div class="topic-metadata">

**Author:** [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Replies:** 2\
**Last updated:** [March 1, 2022, 7:57pm UTC](https://discourse.julialang.org/t/libc-file-for-stdout/22482 "2022-03-01T19:57:04Z")

</div>

I need to ccall a function that expects a C FILE \*. To have the function write to a file on disk, I figured out that I can get an appropriate FILE \* using foo = open("foo.txt", "w") Libc.FILE(foo) This works fine, but…

---

## [How do you like Julia 1.7?](https://discourse.julialang.org/t/how-do-you-like-julia-1-7/70405)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 9\
**Last updated:** [March 1, 2022, 7:01pm UTC](https://discourse.julialang.org/t/how-do-you-like-julia-1-7/70405 "2022-03-01T19:01:21Z")

</div>

I’m using Julia 1.6 right now and am wondering if I should upgrade to Julia 1.7. Any advice is appreciated. BTW, how do I upgrade to 1.7? If I have to delete my current Julia 1.6 folder before installing Julia 1.7, woul…

---

## [A neat Julia/SLURM trick](https://discourse.julialang.org/t/a-neat-julia-slurm-trick/61123)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 12\
**Last updated:** [March 1, 2022, 6:27pm UTC](https://discourse.julialang.org/t/a-neat-julia-slurm-trick/61123 "2022-03-01T18:27:24Z")

</div>

This took some figuring out and I haven’t seen it mentioned for Julia, so I figured I’d share. Hope its helpful to someone! If you often submit Julia scripts on a SLURM cluster and hate having to have a separate SLURM s…

---

## [Inconsistent StackOverflowError with recursive parametric dynamic types](https://discourse.julialang.org/t/inconsistent-stackoverflowerror-with-recursive-parametric-dynamic-types/77210)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 7\
**Last updated:** [March 1, 2022, 5:30pm UTC](https://discourse.julialang.org/t/inconsistent-stackoverflowerror-with-recursive-parametric-dynamic-types/77210 "2022-03-01T17:30:33Z")

</div>

I think I stumbled upon a bug in the Julia, but I am not sure what kind of issue is this. The code is the following: using Graphs abstract type MyAbstract end struct Composite{T \<: MyAbstract,R \<: MyAbstract} \<: MyAb…

---

## [How to broadcast over only certain function arguments?](https://discourse.julialang.org/t/how-to-broadcast-over-only-certain-function-arguments/19274)

<div class="topic-metadata">

**Author:** [@ronubi](https://discourse.julialang.org/u/ronubi)\
**Replies:** 15\
**Last updated:** [March 1, 2022, 5:13pm UTC](https://discourse.julialang.org/t/how-to-broadcast-over-only-certain-function-arguments/19274 "2022-03-01T17:13:42Z")

</div>

I have a function that takes fixed input arrays and variable scalars to produce a scalar return value. I would like to use the broadcast capability of Julia to turn the variable scalars into arrays, and have it return a…

---

## [Installing Julia Packages on a cluster](https://discourse.julialang.org/t/installing-julia-packages-on-a-cluster/43549)

<div class="topic-metadata">

**Author:** [@diepreye\_ayabina](https://discourse.julialang.org/u/diepreye_ayabina)\
**Replies:** 5\
**Last updated:** [March 1, 2022, 3:12pm UTC](https://discourse.julialang.org/t/installing-julia-packages-on-a-cluster/43549 "2022-03-01T15:12:29Z")

</div>

Hi, I’ve just started using Julia on my cluster account. Julia has to be recently installed by the admin and there isn’t much support from them with regards to usage. I can submit and run simple jobs, however when I try…

---

## [Allocations when overwriting array elements in-place](https://discourse.julialang.org/t/allocations-when-overwriting-array-elements-in-place/77215)

<div class="topic-metadata">

**Author:** [@misa](https://discourse.julialang.org/u/misa)\
**Replies:** 5\
**Last updated:** [March 1, 2022, 1:07pm UTC](https://discourse.julialang.org/t/allocations-when-overwriting-array-elements-in-place/77215 "2022-03-01T13:07:04Z")

</div>

I have a relatively large matrix, where I want to set all values below a certain threshold to zero: @time A = rand(1000,1000,1000) @time bool = A .\< 0.5 @time A\[bool\] .= 0.0 5.653554 seconds (2 allocations: 7.451 GiB, …

---

## [If statement executing when comparing equality of hyphen](https://discourse.julialang.org/t/if-statement-executing-when-comparing-equality-of-hyphen/77230)

<div class="topic-metadata">

**Author:** [@imantha](https://discourse.julialang.org/u/imantha)\
**Replies:** 2\
**Last updated:** [March 1, 2022, 12:57pm UTC](https://discourse.julialang.org/t/if-statement-executing-when-comparing-equality-of-hyphen/77230 "2022-03-01T12:57:18Z")

</div>

Hi I am wondering what I am doing incorrectly here, somestring = "2021\_10\_20-sess05-spk\_M\_C\_010.pdf" if somestring\[11\] != "-" @show somestring\[11\],"incorrect" end \>\>\> ("-", incorrect) It shouldnt be executing sin…

---

## [How best to use a custom module?](https://discourse.julialang.org/t/how-best-to-use-a-custom-module/77066)

<div class="topic-metadata">

**Author:** [@LeoK987](https://discourse.julialang.org/u/LeoK987)\
**Replies:** 18\
**Last updated:** [March 1, 2022, 10:34am UTC](https://discourse.julialang.org/t/how-best-to-use-a-custom-module/77066 "2022-03-01T10:34:25Z")

</div>

Hi guys, I have been away from Julia since end of 2018. Now coming back and looking at my old code now with Julia 1.7, I feel puzzled at how best to use my own modules. My modules are in subdirectories under the root …

---

## [How to find the data in the nearest grid point?](https://discourse.julialang.org/t/how-to-find-the-data-in-the-nearest-grid-point/77213)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 1\
**Last updated:** [March 1, 2022, 2:12am UTC](https://discourse.julialang.org/t/how-to-find-the-data-in-the-nearest-grid-point/77213 "2022-03-01T02:12:16Z")

</div>

I have some ship track based data missing one of the variables (Var1) that I want to extract from a gridded database (1 x 1 degree). At one location of my ship track, there will be 4 grid points (Left up, left down, rig…

---

## [Comparing RNNs versus Neural ODEs for time series prediction](https://discourse.julialang.org/t/comparing-rnns-versus-neural-odes-for-time-series-prediction/77206)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 2\
**Last updated:** [March 1, 2022, 12:33am UTC](https://discourse.julialang.org/t/comparing-rnns-versus-neural-odes-for-time-series-prediction/77206 "2022-03-01T00:33:47Z")

</div>

Hey folks. Say, I was playing around with some simple NeuralODEs (NODEs) in DiffEqFlux, and have worked with RNNs in the past. I was trying to understand the difference in prediction accuracy between RNNs and NeuralODE…

---

## [VS Code: No implementation found in developed package](https://discourse.julialang.org/t/vs-code-no-implementation-found-in-developed-package/77198)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [February 28, 2022, 10:29pm UTC](https://discourse.julialang.org/t/vs-code-no-implementation-found-in-developed-package/77198 "2022-02-28T22:29:00Z")

</div>

I work with code which references functions defined in a package developed side-by-side with the current environment/file. The implementation of the function view\_modes is reported as not found, however. This function …

---

## [Add repo outside of github as dependency to local package](https://discourse.julialang.org/t/add-repo-outside-of-github-as-dependency-to-local-package/77209)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [February 28, 2022, 10:16pm UTC](https://discourse.julialang.org/t/add-repo-outside-of-github-as-dependency-to-local-package/77209 "2022-02-28T22:16:35Z")

</div>

Hi all, I have a project that is set up as a local package using PkgTemplates. I would like to add a private Julia package that is hosted on a git repo outside of Github. I am having trouble getting it to work. I added…

---

## [General Arrow questions](https://discourse.julialang.org/t/general-arrow-questions/77191)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 7\
**Last updated:** [February 28, 2022, 10:00pm UTC](https://discourse.julialang.org/t/general-arrow-questions/77191 "2022-02-28T22:00:31Z")

</div>

I am considering switching to Arrow to improve my data loading times. Here is my setup: just over 1,000 files, each representing a single date, currently stored in SAS .sas7bdat format, sizes ranging from a 100MB to 3GB.…

---

## [Run Julia server as Windows Service to work after user log out](https://discourse.julialang.org/t/run-julia-server-as-windows-service-to-work-after-user-log-out/37261)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 2\
**Last updated:** [February 28, 2022, 9:54pm UTC](https://discourse.julialang.org/t/run-julia-server-as-windows-service-to-work-after-user-log-out/37261 "2022-02-28T21:54:16Z")

</div>

I’m trying to make Julia server working on a Windows machine without being closed when a user log out. So, I’ve tried to wrap a simple Julia HTTP server script (and WebSocket server script) into a service on Windows 10 …

---

## [Iterator tool similar to zip (mesh?)](https://discourse.julialang.org/t/iterator-tool-similar-to-zip-mesh/77137)

<div class="topic-metadata">

**Author:** [@reinermartin](https://discourse.julialang.org/u/reinermartin)\
**Replies:** 23\
**Last updated:** [February 28, 2022, 9:35pm UTC](https://discourse.julialang.org/t/iterator-tool-similar-to-zip-mesh/77137 "2022-02-28T21:35:50Z")

</div>

Sometimes I would find it useful to ‘zip’ or ‘mesh’ two or more iterators in a way that each iterator runs in turn, and once one is exhausted it continues to use the remaining ones. For example, when I want to search thr…

---

## [Get tuple length from type?](https://discourse.julialang.org/t/get-tuple-length-from-type/32483)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 19\
**Last updated:** [February 28, 2022, 5:12pm UTC](https://discourse.julialang.org/t/get-tuple-length-from-type/32483 "2022-02-28T17:12:57Z")

</div>

Is there a built-in function to get the length of a tuple as a Val{N}? Basically I’m looking for something that would be of the form: tuplen(::Type{Tuple{}}) = Val{0}() tuplen(::Type{Tuple{T}}) where T = Val{1}() tuple…

---

## [Hash(1) change between 1.5 and 1.6](https://discourse.julialang.org/t/hash-1-change-between-1-5-and-1-6/77101)

<div class="topic-metadata">

**Author:** [@Jon\_Barker](https://discourse.julialang.org/u/Jon_Barker)\
**Replies:** 7\
**Last updated:** [February 28, 2022, 3:08pm UTC](https://discourse.julialang.org/t/hash-1-change-between-1-5-and-1-6/77101 "2022-02-28T15:08:48Z")

</div>

Hi all, I’m trying to recreate the Hash(1) value from Julia 1.1 in our Julia 1.6 codebase. Hash(1) Julia 1.5: 0x02011ce34bce797f Hash(1) Julia 1.6: 0x5bca7c69b794f8ce I’ve delved deep into the c code, without a lot of…

---

## [Timestamps in \[MsgPack.jl\](https://github.com/JuliaIO/MsgPack.jl)](https://discourse.julialang.org/t/timestamps-in-msgpack-jl-https-github-com-juliaio-msgpack-jl/40255)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 1\
**Last updated:** [May 29, 2020, 12:22am UTC](https://discourse.julialang.org/t/timestamps-in-msgpack-jl-https-github-com-juliaio-msgpack-jl/40255 "2020-05-29T00:22:34Z")

</div>

Hey :slight\_smile: I’m using MsgPack.jl and trying to add an ExtentionType (Link). But I want to define my one deserialization as defined here. I hope someone knows how it works :+1:

---

## [Inaccurate Matrix Multiplication](https://discourse.julialang.org/t/inaccurate-matrix-multiplication/76903)

<div class="topic-metadata">

**Author:** [@judober](https://discourse.julialang.org/u/judober)\
**Replies:** 39\
**Last updated:** [February 28, 2022, 2:02pm UTC](https://discourse.julialang.org/t/inaccurate-matrix-multiplication/76903 "2022-02-28T14:02:12Z")

</div>

We experienced an issue with Matrix-Vector (or row-vector times column-vector) product. In the example the result should return zero: a = \[1.3190624946305824, 1.3190624946305824\] b = \[-3.74 3.74\] # Matrix-Vector-Produ…

---

## [Creating a loss function for sciml\_train with unequal time point distribution of the ODE components](https://discourse.julialang.org/t/creating-a-loss-function-for-sciml-train-with-unequal-time-point-distribution-of-the-ode-components/75204)

<div class="topic-metadata">

**Author:** [@Marius\_123](https://discourse.julialang.org/u/Marius_123)\
**Replies:** 13\
**Last updated:** [February 28, 2022, 1:52pm UTC](https://discourse.julialang.org/t/creating-a-loss-function-for-sciml-train-with-unequal-time-point-distribution-of-the-ode-components/75204 "2022-02-28T13:52:27Z")

</div>

Hello, i am wondering how i can build an apropriate loss function for parameter estimation with DiffEqFlux.sciml\_train if i have data points from the ODE at different time points in each component. Can maybe someone hel…

---

## [Correct way to prepare dependencies of a julia project for publishing?](https://discourse.julialang.org/t/correct-way-to-prepare-dependencies-of-a-julia-project-for-publishing/77176)

<div class="topic-metadata">

**Author:** [@Kevin\_Shen1](https://discourse.julialang.org/u/Kevin_Shen1)\
**Replies:** 9\
**Last updated:** [February 28, 2022, 12:52pm UTC](https://discourse.julialang.org/t/correct-way-to-prepare-dependencies-of-a-julia-project-for-publishing/77176 "2022-02-28T12:52:26Z")

</div>

I come from python where each environment has an independent list of packages. This simplifies publishing the project to github because you can just install from a requirements.txt file. According to this Q&A Understand…

---

## [Defining an array of MTK variables causes error with ModelingToolkit.discretize()](https://discourse.julialang.org/t/defining-an-array-of-mtk-variables-causes-error-with-modelingtoolkit-discretize/77153)

<div class="topic-metadata">

**Author:** [@Fathya.Salih](https://discourse.julialang.org/u/Fathya.Salih)\
**Replies:** 4\
**Last updated:** [February 28, 2022, 8:05am UTC](https://discourse.julialang.org/t/defining-an-array-of-mtk-variables-causes-error-with-modelingtoolkit-discretize/77153 "2022-02-28T08:05:04Z")

</div>

I am trying to solve a number of ODEs for a set of variables (u\_1, u\_2, ..., u\_6) using MethodOfLines.jl, but I get this error MethodError: no method matching nameof(::SymbolicUtils.Term{SymbolicUtils.FnType{Tuple, Real…

---

## [Minkowski decomposition in Polyhedra.jl](https://discourse.julialang.org/t/minkowski-decomposition-in-polyhedra-jl/77156)

<div class="topic-metadata">

**Author:** [@XLVII](https://discourse.julialang.org/u/XLVII)\
**Replies:** 1\
**Last updated:** [February 27, 2022, 10:36pm UTC](https://discourse.julialang.org/t/minkowski-decomposition-in-polyhedra-jl/77156 "2022-02-27T22:36:44Z")

</div>

Is there a function about minskowski decomposition or minkowski summands which gives the all summands pair?

---

## [Reusing preallocated memory without unsafe wraps](https://discourse.julialang.org/t/reusing-preallocated-memory-without-unsafe-wraps/77069)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 8\
**Last updated:** [February 27, 2022, 8:01pm UTC](https://discourse.julialang.org/t/reusing-preallocated-memory-without-unsafe-wraps/77069 "2022-02-27T20:01:04Z")

</div>

Hello, I need to use large arrays of floats in a large number of iterations. In each iteration, the size of the arrays will be different. If memory permits, I can pre-allocate the memory needed for all iterations at o…

---

## [Easily run code in .jmd file (Weave.jl)](https://discourse.julialang.org/t/easily-run-code-in-jmd-file-weave-jl/61575)

<div class="topic-metadata">

**Author:** [@Antomek](https://discourse.julialang.org/u/Antomek)\
**Replies:** 1\
**Last updated:** [February 27, 2022, 4:47pm UTC](https://discourse.julialang.org/t/easily-run-code-in-jmd-file-weave-jl/61575 "2022-02-27T16:47:19Z")

</div>

Hello, Is there an easy way to run the code chunks from a .jmd file in the REPL? I am using VS Code, and like using Weave.jl to properly document my simulations. However, it would be nice if running code was easier fr…

---

## [Time cost for using structs](https://discourse.julialang.org/t/time-cost-for-using-structs/77149)

<div class="topic-metadata">

**Author:** [@lineycroc](https://discourse.julialang.org/u/lineycroc)\
**Replies:** 2\
**Last updated:** [February 27, 2022, 2:07pm UTC](https://discourse.julialang.org/t/time-cost-for-using-structs/77149 "2022-02-27T14:07:31Z")

</div>

I am trying to better understand the performance implications of using mutable structs. My actual use case is similar to the Optim package of storing a state variable that will change every iteration (such as https://git…

---

## [Time series interpolation](https://discourse.julialang.org/t/time-series-interpolation/77147)

<div class="topic-metadata">

**Author:** [@cripcate](https://discourse.julialang.org/u/cripcate)\
**Replies:** 3\
**Last updated:** [February 27, 2022, 12:44pm UTC](https://discourse.julialang.org/t/time-series-interpolation/77147 "2022-02-27T12:44:33Z")

</div>

Suppose i have two vectors, one containing timestamps and one containing values: using Dates dt = collect(Date(1900,1,1):Day(2):Date(1902,1,1)) y = randn(length(x)) I want to upsample these data to daily resolution by …

---

## [Operation between two large N-dimensional arrays](https://discourse.julialang.org/t/operation-between-two-large-n-dimensional-arrays/77141)

<div class="topic-metadata">

**Author:** [@Tzaki](https://discourse.julialang.org/u/Tzaki)\
**Replies:** 2\
**Last updated:** [February 27, 2022, 10:41am UTC](https://discourse.julialang.org/t/operation-between-two-large-n-dimensional-arrays/77141 "2022-02-27T10:41:10Z")

</div>

Hello, I am pretty much new to Julia. I am now trying to do an operation between two large N-dimensional sparse arrays of the same size (typically something like 8-dimensional array with 5 to 10 elements for each dimens…

---

## [Error with quiver: "unexpected vi type Nothing for quiver: nothing"](https://discourse.julialang.org/t/error-with-quiver-unexpected-vi-type-nothing-for-quiver-nothing/77060)

<div class="topic-metadata">

**Author:** [@leopdsf](https://discourse.julialang.org/u/leopdsf)\
**Replies:** 1\
**Last updated:** [February 27, 2022, 12:11am UTC](https://discourse.julialang.org/t/error-with-quiver-unexpected-vi-type-nothing-for-quiver-nothing/77060 "2022-02-27T00:11:53Z")

</div>

Greetings, everybody! I’m having a problem using quiver from Plots.jl. As I understood, I have to provide 2 arrays that will state the initial coordinate of the vector, and other 2 that will state its final position. So…

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

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