# General Usage

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

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

**Page:** 783

---

## [Why does Julia not optimize this code when C++ (LLVM) can?](https://discourse.julialang.org/t/why-does-julia-not-optimize-this-code-when-c-llvm-can/35314)

<div class="topic-metadata">

**Author:** [@kdheepak](https://discourse.julialang.org/u/kdheepak)\
**Replies:** 14\
**Last updated:** [February 29, 2020, 7:08pm UTC](https://discourse.julialang.org/t/why-does-julia-not-optimize-this-code-when-c-llvm-can/35314 "2020-02-29T19:08:32Z")

</div>

When using a C++ compiler with LLVM version 6.0.0, the following code bool isEven(int n) { bool ret = true; for (int i = 0; i \< n; i ++) { ret = !ret; } return ret; } emits the LLVM IR define z…

---

## [Print progress info of \`Base.download(...)\` (or alternatives)?](https://discourse.julialang.org/t/print-progress-info-of-base-download-or-alternatives/35326)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 1\
**Last updated:** [February 29, 2020, 6:50pm UTC](https://discourse.julialang.org/t/print-progress-info-of-base-download-or-alternatives/35326 "2020-02-29T18:50:11Z")

</div>

Is there a way to download a large file from Julia while printing the progress of the download? I don’t see any option in Base.download() to do this. Any alternatives we can use?

---

## [How would I set a generalized condition that can be passed in to index a dataframe without explicitly defining the dataframe name](https://discourse.julialang.org/t/how-would-i-set-a-generalized-condition-that-can-be-passed-in-to-index-a-dataframe-without-explicitly-defining-the-dataframe-name/35293)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 3\
**Last updated:** [February 29, 2020, 4:15pm UTC](https://discourse.julialang.org/t/how-would-i-set-a-generalized-condition-that-can-be-passed-in-to-index-a-dataframe-without-explicitly-defining-the-dataframe-name/35293 "2020-02-29T16:15:19Z")

</div>

Here is what I have now: df = df\[df\[Symbol(“PURCHASE”)\].==“SUCCESS”, :\] what I’d like to do is set a success condition variable and have something that works like the code below: success\_condition = Symbol(“PURCHASE”)…

---

## [Same key for run-file and continue](https://discourse.julialang.org/t/same-key-for-run-file-and-continue/35306)

<div class="topic-metadata">

**Author:** [@luc-j-bourhis](https://discourse.julialang.org/u/luc-j-bourhis)\
**Replies:** 1\
**Last updated:** [February 29, 2020, 10:13am UTC](https://discourse.julialang.org/t/same-key-for-run-file-and-continue/35306 "2020-02-29T10:13:55Z")

</div>

Coming from a different IDE (for Python), I got used to having the same key to initiate debugging, “run-file” assigned to F5 by default, and “continue” assigned to F8 by default. So basically, F5 starts debugging if it i…

---

## [Submatrix multiply](https://discourse.julialang.org/t/submatrix-multiply/35309)

<div class="topic-metadata">

**Author:** [@hytonwons](https://discourse.julialang.org/u/hytonwons)\
**Replies:** 7\
**Last updated:** [February 29, 2020, 7:14am UTC](https://discourse.julialang.org/t/submatrix-multiply/35309 "2020-02-29T07:14:48Z")

</div>

Hi, my algorithm involves a lot of submatrix multiply. I got inspired by the use of view, but the speedup of doing so is not that satisfying. Below is some sample code: If we just try slicing the matrix, the speedup is …

---

## [A couple questions on profiling](https://discourse.julialang.org/t/a-couple-questions-on-profiling/35290)

<div class="topic-metadata">

**Author:** [@riccardomurri](https://discourse.julialang.org/u/riccardomurri)\
**Replies:** 3\
**Last updated:** [February 29, 2020, 7:01am UTC](https://discourse.julialang.org/t/a-couple-questions-on-profiling/35290 "2020-02-29T07:01:53Z")

</div>

I am trying to profile a piece of code that runs for about 15 minutes. If I use the default settings in Profile.init(), the profile buffer fills up when Julia is still compiling my code, so I don’t get any useful inform…

---

## [Unit conversion](https://discourse.julialang.org/t/unit-conversion/35302)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 12\
**Last updated:** [February 29, 2020, 6:30am UTC](https://discourse.julialang.org/t/unit-conversion/35302 "2020-02-29T06:30:41Z")

</div>

Hi, I am new to Julia and am trying out Unitful. I would like to do the following: a = 1"m" / 1"cm" and have it return 100. What must I do to make this happen? It is clearly not automatic. Similarly, I would like: …

---

## [How to print arrays inside functions?](https://discourse.julialang.org/t/how-to-print-arrays-inside-functions/4091)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 12\
**Last updated:** [February 29, 2020, 6:05am UTC](https://discourse.julialang.org/t/how-to-print-arrays-inside-functions/4091 "2020-02-29T06:05:34Z")

</div>

It is useful to peak at an array when debugging a function. However, the macro @show prints arrays like vectors. How to print arrays in the correct REPL way? zeros(5, 5) #\>5×5 Array{Float64,2}: #\> 0.0 0.0 0.0 0.0 0.…

---

## [Export metagraph with node properties](https://discourse.julialang.org/t/export-metagraph-with-node-properties/35295)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 2\
**Last updated:** [February 28, 2020, 8:02pm UTC](https://discourse.julialang.org/t/export-metagraph-with-node-properties/35295 "2020-02-28T20:02:24Z")

</div>

Is there a way to export a MetaGraph to a common graph format and include the added node properties?

---

## [How would I parallelize a for loop that's iterating over columns of a dataframe](https://discourse.julialang.org/t/how-would-i-parallelize-a-for-loop-thats-iterating-over-columns-of-a-dataframe/35249)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 5\
**Last updated:** [February 28, 2020, 7:37pm UTC](https://discourse.julialang.org/t/how-would-i-parallelize-a-for-loop-thats-iterating-over-columns-of-a-dataframe/35249 "2020-02-28T19:37:10Z")

</div>

Hi how’s it going? I’ve read up on Distributed.jl, adprocs, and @everywhere. I tried implementing parallelization of a function I have by making sure all the necessary packages, functions, and variables were preceded by…

---

## [Issues using HDF5 package](https://discourse.julialang.org/t/issues-using-hdf5-package/34769)

<div class="topic-metadata">

**Author:** [@natepage](https://discourse.julialang.org/u/natepage)\
**Replies:** 1\
**Last updated:** [February 28, 2020, 2:59pm UTC](https://discourse.julialang.org/t/issues-using-hdf5-package/34769 "2020-02-28T14:59:06Z")

</div>

I have downloaded the HDF5 package using the “add” command and I have made a small program that currently just reads an HDF5 file and prints some of the data. However I am getting the following error when I try to run th…

---

## [Serve files](https://discourse.julialang.org/t/serve-files/35229)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 1\
**Last updated:** [February 28, 2020, 2:48pm UTC](https://discourse.julialang.org/t/serve-files/35229 "2020-02-28T14:48:51Z")

</div>

How can I serve the content of a specific folder online? Something like this: The goal is for a user to see a list of all the available files in that folder and be able to download them. The last post about this top…

---

## [Python to Julia conversion](https://discourse.julialang.org/t/python-to-julia-conversion/35280)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 3\
**Last updated:** [February 28, 2020, 2:33pm UTC](https://discourse.julialang.org/t/python-to-julia-conversion/35280 "2020-02-28T14:33:17Z")

</div>

Can someone tell me how to convert a python code to julia, i.e., .py to .jl.

---

## [Organizing code into functions—am I doing it right?](https://discourse.julialang.org/t/organizing-code-into-functions-am-i-doing-it-right/35228)

<div class="topic-metadata">

**Author:** [@ElectronicTeaCup](https://discourse.julialang.org/u/ElectronicTeaCup)\
**Replies:** 9\
**Last updated:** [February 28, 2020, 12:46pm UTC](https://discourse.julialang.org/t/organizing-code-into-functions-am-i-doing-it-right/35228 "2020-02-28T12:46:42Z")

</div>

Hey everyone! A while back when I was learning Python, I read the book “Think Python” which has a similar port on Julia. I read the port recently, and was wondering about the method explained in the book when it came to …

---

## [Deep Learning libraries](https://discourse.julialang.org/t/deep-learning-libraries/35278)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 2\
**Last updated:** [February 28, 2020, 10:15am UTC](https://discourse.julialang.org/t/deep-learning-libraries/35278 "2020-02-28T10:15:23Z")

</div>

Hi everyone. I know that julia has many deep learning libraries like Flux, Mocha, Knet, MLBase etc. Can someone explain me which one is best for what. Or in other words, how are each of them different.

---

## [No matching method in 02-advanced\_ODE\_solving.ipynb tutorial](https://discourse.julialang.org/t/no-matching-method-in-02-advanced-ode-solving-ipynb-tutorial/35200)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 17\
**Last updated:** [February 27, 2020, 10:25pm UTC](https://discourse.julialang.org/t/no-matching-method-in-02-advanced-ode-solving-ipynb-tutorial/35200 "2020-02-27T22:25:53Z")

</div>

Hi, I am running a tutorial: 02-advanced\_ODE\_solving in a Jupyter notebook. I got part of the way down the notebook, and eventually got an error that indicated a routine was not found. I am using Julia 1.31 . If there i…

---

## [Problem of first plot? can be better?](https://discourse.julialang.org/t/problem-of-first-plot-can-be-better/35064)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 10\
**Last updated:** [February 27, 2020, 10:25pm UTC](https://discourse.julialang.org/t/problem-of-first-plot-can-be-better/35064 "2020-02-27T22:25:37Z")

</div>

Is there an improvement in the first plot problem in Julia’s road map? I ported a text search program, with its web interface (with Genie) and it works very well, a missile like speed once the first compilation started …

---

## [Method definition overwritten warnings when compiling cache or "using module" twice](https://discourse.julialang.org/t/method-definition-overwritten-warnings-when-compiling-cache-or-using-module-twice/28970)

<div class="topic-metadata">

**Author:** [@rwgardner](https://discourse.julialang.org/u/rwgardner)\
**Replies:** 1\
**Last updated:** [February 27, 2020, 9:56pm UTC](https://discourse.julialang.org/t/method-definition-overwritten-warnings-when-compiling-cache-or-using-module-twice/28970 "2020-02-27T21:56:50Z")

</div>

I have some code with this general structure push!(LOAD\_PATH, Base.source\_dir()) …

---

## [Compress many files](https://discourse.julialang.org/t/compress-many-files/35250)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 3\
**Last updated:** [February 27, 2020, 8:58pm UTC](https://discourse.julialang.org/t/compress-many-files/35250 "2020-02-27T20:58:01Z")

</div>

How to Compress many files (no data) in Julia ? Specialy text files, if I saved txt data to jld or hdf5 was many time bigger then txt. Today I hvae lot of files txt and I must compress it and still using it some time. …

---

## [Warning: You are using Gtk on Windows which is currently not recommended](https://discourse.julialang.org/t/warning-you-are-using-gtk-on-windows-which-is-currently-not-recommended/34967)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 7\
**Last updated:** [February 27, 2020, 9:45pm UTC](https://discourse.julialang.org/t/warning-you-are-using-gtk-on-windows-which-is-currently-not-recommended/34967 "2020-02-27T21:45:23Z")

</div>

What to do ? After adding Gtk is still the same Warning. Win 7 , I preparde special USER JuliaPro\_v1.3.1-1 for this instalation JPRO. In Atom was added uber-juno (@v1.3) pkg\> st Status \`C:\\Users\\JuliaPro\_v1.3.1-1\\…

---

## [Lightweight tasks, Julia vs Elixir/OTP](https://discourse.julialang.org/t/lightweight-tasks-julia-vs-elixir-otp/35082)

<div class="topic-metadata">

**Author:** [@pbayer](https://discourse.julialang.org/u/pbayer)\
**Replies:** 21\
**Last updated:** [February 27, 2020, 6:37pm UTC](https://discourse.julialang.org/t/lightweight-tasks-julia-vs-elixir-otp/35082 "2020-02-27T18:37:37Z")

</div>

I wanted to know, whether Julia can cope with Elixir/OTP lightweight tasks and made a comparison for chaining a lot of them following the example from “Programming in Elixir”. My Julia code is: function counter(next::…

---

## ["non-matching indices" error using TensorOperations](https://discourse.julialang.org/t/non-matching-indices-error-using-tensoroperations/35136)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 7\
**Last updated:** [February 27, 2020, 8:11pm UTC](https://discourse.julialang.org/t/non-matching-indices-error-using-tensoroperations/35136 "2020-02-27T20:11:58Z")

</div>

I’m trying to simplify some code that does a lot of dropdims and mapslices, so I’m looking at some packages that do Einstein notation. I tried out Einsum.jl which seems pretty intuitive, but I also wanted to try out Tens…

---

## [Problem installing ImageCore in Julia 1.4.0 on Windows (Pkg bug?)](https://discourse.julialang.org/t/problem-installing-imagecore-in-julia-1-4-0-on-windows-pkg-bug/35236)

<div class="topic-metadata">

**Author:** [@cirocavani](https://discourse.julialang.org/u/cirocavani)\
**Replies:** 4\
**Last updated:** [February 27, 2020, 7:03pm UTC](https://discourse.julialang.org/t/problem-installing-imagecore-in-julia-1-4-0-on-windows-pkg-bug/35236 "2020-02-27T19:03:12Z")

</div>

Hi folks, I am trying to install ImageCore in Julia 1.4.0-rc2 on Windows 10. When I try add the first time, the result is an IOError: symlink: no such file or directory (ENOENT). When I try add the second time, it pass…

---

## [Cassette hooks only for own module functions](https://discourse.julialang.org/t/cassette-hooks-only-for-own-module-functions/35239)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 0\
**Last updated:** [February 27, 2020, 3:47pm UTC](https://discourse.julialang.org/t/cassette-hooks-only-for-own-module-functions/35239 "2020-02-27T15:47:56Z")

</div>

Is there a way to specify Cassette in such a way that there are only prehooks and posthooks for each function of my own module? Would like to get a high level stack trace with my function names, arguments and the return. …

---

## [Lazy countmap](https://discourse.julialang.org/t/lazy-countmap/35220)

<div class="topic-metadata">

**Author:** [@harven](https://discourse.julialang.org/u/harven)\
**Replies:** 3\
**Last updated:** [February 27, 2020, 3:27pm UTC](https://discourse.julialang.org/t/lazy-countmap/35220 "2020-02-27T15:27:27Z")

</div>

I am triaging elements in a list according to their values by some function f and compute the number of elements for each possible value as follows. countmap(map(f, list)) This returns a dict whose keys are unique va…

---

## [Registrator's usage instruction link is 404](https://discourse.julialang.org/t/registrators-usage-instruction-link-is-404/35231)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 1\
**Last updated:** [February 27, 2020, 3:14pm UTC](https://discourse.julialang.org/t/registrators-usage-instruction-link-is-404/35231 "2020-02-27T15:14:26Z")

</div>

I am going to register my package to General but the Registrator’s instruction page is not exist. Is there a text what I should read?

---

## [Redefining a method used in a generated function](https://discourse.julialang.org/t/redefining-a-method-used-in-a-generated-function/35225)

<div class="topic-metadata">

**Author:** [@Sheemon7](https://discourse.julialang.org/u/Sheemon7)\
**Replies:** 2\
**Last updated:** [February 27, 2020, 2:06pm UTC](https://discourse.julialang.org/t/redefining-a-method-used-in-a-generated-function/35225 "2020-02-27T14:06:57Z")

</div>

I understand that generated functions are generated “on demand” and therefore all used methods have to be defined before: julia\> @generated g() = (@show f(1); nothing) g (generic function with 1 method) julia\> f(x) = x…

---

## [What computations are fine to do within \`Val\`?](https://discourse.julialang.org/t/what-computations-are-fine-to-do-within-val/35216)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 7\
**Last updated:** [February 27, 2020, 2:05pm UTC](https://discourse.julialang.org/t/what-computations-are-fine-to-do-within-val/35216 "2020-02-27T14:05:31Z")

</div>

Here are two (highly artificial) examples: f(::Array{T,N}, ::Array{T,M}) where {T,N,M} = zeros(T, ntuple(i -\> 2, Val(N+M))) g(::Array{T,N}, ::Array{T,M}) where {T,N,M} = zeros(T, ntuple(i -\> 2, Val(round(Int, √abs(N+M))…

---

## [Plots & animation](https://discourse.julialang.org/t/plots-animation/35223)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 6\
**Last updated:** [February 27, 2020, 1:22pm UTC](https://discourse.julialang.org/t/plots-animation/35223 "2020-02-27T13:22:33Z")

</div>

I’m playing around with animation using Plots… Here is what I get: Question: Is it possible to suppress the plotting (IJulia, Windows 10) of the final plot (above the pink box with my black tipped masking of director…

---

## [Test-driven/test-heavy workflow?](https://discourse.julialang.org/t/test-driven-test-heavy-workflow/35173)

<div class="topic-metadata">

**Author:** [@mlhetland](https://discourse.julialang.org/u/mlhetland)\
**Replies:** 6\
**Last updated:** [February 27, 2020, 11:40am UTC](https://discourse.julialang.org/t/test-driven-test-heavy-workflow/35173 "2020-02-27T11:40:57Z")

</div>

How do people set things up in order to run their test suite often (whether test-driven or not)? Some options I’ve used: Run test/runtests.jl from command line. Tends to take a long time, and requires global installat…

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

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