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

Call a macro from within a funciton

I am working with DataFrames.jl and DataFramesMeta.jl (which I love). So consider the following MWE, not directly related to my actual work: using DataFrames, DataFramesMeta grps = groupby(dff, :col1)...

View Article


Convert utf8 to binary

Hi, I’m new to Julia and trying to solve the cryptopals challenge: https://cryptopals.com/sets/1/challenges/6 This challenge requires to compute the hamming distance between two strings: str1 = "this...

View Article


Struggling to implement Tables.jl interface for Vector{MyStruct}

I’m trying to make Vector{MyStruct} a Table. One of the things that I have in mind is that I’ll be able to save Vector{MyStruct} into a parquet file by just calling write_parquet(file, tbl), which you...

View Article

Problem with using in Submodules

Dear all, I have a problem with modules. I have a file with module Root include("Branch.jl") include("OtherBranch.jl") include("Stalk.jl") using .Branch, .OtherBranch, .Stalk end Now, in...

View Article

How to compare non-missing elements of two DataFrames

Seeking terseness in order to keep my @testset readable. In this particular @test, query responses (as DataFrames) need to be checked for accuracy. There has to be a better way to do this: response =...

View Article


Help with Zygote and parameters

I’m having a hard time figuring out why this works: using Zygote W, b = rand(2, 3), rand(2) predict(x) = W*x .+ b g = gradient(() -> sum(predict([1,2,3])), Params([W, b])) g[W], g[b] but this...

View Article

Idiomatic way to find extreme and the next (less) extreme unique values

I have: julia> a = [3, 1, 4, 1, Inf, Inf] julia> extrema(a) (1.0, Inf) I would like to find the next pair of extreme values of array a , which are different from the original ones, i.e. laying...

View Article

Image may be NSFW.
Clik here to view.

How to dismiss editor tips on vars

Sometimes these tips pop up and obscure the line, there seems to be no option to dismiss on the tip itself. Is there some way to globally toggle these off? Example of tip with dismissal option:...

View Article


Graphplot in a loop

I would like to use graphplot in a loop inside a function. But graphplot does not return a value. How can this be done? Here is a MWE that demonstrates that I am not getting a plot. using Plots,...

View Article


Help with Threadding

Hello Guys, im not sure if im at the Right Place to ask those kind off Questions, if not im really sorry. So my Question is about Threadding. I have got a Julia-Script where im using a lot of...

View Article

Error while loading DynamicalSystems

Continuing the discussion from Get Error to load packages in Julia Console: Sir, I am facing same problem in case of “DynamicalSystems” .package.Also run Pkg.build().But still giving same error...

View Article

Control systems

Dear all, Hello, I have tried ControlSystems.jl since I want to use it in my courses with engineers but it is not woking for Julia 1.4! I am novice in Julia programming. I would like to participate in...

View Article

Parse an array of bits (`BitArray`) to an integer

I want to parse an array of bits to a decimal number. I am using this function now but it does not work very fast function bitarr_to_int(arr) return sum(arr .* (2 .^ collect(length(arr)-1:-1:0))) end...

View Article


Problems with dispatching of Base.iterate

The situation is the following: I’m defining some iterators with the following structure module foo module Generic import Base: iterate abstract type Gen struct iterator{G} where {G<:Gen} end...

View Article

Dictionary - inverse and consolidating

I have found this solution in Python and want to write in Julia something that will yield the same end result. It inverses the keys and values in a dictionary and consolidate the values in the inverse...

View Article


Plotly and graphplot

I would like to plot and rotate with the mouse a 3D SimpleGraph from LightGraphs.jl. Here is MWE: using LightGraphs using GraphRecipes import Plots Plots.PlotlyBackend() function plotGraph() graph =...

View Article

Gadfly DataFrame "cannot convert"

I’m sure I’m making a relatively elementary error, but when I attempt to work through the Gadfly tutorial, I keep getting errors when I run their code. For instance, when I run: using RDatasets using...

View Article


Suddenly cannot use Plots package

I am using julia 1.3.0, and suddenly I cannot use the Plots.jl package. This the error I get: julia> using Plots [ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] GC error (probable...

View Article

Edges plotted with graphplot, which should not be

I am successfully interacting with a 3D graph created with LightGraphs, but plotly backend is rather slow when I have 2000 nodes and 10,000 edges. It might be slow because the curvature argument...

View Article

Allocations when creating graphs, inefficiencies

I am creating my own method to create a graph in 3D because graphplot has a bug, which I reported here and on Github, and I got no reply, and yet I still need the plot. Here is some MWE, which I run...

View Article
Browsing all 2795 articles
Browse latest View live