# General Usage

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

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

**Page:** 1047

---

## [Ipopt loading Error:ReadOnlyMemory()](https://discourse.julialang.org/t/ipopt-loading-error-readonlymemory/4035)

<div class="topic-metadata">

**Author:** [@gopal2017](https://discourse.julialang.org/u/gopal2017)\
**Replies:** 0\
**Last updated:** [June 1, 2017, 3:01pm UTC](https://discourse.julialang.org/t/ipopt-loading-error-readonlymemory/4035 "2017-06-01T15:01:08Z")

</div>

I have installed Ipopt through my local Account. I don’t have Admin privilege. If I use Pkg.test(“Ipopt”) at Julia Command Prompt I got loading Error:readOnlyMemory(). If I compile my code from Atom I got the same error.…

---

## [Is there a way to guarantee 0 allocations when accessing an array?](https://discourse.julialang.org/t/is-there-a-way-to-guarantee-0-allocations-when-accessing-an-array/3781)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 18\
**Last updated:** [June 1, 2017, 12:45pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-guarantee-0-allocations-when-accessing-an-array/3781 "2017-06-01T12:45:48Z")

</div>

I have a whole bunch of functions which take as their arguments slices of an array. I’d like to execute these functions with 0 allocations (if that’s even possible). Note the following: f(x::AbstractArray) = x\[1\] + x\[…

---

## [How do you get all variables with a value in module's workspace?](https://discourse.julialang.org/t/how-do-you-get-all-variables-with-a-value-in-modules-workspace/4022)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 6\
**Last updated:** [June 1, 2017, 5:25am UTC](https://discourse.julialang.org/t/how-do-you-get-all-variables-with-a-value-in-modules-workspace/4022 "2017-06-01T05:25:20Z")

</div>

for example, I have the module: module Foo bar() = println("moo") baz() = 404 a = 2 b = 3.4e2 c = a + b / baz() end how do i get a dictionary that looks like: { a: 2 b: 3.4e2 c: 2.8415841584 } // …

---

## [The parallelism is slower than sequential computing?](https://discourse.julialang.org/t/the-parallelism-is-slower-than-sequential-computing/4014)

<div class="topic-metadata">

**Author:** [@nagnapk](https://discourse.julialang.org/u/nagnapk)\
**Replies:** 6\
**Last updated:** [June 1, 2017, 3:00am UTC](https://discourse.julialang.org/t/the-parallelism-is-slower-than-sequential-computing/4014 "2017-06-01T03:00:48Z")

</div>

Hello, I am newbie to Julia and I was testing Julia for the computational complexity of small program, as listed on https://julialang.org/. I run the same program in sequential loop and surprisingly, at least to me, t…

---

## [Troubleshooting LAPACKException](https://discourse.julialang.org/t/troubleshooting-lapackexception/3999)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 4\
**Last updated:** [June 1, 2017, 3:48am UTC](https://discourse.julialang.org/t/troubleshooting-lapackexception/3999 "2017-06-01T03:48:58Z")

</div>

I am getting a weird error that occurs unpredictably: LoadError: Base.LinAlg.LAPACKException(1) while loading D:\\Jeremy\\Dropbox\\Documents\\School\\Waterloo\\Research\\Programming\\Julia\\Schrodinger\\examples\\punchout.jl, in e…

---

## [Abstract function with imposed arguments and return types](https://discourse.julialang.org/t/abstract-function-with-imposed-arguments-and-return-types/4007)

<div class="topic-metadata">

**Author:** [@Azzaare](https://discourse.julialang.org/u/Azzaare)\
**Replies:** 5\
**Last updated:** [June 1, 2017, 3:23am UTC](https://discourse.julialang.org/t/abstract-function-with-imposed-arguments-and-return-types/4007 "2017-06-01T03:23:10Z")

</div>

I would like to define a struct where one of the field is a function. But I would also like to control the arguments and return type of that fonction. For the sake of the example, let say that function would match this s…

---

## [Best way to dispatch on type field](https://discourse.julialang.org/t/best-way-to-dispatch-on-type-field/4024)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 1\
**Last updated:** [May 31, 2017, 10:43pm UTC](https://discourse.julialang.org/t/best-way-to-dispatch-on-type-field/4024 "2017-05-31T22:43:02Z")

</div>

I have a struct like this abstract Material mutable struct Element mat::Material data::Data ... end and an overloaded method update! that updates the struct based on concrete types of Material. Functions lik…

---

## [Recommended way to suppress "method overwritten" warnings](https://discourse.julialang.org/t/recommended-way-to-suppress-method-overwritten-warnings/3996)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 14\
**Last updated:** [May 31, 2017, 9:56pm UTC](https://discourse.julialang.org/t/recommended-way-to-suppress-method-overwritten-warnings/3996 "2017-05-31T21:56:39Z")

</div>

Hello, Some time ago Julia introduced warnings for re-defining methods. This kind of created havoc in my work because what I do all day is Edit Julia file. include(“myfile.jl”) GOTO 1. So every time I edit my file I’…

---

## [Symbol Block vs Quote Node in Metaprogramming](https://discourse.julialang.org/t/symbol-block-vs-quote-node-in-metaprogramming/3984)

<div class="topic-metadata">

**Author:** [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Replies:** 2\
**Last updated:** [May 31, 2017, 7:46pm UTC](https://discourse.julialang.org/t/symbol-block-vs-quote-node-in-metaprogramming/3984 "2017-05-31T19:46:37Z")

</div>

Could someone please explain the difference between a symbol block and quote node in an expression? Thank you.

---

## [Global variable disappears](https://discourse.julialang.org/t/global-variable-disappears/4021)

<div class="topic-metadata">

**Author:** [@ulysses](https://discourse.julialang.org/u/ulysses)\
**Replies:** 2\
**Last updated:** [May 31, 2017, 7:09pm UTC](https://discourse.julialang.org/t/global-variable-disappears/4021 "2017-05-31T19:09:02Z")

</div>

I have the following scenario for initialization of a global variable which fails for some mysterious reason. // t.jl n = 1 function f() if n == 1 n = 2 end println(n) end ... julia\> include("t.jl") …

---

## [Base.call() in Julia 0.6](https://discourse.julialang.org/t/base-call-in-julia-0-6/3983)

<div class="topic-metadata">

**Author:** [@charlesll](https://discourse.julialang.org/u/charlesll)\
**Replies:** 7\
**Last updated:** [May 31, 2017, 8:28am UTC](https://discourse.julialang.org/t/base-call-in-julia-0-6/3983 "2017-05-31T08:28:12Z")

</div>

Hi All, I can’t find information about the usage of base.call in Julia 0.6, but it breaks some code I have and that works well in Julia 0.5… The function I am trying to run is immutable SavitzkyGolayFilter{M,N} end @…

---

## [\`.\*\` falls back to \`Base.broadcast\` only for identical arguments](https://discourse.julialang.org/t/falls-back-to-base-broadcast-only-for-identical-arguments/3991)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 3\
**Last updated:** [May 30, 2017, 6:56pm UTC](https://discourse.julialang.org/t/falls-back-to-base-broadcast-only-for-identical-arguments/3991 "2017-05-30T18:56:46Z")

</div>

Here’s a weird one: struct Testype x::Int64 end import Base.broadcast Base.broadcast(::typeof(\*), t1::Testype, t2::Testype) = (t1.x \* t2.x) t1 = Testype(2) t2 = Testype(3) Now, if you do t1 .\* t2 everything is f…

---

## [Set UDPSocket reciever buffer size?](https://discourse.julialang.org/t/set-udpsocket-reciever-buffer-size/3939)

<div class="topic-metadata">

**Author:** [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Replies:** 4\
**Last updated:** [May 30, 2017, 4:57pm UTC](https://discourse.julialang.org/t/set-udpsocket-reciever-buffer-size/3939 "2017-05-30T16:57:45Z")

</div>

I would like to increase the recieve buffer size of a UDP socket, but I don’t see how to do it. In C++ I would do setsockopt(sd, SOL\_SOCKET, SO\_RCVBUF, &sockbufsize, (socklen\_t)sizeof(sockbufsize)); But the closest fu…

---

## [Type stability](https://discourse.julialang.org/t/type-stability/3988)

<div class="topic-metadata">

**Author:** [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Replies:** 4\
**Last updated:** [May 30, 2017, 4:57pm UTC](https://discourse.julialang.org/t/type-stability/3988 "2017-05-30T16:57:23Z")

</div>

I don’t understand the following is not typestable, changing the \_p assignment to a mapreduce call doesn’t help, subsetting h or a for loop helps: function conf\_int\_sum{T}(p::T, h::Array{T}, eps::T) b1 = zero(T) …

---

## [JuMPChance and CPLEX 12.7](https://discourse.julialang.org/t/jumpchance-and-cplex-12-7/3992)

<div class="topic-metadata">

**Author:** [@UserMorocco](https://discourse.julialang.org/u/UserMorocco)\
**Replies:** 0\
**Last updated:** [May 30, 2017, 3:30pm UTC](https://discourse.julialang.org/t/jumpchance-and-cplex-12-7/3992 "2017-05-30T15:30:11Z")

</div>

Hello, I have a two stage and chance constraint model. Can I use Cplex solver 12.7 and JuMPChance modeling framework to solve my problem ? Thank you, Zineb

---

## [How to prevent BLAS from thrashing with Julia?](https://discourse.julialang.org/t/how-to-prevent-blas-from-thrashing-with-julia/3944)

<div class="topic-metadata">

**Author:** [@oatlzzvztd](https://discourse.julialang.org/u/oatlzzvztd)\
**Replies:** 5\
**Last updated:** [May 30, 2017, 10:17am UTC](https://discourse.julialang.org/t/how-to-prevent-blas-from-thrashing-with-julia/3944 "2017-05-30T10:17:24Z")

</div>

Hello. Let’s say I’m trying to run the following function many times on multiple cores: @everywhere function test() X = randn(800, 800) Y = randn(800, 800) Base.LinAlg.BLAS.axpy!(2.0, X, Y) end (The real functio…

---

## [Guide for good programming style in Julia](https://discourse.julialang.org/t/guide-for-good-programming-style-in-julia/3980)

<div class="topic-metadata">

**Author:** [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Replies:** 4\
**Last updated:** [May 30, 2017, 7:24am UTC](https://discourse.julialang.org/t/guide-for-good-programming-style-in-julia/3980 "2017-05-30T07:24:17Z")

</div>

I am looking for a guide that focuses on programming style in Julia. I understand how to write functions, use types, the syntax etc., but I look for a guide that focuses on questions like: When I start a project with ma…

---

## [Julia 0.6 Output Issue?](https://discourse.julialang.org/t/julia-0-6-output-issue/3981)

<div class="topic-metadata">

**Author:** [@clinton](https://discourse.julialang.org/u/clinton)\
**Replies:** 1\
**Last updated:** [May 29, 2017, 11:45pm UTC](https://discourse.julialang.org/t/julia-0-6-output-issue/3981 "2017-05-29T23:45:12Z")

</div>

Hi- I just installed 0.6 RC2, moving from the latest 5.2. I’m not sure if this is an issue and if so where it should be posted, but my console output has now slowed to a crawl with random line breaks inserted. For exampl…

---

## [Bug with divrem?](https://discourse.julialang.org/t/bug-with-divrem/3976)

<div class="topic-metadata">

**Author:** [@alexhallam](https://discourse.julialang.org/u/alexhallam)\
**Replies:** 7\
**Last updated:** [May 29, 2017, 4:50pm UTC](https://discourse.julialang.org/t/bug-with-divrem/3976 "2017-05-29T16:50:28Z")

</div>

I am using divrem(A, B) and getting the following warning WARNING: div(A::AbstractArray, B::Number) is deprecated, use div.(A, B) instead. It looks like I am being told to use div. instead of div, but I am not using d…

---

## [Dot position to broadcast: f. vs .+](https://discourse.julialang.org/t/dot-position-to-broadcast-f-vs/3978)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 5\
**Last updated:** [May 29, 2017, 3:54pm UTC](https://discourse.julialang.org/t/dot-position-to-broadcast-f-vs/3978 "2017-05-29T15:54:42Z")

</div>

I like the new . syntax to broadcast but I have a question about the position of the dot . Why is the syntax to add elementwise.+ while the syntax to apply a function elementwise is f. ? Is not it inconsistent?

---

## [Nth root of a complex number should return N results](https://discourse.julialang.org/t/nth-root-of-a-complex-number-should-return-n-results/3961)

<div class="topic-metadata">

**Author:** [@Kaiyin\_Zhong](https://discourse.julialang.org/u/Kaiyin_Zhong)\
**Replies:** 3\
**Last updated:** [May 29, 2017, 9:41am UTC](https://discourse.julialang.org/t/nth-root-of-a-complex-number-should-return-n-results/3961 "2017-05-29T09:41:24Z")

</div>

As shown below: x = 27 \* e^π e^2im e^(2+2pi)im n = 3 Θ = pi/3 Q = 27 x = Q⋅e^(Θ⋅im) ϕ₁ = Θ/n + 2π⋅1/n ϕ₂ = Θ/n + 2π⋅2/n ϕ₃ = Θ/n + 2π⋅3/n R = Q^(1/n) y₁ = R⋅e^(ϕ₁⋅im) y₂ = R⋅e^(ϕ₂⋅im) y₃ = R⋅e^(ϕ₃⋅im) println(x) println…

---

## [Return type annotation with "where"](https://discourse.julialang.org/t/return-type-annotation-with-where/3951)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [May 28, 2017, 12:13pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951 "2017-05-28T12:13:54Z")

</div>

Not sure if I’m doing this wrong or perhaps this hasn’t been resolved yet: I can annotate the return type or I can have “where” in the function definition but I don’t know how to have both. struct TypeA end something(…

---

## [Avoiding conversion of (an invalid) string returned from PyCall when passing back to Python](https://discourse.julialang.org/t/avoiding-conversion-of-an-invalid-string-returned-from-pycall-when-passing-back-to-python/974)

<div class="topic-metadata">

**Author:** [@samuelpowell](https://discourse.julialang.org/u/samuelpowell)\
**Replies:** 3\
**Last updated:** [May 28, 2017, 10:13am UTC](https://discourse.julialang.org/t/avoiding-conversion-of-an-invalid-string-returned-from-pycall-when-passing-back-to-python/974 "2017-05-28T10:13:49Z")

</div>

In Python \>\>\> import base64 \>\>\> base64.urlsafe\_b64decode('08lZBOeQrbLPrIK8d029jtuj3rl3oC6DD\_4MUEKu\_8TAlZIOSub4a-RJ2Me8z5Dv') produces the following string: '\\xd3\\xc9Y\\x04\\xe7\\x90\\xad\\xb2\\xcf\\xac\\x82\\xbcwM\\xbd\\x8e\\xdb\\…

---

## [Extending println](https://discourse.julialang.org/t/extending-println/3888)

<div class="topic-metadata">

**Author:** [@JaredCrean2](https://discourse.julialang.org/u/JaredCrean2)\
**Replies:** 2\
**Last updated:** [May 27, 2017, 11:11pm UTC](https://discourse.julialang.org/t/extending-println/3888 "2017-05-27T23:11:59Z")

</div>

I’m trying to define my own IO type to prepend a time stamp to each line. What I have so far is: module Mod1 type DebugFileIO \<: IO fstream::IO end write(io::DebugFileIO, x::UInt8) = write(io.fstream, x) flush(io:…

---

## [Help with type instabilities](https://discourse.julialang.org/t/help-with-type-instabilities/3897)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 9\
**Last updated:** [May 27, 2017, 3:18pm UTC](https://discourse.julialang.org/t/help-with-type-instabilities/3897 "2017-05-27T15:18:57Z")

</div>

I’m having issues removing type instabilities from the function below, and would appreciate some tips. A = rand(36,36); out = \[2\]; sysdims = \[2,9,2\]; @code\_warntype ptrace2(A,out,sysdims) function ptrace2{T\<:Number}(A:…

---

## [What is the main point of "where"?](https://discourse.julialang.org/t/what-is-the-main-point-of-where/3940)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 7\
**Last updated:** [May 27, 2017, 3:18pm UTC](https://discourse.julialang.org/t/what-is-the-main-point-of-where/3940 "2017-05-27T15:18:15Z")

</div>

What is the difference between same\_type(x::T, y::T) where {T} and same\_type{T}(x::T, y::T) Where would “where” be REQUIRED? Thanks, P

---

## [Keeping track of how many characters written to an IO](https://discourse.julialang.org/t/keeping-track-of-how-many-characters-written-to-an-io/3935)

<div class="topic-metadata">

**Author:** [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Replies:** 5\
**Last updated:** [May 26, 2017, 11:28pm UTC](https://discourse.julialang.org/t/keeping-track-of-how-many-characters-written-to-an-io/3935 "2017-05-26T23:28:42Z")

</div>

I want to create my own IO that can also keep track of how many characters that has been written to it. AFAIU, everything written to an IO boils down to a call to Base.unsafe\_write(io::IOIndent, p::Ptr{UInt8}, n::UInt), …

---

## [How to submit update on RPM?](https://discourse.julialang.org/t/how-to-submit-update-on-rpm/3723)

<div class="topic-metadata">

**Author:** [@musm](https://discourse.julialang.org/u/musm)\
**Replies:** 3\
**Last updated:** [May 26, 2017, 8:50pm UTC](https://discourse.julialang.org/t/how-to-submit-update-on-rpm/3723 "2017-05-26T20:50:36Z")

</div>

I would like to update a library that is downloaded using WinRPM.jl What’s the easy way to do this ? Similarly if I would like to add a package Thanks!

---

## [Tracing out-of-scope function calls](https://discourse.julialang.org/t/tracing-out-of-scope-function-calls/3941)

<div class="topic-metadata">

**Author:** [@iamed2](https://discourse.julialang.org/u/iamed2)\
**Replies:** 0\
**Last updated:** [May 26, 2017, 5:42pm UTC](https://discourse.julialang.org/t/tracing-out-of-scope-function-calls/3941 "2017-05-26T17:42:13Z")

</div>

Problem: log every time a generic function Base.f is called, anywhere, where at least one of the arguments is of type T. At Invenia we’ve been having a long conversation about how one might do this. See a related issue …

---

## [AbstractArray vs. Array in Julia types](https://discourse.julialang.org/t/abstractarray-vs-array-in-julia-types/3937)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 15\
**Last updated:** [May 26, 2017, 3:25pm UTC](https://discourse.julialang.org/t/abstractarray-vs-array-in-julia-types/3937 "2017-05-26T15:25:08Z")

</div>

Consider the simple type: type Foo{T} A::AbstractArray{T} # (1) end # (2) update Foo.A with some operation on external array A update{T}(foo::Foo{T}, A::AbstractArray{T}) = foo.A = 2\*A I created two marks in the code (…

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

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