konsolebox has quit [Read error: Connection reset by peer]
centrx has joined #ruby
konsolebox has joined #ruby
jonhg has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jonhg has quit [Ping timeout: 265 seconds]
ur5us_ has quit [Ping timeout: 264 seconds]
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jenrzzz has joined #ruby
hiroaki has quit [Ping timeout: 265 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
bucareli has joined #ruby
hiroaki has joined #ruby
bucareli has quit [Client Quit]
jonhg has joined #ruby
split-brain has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
centrx has quit [Remote host closed the connection]
centrx_ has joined #ruby
centrx_ has quit [Ping timeout: 264 seconds]
konsolebox has joined #ruby
centrx has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
centrx has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
ur5us_ has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
centrx has joined #ruby
blackmesa has joined #ruby
cloud69 has joined #ruby
konsolebox has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
<cloud69>
If an article has multiple paragraps, I can use Nokogiri to map them all into an array, do some cleaning, and then eventually join back together again. But how to map into a similar array if the article has everything packed into a single paragraph? https://gist.github.com/cloud69420/7d33b3d5898ffbcaae32429665a788c5
ur5us_ has quit [Ping timeout: 264 seconds]
centrx has joined #ruby
vondruch has quit [Quit: vondruch]
moldorcoder7 has quit [Ping timeout: 264 seconds]
vondruch has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
junaidnaseer2 has joined #ruby
centrx has joined #ruby
naftilos76 has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
moldorcoder7 has joined #ruby
lockweel has joined #ruby
centrx has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
centrx has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
konsolebox has joined #ruby
centrx has joined #ruby
jetchisel has quit [Ping timeout: 260 seconds]
Rudd0 has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
jetchisel has joined #ruby
kslt1 has joined #ruby
feriman has joined #ruby
akem has quit [Quit: leaving]
Fusl has quit [Max SendQ exceeded]
Fusl has joined #ruby
centrx has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
junaidnaseer2 has quit [Ping timeout: 256 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
centrx has joined #ruby
kslt1 has quit [Remote host closed the connection]
kslt1 has joined #ruby
centrx has quit [Ping timeout: 264 seconds]
konsolebox has quit [Read error: Connection reset by peer]
thecoffemaker_ has quit [Quit: So long and thanks for all the fish!]
thecoffemaker has joined #ruby
<User4588>
Hi, I would like to generate all combinations like in this example, can someone help me and tells me how is it called in algebraic? https://paste.debian.net/1189045/
maryo87 has joined #ruby
thecoffemaker has quit [Remote host closed the connection]
maryo has quit [Ping timeout: 246 seconds]
jonhg has quit [Remote host closed the connection]
feriman has quit [Ping timeout: 245 seconds]
thecoffemaker has joined #ruby
hiroaki has quit [Ping timeout: 272 seconds]
infernix has joined #ruby
jonhg has joined #ruby
TCZ has joined #ruby
hiroaki has joined #ruby
jonhg has quit [Ping timeout: 245 seconds]
naftilos76 has joined #ruby
<gearnode>
Maybe you use Array#combination for this kind of purpose.
konsolebox has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
TCZ has quit [Quit: Apophis - status nieznany]
jonhg has joined #ruby
<User4588>
phaul, NL3limin4t0r Sorry I was away. Thanks for these examples they works as expected. Now I need to understand them. It seems a little strange to add 3 nil values to the array.
<NL3limin4t0r>
User4588: Although the solution with "nil" values might be shorter code-wise, it's quite inefficient because it creates duplicate collections (`[1, 2, nil, nil]` is present 3 times). Not only are duplicates created, you also need to map through the entire result and compact all elements, then remove the duplicates.
<NL3limin4t0r>
^ "compact" = "remove nil values"
Swyper has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 246 seconds]
gray-_-wolf has quit [Quit: WeeChat 3.0]
dinfuehr has joined #ruby
Swyper has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
DaRock has quit [Ping timeout: 245 seconds]
<nakilon>
but it's only one loop instead of nested
dinfuehr has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 260 seconds]
Swyper has quit [Ping timeout: 272 seconds]
Emmanuel_Chanel has joined #ruby
<NL3limin4t0r>
That might be the case, but that doesn't mean it's more efficient. Take a look at how many combinations are generated:
<NL3limin4t0r>
I'd say a logical optimization, not premature.
<nakilon>
every optimization is logical
<nakilon>
but do you really need them all?
<NL3limin4t0r>
I don't mean "logical" as in computer logical, just something that is logical to do.
<nakilon>
nested loop, bigger code -- more space for a bug
<NL3limin4t0r>
More cryptic code is also a source of bugs.
<nakilon>
every code is cryptic
<nakilon>
I used just a Ruby stdlib, nothing secret
<NL3limin4t0r>
&>> a = [*1..3]; a.size.downto(1).sum_by { |n| a.combination(n) }
<rubydoc>
# => -e:4:in `<main>': undefined method `sum_by' for #<Enumerator: 3:downto(1)> (NoMethodError)... check link for more (https://carc.in/#/r/ajc2)
<NL3limin4t0r>
&>> a = [*1..3]; a.size.downto(1).sum { |n| a.combination(n) }
<rubydoc>
# => -e:4:in `+': Enumerator can't be coerced into Integer (TypeError)... check link for more (https://carc.in/#/r/ajc3)
<NL3limin4t0r>
&>> a = [*1..3]; a.size.downto(1).sum { |n| a.combination(n).size }
<cloud69>
Thought I had to play with stuff like simple_format or even kramdown!
shtirlic has quit [Ping timeout: 264 seconds]
ur5us has quit [Ping timeout: 264 seconds]
shtirlic has joined #ruby
shtirlic has quit [Ping timeout: 264 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
ur5us has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
<cloud69>
(which is a very stupid idea in hindsight)
jenrzzz has quit [Ping timeout: 245 seconds]
split-brain has quit [Remote host closed the connection]
gearnode has quit [Ping timeout: 272 seconds]
centrx has quit [Ping timeout: 260 seconds]
blackmesa has quit [Ping timeout: 260 seconds]
swaggboi has quit [Quit: C-x C-c]
Technodrome has joined #ruby
<scriptonaut>
I have a really weird thing happening. I was having an encoding error caused by certain characters in the MS SQL db, using TinyTds. I added a rescue for the error, and it's skipping it and still failing. So I added a StandardError catch, and now I'm catching all of these weird activerecord errors. Here's the code and the error info: https://gist.github.com/robins35/6732b56f9f8f9bb1b482c0a8938dfd13
<scriptonaut>
The TinyTds gem readme says this: TinyTds::Error - A wrapper for all FreeTDS exceptions, so it should be catching the error
<scriptonaut>
but most of all, why does adding a rescue for StandardError start to trigger all of these errors that don't happen when I don't have the rescue at all?
<scriptonaut>
it's like adding the second rescue statement causes errors to happen that otherwise weren't happening. The error itself makes no sense, it's saying my activerecord method is returning false, when it always returns an empty array.