faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <RubyRebbe> @Blacksmoke16 : tested it in Crystal spec. Works!
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <anamba> hi all. webpack + babel are not exactly my best friends but i am having a lot of trouble getting the chat websocket example working. first thing i worked out was that I had to comment out the module.exports part of amber.js (otherwise i get `TypeError: "exports" is read-only`). currently trying to figure out how to add the necessary route... no mention of that in the ws docs
<FromGitter> <vusaalab> Hi guy! Is crystal good for video transcode with ffmpeg
<FromGitter> <waghanza> :trollface: I would personaly take `python` as more mature
<FromGitter> <waghanza> see https://github.com/veelenga/awesome-crystal for intersting stuff
<FromGitter> <vusaalab> what about go or rust? @waghanza
<FromGitter> <waghanza> I found this one https://github.com/marceloboeira/ffmpeg.cr, but not very maintain (I think)
<FromGitter> <waghanza> @vusaalab in fact, you can choose to run directly in a language ((home made framework) or bind existing
<FromGitter> <waghanza> the question is more, what exists / is maintain
<FromGitter> <waghanza> python has great bindings ;-)
<FromGitter> <waghanza> I don't now about rust and go
<FromGitter> <Blacksmoke16> yea nvm on annotation stuff, implementation is quite a bit involved sadly
<FromGitter> <Blacksmoke16> it would be doable but not without *a lot* of refactoring
<FromGitter> <Blacksmoke16> like at that point granite 2.0
<FromGitter> <Blacksmoke16> but with whats being said in #crystal it might be needed at some point...
<FromGitter> <proyb6> I wonder if converting all paths into byte slice (behind the scene) using to_slice have an improvement in performance?
<robacarp> @blacksmoke16 I haven't been watching crystal-lang...what sort of things make you say that?
<FromGitter> <Blacksmoke16> ```**<RX14>** mutable constants are probably going to be removed entirely sooner or later```
<FromGitter> <Blacksmoke16> which we use for the `CONTENT_FIELDS` and stuff
<robacarp> mutable constants
<robacarp> the discussion that's been looming around forever is to replace individual `field` macro calls with a `fields` macro which defines everything at once.
<FromGitter> <melon-mochi> trying to render some granite data, but it's giving me an error. ⏎ here's my main file (indigo2.cr): https://pastebin.com/yp9edUUC ⏎ here's my error: https://pastebin.com/7bG7Z9rM
<FromGitter> <melon-mochi> please ping me if you find a solution
<FromGitter> <Blacksmoke16> hm
<FromGitter> <Blacksmoke16> try doing ` community = Community.where(id: env.params.url["id"]).limit(1).select` @melon-mochi
<FromGitter> <melon-mochi> thanks, will try when I get home
<FromGitter> <Blacksmoke16> based on the error `undefined method 'title' for Granite::Query::Builder(Community)` your `community` var isnt actually the record
<FromGitter> <Blacksmoke16> prob could just do `Community.find env.params.url["id"]` as well
<FromGitter> <melon-mochi> alright, ill let you know if it works once I have access to my computer
<FromGitter> <melon-mochi> when using `community = Community.where(id: env.params.url["id"]).limit(1).select`i get this error (https://pastebin.com/F5Lgd8b3)
<FromGitter> <melon-mochi> @Blacksmoke16
<FromGitter> <Blacksmoke16> which makes sense
<FromGitter> <Blacksmoke16> using a where clause would return an array of `Community` objects
<FromGitter> <Blacksmoke16> even if there is only 1 record, is why i suggested using `.find` as that would do a select on primary key and return the 1 row
<FromGitter> <melon-mochi> and when i use the second one i get ```Error in src/indigo2.cr:111: undefined method 'title' for Nil (compile-time type is (Community | Nil)) ⏎ ⏎ title = community.title ⏎ ⏎ `````` [https://gitter.im/amberframework/amber?at=5be490444e7ca14520757ee7]
<FromGitter> <melon-mochi> guess i cant do multi line code blocks :/
<FromGitter> <Blacksmoke16> which also makes sense because it is not known whether it'll find a row with that id or not
<FromGitter> <Blacksmoke16> can use `.find!` which will raise on nil
<FromGitter> <Blacksmoke16> otherwise you'll need to handle the case that a record isnt found with that id
<FromGitter> <melon-mochi> oh, `.find!` works
<FromGitter> <melon-mochi> thank you
<FromGitter> <Blacksmoke16> np, but just know that if it doesnt find a record with the given id, it'll raise an exception
<FromGitter> <Blacksmoke16> i.e.
<FromGitter> <Blacksmoke16> GET `/communities/999999999`
<FromGitter> <melon-mochi> i'll put in a 500 handler in there
<FromGitter> <Blacksmoke16> i think the better way to handle this would be to do like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5be49177bb887874749ab713]
<FromGitter> <melon-mochi> that makes more sense
<FromGitter> <melon-mochi> ty
<FromGitter> <melon-mochi> `comm` is replacing the `community` variable correct
<FromGitter> <Blacksmoke16> in that example `comm` is a variable that is local to the if block
<FromGitter> <Blacksmoke16> that is known at compile time to be not_nil