havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.0, 3.0.3, 2.7.5: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
<nakilon> probably "blocked #{reason} forever"
jsnwesson has joined #ruby
<nakilon> it's chinese service
<havenwood> yup
<nakilon> weird words order is possible
<havenwood> "blocked #{reason} forever" is at least poetic
jsnwesson has quit [Client Quit]
ouestbillie has quit [Ping timeout: 256 seconds]
<nakilon> oh it's ok, it's not me who is poetically blocked, it's the page of the user I try to read
<ox1eef> IRC, where east meets west.
ouestbillie has joined #ruby
<nakilon> I want to draw a bar plot with X axis going in the middle with two sequences of bars -- one color bars up and another color bars down from the axis
<nakilon> should I interpolate the data from ruby to html as a json literal for chartjs like I usually do and learn to render another type of plots or should I use gnuplot? their manual is 400 pages long...
<ox1eef> i've been using HTML5's canvas for something vaguely similar. It is pretty fun to learn.
<nakilon> do you mean you drew rects manually?
<ox1eef> yep
<nakilon> _<>
<ox1eef> and it can do much more, it's worth having in your toolbox
<nakilon> I can't find what I need neither in gnuplot manual nor here https://github.com/red-data-tools/GR.rb
<ox1eef> i dunno about gnuplot
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
bluedust has joined #ruby
bluedust has quit [Ping timeout: 256 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
John_Ivan has quit [Read error: Connection reset by peer]
teclator has joined #ruby
fredlinhares has joined #ruby
pgib has quit [Ping timeout: 240 seconds]
<adam12> I want to extend rdoc but I'm already not happy. Bleh.
CrazyEddy has joined #ruby
<ox1eef> has rdoc moved on from the darkfish template
<nakilon> hm, I've got a thread problem
perrierjouet has joined #ruby
<nakilon> I minified the problematic code to this https://dpaste.org/MSVS/slim
<nakilon> and if I order this as "Thread.new do cache_json.call do delayed.call do" I'll spawn user.size amount of threads immediately
<nakilon> that is higher than ulimit and will cause an error
constxd_ has joined #ruby
<mooff> nakilon, is each_with_progressbar more like map_with_progressbar?
perrierjouet has quit [Quit: WeeChat 3.4]
BSaboia has quit [Quit: This computer has gone to sleep]
<mooff> i think you're spawning user.size amount of threads immediately in the paste already
BSaboia has joined #ruby
perrierjouet has joined #ruby
<mooff> sorry, now i see
<mooff> in the first form, put next if File.exist? "#{id}.json" before delayed.call
<mooff> i think that's the quick solution ^ at least the one that avoids e.g. Queue, a fixed thread pool
oxfuxxx has joined #ruby
<mooff> i think to be robust on a cold start you might need a thread pool + Queue anyway
oxfuxxx has quit [Client Quit]
<mooff> don't have more time to analyze, sorry :)
fredlinhares has quit [Quit: WeeChat 3.4]
Pipip has joined #ruby
<nakilon> the only solution I see currently is to teach the cache_json to see that yielded result is a Thread and spawn another Thread for delayed to file write
<nakilon> *delayed file write
<nakilon> that is ugly and doubles the number of thread for no obvious reason
<nakilon> or maybe I should go for the "spawn users.size threads" but replacing them with Fibers that I unfortunately don't remember how to use
duderonomy has quit [Read error: Connection reset by peer]
<nakilon> though probably fibers won't make requests go in parallel so it won't work
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
perrierjouet has quit [Quit: WeeChat 3.4]
<havenwood> nakilon: Fibers can make requests parallel.
<havenwood> nakilon: Check out the Async gems. Basic Async works with any Ruby HTTP client or there's async-http.
perrierjouet has joined #ruby
foxxx0 has quit [Ping timeout: 260 seconds]
foxxx0 has joined #ruby
constxd_ has quit [Ping timeout: 256 seconds]
Rounin has quit [Ping timeout: 240 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
bluedust has joined #ruby
Leon_ has joined #ruby
Leon_ is now known as Guest6768
leonthemisfit has quit [Ping timeout: 250 seconds]
duds-_ has joined #ruby
duds- has quit [Ping timeout: 276 seconds]
duds-_ is now known as duds-
bluedust_ has joined #ruby
shokohsc has quit [Read error: Connection reset by peer]
shokohsc has joined #ruby
bluedust has quit [Ping timeout: 256 seconds]
fef has joined #ruby
teclator has joined #ruby
_ht has joined #ruby
Pipip has quit [Remote host closed the connection]
bluedust has joined #ruby
bluedust_ has quit [Ping timeout: 250 seconds]
Bounga has joined #ruby
Rounin has joined #ruby
dviola has joined #ruby
perrierjouet has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4]
hanzo has quit [Quit: Connection closed for inactivity]
gproto23_ has joined #ruby
Leon_ has joined #ruby
Leon_ is now known as Guest6533
Guest6768 has quit [Ping timeout: 250 seconds]
perrierjouet has joined #ruby
bluedust_ has joined #ruby
bluedust has quit [Ping timeout: 250 seconds]
<nakilon> havenwood do you mean I just replace my Thread with Async do and then .wait?
<nakilon> instead of .value
<gr33n7007h> nakilon: that should work (i think :)) looking from the code yesterday.
ferr_ has joined #ruby
fercell has quit [Ping timeout: 240 seconds]
fef has quit [Ping timeout: 276 seconds]
<gr33n7007h> hang on, that'll make become synchronous though.
<gr33n7007h> nakilon: better wait until havenwood or someone with more knowledge of the sync lib.
<gr33n7007h> *async
fercell has joined #ruby
ferr_ has quit [Ping timeout: 250 seconds]
<gr33n7007h> nakilon: https://imgur.com/a/YFWRxsW
fef has joined #ruby
<nakilon> I mean array.map{ Async{ .. } }.each(&:wait)
<gr33n7007h> nakilon: tbh, i'm new to this lib too. i'd recommend waiting until havenwood wakes up, he's kinda knows this lib well :)
<g_sg> hi all, i ran into an interesting quirk with UTF-8 handling in ruby
<g_sg> could someone explain this behaviour?
royo25 has joined #ruby
<g_sg> my expectation was that fp.readchar would return the same as "☕️", but that test actually fails
fef has quit [Remote host closed the connection]
Byteflux has quit [Read error: Connection reset by peer]
Byteflux has joined #ruby
<nakilon> g_sg print fp.encoding
<nakilon> if it's not utf-8 then you'll have to pass encoding: "utf-8" in file.open
<nakilon> maybe your ruby environment does not default to utf
constxd_ has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4]
<g_sg> hmmm good pointer. i don't think IO or File have an #encoding method (getting an error), but let me see if there's something similar
<g_sg> fp.external_encoding returns "UTF-8"
<g_sg> STDOUT.external_encoding is nil, however
royo25 has quit [Quit: Bye]
<nakilon> I'm being stupid today; how do I map(&:call) the [->{sleep rand; 1},->{sleep rand; 2},->{sleep rand; 3}] with .with_progressbar
royo25 has joined #ruby
<nakilon> g_sg what about .getc
<g_sg> same
<g_sg> <"☕️"> expected but was <"☕">
<g_sg> "☕️".bytes # => [226, 152, 149, 239, 184, 143]
<g_sg> fp.getc.bytes # => [226, 152, 149]
<g_sg> wat.png
<nakilon> [->{sleep rand; 1},->{sleep rand; 2},->{sleep rand; 3}].each.with_progressbar(&:call) # returns [<Proc>, ...] instead of [1,2,3] ..(
<nakilon> oh, nvm, s/each/map
fef has joined #ruby
lispy has joined #ruby
fef has quit [Remote host closed the connection]
unknown__ has joined #ruby
lispy has quit [Quit: Leaving]
<nakilon> hm, I don't get it, Async{} waits, I even checked that I'm using ruby 3
<nakilon> should I wrap in Async{|task| task.async{ ?
<nakilon> undefined method `new' for Async:Module
<gr33n7007h> nakilon: you use task.async to spawn more Async tasks that run concurrently to each other.
<gr33n7007h> nakilon: Async is a method on Kernel.
<nakilon> I don't want to wrap everything in Async do
<nakilon> because I want to wait for all tasks and return an array of results
In0perable has quit [Quit: All your buffer are belong to us!]
<gr33n7007h> nakilon: use a barrier then.
<nakilon> hm "00:42:02 <havenwood> nakilon: yes, looking at the code it looks like you can do: task = Async::Reactor.new" -- hm, it waits for every task to finish
<nakilon> gr33n7007h that example is still wrapped in Async do
Inoperable has joined #ruby
<gr33n7007h> nakilon: i'm not sure what you're trying to acheive tbh.
<nakilon> the problem is that Async do does not return what is in the block even if you put the .wait on all asyncs inside
<nakilon> I want an array of results
<nakilon> outside of Async do
<gr33n7007h> nakilon: hold up, let me play around.
<nakilon> this does not run in parallel https://dpaste.org/3uZF/slim
<nakilon> oh wow, found somewhere Sync instead of Async
<nakilon> looks like it returns the value from the block
bluedust_ has quit [Remote host closed the connection]
goldfish has joined #ruby
bluedust has joined #ruby
<gr33n7007h> nakilon: do you manage to solve it?
perrierjouet has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4]
wiz42 has joined #ruby
<nakilon> gr33n7007h yep, seems to be working as intended https://dpaste.org/XYqw/slim
IsoLinCHiP has joined #ruby
<gr33n7007h> nakilon: ah, very nice :)
<nakilon> so this returns thousands of results that are being cached and if there is no cache it waits at least 100msec after previous cache miss
<IsoLinCHiP> Hi. Any recommendations for a library to assist in creating console based interactive list manipulation tools? I have various tasks that would benefit from having a list I can page through with cursor keys, while having either a detail/preview panel showing info pertaining to that item and then selecting one or many items to execute actions on them.
constxd_ has quit [Ping timeout: 256 seconds]
<nakilon> IsoLinCHiP either cli-ui or tty-prompt
perrierjouet has joined #ruby
<gr33n7007h> nakilon: you do know using Sync is a synchronous operation making `end.map.with_progressbar(&:wait)` redundant, because it waits for the block to complete anyway.
<nakilon> cli-ui looks more polished but when I asked an obvious feature from tty-prompt I've got some weird rejection response
<nakilon> so I'm probably back to tty-prompt
goldfish has quit [Ping timeout: 256 seconds]
<nakilon> gr33n7007h oh, nice, indeed looks like it's waiting for all that was started inside
<nakilon> but then how do I show the progress_bar?
<nakilon> hm the progressbar does not work actually ..\
<IsoLinCHiP> nakilon: thanks for the cli-ui recommendation, hadnt come across that yet. Ive used tty-prompt for some projects already, its preatty neat. I have however not yet been able to create something that would show a preview in a seperate panel depending on the current selection. Would you think that might be possible with cli-ui?
<nakilon> ffs dpaste captcha
<IsoLinCHiP> Specifically Im really struggling to find a convenient 'windowing' toolkit
<nakilon> looks like progressbar works if put one level inside the block
<nakilon> IsoLinCHiP if it's not in readme, then probably not
bluedust_ has joined #ruby
<nakilon> nice, 6000 requests one by one was going to take 2 hours yesterday, now it should be 10 minutes
<havenwood> you
<gr33n7007h> nakilon: :P yeah, async does seems like a real game changer
<nakilon> also I could even reduce the 100msec since by net lib parses the x-ratelimit header
<havenwood> nice
<nakilon> gr33n7007h I could do the same semaphore with Thread but yeah, I don't want to be limited with 1024 or whatever
<gr33n7007h> nakilon: async has the potential for millions :)
bluedust has quit [Ping timeout: 250 seconds]
<nakilon> I wonder why it does not interrupt on ^C though
<nakilon> ..\
<gr33n7007h> nakilon: it doesn't?
<nakilon> nope, it's stuck
<gr33n7007h> nakilon: how many tasks are you spawning?
<nakilon> 1 per 100msec
<nakilon> it has spawned like 700
<nakilon> there is no progressbar print anymore and htop is low so it's not building any crazy backtrace, it's just stuck
<gr33n7007h> hmm, weird.
<nakilon> cpu 0.2%
wiz42 has quit [Quit: Client closed]
<nakilon> adding Signal.trap("INT"){ task.interrupt } does not work
easbarba has joined #ruby
<rapha> if you wanted to implement something like midnight commander (=> horizontal split, left panel and right panel) in ruby, would you use the curses gem and go by foot, or is there something more specialized for that?
gr33n7007h has quit [Quit: WeeChat 3.4]
<nakilon> my script now hangs in some another place, looks like I open too many network connections so I should make it all in some different way.... or maybe add another semaphore with n=100
<nakilon> so I merged the delayed and request lambdas from my yesterday code
<nakilon> and looks like ^C is just interrupting one task at a time
kinduff has quit [Quit: The Lounge - https://thelounge.chat]
John_Ivan has joined #ruby
constxd_ has joined #ruby
royo25 has quit [Quit: Bye]
<micah> where can I see what `rake db:schema:load` actually does?
graywolf has joined #ruby
unknown__ is now known as fef
BSaboia has quit [Quit: This computer has gone to sleep]
BSaboia has joined #ruby
constxd_ has quit [Ping timeout: 250 seconds]
Bounga has quit [Ping timeout: 240 seconds]
oxfuxxx has joined #ruby
Rounin has quit [Ping timeout: 240 seconds]
oxfuxxx has quit [Ping timeout: 256 seconds]
<micah> nakilon: thanks!
lim has joined #ruby
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
oxfuxxx has joined #ruby
oxfuxxx has quit [Ping timeout: 256 seconds]
goldfish has joined #ruby
Sheilong has joined #ruby
mdemo has joined #ruby
Guest35 has joined #ruby
Guest35 has quit [Client Quit]
ouestbillie has quit [Ping timeout: 256 seconds]
infinityfye has joined #ruby
hanzo has joined #ruby
bluedust has joined #ruby
mdemo has quit [Quit: The Lounge - https://thelounge.github.io]
bluedust_ has quit [Ping timeout: 256 seconds]
bluedust has quit [Remote host closed the connection]
teclator has quit [Remote host closed the connection]
mdemo has joined #ruby
mdemo has quit [Client Quit]
mdemo has joined #ruby
mdemo has quit [Client Quit]
mdemo has joined #ruby
mdemo has quit [Client Quit]
mdemo has joined #ruby
mdemo has quit [Client Quit]
vit has joined #ruby
justIrresolute is now known as justJustache
vit is now known as Guest9014
<IsoLinCHiP> What dependencies do I need to be able to use Curses::Menu? Documentation seems a bit thin here.
<IsoLinCHiP> Or is this a debian packaging issue, that it doesnt seem to be available?
goldfish has quit [Ping timeout: 250 seconds]
<havenwood> IsoLinCHiP: Do you have the curses gem installed? It no longer ships with the Ruby stdlib.
<IsoLinCHiP> yes, I installed the debian package ruby-curses. Trying to obtain it through `gem install curses` did not work. I wont go into details, it was a nightmare
infinity_fye has joined #ruby
infinityfye has quit [Ping timeout: 250 seconds]
<IsoLinCHiP> the simple examples like `rain.rb` are working, but menu and forms are not, as the Constants are not defined.
graywolf has quit [Quit: WeeChat 3.4]
bluedust has joined #ruby
ouestbillie has joined #ruby
bluedust_ has joined #ruby
bluedust has quit [Ping timeout: 256 seconds]
<nakilon> I hate that ruby 3 irb prints arrays vertically -- can I disable it?
<nakilon> it's stupid to waste 10 pages for .methods instead of one
ouestbillie has quit [Ping timeout: 256 seconds]
ouestbillie has joined #ruby
fef has quit [Ping timeout: 276 seconds]
infinity_fye has quit [Quit: Leaving]
ouestbillie has left #ruby [#ruby]
Bounga has joined #ruby
bluedust has joined #ruby
bluedust_ has quit [Ping timeout: 250 seconds]
duderonomy has joined #ruby
bluedust_ has joined #ruby
bluedust has quit [Read error: Connection reset by peer]
bluedust has joined #ruby
<nakilon> I feel like I drag more and more gems around for every new program ..\
bluedust_ has quit [Ping timeout: 250 seconds]
_ht has quit [Remote host closed the connection]
<IsoLinCHiP> Amen
skali has joined #ruby
skali has quit [Quit: bye]
bluedust has quit [Remote host closed the connection]
Guest6697 has joined #ruby
Guest43 has joined #ruby
<Guest43> Hello. I toyed a bit with Ruby years ago and recently found my way back. I was looking into the tooling and it seems like a straight `gem install foo` would install a package/library globally but if I wanted to keep them local to a project in a given directory, I'd use Bundler. Is that correct?
<leah2> yeah
<Guest43> Cool, thanks. And Bundler installs packages, not versions of Ruby.
<leah2> yes
<leah2> that's rbenv or other tools
<Guest43> Right. Pretty sure I used rbenv back in the day. Looks like there's a handful of options there.
Guest6697 has quit [Quit: Ping timeout (120 seconds)]
gproto23_ has quit [Ping timeout: 250 seconds]
<weaksauce> rbenv is nice
Guest43 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest43 has joined #ruby
Guest43 has quit [Client Quit]
duderonomy has quit [Ping timeout: 256 seconds]
Guest9014 has quit [Ping timeout: 240 seconds]
duderonomy has joined #ruby
Bounga has quit [Ping timeout: 250 seconds]
Aylat has joined #ruby
Aylat has quit [Client Quit]
lim has quit [Remote host closed the connection]
bastelfreak has quit [Quit: WeeChat 3.3]
<ox1eef> i prefer chruby
bluedust has joined #ruby