<romistrub>
almost, I left out a little bit (framework/web_socket)
AcidCrash0x00 has quit [Read error: Connection reset by peer]
<Radar>
Gist supports multiple files.
<Radar>
Can you please split that up into multiple files?
<romistrub>
oh; well I copied and pasted all of these to one file; thought it would be easier that way
AcidCrash has joined #ruby
<romistrub>
basically, my expectation was that every time TCPServer#accept returned a TCPSocket, it meant that a browser was making an HTTP request to me server
cdg has quit [Ping timeout: 244 seconds]
<romistrub>
But I'm getting "requests" of zero length
solocshaw has joined #ruby
<romistrub>
I can easily filter out requests with zero length, but I'm confused as to why TCPServer#accept would return a TCPSocket whose contents (via #recv) are length 0
<romistrub>
I'm new to Sockets in general, so I'm guessing it's a misunderstanding on my part
<romistrub>
adam12, yeah, 1024
<adam12>
romistrub: How are you testing the connections? browser?
<romistrub>
adam12: yeah
<romistrub>
is it a keepalive or something?
<adam12>
Can you telnet to it locally and dump some crap through it, to see if it's actually receiving 0 length?
<Radar>
romistrub: Did you add the websocket bit?
<romistrub>
Radar: the Websocket element wasn't relevant, so I just didn't include it in the pastejob
Hobogrammer has joined #ruby
noodle has joined #ruby
<adam12>
I guess I should of asked what protocol this was..
<romistrub>
adam12: protocol is http
<romistrub>
adam12: don't get me wrong, it's receiving all of the manual http requests fine
Moosashi has joined #ruby
eljimador has joined #ruby
<adam12>
romistrub: So just browser requests are failing?
<toretore>
i'm guessing you're not actually replying to the initial request, so it's probably chome trying to see if the host is still available
<romistrub>
toretore: even when I'm replying (which I was, before I minimalized the script), it still sent the 0-byte signal
<toretore>
define replying
<romistrub>
with HTML
<toretore>
do you close the socket, and then chrome opens another connection?
<romistrub>
toretore: yup
blackgoat has joined #ruby
<romistrub>
is anybody has a different browser, it would be pertinent to test it on that, too
Rodya_ has quit [Ping timeout: 250 seconds]
<romistrub>
just to see if this is a chrome particular
nankyokusei has joined #ruby
brian has joined #ruby
brian is now known as Guest31917
ornerymoose has quit [Quit: ornerymoose]
matp_ has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
<smathy>
Doesn't happen here (from Chrome, ruby 2.3), I just get three attempts at 692 bytes.
matp has quit [Ping timeout: 272 seconds]
<romistrub>
smathy, give it time, it takes up to 20 secs
_Tariq has joined #ruby
<smathy>
I left it for 5 minutes.
<romistrub>
hmmm
<romistrub>
did you use the exact code I did?
<smathy>
Except not port 80.
<romistrub>
what port
Yiota has joined #ruby
<smathy>
A high port, I don't have ruby set up for root.
jaguarmagenta has joined #ruby
<romistrub>
smathy: tried it with 3000, still getting the 0
Yzguy has quit [Quit: Zzz...]
claw has quit [Read error: Connection reset by peer]
Yiota has quit [Ping timeout: 240 seconds]
<smathy>
Yeah, it'd be hard to imagine it was something caused by a specific port. Maybe your Chrome is making the reconnection so quickly that by the time you're looping and accepting, the buffer is already empty. I'm not sure how TCPServer handles itself with that.
<smathy>
What if you make a thread for the accept instead?
<enterprisey>
Does Ruby have a method similar to Python's partition method for strings?
jaguarmagenta has quit [Ping timeout: 272 seconds]
<smathy>
enterprisey, partition
<enterprisey>
okay
claw has joined #ruby
northfurr has quit [Ping timeout: 246 seconds]
<romistrub>
smathy: that wouldn't make sense; I check socket first and it's a new socket when I click recv
bfig has joined #ruby
<bfig>
hello
<smathy>
romistrub, well, the behavior you're explaining doesn't makes sense.
moos3 has joined #ruby
<bfig>
I'm having issues running the ruby interp. It hangs as soon as I start it (ubuntu 16.04)
<romistrub>
smathy: I know it doesn't; but it's what happens
<smathy>
bfig, describe what you're doing and what's happening.
<smathy>
romistrub, right, so no point dismissing things that also don't make sense. The problem you're seeing is already "out there".
<smathy>
romistrub, take a look and see if the thread approach still shows the same issue.
<romistrub>
smathy: I see what you're saying
Yiota has joined #ruby
<romistrub>
a thread for what specifically?
Regulati_ has joined #ruby
mattwashere has joined #ruby
<bfig>
smathy: I'm on the console, write 'ruby', press enter
<smathy>
romistrub, like `Thread.start(t.accept) do |socket|` instead of just `t.accept` - and `end` after you `socket.close`
<romistrub>
smathy: on it
<bougyman>
1~/44
<smathy>
bfig, right, and you should see a blank line waiting for STDIN that at EOF ruby will then process.
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
RegulationD has quit [Ping timeout: 244 seconds]
<smathy>
bfig, if you want an interactive shell, use irb (or pry is an enhanced version, but doesn't ship with ruby, you'd need to install the gem).
<bfig>
smathy: great! thanks for the advice
<romistrub>
smathy: same thing
<smathy>
romistrub, oh well. I'm out of ideas.
<romistrub>
smathy: yeah, me too
<smathy>
romistrub, which version of ruby are you using? I arrived late.
moos3 has quit [Ping timeout: 264 seconds]
sdothum has joined #ruby
<romistrub>
smathy: err... 2.2.3
<smathy>
Are you stuck there for a reason? Try moving to the latest.
<romistrub>
smathy: stupid question, but I looked it up before... how do I do that? I'm on Windows, which might be a limiting factor
<smathy>
I just switched to 2.2.3 and I still don't see the issue.
<romistrub>
Chrome version?
<smathy>
Oh, heh, Windows :) Ok, totally different network stack so none of my tests are relevant.
chimkan has joined #ruby
<romistrub>
51.0.2704.103 m
<smathy>
Same.
hahuang62 has joined #ruby
<chimkan>
question
<romistrub>
toretore duplicated the problem
<romistrub>
answer
<chimkan>
lol
<chimkan>
does anyone have try to do machine learning with ruby?
<enterprisey>
Any idea how I can change this regexp to get Ruby to stop complaining? /==\s?(\w+)\s?==/
<smathy>
romistrub, long shot, but have you tried from a new incognito session?
<romistrub>
smathy: interesting idea, 1 sec
<smathy>
chimkan, they have, the work is a little stale now though. People have tended to use Python or other languages more than ruby.
<romistrub>
same problem
mattwashere has quit [Remote host closed the connection]
<_Tariq>
I know there is one ML algorithm that could be useful for web dev
<_Tariq>
Let me see if I have it starred
<chimkan>
smathy, thanks. I’m currently using python scikit or even spacy.io and creating a CLI that generates the predictions or results in json
<chimkan>
I call my python cli within ruby via eval()
<chimkan>
it works
<chimkan>
but trying to see if there’s anything better
<_Tariq>
I'd probably recommend using your approach
<_Tariq>
Best tool for the job and all.
<_Tariq>
But this library could be useful for sites that want to "recommend" other parts of the website
<_Tariq>
using machine learning to select articles that are very close to the existing article in question
<_Tariq>
So potentially useful for webdev work
<smathy>
romistrub, first request 384 length (for localhost:3100) and then I get two more at 410 length (because Chrome has added a cache header to the retries). Never a 0 length. Running 2.2.3 or 2.3.1 - all the same.
<chimkan>
_Tariq, that’s a very good one, I didn’t know that
rkazak has quit [Quit: Sleep.....ing....]
<romistrub>
smathy: I'm trying firefox
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<smathy>
FF for me just has a single request at 298 and no retries.
<romistrub>
smathy: same weirdness with firefox
<smathy>
Safari has some retries, all of them have content.
<smathy>
romistrub, yeah, I definitely suspect TCPServer more than I would Chrome.
_Tariq has quit []
<smathy>
romistrub, maybe try with TCPSocket instead, see if you get the same issue.
<romistrub>
smathy: one problem, I tried to send a null string using TCPSocket, and didn't get a string with zero length, I got nothing at all
<romistrub>
smathy: tried that already, no such problem
<smathy>
romistrub, what's "a null string"? You mean "\0" ?
<toretore>
romistrub: you will see that chrome initializes a connection and then closes it some time later
<Radar>
Dimik1: what
<shevy>
Dimik1 what does this mean
<Dimik1>
0.01..0.10
<romistrub>
toretore: but I get the 0-byte string on a different socket
<shevy>
what should be the output of this
<Dimik1>
something like for x in 0.01..0.10 do puts x end
<shevy>
no I mean
<toretore>
romistrub: what it's doing is making a "preconnect" in case it needs to make another request, then closes it after a timeout when it figures it doesn't need it after all
<shevy>
0.09000000000000001 tripped me up in IRB for a moment :D
lalalaaa has quit [Ping timeout: 250 seconds]
<romistrub>
toretore: thanks for giving me something to read up on
<romistrub>
smathy: thanks for all your help
<toretore>
romistrub: in practical terms: you have to check for eof on the socket in your read loop and discard it if a complete request hasn't come through
maloik has quit [Remote host closed the connection]
<smathy>
romistrub, you mean that client code you're showing with the `socket.send ""` ? I get a zero length string btw.
maloik has joined #ruby
<smathy>
...your client code connecting to your server code.
northfurr has joined #ruby
SilverKey has joined #ruby
<romistrub>
smathy: that's exactly what I mean
ornerymoose has joined #ruby
<romistrub>
toretore: can u give me an example of using eof?
braincrash has quit [Quit: bye bye]
<smathy>
romistrub, last thought, maybe there's an initial empty connection made, and then the browser sends headers in another send. Try doing a second `s << socket.recv(1024)` after your initial `s = socket.recv(1024)` - just as a diagnostic step.
<romistrub>
smathy: I'm pretty sure toretore figured out that it's a TCP Preconnect
Dimik1 has quit [Ping timeout: 244 seconds]
<romistrub>
apparently Chrome doesn't start issuing preconnects until it's expected certain responses from a server, which explains why smathy didn't get the 0-byte recv
<toretore>
romistrub: data = ''; loop{ data << socket.recv(1234); break if socket.eof? or can_has_request?(data) }
<_mak_>
so, I have this endpoint JSON URI that requires me to be authenticated with cookies. I'm currently using watir to open a browser and authenticate th session. How could I authenticate my script without resorting to watir?
hk238 has joined #ruby
ych has quit [Ping timeout: 276 seconds]
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ngw has joined #ruby
karmatr0n has quit [Ping timeout: 276 seconds]
Niham has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
atm0sphere has joined #ruby
Nawn has joined #ruby
d0lph1n98 has joined #ruby
Nawn has quit [Remote host closed the connection]
Rickmasta has joined #ruby
craigp_ has quit [Ping timeout: 244 seconds]
bluOxigen has quit [Ping timeout: 264 seconds]
bluOxigen has joined #ruby
hahuang62 has joined #ruby
northfurr has joined #ruby
raeoks has joined #ruby
n1x-nz has joined #ruby
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gfvcastro has joined #ruby
northfurr has quit [Client Quit]
guardianJ has joined #ruby
hahuang62 has quit [Ping timeout: 260 seconds]
djbkd has quit [Quit: My people need me...]
last_staff has joined #ruby
gfvcastro has quit [Client Quit]
mradmacher has joined #ruby
skweek has quit [Ping timeout: 240 seconds]
pawnbox has quit [Remote host closed the connection]
ngw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
emilkarl has quit [Read error: Connection reset by peer]
amclain has quit [Quit: Leaving]
pawnbox has joined #ruby
the_drow has joined #ruby
codecop has joined #ruby
TomyLobo has joined #ruby
pandaant has joined #ruby
guardianJ has quit [Remote host closed the connection]
aryaching has joined #ruby
PlasmaStar has quit [Ping timeout: 246 seconds]
ta_ has quit [Remote host closed the connection]
Niham has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
mercerist has quit [Quit: Computer has gone to sleep.]
aryaching has joined #ruby
pawnbox has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 276 seconds]
agit0 has joined #ruby
aries_liuxueyang has quit [Ping timeout: 276 seconds]
antgel has joined #ruby
cevett_ has joined #ruby
beawesomeinstead has joined #ruby
aries_liuxueyang has joined #ruby
cevett has quit [Ping timeout: 240 seconds]
karmatr0n has joined #ruby
<p1k>
_mak_: you can set cookie headers on programatic requests just as with a browser, but if you want api access to your endpoint tokens are the more correct way
aganov has joined #ruby
ruby-lang467 has quit [Ping timeout: 250 seconds]
the_drow has joined #ruby
karmatr0n has quit [Ping timeout: 250 seconds]
Silthias has quit [Ping timeout: 240 seconds]
vdamewood has quit [Ping timeout: 252 seconds]
galeido_ is now known as galeido
jaguarmagenta has quit [Remote host closed the connection]
Akuma0n3 has quit [Read error: Connection reset by peer]
Akuma0n3 has joined #ruby
Silthias has joined #ruby
galeido has quit [Changing host]
galeido has joined #ruby
joonty has joined #ruby
Hounddog has joined #ruby
ur5us has joined #ruby
roamingdog has quit [Remote host closed the connection]
infra-red has joined #ruby
infra-red has quit [Client Quit]
vuoto has quit [Remote host closed the connection]
multi_io has quit [Ping timeout: 252 seconds]
multi_io has joined #ruby
mistermocha has joined #ruby
SuperLag has quit [Ping timeout: 260 seconds]
k3rn31 has quit [Quit: Computer has gone to sleep.]
agentmeerkat has joined #ruby
mistermo_ has quit [Ping timeout: 244 seconds]
edwinvdgraaf has joined #ruby
ngw has joined #ruby
SuperLag has joined #ruby
mistermo_ has joined #ruby
mistermocha has quit [Ping timeout: 240 seconds]
mistermo_ has quit [Read error: Connection reset by peer]
mradmacher has quit [Ping timeout: 244 seconds]
agentmeerkat has quit [Ping timeout: 244 seconds]
mooru has joined #ruby
ta_ has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
ta_ has joined #ruby
moos3 has joined #ruby
Akuma0n3 has quit [Read error: Connection reset by peer]
elaptics`away is now known as elaptics
Akuma0n3 has joined #ruby
gettalong has quit [Ping timeout: 260 seconds]
yfeldblum has joined #ruby
yfeldblum has quit [Remote host closed the connection]
beawesomeinstead has quit [Remote host closed the connection]
yfeldblum has joined #ruby
k3rn31 has joined #ruby
noodle has quit [Ping timeout: 260 seconds]
moos3 has quit [Ping timeout: 244 seconds]
Coldblackice has joined #ruby
Axy has quit [Ping timeout: 244 seconds]
jaruga___ has joined #ruby
beawesomeinstead has joined #ruby
kp666 has joined #ruby
lalalaaa_ has joined #ruby
john0123 has quit [Quit: Connection closed for inactivity]
Hyuk has joined #ruby
Beverage is now known as Wsewolod
edwinvdgraaf has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
Dimik has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
ocbtec has joined #ruby
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
skade has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
nankyokusei has joined #ruby
dcunit3d has joined #ruby
sdwrage has quit [Quit: This computer has gone to sleep]
Macaveli has joined #ruby
emiltin has quit [Quit: Computer has gone to sleep.]
HalpMe has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
edwinvdgraaf has quit [Ping timeout: 258 seconds]
Guest91763 is now known as ndrst
ruby[bot] has joined #ruby
HalpMe has left #ruby [#ruby]
Sashimi_ has joined #ruby
mrgrieves has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
aryaching has quit [Read error: Connection reset by peer]
dcunit3d has quit [Ping timeout: 264 seconds]
blackgoat has quit [Ping timeout: 240 seconds]
edwinvdgraaf has joined #ruby
karmatr0n has joined #ruby
zacstewart has joined #ruby
madgen has quit [Ping timeout: 260 seconds]
edwinvdgraaf has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
jaruga___ has quit [Quit: jaruga___]
pawnbox has quit [Remote host closed the connection]
karmatr0n has quit [Ping timeout: 264 seconds]
pawnbox has joined #ruby
tvw has joined #ruby
zacstewart has quit [Ping timeout: 240 seconds]
norc has joined #ruby
gettalong has joined #ruby
Sashimi_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yfeldblum has quit [Ping timeout: 250 seconds]
fenre has quit [Remote host closed the connection]
tvw has quit []
roamingdog has joined #ruby
hanmac has quit [Ping timeout: 260 seconds]
tvw has joined #ruby
hanmac has joined #ruby
kedare has joined #ruby
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
moos3 has joined #ruby
nhhc has joined #ruby
minimalism has quit [Quit: minimalism]
Mia has quit [Read error: Connection reset by peer]
AnoHito has quit [Read error: Connection reset by peer]
bnagy_ has quit [Ping timeout: 240 seconds]
nadir has joined #ruby
lxsameer has joined #ruby
Moosashi has joined #ruby
kareeole_ has joined #ruby
n1x-nz has quit [Quit: Computer says no]
Xeago_ has joined #ruby
yfeldblum has joined #ruby
kareeoleez has quit [Ping timeout: 272 seconds]
roamingdog has quit [Remote host closed the connection]
mistermocha has joined #ruby
dionysus69 has joined #ruby
Spami has joined #ruby
k3rn31 has quit [Quit: Computer has gone to sleep.]
mistermo_ has joined #ruby
mistermocha has quit [Ping timeout: 240 seconds]
mistermo_ has quit [Read error: Connection reset by peer]
mistermocha has joined #ruby
yxdjlr has joined #ruby
minimalism has joined #ruby
mistermo_ has joined #ruby
Hyuk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
moos3 has quit [Ping timeout: 260 seconds]
misterm__ has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
mistermocha has quit [Ping timeout: 272 seconds]
mistermocha has joined #ruby
Snowy has joined #ruby
bnagy has joined #ruby
the_drow has joined #ruby
mistermo_ has quit [Ping timeout: 250 seconds]
thoraxe has quit [Ping timeout: 246 seconds]
the_drow has quit [Client Quit]
Moosashi has quit [Quit: Moosashi]
mistermo_ has joined #ruby
misterm__ has quit [Ping timeout: 250 seconds]
oshanz has joined #ruby
thoraxe has joined #ruby
mistermo_ has quit [Read error: Connection reset by peer]
mistermo_ has joined #ruby
roamingdog has joined #ruby
kareeole_ is now known as kareeoleez
Hyuk has joined #ruby
Mia has joined #ruby
mistermocha has quit [Ping timeout: 258 seconds]
roamingdog has quit [Remote host closed the connection]
mistermocha has quit [Read error: Connection reset by peer]
mistermo_ has quit [Ping timeout: 260 seconds]
nofxx has quit [Ping timeout: 260 seconds]
misterm__ has quit [Ping timeout: 250 seconds]
<oshanz>
hi all, i'm new to ruby. as of github repository there are only 40 ruby contributors. like to know is that wrong or else why?.
joes_ has joined #ruby
joes_ has quit [Client Quit]
joes_ has joined #ruby
joes_ has quit [Client Quit]
kareeoleez has quit [Remote host closed the connection]
chip_ has joined #ruby
moei has quit [Quit: Leaving...]
_joes__ has joined #ruby
Xeago_ has quit [Remote host closed the connection]
Sashimi_ has joined #ruby
moei has joined #ruby
Xeago_ has joined #ruby
giz|work has joined #ruby
lalalaaa_ has quit [Quit: leaving]
Coldblackice has quit [Ping timeout: 244 seconds]
ur5us has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
edwinvdg_ has joined #ruby
madgen has joined #ruby
<maloik>
oshanz there's no way to tell... a very small library could be "completely done" and see no commits for years, and have a single committer
the_drow has joined #ruby
<maloik>
for other things you'd want more updates and probably a bigger team behind it, but it's all subjective
edwinvdgraaf has quit [Read error: Connection reset by peer]
pawnbox has joined #ruby
<hanmac>
depends ... i did something big like a ruby binding for wxWidgets all by my self
lukebyrne has joined #ruby
karmatr0n has joined #ruby
zacstewart has joined #ruby
emiltin has joined #ruby
Hyuk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
I think they're talking about github.com/ruby/ruby
tvw has quit [Read error: Connection reset by peer]
<hanmac>
jhass: yeah i see it myself ... there are only 40, but they are very active in commiting
<jhass>
oshanz: ^ is only a mirror of the SVN repo where the development actually happens. Githubs contributor graph only shows people it could identify (knows the mail address of)
<maloik>
nice reading skills, I did not catch that :)
<jhass>
github couldn't associate it to a github profile and so it won't show up in the contributors list
emiltin has quit [Quit: Computer has gone to sleep.]
zeroDi has joined #ruby
jaguarmagenta has quit [Ping timeout: 240 seconds]
yfeldblum has quit [Ping timeout: 250 seconds]
<oshanz>
hope there will be a solution. contributors deserve it.
kknight has quit [Ping timeout: 264 seconds]
<jhass>
github is not source of truth here
<jhass>
don't make it more important than it is
<norc>
You are right jhass.
<norc>
Slashdot is.
Hyuk has joined #ruby
Hyuk has quit [Max SendQ exceeded]
lukebyrne has quit [Quit: lukebyrne]
workmad3 has joined #ruby
bnagy has joined #ruby
Niham_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
marr has joined #ruby
<oshanz>
sory. i didn't mean anything like that. just i prefer github. btw thanks for information.
gettalong has quit [Ping timeout: 272 seconds]
bruce_lee has joined #ruby
koooge has quit [Quit: Leaving...]
agentmeerkat has joined #ruby
oshanz has quit [Quit: Page closed]
roamingdog has joined #ruby
LoneHermit has joined #ruby
bnagy has quit [Ping timeout: 276 seconds]
elaptics`away is now known as elaptics
marr has quit []
gettalong has joined #ruby
raeoks has quit [Read error: Connection reset by peer]
marr has joined #ruby
agentmeerkat has quit [Ping timeout: 252 seconds]
roamingdog has quit [Ping timeout: 244 seconds]
fenre has joined #ruby
ocbtec has quit [Quit: leaving]
LoneHermit has quit [Ping timeout: 252 seconds]
yeticry has quit [Ping timeout: 240 seconds]
Xeago_ has quit [Remote host closed the connection]
yeticry has joined #ruby
kareeoleez has joined #ruby
bnagy has joined #ruby
blaxter has quit [Quit: foo]
lightt has joined #ruby
edwinvdg_ has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
mercerist has joined #ruby
mooru has quit [Ping timeout: 264 seconds]
mooru has joined #ruby
bnagy has quit [Ping timeout: 276 seconds]
moeabdol has joined #ruby
norc has quit [Ping timeout: 250 seconds]
slackbotgz has joined #ruby
emiltin has joined #ruby
sdothum has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
bluOxigen has quit [Ping timeout: 250 seconds]
mistermocha has joined #ruby
jaruga___ has joined #ruby
Niham has joined #ruby
mercerist has quit [Quit: Computer has gone to sleep.]
bnagy has joined #ruby
Niham has quit [Max SendQ exceeded]
nankyokusei has joined #ruby
<ponga>
what channel should i be asking general programming related question
Mia has quit [Read error: Connection reset by peer]
Niham has joined #ruby
Niham has quit [Max SendQ exceeded]
dcunit3d has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
<jhass>
I think there's a #programming or ##programming? but eh, here's probably fine too
Niham has joined #ruby
conta has quit [Ping timeout: 240 seconds]
DoubleMalt has quit [Ping timeout: 240 seconds]
Niham has quit [Max SendQ exceeded]
bnagy has quit [Ping timeout: 260 seconds]
nankyokusei has quit [Ping timeout: 244 seconds]
<ponga>
pypy and crystal lang says its compiler is written in of language itself, why does that work? does CPU/OS naturally understands compiler?
bnagy has joined #ruby
Niham has joined #ruby
<ponga>
its very dumbass question but it always tickled my mind
tesuji_ has quit [Read error: Connection reset by peer]
johnmilton has quit [Remote host closed the connection]
edwinvdgraaf has quit [Ping timeout: 244 seconds]
dcunit3d has quit [Ping timeout: 240 seconds]
Dysp has joined #ruby
conta has joined #ruby
Ropeney has joined #ruby
<jhass>
ponga: Crystal was bootstrapped with Ruby, pypy (I guess) with CPython (the main/offical one)
<jhass>
once you have a basic compiler/interpreter running written in another language, you can then proceed to rewriting it in your own language
karmatr0n has joined #ruby
duncannz has quit [Remote host closed the connection]
<jhass>
So for Crystal, you have the Crystal compiler written in Ruby, which can then compile a compiler written in Crystal
zacstewart has joined #ruby
<jhass>
that resulting compiler you can then use to compile the next version of the compiler you wrote in Crystal
<ponga>
damn
mrmortondk has joined #ruby
bweston92 has joined #ruby
<ponga>
jhass: sounds crazy but thanks
emiltin has quit [Quit: Computer has gone to sleep.]
bnagy has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
<jhass>
the lession to learn here is that a compiler is nothing special, it's just a program that reads text, interprets it, and generates some kind of output of it, be it other text (source to source compiler), machine code (source to binary compiler) or whatever else really
<ponga>
ah
<ponga>
yeah
<ponga>
that's right!
<ponga>
finally got it
karmatr0n has quit [Ping timeout: 244 seconds]
atm0sphere has quit [Quit: Leaving]
<jhass>
and the input is actually not even limited to text, see for example the piet programming language or one could argue that disassemblers are compilers too
zacstewart has quit [Ping timeout: 258 seconds]
emiltin has joined #ruby
ocbtec has joined #ruby
GodFather has joined #ruby
chip_ has quit [Ping timeout: 260 seconds]
DoubleMalt has joined #ruby
Xeago_ has joined #ruby
yxdjlr has quit [Remote host closed the connection]
d0nn1e has quit [Ping timeout: 264 seconds]
User458764 has joined #ruby
d0nn1e has joined #ruby
gettalong has quit [Ping timeout: 260 seconds]
slackbotgz has quit [Remote host closed the connection]
Snowy has quit [Remote host closed the connection]
edwinvdgraaf has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
Gasher has joined #ruby
agit0 has quit [Quit: zzzZZZ….]
Snowy has joined #ruby
Rickmasta has quit [Ping timeout: 252 seconds]
nadir has quit [Quit: Connection closed for inactivity]
Rickmasta has joined #ruby
rodfersou has joined #ruby
mikecmpbll has joined #ruby
gnufied has joined #ruby
nhhc has quit [Ping timeout: 264 seconds]
blaxter has joined #ruby
johnmilton has joined #ruby
gettalong has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mercerist has joined #ruby
emiltin has quit [Quit: Computer has gone to sleep.]
mercerist has quit [Client Quit]
mercerist has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
Rickmasta has quit [Ping timeout: 276 seconds]
<Dysp>
If I want to make methods private, like all except one, is there an easier way to do this than to simply private all of those who need be?
Rickmasta has joined #ruby
<Dysp>
I mean, could you write something like "private all except x, y"?
<ljarvis>
Dysp: in theory, yes
<Dysp>
But we don't do that, now, do we?
<Dysp>
:P
d0lph1n98 has quit [Ping timeout: 246 seconds]
madgen has quit [Ping timeout: 272 seconds]
mooru has quit [Ping timeout: 260 seconds]
<ljarvis>
no.. but, surely you could just have any public methods at the top, then use the private keyword without any args, and have all methods below it private?
dionysus69 has quit [Ping timeout: 244 seconds]
hanmac has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
hanmac has joined #ruby
<Dysp>
Alrighty. Thx.
sepp2k has joined #ruby
mistermocha has joined #ruby
pawnbox has quit [Remote host closed the connection]
Xeago_ has quit [Read error: Connection reset by peer]
Xeago_ has joined #ruby
bnagy has joined #ruby
vdamewood has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
Macaveli has joined #ruby
emiltin has joined #ruby
fujinuma has joined #ruby
karmatr0n has joined #ruby
<fujinuma>
what is the fastest way to get ruby's default load path?
<fujinuma>
instead; ruby -e 'puts $:'
emiltin has quit [Client Quit]
zacstewart has joined #ruby
<fujinuma>
ruby.vim uses that expression but it's too much slow.
matp_ is now known as matp
ornerymoose has joined #ruby
bnagy has quit [Ping timeout: 264 seconds]
ornerymoose has quit [Client Quit]
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Xeago_ has quit [Remote host closed the connection]
Hates_ has quit [Ping timeout: 258 seconds]
acalewin has quit [Ping timeout: 258 seconds]
Hates_ has joined #ruby
tfitts has quit [Quit: Connection closed for inactivity]
Xeago_ has joined #ruby
zipkid has quit [Ping timeout: 258 seconds]
armyriad has quit [Ping timeout: 244 seconds]
acalewin has joined #ruby
karmatr0n has quit [Ping timeout: 240 seconds]
ldnunes has joined #ruby
jaguarmagenta has joined #ruby
zipkid has joined #ruby
mdw has joined #ruby
Ropeney has joined #ruby
zacstewart has quit [Ping timeout: 260 seconds]
hanmac has quit [Ping timeout: 258 seconds]
skade has quit [Quit: Computer has gone to sleep.]
<jhass>
fujinuma: you can speed it up a little with --disable-gems
<jhass>
I doubt gem env is any faster
agit0 has joined #ruby
gnufied has quit [Quit: Leaving]
gettalong has quit [Ping timeout: 260 seconds]
armyriad has joined #ruby
<fujinuma>
jhass: what's the equivalent of puts $: in gem env?
<fujinuma>
gem env what?
shinnya has joined #ruby
<jhass>
gem env gempath I think?
jaguarmagenta has quit [Ping timeout: 264 seconds]
<jhass>
mh no, it's not even the same, nvm
agit0 has quit [Client Quit]
<fujinuma>
jhass: thank you for the --disable-gem flag it's much faster.
gnufied has joined #ruby
Xeago_ has quit [Remote host closed the connection]
aries_liuxueyang has quit [Ping timeout: 240 seconds]
moos3 has joined #ruby
yottanami has joined #ruby
<yottanami>
I have an array like this `[{:name=>"Maz", :age=>22}, {:name=>"Alex", :age=>2}]` now I want update it and change the age of Alex, how can I do using Ruby
aries_liuxueyang has joined #ruby
lukebyrne has joined #ruby
joonty has quit [Quit: This computer has gone to sleep]
d0lph1n98 has joined #ruby
Ishido has quit [Remote host closed the connection]
<fujinuma>
yottanami: arr.each{|item| item[:key] = "blah" if item[:key]== "Alex"}
bnagy has joined #ruby
Ishido has joined #ruby
emiltin has joined #ruby
<fujinuma>
yottanami: `arr.each { |person| person[:name] = "blah" if person[:name] == 'Alex'}` this looks nicer :)
lukebyrne has quit [Client Quit]
emiltin has quit [Client Quit]
rodferso1 has joined #ruby
kknight has joined #ruby
ldnunes_ has joined #ruby
Xeago_ has joined #ruby
bnagy has quit [Ping timeout: 260 seconds]
<shevy>
and another one array = [{:name=>"Maz", :age=>22}, {:name=>"Alex", :age=>2}]; array.select {|entry| entry[:name] == 'Alex' }.first[:name] = 'John Doe' # => # => [{:name=>"Maz", :age=>22}, {:name=>"John Doe", :age=>2}]
<shevy>
but in general, if you store it as a hash already, don't put it into an Array on top of that
ramfjord has quit [Ping timeout: 272 seconds]
hanmac has joined #ruby
Xeago_ has quit [Remote host closed the connection]
rodfersou has quit [Ping timeout: 260 seconds]
agentmeerkat has joined #ruby
TomyWork has joined #ruby
jord-n has joined #ruby
joonty has joined #ruby
mradmacher has joined #ruby
ldnunes_ has quit [Quit: Leaving]
gheegh has joined #ruby
agentmeerkat has quit [Ping timeout: 272 seconds]
Xeago_ has joined #ruby
chimkan has joined #ruby
fmcgeough has joined #ruby
rodferso1 is now known as rodfersou
bnagy has joined #ruby
f4cl3y has joined #ruby
agit0 has joined #ruby
moos3_ has joined #ruby
pawnbox has joined #ruby
moos3 has quit [Read error: Connection reset by peer]
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
synthroid has joined #ruby
strigon33 has joined #ruby
ornerymoose_ has joined #ruby
jmignault has joined #ruby
Ropeney has joined #ruby
ornerymoose has quit [Ping timeout: 244 seconds]
ornerymoose_ is now known as ornerymoose
arne_ has joined #ruby
aries_liuxueyang has quit [Ping timeout: 260 seconds]
aries_liuxueyang has joined #ruby
kspencer has quit [Ping timeout: 244 seconds]
<arne_>
grml, how does one insert a tag in a text node with nokogiri?
neha- has joined #ruby
madgen has joined #ruby
lightt has quit [Remote host closed the connection]
emilkarl has joined #ruby
strigonLeader has quit [Ping timeout: 240 seconds]
skade has joined #ruby
DTZUBDUB has quit [Ping timeout: 264 seconds]
bluOxigen has joined #ruby
allcentury has joined #ruby
madgen has quit [Ping timeout: 260 seconds]
GodFather has quit [Ping timeout: 260 seconds]
nankyokusei has joined #ruby
freerobby has joined #ruby
moos3_ has quit [Ping timeout: 240 seconds]
dcunit3d has joined #ruby
cevett_ has quit [Quit: Leaving]
gettalong has joined #ruby
cevett_ has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
cevett_ has quit [Client Quit]
cevett has joined #ruby
jrafanie has joined #ruby
swills has quit [Ping timeout: 260 seconds]
GodFather has joined #ruby
madgen has joined #ruby
aufi has quit [Ping timeout: 260 seconds]
gfvcastro has joined #ruby
<hanmac>
arne_: hm textnodes should not be able to have tags ... normally you would need to replace the text node ... but i currently don't know how ... i need to look it up
dcunit3d has quit [Ping timeout: 244 seconds]
karmatr0n has joined #ruby
zacstewart has joined #ruby
mistermocha has joined #ruby
edwinvdg_ has joined #ruby
Xeago_ has quit [Remote host closed the connection]
mostlybadfly has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Remote host closed the connection]
nettoweb has joined #ruby
strigon33 has joined #ruby
zacstewart has joined #ruby
edwinvdgraaf has joined #ruby
strigonLeader has quit [Ping timeout: 246 seconds]
prestorium has joined #ruby
karmatr0n has joined #ruby
isxek has joined #ruby
moeabdol has quit [Ping timeout: 240 seconds]
jaguarmagenta has joined #ruby
freerobby has quit [Quit: Leaving.]
symm- has joined #ruby
VeryBewitching has joined #ruby
karmatr0n has quit [Ping timeout: 240 seconds]
SirOliver has quit [Quit: ZZZzzz…]
eljimmy has joined #ruby
bkxd has joined #ruby
SilverKey has joined #ruby
pawnbox has joined #ruby
jaguarmagenta has quit [Ping timeout: 240 seconds]
Hobogrammer has quit [Quit: WeeChat 0.4.2]
craigp_ has quit [Quit: WeeChat 1.5]
craigp has joined #ruby
pontiki has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hinbody has joined #ruby
ta_ has quit [Remote host closed the connection]
M-mistake has quit [Ping timeout: 244 seconds]
M-shine has quit [Ping timeout: 246 seconds]
merceris_ has joined #ruby
M-Kodo has quit [Ping timeout: 260 seconds]
lxsameer has quit [Quit: WeeChat 1.5]
aryaching has joined #ruby
hk238 has joined #ruby
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ifsp has joined #ruby
mercerist has quit [Ping timeout: 250 seconds]
insanedreamer has joined #ruby
palms has joined #ruby
`tim` has joined #ruby
dasher00 has quit [Quit: Leaving]
skade has quit [Quit: Computer has gone to sleep.]
dasher00 has joined #ruby
sergio_101 has joined #ruby
User458764 has joined #ruby
northfurr has joined #ruby
LoneHerm_ has joined #ruby
<User458764>
Hi, when using block methods like array.collect {} how do you refer to the instance. I see something very cool in Swift which do that but I can't reproduce it in ruby
wigust has joined #ruby
agentmeerkat has joined #ruby
Niham has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
andikr has quit [Remote host closed the connection]
<toretore>
you can't
<jhass>
what does "the instance" even mean here?
<jhass>
the array?
<User458764>
toretore oh great I see finally an interest to Swift over ruby :)
<User458764>
jhass yes
<jhass>
yes you can't, you have to closure the initial variable
<pontiki>
array
<User458764>
I thought a self will does the job but not
<mikecmpbll>
depends exactly what you're trying to do but can probably suggest a way to do it.
<jhass>
User458764: I was more interested in some real world usecases
reloaded has joined #ruby
<User458764>
mikecmpbll jhass when you are using array powerful builtin api and you want to refer to the index
<arne_>
grml, why does nokogiri support creating notes from "chunks" everywhere, but when you want to create element
<arne_>
s
<apeiros>
notes = nodes?
<arne_>
yep
<jhass>
User458764: so array.map.with_index {|elem, i| } ?
<apeiros>
and "but when" = "but not when"?
<arne_>
nope
sdwrage has joined #ruby
<apeiros>
then phrase no parse
<User458764>
jhass yes I saw this same expression in the collect documentation
<arne_>
apeiros: pardon?
kareeoleez has quit [Read error: Connection reset by peer]
aganov has quit [Remote host closed the connection]
wigust_ has joined #ruby
<apeiros>
arne_: can't make sense of what you said
<jhass>
User458764: I find the stuff under "Shorthand Argument Names" in your link very confusing
<jhass>
I think perl has similar stuff
<apeiros>
"but when you want to create elements" - yeah, then what? lacks some statement as is…
kareeoleez has joined #ruby
Xeago_ has joined #ruby
<toretore>
SyntaxError
<arne_>
"... anything, but" sounds pretty valid to me
<jhass>
User458764: I prefer to have readable names for stuff that actually have a semantic meaning for the data
<User458764>
In the expression you gave me array.map.with_index {|elem, i| } how do you refer to the 'array' instance to collect only even index for example?
<arne_>
i like every icecream, but chocolate
<mikecmpbll>
User458764 : the example in that link you gave about passing a sorting function to the sort method can be done in ruby with lambdas, which are closures too
<apeiros>
arne_: so "but" as "but not"
fenre has quit [Remote host closed the connection]
<mikecmpbll>
>> backwards = ->(a, b){ b <=> a }; [1,2,3,4,5].sort(&backwards)
Xeago_ has quit [Remote host closed the connection]
<arne_>
no you didn't use the word "as" you used "=" which is equal, which is not equal.
<User458764>
mikecmpbll hum interresting I bookmark it
<apeiros>
arne_: uh dude, then you should have said "no" when I asked "notes = nodes"
<arne_>
u got me
wigust has quit [Ping timeout: 260 seconds]
<mikecmpbll>
User458764 : that's identical to the sort example under "The Sort Method".
<jhass>
User458764: I'm not sure what you mean, two possible interpretations: array.map.with_index {|elem, i| i.even? ? func(elem) : elem } or array.select.with_index {|_, i| i.even? }.map {|elem| func(elem) }
<reloaded>
Gem net-ldap, how can I search internal ldap attributes like "pwdAccountLockedTime"? With ldapsearch command there is the "+" option who enables you to see those attributes but is there any in this gem?
<User458764>
jhass ok it's the first time I see func method thanks
<arne_>
either way.. nokogiri let's me add siblings like node.add_sibling "<img src="whatever.png">", but i cannot create an element like that, to insert it later on
<arne_>
and i can't find the code in their github
KCmetro has joined #ruby
<apeiros>
arne_: use Nokogiri.HTML("<element>")?
<arne_>
that creates a document, where i have to search the element i want to insert
<jhass>
User458764: tbh I have the feeling your use of "the instance" is not what you actually mean by it
<arne_>
which is possible, but superugly
<apeiros>
hm, ok
<apeiros>
arne_: and Nokogiri.HTML.fragment("<element>")?
<arne_>
*tests*
<apeiros>
hm, no
<apeiros>
doesn't work. but there was something like that
cdg has joined #ruby
mdw has quit [Quit: Sleeping Zzzzz]
<apeiros>
ah, Nokogiri::HTML.fragment("<element>"). but that doesn't given an element either. it's a DocumentFragment
<arne_>
apeiros: well works for me
<jhass>
User458764: func is a placeholder for some arbitrary operation on elem applied, I made it up on the spot, it's nothing given by the language
<arne_>
apeiros: doc.at()
<arne_>
apeiros: doc.at('//body').first.add_child Nokogiri::HTML.fragment('<img src="google.de">') does i what i want, thanks
<arne_>
the nokogiri docs confused me there .. somehow
<apeiros>
curious why a plain string doesn't work :-/
<mikecmpbll>
arne_ , apeiros : not sure i'm following this exactly, but it sounded like it might be similar to an issue i was having a few years ago: http://stackoverflow.com/a/29219261/1520714
<mikecmpbll>
this dude's answer seems comprehensive, if it is at all related
<arne_>
still weird, that you can use html"fragments" everyhwere but in element-creations
<mikecmpbll>
if not, ignore me :)
<apeiros>
arne_: agreed
<apeiros>
.add_child("html string") would make sense
<arne_>
well, that works, i think
<apeiros>
then I'm again confused as to what your issue is :D
<apeiros>
but I got to go afk now
<arne_>
yeah i will explain it, let me.. okeh
diegoaguilar has quit [Read error: Connection reset by peer]
<arne_>
i have html templates with ruby-style-placeholders "#{example}", and i was using .gsub to replace them, after i went into html-escaping-errors, i went with nokogiri :D
<arne_>
now i cannot use gsub since it escapes { and } :D
swills has joined #ruby
northfurr has quit [Ping timeout: 260 seconds]
<arne_>
and if i want to insert a (for example) <img> node in text, i will have to rearrange everything, bleh
<arne_>
so find text node => find placeholder => split textnode in 2 => insert img tag in between
codecop has quit [Remote host closed the connection]
<agent_white>
Mornin'
<mikecmpbll>
TvL2386 : okay, and what's the problem?
skade has joined #ruby
<TvL2386>
well I'm struggling on how to get savon to create that output
Xeago_ has joined #ruby
<mikecmpbll>
TvL2386 : what are you struggling with? ...
dcunit3d has quit [Ping timeout: 244 seconds]
M-Kodo has joined #ruby
mistermocha has joined #ruby
marr has quit [Read error: Connection reset by peer]
SilverKey has joined #ruby
<TvL2386>
mikecmpbll, I don't know how to create the :message that I supply to Savon.client.call(:prequal, message: { ???? })
skade has quit [Client Quit]
<mikecmpbll>
TvL2386 : oh okay. savon converts the hash to xml (and does a little bit of other nice stuff)
skade has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
aufi has joined #ruby
freerobby has joined #ruby
allcentury has quit [Ping timeout: 260 seconds]
<TvL2386>
mikecmpbll, yes... And in my generated xml I have: <env:Body><tns:prequal><orderLocation>#<Vendor1::OrderLocation:0x00562c35649698></orderLocation><productGroup>THE_PRODUCT</productGroup></tns:prequal></env:Body>
allcentury has joined #ruby
<mikecmpbll>
TvL2386 : okay, why are you passing a ruby object to the soap message?
User458764 has joined #ruby
<mikecmpbll>
you'll probably want to render that object to XML before putting it in the message.
mistermocha has joined #ruby
<TvL2386>
mikecmpbll, hmmm..... I thought I would keep that object around so I can add other things like persisting to the DB... That's probably gonna happen
mistermocha has quit [Read error: Connection reset by peer]
<TvL2386>
mikecmpbll, yeah that sounds good. And how would I get the "href" object references in the output?
<mikecmpbll>
that fine, but you can't just plonk the object in the hash and expect savon to know how to convert it to your valid xml soap request.
snath has quit [Ping timeout: 260 seconds]
nhhc is now known as Chau
mistermocha has joined #ruby
<TvL2386>
mikecmpbll, yeah true :)
mistermocha has quit [Read error: Connection reset by peer]
Xeago_ has quit [Remote host closed the connection]
<mikecmpbll>
TvL2386 : from what i recall (although i can't actually find it in the docs) to create attributes on the elements, you pass them under the key `attributes!`
gfvcastro has joined #ruby
<mikecmpbll>
like message: { foo: "bar", attributes!: { foo: { "baz" => "blah" } } would result in something like <foo baz="blah">bar</foo>
giz|work has quit [Ping timeout: 272 seconds]
yardenbar has quit [Ping timeout: 272 seconds]
<TvL2386>
mikecmpbll, so what you are saying is to work with sub elements instead of having references to the objects as shown in the gist?
mistermocha has joined #ruby
<mikecmpbll>
TvL2386 : no i was trying to explain how to get the element attributes like in the gist.
mistermocha has quit [Read error: Connection reset by peer]
<TvL2386>
oh the href!
roamingdog has joined #ruby
polishdub has joined #ruby
craigp has quit [Ping timeout: 276 seconds]
<mwlang>
Is there a better way to tell the time portion of a Time is zero than t.hour + t.min + t.sec == 0 ?
roamingdog has quit [Read error: Connection reset by peer]
<smathy>
ruby-lang191, if it's the `h.` that you don't understand: singleton method. If it's the `[]=` that you don't understand, umm, just ruby docs.
<ruby-lang191>
cool, thanks!
mebus has left #ruby [#ruby]
<smathy>
Happy to explain either here if you need it, but some people like discovering for themselves, so I don't want to ruin the experience if that's you :)
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Sashimi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apeiros>
also public_send > send
<ruby-lang191>
`h = {} def h.[]=(k, v)` Why is a singleton method being called on an empty hash in the def? Also what is []= , on docs I found it as setting environment variable but I think I'm looking up the wrong thing.
<smathy>
The & has to be part of the method call though, so yeah, no closer to the splat.
<apeiros>
ruby-lang191: that's not calling a method, that's defining it
<fabianfrz1>
are some ruby developers here - I have a question about URI
User458764 has joined #ruby
ocbtec has quit [Quit: leaving]
<smathy>
fabianfrz1, best to just ask.
<apeiros>
it defines the []= method for that single hash instance. and []= is what's invoked when you do: `some_hash[key] = value`
<dsimon>
it thinks the first part is the protocol :-(
<smathy>
Yep, the colon throws it.
<smathy>
It's really not a URI parser at all.
<apeiros>
1 is not valid as a subdomain afair
<dsimon>
i guess that is reasonable of it
<smathy>
...although: "example.com:443" is not a URI.
<dsimon>
since without a protocol it's not a proper URI according to the rfc
<fabianfrz1>
some CDNs are numbered this way
Macaveli has joined #ruby
<smathy>
dsimon, I actually think your code isn't terrible, the CONNECT request does *not* provide a URI.
<dsimon>
or a "scheme" as the official docs put it
<apeiros>
and missing the scheme, yes
<smathy>
...it provides a host:port
SilverKey has quit [Quit: Halted.]
<dsimon>
smathy, s'not my code :-)
<smathy>
Heh, sorry...
<smathy>
fabianfrz1, ^
<apeiros>
fabianfrz1: I doubt that
<smathy>
fabianfrz1, just checking, you *do* understand that "1.localhost:123" *is* a bad URI right? As is "example.com:443" for that matter.
dopie_ has quit [Quit: Lost terminal]
hinbody has joined #ruby
Laxu5 has joined #ruby
dopie_ has joined #ruby
<fabianfrz1>
ok, so everything works as expected and this should not be used as an uri - however the server requires it as it decides which service it will call
<fabianfrz1>
It works just fine now ;)
jhack has joined #ruby
ramfjord has joined #ruby
Moosashi has quit [Quit: Moosashi]
KCmetro has quit [Remote host closed the connection]
SilverKey has joined #ruby
jottr has joined #ruby
SCHAAP137 has quit [Quit: Leaving]
gfvcastro has joined #ruby
KCmetro has joined #ruby
MrBusiness has quit [Ping timeout: 250 seconds]
ocbtec has joined #ruby
enterprisey has joined #ruby
<fabianfrz1>
thanks for your help
ramfjord has quit [Ping timeout: 260 seconds]
gatman has joined #ruby
jaruga___ has quit [Quit: jaruga___]
whathappens has quit [Quit: Leaving...]
<shevy>
I am having a blackout I think ...
<shevy>
from code like: class Base; end; class A < Base; end ... is there a way to find out the direct superclass from class A?
pilne has joined #ruby
<havenwood>
shevy: ask it
<shevy>
ah... .superclass I guess
<havenwood>
shevy: A.superclass
<havenwood>
yup!
<havenwood>
<3 Ruby
<shevy>
I think I never used this so far, thanks
jaguarmagenta has joined #ruby
vuoto has joined #ruby
roamingdog has quit [Remote host closed the connection]
k3rn31 has joined #ruby
jgt1 has quit [Ping timeout: 244 seconds]
Moosashi has joined #ruby
<havenwood>
shevy: you're welcome, any time!
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
wixad_ has joined #ruby
jaguarmagenta has quit [Ping timeout: 260 seconds]
<havenwood>
shevy: thanks back - i updated my method finding code to not bug out finding that answer :)
KCmetro has quit [Remote host closed the connection]
dfockler has joined #ruby
conta has joined #ruby
aegis3121 has quit [Ping timeout: 260 seconds]
<shevy>
hehe
SirOliver has quit [Quit: Ave]
AlexRussia has joined #ruby
KCmetro has joined #ruby
gatman has quit [Ping timeout: 264 seconds]
ta_ has quit [Remote host closed the connection]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
k3rn31 has quit [Quit: Computer has gone to sleep.]
postmodern has quit [Quit: Leaving]
Moosashi has quit [Quit: Moosashi]
mistermocha has quit [Remote host closed the connection]
mistermocha has quit [Remote host closed the connection]
d0lph1n98 has quit [Ping timeout: 258 seconds]
<ruby-lang191>
So it's creating a singleton method in a def, which is confusing. And is (k,v) the paramters for the method or is it the values taken from the hash after a key/value is assigned?
<malconis>
it's overriding []= for h (hash)
<malconis>
looks like it's just printing out what it's doing
weaksauce has joined #ruby
<malconis>
so now whenever you're setting value for a key it'll print out "Setting hash key #{k} with #{v.inspect}"
craigp has joined #ruby
<ruby-lang191>
what about the (k,v) part? is that the method param?
<toretore>
it's just a method, like any other
<toretore>
it takes two arguments
k3rn31 has joined #ruby
quakephil has joined #ruby
saneax is now known as saneax_AFK
aeruder has joined #ruby
<ruby-lang191>
havent seen that kind of method def before and I'm still trying to understand it.
kareeoleez has quit [Remote host closed the connection]
<ruby-lang191>
are there similar examples I can search for? I don't know what to search for?
<quakephil>
Greets all! How can I access an array inside a sort_by block? I'm getting "nil" when trying to use it here http://pastebin.ca/3649166
nofxx has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
ponga has quit [Quit: Connection closed for inactivity]
<quakephil>
(line 22, sortedkeys.index(k) turns out to be nil)
<dsimon>
note that the other weird thing about the snippet you posted is that it's not only doing operator overloading, it's also defining a method on a singleton class
yardenbar has quit [Ping timeout: 272 seconds]
brian has joined #ruby
brian is now known as Guest79580
ramfjord has joined #ruby
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dsimon>
quakephil, it's a symbols vs strings problem
<dsimon>
that's my guess anyways
<dsimon>
try sortedkeys.index(k.to_sym)
<toretore>
quakephil: it doesn't have anything to do with `sortedkeys` not being accessible
memorasus1 has joined #ruby
<jhass>
yes two problems there
<jhass>
first is symbols vs strings, just the other way around than dsimon mentioned
<jhass>
second is that sortedkeys doesn't have all keys you ask it for
<dsimon>
oh, right, yeah
`tim` has joined #ruby
<dsimon>
and yeah
* dsimon
nods in agreement
aegis3121 has joined #ruby
<quakephil>
jhass: that's by design
<jhass>
so .index returns nil in some (currently all) situations
<jhass>
and you can't 0 <=> nil
<memorasus1>
Would anyone be kind enough to review my code for a project I'm working on and suggest things I could do differently? It's the first script i'm writing in ruby so I don't know where it could be improved
<quakephil>
can you help me write the sorter? I essentually want to get to the sorted hash, from unsorted hash, using sortedkeys as a guide
<quakephil>
sortedkeys may or may not have all keys
<quakephil>
any hints/pointers are welcome
<jhass>
tbh I still consider depending on the order of a hash a code smell in itself
<quakephil>
Ordering a hash is one of the basic functions of this data structure
<jhass>
quakephil: what's the order of keys not in sortedkeys?
<hxegon>
agreed, hashes should be order independant
ta_ has joined #ruby
<quakephil>
jhass: either as before, or doesn't matter
<quakephil>
whichever is simpler to implement
postmodern has joined #ruby
<jhass>
quakephil: wrong, Hash is Ruby's implementation of a map. The ADT map doesn't define order. Ruby's Hash was in fact unordered up to version 1.9
<jhass>
just getting the misconceptions out of the way first
danostrowski has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord_ has joined #ruby
Snowy has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<jhass>
.sort {|(a, _), (b, _)| a_i = sortedkeys.index(a); b_i = sortedkeys.index(b); a_i && b_i ? a_i <=> b_i : a_i || b_i ? 1 : a <=> b } should be your solution
synthroid has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 252 seconds]
agit0 has joined #ruby
<quakephil>
Holy mother of god... let me give that a shot
mikecmpbll has joined #ruby
pandaant has quit [Remote host closed the connection]
memorasus1 is now known as memorasus
<quakephil>
http://pastebin.ca/3649176 doesn't seem to be sorting; also returning a array whereas I should really want a hash in the same form back, but ordered
dikaio has joined #ruby
<quakephil>
I'm on 2.3.0p0
roamingdog has joined #ruby
<jhass>
yes you have to convert it back.
<jhass>
Ruby's hash is insertion ordered. It does not support reordering in place
phrozen77_ has joined #ruby
kirun has joined #ruby
whathapp_ has joined #ruby
<quakephil>
ok that's fine, but the ordering doesn't seem to be working either, the resulting array is still in the original order?
roamingdog has quit [Read error: Connection reset by peer]
araujo has joined #ruby
roamingdog has joined #ruby
jottr has quit [Ping timeout: 240 seconds]
whathappens has quit [Ping timeout: 250 seconds]
phrozen77 has quit [Ping timeout: 250 seconds]
<jhass>
you ignored the first problem I mentioned
<quakephil>
I want to get this working. If I missed something, its not because I'm ignoring it
<quakephil>
Its because I'm a noob who is trying to learn with your help
<quakephil>
so what did I miss? Do I have to convert the hash to an array first?
<jhass>
you have scrollback, reread what I and dsimon wrote
<quakephil>
I thought "should be your solution" meant it should be my solution
ramfjord_ has quit [Ping timeout: 246 seconds]
<quakephil>
My bad
<dsimon>
jhass, why have them use sort instead of sort_by?
<memorasus>
This is the main script, everything else is just nonsense / dependent directories
nankyokusei has quit [Ping timeout: 260 seconds]
moeabdol has joined #ruby
mtkd has joined #ruby
synthroid has joined #ruby
LoneHerm_ has joined #ruby
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dcunit3d has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
I think you can simplify the various serv.name =~/sql/ lines
<memorasus>
how so?
roamingdog has quit [Ping timeout: 240 seconds]
`tim` has joined #ruby
<memorasus>
I don't even need it explained, just a link to that stuff would be tremendously helpful, I know virtually nothing about ruby lol
<hanmac>
shevy *now making an Uncle Sam pose' i need you to Dislike the Ghostbusters 2016 Trailer ... there are still a few numbers left until 1.000.000 ;P
moeabdol has quit [Ping timeout: 260 seconds]
LoneHerm_ has quit [Ping timeout: 240 seconds]
ruby-lang989 has quit [Ping timeout: 250 seconds]
<dsimon>
memorasus, google "ruby case regex" :-)
agit0 has quit [Quit: zzzZZZ….]
gfvcastro has joined #ruby
mercerist has quit [Quit: Computer has gone to sleep.]
dcunit3d has quit [Ping timeout: 276 seconds]
ta_ has quit [Read error: Connection reset by peer]
Macaveli has joined #ruby
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy>
you can make a link to the solution from your script, to rubular
<shevy>
click at "make permalink"
<memorasus>
idk if you'd know this if you haven't worked with metasploit, but do you know if theres a way to interact with the framework / datastore without actually being in msf?
<shevy>
no idea, I think the amount of people here who use or need metasploit is very very low
<memorasus>
That's what I expected, but then in the offsec channel people just tell you to try harder lol
<aegis3121>
not compact, you'll still need #reject
<smathy>
alcy_, yes.
<jhass>
alcy_: yes but you shouldn't do it, your framework should offer you a way to extract that logic into a method external from the template and allow you to call it then
<aegis3121>
though you could use select. arr.select { |thing| thing[:date] } if you prefer thinking about select rather than reject
dikaio has joined #ruby
<dsimon>
i like PaulePanter's original version best
<jhass>
Id add some spaces but it's pretty good already
joonty has joined #ruby
<alcy_>
jhass: I am doing this in puppet's context, so my options are a little limited.
<jhass>
?puppet
<ruby[bot]>
Please join #puppet for help with it.
* hanmac
is now known as "I'Mrakul"
<jhass>
PaulePanter: posts.reject {|post| post[:date].nil? }.sort {|a, b| b[:date] <=> a[:date] } would save the reverse call
dikaio has quit [Client Quit]
nankyokusei has joined #ruby
<aegis3121>
And, yea: I think .select { |post| post[:date] } reads slightly better, but that's a matter of choice. Saves a method call on #nil?, though.
dikaio has joined #ruby
chip_ has joined #ruby
wigust has joined #ruby
wigust has quit [Remote host closed the connection]
<PaulePanter>
aegis3121, jhass: Thanks a lot.
dikaio has quit [Client Quit]
<aegis3121>
np
mercerist has joined #ruby
<ytti>
anyone have extra berlin/ietf venue hotel reservation they want to get rid of?
CJKinni` has joined #ruby
mercerist has quit [Remote host closed the connection]
<hanmac>
i always wanted some kind of reverse sort, but that doesn't exist yet
mattwashere has quit [Remote host closed the connection]
VeryBewitching has quit [Quit: Konversation terminated!]
jhack has quit [Quit: jhack]
mattwashere has joined #ruby
CJKinni has quit [Ping timeout: 264 seconds]
dikaio has joined #ruby
edwinvdg_ has joined #ruby
yfeldblum has joined #ruby
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 272 seconds]
cdg has quit [Remote host closed the connection]
Pumukel has joined #ruby
CJKinni has joined #ruby
CJKinni` has quit [Read error: Connection reset by peer]
bluOxigen has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
edwinvdg_ has quit [Ping timeout: 258 seconds]
VeryBewitching has joined #ruby
johnmilton has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
wigust has joined #ruby
dcunit3d has joined #ruby
gizmore has joined #ruby
ramfjord has joined #ruby
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ruby
bluOxigen has quit [Client Quit]
dionysus69 has quit [Ping timeout: 260 seconds]
zenlot has joined #ruby
dfockler has quit [Ping timeout: 260 seconds]
elifoster has joined #ruby
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dikaio has joined #ruby
zenlot6 has quit [Ping timeout: 276 seconds]
k3rn31 has quit [Quit: Computer has gone to sleep.]
dikaio has quit [Max SendQ exceeded]
bkxd has joined #ruby
giz|work has joined #ruby
Sashimi has joined #ruby
Guest79580 has quit [Ping timeout: 244 seconds]
nofxx has quit [Ping timeout: 276 seconds]
nofxx has joined #ruby
phrozen77_ has quit [Quit: Computer has gone to sleep.]
bkxd has quit [Ping timeout: 260 seconds]
Madplatypus has joined #ruby
brian_ has joined #ruby
Mia has quit [Read error: Connection reset by peer]
replay has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
yardenbar has joined #ruby
amcoder has joined #ruby
jmignault has joined #ruby
Endie has joined #ruby
dcunit3d has quit [Ping timeout: 272 seconds]
Akuma has joined #ruby
rodfersou is now known as rodfersou|afk
dcunit3d has joined #ruby
nankyokusei has quit [Remote host closed the connection]
whathapp_ has quit [Remote host closed the connection]
whathappens has joined #ruby
whathappens has quit [Remote host closed the connection]
_mak_ has left #ruby [".."]
dcunit3d has quit [Ping timeout: 276 seconds]
<havenwood>
It'd be nice to simplify the Puma thread pool code once pre-2.4 is past EoL at the very least! (Unless it's really worth doing even now. I haven't done thorough benchmarks.)
ocbtec has quit [Quit: leaving]
modin has joined #ruby
whathappens has joined #ruby
<ruby-lang191>
Is there a rails IRC or people answer rails questions here also?
KCmetro has quit [Remote host closed the connection]
<jhass>
?rails
<ruby[bot]>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<shevy>
ruby-lang191 #rubyonrails but you may have to register first on freenode
whathappens has quit [Remote host closed the connection]
ruby-lang191 has left #ruby [#ruby]
whathappens has joined #ruby
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
nankyokusei has quit [Remote host closed the connection]
modin has quit [Ping timeout: 264 seconds]
<smathy>
You don't ^
KCmetro has joined #ruby
whathappens has quit [Ping timeout: 252 seconds]
dcunit3d has joined #ruby
pwnd_nsfw has joined #ruby
Yiota has joined #ruby
Gasher has quit [Quit: Leaving]
tomchapin has joined #ruby
alcy_ has quit [Quit: leaving]
blackgoat has joined #ruby
<jhass>
well, Radar's switching it on and off all the time, can't be bothered to change the factoid each time
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<smathy>
No harm anyway :)
<shevy>
:D
eljimmy has quit [Quit: This computer has gone to sleep]
centrx has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Guest48 has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
dhollinger has joined #ruby
xall_ has quit [Ping timeout: 252 seconds]
chimkan has quit [Quit: chimkan]
jgt1 has quit [Quit: WeeChat 1.4]
lightt has joined #ruby
neo_ has joined #ruby
replay has quit [Ping timeout: 244 seconds]
modin has joined #ruby
<neo_>
hi
<havenwood>
neo_: hi
<apeiros>
jhass: we could change it to "you may need to…"
<apeiros>
but
<apeiros>
meh :D
lightt has quit [Remote host closed the connection]
<jhass>
;)
crystal77 has joined #ruby
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fabianfrz1 has left #ruby ["Konversation terminated!"]
pawnbox has joined #ruby
Lord_of_Life has quit [Excess Flood]
modin has quit [Ping timeout: 264 seconds]
ur5us has joined #ruby
moos3_ has joined #ruby
edwinvdgraaf has joined #ruby
Dimik1 has quit [Ping timeout: 250 seconds]
lightt has joined #ruby
lightt has quit [Max SendQ exceeded]
lightt has joined #ruby
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Endie has quit [Ping timeout: 276 seconds]
Lord_of_Life has joined #ruby
LoneHermit has joined #ruby
moos3 has quit [Ping timeout: 252 seconds]
pawnbox has quit [Ping timeout: 252 seconds]
<shevy>
let unregistered users change factoids for you!!!
yardenbar has quit [Ping timeout: 276 seconds]
timanema has joined #ruby
LoneHermit has quit [Ping timeout: 252 seconds]
danostrowski has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gusrub has quit [Quit: Leaving]
Jayson_Virissimo has joined #ruby
moos3_ has quit [Remote host closed the connection]
timanema has quit [Client Quit]
dcunit3d has quit [Ping timeout: 252 seconds]
danostrowski has joined #ruby
timanema has joined #ruby
blandflakes has joined #ruby
bier_ has quit [Ping timeout: 276 seconds]
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
deviation has joined #ruby
Endie has joined #ruby
allcentury has quit [Ping timeout: 258 seconds]
aep-shoutlet has joined #ruby
<deviation>
I have a ruby question that I'm not sure how to ask properly... I have a hash with many optional items and I want to send its values to a method only if they're defined in the hash. The method I'm calling takes values named keyword arguments. Ie I would like to call: myMethod(id: data['id']) if data['id'] is set, otherwise I'd like to just call myMethod()
<deviation>
is there a shorthand/clean way to do that?
ta_ has quit [Remote host closed the connection]
timanema has quit [Quit: leaving]
ldnunes_ has joined #ruby
<tobiasvl>
deviation: well, if data['id'] is not set it will be nil, so handle nil as a special case inside myMethod?
bier has joined #ruby
[Butch] has joined #ruby
<mradmacher>
How about something like myMethod(data.fetch('id', nil))
<tobiasvl>
mradmacher: won't it already be nil?
<deviation>
myMethod is in a 3rd party lib
<tobiasvl>
as long as data is set of course
<deviation>
that I can't (or don't want to) modify
<toretore>
deviation: what is myMethod actually?
<jhass>
deviation: does it require the arguments to be passed?
<havenwood>
deviation: If open source, link to the code?