# General Usage

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

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

**Page:** 1076

---

## [What's your strategy to version-control your IJulia notebook?](https://discourse.julialang.org/t/whats-your-strategy-to-version-control-your-ijulia-notebook/664)

<div class="topic-metadata">

**Author:** [@i2000s](https://discourse.julialang.org/u/i2000s)\
**Replies:** 7\
**Last updated:** [December 1, 2016, 7:11pm UTC](https://discourse.julialang.org/t/whats-your-strategy-to-version-control-your-ijulia-notebook/664 "2016-12-01T19:11:28Z")

</div>

After a quick Google search, I didn’t get any direct recommendation on versioning IJulia notebooks in Jupyter. But there are suggestions on Stackexchange for IPython notebooks. One of them (top one solution voted) is usi…

---

## [Eigenvalue problem of sparse matrix](https://discourse.julialang.org/t/eigenvalue-problem-of-sparse-matrix/577)

<div class="topic-metadata">

**Author:** [@111](https://discourse.julialang.org/u/111)\
**Replies:** 7\
**Last updated:** [December 1, 2016, 1:44pm UTC](https://discourse.julialang.org/t/eigenvalue-problem-of-sparse-matrix/577 "2016-12-01T13:44:02Z")

</div>

With Julia, I created a sparse matrix with the spzeros() function, initialized the matrix with some sentences, and tried to calculate the eigenvalue of it. However, the function works well only for small sparse matrix(n\<8…

---

## [Which methods must be implemented for a custom type to support broadcasting](https://discourse.julialang.org/t/which-methods-must-be-implemented-for-a-custom-type-to-support-broadcasting/657)

<div class="topic-metadata">

**Author:** [@kkmann](https://discourse.julialang.org/u/kkmann)\
**Replies:** 3\
**Last updated:** [December 1, 2016, 1:33pm UTC](https://discourse.julialang.org/t/which-methods-must-be-implemented-for-a-custom-type-to-support-broadcasting/657 "2016-12-01T13:33:17Z")

</div>

Hey, I wanted to leverage the new “.” notation for broadcasting for methods of a custom type, which methods does the type need in order to support automatic broadcasting? say type A val::Float64 end function f(a…

---

## [Juno and LightXML package function "name" conflict](https://discourse.julialang.org/t/juno-and-lightxml-package-function-name-conflict/651)

<div class="topic-metadata">

**Author:** [@YongHee-Kim](https://discourse.julialang.org/u/YongHee-Kim)\
**Replies:** 2\
**Last updated:** [December 1, 2016, 11:52am UTC](https://discourse.julialang.org/t/juno-and-lightxml-package-function-name-conflict/651 "2016-12-01T11:52:14Z")

</div>

I don’t know whether I should create this issue on LightXML.jl or Juno.jl Juno doesn’t explicitly export “name” but still it conflicts with LightXML

---

## [REPL-like printing from a script?](https://discourse.julialang.org/t/repl-like-printing-from-a-script/624)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 1\
**Last updated:** [November 30, 2016, 8:12pm UTC](https://discourse.julialang.org/t/repl-like-printing-from-a-script/624 "2016-11-30T20:12:40Z")

</div>

I often develop scripts in Atom or in the REPL before running them on a compute cluster. The cluster is configured with a node for submitting scripts and several compute nodes. I can’t log in directly to a compute node…

---

## [Is monkey patching possible in julia 0.5?](https://discourse.julialang.org/t/is-monkey-patching-possible-in-julia-0-5/600)

<div class="topic-metadata">

**Author:** [@pdobacz](https://discourse.julialang.org/u/pdobacz)\
**Replies:** 7\
**Last updated:** [November 30, 2016, 6:21am UTC](https://discourse.julialang.org/t/is-monkey-patching-possible-in-julia-0-5/600 "2016-11-30T06:21:59Z")

</div>

Is there any means to (temporarily) redefine a function, so that: f = function(x) 0.5 end # monkey patch Base.sin with f sin(12.0) # returns 0.5 # undo monkey patching I suppose it was once possible, done like here: F…

---

## [Failure in type inference when indexing Tuple with UnitRange (?)](https://discourse.julialang.org/t/failure-in-type-inference-when-indexing-tuple-with-unitrange/642)

<div class="topic-metadata">

**Author:** [@s-broda](https://discourse.julialang.org/u/s-broda)\
**Replies:** 2\
**Last updated:** [November 29, 2016, 11:53pm UTC](https://discourse.julialang.org/t/failure-in-type-inference-when-indexing-tuple-with-unitrange/642 "2016-11-29T23:53:34Z")

</div>

I believe this may be a bug, but thought I’d ask here first before filing an issue: julia\> foo{N,T}(bar::NTuple{N,T})=sum(bar\[1:N\]);@code\_warntype foo((1,)) Variables: #self#::#foo bar::Tuple{Int64} Body: begin …

---

## [Inspect buffer on open TCP socket](https://discourse.julialang.org/t/inspect-buffer-on-open-tcp-socket/569)

<div class="topic-metadata">

**Author:** [@Colin\_Beckingham](https://discourse.julialang.org/u/Colin_Beckingham)\
**Replies:** 6\
**Last updated:** [November 29, 2016, 6:25pm UTC](https://discourse.julialang.org/t/inspect-buffer-on-open-tcp-socket/569 "2016-11-29T18:25:33Z")

</div>

Interaction with a TCP socket is mostly straightforward, however occasionally I find that the buffer is not empty on first opening, so the function starts processing the buffer when it should just wait for the buffer to …

---

## [Iterator with previous and current elements](https://discourse.julialang.org/t/iterator-with-previous-and-current-elements/631)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [November 29, 2016, 5:42pm UTC](https://discourse.julialang.org/t/iterator-with-previous-and-current-elements/631 "2016-11-29T17:42:01Z")

</div>

I am wondering if it is possible to iterate over pairs of the previous and the current element in an iterable collection. Eg to implement function pairs\_sum(s) result = \[\] state = start(s) while !done(s, sta…

---

## [\`typ\` field in Expr objects](https://discourse.julialang.org/t/typ-field-in-expr-objects/626)

<div class="topic-metadata">

**Author:** [@ZacLN](https://discourse.julialang.org/u/ZacLN)\
**Replies:** 3\
**Last updated:** [November 29, 2016, 5:27pm UTC](https://discourse.julialang.org/t/typ-field-in-expr-objects/626 "2016-11-29T17:27:33Z")

</div>

What is the purpose/use of the typ field of an Expr. I’m using it with JuliaParser to store locations of expressions as they’re parsed (not for evaluation) but was wondering what the side effects of doing so is\>

---

## [DataFrames in Master (with NullableArrays) may use memory wastefully](https://discourse.julialang.org/t/dataframes-in-master-with-nullablearrays-may-use-memory-wastefully/509)

<div class="topic-metadata">

**Author:** [@mwsohn](https://discourse.julialang.org/u/mwsohn)\
**Replies:** 9\
**Last updated:** [November 29, 2016, 4:12pm UTC](https://discourse.julialang.org/t/dataframes-in-master-with-nullablearrays-may-use-memory-wastefully/509 "2016-11-29T16:12:32Z")

</div>

I converted Stata data to Julia by taking caution to convert data to equivalent data types as much as possible such as: Stata byte type to Int8 in Julia, int to Int16, long to Int32, etc. What I found out was that a dat…

---

## [Overloading base operator from module](https://discourse.julialang.org/t/overloading-base-operator-from-module/621)

<div class="topic-metadata">

**Author:** [@CorbinFoucart](https://discourse.julialang.org/u/CorbinFoucart)\
**Replies:** 7\
**Last updated:** [November 29, 2016, 2:38pm UTC](https://discourse.julialang.org/t/overloading-base-operator-from-module/621 "2016-11-29T14:38:43Z")

</div>

I would like to define a custom matrix-vector product for a type which I have declared in a module: module JulHDG export HollowSparseMatrix immutable HollowSparseMatrix bigA::SparseMatrixCSC{Float64, Int64} …

---

## [Juno/Atom having problems after update today](https://discourse.julialang.org/t/juno-atom-having-problems-after-update-today/554)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 8\
**Last updated:** [November 29, 2016, 2:33pm UTC](https://discourse.julialang.org/t/juno-atom-having-problems-after-update-today/554 "2016-11-29T14:33:21Z")

</div>

Hi all, I’ve just started getting the below error message when using Juno/Atom with Julia v0.5 on Ubuntu 16.04. Worked fine yesterday, I ran a Pkg.update() today and have been having this problem ever since. I’m guessin…

---

## [Can't import a package on remote workers](https://discourse.julialang.org/t/cant-import-a-package-on-remote-workers/595)

<div class="topic-metadata">

**Author:** [@wonjinChoi](https://discourse.julialang.org/u/wonjinChoi)\
**Replies:** 4\
**Last updated:** [November 29, 2016, 1:20am UTC](https://discourse.julialang.org/t/cant-import-a-package-on-remote-workers/595 "2016-11-29T01:20:17Z")

</div>

Hi, I’m trying to set up remote workers in my desktop, so I can use it from my laptop. I could connect to remote workers by addprocs(), but I couldn’t import a package. julia\> addprocs(\[("wonjin@xxx.xxx.xxx", 4)\], dir…

---

## [Pkg.update hangs on checked-out packages](https://discourse.julialang.org/t/pkg-update-hangs-on-checked-out-packages/531)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 1\
**Last updated:** [November 28, 2016, 6:52pm UTC](https://discourse.julialang.org/t/pkg-update-hangs-on-checked-out-packages/531 "2016-11-28T18:52:29Z")

</div>

On OS X v10.11.6, with julia-v0.5.0, Pkg.update() hangs for a while on the packages where I have checked out master. The repo is still a public GitHub repo in both cases where this happens. It hangs for several minutes o…

---

## [Reload a module from within a while loop](https://discourse.julialang.org/t/reload-a-module-from-within-a-while-loop/560)

<div class="topic-metadata">

**Author:** [@samuelpowell](https://discourse.julialang.org/u/samuelpowell)\
**Replies:** 6\
**Last updated:** [November 28, 2016, 9:21am UTC](https://discourse.julialang.org/t/reload-a-module-from-within-a-while-loop/560 "2016-11-28T09:21:06Z")

</div>

I wish to reload a module based upon some user input. The following works… while true import mod readline() reload("mod") mod.test() end but this fails to reload the module… import mod while true …

---

## [Does GLVisualize work with nightly Julia on Windows?](https://discourse.julialang.org/t/does-glvisualize-work-with-nightly-julia-on-windows/593)

<div class="topic-metadata">

**Author:** [@asampal](https://discourse.julialang.org/u/asampal)\
**Replies:** 1\
**Last updated:** [November 27, 2016, 10:28pm UTC](https://discourse.julialang.org/t/does-glvisualize-work-with-nightly-julia-on-windows/593 "2016-11-27T22:28:22Z")

</div>

I’m tried running Pkg.test(“GLVisualize”) and got the following errors: ERROR: LoadError: LoadError: UndefVarError: Repeated not defined in include\_from\_node1(::String) at .\\loading.jl:532 in include(::String) at .\\sy…

---

## [Julia for GUI app](https://discourse.julialang.org/t/julia-for-gui-app/416)

<div class="topic-metadata">

**Author:** [@gour](https://discourse.julialang.org/u/gour)\
**Replies:** 57\
**Last updated:** [November 26, 2016, 6:10pm UTC](https://discourse.julialang.org/t/julia-for-gui-app/416 "2016-11-26T18:10:29Z")

</div>

Hello, I see there are GTK bindings for Julia language for those desiring to write desktop GUI app. However I’m evaluating whether Julia can replace Python as suitable language for writing GUI apps which has things like…

---

## [Workflow for local packages](https://discourse.julialang.org/t/workflow-for-local-packages/562)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [November 26, 2016, 3:17pm UTC](https://discourse.julialang.org/t/workflow-for-local-packages/562 "2016-11-26T15:17:14Z")

</div>

I am wondering what the best workflow is for packages which are developed and used locally (before they are published). Currently, I create them with PkgDev.generate, they end up in ~/.julia/v0.5, and then I keep workin…

---

## [Extend a bunch of functions within (sub)modules – best practice](https://discourse.julialang.org/t/extend-a-bunch-of-functions-within-sub-modules-best-practice/570)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 3\
**Last updated:** [November 26, 2016, 6:43am UTC](https://discourse.julialang.org/t/extend-a-bunch-of-functions-within-sub-modules-best-practice/570 "2016-11-26T06:43:31Z")

</div>

Lets say I defined a new abstract datatype and have a few functions and algorithms to run. Here’s a sketch of my code module A import Base.norm, Base.length export norm, length, AType abstract AType function norm(a:ATyp…

---

## [Specifics of package development: tags and updates](https://discourse.julialang.org/t/specifics-of-package-development-tags-and-updates/568)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 0\
**Last updated:** [November 25, 2016, 9:15pm UTC](https://discourse.julialang.org/t/specifics-of-package-development-tags-and-updates/568 "2016-11-25T21:15:35Z")

</div>

I have one updated, retagged package submitted as a pull request. I have a second package that requires the updated version of the first one. Can I tag the second package and also mush it into my github fork of METATDAT…

---

## [Jupyter, change prompt colors](https://discourse.julialang.org/t/jupyter-change-prompt-colors/559)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 2\
**Last updated:** [November 25, 2016, 11:50pm UTC](https://discourse.julialang.org/t/jupyter-change-prompt-colors/559 "2016-11-25T23:50:14Z")

</div>

Is there a way to change the prompt color dynamically in Jupyter? This is to give a visual indication of an input mode. Another way to indicate this might also work, e.g. changing the prompt text. It appears that neith…

---

## [Purpose of lock in addprocs](https://discourse.julialang.org/t/purpose-of-lock-in-addprocs/564)

<div class="topic-metadata">

**Author:** [@pearcemc](https://discourse.julialang.org/u/pearcemc)\
**Replies:** 0\
**Last updated:** [November 25, 2016, 4:07pm UTC](https://discourse.julialang.org/t/purpose-of-lock-in-addprocs/564 "2016-11-25T16:07:05Z")

</div>

Hello I’d like to understand the purpose of the lock in addprocs. I ask because the slurm scheduler seems to disadvantage 1 request for n nodes vs n requests for 1 node. I am guessing the lock stops me from making mul…

---

## [Using generalized array indexes](https://discourse.julialang.org/t/using-generalized-array-indexes/556)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 0\
**Last updated:** [November 25, 2016, 11:10am UTC](https://discourse.julialang.org/t/using-generalized-array-indexes/556 "2016-11-25T11:10:43Z")

</div>

After reading through the PR below, and some blog posts about generalized indexing in AbstractArrays, I am wondering if the code below is the right way to iterate through the rows of a matrix: "Check if argument is a pr…

---

## [Kernel continuously restarted in Mac OS X + Jupyter + Julia 0.5](https://discourse.julialang.org/t/kernel-continuously-restarted-in-mac-os-x-jupyter-julia-0-5/526)

<div class="topic-metadata">

**Author:** [@vinhqdang](https://discourse.julialang.org/u/vinhqdang)\
**Replies:** 2\
**Last updated:** [November 25, 2016, 12:30am UTC](https://discourse.julialang.org/t/kernel-continuously-restarted-in-mac-os-x-jupyter-julia-0-5/526 "2016-11-25T00:30:01Z")

</div>

Hello everyone I am using Mac OS X 10.12.1 I downloaded Julia 0.5.dmg from the website, and put Julia-0.5.app into Applications folder. Then I started julia-0.5 app, and typed: Pkg.add(“Ijulia”) The build failed at …

---

## [How to construct parametric type with SharedArray or Array, depending on args to constructor?](https://discourse.julialang.org/t/how-to-construct-parametric-type-with-sharedarray-or-array-depending-on-args-to-constructor/517)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 6\
**Last updated:** [November 24, 2016, 4:09pm UTC](https://discourse.julialang.org/t/how-to-construct-parametric-type-with-sharedarray-or-array-depending-on-args-to-constructor/517 "2016-11-24T16:09:43Z")

</div>

I would like to construct a parametric type with SharedArrays whenever nprocs()\>1, and with standard Arrays when not. I’m trying to understand why this doesnt work: type V{T} array :: T function V{T}(arr::T) …

---

## [Pkg.update() in V0.5.0](https://discourse.julialang.org/t/pkg-update-in-v0-5-0/504)

<div class="topic-metadata">

**Author:** [@ehughes](https://discourse.julialang.org/u/ehughes)\
**Replies:** 3\
**Last updated:** [November 24, 2016, 3:06pm UTC](https://discourse.julialang.org/t/pkg-update-in-v0-5-0/504 "2016-11-24T15:06:19Z")

</div>

I installed V0.5.0 of Julia. When I run a Pkg.Update() I get: Note that I also have 0.4.6 install and do not get this error. I can add packages and update, etc. julia\> Pkg.update() INFO: Initializing package repos…

---

## [Metaprogramming: how to use variables from enclosing scope?](https://discourse.julialang.org/t/metaprogramming-how-to-use-variables-from-enclosing-scope/520)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 11\
**Last updated:** [November 24, 2016, 5:54am UTC](https://discourse.julialang.org/t/metaprogramming-how-to-use-variables-from-enclosing-scope/520 "2016-11-24T05:54:11Z")

</div>

I want to use @eval to generate code that does the same thing for different symbols. I keep going back to this example from Logging.jl, even though it’s not the best example. Here is my contrived use case: """ find all …

---

## [Isequal for composite types](https://discourse.julialang.org/t/isequal-for-composite-types/515)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [November 23, 2016, 1:00pm UTC](https://discourse.julialang.org/t/isequal-for-composite-types/515 "2016-11-23T13:00:15Z")

</div>

Is there a library that helps define isequal recursively for composite types? The code is trivial, but I find I keep using it in many places, so it would be nice to either use an existing library, of if there is none, wr…

---

## [Measuring R squared of a linear regression with GLM and Dataframes](https://discourse.julialang.org/t/measuring-r-squared-of-a-linear-regression-with-glm-and-dataframes/511)

<div class="topic-metadata">

**Author:** [@sevimora](https://discourse.julialang.org/u/sevimora)\
**Replies:** 3\
**Last updated:** [November 23, 2016, 10:51am UTC](https://discourse.julialang.org/t/measuring-r-squared-of-a-linear-regression-with-glm-and-dataframes/511 "2016-11-23T10:51:29Z")

</div>

Hi I am new to Julia. I do not see how to get the R^2 of a linear regression using DataFrames and GLM. I can get the sum of squares of the errors (so I am almost there), but not the R^2. Is there a way of getting form …

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

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