<FromGitter>
<bajro17> So nice you people work like crazy so nice to see how much you done
return0e has quit [Ping timeout: 252 seconds]
return0e has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
go|dfish has quit [*.net *.split]
bazaar has quit [*.net *.split]
bazaar_ has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
return0e has quit [Ping timeout: 260 seconds]
<FromGitter>
<girng> Agreed. Crystal dev team is amazing
<FromGitter>
<girng> @Blacksmoke1 the asynchronous `spawn` for db.query you told me about yesterday for item loot works great. no response time delay at all for the player. thanks for that =]
rohitpaulk has joined #crystal-lang
<FromGitter>
<Blacksmoke16> hm?
rohitpaulk has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> thats either a very odd coincidence or it messed up my name ;p
<FromGitter>
<Blacksmoke16> deff wasnt me tho
<FromGitter>
<girng> @Blacksmoke16 my bad man. i checked the gitter logs, and it was fridgerator, iuno why i thought of your name lol
<FromGitter>
<girng> for example, in my gameserver , i use `property db : DB::Database`. but i need to @db inside the initialize method which is normal/fine. however, i want it to be done inside a method thhat's called from initialize
return0e has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
DTZUZO_ has quit [Ping timeout: 252 seconds]
rohitpaulk has quit [Ping timeout: 260 seconds]
DTZUZO_ has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<j8r> You can't, you must set a default value for \@db else. but you can do the reverse. Have a self.new that will call the initialize
<FromGitter>
<j8r> (Dont' know how to escape @ in gitter :|)
lunarfyre7 has quit [Ping timeout: 240 seconds]
<FromGitter>
<vlazar> > @vlazar awesome! I'm wondering, what'll happen after the next Crystal release? (or more precisely when a language change happen) will you update it? ⏎ ⏎ @bew the final release of the book is stated for Jan 2019 currently and the description in bookstore says that you'll get additional updates for the life of this edition, which I hope would include Crystal 1.0
<FromGitter>
<vlazar> that of course depends on whether or not Crystal will reach 1.0 soon enough, otherwise I guess it can be too much effort for the author to keep updating his book
lunarfyre7 has joined #crystal-lang
Groogy1 has joined #crystal-lang
ua has quit [Ping timeout: 252 seconds]
ua has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
baweaver is now known as baweaver_away
ashirase has quit [Ping timeout: 250 seconds]
ashirase has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<girng> @j8r if i do @db = connect_to_mysql(root, password). it works though
<FromGitter>
<girng> it just doesn't work if i do that inside a method inside `initialize`
<FromGitter>
<girng> why is that, i'm still initializing it. just being a bit more organized and wanting to re-use the connect method incase of disconnects.
<FromGitter>
<j8r> that's normal
<FromGitter>
<j8r> all instances variables are needed to be declared either on the class or in the initialize
<FromGitter>
<girng> but i'm still initializing the instance variable, but it's just inside another method
<FromGitter>
<girng> it is still being run inside of `initialize()`
<FromGitter>
<j8r> the compiler doesn't do that
<FromGitter>
<j8r> don't know if may be good to do this
<FromGitter>
<j8r> simply declare it in the initialize, like `@db = my_method_to_get_db`
<FromGitter>
<girng> well, my use case is. in initialize, i want to setup my socket and db to connect to a master server. and then if the master server gets disconnected, i can re-use that `method`. instead of re-writing the same code twice
<FromGitter>
<j8r> have you considered `self.new` ?
<FromGitter>
<girng> yeah, i use that inside the method
<FromGitter>
<j8r> you could set the socket & co in the `self.new`, and return like `{ db, socket }` and in the initialize: `@db, @socket = new`
<FromGitter>
<girng> let me try that, good idea ty
<FromGitter>
<j8r> that's fine if you are few variables, like two or so
<FromGitter>
<girng> yeah, that works, thx. not the cleanest, since i need to write `@db, @master_server = connect_to_master`, but it works. ty @j8r
<FromGitter>
<j8r> you're welcome @girng :)
justinmcp has quit [Quit: No Ping reply in 180 seconds.]
justinmcp has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
<FromGitter>
<girng> `check = TCPSocket.new(GO["master_server"].as_s, GO["master_server_port"].as_s)` ⏎ ⏎ if the "master_server" can't be connected, it will run indefinitely (and use 100% cpu usage). is it possible to poll it and check every 1-3 seconds instead?
<FromGitter>
<girng> would this be `tcp_keepalive_interval`?
<FromGitter>
<girng> i'
<FromGitter>
<girng> i'm bug hunting this morning :D
go|dfish has joined #crystal-lang
<FromGitter>
<Prutheus> Hello, I want to cross compile my project to windows following this guide https://github.com/crystal-lang/crystal/wiki/Porting-to-Windows now, when i need to run `crystal build ...` I get this error: `in /usr/local/Cellar/crystal/0.26.1/src/socket.cr:1: while requiring "c/arpa/inet": can't find file 'c/arpa/inet'` how to fix that?
<FromGitter>
<girng> did you use --static on your crystal build?
<FromGitter>
<Prutheus> no
<FromGitter>
<Prutheus> but then the same error
<FromGitter>
<girng> hmm. lead devs are just waking up i think so they can u hlep alot better
<FromGitter>
<Prutheus> there is the library which can't be found, but not for windows cross compile....
<FromGitter>
<Prutheus> at windows, there is no such lib
<FromGitter>
<j8r> @Prutheus the windows support is highly experimental, you app will likely not work yet
<FromGitter>
<Prutheus> hmmm okay :/ this is sad ...
<FromGitter>
<girng> have u tried WSL? works great
<FromGitter>
<girng> i've been using for 8+months with crystal no issues :D
<FromGitter>
<j8r> yeah that's a fine option
<FromGitter>
<j8r> @Prutheus don't be sad, @RX14 is working hard on Windows support 😄
<RX14>
Prutheus there's no networking support on windows yet
<FromGitter>
<fenicks> Looking for a text indexing library in Crystal like bleve in Go, send me the link if you knows about one : https://github.com/blevesearch/bleve
<FromGitter>
<j8r> @fenicks you have the crystal logo as an avatar, you should quite like it. However, I don't see any Crystal post in your blog 😄
<FromGitter>
<fenicks> Not for now, but I have found a first project to learn Crystal and blog posts are scheduled.
<FromGitter>
<fenicks> I really like the logo and the language of course.
<FromGitter>
<fridgerator> @vlazar I dont believe crystal will be at 1.0 by January
<FromGitter>
<fenicks> Yes, nice. I'll look at it more deeply.
<FromGitter>
<j8r> me too, strongly think no. There are still Path and System PRs to be merged
<FromGitter>
<drosehn> I think vlazar doesn't expect crystal to reach 1.0 by January, just that the book will continue to get updates until crystal does reach 1.0.
<FromGitter>
<fridgerator> Ah ok, I misread
<FromGitter>
<girng> who is vlazar , author of an official crystal book?
<FromGitter>
<girng> Like, a hardback purchasable one?
<FromGitter>
<girng> I would love to read it during night / in bed
<FromGitter>
<fridgerator> No he posted the link to the book, right now its an ebook, physical copies are expected to ship in Janurary
<FromGitter>
<girng> Who is the author of the book?
<FromGitter>
<fridgerator> Ivo Balbaert and Simon St. Laurent
<FromGitter>
<girng> Was hoping it was from the lead developers
<FromGitter>
<fridgerator> Why is that?
<FromGitter>
<fridgerator> Ivo has authored books about other languages as well: Go, Rust, Julia, etc
<FromGitter>
<girng> Well, this is just my opinion, but when I spend money on something I want to make sure i'm getting the best possible information as possible. And I think if they have a lot of contributions to the language (github repo), or a lead developer, that increases their credibility tenfold
<Vexatos>
not every developer is a good didactic author :P
<Vexatos>
it's one thing to know a language and another entirely to explain it well
<FromGitter>
<girng> Someone who literally developed the language knows it the best, no?
<FromGitter>
<girng> Or, in crystal's case, a small team. The "lead developers"
<Vexatos>
As I said, it is one thing to know it, is is another to be able to write a book about it
<Vexatos>
Not everyone can or wants to be an author
<FromGitter>
<girng> Or.. if they have contributed highly to the language through github/PRs, etc
<Vexatos>
if you want the best information, you read the official documentation
<Vexatos>
if you want easily digestible information, you read a good book
<FromGitter>
<girng> If I want the best information I'm going to buy a programming book written by the author(s) of the language or highly active contributors. There is a reason why this book is regarded as one of the best https://www.amazon.com/Programming-Language-Brian-W-Kernighan-ebook/dp/B009ZUZ9FW :). Same logic applies to crystal imo.
<Vexatos>
It doesn't
<Vexatos>
the best book for crystal is not the one written by the developers because there isn't any book written by the developers
<FromGitter>
<girng> Why not?
<Vexatos>
so it does not apply
<FromGitter>
<girng> Did you not see my link?
<FromGitter>
<girng> Yes it does apply
<FromGitter>
<girng> Dennis Ritchie (Author)
<Vexatos>
As I already mentioned twice, not every programmer also happens to be good at writing books. Believe it or not, but there are developers that cannot and won't ever write books themselves
<Vexatos>
Just because there are developers who write books doesn't mean every developer can write good books for their own language
<OvermindDL1>
Vexatos: ? Huh what?
<FromGitter>
<girng> I'm just saying when you see a book that is authored by someone who invented the language (or a highly active contributor), wouldn't that increase credibility of the knowledge inside that book? That's just what I mean
<Vexatos>
not really, no
<Vexatos>
I can learn 100% of a language without ever contributing to it
<FromGitter>
<j8r> yes an unknown guy can write a formidable Crystal book
<Vexatos>
I have had a person randomly send a PR for documentation to one of my projects. I'd never seen the name anywhere before but he clearly seemed to understand everything perfectly
<FromGitter>
<j8r> but what matter more is what contributors/authors of the language think about this very book
<Vexatos>
yea
<FromGitter>
<girng> @Vexatos am sorry, but that doesn't make sense to me. By that logic, you can learn C 100%, then a write a book and people will think you have the same credibility as Dennis Ritchie? I don't undertstand
<FromGitter>
<fridgerator> now you're flipping the topic of discussion
<Vexatos>
@girng if the same information is inside, it won't be any less correct, and if your book is easier to read, then the new book is clearly superior
<FromGitter>
<fridgerator> its a book about high level Crystal, you dont have to be Ary to write a book about that
<Vexatos>
^
<FromGitter>
<girng> No i'm not. It's been about credibility ever since.
<FromGitter>
<girng> That's why I originally said "Was hoping it was from the lead developers"
<Vexatos>
What do you mean by "credibility"? You think someone is just going to write false information in a book?
<FromGitter>
<j8r> it can have the same credibility if the author approves a book from a fellow
<Vexatos>
What false information can you even write into a programming book
<FromGitter>
<j8r> 1) author of the language
<Vexatos>
If you say "x does y" and you test it and it clearly doesn't, or what >_<
<oprypin>
geez what a polarized discussion
<oprypin>
if i'm writing a book while reading tutorials about the thing, it's obviously not gonna be a good book
<FromGitter>
<j8r> need 😎 yea oprypin
<FromGitter>
<girng> Someone who has developed their own language knows more about it than someone else learning it. That's what I personally believe, you can disagree, I don't really care
<Vexatos>
if the person is learning it, yes, if the person _knows_ it, no. There is a finite amount of stuff to learn about a language. At least the stuff that is relevant enough to write a book about
<Vexatos>
especially smaller language like crystal
* FromGitter
* fridgerator steps away from the conversation
<Vexatos>
good idea :I
<oprypin>
there's a finite amount to learn, sure, but unfortunately, the only way to learn some of it is by participating in the community
<oprypin>
so I sure hope those people did that
<Vexatos>
I mean you can learn a language without doing that
<Vexatos>
specifically by reading books and documentation
<Vexatos>
and using it yourself for a while
<FromGitter>
<fridgerator> @girng There is an ebook by @sdogruyol I believe
<FromGitter>
<j8r> finite? infinite to learn i would say
<OvermindDL1>
Vexatos: So what's going on?
<FromGitter>
<girng> I find it pretty funny how oprypin claims if he wrote a book, it's not gonna be a "good book". But he's one the main people here who have helped me immensely. Doesn't make sense to me. I'd buy a book by oprypin any day of the week =]
<oprypin>
where did i say that
<Vexatos>
that is not what they said
<FromGitter>
<j8r> > <oprypin> if i'm writing a book while reading tutorials about the thing, it's obviously not gonna be a good book
<FromGitter>
<girng> "if i'm writing a book while reading tutorials about the thing, it's obviously not gonna be a good book"
<FromGitter>
<j8r> there is a condition
<oprypin>
"i" doesn't mean "oprypin", it's general
<FromGitter>
<j8r> anyway, lets readers judge the book 😄
<Vexatos>
now we're into English linguistics :U
<FromGitter>
<girng> Okay, well I agree with that then. That's actually another reason why I would favor a contributor/lead developer as an author ;)
<FromGitter>
<j8r> I was wondering, the only point of having property, getter and setter if for documentation? (vs `myclass.@ivar`). Because performance-wise, reopening the class method will be a bit slower
return0e has quit [Remote host closed the connection]
<FromGitter>
<vlazar> > @vlazar I dont believe crystal will be at 1.0 by January ⏎ @fridgerator Yeah, I have the same feeling. However some books get updates, I feel like with not many breaking chanhes this book can be updated to 1.0 eventually :)
<FromGitter>
<vlazar> Crystal will be probably 0.28 by January, maybe with finished arithmetic operations changes, better Windows support (probably not finished) and then there is also parallelism and polishing before 1.0. This sounds like a lot of work.
<FromGitter>
<bajro17> I'm not anymore worried about this version 1.0
<FromGitter>
<bajro17> when I start use crystal more now
<FromGitter>
<bajro17> I see this project is so stable (for me on linux )
<FromGitter>
<bajro17> I dont have any fear to recommend it even for production
<FromGitter>
<bajro17> All developer of crystal I love you <3 you are world changer
<FromGitter>
<fridgerator> 👍 🎉
DTZUZO_ has quit [Ping timeout: 244 seconds]
<FromGitter>
<sam0x17> so not for nothing guys, I just spent 3 weeks trying to get something working in rust, and I was able to do it fully with a better API in crystal in about 45 minutes
<FromGitter>
<girng> Okay I have really weird problem with TCPSocket. Not sure if it's a bug, or my code ⏎ Here is a basic client.cr example: https://paste.ee/p/xHvsZ ⏎ It works just fine when my Master Server is already running. All my TCPServer does it send a message "hey". My client.cr receives messages, and cpu usage is 0-1% ⏎ ⏎ However, if I run client.cr before my Master Server is running, then I start my Master
<FromGitter>
<codenoid> `math.ceil` is what i need (in python)
<FromGitter>
<codenoid> ✨ thankyou
Heaven31415 has quit [Quit: Leaving]
<FromGitter>
<Aaron-Fleisher> Hello~ I heard crystal being recommended in the Godot community. I have some experience with lua and python, but not much ruby. Really looking forward to it!
<FromGitter>
<fridgerator> 👍
<oprypin>
i wonder who could've recommended that
<oprypin>
Aaron-Fleisher, welcome! i can answer questions from Python point of view.
<FromGitter>
<Aaron-Fleisher> I saw it in the discord group by dillybob or something a few months ago. Just never really got around to it. Thank you for the warm welcome!
<FromGitter>
<bajro17> What is best way to save pictures to database
<FromGitter>
<bajro17> to generate some name for files
<FromGitter>
<bajro17> is it good to use base64 or to use some other way?
<FromGitter>
<bajro17> or maybe to use picture name with Time.now
<FromGitter>
<r00ster91> yes using Time.now sounds like a good idea. But it could be still possible that a new image is saved in the same second. Maybe append a number in this case.
<FromGitter>
<bew> @Aaron-Fleisher welcome to Crystal! (hehe Lua is great language too ;) )
Groogy1 has quit [Ping timeout: 245 seconds]
<oprypin>
bajro17, but databases have autoincrement primary keys ??
<FromGitter>
<Aaron-Fleisher> 👍
<FromGitter>
<bajro17> yes I know just about security
<FromGitter>
<bajro17> what is better
<FromGitter>
<bajro17> or this is more about server setup
<oprypin>
bajro17, what is your goal?
<FromGitter>
<bajro17> I just save all pictures in same folder
<oprypin>
the images dont even necessarily need to have filenames. how are you storing them and for what purpose?
<FromGitter>
<bajro17> and I worry what if 2 person save image with same name
<FromGitter>
<bajro17> it will overwrite
<FromGitter>
<fridgerator> you can generate a unique folder for each file (using uuid or something)
<FromGitter>
<bajro17> I will go with simple base64+Time.now
<oprypin>
bajro17, base64 of what
<oprypin>
interestingly, 4chan somehow manages just fine with using timestamp in milliseconds
<FromGitter>
<bajro17> base64 of file name
<oprypin>
bajro17, whenever you think of security, you need to consider only the worst case scenario
<FromGitter>
<bajro17> I want to make simple web framework with web ui to generate files for project
<oprypin>
so, everyone uploading with the exact same filename, and this addition makes no difference. so may as well remove it
<FromGitter>
<bajro17> no there is some drivers
<FromGitter>
<bajro17> who upload there driver licence
<FromGitter>
<bajro17> then all this picture go to folder named driver_licence
DTZUZO_ has joined #crystal-lang
<FromGitter>
<bajro17> then if I want use picture name to save it to this folder
<FromGitter>
<bajro17> some people can have same
<FromGitter>
<bajro17> like licence.jpg
<FromGitter>
<bajro17> I want just have unique name to I dont lose same of them because overwrite
<oprypin>
bajro17, insert a row into database with autoincrement id, and the insert operation will actually return that id, and then just use it as the filename
<FromGitter>
<bajro17> Thank you so much I will try it and see how all work together
<FromGitter>
<bajro17> after that little test if I get some problem I will come back :)
<FromGitter>
<KINGSABRI> Hello guys, ⏎ Is there anything like drb (distributed ruby) in Crystal ?
druonysus has joined #crystal-lang
druonysus has quit [Client Quit]
sevensidedmarble has joined #crystal-lang
notdaniel has quit [Remote host closed the connection]
dkh is now known as notdaniel
<FromGitter>
<bajro17> I have one more question how to use Lets Encrypt with my website