RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <kingsleyh> I would say - self
_whitelogger has joined #crystal-lang
johndescs has quit [Ping timeout: 272 seconds]
johndescs has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <sam0x17> how do I "concatenate" two slices to get a new slice that is slice1 + slice 2?
azuri5 has joined #crystal-lang
<FromGitter> <proyb6> Slice of what type?
<FromGitter> <sam0x17> UInt8
<FromGitter> <sam0x17> all I actually need to do is prepend to the beginning of a Slice(UInt8)
<FromGitter> <sam0x17> I expected the compiler to let me + tem together but alas no, and the copy_to / copy_from methods don't seem to do what I want either
<FromGitter> <sam0x17> *them
ua has quit [Ping timeout: 268 seconds]
ua has joined #crystal-lang
<oprypin> sam0x17: again, what are you actually trying to do? I'm curious about the situation where you specifically need to prepend to a slice. and is it just once, or more?
<oprypin> probably could do some ugly combination of realloc, pointer math, copy_to
<oprypin> oh but that's just for appending. prepending is such a pain
return0e has joined #crystal-lang
return0e_ has quit [Ping timeout: 268 seconds]
<FromGitter> <sam0x17> some stuff involving AES encryption... adding a nonce to the beginning of the data in my encrypt method
<FromGitter> <sam0x17> the exact method: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5c21e55923323d58bd20067c]
<FromGitter> <sam0x17> excuse the funky variable names -- I'm trying to maintain parity with a well known C++ example
<FromGitter> <sam0x17> @oprypin ^
azuri5 has quit [Quit: azuri5]
azuri5 has joined #crystal-lang
<FromGitter> <sam0x17> for now I am appending instead of prepending, since it shouldn't really matter for a nonce, but still curious what the proper solution is
ashirase has quit [Ping timeout: 245 seconds]
ashirase has joined #crystal-lang
<oprypin> sam0x17, in C they dont have any way to prepend so i'd be really surprised that the API requires it. would it be possible to find an example in C and adapt it?
<oprypin> merging two slices could indeed be useful, strange that that's missing
<yxhuvud> sam0x17: refactor. Create an output buffer that you write to, that you start off by writing the nonce. Then write encrypted data to the buffer.
<oprypin> yea
azuri5 has quit [Quit: azuri5]
azuri5 has joined #crystal-lang
<FromGitter> <proyb6> What is the Ruby JSON.dump equivalent in Crystal?
<FromGitter> <bararchy> parsed = JSON.parse(json_string) ⏎ parsed.to_s # this is the "dump"
<FromGitter> <proyb6> I see, thanks!
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 250 seconds]
return0e_ has quit [Ping timeout: 250 seconds]
return0e has joined #crystal-lang
azuri5 has quit [Quit: azuri5]
azuri5 has joined #crystal-lang
azuri5 has quit [Client Quit]
azuri5 has joined #crystal-lang
azuri5 has quit [Quit: azuri5]
azuri5 has joined #crystal-lang
<FromGitter> <asterite> JSON.dump should be `to_json`...
ua has quit [Quit: Leaving]
ua has joined #crystal-lang
Jenz has joined #crystal-lang
<Jenz> kingsleyh, you here? I'm getting this "Warn ] receive invalid message, will be ignored" message, playing with the sushichain testnet
<FromGitter> <kingsleyh> Hi Jenz - what are you doing when that message occurs - it’s a warning so not a big problem unless you are expecting the message to be sent
<Jenz> sushim -n $testnet -w $wallet --testnet --process 32
<FromGitter> <kingsleyh> Wow 32 threads!
<FromGitter> <kingsleyh> 32 processes !!
Raimondi has joined #crystal-lang
<FromGitter> <kingsleyh> I’ll have a look
<Jenz> With cpu-usage limited to 256% though, hehe
<FromGitter> <kingsleyh> the warning occurs when the miner is communicating with the blockchain over a websocket - I'll try to reproduce it and see what the underlying Exception is
Raimondi has quit [Ping timeout: 240 seconds]
<Jenz> Ok, happened again, this time with 16 processes
<Jenz> Though it happened much later after launch, than with 32 processes
<Jenz> Should probably also mention all processes are cancelled together with that warning, so it should rather be an error shouldn't it?
Raimondi has joined #crystal-lang
Jenz has quit [Quit: leaving]
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <kingsleyh> Yeah sounds like a communications problem
<FromGitter> <kingsleyh> You could try starting a local node and repeating the same test - this would help to understand if it’s a networking issue.
<FromGitter> <kingsleyh> I’ll investigate further tomorrow
Raimondi has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
<FromGitter> <sam0x17> @yxhuvud this is good advice -- thanks -- should I use a new slice as the output buffer? How do I write a slice at a particular position?
<literal> what are the rules for how complex the conditional can be for Crystal to know which types the variables can be?
azuri5 has quit [Quit: azuri5]
<FromGitter> <j8r> literal: https://play.crystal-lang.org/#/r/5urg
<FromGitter> <j8r> What's the prob?
<literal> j8r: uncomment the failing code: https://play.crystal-lang.org/#/r/5urh
<FromGitter> <j8r> I don't know :/
<FromGitter> <proyb6> @asterite Ah, I guess it as much thanks!