<oprypin>
codenoid, there is no string `"/\n/"` anywhere in the text, so the split does not happen
<oprypin>
you want `"\n"` or `/\n/`
<FromGitter>
<codenoid> :# it's silly mistake
<FromGitter>
<codenoid> lol
<FromGitter>
<codenoid> split a new line, okay then
mbarbar has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 250 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 248 seconds]
snsei has joined #crystal-lang
faustinoaq has joined #crystal-lang
<FromGitter>
<GavinRay97> I have what is in all likelihood a really dumb question.
<FromGitter>
<GavinRay97> I'm trying to use Kemal + Kemal REST API to spin up a quick API from a SQLite DB.
<FromGitter>
<GavinRay97> The schema of the DB is such that ⏎ ⏎ Nutrition Ingredient has the base information for an ingredient item, with values for fat/protein/carbs and kcal in 100g increments. ⏎ ⏎ Nutrition Ingredient has many Nutrition Ingredient Weight Units. A Nutrition Ingredient Weight Unit has one Weight Unit, which contains the human readable name for the weight Unit. [http
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<GavinRay97> Is there any way for me to return the Ingredient Weight Units with Weight Unit name? They're associated by foreign and primary keys in the DB, I'm just used to have Rail's Active Record models map associations for me.
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
<FromGitter>
<GavinRay97> This is the code I currently have running, first 20 minutes experimenting with Crystal. I love it, it's blazing fast and I felt like I was just writing Ruby: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a080fef86d308b755da86a3]
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
claudiuinberlin has joined #crystal-lang
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<literal>
is there no terser way than doing "ints = IntOrNil.new; ints.push 6, 7" ?
<literal>
or separating the type alias, having one for the contents and one for the array of those contents, so it would be "alias IntOrNil = Int32 | Nil; alias ArrayOfIntOrNil = Array(IntOrNil); array_storage = [] of ArrayOfIntOrNil.new; array_storage << [6, 7] of IntOrNil"
<Yxhuvud>
I think the best answer would be to not create that kind of arrays in the first place. Why do you need them?
<literal>
never create arrays of Int32 | Nil ? why not?
<literal>
I'm just curious about syntax here, as I'm learning the language
<literal>
I'm iterating over an array of things, and creating chained links of [thing, thing], and the ends will produce [nil, thing] and [thing, nil]
<Yxhuvud>
because, as you have noticed, they are not nice to work with. very often a better answer is to not include the nils in the array, or to wrap your composite datatypes in a tuple/struct instead of in a generic union type.
<literal>
yeah, I could try tht
<literal>
that
baweaver is now known as baweaver_away
<Yxhuvud>
also note that I am not saying to never create them, but rather to think through your types - often there are better ways
<crystal-gh>
[crystal] MakeNowJust opened pull request #5278: Format: insert space between `{` and `%` to prevent writing `{%` (master...fix/crystal-format/5277-insert-space-between-brace-and-percent) https://git.io/vFwS9
<jhass>
anybody did something for cookie signing yet?
qard has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Groogy>
hmm don't get why my texts gets so destroyed on smaller size :/ looks ok in the font texture though
<Yxhuvud>
groogy: alignment? (and yeah, it is not certain it is possible to align properly).
<Groogy>
Yeah tried that but like, moved the sprite rendering the font texture to like 200.5 and stuff like that
<Groogy>
still looks fine there
<Groogy>
though I guess the text is doing this with a lot of small squares so maybe more likely to happen there
<Groogy>
I'm asking on the opengl channel but still no response on ideas
<Groogy>
BAh I give up, it will have to look like crap for now
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
<FromGitter>
<Sevensidedmarble> since crystal doesnt have globals, whats the best approach for flags like 'debug' that you may have to set dynamically and cant use a constant for?
<FromGitter>
<bararchy> instance var with accesor ?
<FromGitter>
<bararchy> or you mean "for all the program to know about the status" ?
<FromGitter>
<Sevensidedmarble> yes the latter
<FromGitter>
<Sevensidedmarble> I want everything to be able to see if debug is true or not
<FromGitter>
<bararchy> ENV var ?
<FromGitter>
<Sevensidedmarble> ah, that could work
<FromGitter>
<bararchy> :)
<FromGitter>
<Sevensidedmarble> can you reopen modules and use them like namespaces?
<FromGitter>
<Sevensidedmarble> I guess I could just make sure my seperate files are all in the same module if they work like namespaces
<Groogy>
you could also make a module
<Groogy>
Debug.is_on?
<FromGitter>
<Sevensidedmarble> there we go, that might be the best option
<Groogy>
and yeah modules work as namespaces as well
<Groogy>
also oh boy I love Crystal
<Groogy>
it seems like it does a runtime lookup when matching arguments on a method call as well which is freaking sweet
<FromGitter>
<Sevensidedmarble> what do you mean?
<Groogy>
it's made my ui code so freaking easy to read/follow
<Groogy>
I have a design class that defines "How do we render let's say a button"
<Yxhuvud>
groogy: iirc it expands to something that works like a switch statement, so if ou have a billion choices it could get slow.
<Groogy>
and all it does is rewrite get_drawer(wdiget) with a defined type like GUI::Button
<Groogy>
and it just maps by itself even if the compile time the type isn't known
<Groogy>
yeah probably but this should only be done when something changes
<Groogy>
I've yet to do the "only re-render this part of the screen" portion but should be coming soon
<FromGitter>
<Sevensidedmarble> I'm just trying to expose a variable to many different files through a module
<FromGitter>
<Sevensidedmarble> never mind I'm stupid
<FromGitter>
<straight-shoota> @RX14 I've tried your new omnibus build, but running the compiler throws a segmentation fault. I don't think I'd need to do anything else beside unpacking, do I?
<RX14>
no
<RX14>
darn
<RX14>
what distro?
<FromGitter>
<straight-shoota> Ubuntu 14.04.5 LTS
<FromGitter>
<straight-shoota> on WSL
<RX14>
i tried on debian 6 and 8, old fedora, and old centos
<RX14>
oh on WSL
<RX14>
well
<RX14>
meh
<RX14>
@straight-shoota
<RX14>
a gdb backtrace might be interesting though
<RX14>
for that segfault
<FromGitter>
<straight-shoota> I'll try to find the core dump file...
<RX14>
why not just run gdb /path/to/script
<RX14>
actually
<RX14>
gdb crystal-0.24.0/lib/crystal/bin/crystal
<FromGitter>
<straight-shoota> okay
<RX14>
then run and bt
<FromGitter>
<straight-shoota> on native ubunutu 16.04.3 LTS it works BTW 👍
<FromGitter>
<unreadable> I simply love go, it gets the job with a ease of use
<RX14>
Its going to be the next Java I'm sure
<RX14>
And that's absolutely not a bad thing
<RX14>
Its fast its simple its portable and it beats Java in concurrency because it has csp
<FromGitter>
<unreadable> I'd love to use Go at a previous job that I was told to rejoin, but damn, they're so damn into c#
<FromGitter>
<unreadable> but for node.js, I think it's a better move
<FromGitter>
<monouser7dig> is there already some work done to optimise crystal code before entering llvm? like reverse.each could get remapped to reverse_each, or x = x.map could be x.map!, language specific things like these?
<FromGitter>
<monouser7dig> if you assign to the same variable?
<Papierkorb>
what if someone else has a reference to it?
<FromGitter>
<monouser7dig> what do you mean? after map is executed x will be altered in both scenarios for anyone referencing it
<Papierkorb>
no it won't.
<FromGitter>
<monouser7dig> btw I'd be willing to try binden on mac cause I'd need some UI things so unless I'd need advanced knowledge already I'd like to try, report back and help out making it work on mac
<FromGitter>
<monouser7dig> I do not understand?
vivus has joined #crystal-lang
<Papierkorb>
gcds got bindgen to run last week. haven't heard back from that though
<Papierkorb>
+on mac ^
<FromGitter>
<monouser7dig> ok I add to my shards.yml run crystal deps, have qt installed (not sure if I even have to?) but get Failed crystal deps build && ext/try_build.sh and nothing in lib folder
<FromGitter>
<monouser7dig> still how is x = x.map different from x.map! ?
<Papierkorb>
that try_build didn't exist for quite a while now.
<Papierkorb>
`def foo(a); a = a.map(..); end`
<Papierkorb>
Please read up on passing by reference if it's still not clear
snsei has joined #crystal-lang
<Papierkorb>
and w.r.t getting it to run on mac, you're on your own basically. you'll have to fullfill all dependencies, which are documented for known-to-work platforms
<FromGitter>
<monouser7dig> see what you mean, have not thought about that, so is there no work in this direction being done or is it planned/ not planned?
<Papierkorb>
And yes, that of course includes Qt bindings. Those generated for linux obviously won't work on mac.
<Papierkorb>
*Qt itself
<FromGitter>
<monouser7dig> Ive got home-brew yt 5.9.2 easy enough but qt-devel or light-devel what you might refer to as other headers/ lib is not available
qard has joined #crystal-lang
qard has quit [Ping timeout: 260 seconds]
balduin has joined #crystal-lang
hightower3 has joined #crystal-lang
snsei has quit [Remote host closed the connection]
hightower4 has quit [Ping timeout: 248 seconds]
qard has joined #crystal-lang
illyohs has joined #crystal-lang
<crystal-gh>
[crystal] wmoxam opened pull request #5282: Fixes issue with linking lib_unwind on OpenBSD (master...fix-openbsd-linking-issue) https://git.io/vFrmy
<crystal-gh>
[crystal] wmoxam opened pull request #5283: Fixes setting IO blocking on OpenBSD (master...fixes-stdio-redirections-on-openbsd) https://git.io/vFrYR
<crystal-gh>
[crystal] jhass pushed 1 new commit to master: https://git.io/vFrYp