# General Usage

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

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

**Page:** 907

---

## [Serialized size](https://discourse.julialang.org/t/serialized-size/19138)

<div class="topic-metadata">

**Author:** [@squaregoldfish](https://discourse.julialang.org/u/squaregoldfish)\
**Replies:** 2\
**Last updated:** [December 31, 2018, 10:02am UTC](https://discourse.julialang.org/t/serialized-size/19138 "2018-12-31T10:02:45Z")

</div>

Is it possible to discover how large something will be when it’s serialized? I have a data type: NamedTuple{(:x, :y), Tuple{UInt64, UInt64}} sizeof tells me this is 16 bytes, and the serialize documentation says that …

---

## [\`MethodError\` in Julia processes launched with \`--worker\` argument](https://discourse.julialang.org/t/methoderror-in-julia-processes-launched-with-worker-argument/19143)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 0\
**Last updated:** [December 31, 2018, 2:49am UTC](https://discourse.julialang.org/t/methoderror-in-julia-processes-launched-with-worker-argument/19143 "2018-12-31T02:49:45Z")

</div>

I wrote a my cluster manager to be used with our cluster running Slurm. Now running the code is as simple as julia\> a = ArettoManager(124) ArettoManager(124) julia\> addprocs(a, partition="defq", N=16) which correctly…

---

## [Compiler-like analysis in Julia](https://discourse.julialang.org/t/compiler-like-analysis-in-julia/19075)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 17\
**Last updated:** [December 31, 2018, 12:47am UTC](https://discourse.julialang.org/t/compiler-like-analysis-in-julia/19075 "2018-12-31T00:47:24Z")

</div>

Hello all, For Soss.jl I need to do some static analysis and transformations on expressions. Here’s a simple example of a Model: myModel = @model x begin μ ~ Normal(0, 1.0) x ~ Normal(μ, 1.0) end Think of this…

---

## [Optimizing iteration over slices of multiple matrices](https://discourse.julialang.org/t/optimizing-iteration-over-slices-of-multiple-matrices/19096)

<div class="topic-metadata">

**Author:** [@mateuszbaran](https://discourse.julialang.org/u/mateuszbaran)\
**Replies:** 14\
**Last updated:** [December 30, 2018, 6:03pm UTC](https://discourse.julialang.org/t/optimizing-iteration-over-slices-of-multiple-matrices/19096 "2018-12-30T18:03:49Z")

</div>

I’m trying to optimize some of my code. A common pattern is performing an operation column-wise or row-wise across multiple arrays. Here is a very simplified piece of code: using BenchmarkTools using LinearAlgebra func…

---

## ["invert" nested arrays/collections](https://discourse.julialang.org/t/invert-nested-arrays-collections/19116)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [December 30, 2018, 5:08pm UTC](https://discourse.julialang.org/t/invert-nested-arrays-collections/19116 "2018-12-30T17:08:29Z")

</div>

Is there an existing library that would transform a vector of some collections (eg Tuple, NamedTuple, Array) to a collection of vectors, recursively? Eg (note that using fill with the same elements is just for the MWE): …

---

## [Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure](https://discourse.julialang.org/t/matplotlib-is-currently-using-agg-which-is-a-non-gui-backend-so-cannot-show-the-figure/19113)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 1\
**Last updated:** [December 30, 2018, 9:38am UTC](https://discourse.julialang.org/t/matplotlib-is-currently-using-agg-which-is-a-non-gui-backend-so-cannot-show-the-figure/19113 "2018-12-30T09:38:52Z")

</div>

I am running this code. using Pkg using GaussianProcesses using Plots pyplot() # Optionally select a plotting backend # Generate random data for Gaussian process x = 2π \* rand(10) y = sin.(x) + 0.5\*rand(10) # Set-up…

---

## [Error using PGFPlots.jl](https://discourse.julialang.org/t/error-using-pgfplots-jl/19080)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 5\
**Last updated:** [December 30, 2018, 7:59am UTC](https://discourse.julialang.org/t/error-using-pgfplots-jl/19080 "2018-12-30T07:59:24Z")

</div>

Hi, please help me with this annoying and incomprehensive behavior. When I run using PGFPlots p = \[\] fun = \[sin, cos\] x = 0:10 for i = 1:2 push!(p, Plots.Linear(x, fun\[i\].(x))) end Axis(p) I get the following error…

---

## [Modules and multiple dispatch](https://discourse.julialang.org/t/modules-and-multiple-dispatch/19098)

<div class="topic-metadata">

**Author:** [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Replies:** 2\
**Last updated:** [December 29, 2018, 8:28pm UTC](https://discourse.julialang.org/t/modules-and-multiple-dispatch/19098 "2018-12-29T20:28:49Z")

</div>

Hello everyone! I have been struggling with understanding how modules work together with multiple dispatch. What I want is to subtype abstract type defined in the module to overload specific, previously known methods. Th…

---

## [Is there a way to get f from typeof(f)?](https://discourse.julialang.org/t/is-there-a-way-to-get-f-from-typeof-f/18818)

<div class="topic-metadata">

**Author:** [@tkf](https://discourse.julialang.org/u/tkf)\
**Replies:** 17\
**Last updated:** [December 29, 2018, 10:05am UTC](https://discourse.julialang.org/t/is-there-a-way-to-get-f-from-typeof-f/18818 "2018-12-29T10:05:15Z")

</div>

I’m looking for somemagicfunction which behaves like julia\> somemagicfunction(::Type{typeof(one)}) = one somemagicfunction (generic function with 1 method) julia\> somemagicfunction(typeof(one)) one (generic function wi…

---

## [Can't install SampledSignals package because of "julia compatibility requirements to versions" ... 1.0.0](https://discourse.julialang.org/t/cant-install-sampledsignals-package-because-of-julia-compatibility-requirements-to-versions-1-0-0/19067)

<div class="topic-metadata">

**Author:** [@arnaudmgh](https://discourse.julialang.org/u/arnaudmgh)\
**Replies:** 2\
**Last updated:** [December 29, 2018, 9:11am UTC](https://discourse.julialang.org/t/cant-install-sampledsignals-package-because-of-julia-compatibility-requirements-to-versions-1-0-0/19067 "2018-12-29T09:11:45Z")

</div>

I installed Julia 1.0.3 (last stable release at time of writing this), but seems like SampledSignals does not work with this version. I thought about installing Julia 1.0.0, but can’t find an installable binary of it. A…

---

## [Compiling to branch table](https://discourse.julialang.org/t/compiling-to-branch-table/16599)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 18\
**Last updated:** [December 29, 2018, 5:51am UTC](https://discourse.julialang.org/t/compiling-to-branch-table/16599 "2018-12-29T05:51:13Z")

</div>

Is there a way to coax the compiler into compiling something like const CODES = (2, 3, 5, 7, 11) function findcode(x) index = findfirst(isequal(x), CODES) index ≡ nothing ? 0 : index end similarly to function…

---

## [My simple embedding example works on Linux, fails in Windows](https://discourse.julialang.org/t/my-simple-embedding-example-works-on-linux-fails-in-windows/18813)

<div class="topic-metadata">

**Author:** [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Replies:** 2\
**Last updated:** [December 29, 2018, 4:41am UTC](https://discourse.julialang.org/t/my-simple-embedding-example-works-on-linux-fails-in-windows/18813 "2018-12-29T04:41:41Z")

</div>

I’m working on a project right now in which I need to call Julia from a C++ Windows application. I’m not a Windows expert but need it for this project. I’m using julia 1.0.2 and on the C++ side I’m building with Microsof…

---

## [Explicitly separating execution](https://discourse.julialang.org/t/explicitly-separating-execution/18957)

<div class="topic-metadata">

**Author:** [@pyrex41](https://discourse.julialang.org/u/pyrex41)\
**Replies:** 2\
**Last updated:** [December 28, 2018, 5:45pm UTC](https://discourse.julialang.org/t/explicitly-separating-execution/18957 "2018-12-28T17:45:47Z")

</div>

Assuming I have the following structure, where an initial “state” is created which includes “objects” (in my case, custom types consisting of values/arrays/tuples + vector of callback functions), and various functions th…

---

## [Bounds Error](https://discourse.julialang.org/t/bounds-error/19060)

<div class="topic-metadata">

**Author:** [@yasirhassan](https://discourse.julialang.org/u/yasirhassan)\
**Replies:** 4\
**Last updated:** [December 28, 2018, 4:41pm UTC](https://discourse.julialang.org/t/bounds-error/19060 "2018-12-28T16:41:22Z")

</div>

i am trying to run following code: using Plots gr() X = Y = collect( range(-10, stop=10, length=100)) f(x, y) = exp.(-x.^2 .- y.^2) contour(X, Y, f) quiver!(X, Y’, quiver=f, c=:blue) bounds error is thrown: ERROR…

---

## [Jacobian of StaticArray function becoming type-unstable](https://discourse.julialang.org/t/jacobian-of-staticarray-function-becoming-type-unstable/19045)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 3\
**Last updated:** [December 28, 2018, 9:44am UTC](https://discourse.julialang.org/t/jacobian-of-staticarray-function-becoming-type-unstable/19045 "2018-12-28T09:44:16Z")

</div>

I’m trying to remove allocations from this optimization code where I’m using ForwardDiff to calculate a Jacobian matrix, and I seem to have found some corner case where the Jacobian becomes type-unstable even though each…

---

## [How to use @inbounds?](https://discourse.julialang.org/t/how-to-use-inbounds/19048)

<div class="topic-metadata">

**Author:** [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Replies:** 2\
**Last updated:** [December 28, 2018, 2:29am UTC](https://discourse.julialang.org/t/how-to-use-inbounds/19048 "2018-12-28T02:29:29Z")

</div>

julia\> f(x,y) = sqrt( x^2 + y^2 ); julia\> xset= 10:11; yset= 12:13; i= 1; julia\> m= Matrix{Float64}(undef, length(xset)\*length(yset), 3); size(m) (4,3) julia\> for x in xset for y in yset glo…

---

## [Unnecessary allocations happening at big StaticArray expression](https://discourse.julialang.org/t/unnecessary-allocations-happening-at-big-staticarray-expression/19005)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 3\
**Last updated:** [December 27, 2018, 6:41pm UTC](https://discourse.julialang.org/t/unnecessary-allocations-happening-at-big-staticarray-expression/19005 "2018-12-27T18:41:07Z")

</div>

I’m thinking this might actually be a bug report… I am working with matrix exponentiation, adapting the original Julia function first to be able to use ForwardDiff, and now trying to optimize the code as much as I can. M…

---

## [What's wrong with Coverage?](https://discourse.julialang.org/t/whats-wrong-with-coverage/18432)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 5\
**Last updated:** [December 27, 2018, 6:11pm UTC](https://discourse.julialang.org/t/whats-wrong-with-coverage/18432 "2018-12-27T18:11:17Z")

</div>

I get so many wrong results (for example here it seems that the program execution stopped at the middle). Also tried the instructions at Coverage.jl to run it locally but here no .cov files were generated (from Windows) …

---

## [PyPlot Formatting](https://discourse.julialang.org/t/pyplot-formatting/9601)

<div class="topic-metadata">

**Author:** [@Romero\_Azzalini](https://discourse.julialang.org/u/Romero_Azzalini)\
**Replies:** 3\
**Last updated:** [December 27, 2018, 1:33pm UTC](https://discourse.julialang.org/t/pyplot-formatting/9601 "2018-12-27T13:33:08Z")

</div>

Hi, can someone tell me how to format my plots in pyplot to get the numeration lines in the plot (like in the picture) and not outward? Also how do I make every 5th line longer? Is there a way to move the numeration of …

---

## [How to set variable to key of keyword arguments of function?](https://discourse.julialang.org/t/how-to-set-variable-to-key-of-keyword-arguments-of-function/18995)

<div class="topic-metadata">

**Author:** [@orange\_si](https://discourse.julialang.org/u/orange_si)\
**Replies:** 7\
**Last updated:** [December 27, 2018, 8:06am UTC](https://discourse.julialang.org/t/how-to-set-variable-to-key-of-keyword-arguments-of-function/18995 "2018-12-27T08:06:33Z")

</div>

hi, everyone~ my code like this: function hello(;name="world") println("hello, $(name)") end keyname = "name" hello(keyname="today") # I don't want to use hello(name="today") directly~ then will get error: ERR…

---

## [New user recruitment](https://discourse.julialang.org/t/new-user-recruitment/18994)

<div class="topic-metadata">

**Author:** [@gtraeger](https://discourse.julialang.org/u/gtraeger)\
**Replies:** 17\
**Last updated:** [December 27, 2018, 8:22am UTC](https://discourse.julialang.org/t/new-user-recruitment/18994 "2018-12-27T08:22:41Z")

</div>

I keep Julia on the Taskbar and use Julia as my everyday calculator. This gave me a thought. Why not promote Julia as a high-power calculation or Excel substitute? This would be a great way to introduce many more uses to…

---

## [New differentiation rules for ForwardDiff](https://discourse.julialang.org/t/new-differentiation-rules-for-forwarddiff/19012)

<div class="topic-metadata">

**Author:** [@yha](https://discourse.julialang.org/u/yha)\
**Replies:** 0\
**Last updated:** [December 26, 2018, 9:17pm UTC](https://discourse.julialang.org/t/new-differentiation-rules-for-forwarddiff/19012 "2018-12-26T21:17:13Z")

</div>

Is there currently an “official” way to add differentiation rules to be used by ForwardDiff? This was discussed a few months ago here: which pointed to DiffRules.@define\_diffrule. I managed to get my new rule to work…

---

## [Schedule web scraper on juliabox](https://discourse.julialang.org/t/schedule-web-scraper-on-juliabox/19011)

<div class="topic-metadata">

**Author:** [@Dmitry\_Makarov1](https://discourse.julialang.org/u/Dmitry_Makarov1)\
**Replies:** 0\
**Last updated:** [December 26, 2018, 9:10pm UTC](https://discourse.julialang.org/t/schedule-web-scraper-on-juliabox/19011 "2018-12-26T21:10:47Z")

</div>

Hi, I am thinking about using Julia for writing a simple web scraper. It needs to run regularly at certain times every day. Hence, I prefer cloud-based solution and not using my pc. Can such a scheduler be done using ju…

---

## [Matrix{Bool}(1000000, 1000000) really?](https://discourse.julialang.org/t/matrix-bool-1000000-1000000-really/19001)

<div class="topic-metadata">

**Author:** [@1112](https://discourse.julialang.org/u/1112)\
**Replies:** 2\
**Last updated:** [December 26, 2018, 4:25pm UTC](https://discourse.julialang.org/t/matrix-bool-1000000-1000000-really/19001 "2018-12-26T16:25:44Z")

</div>

Is it possible to create such a matrix? Matrix{Bool}(1000000, 1000000) In this form, I certainly get OutOfMemoryError() Maybe there are some kind of special matrix, I need to create an empty matrix 1000000x1000000, af…

---

## [Can the compiler automatically optimize this code?](https://discourse.julialang.org/t/can-the-compiler-automatically-optimize-this-code/18924)

<div class="topic-metadata">

**Author:** [@song\_tebo](https://discourse.julialang.org/u/song_tebo)\
**Replies:** 8\
**Last updated:** [December 26, 2018, 4:16pm UTC](https://discourse.julialang.org/t/can-the-compiler-automatically-optimize-this-code/18924 "2018-12-26T16:16:07Z")

</div>

The code below is very slow: w=rand(300,300);x=rand(300,300); r=vec(rand(300,1));b=rand(300,1); j=12;N=300; function orig() sAll=0.0;k=1; while k\<=1000000 sAll=sAll+sum(w\[:,j\].\*(r + b\[j\]\*x\[:,j\])); …

---

## [Custom exception handler](https://discourse.julialang.org/t/custom-exception-handler/18946)

<div class="topic-metadata">

**Author:** [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Replies:** 7\
**Last updated:** [December 26, 2018, 11:31am UTC](https://discourse.julialang.org/t/custom-exception-handler/18946 "2018-12-26T11:31:14Z")

</div>

Hi, I am looking for the global exception handler and a way to replace it with a custom one. The use case is a UI application (Gtk) where I want to catch all exceptions and let a message box pop up. Thanks for any hint …

---

## [Convert "4da903" to 0x4da903](https://discourse.julialang.org/t/convert-4da903-to-0x4da903/18996)

<div class="topic-metadata">

**Author:** [@1112](https://discourse.julialang.org/u/1112)\
**Replies:** 2\
**Last updated:** [December 26, 2018, 9:00am UTC](https://discourse.julialang.org/t/convert-4da903-to-0x4da903/18996 "2018-12-26T09:00:12Z")

</div>

Tell me how to convert the string to bits? “4da903” to 0x4da903

---

## [Tabular data processing benchmark & Python+Pandas](https://discourse.julialang.org/t/tabular-data-processing-benchmark-python-pandas/18983)

<div class="topic-metadata">

**Author:** [@zhangliye](https://discourse.julialang.org/u/zhangliye)\
**Replies:** 1\
**Last updated:** [December 25, 2018, 11:59pm UTC](https://discourse.julialang.org/t/tabular-data-processing-benchmark-python-pandas/18983 "2018-12-25T23:59:40Z")

</div>

Benchmark — (Python+Pandas) && (Julia +JuliaDB) Aim of the benchmark This benchmark aims to evaluate the Julia code using real-world data from the perspective of a normal user (not expert from computing science ). Hop…

---

## [TOML.ParserError when trying Pkg.gc](https://discourse.julialang.org/t/toml-parsererror-when-trying-pkg-gc/18976)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 2\
**Last updated:** [December 25, 2018, 3:04pm UTC](https://discourse.julialang.org/t/toml-parsererror-when-trying-pkg-gc/18976 "2018-12-25T15:04:58Z")

</div>

When I try to call gc in Pkg mode, I get a Pkg.TOML.ParserError as shown. Any ideas what is the problem and how to solve it? julia\> versioninfo() Julia Version 1.0.3 Commit 099e826241 (2018-12-18 01:34 UTC) Platform Inf…

---

## [Can the type gymnastics in broadcast.jl be replaced with @generated?](https://discourse.julialang.org/t/can-the-type-gymnastics-in-broadcast-jl-be-replaced-with-generated/18973)

<div class="topic-metadata">

**Author:** [@cnliao](https://discourse.julialang.org/u/cnliao)\
**Replies:** 2\
**Last updated:** [December 25, 2018, 1:08pm UTC](https://discourse.julialang.org/t/can-the-type-gymnastics-in-broadcast-jl-be-replaced-with-generated/18973 "2018-12-25T13:08:22Z")

</div>

I am trying to learn from base/broadcast.jl and eventually implement a custom broadcaststyle, which is a bit more involved than can be implemented by the methods in doc. I see the following type gymnastics and am wonderi…

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

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