ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.2 | 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
notdaniel has quit [Quit: Leaving]
<crystal-gh> [crystal] masukomi opened pull request #6131: OptionParser documentation improvement (master...improved_option_parser_docs) https://git.io/vhqUC
<FromGitter> <girng> For a simple TCP Server with Crystal, would have an SSD over a regular hard drive be negligible or a huge difference in performance?e
<FromGitter> <girng> I was looking at some of these Kimsufi deals, and $14.99/m for a dedicated box, with a i5 750 is amazing. However, their storage is non-SSD
<FromGitter> <bew> @girng if you need to store and access data on it yes, if not it makes almost no difference
<FromGitter> <girng> For example, like using the mysql module excessively?
<FromGitter> <girng> Okay. I guess I should get the SSD then. That sucks, I was really excited to get this dedicated server. Such a gooood deal lol
<FromGitter> <girng> Wow
<FromGitter> <faustinoaq> Interesting `h2o_mruby` is quite fast
<FromGitter> <faustinoaq> I'm wondering how would be an `h2o_crystal` 😉
<FromGitter> <girng> :D
<FromGitter> <faustinoaq> ^^ https://h2o.examp1e.net/
snsei has joined #crystal-lang
<FromGitter> <fridgerator> its http 2.0?
<FromGitter> <fridgerator> are the techempower tests 2.0 enabled?
<FromGitter> <fridgerator> seems dumb
snsei has quit [Remote host closed the connection]
<faustinoaq> @fridgerator no, its h2o XD
<faustinoaq> its the lib name
<faustinoaq> TFB are http/1
p0p0pr37 has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> @faustinoaq you mean with bindings to h2o? Or with a h2o written in Crystal?
p0p0pr37 has joined #crystal-lang
p0p0pr37 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter> <fgimian> Hello folks, hope you're all doing great. Please bear with me as I'm new here (coming from Python-land) :)
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
<FromGitter> <fgimian> I'm currently developing bindings for LibC's pwd and grp libraries which give you a list of users and groups. So far I have everything working great, but have hit just one little snag
<FromGitter> <fgimian> My group struct is as follows: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b08e7ee93dc78791c87f890]
<FromGitter> <fgimian> I've tried the obvious: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b08e82193dc78791c87f92e]
<FromGitter> <fgimian> but no pickle :)
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <bew> Hey, welcome to Crystal !
<FromGitter> <bew> You'll have to make the Array yourself, by traversing each element of the C array of char*, create a String for it and push the String to the Array
<FromGitter> <fgimian> Thank you so much! I'm absolutely in love with this beautiful language.
<FromGitter> <fgimian> Sweet, how can I determine the length of my Char**?
<FromGitter> <fgimian> simply keep going until I get a null pointer?
<FromGitter> <bew> Yes
<FromGitter> <fgimian> awesome, thanks a lot! :)
<FromGitter> <bew> Do you know a bit of C?
<FromGitter> <bew> (or a byte)
<FromGitter> <fgimian> Yeah, I'm rusty, but yeah I started as a C++ dev at uni
<FromGitter> <bew> :P nice!
<FromGitter> <fgimian> 😄 I'll post my solution shortly and let me know if I did ok
<FromGitter> <fgimian> is that ok?
<FromGitter> <bew> Sure!
p0p0pr37 has quit [Remote host closed the connection]
p0p0pr37 has joined #crystal-lang
<FromGitter> <fgimian> ta, I'll be in touch shortly :shipit:
<FromGitter> <bew> @faustinoaq verrry interesting slides about h2o, thanks a lot!
<FromGitter> <fgimian> Okies, here's my solution (which seems to work well): ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b08ed6a352b9e1a4b33a7bd]
<FromGitter> <fgimian> does that look ok?
<FromGitter> <S-YOU> may be use until iterator.value.null?
<FromGitter> <S-YOU> until iterator should be ok
<FromGitter> <fgimian> oh yes, good idea
<FromGitter> <fgimian> thanks
<FromGitter> <S-YOU> because null pointer should be evaluated to false
<FromGitter> <fgimian> true, yeah, I guess there's no real need to use the `null?` as you mention
<FromGitter> <bew> I think you mean `while iterator` or `until iterator.null?`
<FromGitter> <S-YOU> sorry, not until iterator, `while iterator`
<FromGitter> <S-YOU> :D
<FromGitter> <fgimian> ah yes, I just realised that after I crashed it lol
<FromGitter> <S-YOU> sorry xD
<FromGitter> <bew> Hehe
<FromGitter> <fgimian> hahaha nah no problemo
<FromGitter> <fgimian> or we could do `until iterator.value.null?`
<FromGitter> <fgimian> do you guys usually exclude the `.null?` or `.nil?` and rely on truthy of conditional instead?
<FromGitter> <bew> Yeah your last until is correct
<FromGitter> <fgimian> I think I'll leave it explicit for now while I'm learning
<FromGitter> <fgimian> sweet! :)
<FromGitter> <bew> 'cuz the iterator will never be null, it' s value will
<FromGitter> <fgimian> yah, makes total sense 😄
<FromGitter> <bew> It depends what for, but this `.null?` is very handy and I usually use it
<FromGitter> <S-YOU> likely `while iterator.value`, I missed one pointer.
<FromGitter> <fgimian> that's cool, yeah @bew I'm liking the clarity of leaving it in
<FromGitter> <fgimian> np @S-YOU 😸
<FromGitter> <S-YOU> 👍
<FromGitter> <fgimian> I'm going to attempt to write bindings to the unrar library next, I'm a bit intimidated by that one, but it's worth a shot
<FromGitter> <bew> Actually I think I'd go with the while for this one, but that's personal pref'
<FromGitter> <fgimian> kewl
<FromGitter> <fgimian> are you folks aware of any libraries for Crystal that parse plist files (macOS) or that alow a user to obtain details of a RAR file (using the unrar libs) and extra them?
<FromGitter> <fgimian> i realise this is a pretty weird requirement 😄
<FromGitter> <bew> I doubt there is one, but you can check on crystalshards.xyz
<FromGitter> <fgimian> sweet, will do
<FromGitter> <S-YOU> looks like plist is xml?
<FromGitter> <fgimian> it is but sadly there's also a binary format
<FromGitter> <fgimian> I can see there is indeed a library for parsing the XML, but no binary support in there yet
<FromGitter> <S-YOU> binary, I see.
<FromGitter> <fgimian> the binary format also decodes to XML, so it's just that part that frightens me hahaha
<FromGitter> <fgimian> Python has a library to do this in the stdlib which I may reference to see what I'm up against
<FromGitter> <S-YOU> Really, for plist binary?
<FromGitter> <S-YOU> plistlib, I see
<FromGitter> <S-YOU> Interesting
<FromGitter> <fgimian> yeah, to be fair, that only got included in Python 3.x and it seems like a direct import of a library developed by a fella
<FromGitter> <fgimian> 😄
<FromGitter> <fgimian> if I can get the rar bindings to work, then I will probably slowly work on a port of it for Crystal, sllowwwlllly 😄
<FromGitter> <S-YOU> Only bad thing is plistlib is written in python not as C binding xD.
<FromGitter> <fgimian> yeah tell me about it
<FromGitter> <fgimian> I was just searching to see if there is a C library that does the heavy lifting for me
<FromGitter> <fgimian> yeah and it's a good 1,000 lines of code there
<FromGitter> <S-YOU> But binary are always easier to parse.
<FromGitter> <fgimian> is it?
<FromGitter> <fgimian> I can't say I've actually done lots of binary parsing in my time
<FromGitter> <fgimian> the good thing is that I at least have a full reference library that tells me everything I might need to know
<FromGitter> <S-YOU> Well, normally, binary protocol have length fields, you don't really need to write like text parsers.
<FromGitter> <fgimian> aaah gotcha
<FromGitter> <fgimian> good point
<FromGitter> <fgimian> I'm going to try it I think
<FromGitter> <fgimian> it will be a fun project and a good learning experience 😃
<FromGitter> <fgimian> the actual reader isn't all that long in the Python code
<FromGitter> <S-YOU> yeah
<FromGitter> <fgimian> 😄 sweet, will add to the TODO list here hehe
<FromGitter> <S-YOU> I never write OSX application, but may be there one option for binding too. ⏎ https://github.com/comex/pluhttps://github.com/0x73/hoop/tree/master/src/core_foundation
<FromGitter> <fgimian> ooooh, thanks heaps
<FromGitter> <fgimian> I'll check those out shortly 😄
<FromGitter> <fgimian> I actually would like to try and bind to the mac libs too
<FromGitter> <fgimian> as you can see there, they bind to `CoreFoundation.h` which I could do
<FromGitter> <fgimian> I suppose the con to this approach is that the script will only work on macOS (which isn't an issue for me personally, but it just makes it less portable I suppose)
<FromGitter> <fgimian> oh btw, that second library you linked is VERY VERY useful!!!! thank you!
<FromGitter> <fgimian> 💃
<FromGitter> <bew> plist are almost not used anywhere else I think... so...
<FromGitter> <S-YOU> right, that will only work on MacOS.
<FromGitter> <fgimian> yeah, you're right @bew
<FromGitter> <fgimian> yah
<FromGitter> <fgimian> parsing the binary in pure Crystal is kinda appealing though, it sounds like a fun challenge
<FromGitter> <fgimian> 😄
<FromGitter> <S-YOU> True 😄
<FromGitter> <bew> 👍
sz0 has quit [Quit: Connection closed for inactivity]
rohitpaulk has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 248 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <fgimian> I know this is pretty rough, but my first commit of the user / group db is on GitHub now: https://github.com/fgimian/unix_userdb.cr
<FromGitter> <fgimian> I'm starting to wonder, did I do the right thing by using a NamedTuple for each record or should I have used a struct?
<FromGitter> <fgimian> any thoughts welcome 😄
<FromGitter> <S-YOU> I would do`while group = LibC.getgrent`, instead of loop and break
<FromGitter> <fgimian> oh good call, thanks, I was wondering how I could simplify that
<FromGitter> <fgimian> testing that now and will push up
<FromGitter> <S-YOU> 👍
<FromGitter> <fgimian> I'll try to get some unit tests going too, but just need to probably ensure that my CI server will have some users and groups I can test against
<FromGitter> <fgimian> just pushed that fix up, thanks again @S-YOU 😄
<FromGitter> <S-YOU> Cool! 👍
rohitpaulk has quit [Ping timeout: 268 seconds]
ua has quit [Quit: Leaving]
ua has joined #crystal-lang
<FromGitter> <fgimian> Sorry, just gonna throw another question about if that's cool. I need a constant from sys/ioctl.h called `TIOCGWINSZ`. Unfortunately this is computed via a macro as follows: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Would you normally just grab the value from a C program and hard-code that in, or is it possible to replicate this in Crystal? [https://gitter.im/crysta
<FromGitter> ... l-lang/crystal?at=5b091b33016ae21a4ce6335c]
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 245 seconds]
p0p0pr37_ is now known as p0p0pr37
<Guest11714> fgimian, hardcode
<Guest11714> wait what
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> how i can search mongo `ObjectId` with https://github.com/datanoise/mongo.cr
<Guest11714> test
<Guest11714> test
Guest11714 has quit [Quit: Bye]
oprypin has joined #crystal-lang
<oprypin> geez that guest stuff was scary. that was me
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 252 seconds]
Raimondii is now known as Raimondi
hightower2 has quit [Ping timeout: 256 seconds]
<FromGitter> <S-YOU> C macros, and static inlines are a bit problem on writing binding, you need to hard code or remove inlines. ⏎ I normally do like this for defines
<FromGitter> <S-YOU> ```module Constants ⏎ IOCPARM_MASK 0x1fff ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5b09254dba1a351a68c6172a]
<FromGitter> <S-YOU> *IOC, IOC*OUT, _IOR, TIOCGWINSZ you can rewrite it in crystal I guess.
<FromGitter> <S-YOU> I dont know mongo.cr, but something like `ObjectId.new(value)` and pass it that to find or similar method?
<FromGitter> <S-YOU> Or may be `BSON::ObjectId.new(value)`
* FromGitter * fgimian reads
<FromGitter> <fgimian> Sorry, was just at dinner.
<FromGitter> <fgimian> thanks so much @S-YOU and @oprypin for the replies 😄
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
Nik736 has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 256 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <codenoid> i love u @S-YOU
dragonkh has quit [Ping timeout: 264 seconds]
<FromGitter> <S-YOU> 👍
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
alex`` has quit [Ping timeout: 260 seconds]
<FromGitter> <faustinoaq> > you mean with bindings to h2o? Or with a h2o written in Crystal? ⏎ ⏎ @bew bindings, but I think is a nice idea to improve `HTTP::Server` on stdlib using h2o goals :) WDYT?
alex`` has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
faustinoaq has quit [Ping timeout: 252 seconds]
<FromGitter> <S-YOU> I find it, h2o is kind of big library.
<FromGitter> <fgimian> Folks, is there any way to do this with the stdlib in Crystal at the moment? ⏎ ⏎ ```In [6]: os.path.relpath("/Users/fots/Downloads", "/Users") ⏎ Out[6]: 'fots/Downloads'``` [https://gitter.im/crystal-lang/crystal?at=5b095303ba1a351a68c691ac]
<FromGitter> <fgimian> I don't believe it is, but just thought I'd double check
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
<FromGitter> <fgimian> I believe this is how Ruby does it: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b0953a752e35117cde29fbf]
p0p0pr37 has quit [Ping timeout: 265 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <faustinoaq> @fgimian I think crystal can't do that yet 😅
<FromGitter> <fgimian> @faustinoaq no worries Faustino, thanks a lot for the reply 😄
<FromGitter> <j8r> @fgimian you would like to have the real path of a symlink?
<FromGitter> <faustinoaq> Would be nice to have `Path.relative_path("/Users/fots/Downloads", "/Users") # => #<Pathname:fots/Downloads>`, though
<FromGitter> <faustinoaq> Looks like a nice PR todo 😉
<FromGitter> <fgimian> @faustinoaq yes, or perhaps in the File library 😄
<FromGitter> <faustinoaq> 😄 👍
<FromGitter> <fgimian> @j8r nah, I'm looking to obtain the relative directory of one directory against another
<FromGitter> <j8r> Ha ok. This work with absolute and relative path in Ruby?
<FromGitter> <fgimian> another little function that I find handy in Python (that I just re-implemented in Crystal) is, determining if a path is a mountpoint
<FromGitter> <fgimian> @j8r it does in Python, but I haven't played with the Ruby lib so much tbh (I'm coming from Python-land) 😄
<FromGitter> <fgimian> It's actually super smart, I'm tempted to just port the Python algorithm because I know it works well hehehe
<FromGitter> <j8r> @fgimian You can do `File.expand_path("/Users/fots/Downloads","/Users").lstrip("/Users")`
<FromGitter> <fgimian> I considired that @j8r but this sadly doesn't cover the many other things that the `relpath` function can do
<FromGitter> <fgimian> e.g. check this out
<FromGitter> <fgimian> ```In [15]: os.path.relpath("/Users/fots/Downloads", "..") ⏎ Out[15]: '../../../../Downloads'``` [https://gitter.im/crystal-lang/crystal?at=5b09587616f6496124e159d4]
<FromGitter> <fgimian> I'm trying to port it atm
<FromGitter> <j8r> I don't understand the result
<FromGitter> <j8r> does it depends on the working directory?
<FromGitter> <fgimian> perhaps if I show you where I was when I ran it, it would make more sense, sorry, I'll show you now
<FromGitter> <fgimian> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b0959cfc712f56125345507]
<FromGitter> <fgimian> what it's doing there is taking my parent directory "/Users/fots/Documents/Development/fresh-language/crystal" as the starting point and saying, what do you need to do to arrive at "/Users/fots/Downlads"
<FromGitter> <fgimian> which as you can is ../../../../Downloads
<FromGitter> <j8r> Ok thanks I understand now :)
<FromGitter> <fgimian> np 😄
<FromGitter> <fgimian> your solution would work, but you must first `File.expand_path`
<FromGitter> <j8r> Ok I start to understand how it works
<FromGitter> <j8r> There is two modes: absolute and relative
<FromGitter> <j8r> For each argument it evaluate if its absolute (starts with '/') or relative
<FromGitter> <j8r> this is purely string manipulation. I can write invalid path
That_Guy_Anon has quit [Remote host closed the connection]
<FromGitter> <fgimian> Well in case anyone's interested, here's a port of both the mount and relpath functions from Python
<FromGitter> <fgimian> I think there's still a few bugs to iron out, I will see if I can run some seriously thorough unit tests over these
* FromGitter * fgimian has already found a bug 😟
<FromGitter> <fgimian> ok fixed ... 🐌
<FromGitter> <fgimian> little demo: ⏎ ⏎ ```fots/Downloads ⏎ ../../../../Downloads ⏎ Users/fots/Downloads ⏎ .. ⏎ .``` [https://gitter.im/crystal-lang/crystal?at=5b0968fcba1a351a68c6d097]
<FromGitter> <fgimian> Well, I'm off for the evening, thanks for your help guys 😄
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
<FromGitter> <manveru> damn, somehow my server keeps crashing
<FromGitter> <manveru> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b09767fedd06f7d15e6585a]
<FromGitter> <manveru> any idea what that is?
<FromGitter> <manveru> ah, i think i know
<FromGitter> <manveru> another bug i fear :|
<FromGitter> <manveru> pretty sure that should be caught by the type system too :)
That_Guy_Anon has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
dragonkh has joined #crystal-lang
<dragonkh> hi - how can I turn an Array(UInt8) into a Slice(UInt8) ?
<dragonkh> do I have to turn it into a String and then use to_slice?
<dragonkh> seems like I should be able to get a Slice somehow from Array without turning it into a String first
<dragonkh> maybe unsafe_as(Bytes)
<dragonkh> yeah unsafe_as(Bytes) does work - but if anyone knows a better way - please let me know :
<crystal-gh> [crystal] RX14 closed pull request #6131: OptionParser documentation improvement (master...improved_option_parser_docs) https://git.io/vhqUC
greengriminal has quit [Quit: Leaving]
<oprypin> i know a better way
<oprypin> unsafe_as(Bytes) returns garbage
<dragonkh> oprypin ok - how should I do it?
<oprypin> dragonkh, `a.to_unsafe().to_slice(a.size)`
<dragonkh> oprypin ah great thanks that works
<FromGitter> <Grabli66> Can i cast class instance to slice? someInstance.to_unsafe().to_slice() ?
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 245 seconds]
p0p0pr37_ is now known as p0p0pr37
<travis-ci> crystal-lang/crystal#3c887de (master - OptionParser documentation improvement (#6131)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/384120358
<DeBot> https://github.com/crystal-lang/crystal/pull/6131 (OptionParser documentation improvement)
<FromGitter> <manveru> well, made an issue for the crash if someone wants to try it: https://github.com/crystal-lang/crystal/issues/6132
s0bait has joined #crystal-lang
<s0bait> Heyo
<s0bait> Where can I read how Crystal lexer? Also.. surprise to see that the LLVM code is not C but Crystal.
<FromGitter> <bew> @Grabli66 it doesn't make sense to me, why do you need that?
rohitpaulk has joined #crystal-lang
<hmans> Can I have a shard.yml dependency loaded from a local path within my project (but outside of `src`)?
<hmans> ie. I want that path to be added to the require load path, but still version my to-be-extracted-into-an-actual-shard code with my app
<hmans> manveru, I'll give that a try, hoping it'll do relative paths... lemme give it a shot.
<s0bait> Found the lexer, but still not sure how the compiler of Crystal is written in Crystal.
<FromGitter> <bew> It's written with the prev
<FromGitter> <bew> Oops
<hmans> manveru, ah, it creates a symlink in lib/, so that should work. Thanks!
<FromGitter> <bew> It's written with the previous stable version of Cystal @s0bait
<FromGitter> <bew> At the beginning the compiler was written in Ruby, then as the language grew it the compiler written in Ruby could build a compiler written in Crystal, that can compile itself
<hmans> Random unconstructive take: it drives me nuts that the tool is named "shards" while the files are named "shard"... please don't mock me
s0bait has quit [Ping timeout: 260 seconds]
<FromGitter> <drum445> Hello, what is the recommended way to turn a MySQL result set into an object
<FromGitter> <drum445> The result set has a lot of columns, so doing ```rs.read(String)``` over and over doesn't seem ideal
That_Guy_Anon has quit [Ping timeout: 245 seconds]
That_Guy_Anon has joined #crystal-lang
s0bait has joined #crystal-lang
<FromGitter> <bhargavrpatel> Ah that makes sense Benoit
s0bait has quit [Client Quit]
rohitpaulk has quit [Ping timeout: 248 seconds]
That_Guy_Anon has quit [Remote host closed the connection]
<FromGitter> <Grabli66> @bew I don't know :)
<FromGitter> <drum445> How can I make an Array can contain any type
<FromGitter> <drum445> similar to interface{} in g
<FromGitter> <drum445> Something like ```Hash(String, T).new
jongar has joined #crystal-lang
<Yxhuvud> Any type? You can't. You can make it contain multiple types by doing Hash(String, Foo | Bar | Baz).new though
<FromGitter> <bew> How would you use such a hash if you could? @drum445
<FromGitter> <drum445> I used a JSON builder instead
<FromGitter> <drum445> cheers
<FromGitter> <drum445> what you reckon?
<FromGitter> <drum445> would appreciate some feedback
<hmans> Why would I not just use eg. Crecto?
<FromGitter> <bew> Isn't there a DB.mapping
<FromGitter> <bew> Using json for that is wrong
<FromGitter> <bew> https://crystal-lang.github.io/crystal-db/api/0.5.0/DB.html#mapping%28properties%2Cstrict%3Dtrue%29-macro
<FromGitter> <drum445> ha
<FromGitter> <drum445> yep that is better, thought I'd give it ago, didn't know that existed
<FromGitter> <drum445> @bew how can you use Json.mapping with that?
<FromGitter> <bew> You don't, why would you want that?
<FromGitter> <drum445> So I can go DB -> Crystal -> JSON response
<FromGitter> <drum445> in my api
<FromGitter> <bew> Currently you have to write 2 mappings, on for json, one for db
<FromGitter> <drum445> indeed, but the json mapping causes initializer issues
<FromGitter> <bew> ?
<FromGitter> <drum445> oh I see, I have to add everything in my db mapping to my json mapping
<FromGitter> <drum445> welp
<FromGitter> <drum445> god this just feels like a hack
<FromGitter> <drum445> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b09ab4f54ce23136158b05e]
<FromGitter> <drum445> like that doen't look good
<FromGitter> <bew> You can use a constant for the actual mapping
<FromGitter> <drum445> ?
<FromGitter> <bew> And expand it with a small macro to the json & db mappings
<FromGitter> <drum445> I don't follow I'm afraid
<FromGitter> <drum445> seems like returning a db set as json would be a very common thing people need to do
<FromGitter> <drum445> especially in the age of REST APIs
<oprypin> first of all, next crystal release has a solution to this
<FromGitter> <drum445> next release?
<FromGitter> <drum445> also is there an example of that second post please?
<FromGitter> <bew> Was thinking about that one https://carc.in/#/r/3v7d
<FromGitter> <bew> @oprypin next release will give the tools for another solution, but there application for json/db/etc will need to wait a bit more
<FromGitter> <drum445> nice one, that's ace, cheers @bew. Do we have any docs on how the next release will solve this issue oprypin?
<FromGitter> <Grabli66> Release, come to us. 😄
<hmans> Woah...: Codegen (linking): 00:00:14.766470000
<hmans> That's within a Docker container.
<hmans> Outside (on macOS) the linking step takes <1s
hmanssi has quit [Quit: hmprf]
<hmans> I would have been less surprised by the actual compilation taking longer, but... linking?
<hmans> Okay, I've tried it on a straight Linux server -- and inside a container -- and it's much faster, so I'm blaming Docker for Mac's extra virtualization.
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
<FromGitter> <bew> that's because docker can't run natively on mac, so there's an overhead
<hmans> Obviously. I'm just surprised that there is such a _large_ impact, and it's _just_ in the linking step.
<hmans> It's 14-16 seconds vs slightly under 1 second. All the other compilation steps are mostly okay.
rohitpaulk has joined #crystal-lang
<hmans> Ah, I figured it out
<hmans> The delay wasn't because of the linking per se, but the linking's _result_ -- an executable of many hundred KB that I was dumping into my project directory, which of course I've been mounting all the way from my macOS into the Docker VM into the container (which, of course, is butt slow.)
<hmans> So it was merely the writing of the executable that was taking up all that time. Cool!
<hmans> Which means I can dump the executable into a path that I will mount as a non-external volume, and voila, it's fixed.
rohitpaulk has quit [Ping timeout: 268 seconds]
<FromGitter> <galvertez> from this issue https://github.com/crystal-lang/crystal/issues/6094 ⏎ ⏎ ```annotation Bla ⏎ end``` ⏎ ⏎ i can't seem to find any documentation to read on `annotation` anyone got a pointer? [https://gitter.im/crystal-lang/crystal?at=5b09baa593dc78791c8a2359]
<oprypin> galvertez, there is no documentation, the PR is your best bet
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 256 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <galvertez> alright fair enough. thanks for saving me hours of searching lol
jongar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <thewalkingtoast> Is there anything like byebug?
<hmans> thewalkingtoast: short answer, no.
Nik736 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Groogy has joined #crystal-lang
<FromGitter> <girng> @drum445 Yeah, that's where a macro comes in handy haaha I had same issue last month. Opyrpin helpd
p0p0pr37_ has joined #crystal-lang
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<FromGitter> <girng> https://www.kimsufi.com/us/en/servers.xml Look at the FRANCE i5 750 one, that is an insane deal. Too badI need something in the USA
<FromGitter> <girng> But I just remembered, these all have HDD not SSD :( damnit
<FromGitter> <bew> @thewalkingtoast there is gdb, but you won't be able to see most of the objects
<crystal-gh> [crystal] chris-huxtable opened pull request #6133: Feature: File Atomic Write (master...feature/atomic_write) https://git.io/vhqMw
<FromGitter> <bew> @thewalkingtoast the thing is, Ruby runs in a virtual machine, on which you can have full control. Crystal runs natively, so there is no VM in between that you can control as easily
<FromGitter> <thewalkingtoast> That's what I was fearing. Thanks for confirming. :)
<Groogy> is there a way to make an empty proc?
<oprypin> clarify
<FromGitter> <thewalkingtoast> I made a URL shortener that uses Redis and does simple stat counting.
<FromGitter> <thewalkingtoast> https://github.com/thewalkingtoast/mpngin
<FromGitter> <thewalkingtoast> It will go into production shortening URLs for SMS in our Rails app next week. =)
<Groogy> oprypin, eh like Tuple.new
<oprypin> i still don't really get it
<Groogy> a dummy proc that does nothing?
rohitpaulk has joined #crystal-lang
<FromGitter> <bew> ->{}
<oprypin> >> -> { }
<DeBot> oprypin: # => #<Proc(Nil):0x55b957604290> - https://carc.in/#/r/45em
<Groogy> thx
<FromGitter> <bew> Groogy: but why?
<Groogy> no experimenting with stuff and just needed it to test a part in the api quickly without rewriting everything
<Groogy> trying to get windows to go to front by hovering over them by using already in place things but seems like it won't be that easy :/
<Groogy> they keep flipping back and forth
rohitpaulk has quit [Ping timeout: 245 seconds]
<Groogy> oh boy you know when you been staring at a thing and you realize you've just been insanly dumb?
<Groogy> I forgot to early out of the loop >.<
<FromGitter> <drum445> everyone's favourite bug
<FromGitter> <decal> How do I get docs for a specific Crysyal method from the command line? is. with Ruby I can do: ri String#split
<FromGitter> <bew> there is no such thing yet, didn't know that for ruby, that's very handy! Maybe this could be done with`crystal docs --format json`, save that some place, and make some queries to get the docs you want, that'd be a nice tool to have
<Groogy> ugh too tired but code didn't turn out the pretiest, had to fix rendering to make sure it always does it in the same order no matter what widgets triggers rerendering 😩
<Groogy> it feels very "not crystal-esque"
p0p0pr37_ has joined #crystal-lang
p0p0pr37 has quit [Ping timeout: 245 seconds]
p0p0pr37_ is now known as p0p0pr37