# General Usage

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

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

**Page:** 917

---

## [Weird macro behavior trying to simulate keyword arguments](https://discourse.julialang.org/t/weird-macro-behavior-trying-to-simulate-keyword-arguments/17800)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 8\
**Last updated:** [November 21, 2018, 6:37pm UTC](https://discourse.julialang.org/t/weird-macro-behavior-trying-to-simulate-keyword-arguments/17800 "2018-11-21T18:37:38Z")

</div>

DataFramesMeta’s macros are weird, because they want to behave like functions. @transform(df, y = 5), but they are still macros. If @transform were a function, it would be implemented like transform(df; kwargs...). Inde…

---

## [Need to make a custom plot](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 4\
**Last updated:** [November 21, 2018, 5:51pm UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802 "2018-11-21T17:51:09Z")

</div>

I need to make a custom plot type (for a smith chart) and i’m wondering what would be the best approach for this. i’m most familiar with pyplot, i.e. matplotlib ,but not at all with familiar with creating custom plot ty…

---

## [Import the Pkgs already installed on another PC](https://discourse.julialang.org/t/import-the-pkgs-already-installed-on-another-pc/17158)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 36\
**Last updated:** [November 21, 2018, 5:49pm UTC](https://discourse.julialang.org/t/import-the-pkgs-already-installed-on-another-pc/17158 "2018-11-21T17:49:55Z")

</div>

Hello, In my workplace I do not have Internet, so I would like to import the Pkgs already installed on a PC with Internet. How to proceed? My interest is to study the Pkg “DiffEqTutorials”. So I need all the dependenc…

---

## [Small benchmark](https://discourse.julialang.org/t/small-benchmark/17665)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 14\
**Last updated:** [November 21, 2018, 4:37pm UTC](https://discourse.julialang.org/t/small-benchmark/17665 "2018-11-21T16:37:41Z")

</div>

I’m new to Julia, and was curious to test its famed performance, so today I made a small benchmark comparing it to C, optimized Python and Scala. Some pretty interesting results, with Julia falling a mere 3% behind the b…

---

## [How can I deep serialize an object and send it to other worker with internet?](https://discourse.julialang.org/t/how-can-i-deep-serialize-an-object-and-send-it-to-other-worker-with-internet/17818)

<div class="topic-metadata">

**Author:** [@1113](https://discourse.julialang.org/u/1113)\
**Replies:** 2\
**Last updated:** [November 21, 2018, 4:39pm UTC](https://discourse.julialang.org/t/how-can-i-deep-serialize-an-object-and-send-it-to-other-worker-with-internet/17818 "2018-11-21T16:39:44Z")

</div>

How can I deep serialize (I mean serialize an object and all of its mutable fileds) and send it to other worker via socket, just like pickle for Python?

---

## [Reset REPL when testing a module](https://discourse.julialang.org/t/reset-repl-when-testing-a-module/17816)

<div class="topic-metadata">

**Author:** [@gdestouet](https://discourse.julialang.org/u/gdestouet)\
**Replies:** 1\
**Last updated:** [November 21, 2018, 3:11pm UTC](https://discourse.julialang.org/t/reset-repl-when-testing-a-module/17816 "2018-11-21T15:11:09Z")

</div>

Hello everyone, When I am using the REPL to test a module or script by loading it with include("test.jl"), if I ever modify some definitions in the ‘test.jl’ file and include it again some modifications won’t be taken i…

---

## [BoundsError: attempt to access 5×100 Array{Float32,2} at index \[\[0, 5, … 490, 495\]\]](https://discourse.julialang.org/t/boundserror-attempt-to-access-5x100-array-float32-2-at-index-0-5-490-495/17809)

<div class="topic-metadata">

**Author:** [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Replies:** 3\
**Last updated:** [November 21, 2018, 2:29pm UTC](https://discourse.julialang.org/t/boundserror-attempt-to-access-5x100-array-float32-2-at-index-0-5-490-495/17809 "2018-11-21T14:29:43Z")

</div>

function init\_wb(in\_out=\[4096,5\]) w=\[xavier(Float32,(in\_out\[2\],in\_out\[1\])),zeros(Float32,in\_out\[2\])\] end predict(w,x)=w\[1\]\*mat(x).+w\[2\] loss(w,x,ygold)=nll(predict(w,x),ygold) lossgradient=grad(loss) julia\> w\[1\] 5…

---

## [Macro hygiene in nested quote not working](https://discourse.julialang.org/t/macro-hygiene-in-nested-quote-not-working/17806)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 11\
**Last updated:** [November 21, 2018, 1:07pm UTC](https://discourse.julialang.org/t/macro-hygiene-in-nested-quote-not-working/17806 "2018-11-21T13:07:15Z")

</div>

unfortunately I face severe problems when dealing with macros with nested quotes. Somehow the standard hygiene does not seem to work… three examples, all failing first experiment .. fails module NestedQuoteHygiene exp…

---

## [Style guide for throwing errors?](https://discourse.julialang.org/t/style-guide-for-throwing-errors/17789)

<div class="topic-metadata">

**Author:** [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Replies:** 6\
**Last updated:** [November 20, 2018, 9:30pm UTC](https://discourse.julialang.org/t/style-guide-for-throwing-errors/17789 "2018-11-20T21:30:13Z")

</div>

Hi, I have two questions about programming style and errors in Julia: Is it considered good style to have functions validate their inputs, and throw informative errors if an input’s value would cause an error? What ty…

---

## [syntax: missing last argument in "2:" range expression when using include("MyModule.jl")](https://discourse.julialang.org/t/syntax-missing-last-argument-in-2-range-expression-when-using-include-mymodule-jl/17792)

<div class="topic-metadata">

**Author:** [@Balance37](https://discourse.julialang.org/u/Balance37)\
**Replies:** 3\
**Last updated:** [November 20, 2018, 9:26pm UTC](https://discourse.julialang.org/t/syntax-missing-last-argument-in-2-range-expression-when-using-include-mymodule-jl/17792 "2018-11-20T21:26:55Z")

</div>

Hi, I am trying to use a customized Module in the same folder as main.jl. (Julia 0.6v) I used include(“MyModule.jl”) using MyModule in main.jl. But it returned an error: syntax: missing last argument in “2:” range ex…

---

## [How to install FFTW.jl offline?](https://discourse.julialang.org/t/how-to-install-fftw-jl-offline/17155)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [November 20, 2018, 8:42pm UTC](https://discourse.julialang.org/t/how-to-install-fftw-jl-offline/17155 "2018-11-20T20:42:56Z")

</div>

I am trying to install FFTW.jl on a cluster on which I do not have internet access. Usually I just clone the package and add it to julia using the local path. However FFTW.jl seems to want to download the source from the…

---

## [How to deinstall a package](https://discourse.julialang.org/t/how-to-deinstall-a-package/9854)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 10\
**Last updated:** [November 20, 2018, 8:20pm UTC](https://discourse.julialang.org/t/how-to-deinstall-a-package/9854 "2018-11-20T20:20:13Z")

</div>

Thsi question is relevant to the current package manager. It there is an answer for Pkg3 this will be welcome also. The Documentation does have a section on removing packages. but it is unclear and has not worked for me …

---

## [Is it possible to perform push!/pop!/deleteat! on an OffsetArray?](https://discourse.julialang.org/t/is-it-possible-to-perform-push-pop-deleteat-on-an-offsetarray/17787)

<div class="topic-metadata">

**Author:** [@SZJX](https://discourse.julialang.org/u/SZJX)\
**Replies:** 1\
**Last updated:** [November 20, 2018, 7:34pm UTC](https://discourse.julialang.org/t/is-it-possible-to-perform-push-pop-deleteat-on-an-offsetarray/17787 "2018-11-20T19:34:21Z")

</div>

Maybe I haven’t understood the usage of OffsetArray fully. I am porting some code from C++ and would like to have an 0-based indexing array on which one can still perform actions such as push! or delete! (i.e. the length…

---

## [Super type for all things iterable?](https://discourse.julialang.org/t/super-type-for-all-things-iterable/17765)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 5\
**Last updated:** [November 20, 2018, 7:04pm UTC](https://discourse.julialang.org/t/super-type-for-all-things-iterable/17765 "2018-11-20T19:04:08Z")

</div>

Is there such a type? Or is there a way that I can check whether something is iterable? Thanks

---

## [Log REPL text to file](https://discourse.julialang.org/t/log-repl-text-to-file/17761)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 3\
**Last updated:** [November 20, 2018, 4:08pm UTC](https://discourse.julialang.org/t/log-repl-text-to-file/17761 "2018-11-20T16:08:42Z")

</div>

Hi all, Is there a simple command to set up text logging of the REPL output? Something like MATLAB’s ‘diary’ function: Log Command Window text to file - MATLAB diary I always found this useful when running scripts bli…

---

## [Using all variables on a regression?](https://discourse.julialang.org/t/using-all-variables-on-a-regression/17766)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 0\
**Last updated:** [November 20, 2018, 12:46pm UTC](https://discourse.julialang.org/t/using-all-variables-on-a-regression/17766 "2018-11-20T12:46:18Z")

</div>

Is there any way to quickly say Julia I want to use all variables on a regression’s formula without explicitly writing them by hand? (Something like R’s “.” to select all columns for the model) It’s useful when you hav…

---

## [List of deprecated function and packages through versions?](https://discourse.julialang.org/t/list-of-deprecated-function-and-packages-through-versions/17764)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 0\
**Last updated:** [November 20, 2018, 12:20pm UTC](https://discourse.julialang.org/t/list-of-deprecated-function-and-packages-through-versions/17764 "2018-11-20T12:20:56Z")

</div>

Hello There is a large history.md file showing changes on base Julia. Is there a curated list or table of deprecated functions for the different Julia versions? It would also be great to have a list of superseded pack…

---

## [Saving and Loading Custom Types](https://discourse.julialang.org/t/saving-and-loading-custom-types/17763)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 1\
**Last updated:** [November 20, 2018, 10:49am UTC](https://discourse.julialang.org/t/saving-and-loading-custom-types/17763 "2018-11-20T10:49:49Z")

</div>

I’ve been having some difficulties storing custom data types, and would love to hear people’s suggestions and experiences. In the past I’ve always used JLD to convenient save / load custom types from disk. But recently …

---

## [It would be a good idea to add the "END" indice notation in "splice!()" and the like for consistency](https://discourse.julialang.org/t/it-would-be-a-good-idea-to-add-the-end-indice-notation-in-splice-and-the-like-for-consistency/17642)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 16\
**Last updated:** [November 20, 2018, 8:44am UTC](https://discourse.julialang.org/t/it-would-be-a-good-idea-to-add-the-end-indice-notation-in-splice-and-the-like-for-consistency/17642 "2018-11-20T08:44:14Z")

</div>

Actually if you need to remove the 2 last elements of a Vector, v=\[1,2,3,4\] splice!(v,length(v)-1:length(v)) is the way to go (for me at least^^) and I believe that splice!(v,end-1:end) # SADLY THIS DOES NOT WORK Loo…

---

## [Calling Julia from Java: Image Not Found](https://discourse.julialang.org/t/calling-julia-from-java-image-not-found/17265)

<div class="topic-metadata">

**Author:** [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Replies:** 5\
**Last updated:** [November 19, 2018, 9:13pm UTC](https://discourse.julialang.org/t/calling-julia-from-java-image-not-found/17265 "2018-11-19T21:13:46Z")

</div>

Hello, I asked this on StackOverflow, but this is a better place :slight\_smile: I am calling Julia from Java via JNI. I have successfully compiled and linked my Julia into a dylib using instructions here: julia ~/dev…

---

## [Permutation average of an array](https://discourse.julialang.org/t/permutation-average-of-an-array/17753)

<div class="topic-metadata">

**Author:** [@abulak](https://discourse.julialang.org/u/abulak)\
**Replies:** 0\
**Last updated:** [November 19, 2018, 8:34pm UTC](https://discourse.julialang.org/t/permutation-average-of-an-array/17753 "2018-11-19T20:34:20Z")

</div>

I have the following problem: I’m given a square matrix M in M\_{N,N} and a left/right group action on M\_{N,N} given by explicit permutations of the row/column spaces. I need to find a fixed point of this action, i.e. an …

---

## [Problems Installing Julia and MKL OSX](https://discourse.julialang.org/t/problems-installing-julia-and-mkl-osx/17102)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 6\
**Last updated:** [November 19, 2018, 7:25pm UTC](https://discourse.julialang.org/t/problems-installing-julia-and-mkl-osx/17102 "2018-11-19T19:25:21Z")

</div>

Hello guys, I tried to install julia with MKL but I got an error when compiling the code. I pretty much followed what is explained here: Do you have any hints on what to do? Here I list the steps I took: My steps …

---

## [Building Julia: Does the compiler matter?](https://discourse.julialang.org/t/building-julia-does-the-compiler-matter/6858)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 3\
**Last updated:** [November 19, 2018, 7:11pm UTC](https://discourse.julialang.org/t/building-julia-does-the-compiler-matter/6858 "2018-11-19T19:11:44Z")

</div>

I want to use Julia with MKL. As has been discussed, one currently has two options: use Julia Pro or build Julia from sources and setting flags. For many reasons I want to take the second approach. Regarding performance…

---

## [Source code from "Julia: Dynamism and Performance Reconciled by Design"?](https://discourse.julialang.org/t/source-code-from-julia-dynamism-and-performance-reconciled-by-design/17610)

<div class="topic-metadata">

**Author:** [@igouy](https://discourse.julialang.org/u/igouy)\
**Replies:** 4\
**Last updated:** [November 19, 2018, 7:01pm UTC](https://discourse.julialang.org/t/source-code-from-julia-dynamism-and-performance-reconciled-by-design/17610 "2018-11-19T19:01:57Z")

</div>

The paper \[pdf\] “Julia: Dynamism and Performance Reconciled by Design” shows relative performance (Fig 7) of some Julia implementations of benchmarks game programs — pidigits, regex, revcomp, … Are those Julia programs …

---

## [Allocation puzzler](https://discourse.julialang.org/t/allocation-puzzler/17720)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 6\
**Last updated:** [November 19, 2018, 6:45pm UTC](https://discourse.julialang.org/t/allocation-puzzler/17720 "2018-11-19T18:45:57Z")

</div>

I have a bit of a puzzle here. I simply loop through arrays and assign either at multiple of one array (with permutation of the rows and columns), or just assign a multiple of one array to the other. Both versions alloca…

---

## [Add rows to DataFrame (or similar table-like struct) in parallel?](https://discourse.julialang.org/t/add-rows-to-dataframe-or-similar-table-like-struct-in-parallel/17721)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 3\
**Last updated:** [November 19, 2018, 6:42pm UTC](https://discourse.julialang.org/t/add-rows-to-dataframe-or-similar-table-like-struct-in-parallel/17721 "2018-11-19T18:42:31Z")

</div>

I want to produce many rows of a DataFrame in parallel (using a @distributed for loop). I like DataFrames because then I can Query it which is very convenient. But any other similar table-like structure that can be quer…

---

## [Setting Up A Global Logger](https://discourse.julialang.org/t/setting-up-a-global-logger/17691)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 4\
**Last updated:** [November 19, 2018, 4:47pm UTC](https://discourse.julialang.org/t/setting-up-a-global-logger/17691 "2018-11-19T16:47:53Z")

</div>

I want to setup a global logger and write the logging messages into a file. Here is what I did for this purpose. module Example using Logging function setlogger() io = open("/tmp/log.txt", "w+") logger = Simpl…

---

## [Migrating code from Matlab: Accessing arrays without allocating](https://discourse.julialang.org/t/migrating-code-from-matlab-accessing-arrays-without-allocating/17433)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 20\
**Last updated:** [November 19, 2018, 3:37pm UTC](https://discourse.julialang.org/t/migrating-code-from-matlab-accessing-arrays-without-allocating/17433 "2018-11-19T15:37:25Z")

</div>

One of the performance critical parts of my Matlab code is this: function M = MFdiff(x1, x2) % Computes a flattened multidimensional x1' - x2 % x1 is (d x n1) % x2 is (d x n2) % M is (d x n1 \* n2) n1 = size(x1, 2); n2…

---

## [Line breaks in Markdown](https://discourse.julialang.org/t/line-breaks-in-markdown/17473)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 10\
**Last updated:** [November 19, 2018, 2:24pm UTC](https://discourse.julialang.org/t/line-breaks-in-markdown/17473 "2018-11-19T14:24:24Z")

</div>

I am trying to port some documentation from RST to Markdown and can’t figure how to make a line break without creating a new paragraph. As an example see this RST based doc and compare to the markdown version created wit…

---

## [Function loop that deals with vectors and single numbers. setindex! when i==1](https://discourse.julialang.org/t/function-loop-that-deals-with-vectors-and-single-numbers-setindex-when-i-1/17709)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 7\
**Last updated:** [November 19, 2018, 1:05pm UTC](https://discourse.julialang.org/t/function-loop-that-deals-with-vectors-and-single-numbers-setindex-when-i-1/17709 "2018-11-19T13:05:56Z")

</div>

Hi, Simple question I am sure someone can answer. Looked through the help and couldn’t see an obvious example. ##Define these two functions in the REPL: function TestFunc(X,Pa) #TestFunc = Moves a point by movement s…

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

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