Quantcast
Channel: First steps - JuliaLang
Browsing all 2795 articles
Browse latest View live

With struct do

A long time ago, I learned Turbo Pascal and there was a contract that allowed: with x do field3 = field1 + field2 end instead of x.field3 = x.field1 + x.field2 where mutable struct compositetype...

View Article


Vector and integer variables

Hi guys, could you help me please? I came across a problem and I can’t imagine a way out. How do I compare an integer value passed as a parameter to a function, for example: x = 123 and find out if...

View Article


Keep Gtk dialog windows on top

How to keep Gtk open_dialog always on top of the others?’ Thank you. 1 post - 1 participant Read full topic

View Article

How to extend a vector the Julian way

In Python, given a list a=[1,2], I can extend it with a.extend([3,4]) Now a contains [1,2,3,4]. Does Julia have a simple way to extend vectors? Of course, vcat comes to mind: a = [1,2] a =...

View Article

How to execute echo $PATH from Julia

I would like to run echo $PATH bash command, see the result and optionally capture it in a string or array of strings. I started with: julia> run(`echo $PATH`) ERROR: UndefVarError: PATH not...

View Article


Revisited : Loading first few lines from data file

I am revisiting a question I had asked earlier, but none of the solutions work on my 1.1.0 version Julia. I have a data file with 100 rows of data of the form 1 2 3 4 5 6.1 ... I want to load the...

View Article

Sampling from a list of integers without repetition

Given a vector of integers a = collect(1:10) I would like to randomly sample 5 integers with guaranteed non-repetition. As far as I know, b = rand(a, 10) does not guarantee that. This is easily...

View Article

Making a task.sticky = false run in any thread

I was experimenting with multithreading to learn more about Julia’s multithreading capabilities. I tried to replicate the @spawn steps with ordinary Task creation: function prime_check(n) for i =...

View Article


Putting Threads.@threads or any macro in an if statement

Is there a way to “turn” macros on and off with a flag/if statement. For example, I have a loop where I calculate forces and in some instances I don’t need to use multiple threads (e.g. avoid...

View Article


How do I parse the string "29 February" into a date structure

using Dates julia> format = Dates.DateFormat("d U") dateformat"d U" julia> parse(Date,"28 February",format) + Dates.Year(2020-1) 2020-02-28 julia> parse(Date,"29 February",format) +...

View Article

How do I tell the VSCode Langauge server to use my Project.toml?

I have a project that I’m trying to edit in VSCode: eric@tara ~/s/c/sql_explore (dev)> tree . ├── Manifest.toml ├── Project.toml ├── main.jl ├── src │ └── sql_explore.jl └── test └── runtests.jl...

View Article

Error Installing juno-client

Hi everyone! This is my first time of using Julia. I tried installing juno in Atom using uber-juno. This is the error I get. Error installing juno-client. Check your internet or or report this to...

View Article

Garbage collection

Hello, I’m new to Julia. I ran my code and timed it using @time. The results show that gc time is 67.2%. From what I’ve seen in other threads, this is a high figure and is a drag on performance....

View Article


Module not reading properly

The use of modules in Julia is painful for me, after using many languages. However, I am persevering. In a file pickle.jl, I have the following code: module Pickle export mypickle, myunpickle using...

View Article

Issues with package management

Still learning Julia… I think I messed up the package repository on my machine and I’m at a loss on how to fix it. I attempted to install a package from github: (@v1.3) pkg> add...

View Article


Initialise a dict in a mutually circular type

I need to define two mutually circular types. I have read this issue, which suggests using a forward declaration. That works. However, I also need to contain the types in Dicts, which must be...

View Article

Flux: Custom Layer

In Flux, I need to create a custom layer (named Nonneg) and then train the model with Train. I tried replicating the Dense layer, following @LudiWin’s example and looking at the definition of the...

View Article


Identifying nodes in a Graph

Hi, I have data on users for whom I’d like to create a bipartite network that connects them through their consumption decisions. Since the data is rather big I’m trying to find an efficient...

View Article

Compiling Clones for Fun and Profit

Hello, uh, Juliaistas? Juliaverse? As part of my Julia journey, I have decided to work on a TCX parser (specifically this parser xue35/TCX.jl that would be useful for getting to my fitness data. While...

View Article

Documenter.jl only works on packages and modules?

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged) 1 post - 1 participant Read full topic

View Article
Browsing all 2795 articles
Browse latest View live