# General Usage

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

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

**Page:** 883

---

## [ImageView gives errors](https://discourse.julialang.org/t/imageview-gives-errors/17105)

<div class="topic-metadata">

**Author:** [@microlifecc](https://discourse.julialang.org/u/microlifecc)\
**Replies:** 4\
**Last updated:** [March 24, 2019, 7:59pm UTC](https://discourse.julialang.org/t/imageview-gives-errors/17105 "2019-03-24T19:59:28Z")

</div>

Hi, I recently upgraded to Julia 1.0.1 from 0.6. Now I have added Images package but on running: using ImageView on the terminal I am getting this error: \[ Info: Precompiling ImageView \[86fae568-95e7-573e-a6b2-d8a6…

---

## [See an image in the gray scale](https://discourse.julialang.org/t/see-an-image-in-the-gray-scale/22264)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 4\
**Last updated:** [March 24, 2019, 7:25pm UTC](https://discourse.julialang.org/t/see-an-image-in-the-gray-scale/22264 "2019-03-24T19:25:43Z")

</div>

see an image in the gray scale. I have a doubt. I’m working with an image but I want to know why I can not see it fast “in automatic” without writing ImageView.imshow (ImageFromTestImages) \[(This is to see a color im…

---

## [Warning message in Printf](https://discourse.julialang.org/t/warning-message-in-printf/22277)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 3\
**Last updated:** [March 24, 2019, 6:20pm UTC](https://discourse.julialang.org/t/warning-message-in-printf/22277 "2019-03-24T18:20:13Z")

</div>

Hello colleagues, I am using Julia v 0.7. When I print a value x, and give the commands: using Printf x = 2.0 @printf(“The value of x = %2.1f\\n”,x) Appers a warning message in this version (not in 0.6.4): WARNING:…

---

## [0.7 doesn't let me add any packages](https://discourse.julialang.org/t/0-7-doesnt-let-me-add-any-packages/13053)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 3\
**Last updated:** [March 24, 2019, 2:33pm UTC](https://discourse.julialang.org/t/0-7-doesnt-let-me-add-any-packages/13053 "2019-03-24T14:33:37Z")

</div>

Hi, this is a duplicate post, but my original post was really not in a suitable thread. as per subject, doesn’t matter what the package is I get the same error. echo $JULIA\_LOAD\_PATH . any ideas ? Thanks. ‘’’ pkg\> …

---

## [How can I be able to use binary command "julia" in Mac OSX terminal?](https://discourse.julialang.org/t/how-can-i-be-able-to-use-binary-command-julia-in-mac-osx-terminal/22270)

<div class="topic-metadata">

**Author:** [@ssghost](https://discourse.julialang.org/u/ssghost)\
**Replies:** 2\
**Last updated:** [March 24, 2019, 10:14am UTC](https://discourse.julialang.org/t/how-can-i-be-able-to-use-binary-command-julia-in-mac-osx-terminal/22270 "2019-03-24T10:14:24Z")

</div>

I have installed Julia-v1.1 and the default IDE works pretty well. But I can’t directly use some command line instructions such as "$ julia script.jl arg1 arg2… " in Mac Terminal. It returns “command not found”. How can …

---

## ["functional" update of structures?](https://discourse.julialang.org/t/functional-update-of-structures/22261)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 5\
**Last updated:** [March 24, 2019, 7:55am UTC](https://discourse.julialang.org/t/functional-update-of-structures/22261 "2019-03-24T07:55:21Z")

</div>

I’m almost sure I’ve seen this addressed before, but my intertube search skills have failed me. i’m looking for something that will let me do: struct S1 a; b; c end function f1(s::S1, new\_b) s(b=new\_b) end s2 = f1(…

---

## [Concatenation of strings not working inside a function](https://discourse.julialang.org/t/concatenation-of-strings-not-working-inside-a-function/22250)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 3\
**Last updated:** [March 24, 2019, 2:00am UTC](https://discourse.julialang.org/t/concatenation-of-strings-not-working-inside-a-function/22250 "2019-03-24T02:00:57Z")

</div>

The simple function of concatenating strings does not seem to be working. I tried this simplest of codes on v1.1.0. function f(name::String) :: String return String(name, “\_GaussKer”); end julia\> s = f(“test”) ERRO…

---

## [Using ccall](https://discourse.julialang.org/t/using-ccall/22254)

<div class="topic-metadata">

**Author:** [@aditya](https://discourse.julialang.org/u/aditya)\
**Replies:** 4\
**Last updated:** [March 23, 2019, 8:08pm UTC](https://discourse.julialang.org/t/using-ccall/22254 "2019-03-23T20:08:51Z")

</div>

I have a struct in C - struct foo { char s\[128\]; }; I want to make a struct in julia that can be used with ccall as return type or as an argument i.e, struct bar s::Type end x = bar(“hello”) ccall((:fun1,“lib”…

---

## [Is there any function equivalent to "dir" in MATLAB?](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217)

<div class="topic-metadata">

**Author:** [@abuAnat](https://discourse.julialang.org/u/abuAnat)\
**Replies:** 4\
**Last updated:** [March 23, 2019, 6:32pm UTC](https://discourse.julialang.org/t/is-there-any-function-equivalent-to-dir-in-matlab/22217 "2019-03-23T18:32:00Z")

</div>

Is there any function equivalent to dir in MATLAB; that shows {name, folder, date, bytes, isdir, datenum}?

---

## [Request for suggestions on emitting Julia source code from expressions, meta-programming or templates](https://discourse.julialang.org/t/request-for-suggestions-on-emitting-julia-source-code-from-expressions-meta-programming-or-templates/22231)

<div class="topic-metadata">

**Author:** [@Rana\_Ian](https://discourse.julialang.org/u/Rana_Ian)\
**Replies:** 4\
**Last updated:** [March 23, 2019, 4:04pm UTC](https://discourse.julialang.org/t/request-for-suggestions-on-emitting-julia-source-code-from-expressions-meta-programming-or-templates/22231 "2019-03-23T16:04:57Z")

</div>

Any thoughts on how best to emit Julia source code from expressions, meta-programming or templates? Option 1: Ideally a macro dynamically generate structs and functions from some template, capturing those artifacts as e…

---

## [Threads.@threads not working, even without i/o](https://discourse.julialang.org/t/threads-threads-not-working-even-without-i-o/22177)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 3\
**Last updated:** [March 23, 2019, 3:29pm UTC](https://discourse.julialang.org/t/threads-threads-not-working-even-without-i-o/22177 "2019-03-23T15:29:38Z")

</div>

I am continuing my reporting of bugs with multi-threading on Julia. I am using v1.1.0 and running on 4 threads. The following code using SparseArrays; using Serialization; N=1000; oneN=fill(1.0, N); K=spzeros(N,N); …

---

## [Array definition error](https://discourse.julialang.org/t/array-definition-error/22181)

<div class="topic-metadata">

**Author:** [@11111](https://discourse.julialang.org/u/11111)\
**Replies:** 5\
**Last updated:** [March 23, 2019, 1:21pm UTC](https://discourse.julialang.org/t/array-definition-error/22181 "2019-03-23T13:21:06Z")

</div>

When I wrote the following code, an error occurred in the definition of the array. I think that the definition of array u is done, but I do not know why the error occurs. Changing the definition of \[array u\] to \[global…

---

## [How to implement efficient custom array](https://discourse.julialang.org/t/how-to-implement-efficient-custom-array/22189)

<div class="topic-metadata">

**Author:** [@stemann](https://discourse.julialang.org/u/stemann)\
**Replies:** 4\
**Last updated:** [March 23, 2019, 7:41am UTC](https://discourse.julialang.org/t/how-to-implement-efficient-custom-array/22189 "2019-03-23T07:41:27Z")

</div>

How to implement a custom StridedArray or DenseArray? I have some C-code which returns a pointer to an array, which I can wrap using unsafe\_wrap. I need to build a custom array-implementation, but operations on this cus…

---

## [Replace with non-matching group](https://discourse.julialang.org/t/replace-with-non-matching-group/22187)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 0\
**Last updated:** [March 22, 2019, 9:00am UTC](https://discourse.julialang.org/t/replace-with-non-matching-group/22187 "2019-03-22T09:00:17Z")

</div>

The doc of replace has this example: julia\> replace("The quick foxes run quickly.", r"fox(es)?" =\> s"bus\\1") "The quick buses run quickly." this works fine however julia\> replace("The quick fox run quickly.", r"fox(es…

---

## [Save BigFloat Array to a file](https://discourse.julialang.org/t/save-bigfloat-array-to-a-file/22210)

<div class="topic-metadata">

**Author:** [@GoodNews](https://discourse.julialang.org/u/GoodNews)\
**Replies:** 5\
**Last updated:** [March 22, 2019, 11:59pm UTC](https://discourse.julialang.org/t/save-bigfloat-array-to-a-file/22210 "2019-03-22T23:59:47Z")

</div>

Hello together, I am trying to save a big BigFloat Array to a file (The format does not matter to me). HDF5 hasn’t any function that would accept BigFloat Datatype, JLD is incredibly slow on saving and loading the arr…

---

## [Downscaling arrays with categorical data (aka majority or mode resampling)](https://discourse.julialang.org/t/downscaling-arrays-with-categorical-data-aka-majority-or-mode-resampling/22215)

<div class="topic-metadata">

**Author:** [@NiclasMattsson](https://discourse.julialang.org/u/NiclasMattsson)\
**Replies:** 0\
**Last updated:** [March 22, 2019, 8:25pm UTC](https://discourse.julialang.org/t/downscaling-arrays-with-categorical-data-aka-majority-or-mode-resampling/22215 "2019-03-22T20:25:49Z")

</div>

I have two global geospatial datasets with categorical data: one has 16 categories of land cover types and the other represents administrative regions of the world with nearly 400,000 different subregions. Both are globa…

---

## [Code works when run as a file, but not from REPL](https://discourse.julialang.org/t/code-works-when-run-as-a-file-but-not-from-repl/22208)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 4\
**Last updated:** [March 22, 2019, 7:38pm UTC](https://discourse.julialang.org/t/code-works-when-run-as-a-file-but-not-from-repl/22208 "2019-03-22T19:38:17Z")

</div>

I have a small piece of code which works perfectly when run as julia tmp.jl and even as julia -e 'include("tmp.jl")', but not when I start julia and immediately type include("tmp.jl")! Neither it works if I just copy-pas…

---

## [Problem loading old JLD files with "Bool" properties](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926)

<div class="topic-metadata">

**Author:** [@acunningham](https://discourse.julialang.org/u/acunningham)\
**Replies:** 5\
**Last updated:** [March 22, 2019, 2:36pm UTC](https://discourse.julialang.org/t/problem-loading-old-jld-files-with-bool-properties/20926 "2019-03-22T14:36:55Z")

</div>

Hi, I’m trying to load some old JLD files that were created in Julia 0.6 for use in Julia 1.1, however there seems to be issue with loading the Bool . I have a small sample to demonstrate Created in 0.6 using JLD mu…

---

## [Debugging in Julia 1.0?](https://discourse.julialang.org/t/debugging-in-julia-1-0/14298)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [March 22, 2019, 2:26pm UTC](https://discourse.julialang.org/t/debugging-in-julia-1-0/14298 "2019-03-22T14:26:11Z")

</div>

Hello, I am a bit lost with the various discussions on debugging being or not being available, depending on the version of Julia (and Juno). I remember for some times there has been the possibility to step into a functi…

---

## [How to convert IBM (SPSS) time to Julia?](https://discourse.julialang.org/t/how-to-convert-ibm-spss-time-to-julia/22195)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 0\
**Last updated:** [March 22, 2019, 12:42pm UTC](https://discourse.julialang.org/t/how-to-convert-ibm-spss-time-to-julia/22195 "2019-03-22T12:42:32Z")

</div>

I have data from SPSS (IBM soft) . Type od Date and Time. I.e val 13764805188 is equal 21-Dec-2018 20:59:48.00 In Julia julia\> t=13764805188 13764805188 julia\> DateTime(t) -264491995-11-27T13:39:21.216 How to c…

---

## [How to extract part of ReadStatDataFrame?](https://discourse.julialang.org/t/how-to-extract-part-of-readstatdataframe/22152)

<div class="topic-metadata">

**Author:** [@programista](https://discourse.julialang.org/u/programista)\
**Replies:** 1\
**Last updated:** [March 22, 2019, 6:06am UTC](https://discourse.julialang.org/t/how-to-extract-part-of-readstatdataframe/22152 "2019-03-22T06:06:33Z")

</div>

julia\> using ReadStat julia\> using DataValues I have A julia\> A ReadStatDataFrame(Any\[DataValue{Float64}\[1.0, 2.0, 1.0, 2.0\], DataValue{Float64}\[1.0, 1.0, 2.0, 2.0\], DataValue{Float64}\[0.139644, 0.431302, 0.612179…

---

## [C Interface -- Library name must be a constant expression?](https://discourse.julialang.org/t/c-interface-library-name-must-be-a-constant-expression/22171)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 9\
**Last updated:** [March 22, 2019, 6:02am UTC](https://discourse.julialang.org/t/c-interface-library-name-must-be-a-constant-expression/22171 "2019-03-22T06:02:35Z")

</div>

I’m calling a C function: LIBTTV = "path/to/library.so" ccall( (:TTVFast, LIBTTV), Cvoid, ... ) This gives an error: ERROR: LoadError: TypeError: in top-level scope, in ccall: first argument not a pointer or valid con…

---

## [Error when defining an array as a function argument](https://discourse.julialang.org/t/error-when-defining-an-array-as-a-function-argument/22179)

<div class="topic-metadata">

**Author:** [@11111](https://discourse.julialang.org/u/11111)\
**Replies:** 1\
**Last updated:** [March 22, 2019, 5:34am UTC](https://discourse.julialang.org/t/error-when-defining-an-array-as-a-function-argument/22179 "2019-03-22T05:34:58Z")

</div>

I wrote the following code and an error occurred in the function part. I think that the number of elements of the array is correct, but I do not know why the error occurs. function jacobi(x::Matrix{Float64},A::Matrix{F…

---

## [Calling C functions --- segfault when ccall inside a function](https://discourse.julialang.org/t/calling-c-functions-segfault-when-ccall-inside-a-function/22174)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 5\
**Last updated:** [March 22, 2019, 3:45am UTC](https://discourse.julialang.org/t/calling-c-functions-segfault-when-ccall-inside-a-function/22174 "2019-03-22T03:45:43Z")

</div>

This is really weird. I have this library that I’m trying to call from Julia. If I run this in Main (e.g. in the REPL or a script), ccall( (:TTVFast, "path/to/library.so"), Cvoid, ( ...signature... ), ..., pointer(a…

---

## [Threads.@threads not working](https://discourse.julialang.org/t/threads-threads-not-working/22054)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 7\
**Last updated:** [March 22, 2019, 1:53am UTC](https://discourse.julialang.org/t/threads-threads-not-working/22054 "2019-03-22T01:53:13Z")

</div>

I am running into a strange problem when I try to do multithreading over a very simple loop. I have Julia version 1.1.0 and start with 4 threads. The loop is N=4; Threads.@threads for i in 1:N t2(i); end Where the f…

---

## [Using Clipping on an image](https://discourse.julialang.org/t/using-clipping-on-an-image/21782)

<div class="topic-metadata">

**Author:** [@GERSON\_EZEQUIEL\_HERN](https://discourse.julialang.org/u/GERSON_EZEQUIEL_HERN)\
**Replies:** 12\
**Last updated:** [March 22, 2019, 1:21am UTC](https://discourse.julialang.org/t/using-clipping-on-an-image/21782 "2019-03-22T01:21:57Z")

</div>

Using Clipping on an image. When you have a grayscale image, it is quantized to one byte. That means that only 255 bts can be quantified and can not be exceeded or have negative values. Clipping = set limits of the qu…

---

## [Callback: Switch between dynamic models and time step depending on the region](https://discourse.julialang.org/t/callback-switch-between-dynamic-models-and-time-step-depending-on-the-region/22077)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 7\
**Last updated:** [March 22, 2019, 1:07am UTC](https://discourse.julialang.org/t/callback-switch-between-dynamic-models-and-time-step-depending-on-the-region/22077 "2019-03-22T01:07:52Z")

</div>

Hello everyone, I would like to solve an ODE in DifferentialEquations.jl where the right-hand side and the time step depend on the region where is located the particle. The function DiscreteCallBack seems to be adequat…

---

## [C Interface -- How to store an element in a C array](https://discourse.julialang.org/t/c-interface-how-to-store-an-element-in-a-c-array/22156)

<div class="topic-metadata">

**Author:** [@danielc](https://discourse.julialang.org/u/danielc)\
**Replies:** 4\
**Last updated:** [March 22, 2019, 12:52am UTC](https://discourse.julialang.org/t/c-interface-how-to-store-an-element-in-a-c-array/22156 "2019-03-22T00:52:37Z")

</div>

Hello, I have an an old bit of code, written by someone else, that I need to convert to Julia 1.0. I’ve begun the conversion, but I’m stuck: struct ttvfast\_RV\_entry time::Cdouble RV::Cdouble end ... nrvs = 100 rv\_w…

---

## [RFC: Hooks.jl](https://discourse.julialang.org/t/rfc-hooks-jl/22158)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 3\
**Last updated:** [March 21, 2019, 7:31pm UTC](https://discourse.julialang.org/t/rfc-hooks-jl/22158 "2019-03-21T19:31:11Z")

</div>

Sometimes one package wants to do something when an event happens in another package, but they don’t necessarily want to introduce a dependency. I threw together Hooks.jl to make this easy. For example, say Atom.jl want…

---

## [Compiling error](https://discourse.julialang.org/t/compiling-error/21793)

<div class="topic-metadata">

**Author:** [@thomas\_vilches](https://discourse.julialang.org/u/thomas_vilches)\
**Replies:** 2\
**Last updated:** [March 21, 2019, 6:50pm UTC](https://discourse.julialang.org/t/compiling-error/21793 "2019-03-21T18:50:51Z")

</div>

Hey everyone, I am not sure if this is the right way to ask something, but here I am: I am getting an error when I trying to compile some packages, for instance “using DataFrames” is returning the message: using DataFr…

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

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