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
guilleiguaran has joined #crystal-lang
<FromGitter> <girng> good afternoon all!
<FromGitter> <j8r> Hell @girng
<FromGitter> <j8r> Very happy because I've finally succeed to my single macro CLI, soon in a shard
<FromGitter> <girng> cool whats it do?
<FromGitter> <girng> i can add it to my shard depends n play aronud with it if you'd like
<FromGitter> <j8r> An example: https://carc.in/#/r/3x0o
<FromGitter> <j8r> I will create a shard for this
<FromGitter> <j8r> What's nice is everything is done in a NamedTuple. ⏎ Maybe I need to support other types than String - dunno
<FromGitter> <j8r> Bonus: You can have a CLI all in Spanish, Deutsch, Francais whatever including errors
<FromGitter> <faustinoaq> Hi @/all crystal community, can I get some πŸ‘ here πŸ‘‰ https://github.com/Microsoft/vscode/issues/48332
<FromGitter> <girng> upvoted, thx
<FromGitter> <faustinoaq> Last issue was closed because didn't have enough πŸ‘ πŸ˜…
<FromGitter> <girng> why they close it based on upvotes?
<FromGitter> <girng> doesn't seem fair
<FromGitter> <faustinoaq> because they use a bot
<FromGitter> <girng> it should be about functionality
<FromGitter> <girng> prejudiced
<FromGitter> <j8r> omg look at the number of issues
<FromGitter> <j8r> vs Atom, twice as much
<FromGitter> <faustinoaq> Yeah, I tweeted that some time ago:
<FromGitter> <j8r> I've seen the Atom team taking very seriously how handle their increasing number of issues - they had made bots, tags etc
<FromGitter> <faustinoaq> VSCode uses bot as well
<FromGitter> <faustinoaq> but sometime the bot goes crazy πŸ˜…
<FromGitter> <girng> i was going to move to vscode from sublime but not sure if i should yet
<FromGitter> <faustinoaq> and closes all issues he want to close πŸ˜…
<FromGitter> <j8r> I'll stick with `busybox vi` lol
<FromGitter> <faustinoaq> @girng I still use VIM, VSCode is super nice but is an electron-app, so huge memory and not as fast as sublime πŸ˜…
<FromGitter> <j8r> I use Atom, Geany, Micro and busybox vi depending of the use case
<FromGitter> <girng> yeah i heard it's in electron which is basically it's done in HTML?
<FromGitter> <faustinoaq> Yep
<FromGitter> <faustinoaq> vim plugin for crystal by @rhysd is pretty nice, see: https://github.com/rhysd/vim-crystal
<FromGitter> <j8r> this is basically a web app, with a Chromium embedded
<FromGitter> <j8r> there is also NeoVim
<FromGitter> <faustinoaq> I still use VSCode because debugging and vscode diff tool are awesome ✨
<FromGitter> <girng> why do they use an entire chromium just for a text editor?
<FromGitter> <j8r> because they are web dev, and most of us knows web techs if guess
<FromGitter> <Sija> big market, big cool-ness factor
<FromGitter> <faustinoaq> Yeah, the idea behind electron is to use what devs already know HTML+CSS+JS
<FromGitter> <girng> people should start using Godot for ui tools. much faster, no bloat, very low memory usage. has great ui tools
<FromGitter> <faustinoaq> ^^ https://electronjs.org
<FromGitter> <j8r> there is still no perfect editor out of there, maybe Geany - an editor that thinks like an IDE, contrary of Atom-VSCode that are editor that thinks IDE
<FromGitter> <girng> and it has canvas culling effect for any ui element
<FromGitter> <girng> it's not just a game engine
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <faustinoaq> I like QT, I'm using KDE Desktop and is very nice πŸ˜„
<FromGitter> <j8r> A bit same, I 'm also on Manjaro but LXQT
<FromGitter> <j8r> KDE is nice... but to be honest, a bit bloated (like GNOME btw)
<FromGitter> <faustinoaq> ((https://i.imgur.com/hn732uD.gif)) ⏎ ⏎ ^^ QT bindings for crystal by @Papierkorb ⏎ ^^ https://github.com/Papierkorb/qt5.cr [https://gitter.im/crystal-lang/crystal?at=5adbe4a215c9b03114202e16]
Yxhuvud has joined #crystal-lang
<FromGitter> <Sija> over a month passed & there r still no nightlies support on Travis CI (refs #5836) :(
<DeBot> https://github.com/crystal-lang/crystal/issues/5836 (Using nightly builds on Travis CI is broken)
<FromGitter> <j8r> Starred!
<FromGitter> <Sija> that’s real PITA… is setting up debian apt repo for β€˜em is rly that hard?
<FromGitter> <girng> @faustinoaq in your example on that github, you can actually do all that syntax highlighting and add it through code in Godot's TextEdit node. It actually has tons of method to change functionality to make it act like any text editor you want, it's very cool you should play around with it sometime. Even has a built in "intellisense like" menu for methods
<FromGitter> <Sija> I’d do it myself but don’t have access, damn it
<FromGitter> <faustinoaq> @Sija I'm optimistic, I think the core team at Manas can do something about that, maybe they are very busy right now πŸ˜… ⏎ ⏎ I hope the new paid core team developer can get rid of some issues πŸ˜…
<FromGitter> <faustinoaq> @girng Nice, Thank you! πŸ‘
<FromGitter> <Sija> @faustinoaq I hope so too :)
<FromGitter> <faustinoaq> > KDE is nice... but to be honest, a bit bloated (like GNOME btw) ⏎ ⏎ @j8r What? not my friend KDE is not bloated anymore, KDE plasma 5 is very fast and lightweight πŸ˜„ ⏎ ⏎ My pc is an low end machine with 4 years old and latest Manjaro KDE runs excellent ✨ [https://gitter.im/crystal-lang/crystal?at=5adbe6165f188ccc158d5498]
<FromGitter> <faustinoaq> Hey, someone knows Ruby, Julia, Elixir, Lua, channels to promote my issue ? πŸ‘‰ https://github.com/Microsoft/vscode/issues/48332
<FromGitter> <j8r> it takes a quite of bunch of memory @faustinoaq
<FromGitter> <j8r> My LXQT starts with 150MB :-D
<FromGitter> <faustinoaq> because if I don't get enough πŸ‘ in some specific time then the lovely `vscode-bot` can close my issue 😟
<FromGitter> <girng> im working on a godot server manager for crystal tcp servers
<FromGitter> <girng> going to be EPIC
<FromGitter> <j8r> @girng on the server side what is generally used in Godot dev?
<FromGitter> <faustinoaq> @j8r Oh, ok, well, you're right then, KDE starts with ~400MB πŸ˜…
<FromGitter> <girng> @j8r People just pick and choose whatever i guess. nodejs, crystal, golang, rust, julia, elixir, etc. I guess any language that has a tcpserver class. However, there is "official" godot networking support, but you have to compile the godot engine as a "server", and GDScript (their language) isn't nearly as fast as crystal, nodejs, or other languages. I mean it's fast enough for client side game programming, but
<FromGitter> ... for networking I don't think it's the right choice. ⏎ ⏎ Plus, a Godot server doesn't have access to all the cool modules that crystal has like `db`, `digest`, shell-table or if using nodejs, access to the entire npm system. So I always find it funny how they recommend to use the engine as a server, it's much better to ... [https://gitter.im/crystal-lang/crystal?at=5adbe8e75f188ccc158d5bb5]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <j8r> thanks for the detailed explanation! Nice to have the choice :-)
<FromGitter> <girng> @j8r :D
<FromGitter> <girng> im looking over the api docs now for System. is it possible to retrieve memory usage, cpu usage, or other OS stuff similar to what's inside `top`?
<FromGitter> <j8r> Hum this is quite thighted with the OS, i guess Linux in your case
<FromGitter> <j8r> I plan to create a new shard based on https://github.com/NeuraLegion/hardware
<FromGitter> <girng> oh sweet. i just saw that on crystal shards
<FromGitter> <girng> i should be ok to use that 4 now?
<FromGitter> <j8r> I'haven't tested yet
<FromGitter> <girng> hey, that's from @bararchy :D
<FromGitter> <girng> "it behaves wierd on Ubuntu" im on WSL so
<FromGitter> <j8r> Exactly! I've cliqued on him, and then on its organization and then this :-P
<FromGitter> <girng> maybe i should wait hahahaha
<FromGitter> <j8r> what weirdness do you have?
<FromGitter> <girng> ok 1 sec let me fiddle around with it
That_Guy_Anon1 has joined #crystal-lang
That_Guy_Anon1 has quit [Client Quit]
<FromGitter> <girng> it works good!
<FromGitter> <girng> mem_used should be MB, not %. my apologies
<FromGitter> <girng> i wonder if it's possible to send over all the `htop` values as a to_json over tcp
<FromGitter> <girng> gosh that would be perfect
That_Guy_Anon has quit [Ping timeout: 265 seconds]
<FromGitter> <j8r> why?
<FromGitter> <girng> for my server manager in godot it would be awesome
<FromGitter> <girng> i could see what's running, etc all in one place
<FromGitter> <j8r> The best will be not use htop
<FromGitter> <j8r> or any front end
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <j8r> but yeah, you can grab the values in the Linux files used by htop and send them!
<FromGitter> <girng> crystal can execute a command and get the output of it right?
<FromGitter> <j8r> but that's a bad idea, this adds overhead and complexity
Yxhuvud has joined #crystal-lang
<FromGitter> <j8r> The second point of creating a new shards is to have the stats for one/multi process
<FromGitter> <j8r> the problem with htop the interactiveness
<FromGitter> <girng> so, top/htop just read from a file?
<FromGitter> <j8r> of course, multiple file in /proc/stats /proc/cpuinfo etc
<FromGitter> <j8r> All i text and files, this is the UN*X way
<FromGitter> <girng> i guess we can just do that in crystal like how this hardware shard does it. ok so yeah, yourright that would be weird to get the output of a cmd lol
<FromGitter> <girng> when we can just read the files
<FromGitter> <girng> makes sense, thx
<FromGitter> <girng> i wonder if there is a linux thing does grabs al this data and puts itinto a json
<FromGitter> <j8r> because htop send continuously a view when refreshing, and for now in Crystal (AFAIK): You exec, you wait, you have the values
<FromGitter> <faustinoaq> @girng Oh, I just realize godot isn't made in go, I always though that πŸ˜…
<FromGitter> <girng> LOL
<FromGitter> <faustinoaq> Go-Dot
<FromGitter> <j8r> I thought it was in Dot.net !
<FromGitter> <j8r> hahaha
<FromGitter> <faustinoaq> XD
<FromGitter> <girng> @faustinoaq name originated from this: https://en.wikipedia.org/wiki/Waiting_for_Godot
<FromGitter> <girng> basically, "waiting for godot to become the best engine there is, just keep adding to it infinitely"
<FromGitter> <j8r> @girng this will your job to build the JSON, YAML, INI or whatever. In the background you will call methods ;-)
<FromGitter> <faustinoaq> @girng πŸ‘
<FromGitter> <girng> i want a linux package to build that json for me :D then i can just read the file from crystal, send it over tcp πŸ˜‚
<FromGitter> <j8r> You just want another service that expose you sys stats as aJSON API?
<FromGitter> <girng> although, that's another read-write operation. however, premature optimization is the root of all evil!
<FromGitter> <girng> jk xDDD
<FromGitter> <j8r> There is surely one out of there
<FromGitter> <girng> @j8r hell yeah that be awesome lol
moei has quit [Read error: Connection reset by peer]
<FromGitter> <girng> *furiously googling*
<FromGitter> <j8r> there is the infamous https://github.com/firehol/netdata
<FromGitter> <girng> lol holy
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <j8r> it appears to have an API
Yxhuvud has joined #crystal-lang
<FromGitter> <girng> that's what i want to do, but i want to do it in crystal not HTML dom. but i only want the first part. cpu usage, memory, disk, and network. don't relly need all the other stuff below that.
<FromGitter> <j8r> yes, the web UI is not needed
<FromGitter> <girng> do it in Godot*
<FromGitter> <girng> did i just say crystal lmfao my bad
<FromGitter> <girng> now that get's me thinking.....
<FromGitter> <girng> imagine if Crystal was used in the godot engine instead of GDScript!
<FromGitter> <girng> Holyeeee :D
moei has joined #crystal-lang
<FromGitter> <girng> thanks j8r i'll take a look
<FromGitter> <j8r> but not sure it will fit your needs
<FromGitter> <sam0x17> @RX14 is it possible to run i3 in a window / I love it but want to run it within its own window in my existing window manager
<FromGitter> <girng> i found this: https://gist.github.com/walm/e084e5184bc14da9ddbe
<FromGitter> <j8r> yeah but why do in shell what you can do in Crystal
<FromGitter> <j8r> you need to call at least 4 binaries here
<FromGitter> <j8r> I will do one in Crystal, will be fun :-)
<FromGitter> <girng> so just read from `/proc/stats /proc/cpuinfo` files and send it over tcp?
<FromGitter> <girng> that be easiest?
<FromGitter> <girng> only takes two `File.open` calls
<FromGitter> <bew> @sam0x17 try Xephyr it's a tool that allows you to have an X display running in another X display (e.g: to do some tests)
<FromGitter> <j8r> The best/easiest is to use a shard that parse this for you, and you have just to put them in a Hash, then to_json
<FromGitter> <girng> could use struct?
<FromGitter> <j8r> Like the `hardware` shard
<FromGitter> <j8r> you call methods that returns values, and you do whatever you want with
<FromGitter> <j8r> but I've a quetion
<FromGitter> <girng> ok im looking at hardware.cr now, gonna study it
<FromGitter> <j8r> Do you plan to have it integrated to you game server, or don't matter?
<FromGitter> <girng> yeah it will be, i'll login with a key on master server to get data
<FromGitter> <girng> basically this hardware shard is PERFECT,just wish for more information
<FromGitter> <j8r> Like the memory/cpu usage of a process/PID ?
<FromGitter> <girng> and pool data every 1 second to send over tcp to update server manager display on Godot
<FromGitter> <j8r> I had to go, see you!
<FromGitter> <girng> @j8r i mean that would be cool to have , but not really essential
<FromGitter> <girng> ttyl, ima fiddle around with hardware.cr
<FromGitter> <girng> ```code paste, see link``` ⏎ ⏎ @j8r I GOT IT!! [https://gitter.im/crystal-lang/crystal?at=5adbfd227c3a01610d08e999]
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Client Quit]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
Nathanaelle has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
<FromGitter> <bararchy> @girng it should be able to get you MB, but its a shard that will need more love
Yxhuvud has joined #crystal-lang
<FromGitter> <girng> i never really knew the system info was stored in files before i gues i just need to read whatever relevant file i need
<FromGitter> <bararchy> Anyway if you or @j8r wana use it have fun, of you can make it better let me know or PR or just roll your own and ping me for reference, might use yours :)
<FromGitter> <girng> i always thought the linux commands were calling c kernal code or something and then just displaying it. never knew `top` was reading from a file
<FromGitter> <girng> now i can understand why crystal's System class is kind of bare. Because File.read can give you all the stuff you need
Yxhuvud has quit [Client Quit]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang
<FromGitter> <joshuaobrien> Hi, all. Is this the right place to get help with a relatively basic issue I am having?
<FromGitter> <bew> Yes :)
<FromGitter> <joshuaobrien> ```code paste, see link``` ⏎ ⏎ From my understanding, I would have thought that the compiler would see `@root.a = Array(Foo).new` and then treat `@root.a` as an `Array(Foo)`, but I think I have made a bad assumption here! Help is appreciated :) [https://gitter.im/crystal-lang/crystal?at=5adc18867c3a01610d093282]
benharri has quit [Quit: The Lounge - https://thelounge.github.io]
benharri has joined #crystal-lang
<FromGitter> <r00ster91> this seems to work: https://play.crystal-lang.org/#/r/3x1j/edit
<FromGitter> <faustinoaq> Yep, and you can use `.try` as well, see: https://play.crystal-lang.org/#/r/3x1m
<FromGitter> <fridgerator> @joshuaobrien since your type is `Array(Foo)?`, the question mark means it could be nil
<FromGitter> <faustinoaq> or `.not_nil!`, see: https://play.crystal-lang.org/#/r/3x1p (not recommended)
<FromGitter> <fridgerator> and the method `<<` doesn't exist for nil
<FromGitter> <fridgerator> you could remove the `?` and create the new array in the initialize so its never nil (if thats what you intend)
<FromGitter> <fridgerator> https://play.crystal-lang.org/#/r/3x1t
<FromGitter> <joshuaobrien> I think I assumed incorrectly that `@root.a = Array(Foo).new` would effectively serve the same purpose as a nil check - guess I was wrong
<FromGitter> <joshuaobrien> Thanks for the help everyone
<FromGitter> <joshuaobrien> For Crystal, is it idiomatic to avoid using nil where possible?
<FromGitter> <DennisRodgers> Hello
<FromGitter> <fridgerator> @joshuaobrien its good to avoid if its not necessary, but I dont think its idiomatic to crystal
<FromGitter> <fridgerator> @DennisRodgers hi
<FromGitter> <girng> hello!!
<FromGitter> <girng> why do people dislike OOP so much?
alex`` has joined #crystal-lang
qard has joined #crystal-lang
<FromGitter> <bararchy> @girng because its considered old-school approach, and functional is all the rage those days
<FromGitter> <girng> i'm watching this user's video here (https://www.youtube.com/watch?v=IRTfhkiAqPw), and he is using a ruby example
<FromGitter> <girng> to me, the ruby example with Classes makes the code more organized....
<FromGitter> <girng> i like classes...
<FromGitter> <bararchy> @girng so do I, having something being used for long does not necessarily makes it bad
qard has quit [Quit: qard]
<FromGitter> <girng> agreed
qard has joined #crystal-lang
<FromGitter> <girng> at 13:12, the code difference from the OOP design and his, is actually really smaller and i understand the procedural one better lol
<FromGitter> <girng> but his first example, of the PatentLogger didn't make sense to me, but this one did
qard has quit [Quit: qard]
qard has joined #crystal-lang
qard has quit [Quit: qard]
<FromGitter> <schoening> I'm trying to go through the API and source code of Crystal because I am interested in how primitives like Int32 or Bool return their value and not something like <Int32:0x123abc> when the object itself it is printed via "puts" could I get some explaination or where/what to look for? Is it done via macro magic?
<oprypin> schoening, it's just `to_s`
<FromGitter> <schoening> @oprypin but where is the program told to invoke to_s ? Is it in the print function? I dont have to do "puts myInt32.to_s", I just "puts myInt"
<oprypin> schoening, have you thought that perhaps the `puts` function has some code in it? code that might call .to_s ?
<FromGitter> <schoening> Yes I have, that is what I just asked
<oprypin> well it does
<FromGitter> <schoening> So, something like this: https://play.crystal-lang.org/#/r/3x2h ⏎ This has absolutely no real world value to anything I am working on, I am just trying to learn how all of this works.
<oprypin> schoening, canonical example https://carc.in/#/r/3x2l
<FromGitter> <schoening> @oprypin Thanks :) I just tried and was confused why the output was empty, I forgot the io << @value part :)
<FromGitter> <girng> hello @oprypin
<FromGitter> <faustinoaq> Hello, Does someone know how to write specs for `STDIN.gets` ?
<FromGitter> <faustinoaq> because `STDIN.gets` is blocking πŸ˜…
<FromGitter> <faustinoaq> I tried: ⏎ ⏎ ```spawn do ⏎ STDIN.puts "abc" ⏎ end ⏎ output = STDIN.gets.to_s ⏎ output.should eq("abc\n")``` [https://gitter.im/crystal-lang/crystal?at=5adc500a2d0e228d7b9bd0d1]
<FromGitter> <faustinoaq> 1) `STDOUT.puts`
<FromGitter> <faustinoaq> but specs got blocked πŸ˜…
<oprypin> faustinoaq, dont use stdin in tests, stub it out, make your code more reusable
Groogy2 has joined #crystal-lang
Groogy has quit [Disconnected by services]
Groogy2 is now known as Groogy
Groogy_ has joined #crystal-lang
<Groogy> Morning! o/ finally got some time to sit down with crystal ^^
<FromGitter> <bararchy> Hi Groogy, how is your game progressing ?
<Groogy> slowly :P too much day to day work. Lost a programmer to another team so I'm pitching in
<Groogy> Bararchy you started your own company right? How's it going?
<FromGitter> <bararchy> Well, pretty fun until now, we got funded, and we are working on hitting the market with a good product in about 2-3months (we already have beta but we want a full package)\
<FromGitter> <girng> good morning groogy
<Groogy> oh but that's great, you say fun until now, was it fun until obligations took precadence? :P
<FromGitter> <bararchy> Groogy oh, I didn't mean the fun ended, I meant that up to now it was really fun, still is, and hopefuly will be fun in the future :)
<FromGitter> <bararchy> I really enjoy using Crystal for big projects
<FromGitter> <bararchy> it feels like cheating when you can speed up the work with Crystal synatx and mindset and then `--release` and see that it's also really fast in execution
<Groogy> I do feel some parts make me write ugly code out of being lazy :/ which I need to get a grip on
<Groogy> but that's more of a me problem
<FromGitter> <bararchy> The only bad thing Crystal help me do is too complex types
<FromGitter> <bararchy> like `Hash(Symbol, Array(MyType | MyType2)).new`
<FromGitter> <bararchy> and then you look at it and think.... WTF did I just do
<FromGitter> <bararchy> and I put it into a struct or class
<FromGitter> <bararchy> I think it something that Crystal's union type encourge, and users coming frmo dynamic languges are using to fast-fix instead of creating a proper container class
<lvmbdv> is there a way to catch exceptions from fibers, outside fibers?
<lvmbdv> i have been trying different things but none of them seem to work
<lvmbdv> maybe it's an anti-pattern and i should try to catch all exceptions inside
<FromGitter> <bararchy> lvmbdv you can use Channel(Exception) ?
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc63f527c509a7743a2f63]
<lvmbdv> lol that's creative
<FromGitter> <bararchy> :)
<lvmbdv> yes that would work
<lvmbdv> thanks bararchy
<FromGitter> <bararchy> That's an interesting change: https://blog.github.com/2018-04-18-new-tools-for-open-source-maintainers
<FromGitter> <Sija> @faustinoaq is there sth like an ExcepionHandler concept in Amber?
<FromGitter> <girng> @bararchy i love union types
<FromGitter> <girng> helps a lot
<FromGitter> <girng> im also sick of performance optimization
<FromGitter> <bararchy> I'm not against them, It's just that they might be abused too easiily
<FromGitter> <girng> im done with it, going to code like a code WARRIOR
<FromGitter> <girng> then, if game is laggy or server crashes, i fix it l8er. i spent too much time worrying, i need help
<Yxhuvud> as far as I'm conconcered, a union type is the simplest variant of a container class and sometimes it has to be unboxed or boxed more appropriately
alex`` has quit [Quit: WeeChat 2.1]
alex`` has joined #crystal-lang
That_Guy_Anon has joined #crystal-lang
<FromGitter> <faustinoaq> > dont use stdin in tests, stub it out, make your code more reusable ⏎ ⏎ oprypin Yep, I'm doing a bit of refactoring to my shard πŸ˜…
<FromGitter> <faustinoaq> > is there sth like an ExcepionHandler concept in Amber? ⏎ ⏎ @Sija Yeah, Amber has a Exception handler, Right now I'm working on nice Exception pages for it πŸ˜„
<FromGitter> <faustinoaq> *an
<FromGitter> <drum445> Could somebody please help me, when I try to build my app as --release --static I get the following: ⏎ /usr/bin/ld: cannot find -lmongoc-1.0 ⏎ /usr/bin/ld: cannot find -lbson-1.0
<FromGitter> <faustinoaq> @drum445 You need to check your static dependencies
<FromGitter> <drum445> I've tried adding the flag "-L/usr/lib64" but that doesn't work in crystal, please help
<FromGitter> <drum445> how do I do that good sir?
<FromGitter> <faustinoaq> Commonly, you just have dynamic one in your OS, What os do you use
<FromGitter> <faustinoaq> ?
<FromGitter> <faustinoaq> ^^ Oh, That's the error pages I'm working on πŸ˜„
<FromGitter> <drum445> Ubuntu 17
<FromGitter> <faustinoaq> It will catch run time exceptions as well πŸ˜‰
<FromGitter> <drum445> I have installed the libs locally
<FromGitter> <drum445> but it errors when --static
<FromGitter> <faustinoaq> @drum445 Then ensure you have the `-dev` version of each package installled
<FromGitter> <drum445> Sorry for the noob questions, but how would one do that?
<FromGitter> <faustinoaq> Sometimes, even `-dev` version don't have the `.a` files you need to compile it statically
<FromGitter> <asterite> Is it fine to wait 8 seconds after each change?
<FromGitter> <drum445> It is this lib, I've installed the reqs
<FromGitter> <faustinoaq> and you need to create them by yourself
<FromGitter> <faustinoaq> `.a` is for static and `.so` for dinamic
<FromGitter> <faustinoaq> @drum445 You need something like `mondo-dev` packages or something πŸ˜„
<FromGitter> <faustinoaq> @asterite My computer is pretty old and low end pc, Intel Celeron 1 GHz 2GB late 2014 πŸ˜…
<FromGitter> <drum445> Could you point me in the right direction please, very much want to get this live
<FromGitter> <faustinoaq> @asterite, Exception pages are still very useful to catch run time exceptions and inspect them a bit. These pages also include some nice info like headers, cookies, params and other bunch of stuff πŸ˜„
<FromGitter> <faustinoaq> @drum445 Yeah, no problem, let me do a quick search on Ubuntu packages πŸ˜‰
<FromGitter> <drum445> thank you
<FromGitter> <faustinoaq> I'm using Manjaro Linux, I can't compile statically in this OS, because `-dev` packages don't exist, Usually I use alpine to compile things statically
<FromGitter> <faustinoaq> I remember someone share me this some time ago πŸ‘‰ https://store.docker.com/community/images/jrei/crystal-alpine
<FromGitter> <j8r> @drum445 You can use https://hub.docker.com/r/jrei/crystal-alpine/
<FromGitter> <faustinoaq> *shared
<FromGitter> <faustinoaq> @j8r Oh, was you! πŸ˜…
<FromGitter> <j8r> Oh damn you have already said it @faustinoaq πŸ˜…
<FromGitter> <j8r> How to merge two NamedTupleLiteral? I think I will need to use a for loop :/
<FromGitter> <j8r> @bararchy Nice if https://github.com/NeuraLegion/hardware accepts PRs, I will probably send some in the following weeks!
<FromGitter> <bararchy> @j8r I would love to accept PRs, right now it's not really helpful shard except of doing the percentigae, It could be much better if expended.
<FromGitter> <bararchy> we try to opensource anything we can
<FromGitter> <j8r> I finish my work on my CLI interface, on then I will work on `hardware` :-D
<FromGitter> <bararchy> @j8r πŸ‘
<FromGitter> <bararchy> @j8r what CLI Interface tool? :)
<FromGitter> <drum445> thanks guys, I'll try docker now
<FromGitter> <drum445> damn, same errors
<FromGitter> <drum445> --strip invalid option, removed it then got could not find mongoc
<FromGitter> <faustinoaq> ^^
<FromGitter> <j8r> @drum445 need to remove this `--strip` argument
<FromGitter> <j8r> I modify this
<FromGitter> <drum445> sudo apt install libbson-dev ⏎ sudo apt install libmongoc-dev ⏎ ⏎ Still get the same error :( ⏎ @j8r I tried removing -- strip and I got the same errors as before [https://gitter.im/crystal-lang/crystal?at=5adc8aab27c509a7743ab210]
wojnar has joined #crystal-lang
<FromGitter> <drum445> $ ldconfig -p | grep mongoc ⏎ I get "libmongoc-1.0.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmongoc-1.0.so.0" so it looks ok to me
<FromGitter> <faustinoaq> @drum445 Then ensure you have the right `.a` files in your system
<FromGitter> <faustinoaq> Try a quick search with find
<FromGitter> <j8r> you have missing shared libraries
<FromGitter> <faustinoaq> `sudo find / -iname "*.a*"`
<FromGitter> <faustinoaq> @j8r He wants to compile statically, so he needs `.a` files available in his system
<FromGitter> <j8r> Yes of course
<FromGitter> <faustinoaq> `.a` for static and `.so` for dynamic
<FromGitter> <drum445> I can compile --release and run on my system, but when I add static I get this bloody ld error
<FromGitter> <drum445> very frustrating
<FromGitter> <faustinoaq> Because you need the right dependencies
<FromGitter> <drum445> I installed the libbson and libmongoc
<FromGitter> <drum445> aren't they all I need?
<FromGitter> <drum445> /usr/bin/ld: cannot find -lmongoc-1.0 ⏎ /usr/bin/ld: cannot find -lbson-1.0
<FromGitter> <faustinoaq> Yeah, but by default the package just include the dynamic libaries
<FromGitter> <j8r> In the container, can you execute `apk add --update libson-dev mongo-c-driver-dev`
<FromGitter> <j8r> before the `crystal build`
<FromGitter> <faustinoaq> because compiling statically "sometimes" is considered a bad practice πŸ˜…
<FromGitter> <j8r> If you plan to package for an OS - yes
<FromGitter> <faustinoaq> yeah, IMO static compilation is very useful
<FromGitter> <drum445> How else should I do it, all I want to do is build on my local machine (Ubuntu) and run on my server (also ubuntu)
<FromGitter> <j8r> @drum445 so can you try `docker run --rm -it -v $PWD:/app -w /app jrei/crystal-alpine sh`
<FromGitter> <j8r> and Then `apk add --update libson-dev mongo-c-driver-dev`
<FromGitter> <drum445> ERROR: unsatisfiable constraints: ⏎ libson-dev (missing): ⏎ ⏎ ```required by: world[mongo-c-driver-dev]``` [https://gitter.im/crystal-lang/crystal?at=5adc8c847c3a01610d0abd1d]
<FromGitter> <j8r> and finally `crystal build --static src/app.cr`
<FromGitter> <faustinoaq> Actually, you don't need docker, just copy the dynamic linked binary, and do `ldd my-binary` and just fix the dynamic library links πŸ˜‰
<FromGitter> <j8r> But he want to compile statically?
<FromGitter> <faustinoaq> Yeah, but that's an option
<FromGitter> <j8r> Hum you can't compile statically on alipne, they haven't `.a` for this libs my bad
<FromGitter> <drum445> ah fair enough, thanks anyways @j8r
<FromGitter> <j8r> You can do what @faustinoaq said
<FromGitter> <drum445> $ crystal build src/backend.cr ⏎ $ ldd backend
<FromGitter> <faustinoaq> @drum445 The issue here is that your app need mongo compiled statically, so you need to include the entire mongo in the end executable
<FromGitter> <drum445> should that do it?
<FromGitter> <faustinoaq> Yeah, please share us the ooutput of that command
<FromGitter> <drum445> so it all ran ok, and I can run on my local machine. When I upload to my server and run it I get: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc8daa109bb04332eae4bc]
<FromGitter> <drum445> Do I just give up hope you reckon?
<FromGitter> <bararchy> @drum445 or manually static compile mongo?
<FromGitter> <drum445> how woudl I do that?
rohitpaulk has joined #crystal-lang
<FromGitter> <drum445> back to Go
<FromGitter> <bararchy> If you need static C++ driver libraries and you are configuring the C driver with the ./configure script, you must pass the --enable-static configure option when building libbson/libmongoc.
<FromGitter> <bararchy> :)
<FromGitter> <drum445> I just don't really get what is going on, is it a library issue?
<FromGitter> <bararchy> @drum445 btw, this isn't an issue with Crystal, it's an issue with static compilation
<FromGitter> <drum445> I haven't seen this before while using Crystal
<FromGitter> <bararchy> you would have the same issue with C\C++ or w\e lang you wanted to static compile with
<FromGitter> <drum445> Ok let's forget static comp for now, how would you go about releasing an app to a server?
<FromGitter> <drum445> if I use the --release flag I can run it fine locally, but my server plays up
<FromGitter> <bararchy> make sure the server have the needed dynamic libs, or, do what steam does
<FromGitter> <drum445> so you wouldn't bother with static comp when releasing to a server
<FromGitter> <drum445> ?
<FromGitter> <bararchy> pack the dynamic libs locally with the bin
<FromGitter> <bararchy> @drum445 static compilation sounds promising and easy, but there is a good reason not many uses it, it's insecure and might produce wierd errors
<FromGitter> <drum445> ah right cheers, so I should stick to --release flag
<FromGitter> <drum445> I have been for a few months and it's all been working great (with Kemal and Mysql apps)
<FromGitter> <j8r> Or use containers - no more problems
<FromGitter> <drum445> but I want to use mongo for this project and it's killing me lol
<FromGitter> <bararchy> lets say you static build with mongo, 2 days later a new 0-day is released for mongo, the system updates but you compiled with a "snapshot in time" of the driver and now instead of apt-get update, you need to recompile and redestribute
<FromGitter> <bararchy> ^ Containers are a good option
<FromGitter> <j8r> Static compilation is great if you have not a lot of dependencies, or most of them are in the same language
<FromGitter> <drum445> I only have Kemal and Mongo
<FromGitter> <drum445> but I guess Mongo is a C driver which is why It's causing issues
<FromGitter> <drum445> and I imagine the reason my Kemal/MySQL projects work is cause Crystal has it's own MySQL lib?
<FromGitter> <bararchy> `0.25.1` gonna have the longest release note ever XD
<FromGitter> <j8r> But mongo is not an little lib to compile :-/
<FromGitter> <bararchy> @drum445 nope, it's beacuse your server has libmysql installed
<FromGitter> <drum445> I don't really understand why I don't have this issue when using GoLang or Dot net
<FromGitter> <bararchy> @drum445 you should have the same issue
<FromGitter> <drum445> I don't
<FromGitter> <drum445> hence the confusion
<FromGitter> <j8r> Yes you will, you use a C library
<FromGitter> <drum445> Yesterday I ran go build and released it to a server using mongodb
<FromGitter> <drum445> maybe the driver was written in go though
<FromGitter> <bararchy> "a server" or "the same server" ?
<FromGitter> <j8r> You have two options: don't use the C library and use a Crystal one, or use the C one with whatever lang you will have the same pb
<FromGitter> <drum445> the same server
<FromGitter> <faustinoaq> @drum445 Are you sure you can compile go and net "statically" just with those libs? πŸ˜…
<FromGitter> <drum445> It wouldn't be an issue if I could run my --release build on my server
<FromGitter> <j8r> @drum445 You haven't used `libbson` and`mongo-c` to not have the problem, right?
<FromGitter> <drum445> I'm using the latter in yuor list
<FromGitter> <j8r> This implements BSON and Mongo stuff in Crystal -- no more problem with C libraries
<mps> faustinoaq: go links library directly to executable
<FromGitter> <drum445> which one should I use you reckon mate?
<FromGitter> <faustinoaq> > so it all ran ok, and I can run on my local machine. When I upload to my server and run it I get: ⏎ ⏎ No problem ⏎ ⏎ ```code paste, see link``` ... [https://gitter.im/crystal-lang/crystal?at=5adc92fe62316e0505e8ffdb]
<FromGitter> <bararchy> yeha
<FromGitter> <bararchy> ^
<FromGitter> <faustinoaq> Try something like `sudo find / -iname "*libmongoc-1.0.so*"`
<FromGitter> <drum445> I think I was just being a cretin with trying to make it static, I shall try and fix the issue on the server and omit the --static flag during build
<FromGitter> <faustinoaq> and then create your own symlink by `sudo ln -s /usr/lib/path/libmongoc-1.0.so.<something-here> /usr/lib/path/libmongoc-1.0.so.0`
jokke1 has joined #crystal-lang
<FromGitter> <j8r> @drum445 Why you don't use a Crystal Mongo driver?
<FromGitter> <drum445> I couldn't find one
<FromGitter> <j8r> You're right helas :-/
<FromGitter> <faustinoaq> @drum445 No problem, I also try to compile things statically very often, and usually I create a mess https://github.com/mrfoto/slacker/issues/1 πŸ˜…
<FromGitter> <faustinoaq> @drum445 I will recommend you to use the dynamic compiled executable and just fix the symlinks
<FromGitter> <drum445> Bloody marvelous it now runs on my server
<FromGitter> <drum445> Thank you all for helping me out :)
<FromGitter> <faustinoaq> ✨ πŸŽ‰ πŸ˜„
<FromGitter> <drum445> now time to fix an invalid memory access issue ;)
<FromGitter> <faustinoaq> haha XD πŸ˜…
<FromGitter> <faustinoaq> invalid memory exception on crystal is like not method for nil in other languages, you don't know where it come from πŸ˜…
<FromGitter> <drum445> oh good
<FromGitter> <drum445> it's always an adventure :D
jokke has quit [Quit: WeeChat 2.1]
jokke1 has quit [Quit: WeeChat 2.1]
<FromGitter> <bararchy> yeha I hate invalid mem errors
<FromGitter> <bararchy> but `pp` is your best friend :)
jokke has joined #crystal-lang
<FromGitter> <faustinoaq> Yeah, That's why you you should avoid unsafe things like bindings, `.as`, `.not_nil` and ensure your `@instance_vars` are accessed in the right place ⏎ ⏎ Lat time I had that error was because I was trying to access to an `@instance_var` on system trap 😜
<FromGitter> <drum445> very odd, seems to only happen when running with --release
<FromGitter> <bararchy> @drum445 not odd, this is usually the case
<FromGitter> <bararchy> it means you have a race condition
<FromGitter> <bararchy> and --release just makes it reach there faster
<FromGitter> <faustinoaq> Oh, use `--no-debug` then, I remember crystal had an issue about that
<FromGitter> <faustinoaq> I thought that issue was fixed πŸ˜…
rohitpaulk has quit [Ping timeout: 260 seconds]
<FromGitter> <bararchy> @faustinoaq the issue was LLVM5 no? Context error in compile time
<FromGitter> <drum445> I'm on LLVM4
<FromGitter> <bararchy> Oh...
<FromGitter> <drum445> how do i update it?
<FromGitter> <bararchy> XD
<FromGitter> <drum445> pmsl
<FromGitter> <faustinoaq> Oh, just use `--no-debug` XD
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc97b462316e0505e90f4e]
<FromGitter> <bararchy> Arch Linux FTW
<FromGitter> <drum445> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc97c86d7e07082b1f4b5e]
<FromGitter> <drum445> how can I update LLVM please?
<FromGitter> <faustinoaq> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc97d915c9b031142269f4]
<FromGitter> <bararchy> @drum445 using Ubuntu server?
<FromGitter> <drum445> r and desktop
ryan___ has joined #crystal-lang
<FromGitter> <drum445> --release --no-debug didn't seem to fix it :(
<FromGitter> <faustinoaq> Well, I guess you can try to compile it inside docker πŸ˜…
<FromGitter> <bararchy> http://apt.llvm.org/
<FromGitter> <faustinoaq> "sometimes" updating LLVM is a task very hard to achieve
<FromGitter> <bararchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5adc985b5f188ccc158f8d8d]
<FromGitter> <Sija> @faustinoaq gr8! how can I hook/register my own handler into the chain?
<FromGitter> <drum445> so my invalid memory error is probably a LLVM thing?
<FromGitter> <faustinoaq> @Sija Do you mean your own new Exception ?
<FromGitter> <faustinoaq> @drum445 yep
<FromGitter> <drum445> cool, so if I can get it updated we'll be sorted?
<FromGitter> <faustinoaq> @Sija For a amber pipe, (HTTP::Handler) you just need to inherit your class from `Amber::Pipe::Base` and "plug" it to your pipeline inside `config/routes.cr`
<FromGitter> <faustinoaq> *an amber
<FromGitter> <Sija> @faustinoaq I mean how can I intercept Exceptions? Sth like kemal’s `begin; call_next(req); rescue; …; raise; end` middleware
<ryan___> How is the XML::Node (https://crystal-lang.org/api/0.24.2/XML/Node.html) at handling badly formed HTML markup? One consideration was to use the crystagiri wrapped for libxml, as I know it handles a lot of the malformed HTML.
<FromGitter> <Sija> so Amber pipes are comparable to kemal’s middleware?
<FromGitter> <faustinoaq> @Sija, Then you need to modify the Error pipe on `src/pipes/error.cr` inside your amber project
<FromGitter> <faustinoaq> You can create it by using `amber generate error`
<FromGitter> <Sija> umm, not what I expected
<FromGitter> <Sija> I’d like to make Amber integration for https://github.com/Sija/raven.cr
<FromGitter> <faustinoaq> @Sija Well, I'm not an expert on that part of Amber Framework, I guess @eliasjpr is more confident to talk about it πŸ˜…
<FromGitter> <Sija> without monkey-patching or other code-intrusive techniques
<FromGitter> <Sija> πŸ‘
<FromGitter> <faustinoaq> He knows more about the "pipe", "pipeline" system inside amber
<FromGitter> <Sija> it seems to me that making a custom pipe should suffice
<FromGitter> <Sija> 1) plugging it in the right place in the chain that is (on the dev side)
<FromGitter> <faustinoaq> @Sija We have `call_next` as well, I think something can be done
<FromGitter> <Sija> @faustinoaq I’ll try that, thanks!
guilleiguaran has quit [Quit: Connection closed for inactivity]
<ryan___> How would I go about sorting this hash by value? `h = Hash(String, Int32).new(0)` I've seen the conversation (https://github.com/crystal-lang/crystal/issues/1915) that suggests calling `.to_a.sort`, but that has an error of "expected block to return Int32, not Tuple(String, Int32)"
<ryan___> `h.to_a.sort { |_k, v| v }`
<oprypin> ryan___, `sort_by` instead will work
<ryan___> Ah, thanks oprypin :-)
<FromGitter> <drum445> Fixed my memory issue and app is running nicely on the server, thanks again for the help guys, really appreciate it
wojnar has quit [Remote host closed the connection]
<ryan___> Is it possible to build a CSV string with a `\t` character separator?
<oprypin> apparently not in stdlib
guilleiguaran has joined #crystal-lang
<ryan___> Would it make sense for it to take the `DEFAULT_SEPARATOR` value in the CSV class?
<FromGitter> <codenoid> hi
<FromGitter> <codenoid> long time no see
frog has joined #crystal-lang
cptaffe has quit [*.net *.split]
fifr[m] has quit [*.net *.split]
WA9ACE has quit [*.net *.split]
jwaldrip has quit [*.net *.split]
ilovezfs_ has quit [*.net *.split]
greenbigfrog has quit [*.net *.split]
That_Guy_Anon has quit [Quit: Leaving]
jwaldrip has joined #crystal-lang
ilovezfs_ has joined #crystal-lang
fifr[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
WA9ACE has joined #crystal-lang
<FromGitter> <faustinoaq> ^^ Hey, @/all crystal community, I just published a new shard to get "secrets"
<FromGitter> <faustinoaq> ^^ https://github.com/faustinoaq/secrets
<FromGitter> <jwoertink> Hey, question about `Time.now.epoch`. If I get `1524413100` then I add 30 to get `1524413130` did I just add 30 seconds?
<FromGitter> <jwoertink> sweet @faustinoaq !
betofloresbaca[m has quit [Ping timeout: 240 seconds]
cptaffe has quit [Ping timeout: 256 seconds]
fifr[m] has quit [Ping timeout: 256 seconds]
kixune[m] has quit [Ping timeout: 245 seconds]
byteflame has quit [Ping timeout: 240 seconds]
braidn[m] has quit [Ping timeout: 240 seconds]
thunker[m] has quit [Ping timeout: 260 seconds]
Renich has quit [Ping timeout: 260 seconds]
olbat[m] has quit [Ping timeout: 276 seconds]
kp666[m] has quit [Ping timeout: 276 seconds]
<FromGitter> <straight-shoota> @jwoertink yes, `Time#epoch` returns number of seconds since Unix epoch
<FromGitter> <jwoertink> cool, thanks
Nathanaelle has quit [Ping timeout: 240 seconds]
Nathanaelle has joined #crystal-lang
<FromGitter> <eliasjpr> @Sija a custom pipe is the way to go
<FromGitter> <r00ster91> uhm what does the `i = self ^ self` means in https://github.com/crystal-lang/crystal/blob/4f9ed8d03208dd0db33993c5a6fa6753bc1cf91e/src/int.cr#L332 ? ⏎ both values are the same. And when you use 2 same values with bitwise XOR (`^`) then it will always be 0. So why not just `i = 0`?
<FromGitter> <bew> I think that's because 0 is Int32, and self might be another type. So `self ^ self` ensures to have a 0 value of the correct type. But yeah it looks weird
Hashirama has joined #crystal-lang
<Hashirama> Noob programmer here β€” how is crystal lang cross platform? Does it simply build on top of a compiler or something?
<Hashirama> Ah does it use LLVM?
<FromGitter> <r00ster91> yes
Nathanaelle has quit [Ping timeout: 256 seconds]
Nathanaelle has joined #crystal-lang
<Hashirama> Also, why would I use Crystal over Elixir/Erlang?
<Hashirama> I just recently picked up Elixir, so I wonder if I should switch or both languages are different and they should "coexist"
Hashirama has quit [Quit: Leaving.]
<FromGitter> <r00ster91> i would switch to crystal. I think it has a cleaner syntax than elixir and its easier. ⏎ And its maybe even faster than elixir.. but im not sure. But i dont think its slower
<FromGitter> <drum445> The syntax is a huge selling point
Hashirama has joined #crystal-lang
<FromGitter> <drum445> Union types
<Hashirama> Syntax is very similar since they are both influenced by ruby. Only benefit i see with elixir right now is the concurrency and parallelism.
<Hashirama> brew install crystal-lang
<Hashirama> ^ Sorry that was in error.
Hashirama has quit [Quit: Leaving.]
<FromGitter> <faustinoaq> Hashirama, Elixir is pretty nice to do functional programming πŸ‘ , Crystal is more procedural//Object Oriented πŸ˜…
<FromGitter> <forkev_twitter> New to Crystal. This is day one, so pardon the dumb questions. https://play.crystal-lang.org/#/r/3x6b runs in Crystal version 0.23.1 but in 0.24.1 and 0.24.2 returns error "'Flate::Writer.new' is not expected to be invoked with a block, but a block was given" How do I rewrite this sans block?
<FromGitter> <faustinoaq> @forkev_twitter Try https://play.crystal-lang.org/#/r/3x6f
Nathanaelle has quit [Read error: Connection reset by peer]
<FromGitter> <faustinoaq> ^^ See more: https://crystal-lang.org/api/master/Flate/Writer.html
<FromGitter> <forkev_twitter> Thanks Faustino. I see the .new vs .open in the documentation now. cool.
Nathanaelle has joined #crystal-lang
ua has quit [Ping timeout: 240 seconds]
Nathanaelle has quit [Ping timeout: 246 seconds]
Nathanaelle has joined #crystal-lang
<crystal-gh> [crystal] Sija opened pull request #5990: Add <link rel="canonical"> to the latest API docs (master...fix-5952) https://git.io/vpOg0
Nathanaelle has quit [Read error: Connection reset by peer]
ua has joined #crystal-lang
<ryan___> Does anyone have Crystal 0.24.2 compiling on OpenBSD? The makefile seems to be buggy?
Nathanaelle has joined #crystal-lang
<7IZAAIXBI> [crystal] RX14 pushed 1 new commit to master: https://git.io/vpO2N
<7ITAAGPBJ> [crystal] RX14 closed pull request #5969: Compiler: Add symbol literals support equal sign `=` as last char (master...jm/fix/symbol-literal-equals) https://git.io/vptDU
<7IZAAIXBI> crystal/master d6de698 Johannes MΓΌller: Compiler: Add symbol literals support equal sign `=` as last char (#5969)...
<DeBot> https://github.com/crystal-lang/crystal/pull/5969 (Compiler: Add symbol literals support equal sign `=` as last char)
<DeBot> https://github.com/crystal-lang/crystal/pull/5969 (Compiler: Add symbol literals support equal sign `=` as last char)
alex`` has quit [Quit: WeeChat 2.1]
olbat[m] has joined #crystal-lang
<travis-ci> crystal-lang/crystal#d6de698 (master - Compiler: Add symbol literals support equal sign `=` as last char (#5969)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369831097
<DeBot> https://github.com/crystal-lang/crystal/pull/5969 (Compiler: Add symbol literals support equal sign `=` as last char)
<FromGitter> <Sija> yo, is `amber watch` killing the CPU for every1 or just for me?
<oprypin> Sija, what OS?
<FromGitter> <Sija> OS X
Nathanaelle has quit [Ping timeout: 246 seconds]
<FromGitter> <drum445> i'm out, gn
<FromGitter> <r00ster91> can you save an encrypted passwort in a file and then still use it? ⏎ When I do ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5adceebd2b9dfdbc3ab957e4]
fifr[m] has joined #crystal-lang
byteflame has joined #crystal-lang
braidn[m] has joined #crystal-lang
cptaffe has joined #crystal-lang
betofloresbaca[m has joined #crystal-lang
thunker[m] has joined #crystal-lang
kp666[m] has joined #crystal-lang
Renich has joined #crystal-lang
kixune[m] has joined #crystal-lang
marius has quit [Quit: baj]
<oprypin> r00ster91, why do you use bcrypt here and what do you think it does?
<oprypin> oh, the API is insane, I see
<FromGitter> <r00ster91> I think its good to encrypt a password safely so not everyone can just read it out of the file
<oprypin> this is not encryption
<oprypin> this is hashing (to make a long story short)
<FromGitter> <r00ster91> in gittter i edited the question a bit
marius has joined #crystal-lang
<oprypin> :(
marius has quit [Client Quit]
<FromGitter> <r00ster91> i just added the reason why i want to use this
<FromGitter> <Jens0512> Amber is coming along really nicely
<FromGitter> <Jens0512> End of random exclamation. Good night
<FromGitter> <drum445> @r00ster91 you need to create a new BCRYPT from the file, so something like ⏎ ⏎ ```check = Crypto::Bcrypt::Password.new(File.read_lines("test")[0]) ⏎ check=="super secret"``` [https://gitter.im/crystal-lang/crystal?at=5adcf0da6d7e07082b20a1c8]
mps has left #crystal-lang [#crystal-lang]
<FromGitter> <drum445> which should result in true
marius has joined #crystal-lang
<FromGitter> <drum445> but like @oprypin said it's hashing not encrypting the password so you can never get the plain text back (but I imagine that is fine as it's a password)
<oprypin> r00ster91, https://carc.in/#/r/3x8d
<FromGitter> <r00ster91> ah yes this works. Thanks!
<FromGitter> <drum445> I contributed something, that's a win for today I reckon :)
rohitpaulk has joined #crystal-lang
ryan___ has quit [Ping timeout: 260 seconds]
rohitpaulk has quit [Ping timeout: 248 seconds]
Hashirama has joined #crystal-lang
<Hashirama> Is this the only set of guides for Crystal at the moment? https://crystal-lang.org/docs/overview/
<FromGitter> <r00ster91> yes pretty much. But the API docs are also very helpful to learn crystal https://crystal-lang.org/api/0.24.2/
<Hashirama> Thanks.
Hashirama has quit [Quit: Leaving.]
benharri has quit [Quit: The Lounge - https://thelounge.github.io]
benharri has joined #crystal-lang
Hashirama has joined #crystal-lang
duane has quit [Remote host closed the connection]
<FromGitter> <faustinoaq> > Amber is coming along really nicely ⏎ ⏎ @Jens0512 Oh Yeah!!! πŸ˜„
Hashirama1 has joined #crystal-lang
Hashirama1 has quit [Client Quit]
Hashirama has quit [Read error: Connection reset by peer]
<FromGitter> <faustinoaq> Hashirama try https://crystal-lang.org/api/master/ as well πŸ˜‰
<FromGitter> <faustinoaq> Also there is http://devdocs.io/crystal/ (a bit outdated though still useful πŸ˜… )
<FromGitter> <faustinoaq> > yo, is `amber watch` killing the CPU for every1 or just for me? ⏎ ⏎ @Sija There are some issues about that, I'm fixing all of them πŸ’ͺ
<FromGitter> <bhargavrpatel> Its been a while since I learned a new language. Lately, I've been doing some programming challenges but I do not think thats enough.
<FromGitter> <faustinoaq> @bhargavrpatel Try to create your own language in crystal, seems a pretty nice challenge in crystal community lately XD
<FromGitter> <bhargavrpatel> So tokenizer etc?
<FromGitter> <bhargavrpatel> Its funny, I was reading into LLVM
<FromGitter> <faustinoaq> Yeah, There is a plenty of language made in crystal, and work pretty well, even VM πŸ˜…
<FromGitter> <bhargavrpatel> @faustinoaq Any one in specific I should follow to learn from
<FromGitter> <faustinoaq> You can search on https://github.com/veelenga/awesome-crystal
<FromGitter> <faustinoaq> I found this one https://github.com/runic-lang/compiler
<FromGitter> <faustinoaq> as well
duane has joined #crystal-lang
<FromGitter> <faustinoaq> is made by a Core Team member of crystal πŸ˜…
<FromGitter> <faustinoaq> See: https://github.com/veelenga/awesome-crystal#implementationscompilers This section in specific
<FromGitter> <bhargavrpatel> LOL Yeah this might be fun to do
<FromGitter> <faustinoaq> @bhargavrpatel Oh, also there is https://www.mint-lang.com/, the whole compiler is made in crystal, and is more than 20K lines XD
<FromGitter> <bhargavrpatel> aha
<FromGitter> <faustinoaq> If you want something more "practical" use-case try creating a webapp with Kemal, Lucky or Amber Frameworks. ⏎ ⏎ If you don't like webapps, Try QT or SMFL or SDL bindings to create your own videogame or desktop application πŸ˜‰
<FromGitter> <bhargavrpatel> Yeah, currently I use Python for all the webapp stuff. I might give GUI stuff a go.
<FromGitter> <bhargavrpatel> Actually, I might try to write some of the linux commands instead in crystal (i.e: cat)
<FromGitter> <faustinoaq> @bhargavrpatel Oh, I almost forgot it, if you really want going down the rabbit hole, try java.cr (https://github.com/ysbaddaden/java.cr) and android.cr (https://github.com/ysbaddaden/android.cr). Perhaps you're the lucky guy with the time and motivation to test and rebirth those projects πŸ˜‰
<FromGitter> <bhargavrpatel> Too complex.
<FromGitter> <faustinoaq> Haha, no problem, just pick a project in https://github.com/veelenga/awesome-crystal then πŸ˜„
<FromGitter> <bhargavrpatel> Will do. Thanks for your help!
<FromGitter> <j8r> @bhargavrpatel If you plan to make CLI commands, I will release soon https://github.com/j8r/clicr
<FromGitter> <j8r> early draft at https://carc.in/#/r/3x8s
<FromGitter> <bhargavrpatel> Neat
<FromGitter> <faustinoaq> @j8r Wow, a lot of macros there πŸ˜…
<FromGitter> <j8r> Haha yeah! Only generated by macros, so you can put it in Class, defs, modules or nothing :-)
<FromGitter> <j8r> @faustinoaq and if you see more closely, this macros generate it self - inception
<FromGitter> <faustinoaq> Yeah, Did you check these https://github.com/veelenga/awesome-crystal#cli-builders ?, your cli shard looks a bit different πŸ˜…
<FromGitter> <j8r> Yeas I've already check some of them
<FromGitter> <faustinoaq> I mean, your output looks more UNIX alike πŸ˜„
<FromGitter> <j8r> But I'm dumb, I've never understood how they works. ⏎ In my mind, I must see the commands hierarchy in a Declarative way
<FromGitter> <faustinoaq> ^^ By example, this is the amber cli output
<FromGitter> <j8r> Quite nice :-)
<FromGitter> <faustinoaq> Yeah, we're using mosop/cli
<FromGitter> <j8r> But personally it's clearer with one line `d, deploy` than having the `# alias for`
<FromGitter> <faustinoaq> Well, that cli project got a bit outdated, so we forked it and now amber is using `amberframework/cli` πŸ˜…
<FromGitter> <j8r> Another thing the Cli I have built is entirely multi langual :-D
<FromGitter> <bew> @faustinoaq all the aliases makes it a bit hard to read, wouldn't it be better to have the aliases in there own section at the end, after the subcommands one?
<FromGitter> <faustinoaq> @j8r @bew Yeah, maybe we can use another shard to manage amber cli in the future @eliasjpr @elorest πŸ‘€
<FromGitter> <faustinoaq> Right now the amber cli output depends on `mosop/cli` shard, well `amberframework/cli` fork now πŸ˜…
<FromGitter> <bew> I remember admiral was my preferred one when I checked the cli builders (but never actually tried it in real world)
<FromGitter> <faustinoaq> Yeah, admiral looks, pretty nice, indeed, the name "admiral" pick the attention of new comers (https://youtu.be/71oXjLtXcv4?t=4903) πŸ˜…
<FromGitter> <faustinoaq> @bew IMO, cli builders are very useful for big CLIs like amber, lucky, etc. IMO for my projects the basic support with `OptionParser` is enough πŸ˜…
<FromGitter> <j8r> pushed https://github.com/j8r/clicr
<FromGitter> <j8r> @bew @faustinoaq what do you think? Tests will come this next days
<FromGitter> <j8r> this may not work well for now, but you have the draft
<FromGitter> <faustinoaq> @j8r Nice, stared!
<FromGitter> <faustinoaq> 🌟
<FromGitter> <j8r> thanks. you have even starred beofre me haha!
<FromGitter> <girng> if you pass 2 parameters to a method (message, client) is that procedural ?
<crystal-gh> [crystal] RX14 closed pull request #5932: Add context to errors in JSON.mapping (master...jm/feature/mapping-errors) https://git.io/vx7AE
<FromGitter> <j8r> You can pass variables (like `name=john`) and options are Booleans like `--yes` (`yes = true` in the background code)
<FromGitter> <j8r> And yes, parameters will all be parsed on the `while` loop
<FromGitter> <j8r> But no, if you question is: `myapp install thispackage`, this will no work for now
<FromGitter> <j8r> Coming soon πŸ˜„
<travis-ci> crystal-lang/crystal#6564d6c (master - Add context to errors in JSON.mapping (#5932)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/369879569
<DeBot> https://github.com/crystal-lang/crystal/pull/5932 (Add context to errors in JSON.mapping)
<FromGitter> <Qwerp-Derp> I have an issue with Qwerp-Derp/hedron
<FromGitter> <Qwerp-Derp> I have two types declared in a `lib`, `UI::Box` and `UI::Control`, both of which are `Void*`
<FromGitter> <Qwerp-Derp> In my `Hedron::Box` type, I have `@this` as type `UI::Box*`
<FromGitter> <Qwerp-Derp> Which is essentially a Void** now
<FromGitter> <Qwerp-Derp> I want to cast `@this` as `UI::Control*` - in older versions of Crystal this worked fine, but it doesn't work now for some reason
<FromGitter> <Qwerp-Derp> `@this.as(UI::Control*)` doesn't seem to want to work, and raises a compile error
<FromGitter> <Qwerp-Derp> `can't cast Pointer(UI::Box) to Pointer(UI::Control)`
<FromGitter> <j8r> Maybe `unsafe_as`?
<FromGitter> <j8r> Because I see pointers
<FromGitter> <Qwerp-Derp> @j8r Huh, it works now, thanks!
Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
Yxhuvud has joined #crystal-lang