# General Usage

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

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

**Page:** 1073

---

## [Questions for a new string type and on GC/alignment/padding](https://discourse.julialang.org/t/questions-for-a-new-string-type-and-on-gc-alignment-padding/1077)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 6\
**Last updated:** [December 21, 2016, 4:11pm UTC](https://discourse.julialang.org/t/questions-for-a-new-string-type-and-on-gc-alignment-padding/1077 "2016-12-21T16:11:26Z")

</div>

I’m trying to make a: immutable New\_String\_Type \<: AbstractString first::UInt64 last::Union{String, UInt64} end This works, but really I want this to take 128 bits. Is that what happens and/or can I d…

---

## [Code coverage issue with methods that return a constant bool](https://discourse.julialang.org/t/code-coverage-issue-with-methods-that-return-a-constant-bool/1088)

<div class="topic-metadata">

**Author:** [@Evizero](https://discourse.julialang.org/u/Evizero)\
**Replies:** 1\
**Last updated:** [December 21, 2016, 1:34pm UTC](https://discourse.julialang.org/t/code-coverage-issue-with-methods-that-return-a-constant-bool/1088 "2016-12-21T13:34:46Z")

</div>

I am observing a (to me) strange issue concerning code coverage. The result of Pkg.test(...; coverage=true) tells me that a lot of methods are never called while I know they were. The methods in question all have a ver…

---

## [Slow instantiation of immutable type with string field](https://discourse.julialang.org/t/slow-instantiation-of-immutable-type-with-string-field/1054)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 3\
**Last updated:** [December 21, 2016, 8:49am UTC](https://discourse.julialang.org/t/slow-instantiation-of-immutable-type-with-string-field/1054 "2016-12-21T08:49:47Z")

</div>

I find that an immutable type is usually faster to instantiate than a mutable type with the same field. For example, julia\> type MutableWithTuple t::NTuple{5,Int64} end julia\> immutable ImmutableWith…

---

## [Overloading show(io, expr::Expr)](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082)

<div class="topic-metadata">

**Author:** [@nsmith](https://discourse.julialang.org/u/nsmith)\
**Replies:** 2\
**Last updated:** [December 21, 2016, 3:15am UTC](https://discourse.julialang.org/t/overloading-show-io-expr-expr/1082 "2016-12-21T03:15:45Z")

</div>

Bit of a strange question here but would anyone know which show method controls how :(2\*x) for example gets displayed as :(2x) in the repl. eg: julia\> :(2 \* x) :(2x) There is a handful of show methods in show.jl that l…

---

## [Ccall with pointer argument to array of custom type via an NTuple of immutables](https://discourse.julialang.org/t/ccall-with-pointer-argument-to-array-of-custom-type-via-an-ntuple-of-immutables/1048)

<div class="topic-metadata">

**Author:** [@m-j-w](https://discourse.julialang.org/u/m-j-w)\
**Replies:** 5\
**Last updated:** [December 20, 2016, 5:59pm UTC](https://discourse.julialang.org/t/ccall-with-pointer-argument-to-array-of-custom-type-via-an-ntuple-of-immutables/1048 "2016-12-20T17:59:23Z")

</div>

tl;dr: How to best create a pointer to an array of user-defined type of possibly mutating data when calling into a legacy C API. I’m trying to Ccall a function of a legacy application in which I’ve embedded Julia to rep…

---

## [Way to have a function "mutate an immutable" without much performance loss](https://discourse.julialang.org/t/way-to-have-a-function-mutate-an-immutable-without-much-performance-loss/1050)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 4\
**Last updated:** [December 20, 2016, 4:04am UTC](https://discourse.julialang.org/t/way-to-have-a-function-mutate-an-immutable-without-much-performance-loss/1050 "2016-12-20T04:04:09Z")

</div>

As the title says, is there a way to pass an immutable into a function, have it allowed to be mutated, but make it have low overhead? It seems like wrapping it in some reference makes it about \>2x slower: using Benchmar…

---

## [Error calling remotecall\_fetch from module](https://discourse.julialang.org/t/error-calling-remotecall-fetch-from-module/1029)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 4\
**Last updated:** [December 20, 2016, 3:05am UTC](https://discourse.julialang.org/t/error-calling-remotecall-fetch-from-module/1029 "2016-12-20T03:05:57Z")

</div>

I had similar code working on v0.4, but now fails on v0.5 module TestModule export test1, test2, test3 test1(id) = remotecall\_fetch(myid, id) test2(id) = remotecall\_fetch(()-\>VERSION, id) test3(id) = rem…

---

## [Using DifferentialEquations.jl for very large system](https://discourse.julialang.org/t/using-differentialequations-jl-for-very-large-system/1030)

<div class="topic-metadata">

**Author:** [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Replies:** 7\
**Last updated:** [December 19, 2016, 10:36pm UTC](https://discourse.julialang.org/t/using-differentialequations-jl-for-very-large-system/1030 "2016-12-19T22:36:47Z")

</div>

Firstly, let me say that I think DifferentialEquations.jl is great, and I am very excited to try and use it. I solve very large systems of ODEs (2^18 equations). I have usually used (in C++ and more recently in Julia) m…

---

## [LaTex in Plots](https://discourse.julialang.org/t/latex-in-plots/1045)

<div class="topic-metadata">

**Author:** [@abuAnat](https://discourse.julialang.org/u/abuAnat)\
**Replies:** 1\
**Last updated:** [December 19, 2016, 6:26pm UTC](https://discourse.julialang.org/t/latex-in-plots/1045 "2016-12-19T18:26:06Z")

</div>

In PyPlot, we can do something like title(L"Plot of $\\Gamma\_3(x)$") . How can we do that in Plots

---

## [Skip a FOR loop in Gallium](https://discourse.julialang.org/t/skip-a-for-loop-in-gallium/1039)

<div class="topic-metadata">

**Author:** [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Replies:** 1\
**Last updated:** [December 19, 2016, 1:42pm UTC](https://discourse.julialang.org/t/skip-a-for-loop-in-gallium/1039 "2016-12-19T13:42:11Z")

</div>

How can I do that? Sometimes you have a for loop block right before the piece of code you want to debug… Thanks

---

## [Diagonal 3D array](https://discourse.julialang.org/t/diagonal-3d-array/1038)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 0\
**Last updated:** [December 19, 2016, 10:59am UTC](https://discourse.julialang.org/t/diagonal-3d-array/1038 "2016-12-19T10:59:43Z")

</div>

I’m working on an expression language for handling (sometimes) sparse diagonal arrays. In index notation, these expressions look something like: X\[i,j\], where i == j X\[i,j,k\], where i == k X\[i,j,k\], where j == k etc. T…

---

## [Julia osx 0.5 not starting](https://discourse.julialang.org/t/julia-osx-0-5-not-starting/1000)

<div class="topic-metadata">

**Author:** [@Jason\_McConochie](https://discourse.julialang.org/u/Jason_McConochie)\
**Replies:** 8\
**Last updated:** [December 19, 2016, 11:41am UTC](https://discourse.julialang.org/t/julia-osx-0-5-not-starting/1000 "2016-12-19T11:41:03Z")

</div>

Just downloaded Julia DMG v0.5 for osx and it is not starting. I get two terminal windows opening but there is only a unix prompt, no julia REPL. I notice the Julia menu appears briefly and then disappears. Have tried…

---

## [Installing MP3 on JuliaBox](https://discourse.julialang.org/t/installing-mp3-on-juliabox/839)

<div class="topic-metadata">

**Author:** [@LewisHein](https://discourse.julialang.org/u/LewisHein)\
**Replies:** 2\
**Last updated:** [December 15, 2016, 3:01pm UTC](https://discourse.julialang.org/t/installing-mp3-on-juliabox/839 "2016-12-15T15:01:49Z")

</div>

Hello everyone Is there a way to install the MP3 package on JuliaBox? It fails for me because I don’t have root priveleges. Many thanks, Lewis Hein

---

## [Module Function Naming and Module Publication](https://discourse.julialang.org/t/module-function-naming-and-module-publication/993)

<div class="topic-metadata">

**Author:** [@Jeremy](https://discourse.julialang.org/u/Jeremy)\
**Replies:** 5\
**Last updated:** [December 19, 2016, 9:30am UTC](https://discourse.julialang.org/t/module-function-naming-and-module-publication/993 "2016-12-19T09:30:47Z")

</div>

Does anybody here work in the soil, atmospheric, or climate sciences? I’ve put together a module of functions I’ve created for loading various file types in aforementioned sciences. It’s still pre-1.0 and I’ve run into s…

---

## [Parallel FFT not that much faster](https://discourse.julialang.org/t/parallel-fft-not-that-much-faster/671)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 10\
**Last updated:** [December 19, 2016, 7:32am UTC](https://discourse.julialang.org/t/parallel-fft-not-that-much-faster/671 "2016-12-19T07:32:55Z")

</div>

I’m trying to do parallel FFT on an 8 core (4 CPUs, 2 hyperthreads / CPU) machine, and I’m basically seeing a little less than 2x speedup going from 1 core to 2, and then none whatsoever between 2 and 8. Is this expected…

---

## [Precompiled Package without Source Code](https://discourse.julialang.org/t/precompiled-package-without-source-code/1023)

<div class="topic-metadata">

**Author:** [@tknopp](https://discourse.julialang.org/u/tknopp)\
**Replies:** 2\
**Last updated:** [December 18, 2016, 1:52pm UTC](https://discourse.julialang.org/t/precompiled-package-without-source-code/1023 "2016-12-18T13:52:39Z")

</div>

Hi, I was wondering if a precompiled package still needs the source code or if the source code could be removed. Thanks Tobias

---

## [Meta-programming guide](https://discourse.julialang.org/t/meta-programming-guide/893)

<div class="topic-metadata">

**Author:** [@pitao](https://discourse.julialang.org/u/pitao)\
**Replies:** 2\
**Last updated:** [December 18, 2016, 12:46pm UTC](https://discourse.julialang.org/t/meta-programming-guide/893 "2016-12-18T12:46:56Z")

</div>

I’ve written up the notes I took while learning basic concepts: https://github.com/p-i-/MetaGuideJulia/wiki It is far from complete, and maybe needs to be split up into several pages. Please feel very welcome to do so…

---

## [Get element of a SortedDict by index instead of getting by key](https://discourse.julialang.org/t/get-element-of-a-sorteddict-by-index-instead-of-getting-by-key/971)

<div class="topic-metadata">

**Author:** [@FemtoTrader](https://discourse.julialang.org/u/FemtoTrader)\
**Replies:** 7\
**Last updated:** [December 18, 2016, 1:26am UTC](https://discourse.julialang.org/t/get-element-of-a-sorteddict-by-index-instead-of-getting-by-key/971 "2016-12-18T01:26:40Z")

</div>

Hello, I have a SortedDict like julia\> using DataStructures: SortedDict julia\> v = SortedDict(Dict{Float64,Float64}(), Base.Forward) julia\> v\[1.32\]=10 julia\> v\[1.33\]=20 julia\> v DataStructures.SortedDict{Float64,Float6…

---

## [PyCall: Modifying an array in Python](https://discourse.julialang.org/t/pycall-modifying-an-array-in-python/1003)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 4\
**Last updated:** [December 17, 2016, 2:08pm UTC](https://discourse.julialang.org/t/pycall-modifying-an-array-in-python/1003 "2016-12-17T14:08:40Z")

</div>

I ran into a problem that is reproduced with the following elementary snippet: app = pyeval("lambda x: x.append(1)") x = \[\] app(x) @show x # x = Any\[\] Why is x not modified? I am guessing that append creates a new bl…

---

## [1:n, (1:n)', and (1:n)''](https://discourse.julialang.org/t/1-n-1-n-and-1-n/1006)

<div class="topic-metadata">

**Author:** [@BVPs](https://discourse.julialang.org/u/BVPs)\
**Replies:** 6\
**Last updated:** [December 16, 2016, 11:40pm UTC](https://discourse.julialang.org/t/1-n-1-n-and-1-n/1006 "2016-12-16T23:40:19Z")

</div>

Hello. I am curious about the following behavior of the transposition operator associated with the UnitRange data type. Let n be a natural number. Now, the type of 1:n is UnitRange{Int64}. But why does (1:n)' become a …

---

## [Function with array of matrices as input in Julia 0.5](https://discourse.julialang.org/t/function-with-array-of-matrices-as-input-in-julia-0-5/1004)

<div class="topic-metadata">

**Author:** [@lanaperisa](https://discourse.julialang.org/u/lanaperisa)\
**Replies:** 2\
**Last updated:** [December 16, 2016, 9:56pm UTC](https://discourse.julialang.org/t/function-with-array-of-matrices-as-input-in-julia-0-5/1004 "2016-12-16T21:56:11Z")

</div>

Been struggling with something for a while. I use a lot of arrays of matrices so I wanted to create a typealias for it like this: typealias MatrixCell{T\<:Number} Array{Matrix{T},1} This way I can easily create an array…

---

## [Questions on parallelism, blocking, and a simple web server](https://discourse.julialang.org/t/questions-on-parallelism-blocking-and-a-simple-web-server/977)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 1\
**Last updated:** [December 16, 2016, 4:21pm UTC](https://discourse.julialang.org/t/questions-on-parallelism-blocking-and-a-simple-web-server/977 "2016-12-16T16:21:20Z")

</div>

I’m working on a simple “web” server (to be run only locally) which allows other programs running locally to request solutions to optimization problems. Firstly, and most importantly, solving these optimization problems…

---

## [Trouble with isless for an immutable type](https://discourse.julialang.org/t/trouble-with-isless-for-an-immutable-type/994)

<div class="topic-metadata">

**Author:** [@craigschmidt](https://discourse.julialang.org/u/craigschmidt)\
**Replies:** 4\
**Last updated:** [December 16, 2016, 3:49pm UTC](https://discourse.julialang.org/t/trouble-with-isless-for-an-immutable-type/994 "2016-12-16T15:49:46Z")

</div>

I feel like I’m missing something obvious, but why doesn’t this work: julia\> immutable Counts j::Int32 i::Int32 nij::Int64 end julia\> # allocate something test = Array{Counts…

---

## [How to properly add releases with PkgDev?](https://discourse.julialang.org/t/how-to-properly-add-releases-with-pkgdev/961)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 15\
**Last updated:** [December 16, 2016, 12:11pm UTC](https://discourse.julialang.org/t/how-to-properly-add-releases-with-pkgdev/961 "2016-12-16T12:11:09Z")

</div>

I am probably doing something wrong, but I didn’t find it documented anywhere. Currently, whenever I need to tag a new release for a package of mine, I do PkgDev("Foo"), go to the package directory of (i.e. ~/.julia/v0.…

---

## [Deprecating usage of keywords](https://discourse.julialang.org/t/deprecating-usage-of-keywords/978)

<div class="topic-metadata">

**Author:** [@pkofod](https://discourse.julialang.org/u/pkofod)\
**Replies:** 2\
**Last updated:** [December 16, 2016, 9:13am UTC](https://discourse.julialang.org/t/deprecating-usage-of-keywords/978 "2016-12-16T09:13:31Z")

</div>

In Optim (https://github.com/JuliaOpt/Optim.jl/pull/304) I am currently deprecating our old keyword based options system in favor of the Optim.Options (earlier OptimizationOptions) approach. Say I used to have the follo…

---

## [Ccall, NULL pointers to arrays and sizeof](https://discourse.julialang.org/t/ccall-null-pointers-to-arrays-and-sizeof/984)

<div class="topic-metadata">

**Author:** [@jtravs](https://discourse.julialang.org/u/jtravs)\
**Replies:** 3\
**Last updated:** [December 16, 2016, 4:53am UTC](https://discourse.julialang.org/t/ccall-null-pointers-to-arrays-and-sizeof/984 "2016-12-16T04:53:13Z")

</div>

I am trying to wrap the Vimba C API (for grabbing data from machine vision cameras). I’m struggling with one aspect (it may be that it is my lack of C knowledge). The function I’m currently wrapping is declared roughly …

---

## [How to parallelize this (simple) function (?)](https://discourse.julialang.org/t/how-to-parallelize-this-simple-function/922)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 7\
**Last updated:** [December 15, 2016, 6:00pm UTC](https://discourse.julialang.org/t/how-to-parallelize-this-simple-function/922 "2016-12-15T18:00:12Z")

</div>

Hello, I’m (still) beginning with Julia. I wrote a simple (and probably quite naive) function which calculate the annual numbers of frostdays (sum of days with temperature lower than 0 Celsius). Since this calculation i…

---

## [Suggestion for a python-like tutorial (concise but not a cookbook recipe)?](https://discourse.julialang.org/t/suggestion-for-a-python-like-tutorial-concise-but-not-a-cookbook-recipe/543)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [December 15, 2016, 9:54am UTC](https://discourse.julialang.org/t/suggestion-for-a-python-like-tutorial-concise-but-not-a-cookbook-recipe/543 "2016-12-15T09:54:08Z")

</div>

Could you also suggest me a good theoretical/practical tutorial for Julia? I have started reading the Julia manual at http://docs.julialang.org/en/release-0.5/ but it’s a 355 pages document, and going a bit too technica…

---

## [How to copy all fields without changing the referece?](https://discourse.julialang.org/t/how-to-copy-all-fields-without-changing-the-referece/945)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 8\
**Last updated:** [December 15, 2016, 1:54am UTC](https://discourse.julialang.org/t/how-to-copy-all-fields-without-changing-the-referece/945 "2016-12-15T01:54:59Z")

</div>

Hi guys! I have a type with many fields and I need to define the function copy!(A,B). My question is: is there any way to copy all the fields automatically? Something like deepcopy but without changing the reference? A…

---

## [Emulate local static variable?](https://discourse.julialang.org/t/emulate-local-static-variable/956)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 5\
**Last updated:** [December 15, 2016, 12:35am UTC](https://discourse.julialang.org/t/emulate-local-static-variable/956 "2016-12-15T00:35:20Z")

</div>

Julia has no static keyboard. In C, a static variable inside a function has a value that persists over function calls. One way to emulate this in Julia is with a global variable. This has two limitations: first, this po…

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

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