en10n has quit [Read error: Connection reset by peer]
jerme_ has quit [Write error: Connection reset by peer]
kwilczynski has quit [Ping timeout: 260 seconds]
en10n has joined #ruby
jerme_ has joined #ruby
proc has joined #ruby
fowl has joined #ruby
ReinH__ has joined #ruby
grvgr has joined #ruby
kwilczynski has joined #ruby
chouhoulis has quit [Remote host closed the connection]
deimos_ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
Rudd0 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
deimos__ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
deimos_ has quit [Ping timeout: 260 seconds]
deimos__ is now known as deimos_
dcunit3d has joined #ruby
dc has joined #ruby
dc has quit [Client Quit]
deimos__ has joined #ruby
deimos_ has quit [Ping timeout: 260 seconds]
deimos__ is now known as deimos_
deimos__ has joined #ruby
deimos_ has quit [Ping timeout: 258 seconds]
deimos__ is now known as deimos_
deimos_ has quit [Client Quit]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
znz_jp has quit [Remote host closed the connection]
znz_jp has joined #ruby
bocaneri has joined #ruby
powerhouse has quit [Remote host closed the connection]
howdoi has quit [Quit: Connection closed for inactivity]
cer0 has quit [Quit: shutdown now]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
adu has quit [Quit: adu]
BSaboia has joined #ruby
ua_ has quit [Ping timeout: 260 seconds]
kenso has joined #ruby
ur5us has joined #ruby
imode has quit [Ping timeout: 240 seconds]
kidel_ has joined #ruby
kidel has quit [Ping timeout: 265 seconds]
kidel_ is now known as kidel
deimos_ has joined #ruby
deimos_ has quit [Client Quit]
_whitelogger has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has quit [Ping timeout: 240 seconds]
rubydoc has quit [Ping timeout: 264 seconds]
burgestrand has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
guest1 has quit [Ping timeout: 256 seconds]
guest1 has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
napcae has quit [Ping timeout: 240 seconds]
napcae has joined #ruby
GodFather has quit [Ping timeout: 258 seconds]
bralee has joined #ruby
akem has quit [Ping timeout: 256 seconds]
jordanm has quit [Ping timeout: 272 seconds]
davispuh has joined #ruby
akem has joined #ruby
jordanm has joined #ruby
qwrqwrqasf has joined #ruby
dviola has quit [Ping timeout: 260 seconds]
qwrqwrqasf has quit [Quit: Leaving]
akemrir has joined #ruby
<akemrir>
hi, I'am trying to pass data from firefox native messaging to ruby stdin. But it looks like it locks till ruby process is restarted and then script outputs all gathered data. What I am doing wrong?
<jhass>
what methods do you use for reading?
Rudd0 has quit [Ping timeout: 240 seconds]
<akemrir>
STDIN.each_line
<jhass>
sounds fine. Hard to say anything without being familar with "firefox native messaging" and your code
<akemrir>
it works when I pipe data in linux terminal
<akemrir>
I've seen process with this script in background. Maybe this is the problem?
<akemrir>
it could be launched as background process and needs special treatment?
<jhass>
doubtful, there's no real distinction between a background and foreground program other than what its standard pipes are connected to
kenso has quit [Quit: Connection closed for inactivity]
<jhass>
so that's why, with each_line Ruby's waiting for a \n which never comes
<akemrir>
I've tried with inp = $stdin.read
<akemrir>
but it's locked same way
<jhass>
yes, that waits until EOF
<jhass>
instead it seems you want to read 4 bytes and convert them into a 32 bit signed integer, then read that many bytes and parse them as JSON
Rudd0 has joined #ruby
<jhass>
while size = $stdin.read(4).unpack("I"); message = JSON.parse($stdin.read(size)); end something like this
<jhass>
(looking up I in python it turned out to be an unsigned native endian integer, so same in Ruby)
<akemrir>
I'll try in a moment
<akemrir>
its a pity, I dont have sample message to test without whole infrastructure
<akemrir>
ok, now it gets first message and fails silently. I must debug this other way
dionysus69 has joined #ruby
<jhass>
maybe you can spawn a shellscript that dumps the stream using tee inbetween FF and your ruby script?
<jhass>
that dump should then also give you something to replay
<akemrir>
bash script as container? ill try
<jhass>
yeah
<jhass>
tee messages.dump | ruby script.rb
<akemrir>
yeah, then I will be able to capture all standard output and redirect it to file
<jhass>
something like that
DaRock has quit [Read error: Connection reset by peer]
DaRock has joined #ruby
<akemrir>
messages are visible, but stderr was empty
<jhass>
akemrir: note that you're expected to send responses in the same format if that's what you're doing and potentially get stuck on. So message = response.to_json; $stdout << [message.size].pack("I") << message
<akemrir>
you think it locks becasue it dont receive any output?
<jhass>
well, I don't know what your extension side looks like and expects before sending more messages, just a guess since you started with line based reading you might also be doing line based sending
<akemrir>
I've read that some people are setting python in unbuffered mode. Maybe this is the case here?
<akemrir>
it don't know when to end read and locks
<akemrir>
then when process is rebooted, it's forced to close and executes everything
<jhass>
that can be relevant for sending, but a $stdout.flush after sending a message should work equally well
<jhass>
for reading I cannot imagine a difference sicne the protocol is reading known byte lengths
<jhass>
4 bytes then however many bytes those 4 bytes tell you to, then 4 bytes again and so on
<jhass>
the read buffering works such that it reads (up to the buffer size) everything that's available on the IO, then returns you the part you requested in the read call
<jhass>
if you requested more than is available currently, it blocks
<jhass>
if you want to give it a try anyhow, disabling buffering is as easy as $stdin.sync = true; $stdout.sync = true
<akemrir>
this didn't helped
<jhass>
would've surprised me :)
<akemrir>
ok, I need to pause from this, thanks for help
TCZ has joined #ruby
burgestrand has quit [Quit: burgestrand]
BSaboia has quit [Quit: This computer has gone to sleep]
burgestrand has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 240 seconds]
johndotpub_ has joined #ruby
johndotpub has quit [Quit: /dev/zero]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
fuzzface has joined #ruby
ua has joined #ruby
fuzzface has quit [Quit: Leaving]
burgestrand has quit [Quit: burgestrand]
nofxx_ has joined #ruby
<akemrir>
jhass: I've found something. I've tested with tee and messages dump.
nofxx has quit [Ping timeout: 260 seconds]
<akemrir>
it looks like its not sending an line end
<akemrir>
maybe that's why ruby dont know when to end reading and it looks like locked
<jhass>
akemrir: yes, I think I pointed this out earleir?
<jhass>
each_line waits for a line end. read(bytes) like in my example above does not
<akemrir>
oh, I missunderstood this
<akemrir>
ah, found error, I am one step closer
akem_ is now known as akem
burgestrand has joined #ruby
<akemrir>
jhass: I redirected output of ruby with 2>> file and I have insight in errors
<akemrir>
jhass: thanks for help I managed out to read messages on each request. it doesnt fail silently anymore
<jhass>
great :)
<jhass>
you're welcome
<akemrir>
yeah :) now the fun part with parsing/dmenu hehe
bralee has quit [Ping timeout: 256 seconds]
banisterfiend has joined #ruby
marahin has quit [Quit: ZNC 1.6.3+deb1ubuntu0.2 - http://znc.in]
cadeskywalker has joined #ruby
marahin has joined #ruby
marahin has quit [Changing host]
marahin has joined #ruby
shenghi has quit [Quit: WeeChat 2.9]
shenghi has joined #ruby
dviola has joined #ruby
dviola has left #ruby [#ruby]
dviola has joined #ruby
<proc>
hmm. trying to do some type of job scheduling. basically, I have *one* specific task that will run a certain command on *different* pages at different intervals. eg: run task on "A" every 15 mins. run task on "B" every 2 hours. run task on "C" every 1 January.
<proc>
the "taskfile" is external and loaded in and should be updated regularly.
<proc>
cron would be suitable I guess, but I don't want to load cron with hundreds of entries
<proc>
just worried dynamically updating the schedule in Rufus may cause it to not do "every 3 day" tasks, eg if I update the schedule from the "taskfile" every day (if it would just keep resetting the timer, so the every 3 day task never runs)
shenghi has quit [Quit: WeeChat 2.9]
<proc>
in cron syntax, this isn't really a problem, because it runs on set dates rather than relative to when the cron was installed
shenghi has joined #ruby
Xiti has quit [Quit: Leaving]
<jhass>
proc: how about having a dispatcher that runs every whatever your smallest interval is via cron or so, then checks for each of the tasks if it's eglible. Should be fairly simple to implement but just storing the last run time and desired interval somewhere
<jhass>
*by just
bmurt has joined #ruby
<proc>
jhass: how do I check each of the tasks if it's eligible?
<proc>
eg tasks are inserted either by absolute date (eg "1 January"), or by relative date (eg "every 2 hours"). my smallest interval is every minute, so running my script every min is okay
<proc>
but I'm not sure how to get the entries into the script to do the eligible check
<jhass>
well, that depends on your circumstances and is also a freedom you gain from doing it like this. It could be hardcoded into your dispatcher, it could be a local file, local database etc
<adam12>
But in this case, almost sounds like a database would be a better solution.
<adam12>
Maybe pair it with Chronic (or Postgres with the `interval` type).
Xiti has joined #ruby
<jhass>
yeah, for anything that runs less than daily I'd look something that persists somehow and even would tend to avoid a longrunning processs
<proc>
issue is, entries can always change/be added/removed, and it's all changed externally (and only imported into the app from an external list). I ideally don't want to 'diff' the changes, so database may not work.
<jhass>
hum, well, you need to reconcile the new list with the existing list anyhow, to carry over the last run info for the interval based tasks
<jhass>
if you can redefine the requirements from "every 2 hours" to things like "every even hour on the clock", then it might work stateless
<jhass>
(just make sure to configure your server to a DST less timezone, like UTC)
<proc>
hmm, yeah
TCZ has quit [Quit: Leaving]
banisterfiend has quit [Read error: Connection reset by peer]
mohsen_in has joined #ruby
TCZ has joined #ruby
SeepingN has joined #ruby
impermanence has joined #ruby
GodFather has joined #ruby
ChmEarl has joined #ruby
akem has quit [Quit: Leaving]
banisterfiend has joined #ruby
burgestrand has quit [Quit: burgestrand]
mohsen has joined #ruby
akemrir has quit [Quit: WeeChat 2.9]
mohsen_in has quit [Ping timeout: 240 seconds]
lmat has joined #ruby
<lmat>
I have some code here: https://imgur.com/WRQCI7O.png and nothing inside the "if" statement is getting printed to the output document, but the log statements are showing up in the logs.
<lmat>
Did I dork something up with the if statement?
<lmat>
Oh, I think I didn't include "first = true" just before "split_comments.each..."
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
yeah, that'd be the question, where's first first set :D
<Caspy>
it`s a mirc bot, and can run ruby scripts..
<adam12>
Caspy: Gotcha
<Caspy>
works on ubuntu... centos
<adam12>
Caspy: Well I can't see anything wrong with the script. But ruby_exec looks suspicious.
<Caspy>
but not on debian..
<Caspy>
inatlled ruby and ruby-dev
<adam12>
Caspy: What's the output of `which ruby` on both Ubuntu and Debian
<Caspy>
output? how i can check that?
<havenwood>
Caspy: Type "which ruby" in the command line.
<havenwood>
Caspy: And hit Enter.
<Caspy>
/usr/bin/ruby
<Caspy>
on both
<Caspy>
Debian GNU/Linux 10 \n \l
<Caspy>
Ubuntu 18.04.5 LTS \n \l
<shoshin>
anyone here use pronto-rubocop?
<adam12>
Caspy: Help me a bit here. mIRC the IRC client for Windows?
banisterfiend has quit [Quit: banisterfiend]
<Caspy>
adam12, iroffer is a IRC bot yes
<adam12>
Caspy: OK. So it's not an "mIRC" bot, connected to the IRC client "mIRC" for Windows? I think that's why I'm confused.
<adam12>
Caspy: You're using mIRC to connnect here, but the bot isn't?
<adam12>
Caspy: You're running the bot with ./irbot ... something?
cthu| has quit [Read error: Connection reset by peer]
<Caspy>
exatcly
banisterfiend has joined #ruby
<adam12>
Caspy: and it exits immediately with that error?
<Caspy>
no, not really.. just that script doesn`t work
<Caspy>
and if i rehash the bot, it tells me that error
<Caspy>
rehash = reload the configs and scripts
<adam12>
Caspy: I see. In that case, I'd install strace, then attach it to the pid of the bot process. Then tell the bot to rehash. Take the output of strace and put it in a dpaste.org so we can look at it.
<Caspy>
lemme look
banisterfiend has quit [Ping timeout: 240 seconds]
<adam12>
Caspy: I don't really have a suggestion for you. It reads the file fine, but before it does, tries to treat the file as a file descriptor. I'm not sure this is a Ruby problem as much as it is an iroffer problem.
<adam12>
Caspy: Maybe try recompiling iroffer.
<Caspy>
tryed few times
<Caspy>
same thing
<adam12>
Caspy: And how did you upgrade Ruby?
<adam12>
Caspy: Oh, you didn't. It's the original Ruby version.
<lmat>
but sComment is not in the output document!
titanbiscuit has quit [Ping timeout: 256 seconds]
hiroaki has joined #ruby
<lmat>
I changed my code. Instead of frist = true .... if first ... first = false end ... I'm using count = 0 ... if count == 0 ... end count = count + 1; The result is the same. I'm going to try writing it a couple times now...
<lmat>
So... if count < 3 ... end count = count + 1
<lmat>
Maybe it's gobbling up the first one somehow!?
<lmat>
It looks like the first one doesn't count, then the second one does, then the third one doesn't count, then the fourth one does, etc.
<lmat>
I'm guessing it's running once for measurement, then once for real, then run again for measurement, then again for real.
<lmat>
:'(
ur5us has joined #ruby
titanbiscuit has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
titanbiscuit has joined #ruby
ap4y has joined #ruby
titanbiscuit has quit [Quit: ZNC 1.7.5 - https://znc.in]
titanbiscuit has joined #ruby
titanbiscuit has quit [Ping timeout: 258 seconds]
titanbiscuit has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
tbisker8 has joined #ruby
titanbiscuit has quit [Ping timeout: 258 seconds]
_aeris has joined #ruby
_aeris_ has quit [Ping timeout: 240 seconds]
_aeris is now known as _aeris_
teclator has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brunosaboia_ has joined #ruby
brunosaboia_ has quit [Client Quit]
brunosaboia_ has joined #ruby
mohsen_in has joined #ruby
sphex_ has quit [*.net *.split]
ChrisBr has quit [*.net *.split]
dorian has quit [*.net *.split]
Flonk has quit [*.net *.split]
greenbagels has quit [*.net *.split]
afisher has quit [*.net *.split]
tv- has quit [*.net *.split]
kenichi has quit [*.net *.split]
ghormoon has quit [*.net *.split]
j416 has quit [*.net *.split]
probonic has quit [*.net *.split]
towo has quit [*.net *.split]
MasterNayru has quit [*.net *.split]
iamgr00t has quit [*.net *.split]
creaked has quit [*.net *.split]
DEac- has quit [*.net *.split]
KramerC has quit [*.net *.split]
dorian has joined #ruby
towo has joined #ruby
DEac- has joined #ruby
sphex has joined #ruby
kenichi has joined #ruby
ghormoon has joined #ruby
creaked has joined #ruby
afisher has joined #ruby
KramerC has joined #ruby
iamgr00t has joined #ruby
ChrisBr- has joined #ruby
probonic has joined #ruby
j416 has joined #ruby
Flonk has joined #ruby
mohsen_in has quit [Client Quit]
greenbagels has joined #ruby
brunosaboia_ has quit [Client Quit]
MasterNayru has joined #ruby
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
brendan- has quit [Ping timeout: 264 seconds]
tv- has joined #ruby
tv- has quit [Client Quit]
tv- has joined #ruby
roshanavand_ has joined #ruby
roshanavand has quit [Read error: Connection reset by peer]
roshanavand_ is now known as roshanavand
brendan- has joined #ruby
helpa has quit [Remote host closed the connection]
helpa-bot has joined #ruby
helpa-bot has quit [Changing host]
helpa-bot has joined #ruby
helpa-bot has quit [Remote host closed the connection]
helpa has joined #ruby
bvdw has joined #ruby
TCZ has quit [Quit: Leaving]
banisterfiend has joined #ruby
Technodrome has joined #ruby
silverdust has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
silverdust has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bralee has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
adu has joined #ruby
cthulchu has joined #ruby
ta has quit [Ping timeout: 260 seconds]
inventaro has joined #ruby
inventaro has quit [Remote host closed the connection]
ta has joined #ruby
elxbarbosa has joined #ruby
bralee has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
elxbarbosa has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
dionysus70 has joined #ruby
<adam12>
lmat: Let's distill down to a primitive. You have a collection of comments, you want to iterate over them, but the first is special?