ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.29.0 | 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
<FromGitter> <tenebrousedge> if possible, I think I would have a separate process that scanned that folder and generated the headers as necessary
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
Creatornator has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.4]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <jwoertink> Anyone around that might be able to help me with some git-fu?
<FromGitter> <tenebrousedge> sounds dangerous
<FromGitter> <jwoertink> lol
<FromGitter> <tenebrousedge> what's the problem?
<FromGitter> <jwoertink> I'm scared!
<FromGitter> <jwoertink> I have a PR that's been abandoned. I pulled that PR down, made a change, and want to push it up to that same PR
<FromGitter> <jwoertink> that way when I merge, it will show the original commiter's changes plus my updated changes
<FromGitter> <Blacksmoke16> just checkout a new branch and push it up?
<FromGitter> <tenebrousedge> I think you can also update the existing PR
<FromGitter> <jwoertink> I know I've seen people do it. Even in the crystal repo. I just don't know how people do it
<FromGitter> <jwoertink> I've heard people use hub. I've just never tried it
<FromGitter> <jwoertink> I'll take a look at that though. Thanks!
<FromGitter> <tenebrousedge> quoting: ⏎ ⏎ > On GitHub, the person who submitted the pull request has the option to allow updates from maintainers. If that is enabled (by default), you will be able to commit to the forked repository (and this change the contents of the pull request)
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <jwoertink> oh nice. I don't see that on this, so I wonder if they never checked that box
<FromGitter> <Blacksmoke16> id imagine you need write access or something tho
<FromGitter> <tenebrousedge> it says it's checked by default
<FromGitter> <Blacksmoke16> rip `.to_f` doesnt handle commas
<FromGitter> <tenebrousedge> strip them?
<FromGitter> <jwoertink> Thanks for the help. I'll give these a shot!
<FromGitter> <Blacksmoke16> ill have to i guess
<FromGitter> <Blacksmoke16> have to come up with a good way to do that, as would have to support comma/space/period separated, plus period and comma decimal separator
<FromGitter> <Blacksmoke16> should be doable
<FromGitter> <Blacksmoke16> worry about that later
<FromGitter> <Blacksmoke16> would be handy if the string to_x method handled that tho
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> @vladfaust is there a better way to do LIKE queries? `Onyx::SQL.query(Type.where("name LIKE '%#{query}%'"))` i tried doing like `Onyx::SQL.query(Type.where("name LIKE '%?%'", query))` but that raises `bind message supplies 1 parameters, but prepared statement "" requires 0`
<FromGitter> <Blacksmoke16> like obs the first one isnt safe
return0e has quit [Ping timeout: 248 seconds]
return0e has joined #crystal-lang
<FromGitter> <Nbotz> everything ive tried hasnt worked, how would you update the server time when JS plays a new video?
<FromGitter> <Blacksmoke16> Send a message to the server via a webhook?
<FromGitter> <Blacksmoke16> Websocket*
<FromGitter> <Blacksmoke16> But what do you mean by server time? How does that relate to a video?
<FromGitter> <tenebrousedge> @Blacksmoke16 you can maybe just use a regex to snag `((\d)[.,])+([.,][0-9]{2})$`
<FromGitter> <Blacksmoke16> Hmm, is part of a bigger string of variable decimal and digits
<FromGitter> <Nbotz> @Blacksmoke16 i need it to sync new clients to the server video location. but when a new video is played the sync isnt reset back to 0 it keeps going, which throws everything off
<FromGitter> <Blacksmoke16> Send a request to the server to reset then?
<FromGitter> <tenebrousedge> the sync will be off by a little bit no matter what
<FromGitter> <Blacksmoke16> Whether it's some http request or websocket
<FromGitter> <tenebrousedge> so keep track of the current position (of whoever clicked play) as best you can, and give that to anyone else joining the stream
<FromGitter> <Nbotz> thats the thing, the videos autoplays when the server starts, there's no client host
<FromGitter> <Nbotz> the way i was keeping track of the current position was by subtracting the clients time from the server init time
<FromGitter> <Nbotz> because that way the current position isn't just reset to 0 when you reload the page
<FromGitter> <tenebrousedge> what's the big picture here?
<FromGitter> <tenebrousedge> @Blacksmoke16 any consistent delimiters?
<FromGitter> <Nbotz> i want every video in a folder to autoplay on the server. and when people join in said server they join in at the time of the server.
<FromGitter> <Blacksmoke16> use redis to keep track of the place of each video every second?
<FromGitter> <Blacksmoke16> depends on the country, some use commas some use periods etc
<FromGitter> <Blacksmoke16> but think i can just count the number of periods or something
<FromGitter> <tenebrousedge> @Blacksmoke16 sure, and commas and periods can be dealt with. Space separated numbers without any other field delimiter would be a problem
<FromGitter> <tenebrousedge> is `303 303` one or two numbers?
<FromGitter> <Blacksmoke16> in my case it would be known to be one
<FromGitter> <tenebrousedge> @Nbotz so the client loads the page, loads the video, a loadVideo event fires, this queries the server, then sets the playback position of the video
<FromGitter> <tenebrousedge> I'm pretty sure that there is some sort of video onLoad event
<FromGitter> <Blacksmoke16> but id be ok with not worrying about it to start and let it be a problem
<FromGitter> <Blacksmoke16> dot and comma are prob wayy more common
<FromGitter> <tenebrousedge> @Blacksmoke16 well then, something like that regex should probably work? you might have to be careful about your capture groups
<FromGitter> <tenebrousedge> probably end up with something like [[["123"],["456"]],["78"]] for 123,456.78
Creatornator has joined #crystal-lang
<FromGitter> <Nbotz> @tenebrousedge yes, but i cant really wrap my head around it. i guess i would send a socket of the loadvideo?
<FromGitter> <tenebrousedge> I'm not sure what sort of video player you're using, but I'm pretty sure most of these have an API that allows you to set the starttime
<FromGitter> <tenebrousedge> the server will have a `seconds` counter and know the length of all the videos
<FromGitter> <Blacksmoke16> https://regexr.com/4fqf9
<FromGitter> <Blacksmoke16> then just need to do the second round of gsub to remove invalid chars from the quantity for example group
<FromGitter> <Blacksmoke16> anyway imma get to bed o/
<FromGitter> <tenebrousedge> kk, nighty night
<FromGitter> <Nbotz> night
<FromGitter> <Nbotz> im using the basic HTML player. i get having a global seconds counter for the server, and i kinda get jumping people in using that seconds counter, but i dont know of any way to get the length of videos from crystals end
<FromGitter> <Nbotz> maybe use redis? but i dont know haha
<FromGitter> <tenebrousedge> there's nothing in Crystal that will do that, you would need ffmpeg or similar
<FromGitter> <Nbotz> i tried ffmpeg eariler using the `system` function, and it only dumps output in the console
<FromGitter> <tenebrousedge> https://crystal-lang.org/api/0.29.0/Process.html#run(command:String,args=nil,env:Env=nil,clear_env:Bool=false,shell:Bool=false,input:Stdio=Redirect::Close,output:Stdio=Redirect::Close,error:Stdio=Redirect::Close,chdir:String?=nil):Process::Status-class-method
<FromGitter> <tenebrousedge> you can also use backticks
<FromGitter> <tenebrousedge> ```\`ffmpeg -i video.mpg\````
<FromGitter> <tenebrousedge> more info about backticks: https://crystal-lang.org/reference/syntax_and_semantics/literals/command.html
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
DTZUZU has quit [Ping timeout: 245 seconds]
DTZUZO has quit [Ping timeout: 258 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
RX14 has quit [*.net *.split]
oprypin has quit [*.net *.split]
oz has quit [*.net *.split]
olbat[m] has quit [*.net *.split]
coderobe has quit [*.net *.split]
return0e has quit [*.net *.split]
devil_tux has quit [*.net *.split]
blassin has quit [*.net *.split]
Yxhuvud has quit [*.net *.split]
return0e has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
RX14 has joined #crystal-lang
oprypin has joined #crystal-lang
coderobe has joined #crystal-lang
oz has joined #crystal-lang
olbat[m] has joined #crystal-lang
Yxhuvud has joined #crystal-lang
blassin has joined #crystal-lang
devil_tux has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZU has joined #crystal-lang
<FromGitter> <mavu> Why do {{ }} and {% %} both exist in macro land? ⏎ The one seems only to be used in flow control? Is that the reason?
go|dfish has quit [Ping timeout: 248 seconds]
<FromGitter> <vladfaust> @Blacksmoke16 1) It's not that bad to use interpolation, after all 2) For PG, you should use `$1` instead of `?`
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
<FromGitter> <j8r> @mavu `{{}}` produce text, `{%%}` is transparent
laaron has joined #crystal-lang
ashirase has quit [Ping timeout: 258 seconds]
ashirase has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
Groogy has quit [Quit: WeeChat 2.5]
DTZUZO has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
rohitpaulk has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Client Quit]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <r00ster91> is there no string method for counting the occurrences of a whole string in a string? `String#count(String)` unfortunately has this really annoying behavior where it counts every char of the string I'm giving
_whitelogger has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
alex`` has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
_whitelogger has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
lucasb_ has joined #crystal-lang
laaron has joined #crystal-lang
lucasb_ is now known as lucasb
<FromGitter> <Blacksmoke16> > It's not that bad to use interpolation
<FromGitter> <Blacksmoke16> :thinking:
<FromGitter> <Blacksmoke16> I can see the query being generated is correct `SELECT * FROM types WHERE (name LIKE '%$1%')`
<FromGitter> <Blacksmoke16> @vladfaust ^
laaron has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> @r00ster91 `"foo bar foo".scan("foo").size # => 2`
laaron has joined #crystal-lang
laaron has quit [Client Quit]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
<FromGitter> <r00ster91> that's very inefficient. I guess I will send a pr
<FromGitter> <Blacksmoke16> 👍 sounds like a plan
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter> <Blacksmoke16> @r00ster91 couldn't you just use count with a restriction of `String`?
<FromGitter> <r00ster91> you mean add ` : String` after `String#count`'s `*sets`?
<FromGitter> <Blacksmoke16> similar to https://crystal-lang.org/api/master/String.html#count%28other%3AChar%29-instance-method but with String restriction
<FromGitter> <Blacksmoke16> but hm, might conflict with the `*sets` overload
<FromGitter> <r00ster91> yep that will very likely conflict
<FromGitter> <r00ster91> that's why
<FromGitter> <r00ster91> I really wish `String#count(*sets)` would just be removed
<FromGitter> <r00ster91> these `*sets` method are really confusing. getting `2` when doing `"hello".count("ll")` really isn't what you expect
<FromGitter> <Blacksmoke16> indeed
Creatornator has joined #crystal-lang
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faitswulff has joined #crystal-lang
faitswulff has quit [Client Quit]
Creatornator has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has quit [Ping timeout: 248 seconds]
alex`` has joined #crystal-lang
Creatornator has quit [Quit: Textual IRC Client: www.textualapp.com]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #crystal-lang
laaron has quit [Client Quit]
laaron has joined #crystal-lang
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
alex`` has quit [Ping timeout: 245 seconds]
laaron has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.5]
alex`` has joined #crystal-lang
go|dfish has joined #crystal-lang
<FromGitter> <wwselleck> are there an big obvious holes in the crystal web dev ecosystem? I'm trying to get into crystal and would like to contribute somewhere useful
<FromGitter> <Blacksmoke16> anything in particular?
<FromGitter> <watzon> There are plenty of areas that need help
<FromGitter> <watzon> APIs that need wrappers, social auth systems like passport, a fully functional static site generator, etc
<FromGitter> <watzon> https://github.com/crystal-community/crystal-libraries-needed/issues is a good place to look
<FromGitter> <watzon> What would be the Crystal equivalent of `Array#pack('Q<')`?
<FromGitter> <Blacksmoke16> idk what that does so :shrug:
<FromGitter> <tenebrousedge> There is no Array#pack
<FromGitter> <tenebrousedge> or String#unpack
<FromGitter> <watzon> I'm aware
<FromGitter> <watzon> Otherwise I'd use that
<FromGitter> <watzon> In Ruby `[num].pack('Q<')` packs an unsigned little-endian 64-bit integer. So `[200000000].pack('Q<')` would return `"\x00\xC2\xEB\v\x00\x00\x00\x00"`
<FromGitter> <watzon> I just don't know how to replicate that in Crystal
<FromGitter> <tenebrousedge> I am also not aware, but I've had occasion to note the lack of these features before, and I would definitely be willing to commit some time to porting the Ruby version
<FromGitter> <Blacksmoke16> and whats all that supposed to be?
<FromGitter> <Blacksmoke16> ah
<FromGitter> <Blacksmoke16> so you just want to convert a number to hex?
<FromGitter> <Blacksmoke16> is that the jist of this?
<FromGitter> <watzon> Not quite, really what I need to do is encode a number into a little endian binary string, but I think I figured out how to do it whout pack
<FromGitter> <watzon> It's just a lot more involved
<FromGitter> <tenebrousedge> `pack` is a way of being extremely specific about how numbers are represented in memory
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/72vq like this?
<FromGitter> <watzon> Lol well that is much shorter than what I was doing
<FromGitter> <watzon> Thanks @Blacksmoke16
<FromGitter> <Blacksmoke16> np
<FromGitter> <tenebrousedge> that looks like it would make writing `pack` easier
<FromGitter> <watzon> Although I do wonder which is technically more efficient
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d0577b1faf70031f91eb9ca]
<FromGitter> <Blacksmoke16> benchmark it
<FromGitter> <watzon> I'm going to haha
<FromGitter> <watzon> I'm curious
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <tenebrousedge> I mean, computers are good at bit manipulation, right?
moei has quit [Quit: Leaving...]
<FromGitter> <watzon> That's pretty much all they're good at
<FromGitter> <watzon> Wow. The IO method is about 35% faster.
<FromGitter> <Blacksmoke16> nice
<FromGitter> <watzon> @Blacksmoke16 do you know how to format the string as a hex string instead of unicode? Right now it's a lot of `"\u0001\u0000\u0000\u0000\u0000`
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/72vx like that?
<FromGitter> <Blacksmoke16> but at that point you could also just do like `"200000000".to_s 16`
<FromGitter> <watzon> I was thinking more like `\x00\x00\x00\x00\x00\x00\x00`
<FromGitter> <watzon> I don't think it actually matters though
<FromGitter> <watzon> As long as I have the right bytes
<FromGitter> <Blacksmoke16> if all you need are the bytes you can call `hexbytes` on a string
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/String.html#hexbytes%3ABytes-instance-method
<FromGitter> <watzon> I forgot about that method
<FromGitter> <watzon> Thanks :)
<FromGitter> <Blacksmoke16> Np