<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>
<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> > 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>
<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>
<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 π
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!
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]
<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>
<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.
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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`
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?
<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?
<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)...
<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)
<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>
<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>
<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>
<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.]