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

Detect space

hi all i try to detect space in string, if i have “Hello World , i need to detect the index i , in python i just look for if arr[i] ==” " put here it doesn’t work. function lengthOfLastWord(arr)...

View Article


Makie in Jupyter?

I’m trying to install and use Makie in a Jupyter notebook: No luck. Tried the installation of WGLMakie: No luck. Does anyone have this working on a Windows10 machine? If it helps, the code below...

View Article


How to set a custom theme in Plots.jl

Hi, I’m new to Julia and I want to setup a custom plotting theme. I’ve checked here http://docs.juliaplots.org/latest/generated/plotthemes/ and it points to the package PlotThemes...

View Article

Iteration reverse in for loop

hi all in python if i want to track reverse through the for loop i write this for i in range(len(digits)-1,-1,-1): there is some thing similar in julia ? 4 posts - 3 participants Read full topic

View Article

Add two binary numbers

i need to add two binary number. in the first place how i display a binary number in julia ? i try a lot things but doesn’t work like , parse(Int,"111",2) or Int(0b110111) in python the code is like...

View Article


Problems encountered in installing Pkg for the first time

julia> using Pkg julia> Pkg.add(“PyPlot”) Updating registry at C:\Users\Administrator\.juliapro\JuliaPro_v1.4.2-1\registries\JuliaPro Cannot reach authentication server at...

View Article

Fields of an anonymous function?

Looking at some examples of a package I came across this type of behavior: function f(n) a = n x -> x^a end g = f(2) g.a # 2 Can someone point out where that is documented? 9 posts - 4 participants...

View Article

Poor results using WriteVTK?

Hello! I have made a very simple code to save point data + one point data array: using WriteVTK using Random using Test function write_vtp(filename::String, points, attribute) polys =...

View Article


Merge to number

hi all i have two arrays a and b find the maximum between a[i] and b[i] and return it if i have a = [1,5,9,2] and b =[3,3,7,8,6,4] the output will be res = [3,5,9,8,6,4] it is easy i know but i don’t...

View Article


Recommendation for thread-safe file access (ex .jld2)

I have a for loop that uses the @threads macro, here is a simple example: Threads.@threads for i in 1:10 checks = load("myfile.jld2")["checks"] push!(checks,(i,i+1)) @save "myfile.jld2" checks end...

View Article

Struggling to implement Tables.jl interface (again)

Sorry for the post, it is very similar to previous ones but I just cannot get it to work. I am trying to implement a Tables.jl interface for a Vector{JSON3.Object}. Here is my effort so far: struct...

View Article

Image may be NSFW.
Clik here to view.

Number of threads available seems random (using @spawn)

I am trying to use @spawn to parallelize a computation, but I am experiencing some problems which I do not understand. Here is the simplest code with which I could reproduce the issue: using Dates...

View Article

Any one know lua language

i need to convert some code from julia to lua using hash map any one ? 2 posts - 2 participants Read full topic

View Article


Split-Apply-Combine on many columns at once? Looking for equivalent to...

Hi all, I’ve got a dataset with multiple rows per individual that I would like to collapse to one row per individual, but I want to retain a variety of information for each individual (e.g. their sex,...

View Article

Image may be NSFW.
Clik here to view.

Best practice for channels that use HDF5 (seems like race is still an issue...

I’m about to submit some jobs that use following “emergency backup” scheme (see MWE testBackup.jl below). I learned the hard way after loosing some data on a job that was submitted to our cluster, due...

View Article


Multi-threading changing results

Hello, I’m doing some parallel loops in my code using multi-threading. As I was reviewing my results, I noticed that I kept having different results in a piece of code, although the input data was...

View Article

Meta.parse supports interpolation?

It is confusing for me when I use Meta.parse() function as: Julia> x = 2 Julia> Meta.parse(":(:(v = $x))") :($(Expr(:quote,:($(Expr(quote,:(v = 2))))))) In general, an interpolation with single...

View Article


Image may be NSFW.
Clik here to view.

Plotting bug in VS Code plot pane

I am running on a server without sudo access. When I plot in VS Code (using ctrl-enter), I get the following error: julia> p = plot(rand(100))...

View Article

ERROR: Unsatisfiable requirements detected for package Unitful

Hi. I’m getting this error when adding the NeuralPDE Pkg. I’m using Julia 1.5 (also tried on 1.0.5 and 1.4.2 and I get a similar log). I don’t know how to interpret it. Any help will be highly...

View Article

How to get the date of a file?

Hello, I’m very new to Julia. I try to get the last updated date of a list of file, for that I use the method “mtime”. The result for some files is correct but unfortunately for many I get always that...

View Article
Browsing all 2795 articles
Browse latest View live