claudiuinberlin has quit [Ping timeout: 245 seconds]
vondruch has joined #ruby
xuyuheng has joined #ruby
Fusl has quit [Remote host closed the connection]
jenrzzz has joined #ruby
Fusl has joined #ruby
ellcs has joined #ruby
Ai9zO5AP has quit [Ping timeout: 272 seconds]
jenrzzz has quit [Ping timeout: 258 seconds]
jenrzzz has joined #ruby
hightower2 has joined #ruby
deepredsky has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
conta has joined #ruby
jenrzzz has joined #ruby
Ai9zO5AP has joined #ruby
deepredsky has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hightower2 has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
deepredsky has joined #ruby
conta has quit [Read error: Connection reset by peer]
conta has joined #ruby
ShalokShalom has quit [Remote host closed the connection]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schne1der has quit [Ping timeout: 244 seconds]
DiscoM has joined #ruby
<DiscoM>
Hello
banisterfiend has joined #ruby
<DiscoM>
Someone is using this library ? https://github.com/aspettl/dns-zone i have some pb with the cname records, and my Ruby knowledge is to low to find the bug.
sylario has joined #ruby
ur5us has quit [Remote host closed the connection]
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
leitz has joined #ruby
<ryouba>
is there a way to make a regex gsub work like in https://regex101.com/r/Vaz661/2 (i.e. with global and multiline, named capture groups, substitution based on the group names)?
deepredsky has joined #ruby
<ryouba>
(trying with `lines.gsub /.../m {|match| ...}` to no avail so far)
xuyuheng has quit [Ping timeout: 258 seconds]
<ryouba>
oh, even at https://rubular.com/r/WHXrCmrKPfQMAx it works just fine ... just in code i can't make it work ... it only keeps matching the occurances that have no newline in them
<ytti>
personally i would go other way
<ytti>
instead of doing complex regexp, i'd dos omething like this
<ytti>
input.lines.each do |line|
<ytti>
words = line.split
<ytti>
next unless word[1][0..1] == '[['
<ytti>
...
AJA4350 has joined #ruby
<ytti>
usually if you need help with regexp, then regexp was not the right solution
<ryouba>
ytti: seems like trying to deal with those entries that span 2 lines would be even more complex using that approach
<ytti>
in terms of readability and maintainability
<ryouba>
also that regex was really easy to come up with given the existence of pages like the two i linked ... so i wouldn't classify it as a "complex" one
<ytti>
ryouba, sorry, i only saw first url, and it didn't have multilines
<ryouba>
huh?
<ryouba>
it's the exact same text
* ryouba
looks
<ytti>
ryouba, aah just didn't scroll
<ytti>
the view rendered in 'test string' box didn't contain multilines
<ryouba>
ah
<ryouba>
yeah, it's only some of the lower entries
<ytti>
i think multiple is possible with that loop still
<ytti>
just push result to soem array, once result is complete
<ryouba>
in general it seems like useful knowledge to me to know how Rubular deals with its user input
<ryouba>
wow
<ryouba>
trying with your approach
<ryouba>
this is becoming a complex algorithm
marz_d`ghostman has quit [Ping timeout: 256 seconds]
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
reber has joined #ruby
<ytti>
StringScanner may also be your friend
jinie has quit [Ping timeout: 244 seconds]
xco has quit [Ping timeout: 258 seconds]
jinie has joined #ruby
dostoyevsky has quit [Ping timeout: 244 seconds]
deepredsky has quit [Ping timeout: 246 seconds]
sagax has quit [Ping timeout: 244 seconds]
ua has quit [Ping timeout: 244 seconds]
_axx has joined #ruby
dostoyevsky has joined #ruby
ua has joined #ruby
<ryouba>
ytti: it kind-of works now (https://gist.github.com/sixtyfive/e1f70533598daac01931e611790aaea7 ... except for some bug, that I'm hunting now). but it would definitely be much more elegant and easier to read if there was just a way to treat a string with newlines in it the same way that regex101.com and rubular.com do.
<ytti>
or some other way to return different size enumerable
<phaul>
something.select(&:sometimes)
<ytti>
i thought select returns itself
pwnd_nsfw has quit [Ping timeout: 258 seconds]
<ytti>
when true
<phaul>
it does
<ytti>
where as typically you want to mutate the return value
<ytti>
so you'd rather foo = something,select(&:sometimes).map ...
<phaul>
many ways to skin that cat :)
<ryouba>
phaul: what about my original question ... how might rubular.com deal with its user input? i.e., a long, multiline string and a regex that (on regex101.com, i.e. in Perl lingo) would have "gm" as its options?
octos has quit [Remote host closed the connection]
<phaul>
I donno. I would have thought that rubular does what the ruby regex engine does. I don't know why you are seeing discrepancy
UncleCid__ has joined #ruby
fphilipe_ has quit [Ping timeout: 252 seconds]
deepredsky has quit [Ping timeout: 245 seconds]
pwnd_nsfw` has quit [Ping timeout: 272 seconds]
deepredsky has joined #ruby
kyrylo has joined #ruby
powerbit has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
Swyper has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 258 seconds]
Swyper has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ruby-lang461 has joined #ruby
NL3limin4t0r_afk is now known as NL3limin4t0r
xuyuheng has joined #ruby
<ryouba>
phaul: i don't think there's a difference. i think i don't know how to use the ruby regex engine toward that end. my attempt was basically `str.gsub /regex/m, 'subst'` and my best guess as to why it didn't work is the lack of a 'g' option.
ruby-lang461 has quit [Ping timeout: 256 seconds]
vondruch_ has joined #ruby
xuyuheng has quit [Quit: Quit: My MacBook Pro has gone to sleep. ZZZzzz?]
vondruch has quit [Ping timeout: 248 seconds]
vondruch_ is now known as vondruch
banisterfiend has joined #ruby
deepredsky has quit [Ping timeout: 268 seconds]
banisterfiend has quit [Ping timeout: 258 seconds]
fphilipe_ has joined #ruby
leitz has quit [Quit: Leaving]
<NL3limin4t0r>
ryouba: Ruby regex have the Perl "m" option always enabled, in Ruby `^` and `$` alway match the start and end of an line. If you want to match the start and end of the entire string you'll have to use `\A` and `\z`. Ruby doesn't have the "g" option, depending on the usage it will automatically stop on the first match, or go through all matches.
<NL3limin4t0r>
eg. text[regex] only matches ones, while text.scan(regex) matches all the posibilities.
<NL3limin4t0r>
Ruby only supports the "m", "i" and "x" flags. From whom "i" and "x" are the same as in Perl while the "m" option in Ruby is equal to the "s" option in Perl.
codefriar has joined #ruby
sagax has joined #ruby
esrse has quit [Ping timeout: 258 seconds]
Nicmavr has joined #ruby
Kestrel-029 has quit [Ping timeout: 245 seconds]
wald0 has quit [Quit: Lost terminal]
salerace has joined #ruby
<haxx0r>
what's best way to work with a websocket api? i would think JavaScript can do it best?
<mnemon>
haxx0r: plenty of implementations for common langs
zodd has joined #ruby
<mnemon>
but depends what you're doing with it
<haxx0r>
all the exchanges have websocket APIs
<haxx0r>
so you get real time order book
_whitelogger has joined #ruby
Talion has joined #ruby
deepredsky has joined #ruby
schne1der has joined #ruby
migalenkom has joined #ruby
reber has quit [Remote host closed the connection]
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
grilix has joined #ruby
<haxx0r>
mochi
<haxx0r>
i got it!
codefriar has quit [Read error: Connection reset by peer]
doodlebug has quit [Ping timeout: 248 seconds]
doodleb46 has joined #ruby
aupadhye has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
codefriar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spiette has joined #ruby
Kestrel-029 has joined #ruby
Nicmavr has quit [Ping timeout: 245 seconds]
migalenkom_1 has joined #ruby
<adam12>
migalenkom_: If you want to get assistance for your issue, my suggestion is to digest it into a smaller, reproducable issue that shows what you're expecting and what you're getting instead. Not everyone will have knowledge of Texecom or serial ports, but might be able to assist you in decoding some binary if you show expected value. ie. foobar.unpack("*U") == "hello world" or something.
<havenwood>
migalenkom_: when you write it just returns a single line with the read?
Fusl has joined #ruby
haxx0r has quit [Ping timeout: 272 seconds]
Nicmavr has joined #ruby
ljarvis has joined #ruby
Kestrel-029 has quit [Ping timeout: 245 seconds]
<havenwood>
migalenkom_: It looks like you're requesting a "read zone status" for zones 9-16, based on the docs. So you're expecting 16 bytes of data, followed by 0, 13, 10?
<havenwood>
or the checksum, I guess, so 10, 13, 10?
<havenwood>
migalenkom_: Did "Request Access with Control Panel" return "OK"?
<migalenkom_1>
havenwood: yes, Request Access returned OK.
<havenwood>
migalenkom_1: And it had the checksum and ended in 13, 10?
<havenwood>
migalenkom_: It makes sense why 8 zones would give you back 16 bytes, but why no trailing C/SM, 0x0D, 0x0A?
<migalenkom_1>
havenwood: the response on request access is OK\r\n without checksum
<migalenkom_1>
havenwood: Maybe i sent request in some incorrect way.
<migalenkom_1>
havenwood: But other requests that just returns OK or ERROR works
weteamsteve has joined #ruby
deepredsky has joined #ruby
laaron has quit [Remote host closed the connection]
<havenwood>
migalenkom_1: that's the [18, 8] you were getting back for each zone
codefriar has quit [Client Quit]
<havenwood>
I dunno why no \r\n
banisterfiend has joined #ruby
<al2o3-cr>
havenwood: because in the Texecom class they've got device.readline.chomp
<havenwood>
al2o3-cr: ah, i shoulda read the code
<havenwood>
now it makes total sense
<havenwood>
al2o3-cr: thanks!
<al2o3-cr>
havenwood: np
<havenwood>
migalenkom_1: so those are just the LBD and HBD, check the bits
<havenwood>
migalenkom_1: al2o3-cr explained the no /r/n mystery - it's chomped in the code and I wasn't thinking about it being preprocessed before us seeing it
Talion has quit [Quit: Connection closed for inactivity]
deepreds1 has joined #ruby
deepredsky has quit [Ping timeout: 268 seconds]
sagax has quit [Ping timeout: 246 seconds]
sagax has joined #ruby
sagax has quit [Client Quit]
sagax has joined #ruby
regedit has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
cthulchu_ has joined #ruby
<migalenkom_1>
havenwood: thanks you so much, you made my day
xagut has joined #ruby
<migalenkom_1>
al2o3-cr: thanks for explaining the no /r/n mystery
cthu| has quit [Ping timeout: 258 seconds]
<al2o3-cr>
migalenkom_1: np
zodd has quit [Ping timeout: 268 seconds]
migalenkom_1 has quit [Quit: Leaving.]
<xagut>
I'm toying with the ruby source. I added a `.second` method to Array. My change shows up in the the `miniruby` binary build but not the `ruby` binary (Even after a clean build).
fphilipe_ has quit [Ping timeout: 248 seconds]
<xagut>
idk if anybody has any pointers on why that might be :-/
comet23 has joined #ruby
Tempesta has quit [Quit: AdiIRC is updating to v3.5 Beta Build (2019/05/27 UTC) 64 Bit]
Tempesta has joined #ruby
<comet23>
i'm having trouble understanding what the value of power(base,exponent-1) is in the recursive call
<comet23>
return base * power(base,exponent-1)
cthu| has joined #ruby
graft has joined #ruby
graft has quit [Changing host]
graft has joined #ruby
cthu| has quit [Max SendQ exceeded]
cthu| has joined #ruby
cthulchu_ has quit [Ping timeout: 248 seconds]
<mozzarella>
comet23: 2^5 = 2 * 2^4
wildermind has quit [Quit: Connection closed for inactivity]
<ruby[bot]>
comet23: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
kyrylo has joined #ruby
<comet23>
the python tutor website is giving me errors
<phaul>
ah, yours is infinite loop. you check base being zero not exponent
<comet23>
you can't make anonymous gists anymore :*(
<comet23>
oh thank you
esp32_prog has quit [Ping timeout: 248 seconds]
<comet23>
i still don't get it
altious2 has quit [Quit: Leaving]
rrichardsr3 has quit [Quit: He who dares .... wins.]
Ltem has quit [Quit: bbl]
<comet23>
i don't get how the return value is doubling
ShalokShalom has joined #ruby
<phaul>
each call was made from a call one step higher up which multiplies with 2 so it's multiplied after the return (not by that call but the call that called it
<phaul>
it's hard to explain on irc. but when you return it's not doubled yet. It's going to be doubled in the caller
<comet23>
i always thought my_function(n) evaluated to a single number
<comet23>
do you have time? i'll send you money for explaining it
<phaul>
I can try and might fail :)
<phaul>
you do 5 calls all the way down to exp == 0 . f(f(f(f(f(0)))) at this point nothing is doubled and this is when the code in the innermost f hits the if condition
<phaul>
it is returning 1, so now you have 4 f, with 1 bing inside the 4th. f(f(f(f(1))))
<phaul>
the innermost is now in the base * f (... just finished with the evaluation of its f call, it was 1.
<phaul>
so it itself returns 2 * 1. to the 3rd layer
ShalokShalom has quit [Remote host closed the connection]
dar123 has joined #ruby
<phaul>
the 3rd layer receives 2 from the 4th, whil it was doing base * f(.. so it itself returns 4 (2*2)
<phaul>
end so on all the way up
conta has joined #ruby
Nicmavr has joined #ruby
Kestrel-029 has quit [Ping timeout: 245 seconds]
suukim has joined #ruby
<phaul>
yet another way of saying it is f(5) = f(2*f(4)) = f(2*f(2*f(3))) = f(2*f(2*f(2*f(2)))) = f(2*f(2*f(2*f(2*f(1))))) = f(2*f(2*f(2*f(2*f(2*f(0))))) = f(2*f(2*f(2*f(2*f(2*1))))) = f(2*f(2*f(2*f(2*2*1))))) = f(2*f(2*f(2*2*2*1))) = (2*f(2*2*2*2*1)) = (2*2*2*2*2*1)
<phaul>
probably I messed up the number of parens here and there. but it shows what's happeneing
<phaul>
ah I messed up the placement of fs on the way out. let me try with a smaller example:
octos has joined #ruby
cd has joined #ruby
<phaul>
ah. it's much easier to explain this stuff on a whiteboard...
<phaul>
comet23: did this help so far?
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
evdubs has quit [Remote host closed the connection]
evdubs has joined #ruby
cthulchu_ has joined #ruby
orbyt_ has joined #ruby
Ai9zO5AP has quit [Quit: WeeChat 2.4]
hiroaki has joined #ruby
abaiste^ has quit []
renich has quit [Ping timeout: 244 seconds]
tsrt^ has joined #ruby
FernandoB has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dar123 has joined #ruby
renich has joined #ruby
cthulchu_ has quit [Ping timeout: 258 seconds]
esp32_prog has joined #ruby
bambanx has joined #ruby
esp32_prog has quit [Ping timeout: 272 seconds]
haxx0r has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hackeron has joined #ruby
dar123 has joined #ruby
hackeron has quit [Ping timeout: 258 seconds]
dar123 has quit [Client Quit]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure has joined #ruby
bsdbandit has quit [Quit: leaving]
Swyper has joined #ruby
<haxx0r>
XMR mooning, time to cashout boys!
bsdbandit has joined #ruby
Nicmavr has joined #ruby
Kestrel-029 has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
dorian has joined #ruby
<dorian>
hey can somebody reset my brain here about calling a method with a predefined proc as if it was an inline block in the context of the caller?
P0rkD_ has joined #ruby
<dorian>
i have a bunch of dsl stuff i want to stick in a dispatch table
<dorian>
essentially trying to metaprogram class Foo < Bar { dsl_here }
FernandoB has quit [Remote host closed the connection]
<mjacob>
jerthank you, that does exactly what i need
Swyper has quit [Remote host closed the connection]