Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:59
    wontruefree opened #12371
  • Aug 09 11:32
    straight-shoota labeled #7306
  • Aug 09 11:32
    straight-shoota labeled #7306
  • Aug 09 11:30
    straight-shoota closed #12370
  • Aug 09 11:30
    straight-shoota labeled #12370
  • Aug 09 11:30
    straight-shoota labeled #12370
  • Aug 09 11:30
    straight-shoota unlabeled #12370
  • Aug 09 03:30
    orangeSi synchronize #12356
  • Aug 09 01:23
    cyangle synchronize #12355
  • Aug 09 01:10
    cyangle synchronize #12355
  • Aug 09 00:58
    refi64 synchronize #12367
  • Aug 08 23:33
    decademoon labeled #12370
  • Aug 08 23:33
    decademoon opened #12370
  • Aug 08 16:30
    kalinon opened #12369
  • Aug 08 16:30
    kalinon labeled #12369
  • Aug 08 09:37
    HertzDevil edited #12366
  • Aug 08 08:32
    orangeSi synchronize #12356
  • Aug 08 08:10
    orangeSi synchronize #12356
  • Aug 07 22:57
    HertzDevil edited #12368
  • Aug 07 22:57
    HertzDevil labeled #12368
José Rodrigues
@joselfr
@ziprandom What do you mean by the binary does nothing even when you compile directly with crystal?
Zafar Ansari
@ansarizafar
Beginner Question: Is there any global exception handler in Crystal?
From IRC (bridge bot)
@FromIRC
<Yxhuvud> not be default, but you can always wrap whatever you are writing with begin .. rescue .. end. I'd advise strongly to not do that though.
oliviermo75
@zyriuse75
@krypton97 thank for the link man :+1:
From IRC (bridge bot)
@FromIRC
<ShalokShalom> Papierkorb: You said your bindings are ready for Tier 1 KDE?
unreadable
@unreadable
np m8 ;)
@ziprandom try to submit an issue, haven't used it so far
imonmyown
@imonmyown
Hi all :)
What are the generally accepted marshalling tools, or if none are available what is the preferred way to store application settings locally?
Ghost
@ghost~55586c4815522ed4b3e08557
you can use JSON or YAML
imonmyown
@imonmyown
Thanks @bew
imonmyown
@imonmyown

What would be the right mapping for a single YAML array?

class Foo
  YAML.mapping([] of Integer)
end

Doesn't cut it apparently... :(

Do I have to put it behind a key?
Ghost
@ghost~55586c4815522ed4b3e08557
yes
or use
Array(Int32).from_yaml(some_yaml) directly
imonmyown
@imonmyown
Great, thanks
Faustino Aguilar
@faustinoaq
Screenshot_20170922_084536.png
Official API search needs some work, devdocs is a great tool :+1:
From IRC (bridge bot)
@FromIRC
<gcds> Hi, is there implementation of PBKDF2 on Crystal?
Faustino Aguilar
@faustinoaq

No as far I know :sweat_smile:

You can use https://crystalshards.xyz to find crystal projects.

From IRC (bridge bot)
@FromIRC
<gcds> Maybe someone could help me. I am trying to compile std lib and get problem I think on mac somehow std lib cant find libcrypto. Maybe someone has encountered this problem? pkg-config libcrypto doesnt return nothing...
<gcds> it does return sorry but still I cant build :⁠(
<gcds> i think I know the problem my openssl is to old
<gcds> too*
Ilker Güller
@Sly777

Hey all, I'm trying to make crystal app with Kemal, Granite ORM on postgres. My question is I created one model that needs to update password to encrypted one. But on the build, It's giving error as...

instance variable '@password' of User must be (String | Nil), not Crypto::Bcrypt::Password

require "granite_orm/adapter/pg"
require "crypto/bcrypt/password"
require "logger"
require "kemal"

log = Logger.new(STDOUT)
log.level = Logger::WARN

class User < Granite::ORM::Base
  adapter pg

  before_save :prepare_data

  field email : String
  field password : String
  timestamps

  def prepare_data
    if password = @password
      log("#{password}")
      @password = Crypto::Bcrypt::Password.create(password)
      log("#{@password} | #{password}")
    end
  end
end

module Crystal::Chat
  get "/" do
    user = User.new
    user.email = "test@test.com"
    user.password = "pass1234"
    user.save

    "Hello World! #{VERSION}"
  end

  Kemal.run
end
Nick Franken
@fridgerator
Crypto::Bcrypt::Password.create(password).to_s
Ilker Güller
@Sly777
But after that, How can I cast to Bcrypt again to compare password?
Btw. I'm really new on crystal so It can be dumb question :D
Nick Franken
@fridgerator
something lilke
def password_valid?(password : String) : Bool
  Crypto::Bcrypt::Password.new(@encrypted_password) == password
end
Ilker Güller
@Sly777
Thanks @fridgerator !
Nick Franken
@fridgerator
sure
From IRC (bridge bot)
@FromIRC
<gcds> yay... the same error I had on my machine is now on CircleCI :⁠D
Luis Lavena
@luislavena
@gcds CircleCI for OSX? Same solution you applied locally you might want to apply to CI, might recommend install newer OpenSSL using Homebrew.
From IRC (bridge bot)
@FromIRC
<gcds> @luislavena, Locally I just used PKG_CONFIG_PATH flags to help find brew version of openssl so it worked out, but I have no idea how to fix circleci build.
<gcds> ahhh its osx build
<gcds> now I got it :⁠D
From IRC (bridge bot)
@FromIRC
<gcds> hmm it did not worked like I expected trying something out :⁠(
From IRC (bridge bot)
@FromIRC
<gcds> I am feeling bit like idiot... the original PKCS5_PBKDF2_HMAC_SHA1 is found but additional PKCS5_PBKDF2_HMAC method is not found then its in the same lib. Even then in OpenSSL PKCS5_PBKDF2_HMAC_SHA1 wraps a call PKCS5_PBKDF2_HMAC
<gcds> Ok i reproduced the error again and fixed with simple flag. https://gist.github.com/aurimasniekis/422e6dfaf3b256d1d9bcea40ae54ef72
<gcds> but the same thing does not work on CircleCI :⁠(
Zafar Ansari
@ansarizafar
Why I am getting method addme undefined error?
module Helpers

def addme(x : Int32, y : Int32)
return x+y
end

puts addme 3,4

end
George
@georgeu2000
What are you trying to do? Define a class?
Nick Franken
@fridgerator
module Helpers
  def self.addme(x, y)
    return x + y
  end

  self.addme(1, 2)
end
or extend self inside the module
George
@georgeu2000
How to define a Hash( Int32, Int32 ) with an initial value of 0 for each key?
Rinkana
@Rinkana
You dont
George
@georgeu2000
Tried Hash.new( Int32, Int32 ){ 0 } but it did not work.
Seems like you can according to https://github.com/crystal-lang/crystal/blob/e2a1389e8165fb097c785524337d7bb7b550a086/src/hash.cr#L28
Rinkana
@Rinkana
Hash keys are unique so there can be one 0