# General Usage

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

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

**Page:** 775

---

## [BoundsError using reduce function (Julia 1.3.1)](https://discourse.julialang.org/t/boundserror-using-reduce-function-julia-1-3-1/36232)

<div class="topic-metadata">

**Author:** [@erratic](https://discourse.julialang.org/u/erratic)\
**Replies:** 7\
**Last updated:** [March 20, 2020, 8:25pm UTC](https://discourse.julialang.org/t/boundserror-using-reduce-function-julia-1-3-1/36232 "2020-03-20T20:25:50Z")

</div>

I get the following error when I try to reduce the tuple array. Honestly I have no idea why this happen. julia\> a = \[(x, rand()\*10) for x in 1:20\] 20-element Array{Tuple{Int64,Float64},1}: (1, 8.090189006962254) (2,…

---

## [Facet enumeration](https://discourse.julialang.org/t/facet-enumeration/36270)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [March 20, 2020, 4:52pm UTC](https://discourse.julialang.org/t/facet-enumeration/36270 "2020-03-20T16:52:09Z")

</div>

I am looking for a package that implements facet enumeration, ie given the vertices of an \\mathbb{R}^n convex polytope (3 \\le n \\le 5), return the list of facets with a vertex index for each. The polytope can be assumed…

---

## [Streaming gziped file to FASTQ.Reader - where to add method?](https://discourse.julialang.org/t/streaming-gziped-file-to-fastq-reader-where-to-add-method/36266)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 2\
**Last updated:** [March 20, 2020, 3:21pm UTC](https://discourse.julialang.org/t/streaming-gziped-file-to-fastq-reader-where-to-add-method/36266 "2020-03-20T15:21:15Z")

</div>

FASTQ is a file format used for DNA sequencing, and we have a handy reader in the FASTX package. using FASTX testfile = "some/path.fastq" for record in FASTQ.Reader(open(testfile)) seq = FASTQ.sequence(record) …

---

## [How to plot an annotation with datetime X](https://discourse.julialang.org/t/how-to-plot-an-annotation-with-datetime-x/36143)

<div class="topic-metadata">

**Author:** [@Ronneesley](https://discourse.julialang.org/u/Ronneesley)\
**Replies:** 1\
**Last updated:** [March 20, 2020, 3:11pm UTC](https://discourse.julialang.org/t/how-to-plot-an-annotation-with-datetime-x/36143 "2020-03-20T15:11:51Z")

</div>

Hello, Using Plots module I have a problem positioning annotations as you can see: using Plots x = 1 plot(\[x\], \[1\], legend=false) annotate!(\[x\], \[2\], Plots.text("Here", 16, :red, :center)) This works perfectly, pos…

---

## [Writing simple weighted digraphs](https://discourse.julialang.org/t/writing-simple-weighted-digraphs/36263)

<div class="topic-metadata">

**Author:** [@eaubanel](https://discourse.julialang.org/u/eaubanel)\
**Replies:** 0\
**Last updated:** [March 20, 2020, 2:37pm UTC](https://discourse.julialang.org/t/writing-simple-weighted-digraphs/36263 "2020-03-20T14:37:57Z")

</div>

I’m using the LightGraphs package and I’m trying to write a simple weighted digraph to a file: julia\> g {32768, 467633} directed simple Int64 graph with Float64 weights julia\> savegraph("testwt.lg",g) 1 julia\> gl=loadgr…

---

## [Cannot update Julia packages](https://discourse.julialang.org/t/cannot-update-julia-packages/36240)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 4\
**Last updated:** [March 20, 2020, 1:59pm UTC](https://discourse.julialang.org/t/cannot-update-julia-packages/36240 "2020-03-20T13:59:38Z")

</div>

I am using Julia 1.2 on Fedora 31. When I tried to update Julia packages today, I got this error message: signal (11): Segmentation fault in expression starting at none:0 unknown function (ip: 0x7f2b3abdb9f7) http\_pars…

---

## [Question regarding Pkg environments](https://discourse.julialang.org/t/question-regarding-pkg-environments/36249)

<div class="topic-metadata">

**Author:** [@skarppinen](https://discourse.julialang.org/u/skarppinen)\
**Replies:** 6\
**Last updated:** [March 20, 2020, 12:37pm UTC](https://discourse.julialang.org/t/question-regarding-pkg-environments/36249 "2020-03-20T12:37:07Z")

</div>

Hello. I am confused about using Pkg environments. Suppose I create a new directory on my system called “NewProject”. Then I change my directory to this new folder, launch Julia, hit \] to launch Pkg and type activate …

---

## [In-place/fused broadcasting](https://discourse.julialang.org/t/in-place-fused-broadcasting/21067)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 10\
**Last updated:** [February 22, 2019, 2:32pm UTC](https://discourse.julialang.org/t/in-place-fused-broadcasting/21067 "2019-02-22T14:32:51Z")

</div>

I often write something like exp.(rand(10^6)) which is convienent, but inefficient as it allocates 2 arrays. What I really want is x = rand(10^6) map!(exp, x, x) Is there a single-line/idiomatic way to write this op…

---

## [Defining traits on functions using macros](https://discourse.julialang.org/t/defining-traits-on-functions-using-macros/36210)

<div class="topic-metadata">

**Author:** [@MaximeBouton](https://discourse.julialang.org/u/MaximeBouton)\
**Replies:** 10\
**Last updated:** [March 20, 2020, 9:19am UTC](https://discourse.julialang.org/t/defining-traits-on-functions-using-macros/36210 "2020-03-20T09:19:28Z")

</div>

Hello, I am trying to use traits on functions and I would like to define the trait automatically based on existing methods. I have several traits like EntityFeature and FrameFeature and a function featuretype(::typeof(…

---

## [Losing grid when zooming in plotlyjs in Juno](https://discourse.julialang.org/t/losing-grid-when-zooming-in-plotlyjs-in-juno/36226)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 0\
**Last updated:** [March 19, 2020, 8:54pm UTC](https://discourse.julialang.org/t/losing-grid-when-zooming-in-plotlyjs-in-juno/36226 "2020-03-19T20:54:00Z")

</div>

Hi, When I use Plotlyjs.jl through Plots,jl in Juno (this is by the way a fantastic interactive tool), I lose the backward grid when zooming (or at least it does not adapt to the new zooming window). This is inconvenien…

---

## [Error in using PyPlot in Julia](https://discourse.julialang.org/t/error-in-using-pyplot-in-julia/36234)

<div class="topic-metadata">

**Author:** [@fksayaci](https://discourse.julialang.org/u/fksayaci)\
**Replies:** 1\
**Last updated:** [March 20, 2020, 12:44am UTC](https://discourse.julialang.org/t/error-in-using-pyplot-in-julia/36234 "2020-03-20T00:44:51Z")

</div>

Hi, I use Julia for optimization purposes. I use PyPlot for visualization of the results. I have used Windows and Mac computer so far, and there was no problem at all. I recently switched to a Windows computer, instal…

---

## [StringIndexError some time comes unexpectedly](https://discourse.julialang.org/t/stringindexerror-some-time-comes-unexpectedly/36174)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 2\
**Last updated:** [March 19, 2020, 11:40pm UTC](https://discourse.julialang.org/t/stringindexerror-some-time-comes-unexpectedly/36174 "2020-03-19T23:40:10Z")

</div>

StringIndexError some time comes unexpectedly. Does anybody have this type of error? How to deal with it. I just do the next code to solve the problem, just change the index from 701 to 702 =)). Does anybody suggest ot…

---

## [Using CSV issues](https://discourse.julialang.org/t/using-csv-issues/36211)

<div class="topic-metadata">

**Author:** [@mayar](https://discourse.julialang.org/u/mayar)\
**Replies:** 13\
**Last updated:** [March 19, 2020, 8:08pm UTC](https://discourse.julialang.org/t/using-csv-issues/36211 "2020-03-19T20:08:18Z")

</div>

Hello. I have an easy task which is to read a CSV file. I typed in my REPL this: using Pkg Pkg.add(“CSV”) then I write using CSV and press enter I get this msg “Julia has exited Press enter to start a new session” …

---

## [Parsing Markdown lists add paragraph to items](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169)

<div class="topic-metadata">

**Author:** [@cdsousa](https://discourse.julialang.org/u/cdsousa)\
**Replies:** 4\
**Last updated:** [March 19, 2020, 6:36pm UTC](https://discourse.julialang.org/t/parsing-markdown-lists-add-paragraph-to-items/36169 "2020-03-19T18:36:50Z")

</div>

Hi all, When parsing a Markdown list, julia\> m = Markdown.parse("- qwe\\n- rty") each item gets its own paragraph. The HTML conversion of the list includes the paragraphs (\<p\>\</p\>) in each item too: julia\> println(Ma…

---

## [Very easy question about utf-8 string, I can't write the symbol "\\n" into file](https://discourse.julialang.org/t/very-easy-question-about-utf-8-string-i-cant-write-the-symbol-n-into-file/36195)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 0\
**Last updated:** [March 19, 2020, 4:16pm UTC](https://discourse.julialang.org/t/very-easy-question-about-utf-8-string-i-cant-write-the-symbol-n-into-file/36195 "2020-03-19T16:16:41Z")

</div>

I have dataframe, where one of the columns is utf-8 string. I don’t have any problem to write and to read the dataset from csv file, But I have problem, when want to open the file in Stata or Excel. Or I totally confus…

---

## [Questions about Julia Compilation Optimization Levels](https://discourse.julialang.org/t/questions-about-julia-compilation-optimization-levels/11296)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 3\
**Last updated:** [March 19, 2020, 4:15pm UTC](https://discourse.julialang.org/t/questions-about-julia-compilation-optimization-levels/11296 "2020-03-19T16:15:38Z")

</div>

I couldn’t find documentation on optimization flags. Is there such a documentation? I know one can pass optimization flags (e.g. O0) when calling Julia. Is this O0 the same as Clang’s O0? What is the default optimizati…

---

## [I've done it again: compat entry missing when registering a package](https://discourse.julialang.org/t/ive-done-it-again-compat-entry-missing-when-registering-a-package/36189)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [March 19, 2020, 3:23pm UTC](https://discourse.julialang.org/t/ive-done-it-again-compat-entry-missing-when-registering-a-package/36189 "2020-03-19T15:23:48Z")

</div>

I forgot to include a compat entry for a couple of packages when firing of request for that commit to be registered. Then the automatic merging into the registry fails (" Your new version pull request does not meet the…

---

## [Do rules for good problems for benchmarking Julia exists?](https://discourse.julialang.org/t/do-rules-for-good-problems-for-benchmarking-julia-exists/35900)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 9\
**Last updated:** [March 19, 2020, 2:54pm UTC](https://discourse.julialang.org/t/do-rules-for-good-problems-for-benchmarking-julia-exists/35900 "2020-03-19T14:54:40Z")

</div>

Few times I read discussions here, where someone try to check Julia speed, but take problem that was ill-suited for that. Two examples. Some times ago one person post examples in which for loop compute sum of arithmetic …

---

## [Nonlinear solver and interpolation of array data](https://discourse.julialang.org/t/nonlinear-solver-and-interpolation-of-array-data/36187)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 0\
**Last updated:** [March 19, 2020, 2:30pm UTC](https://discourse.julialang.org/t/nonlinear-solver-and-interpolation-of-array-data/36187 "2020-03-19T14:30:57Z")

</div>

I am using NLsolve to solve a single nonlinear function V = f(V,I), where V is the unknown voltage and I is a given current. The equation involves constraint by an arrester volt-current characteristic curve which I am …

---

## [Advice on structuring larger codebases](https://discourse.julialang.org/t/advice-on-structuring-larger-codebases/28203)

<div class="topic-metadata">

**Author:** [@jackf](https://discourse.julialang.org/u/jackf)\
**Replies:** 19\
**Last updated:** [March 19, 2020, 12:39pm UTC](https://discourse.julialang.org/t/advice-on-structuring-larger-codebases/28203 "2020-03-19T12:39:30Z")

</div>

Hi, I currently have a reasonably sized python codebase (10s of thousands of lines across 100s of modules). I rely heavily on hierarchical modules to structure my code - i.e. lots of directories with \_\_init\_\_.py and eit…

---

## [Julia crashes after successful(?) ccall](https://discourse.julialang.org/t/julia-crashes-after-successful-ccall/36157)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 3\
**Last updated:** [March 19, 2020, 10:17am UTC](https://discourse.julialang.org/t/julia-crashes-after-successful-ccall/36157 "2020-03-19T10:17:53Z")

</div>

I am trying to control a National Instruments PXI oscilloscope using Julia by calling the provided .dlls. So far I managed to initialize the communication with the instrument, configure some settings and almost finished…

---

## [How to call one julia program inside another julia program?](https://discourse.julialang.org/t/how-to-call-one-julia-program-inside-another-julia-program/36175)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 1\
**Last updated:** [March 19, 2020, 7:11am UTC](https://discourse.julialang.org/t/how-to-call-one-julia-program-inside-another-julia-program/36175 "2020-03-19T07:11:28Z")

</div>

Suppose I have two programs: code.py and main.py. I want to call code.py in main.py. In python, we can call code.py inside main.py using the command from main import \*. Similarly, in julia suppose I have two programs: ma…

---

## [PyCall Won't import gdal or osr](https://discourse.julialang.org/t/pycall-wont-import-gdal-or-osr/36168)

<div class="topic-metadata">

**Author:** [@scone](https://discourse.julialang.org/u/scone)\
**Replies:** 2\
**Last updated:** [March 19, 2020, 12:20am UTC](https://discourse.julialang.org/t/pycall-wont-import-gdal-or-osr/36168 "2020-03-19T00:20:23Z")

</div>

Hi everyone, I wrote some code a few months ago that was working fine. Now that I am trying to use it again on the same computer without changing the code, I can’t import gdal or osr with pycall. However, numpy still…

---

## [Possible to set the type of Dict entries for specific keys?](https://discourse.julialang.org/t/possible-to-set-the-type-of-dict-entries-for-specific-keys/36159)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 5\
**Last updated:** [March 18, 2020, 8:47pm UTC](https://discourse.julialang.org/t/possible-to-set-the-type-of-dict-entries-for-specific-keys/36159 "2020-03-18T20:47:51Z")

</div>

Hi all, I would like to use a Dict (or a similar structure) with values that can have different, but concrete types for given keys. For example: mydict = Dict(:a=\> 2, :b=\>\[1.0, 3.0\], :c=\> "hello type") In general, thi…

---

## [Generic function for pairwise operations](https://discourse.julialang.org/t/generic-function-for-pairwise-operations/1041)

<div class="topic-metadata">

**Author:** [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Replies:** 9\
**Last updated:** [March 18, 2020, 7:37pm UTC](https://discourse.julialang.org/t/generic-function-for-pairwise-operations/1041 "2020-03-18T19:37:51Z")

</div>

A very commonly used design pattern is to apply a function to all unique pairs of elements in a container, e.g. f(x,y) = x\*y a = randn(5) ret = eltype(a)\[\] #the example returns a vector, but in this case an UpperTriangu…

---

## [Reading bitarray from disk has ordering flipped in groups of 8, how to fix?](https://discourse.julialang.org/t/reading-bitarray-from-disk-has-ordering-flipped-in-groups-of-8-how-to-fix/36123)

<div class="topic-metadata">

**Author:** [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Replies:** 6\
**Last updated:** [March 18, 2020, 6:43pm UTC](https://discourse.julialang.org/t/reading-bitarray-from-disk-has-ordering-flipped-in-groups-of-8-how-to-fix/36123 "2020-03-18T18:43:43Z")

</div>

On Julia 1.4.0-rc2 (I don’t think it’s a new behavior), I see the following: versus the expected: I’m reading in the image as follows: io = open("bilevel\_example.tif") seek(io, 8) data = BitArray(undef, 40160\*8)…

---

## [Showing the algorithm used in DifferentialEquations.jl](https://discourse.julialang.org/t/showing-the-algorithm-used-in-differentialequations-jl/36155)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [March 18, 2020, 6:30pm UTC](https://discourse.julialang.org/t/showing-the-algorithm-used-in-differentialequations-jl/36155 "2020-03-18T18:30:42Z")

</div>

Consider a simple code to solve an ODE by DifferentialEquations.jl shown in the documentation: using DifferentialEquations f(u,p,t) = 1.01\*u u0 = 1/2 tspan = (0.0,1.0) prob = ODEProblem(f,u0,tspan) sol = solve(prob) In…

---

## [MySQL.jl connection error](https://discourse.julialang.org/t/mysql-jl-connection-error/36131)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 3\
**Last updated:** [March 18, 2020, 3:11pm UTC](https://discourse.julialang.org/t/mysql-jl-connection-error/36131 "2020-03-18T15:11:29Z")

</div>

I got the following error when try to connect MySQl using MySQL.jl. using MySQL, DBInterface conn = DBInterface.connect(MySQL.Connection, "\*\*", "root", "\*\*"; port=3306) # the connection parameters are hide here The er…

---

## [Extracting all struct fields](https://discourse.julialang.org/t/extracting-all-struct-fields/36115)

<div class="topic-metadata">

**Author:** [@francesco.alemanno](https://discourse.julialang.org/u/francesco.alemanno)\
**Replies:** 7\
**Last updated:** [March 18, 2020, 3:03pm UTC](https://discourse.julialang.org/t/extracting-all-struct-fields/36115 "2020-03-18T15:03:19Z")

</div>

ideally i would like to do this struct MyStruct a b c end function calculation(C::MyStruct) fieldnames(MyStruct)... = C 2a+3b+c end i was trying this workaround struct My a b c end func…

---

## [Estimating function intergral - function containing a sine or a cosine](https://discourse.julialang.org/t/estimating-function-intergral-function-containing-a-sine-or-a-cosine/36139)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 5\
**Last updated:** [March 18, 2020, 3:01pm UTC](https://discourse.julialang.org/t/estimating-function-intergral-function-containing-a-sine-or-a-cosine/36139 "2020-03-18T15:01:32Z")

</div>

Hi Julia users, I am looking for a package with functionality similar to the FORTRAN package QDAWO: https://docs.roguewave.com/en/imsl/fortran/2018.0/html/fnlmath/index.html#page/FNLMath/mch4.07.08.html. The FORTRAN fu…

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

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