<croot>
staging.eql?("make unit test") == nil I don't know how to
<croot>
I would compare my get requests if assert("good results") then OK
<leftylink>
I thought that couldn't happen. I thought eql? is supposed to only return true or false, not nil.
Al2O3 has quit [Ping timeout: 248 seconds]
<croot>
how do you parse a get request then?
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
yxhuvud has quit [Read error: Connection reset by peer]
staff420 has joined #ruby
<staff420>
Is there a way to automatically do `git checkout HEAD -- Gemfile.lock && bundle install && git add Gemfile* && git rebase --continue` everytime my Gemfile.lock is having a conflict during a rebase?
Al2O3 has joined #ruby
yxhuvud has joined #ruby
___nick___ has quit [Ping timeout: 268 seconds]
<croot>
I get a passennger [emerg] still could not bind() Address already in use
_ht has quit [Remote host closed the connection]
<croot>
rm passenger.pid don't change anything.
<croot>
restarting nginx didn't change a thing.
_ht has joined #ruby
<croot>
Phusion Passenger(R) Standalone is not running, according to PID file /var/www/sinatra/passenger.3000.pid
_ht has quit [Remote host closed the connection]
<croot>
Ha! It's used by nginx.
drainpipe has joined #ruby
<croot>
How to unbind the port used by nginx?
<croot>
mh, i had a backend.conf file in /etc/nginx/conf.d/ using the port.
some14u has joined #ruby
dionysus69 has joined #ruby
drainpipe has quit [Ping timeout: 250 seconds]
<sam113101>
what do you think is the fastest way to check if a number ends with 6, number.digits.first == 6 or number % 10 == 6
<sam113101>
or even number.to_s[-1] == '6'
reset has joined #ruby
grokify has quit [Remote host closed the connection]
<croot>
string = 9876.to_s
<croot>
string[3,1].eql?(6)
<croot>
huh, can't convert a string into an integer.
<croot>
use maths
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<croot>
6.next.eql?(7) could work
some14u has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
teclator has quit [Remote host closed the connection]
<havenwood>
sam113101: modulo
<sam113101>
havenwood: thanks, that's what I thought
<havenwood>
sam113101: I seem modulo about 3x faster than digits and about 5x faster than string.
<havenwood>
With a random sampling of fairly small numbers.
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
That was my same expectation.
some14u has joined #ruby
<havenwood>
FWIW, the results are in the same order in JRuby and TruffleRuby. The proportions are quite similar in JRuby but in TruffleRuby modulo is wildly faster, folding the whol thing away.
<sam113101>
what's your favorite implementation of ruby?
<havenwood>
sam113101: My favorite to contribute to is TruffleRuby, since it's the highest proportion Ruby. CRuby is the one I typically use. JRuby is neat too. Natalie and Artichoke are too relatively new implementations that seem on a good trajectory.
<havenwood>
Natalie is C++ and actually emits C++ code and compiles to machine code for standard deployment. It's also quite young. Artichoke is implemented in Rust and aims to emit solid WASM binaries, etc.
<Guimauve>
havenwood - headius is jruby's biggest feature, IMHO. years and years ago i had a weird issue i mentioned offhand in #jruby on IRC. he was all like "huh" and 10 minutes later i had a patch
clemens3 has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
pavelz has joined #ruby
<havenwood>
Guimauve: Yeah, the whole JRuby team is awesome, +1!
drainpipe has joined #ruby
grokify has joined #ruby
drainpipe has quit [Ping timeout: 264 seconds]
plujon has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
jetchisel has joined #ruby
<John_Ivan>
anyone into software engineering?
<John_Ivan>
I ask because I have a question about a particular scenario which would seem to fall under "fault tolerance" or something
<John_Ivan>
so I have a script.
<John_Ivan>
the problem is, I'm shaky on the belief that this script is stable
<John_Ivan>
I have tests
<John_Ivan>
I just.... the nature of what the script does, feels like it's impossible to test against.
grokify has quit [Remote host closed the connection]
<John_Ivan>
the script goes on a webpage and checks a few links, to which it bumps a counter if the links satisfy the criteria
<John_Ivan>
simple enough. but I have to run this script for over a few thousand urls (from the same webpage)
<John_Ivan>
and the predictability of the website's content isn't very good, as I have encountered irregularities with how the data I expect it to be
<madprops>
what should i code with ruby
<John_Ivan>
in short, I find it extremely hard to make meaningful tests for such a script
Guimauve has quit [Quit: need more cats]
grokify has joined #ruby
<leftylink>
the only thing I'd really be interested in testing is how it responds to certain pieces of html
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
<havenwood>
John_Ivan: You might consider taking a look at the Async libraries like async-http, which compose pretty well for testing and scale nicely with Ruby 3.1.
<havenwood>
John_Ivan: Whatcha using for your HTTP client?
<John_Ivan>
havenwood, nokogiri. but that's not what I'm worried about. I'm worried about the html itself.
<John_Ivan>
leftylink, this
<John_Ivan>
but the possibilities are practically endless..
<John_Ivan>
I can at least think of 30 test cases; I think it's madness to do that for a single function.
grokify has quit [Remote host closed the connection]
<John_Ivan>
havenwood, nokogiri + open-uri **
<havenwood>
John_Ivan: You could use open-uri with `Fiber.schedule do` but I'd suggest taking a look at Typhoeus or async-http.
<John_Ivan>
havenwood, I think leftylink has narrowed down the scenario where my problem mostly lies with parsing rather than actually doing the web request.
<havenwood>
Ah, I missed the backlog.
<havenwood>
Reading now.
<John_Ivan>
out of frustration, I failed to do this distinction..
<John_Ivan>
havenwood, so yeah, in short, the HTML I'm dealing with is very shoddy.
<weaksauce>
how important is it to get 100% correct?
<havenwood>
HTML tends to be shoddy. Kinda sad XHTML didn't win!
<John_Ivan>
yeah, but this is shoddy in semantics not just HTML itself. anyway. weaksauce ehm, well, 100% is impossible because there will be urls that are 404s.
<John_Ivan>
so I have to parse, well, 404 pages.
<John_Ivan>
which are not the pages I expect but eh.
<John_Ivan>
have to account for it.
<John_Ivan>
weaksauce, let me try to summarize everything with 1 sentence.
<John_Ivan>
weaksauce, the html will contain data out of order (to what it usually is). is irregular in certain parts and regular in others. some content will exist under a class/id which it doesn't belong in. some tags are actually even missing. some pages are 404. other pages contain more information than required or expected.
<John_Ivan>
will/may ***
<John_Ivan>
as such the testing needed to create a function that parses "correctly" is absurd.
<weaksauce>
this is the anime catalog thing?
<John_Ivan>
weaksauce, close enough. yeah.
grokify has quit [Remote host closed the connection]
<John_Ivan>
weaksauce, it's ultimately the problem that people just aren't very conventional.
grokify has joined #ruby
<John_Ivan>
weaksauce, they may add a genre in one work, and another may lack genres completely.
<John_Ivan>
weaksauce, another one will have information about the subtitle placed in the wrong tag
<John_Ivan>
weaksauce, some information is kept in tags without ids or classes (holy cat)
<John_Ivan>
weaksauce, others contain more information than I need and because there's unnecessary stuff in there, my script goes haywire because maybe I've missed an edge case.
<John_Ivan>
that's more or less my situation..
<weaksauce>
sounds like a rough problem to solve well
<joto>
are you in fact web crawling? because in that case it'll be nearly impossible to do 'well'
<John_Ivan>
crawling? nah. scraping? somewhat. and yeah, I agree. it will be impossible to do well. but "relatively well" is acceptable to me. I just am getting overwhelmed by the amount of test cases I can come up with on how things can go wrong :D
<joto>
meant scraping indeed :)
<John_Ivan>
if I was crawling, that's be a nightmare compared to this situation
<John_Ivan>
I'd end up in tree nodes where the script just dies lol
<joto>
have been there too... it's a hard problem to solve because there little logic
<joto>
there's*
<John_Ivan>
weaksauce, let me tell you straight - I have my anime catalog scraped. It's on my disk. I have what I need.
<weaksauce>
how many sites are you scraping?
<John_Ivan>
this is just me "grooming" my data.
<John_Ivan>
weaksauce, one.
<John_Ivan>
weaksauce, but I need to "keep in sync" what I have on disk with the website.
<John_Ivan>
if that makes sense.
<John_Ivan>
I "groom" my data and "add/remove" as necessary to meet the "metadata" of the website.
<John_Ivan>
catalog entries die out. new ones come in. what I have on disk may not match for some works.
<John_Ivan>
that kind of thing.
<John_Ivan>
may not match what's online or what's online doesn't match what's on disk (because I simply don't have the work for example)
<joto>
exactly. it's what I'm doing too for my content but I imagine it's harder for anime
<John_Ivan>
makes me feel more relieved that it's actually a hard problem - was feeling rather incompetent a few minutes ago
<John_Ivan>
maybe I need a break.
<joto>
nah it is a hard problem. ten years ago or so I categorised all my content against thetvdb
<joto>
and eventhough they have an api: the numbering changes on that site during the years
<joto>
so had to do a lot of manual work
<John_Ivan>
I feel ya. I end up doing some manual work for certain portions which is just quicker done than writing yet another script for "this scenario"
<joto>
yep, you'll have to do a mix of automation and manual work. it's impossible to fully automate the process as metadata changes
<joto>
scraping a html soup is cool at first but it's a lot of work to keep up
<John_Ivan>
word.
* joto
is going to bed zzz
<John_Ivan>
gnight and thanks for your input
<John_Ivan>
anyway, thanks weaksauce, havenwood for your input too.
<John_Ivan>
also, been a long while since I've spoken/chatted here with you guys. how've you been
grokify has quit [Remote host closed the connection]
<joto>
yw good luck! i'll maybe ping back as I know someone who does a lot of anime categorising.
<John_Ivan>
joto, cheers. any advice is welcome.
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grokify has joined #ruby
jetchisel has joined #ruby
grokify has quit [Ping timeout: 250 seconds]
<sam113101>
how do I get the methods of a module, but not those that are inherited?