Questions tagged [crystal-lang]

Crystal is a programming language with a Ruby inspired syntax but statically type checked and compiled to native and efficient code.

Links

Projects

660 questions
0
votes
1 answer

How can I verify a pem_cert and signiture (RSA-SHA1)?

I'm trying to check if a signature is valid, in Node.js I would use https://nodejs.org/api/crypto.html#crypto_verify_verify_object_signature_signatureencoding I can't seem to find anything for crystal that provides this functionality?
spd
  • 23
  • 1
  • 3
0
votes
2 answers

Crystal Lang Websocket server

I need help with Crystal Lang websockets, I want to know how to upgrade my connection on websocket. I want make simple websocket server
0
votes
0 answers

Shortcut to view the assembly output of a python script's process

I learned from this post that you can use Crystal to compile Ruby into native machine code and generates its asm version. So I'm wondering if there is a similar tool for python. I know that dis can disassemble byte code, but the output is not the…
kakyo
  • 10,460
  • 14
  • 76
  • 140
0
votes
1 answer

how to use crystal to defined a ListNode class

i used to use python to do it and i don't know how to defined a ListNode class by Crystal, what i do is just for the second problem in Leetcode website which is Add Two Number. i have tried in this way but i got undefined method 'next' for ListNode…
0
votes
1 answer

Can not make websocket connection with Amber or NPM not sure which

Amber CLI (amberframework.org) - v0.11.3 Crystal 0.27.0 [c9d1eef8f] (2018-11-01) LLVM: 4.0.0 Default target: x86_64-unknown-linux-gnu npm 3.5.2 I am trying to implement sockets with Crystal Lang and Amber. I followed the instructions from the Amber…
Peter
  • 41
  • 6
0
votes
1 answer

how to add any hash to empty array of hashes?

I just learn Crystal, but stuck on an array of mix type hashes. Suppose there is an array of hashes: array = [{"a" => "Aa", "b" => 66, "c" => Time.now}] I can easily add another element: array << {"c" => "Bb", "d" => 2, "f" => 1.year.from_now} But…
0
votes
1 answer

When I defined a function I got: error unexpected token: (

I have already seen the community of Crystal, but I couldn't find this problem. def Twosum(a = [] of Int32, target = 0) map = {} of Int32 : Int32 a.each_index do |i| diff = target - a[i] if map.key?(diff): …
0
votes
1 answer

Can't access models from crystal play

How do I access models from Crystal Play? After installing Crystal and the Amber framework I am unable to access my new model, User from Crystal Play. I am able to start the project using 'crystal watch' and save a new user using the auto-generated…
Peter
  • 41
  • 6
0
votes
2 answers

Is it possible to get the IP address of an incoming websocket connection?

My websocket server runs this way: ws_hdl = WebSocketHandler.new do |ws| # here we should determine the IP address of an incoming connection end srv = Server.new ws_hdl srv.listen("0.0.0.0", 8080) Is it possible to obtain an IP address of…
Untied
  • 11
  • 4
0
votes
1 answer

About the history of crystal language / Sobre a história da linguagem Crystal

Good morning / Good afternoon / Good evening, I'm doing a college work on the Crystal programming language, I looked on the site, wikis etc ... for the history of this language but I did not find much, since part of the work is to create an article…
user10509826
0
votes
0 answers

MySql Connect Lost in Crystal Language with Kemal

I try connection Kemal Framework with crystal-mysql. This my shard: mysql: github: crystal-lang/crystal-mysql db: github: crystal-lang/crystal-db And this my connection: db = DB.open "mysql://root:password@localhost:787878/book" But, if I'm…
kadal ijo
  • 21
  • 3
0
votes
1 answer

Empty Set literal syntax

Looking for the right syntax or if there's a bug/rough edge: Set{} for empty hashes use '{} of KeyType => ValueType' <-wrong Set{} of Char expecting token '=>', not 'EOF' <-wrong Set(Char){} for empty hashes use '{} of KeyType => ValueType'…
user246672
0
votes
1 answer

How to count perpage using crystal language and kemal

I have some menu, example: Dashboard List Table Category Detail And I want to create Quick Actions dropdown menu with the most viewed. My…
kadal ijo
  • 21
  • 3
0
votes
1 answer

Storing strings in JSON::Any variables not working

I recently got back into crystal and I noticed some breaking changes concerning JSON behaviour in 0.25.0. Previously, when I had a variable of type JSON::Type, I could simply store a string in it a : JSON::Type a = "some string" this is no longer…
tpei
  • 671
  • 9
  • 26
0
votes
1 answer

Create Granite model from JSON params

What I would like to have happen: Someone can make a post request to users/new with parameters, and I would like to create a User object from the JSON parameters. In the readme, it gives this example: foo = Foo.from_json(%({"name":…
Hyrum Carlile
  • 107
  • 3
  • 7