# General Usage

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

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

**Page:** 784

---

## [How to install CNNVisualize](https://discourse.julialang.org/t/how-to-install-cnnvisualize/35215)

<div class="topic-metadata">

**Author:** [@Eldho.Ashna](https://discourse.julialang.org/u/Eldho.Ashna)\
**Replies:** 5\
**Last updated:** [February 27, 2020, 10:26am UTC](https://discourse.julialang.org/t/how-to-install-cnnvisualize/35215 "2020-02-27T10:26:57Z")

</div>

Hi everyone. I want to install CNNVisualize. When I try to install it using import Pkg; Pkg.add("CNNVisualize") I’m getting the following error: The following package names could not be resolved: \* CNNVisualize (not…

---

## [Fast type-stable tensor products](https://discourse.julialang.org/t/fast-type-stable-tensor-products/35159)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 18\
**Last updated:** [February 27, 2020, 9:56am UTC](https://discourse.julialang.org/t/fast-type-stable-tensor-products/35159 "2020-02-27T09:56:51Z")

</div>

Let A and B be two multi-dimensional arrays. I want to form a product of them that contracts the last n dimensions of A with the first n dimensions of B. Calling this product C, one way to do it is with the following cod…

---

## [Sumation inside a for loop](https://discourse.julialang.org/t/sumation-inside-a-for-loop/35166)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 8\
**Last updated:** [February 27, 2020, 8:32am UTC](https://discourse.julialang.org/t/sumation-inside-a-for-loop/35166 "2020-02-27T08:32:02Z")

</div>

i have tried to do a simple code for MCMC as you see below: traget(x)= (1/sqrt(2\*pi\*2^2))\*exp((-(x-10)^2)/(2\*2^2)) proposal(x)=Normal(x,1) initial=-40 result=\[\] Iteration=10000 chain=zeros(Iteration) accept\_rate= zeros(…

---

## [Passing keyword arguments from a function to the other](https://discourse.julialang.org/t/passing-keyword-arguments-from-a-function-to-the-other/35190)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [February 27, 2020, 8:12am UTC](https://discourse.julialang.org/t/passing-keyword-arguments-from-a-function-to-the-other/35190 "2020-02-27T08:12:25Z")

</div>

I need to replicate the following python code, where f1 is called with a function name, a positional argument and some keyword ones, and it passes to the function defined in its first argument the positional argument and…

---

## [Trace of broadcasting](https://discourse.julialang.org/t/trace-of-broadcasting/35210)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 4\
**Last updated:** [February 27, 2020, 7:35am UTC](https://discourse.julialang.org/t/trace-of-broadcasting/35210 "2020-02-27T07:35:17Z")

</div>

docs said: f.(args...) is equivalent to broadcast(f, args...) however, I found that f.() is not calling broadcast(f, ): Base.broadcast(::typeof(exp), x) = println("exp ", x); x = \[1.0, 2.0\]; julia\> Base.broadcast…

---

## [How to avoid unneccessary memory allocation for inplace estimation of \`mean\`?](https://discourse.julialang.org/t/how-to-avoid-unneccessary-memory-allocation-for-inplace-estimation-of-mean/35146)

<div class="topic-metadata">

**Author:** [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)\
**Replies:** 12\
**Last updated:** [February 27, 2020, 12:13am UTC](https://discourse.julialang.org/t/how-to-avoid-unneccessary-memory-allocation-for-inplace-estimation-of-mean/35146 "2020-02-27T00:13:58Z")

</div>

I’m doing micro-optimization of my code, and current bottleneck is a place, where I call mean millions of times on small 2d arrays. And it leads to huge number of allocations. Simply re-implementing mean removes them all…

---

## [Extending ==](https://discourse.julialang.org/t/extending/35198)

<div class="topic-metadata">

**Author:** [@SEA](https://discourse.julialang.org/u/SEA)\
**Replies:** 2\
**Last updated:** [February 26, 2020, 10:00pm UTC](https://discourse.julialang.org/t/extending/35198 "2020-02-26T22:00:19Z")

</div>

I am trying to extend the == operator from Base. If I try to access it via the syntax Base.:==, it does not parse. However, Base.:\* does. A workaround is to explicitly import it via import Base: == to extend it. I am usi…

---

## [Composition of functions and method dispatch](https://discourse.julialang.org/t/composition-of-functions-and-method-dispatch/35189)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 6\
**Last updated:** [February 26, 2020, 8:08pm UTC](https://discourse.julialang.org/t/composition-of-functions-and-method-dispatch/35189 "2020-02-26T20:08:53Z")

</div>

I have a number of functions like so gfun(m::Type1,t) gfun(m::Type2,t) gfun(m::Type3,x,t) In every case, I would like to define a different function, call it hfun, that takes the same arguments and just composes a sim…

---

## [First time call of (precompiled) functions](https://discourse.julialang.org/t/first-time-call-of-precompiled-functions/35179)

<div class="topic-metadata">

**Author:** [@zhaoli-IHEP](https://discourse.julialang.org/u/zhaoli-IHEP)\
**Replies:** 0\
**Last updated:** [February 26, 2020, 3:54pm UTC](https://discourse.julialang.org/t/first-time-call-of-precompiled-functions/35179 "2020-02-26T15:54:06Z")

</div>

I have created a simple function in a module file “test.jl” module test export test0 function test0( s::Float64 )::Float64 return s\*100 end end Then I create another script main.jl to run this function using …

---

## [Generic Method with # Methods](https://discourse.julialang.org/t/generic-method-with-methods/35153)

<div class="topic-metadata">

**Author:** [@jtaylor306](https://discourse.julialang.org/u/jtaylor306)\
**Replies:** 3\
**Last updated:** [February 26, 2020, 1:34pm UTC](https://discourse.julialang.org/t/generic-method-with-methods/35153 "2020-02-26T13:34:43Z")

</div>

What exactly does “with # methods” mean? Here are some results that really confuse me. function sayhi(x,y) x+y end Result: sayhi (generic function with 3 methods) function f(x,y) x+y end Result: f (generic f…

---

## [PackageCompiler do not works](https://discourse.julialang.org/t/packagecompiler-do-not-works/35142)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 4\
**Last updated:** [February 26, 2020, 11:54am UTC](https://discourse.julialang.org/t/packagecompiler-do-not-works/35142 "2020-02-26T11:54:04Z")

</div>

I am studing this page, trying to obtain a standalone app executable: https://julialang.github.io/PackageCompiler.jl/dev/apps/ I am doing these commands, to obtain an executable standalone of the example that there is …

---

## [I cannot import one module although I am able to do so with others](https://discourse.julialang.org/t/i-cannot-import-one-module-although-i-am-able-to-do-so-with-others/35148)

<div class="topic-metadata">

**Author:** [@dave7895](https://discourse.julialang.org/u/dave7895)\
**Replies:** 2\
**Last updated:** [February 26, 2020, 5:16am UTC](https://discourse.julialang.org/t/i-cannot-import-one-module-although-i-am-able-to-do-so-with-others/35148 "2020-02-26T05:16:51Z")

</div>

The title basically says it all. I have a module that Julia does not find. The error message using Pal ERROR: ArgumentError: Package Pal not found in current path: - Run \`import Pkg; Pkg.add("Pal")\` to install the Pal p…

---

## [ForwardDiff.jacobian of softmax vs analytic Jacobian](https://discourse.julialang.org/t/forwarddiff-jacobian-of-softmax-vs-analytic-jacobian/35147)

<div class="topic-metadata">

**Author:** [@zxzkja](https://discourse.julialang.org/u/zxzkja)\
**Replies:** 0\
**Last updated:** [February 26, 2020, 1:18am UTC](https://discourse.julialang.org/t/forwarddiff-jacobian-of-softmax-vs-analytic-jacobian/35147 "2020-02-26T01:18:24Z")

</div>

I am trying out automatic differentiation on part of my code in place of the analytic derivative, but ForwardDiff.jacobian of softmax seems to take twice as long as the analytic Jacobian. I’m not sure if this is an expec…

---

## [Best Practices for Package Resource Location](https://discourse.julialang.org/t/best-practices-for-package-resource-location/35141)

<div class="topic-metadata">

**Author:** [@duncanam](https://discourse.julialang.org/u/duncanam)\
**Replies:** 2\
**Last updated:** [February 25, 2020, 10:19pm UTC](https://discourse.julialang.org/t/best-practices-for-package-resource-location/35141 "2020-02-25T22:19:31Z")

</div>

Hello, I’m creating a package that will perform table lookups on some standardized chemical tables one can find online, and I’d like to inquire as to best practices for where and how to look for these resources once dow…

---

## [Calling Julia algorithm from C](https://discourse.julialang.org/t/calling-julia-algorithm-from-c/35130)

<div class="topic-metadata">

**Author:** [@kevinczimmerman](https://discourse.julialang.org/u/kevinczimmerman)\
**Replies:** 6\
**Last updated:** [February 25, 2020, 8:05pm UTC](https://discourse.julialang.org/t/calling-julia-algorithm-from-c/35130 "2020-02-25T20:05:21Z")

</div>

I am interested in developing algorithms in Julia and compiling the algorithm into a library and then integrating the functionality into large codebases written in C. I’m aware of PackageCompiler.jl but am confused about…

---

## [Performance issue when storing function in a struct as a field](https://discourse.julialang.org/t/performance-issue-when-storing-function-in-a-struct-as-a-field/35122)

<div class="topic-metadata">

**Author:** [@Xing\_Shi\_Cai](https://discourse.julialang.org/u/Xing_Shi_Cai)\
**Replies:** 2\
**Last updated:** [February 25, 2020, 4:34pm UTC](https://discourse.julialang.org/t/performance-issue-when-storing-function-in-a-struct-as-a-field/35122 "2020-02-25T16:34:19Z")

</div>

I have a bit of code like this. In the function simulation, I generate a random tree and count the size of each subtree. Then I sim.func to the subtree sizes and add it up. I mostly need sim.func=log. But to have some f…

---

## [Julia Client – Internal Error: Julia stopped if running codes in script rather than REPL](https://discourse.julialang.org/t/julia-client-internal-error-julia-stopped-if-running-codes-in-script-rather-than-repl/35087)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 8\
**Last updated:** [February 25, 2020, 3:41pm UTC](https://discourse.julialang.org/t/julia-client-internal-error-julia-stopped-if-running-codes-in-script-rather-than-repl/35087 "2020-02-25T15:41:36Z")

</div>

After starting Julia by Enter, any code pasted from script to REPL is running well. However, directly running the codes in script (by Ctrl+Enter) leads to stop Julia every time and report the Internal Error: Julia Clien…

---

## [\`add Test\` fails in presence of \`test\` directory on macOS](https://discourse.julialang.org/t/add-test-fails-in-presence-of-test-directory-on-macos/35118)

<div class="topic-metadata">

**Author:** [@mlhetland](https://discourse.julialang.org/u/mlhetland)\
**Replies:** 1\
**Last updated:** [February 25, 2020, 3:31pm UTC](https://discourse.julialang.org/t/add-test-fails-in-presence-of-test-directory-on-macos/35118 "2020-02-25T15:31:49Z")

</div>

The macOS file system is case insenitive but case preserving, so if you have a directory named test in your project (which is standard) and you try to add the Test module (which you need to do testing), you get the follo…

---

## [isapprox(Tuple{T}) not working](https://discourse.julialang.org/t/isapprox-tuple-t-not-working/35117)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [February 25, 2020, 3:16pm UTC](https://discourse.julialang.org/t/isapprox-tuple-t-not-working/35117 "2020-02-25T15:16:08Z")

</div>

Wondering while isapprox() works for scalar and arrays but not for tuples: \[-6.9999999998,-1.000000000002\] ≈ \[-7,-1\] # true (-6.9999999998,-1.000000000002) ≈ (-7,-1) # MethodError (\[-6.9908,-1.00152\],21.96624)…

---

## [Re-use existing StatsPlots Recipes?](https://discourse.julialang.org/t/re-use-existing-statsplots-recipes/35104)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 1\
**Last updated:** [February 25, 2020, 11:50am UTC](https://discourse.julialang.org/t/re-use-existing-statsplots-recipes/35104 "2020-02-25T11:50:39Z")

</div>

I’m trying to define a stackedhist recipes which takes bins and array{array} and uses groupedbar to display a stacked histogram, the following function works: using StatsPlots, StatsBase function stack\_plot(args...) …

---

## [Win7 running Julia by bat file dispaly not works?](https://discourse.julialang.org/t/win7-running-julia-by-bat-file-dispaly-not-works/35084)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 5\
**Last updated:** [February 25, 2020, 9:31am UTC](https://discourse.julialang.org/t/win7-running-julia-by-bat-file-dispaly-not-works/35084 "2020-02-25T09:31:55Z")

</div>

No plot ! Why ? Win7 in file start.bat is: C:\\Users\\PC\\AppData\\Local\\Julia-0.7.0\\bin\\julia.exe -L start.jl in start.jl file is: println("Pracujesz w aktalogu: ",pwd()) include("display\_plot.jl") display\_plot.jl: …

---

## [Generating zero-isoclines for a coupled ODE](https://discourse.julialang.org/t/generating-zero-isoclines-for-a-coupled-ode/35070)

<div class="topic-metadata">

**Author:** [@Libbum](https://discourse.julialang.org/u/Libbum)\
**Replies:** 4\
**Last updated:** [February 25, 2020, 9:30am UTC](https://discourse.julialang.org/t/generating-zero-isoclines-for-a-coupled-ode/35070 "2020-02-25T09:30:16Z")

</div>

Hi All, This seems like it should be a simple problem to solve, but I’ve scoured the documentation of DifferentialEquations.jl and can’t seem to identify anything specifically relating to my issue. For a simple coupled…

---

## [Why doesn't the compiler infer the type of this function?](https://discourse.julialang.org/t/why-doesnt-the-compiler-infer-the-type-of-this-function/35005)

<div class="topic-metadata">

**Author:** [@benninkrs](https://discourse.julialang.org/u/benninkrs)\
**Replies:** 6\
**Last updated:** [February 25, 2020, 3:23am UTC](https://discourse.julialang.org/t/why-doesnt-the-compiler-infer-the-type-of-this-function/35005 "2020-02-25T03:23:52Z")

</div>

On Julia v1.2.0: fib1(n::Int64) = n\<=1 ? (1,) : (n, fib1(n-1)...) run1() = fib1(5) fib2(::Type{Val{n}}) where {n} = n\<=1 ? (1,) : (n, fib2(Val{n-1})...) run2() = fib2(Val{5}) julia\> @code\_warntype run1() Variables #…

---

## [What's the best way to work with millions of rows of data?](https://discourse.julialang.org/t/whats-the-best-way-to-work-with-millions-of-rows-of-data/35075)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 7\
**Last updated:** [February 24, 2020, 8:38pm UTC](https://discourse.julialang.org/t/whats-the-best-way-to-work-with-millions-of-rows-of-data/35075 "2020-02-24T20:38:44Z")

</div>

Hi how’s it going? I made a prototype of an app using the DataFrames.jl package. The data was about 100,000 rows. I need to scale this up to millions, possibly hundreds of millions of rows. I don’t know too much about h…

---

## [\[SOLVED\] Behavior of @generated with no arguments](https://discourse.julialang.org/t/solved-behavior-of-generated-with-no-arguments/35083)

<div class="topic-metadata">

**Author:** [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Replies:** 0\
**Last updated:** [February 24, 2020, 7:03pm UTC](https://discourse.julialang.org/t/solved-behavior-of-generated-with-no-arguments/35083 "2020-02-24T19:03:45Z")

</div>

EDIT: I somehow missed the appropriate section of the manual despite skimming through several times. Please disregard. https://docs.julialang.org/en/v1/manual/metaprogramming/#Optionally-generated-functions-1 Here’s on…

---

## [Gtk assertion 'GDK\_IS\_WINDOW (window)' failed](https://discourse.julialang.org/t/gtk-assertion-gdk-is-window-window-failed/28964)

<div class="topic-metadata">

**Author:** [@Alan\_Bahm](https://discourse.julialang.org/u/Alan_Bahm)\
**Replies:** 2\
**Last updated:** [February 24, 2020, 7:36pm UTC](https://discourse.julialang.org/t/gtk-assertion-gdk-is-window-window-failed/28964 "2020-02-24T19:36:34Z")

</div>

\#= Using Julia v1.2.0 with Gtk v0.17.0, running Win10 or Mac v10.14.6 A window holding a grid, holding a notebook, holding a canvas generates 5 assertions like: (:47666): Gdk-CRITICAL \*\*: 11:53:46.732: gdk\_window\_…

---

## [What would be the equivalent of this piece of Python code?](https://discourse.julialang.org/t/what-would-be-the-equivalent-of-this-piece-of-python-code/34827)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 6\
**Last updated:** [February 24, 2020, 4:10pm UTC](https://discourse.julialang.org/t/what-would-be-the-equivalent-of-this-piece-of-python-code/34827 "2020-02-24T16:10:07Z")

</div>

Hi I have used this piece of code to measure the time it takes for a Python script to execute. I want to do the same with Julia. from datetime import datetime start\_time = datetime.now() end\_time = datetime.now() del…

---

## [Output matrix in last (t-1) generation: normal; Indexing the same matrix in this generation: NaNs in the (t-1) column](https://discourse.julialang.org/t/output-matrix-in-last-t-1-generation-normal-indexing-the-same-matrix-in-this-generation-nans-in-the-t-1-column/35059)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 2\
**Last updated:** [February 24, 2020, 2:58pm UTC](https://discourse.julialang.org/t/output-matrix-in-last-t-1-generation-normal-indexing-the-same-matrix-in-this-generation-nans-in-the-t-1-column/35059 "2020-02-24T14:58:29Z")

</div>

The only part of this function differring from my previous functional one is adding a variable to be calculated in each generation. NDeme=0.5(Nmax+Nmin)+0.5(Nmax+Nmin)\*sin(2pi\*t/period) #period=12 genetation in setting …

---

## [Syntax invalid for "::"](https://discourse.julialang.org/t/syntax-invalid-for/35068)

<div class="topic-metadata">

**Author:** [@gonced8](https://discourse.julialang.org/u/gonced8)\
**Replies:** 3\
**Last updated:** [February 24, 2020, 2:42pm UTC](https://discourse.julialang.org/t/syntax-invalid-for/35068 "2020-02-24T14:42:44Z")

</div>

I’m new to Julia and I’m trying to use this package: However, after adding it with pkg add GitHub - interplanetary-robot/SigmoidNumbers: Sigmoid Numbers for Julia when I type using SigmoidNumbers I get the foll…

---

## [PackageCompiler for having a simple .exe?](https://discourse.julialang.org/t/packagecompiler-for-having-a-simple-exe/35071)

<div class="topic-metadata">

**Author:** [@Darione](https://discourse.julialang.org/u/Darione)\
**Replies:** 4\
**Last updated:** [February 24, 2020, 2:39pm UTC](https://discourse.julialang.org/t/packagecompiler-for-having-a-simple-exe/35071 "2020-02-24T14:39:22Z")

</div>

Hello, i am looking for a PackageCompiler instruction for humans, because it seems to me that there are a lot of links in internet but it is difficult to find the most simple case : own simple script that print something…

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

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