relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ismaelga has joined #ruby
jespada has joined #ruby
spider-mario has quit [Ping timeout: 252 seconds]
IrishGringo has joined #ruby
rbennacer has quit [Ping timeout: 240 seconds]
scripore has quit [Quit: This computer has gone to sleep]
DrShoggoth has joined #ruby
adriancb has joined #ruby
dandaman has joined #ruby
Takle has quit [Ping timeout: 256 seconds]
<mwlang>
I want to replace a library’s method with my own, do my thing as if that method was called, then call the original method. How do I do this? In Pascal parlance, it was called method chaining and you simply saved the pointer to the original method somewhere and set the pointer to your own method and that allowed your method to get called instead of the original. In ruby parlance, “method chaining” means calling one method after anothe
<mwlang>
tandem, so I have the wrong terminology for sure.
mikeric has quit [Read error: Connection reset by peer]
scripore has joined #ruby
Sawbones has quit [Remote host closed the connection]
dstarh has joined #ruby
jenrzzz has joined #ruby
delianides has joined #ruby
apxm has joined #ruby
<jhass>
mwlang: why is there no alternative design and which ruby versions do you need to support
workmad3 has quit [Ping timeout: 256 seconds]
Takle has joined #ruby
roolo_ has quit [Remote host closed the connection]
n80 has joined #ruby
delianides has quit [Remote host closed the connection]
roolo has joined #ruby
IrishGringo_ has joined #ruby
havenwood has quit [Remote host closed the connection]
roolo has quit [Remote host closed the connection]
delianides has joined #ruby
<mwlang>
jhass: I’m basically going to stub the call to my LDAP server so that I capture the server’s actual response when the “cassette” doesn’t exist yet. If the cassette exists, I just return the contents of the cassette, otherwise, I pass-thru to the original method
scripore has quit [Client Quit]
tier has joined #ruby
IrishGringo has quit [Ping timeout: 256 seconds]
<jhass>
seems brittle, but given what I've seen from that app, it makes no diff anymore I guess. Second question?
adriancb has quit [Remote host closed the connection]
Wolland has joined #ruby
<mwlang>
jhass: Ruby 2.1+
<jhass>
implement your method in a module and prepend (not include) it into the class
sevenseacat has joined #ruby
<jhass>
then you can just call super in your implementation
roolo has joined #ruby
<mwlang>
jhass: only brittle if LDAP 2.0 standards are going to change any time soon.
* mwlang
goes to look up “prepend ruby”
bklane has quit [Remote host closed the connection]
ismaelga has quit [Remote host closed the connection]
martin_work has joined #ruby
<jhass>
I'm talking in terms of code maintenance and quality
IrishGringo_ has quit [Client Quit]
Azure has quit [Read error: Connection reset by peer]
mistermocha has quit [Read error: Connection reset by peer]
<mwlang>
ah….”memoization” is what I’m chasing.
mistermocha has joined #ruby
bklane has joined #ruby
roolo has quit [Ping timeout: 245 seconds]
<mwlang>
jhass: its a test-suite hack. If you got a better pattern for implementing, I’m all ears.
doodlehaus has joined #ruby
Mon_Ouie has quit [Ping timeout: 252 seconds]
martin_work has quit [Client Quit]
<jhass>
abstracting the library calls into an adapter and making the actual adapter used a parameter of your actual code, then you could just implement a variant for the test
<jhass>
some call that dependency injection I guess
justin_pdx has quit [Quit: justin_pdx]
n80 has quit [Quit: n80]
bklane has quit [Remote host closed the connection]
<mwlang>
jhass: yeah, that’s a little more than I need here. the prepend approach will work nicely and its readable.
mistermocha has quit [Ping timeout: 244 seconds]
karmatr0n has quit [Read error: Connection reset by peer]
karmatr0n has joined #ruby
Mon_Ouie has joined #ruby
tkuchiki has joined #ruby
tubuliferous has quit [Read error: Connection reset by peer]
spider-mario has joined #ruby
spider-mario_ has joined #ruby
adriancb has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__adam has joined #ruby
Takle has quit [Remote host closed the connection]
Aswebb_ has joined #ruby
kblake has quit [Ping timeout: 245 seconds]
RegulationD has joined #ruby
spider-mario has quit [Ping timeout: 255 seconds]
__adam_ has joined #ruby
allcentury has joined #ruby
sean_1 has joined #ruby
hmsimha has quit [Ping timeout: 252 seconds]
jespada has quit [Ping timeout: 246 seconds]
RegulationD has quit [Ping timeout: 250 seconds]
__adam_ has quit [Client Quit]
Aswebb_ has quit [Ping timeout: 272 seconds]
__adam has quit [Ping timeout: 264 seconds]
__adam_ has joined #ruby
sean_1 has left #ruby ["Konversation terminated!"]
freerobby has joined #ruby
ismaelga has joined #ruby
Sawbones has joined #ruby
krasnus has joined #ruby
lkba_ has quit [Ping timeout: 255 seconds]
igorshp has quit [Ping timeout: 246 seconds]
__adam_ is now known as __adam
doodlehaus has quit [Remote host closed the connection]
delianides has quit []
plashchynski has quit [Quit: plashchynski]
tier has quit [Remote host closed the connection]
reinaldob has joined #ruby
adriancb has quit [Remote host closed the connection]
atomiccc has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 272 seconds]
yh has quit [Ping timeout: 256 seconds]
n80 has joined #ruby
wallerdev has joined #ruby
heyimwill has joined #ruby
nii236 has joined #ruby
tkuchiki_ has joined #ruby
tkuchiki has quit [Ping timeout: 252 seconds]
scripore has joined #ruby
nii236 has quit [Client Quit]
spider-mario_ has quit [Ping timeout: 256 seconds]
zachrab has quit [Remote host closed the connection]
spider-mario has joined #ruby
zachrab has joined #ruby
__adam has quit [Remote host closed the connection]
adriancb has joined #ruby
karmatr0n has quit [Ping timeout: 246 seconds]
pandaant has quit [Remote host closed the connection]
tvw has quit []
tvw has joined #ruby
zachrab has quit [Ping timeout: 252 seconds]
techietrash has joined #ruby
cpt_yossarian has joined #ruby
zachrab has joined #ruby
it0a has quit [Ping timeout: 246 seconds]
thumpba has quit [Ping timeout: 250 seconds]
graydot has quit [Remote host closed the connection]
MatthewsFace has quit [Remote host closed the connection]
iteratorP has joined #ruby
unreal has quit [Ping timeout: 246 seconds]
Sawbones has quit [Remote host closed the connection]
granitosaurus has quit [Ping timeout: 256 seconds]
Sawbones has joined #ruby
n80 has quit [Ping timeout: 246 seconds]
RegulationD has joined #ruby
binfalse has joined #ruby
zachrab has quit [Read error: Connection reset by peer]
plashchynski has joined #ruby
zachrab has joined #ruby
hmsimha has joined #ruby
yh has joined #ruby
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
spider-mario has quit [Ping timeout: 250 seconds]
Hijiri has quit [Quit: WeeChat 1.0.1]
jonr22 has quit [Remote host closed the connection]
Lactobacillus has left #ruby [#ruby]
commmmodo has quit [Read error: Connection reset by peer]
commmmodo has joined #ruby
bklane has joined #ruby
mistermocha has joined #ruby
maletor has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zacts has joined #ruby
__adam_ has joined #ruby
deric_skibotn has quit [Ping timeout: 264 seconds]
cphrmky has quit [Read error: Connection reset by peer]
plashchynski has quit [Quit: plashchynski]
plashchynski has joined #ruby
justin_pdx has joined #ruby
bradleyprice has joined #ruby
bklane has quit []
jenrzzz has quit [Ping timeout: 264 seconds]
cpt_yossarian has quit [Ping timeout: 245 seconds]
__adam_ has quit [Remote host closed the connection]
freerobby has quit [Quit: Leaving.]
Hobogrammer has joined #ruby
Hijiri has joined #ruby
mistermo_ has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
martin_work has joined #ruby
pietr0 has quit [Quit: pietr0]
marr has quit [Ping timeout: 252 seconds]
tag has quit [Remote host closed the connection]
dc_ has quit [Remote host closed the connection]
Sawbones has quit [Remote host closed the connection]
towski_ has quit [Remote host closed the connection]
unreal has joined #ruby
adriancb has quit [Read error: Connection reset by peer]
dorei has quit []
adriancb has joined #ruby
Dolphi has joined #ruby
<a5i>
Are there any browsers written in Ruby?
jshultz has quit [Quit: Connection closed for inactivity]
justin_pdx has quit [Quit: justin_pdx]
jonr22 has joined #ruby
<wallerdev>
actual browsers?
TheNet has quit [Quit: Leaving...]
<wallerdev>
or browser interfaces
<wallerdev>
like just the rendering engine alone is complicated that there arent many written
<a5i>
actual browsers
doodlehaus has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 245 seconds]
zacts has quit [Quit: leaving]
AlphaTech|AWAY is now known as AlphaTech
MatthewsFace has joined #ruby
dstarh has joined #ruby
nii236 has quit [Ping timeout: 246 seconds]
allcentury has quit [Ping timeout: 265 seconds]
spider-mario has joined #ruby
freerobby has joined #ruby
cpt_yossarian has joined #ruby
jottr has joined #ruby
<a5i>
there is none?
TheRinger has joined #ruby
zacts has joined #ruby
robustus has quit [Ping timeout: 264 seconds]
Takle has joined #ruby
zachrab has quit [Remote host closed the connection]
zachrab has joined #ruby
mistermocha has joined #ruby
mistermo_ has quit [Read error: Connection reset by peer]
gregf has quit [Quit: WeeChat 1.1.1]
robustus has joined #ruby
DavidDudson has joined #ruby
plashchynski has quit [Quit: plashchynski]
erts has quit []
gphummer has quit [Quit: gphummer]
jespada has joined #ruby
Takle has quit [Ping timeout: 264 seconds]
gphummer has joined #ruby
gphummer has quit [Client Quit]
nii236 has joined #ruby
VBlizzard has joined #ruby
VBlizzard has quit [Max SendQ exceeded]
zachrab has quit [Ping timeout: 252 seconds]
plashchynski has joined #ruby
juanpaucar has joined #ruby
_blizzy_ has quit [Ping timeout: 255 seconds]
techietrash has quit [Quit: Bye! <(^_^<)]
dfinninger has joined #ruby
jespada has quit [Ping timeout: 252 seconds]
Rephiax_ has joined #ruby
reinaldob has quit [Remote host closed the connection]
havenwood has joined #ruby
DavidDud_ has joined #ruby
juanpaucar has quit [Ping timeout: 250 seconds]
DavidDud_ has quit [Client Quit]
spider-mario has quit [Ping timeout: 252 seconds]
justin_pdx has joined #ruby
mistermo_ has joined #ruby
jin_ has joined #ruby
JoshGlzBrk has joined #ruby
Rephiax has quit [Ping timeout: 240 seconds]
juanpablo_ has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
<mwlang>
I can’t quite get the reg-exp to extract “just this” from the following string: “"CN=just this,OU=Users,DC=US,DC=TEST,DC=com" Basically, I want everything between “CN=“ and first comma that occurs. Here’s my attempt: str.scan(/^CN\=(.*)\,/) => [[“just this,OU=Users,DC=US,DC=TEST,DC=com”]]
jin_ has quit [Read error: Connection reset by peer]
DavidDudson has quit [Ping timeout: 255 seconds]
spider-mario has joined #ruby
DavidDudson has joined #ruby
jenrzzz has joined #ruby
<jefus>
mwlang: look into greedy matching in regex
<jefus>
i'm not an expert so this is just a trip, try something like /^CN=[^,]+/
<jefus>
just a tip*
<jefus>
/^CN=([^,]+)/ rather
wallerdev has quit [Quit: wallerdev]
<mwlang>
jefus: thanks…that got it.
<jefus>
(.*) by itself will eat too much
<mwlang>
as well as cn = Regexp.new(/^CN\=([^\,]*)/)
juanpablo_ has quit [Ping timeout: 246 seconds]
<jefus>
thus is greedy
<jefus>
cool, np
dfinninger has quit [Remote host closed the connection]
<mwlang>
yours is probably more correct
<mwlang>
since there will always be at least one alphanumeric before that comma.
bruno- has quit [Ping timeout: 250 seconds]
<jefus>
right, in that case probably pretty much the same thing
vozcelik has joined #ruby
Joufflu has joined #ruby
Dolphi has quit [Quit: Leaving]
millerti has quit [Ping timeout: 244 seconds]
jlast has joined #ruby
martin_work has quit [Ping timeout: 255 seconds]
plashchynski has quit [Quit: plashchynski]
iamjarvo has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
DavidDudson has quit [Read error: Connection reset by peer]
dfinninger has joined #ruby
rcs has quit [Ping timeout: 264 seconds]
DavidDudson has joined #ruby
sivsushruth has quit [Ping timeout: 256 seconds]
kaiZen has quit [Quit: Computer has gone to sleep.]
mistermo_ has quit [Read error: Connection reset by peer]
rrrutr has quit [Ping timeout: 264 seconds]
mistermocha has joined #ruby
adriancb_ has joined #ruby
vozcelik has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
adriancb has quit [Read error: Connection reset by peer]
adriancb_ has quit [Remote host closed the connection]
<shevy>
I need to compile a list of pictures of apeiros_ going 'WTF?'
jenrzzz has joined #ruby
<shevy>
like a facial expression study :D
<shevy>
we should do that globally too
<shevy>
all wtf-like moments
<vandemar>
well, that should probably be Inf, but at least that's understandable. (1.0...5.0).to_a doesn't work, because floats aren't enumerable. character set ranges, however, are.
martianixor has quit [Quit: Leaving]
bw_ has quit [Remote host closed the connection]
<certainty>
xD
jespada has joined #ruby
commmmodo has joined #ruby
govg has quit [Quit: leaving]
workmad3 has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
sillylogger has joined #ruby
jespada has quit [Ping timeout: 272 seconds]
<apeiros_>
vandemar: character sets aren't the way you think they are
<vandemar>
apeiros_: I understand there are all sorts of complications with character sets, but if ("\u2600"..."\u26c3").to_a works, why wouldn't .size on that range give some positive number, at least?
yh has joined #ruby
Renich has quit [Quit: leaving]
<apeiros_>
vandemar: because it wouldn't work for all
tmi_ is now known as tmi
<apeiros_>
so with (String..String).size you'd sometimes get nil, sometimes get an integer
sigurding has joined #ruby
<apeiros_>
I'd assume they decided against that and just return nil always
josephcs has quit [Quit: (null)]
craigp_ has quit [Remote host closed the connection]
yeticry has quit [Ping timeout: 264 seconds]
Mia has joined #ruby
livathinos has quit []
Mia has quit [Changing host]
Mia has joined #ruby
arup_r has joined #ruby
<vandemar>
so why didn't they return [] always from (String..String).to_a ? It's just inconsistent.
yeticry has joined #ruby
juanpablo_ has joined #ruby
livathinos has joined #ruby
tkuchiki has quit [Ping timeout: 246 seconds]
_Andres has joined #ruby
livathin_ has joined #ruby
paradoja has joined #ruby
hanmac1 has joined #ruby
juanpablo_ has quit [Ping timeout: 256 seconds]
iterator_ has joined #ruby
<shevy>
hmm no, that is an empty array
<shevy>
I don't think (String..String).to_a can == equal []
<vandemar>
*headdesk*. Yeah, not touching string ranges after seeing *that*
livathinos has quit [Ping timeout: 244 seconds]
iteratorP has quit [Ping timeout: 245 seconds]
davidhq has joined #ruby
<shevy>
apoplexy go chat here, not in PRIVMSG please
coderhs has joined #ruby
iterator_ has quit [Ping timeout: 264 seconds]
<vandemar>
but ranges from one character to another... iterator order is wrong ('z'.succ is 'aa'), but as far as I've seen, .to_a always does the right thing for ranges between single characters
<workmad3>
vandemar: string ranges are fun though :)
<workmad3>
vandemar: ^^ that's why "b".."aa" is empty
yh has quit [Ping timeout: 244 seconds]
gfawcettpq has joined #ruby
fgo has joined #ruby
yh has joined #ruby
piotrj has quit [Remote host closed the connection]
leafybasil has joined #ruby
piotrj has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
coderhs has quit [Quit: Leaving]
scripore has joined #ruby
dmolina has joined #ruby
<apoplexy>
shevy: sorry i just didnt want to post the project specs
dmolina has left #ruby [#ruby]
<apoplexy>
can i paste you the link in pm and then you talk to me here? :]
scripore has quit [Client Quit]
marcoecc has joined #ruby
sinkensabe has quit [Read error: Connection reset by peer]
dfinninger has joined #ruby
<apoplexy>
shevy: ;(
yh has quit [Read error: Connection reset by peer]
norc has joined #ruby
ghostpl_ has joined #ruby
jimms has joined #ruby
nicolastarzia has joined #ruby
<shevy>
apoplexy naaaah it needs to be out in the open
craigp has joined #ruby
<shevy>
apoplexy in PRIVMSG, I need to click on the privmsg-tab in xchat, then answer there, then click back to a channel like #ruby
<shevy>
and I have to repeat that every time a new privmsg arrives
<norc>
Hi. I have about 80 network devices that I communicate with. Each session for a device is expected to last up to a minute before completing. What is the cleanest concurrent method to accomplish this?
<apoplexy>
shevy, calm down soldier, i myself use xchat. i meant to paste 1 URL in 1 line in 1 msg to you privately. everything else can be discussed here.
<apoplexy>
it wasnt a back and fourth deal, i dont think its asking much tbh
<shevy>
I am very calm
<DefV>
and lazy, it seems
<DefV>
"OH NO, SO MUCH CLICKING"
<shevy>
DefV volunteers :D
<DefV>
I have irssi, I have to do actual typing to go to a private chat
jlast has joined #ruby
<DefV>
I CAN'T HAVE THAT
marcoecc has quit [Read error: Connection reset by peer]
nicolastarzia has quit [Remote host closed the connection]
dfinninger has quit [Ping timeout: 244 seconds]
strixd_ has joined #ruby
sinkensabe has joined #ruby
<shevy>
I'd so totally private chat with you now DefV
<apoplexy>
so... no deal?
josephcs has joined #ruby
<shevy>
have you finally written in public
jimms has quit [Ping timeout: 252 seconds]
<apoplexy>
??
<DefV>
apoplexy: nobody cares about your project and its specs, just post it in here
martinbmadsen has joined #ruby
<shevy>
ask DefV in a PRIVMSG
jimms has joined #ruby
claptor has quit [Read error: Connection reset by peer]
claptor has joined #ruby
strixd has quit [Ping timeout: 252 seconds]
wottam has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<apoplexy>
its not a big deal, im just a more lowkey kid, i work at a bank and i dont even like saying the highest balance i've ever seen lol
jlast has quit [Ping timeout: 256 seconds]
shadeslayer has quit [Ping timeout: 252 seconds]
jlast has joined #ruby
paradoja has quit [Ping timeout: 245 seconds]
jottr has joined #ruby
oo_ has quit [Remote host closed the connection]
martinbmadsen has quit [Ping timeout: 256 seconds]
shadeslayer has joined #ruby
<apeiros_>
vandemar: good question. I'd agree that String#succ and string ranges are inconsistent. I haven't put much thought into it yet, though.
<apoplexy>
shevy, DefV: input please? :D
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
I am too scared to click on that
<shevy>
why can't you be like a normal person and just type stuff here :(
<apoplexy>
dude its a fucking conversation, wow
<shevy>
I let the good people of #ruby know about everything
<shevy>
between who
<shevy>
you and ?
<apoplexy>
me and a dude on another network
<apeiros_>
apoplexy: the point about "no private chat" is usually: private chat == consulting, and personally I'd ask money for that ;-)
<shevy>
greet that dude from me!
<apoplexy>
you're one of those freenode users eh shevy. i see, all good.
<shevy>
hey I can be in any network
<shevy>
I used to be a heavy Galaxynet dude back in my mIRC days
<shevy>
lots of Singaporeans out there - you even had to learn singlish to understand their Kauderwelsch english
<apeiros_>
norc: a thread per device, a select loop, eventmachine. that's the ways that come to my mind.
<shevy>
hmm english for Kauderwelsch is mumbo-jumbo ... that does not sound as awesome :(
zorak8 has quit [Ping timeout: 252 seconds]
jlast has quit [Ping timeout: 265 seconds]
<workmad3>
shevy: I played some games in my youth that were active on quakenet :)
sillylogger has quit [Quit: sillylogger]
jottr has quit [Ping timeout: 250 seconds]
<shevy>
never been on quakenet
<apoplexy>
you arent welcome there shevy
<shevy>
but I remember yahoo chat or so and having played strange time-wasters
sillylogger has joined #ruby
<shevy>
apoplexy I am not even welcome here!
<apoplexy>
then pretend you have social skills and be more normal
<norc>
apoplexy: Yeah the "thread per device" approach didnt really settle nicely on my mind. Didnt seem that clean (even though technically threads are a solution to IO bound problems here)
<apeiros_>
norc: thread per device can be very nice. but it depends a lot on your specifics.
<apoplexy>
wat
postmodern has quit [Quit: Leaving]
scripore has quit [Quit: This computer has gone to sleep]
<apeiros_>
apoplexy: norc meant me.
<norc>
Oh yeah my apologies.
<apoplexy>
yeah but he said me... so
<apoplexy>
it cant really be undone
<norc>
It can actually. I just need to wipe your chat log.
<workmad3>
norc: and the public chat log
jonr22 has joined #ruby
<apoplexy>
it cannot be undone
<apoplexy>
so...
OrbitalKitten has joined #ruby
<workmad3>
norc: or invent a time machine, go back in time and stop your younger self from making the mistake
<workmad3>
(that's probably easier than changing the chatlogs)
Mon_Ouie has quit [Ping timeout: 244 seconds]
bw_ has joined #ruby
Mon_Ouie has joined #ruby
<norc>
workmad3: Come to think of it, a time machine would also brilliantly solve my concurrency problem.
mrdtt has joined #ruby
selu has joined #ruby
<workmad3>
norc: yeah, time machines are great for concurrency
<norc>
apeiros_: What would be reasons to pick threads over EventMachine? I mean specifically I have these 80 devices (but they will get more in the future), and I need to initiate a session with each, and communicate with them, obtain data, etc.
OrbitalKitten has quit [Ping timeout: 250 seconds]
<apeiros_>
norc: also 80 threads are nothing
jonr22 has quit [Ping timeout: 256 seconds]
juanpaucar has joined #ruby
<apeiros_>
I'd probably go with select loop before eventmachine. but that may also just be personal bias.
blackmesa has joined #ruby
sivsushruth has joined #ruby
* apeiros_
afk
<apeiros_>
lunch time
davidhq has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
einarj has quit []
roolo has quit [Remote host closed the connection]
catphish has joined #ruby
Timba-as has joined #ruby
<catphish>
can anyone explain the best way to approach the problem that SSLSocket buffers data, and therefore attempting to call Select on such a socket shows that there is no data to be read, even though there is buffered data to read?
CpuID has quit [Ping timeout: 245 seconds]
<jhass>
I thought select special cases SSLSocket?
<jhass>
"It is not happen for IO-like objects such as OpenSSL::SSL::SSLSocket." mmh, that could mean "don't use it there" I guess
juanpaucar has quit [Ping timeout: 245 seconds]
<catphish>
i just read the manual for select and it says the best way to use it is immediately after a read_nonblock on all concerned sockets, i think that will solve the problem
doodlehaus has joined #ruby
<catphish>
but makes my read loop messy
rsavage has joined #ruby
<catphish>
jhass: it appears not to, at least in my application, select definitely doesn't return
<catphish>
(when there's buffered data)
gccostabr has joined #ruby
<jhass>
you can select on the underlying socket, you just need to handle the SSL layer eating the new data, that is the received data is TLS traffic only
<catphish>
it seem that select on the sslsocket actually just calls select on the underlying socket
<catphish>
but obviously data has already bee consumed into the buffer, so it never returns
oivoodoo has quit [Remote host closed the connection]
dfinninger has quit [Ping timeout: 256 seconds]
bMalum has quit [Quit: bMalum]
Takle has quit [Remote host closed the connection]
<catphish>
arup_r: in case your mistake isn't clear, if you start a string with ", then it will finish the first time it sees ", unless it's escaped like this: \"
sigurding has quit [Quit: sigurding]
<catphish>
arup_r: you could also probably write it like this if you wanted the double quotes:
<jhass>
looks like // doesn't work with a document fragment
Tomasso has joined #ruby
<jhass>
I guess because it wants to go back to the root node and there's none in a fragment
<Tomasso>
do you know how to call a block recursively from within the same block (without any function name ) ?
<jhass>
yeah .// works
<jhass>
Tomasso: not possible afaik
<Tomasso>
mm thanks :'*
<arup_r>
let me see
<arup_r>
jhass: no failing
nii236 has quit [Ping timeout: 250 seconds]
<jhass>
arup_r: yeah, there's more in your xpath that doesn't work
bim has joined #ruby
<arup_r>
what's that ?
Azure has joined #ruby
<jhass>
.//strong[text()="I'm strong"] works
paradoja has joined #ruby
Mon_Ouie has quit [Ping timeout: 250 seconds]
<arup_r>
then following-sibling::p/text() is valid also..
<arup_r>
why then not working
cpt_yossarian has quit [Ping timeout: 250 seconds]
fabrice31 has joined #ruby
vt102 has joined #ruby
ypasmk has quit [Quit: ypasmk]
Mon_Ouie has joined #ruby
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby
<arup_r>
jhass: any idea why not?
amundj has quit [Ping timeout: 256 seconds]
krz has quit [Quit: WeeChat 1.0.1]
<jhass>
do you?
<arup_r>
no,, why the ".//strong[text()=\"I'm strong\"]/following-sibling::p/text()" doesn't work
<catphish>
so, can anyone recommend a method by which i might be able to fork and exec a new copy of my application (in order to update to a new version) but pass a listening tcp socket to create zero downtime
DouweM has quit [Read error: Connection reset by peer]
<apeiros_>
catphish: not sure whether fd's can be passed around. but fd's have a number.
<apeiros_>
see IO.for_fd
amundj has joined #ruby
<workmad3>
catphish: maybe look up how puma does similar during its phased restart
<catphish>
apeiros_: they do have a number, but that's per process unfortunately, i know forking keeps sockets open, and i also know there's a way to pass sockets through a unix socket, but i dont know the details
nii236 has joined #ruby
<jhass>
there's also systemd socket activation to look at, though I guess there systemd holds a reference to the socket
<jhass>
so it's not auto-closed
<catphish>
new versions of linux actually allow multiple processes to listen on the same socket, but i dont think that's the right approach
<workmad3>
catphish: multiple listeners on the same socket sounds like a reasonable approach to me... bring up a new process listening to the same socket, signal the existing process(es) that they are to stop accepting connections and close down once they've finished all requests
<catphish>
yeah, that could work, but it relies on some very new kernel features,
claptor has quit [Quit: this channel is bakas]
<catphish>
another option is to fork (leaving the listening FD open), exec the new process, which then just attaches to the already open listener
oo_ has joined #ruby
<workmad3>
catphish: what happens to connections to the original process then though?
<workmad3>
catphish: as in, already established ones
<catphish>
workmad3: both processes share all connections, its up to each of the 2 forks to close the ones they aren't going to use
<catphish>
so the old fork would close the "listening" socket, and the new fork would close any sockets to active clients
<catphish>
then the old fork could finish up with existing clients before exiting, and the new fork could handle new clients
<workmad3>
catphish: ah yeah, that could work... sorry, got a bit messed up in my head about what exec would do with a fork :)
<catphish>
thats a pretty cool solution if i can make it tidy, the tricky part is closing all the old client sockets in the new fork
<jhass>
arup_r: your actual problem is that <p> is only allowed to have inline elements, <p> itself is a block element though, so nesting <p> into <P> is invalid
<jhass>
arup_r: thus the parsed document is not what you think it is, call to_s on the doc to look at it
juanpablo_ has quit [Ping timeout: 264 seconds]
<catphish>
exec starts a new process, replacing the old one (in the new fork), but keeps files open
jww42 has joined #ruby
<workmad3>
catphish: yeah, I know that... for some reason, my mind decided that doing the exec would replace the original process, not the forked one because it's being dumb today :)
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<catphish>
:)
<workmad3>
catphish: that sounds somewhat like how puma does things, btw
<catphish>
the other option is the unix socket thing: you start a new, totally unrelated process clean, but tell it to listen on a unix socket, then you hand it the tcp listener over the unix socket
<jhass>
arup_r: note libxml2 (which nokogiri is a binding for) only supports xpath 1.0
pontiki has joined #ruby
<arup_r>
yes..
govg has joined #ruby
<workmad3>
arup_r: btw, <span> exists for this sort of reason
<arup_r>
I didn't use any xpath 2.0 functions
<catphish>
unfortunately my web server listens on several tcp sockets, so i'd better get to work :)
<jhass>
just saying because you use a xpath 2 test tool
pontiki has quit [Client Quit]
jww42 has quit [Ping timeout: 255 seconds]
aclearman037 has quit [Client Quit]
jottr has joined #ruby
Dude007 has quit []
RegulationD has joined #ruby
govg has quit [Client Quit]
<arup_r>
jhass: got your point
oki has quit [Read error: Connection reset by peer]
oki has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
mostlybadfly has joined #ruby
jerematic has joined #ruby
piotrj has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 244 seconds]
piotrj has joined #ruby
lolmaus has quit [Read error: Connection reset by peer]
lolmaus has joined #ruby
aclearman037 has joined #ruby
<arup_r>
jhass: teaching myself JS.. Its way different than Ruby... :(
<gr33n7007h>
right, can somebody help me out here I created a RemoteGem class and RemoteBot class, RemoteGem class works on the top level but not inside RemoteBot class https://gist.github.com/anonymous/b49ad52afe645e44926f
lanemeyer has joined #ruby
lumidragon has joined #ruby
<jhass>
"does not work"
<catphish>
it's unclear to me why that would fail to work
<jhass>
that's because we didn't get any kind of problem description
<gr33n7007h>
1 sec
<catphish>
my assumption was that the class wasn't being found
<catphish>
but maybe the problem is actually much more mundane
bjornar has quit [Read error: Connection reset by peer]
<catphish>
try stripping the string
govg has joined #ruby
<jhass>
yeah, looks like trailing newline
<catphish>
ignoring any kind of error handling: gem = RemoteGemFetcher.search(match[1].strip)
<catphish>
or fix your regex
brb3 has joined #ruby
<gr33n7007h>
catphish: let me do that 1 sec
iamjarvo has joined #ruby
<jhass>
or use an IRC framework like cinch that handles all the quirks for you already
mengu has joined #ruby
jottr has joined #ruby
<gr33n7007h>
wtf strip that's all it was :) been looking at this for an hour :)
<gr33n7007h>
thanks catphish jhass
<catphish>
gr33n7007h: learn to think around what the error is telling you
<catphish>
gr33n7007h: it was saying the URL was invalid, so at that point you should have run "inspect" on the URL to see what was in it, and you'd have seen the newline
<gr33n7007h>
catphish: for sure I don't know whats wrong with me today :(
<catphish>
good luck :)
<gr33n7007h>
cheers 8)
jlast has joined #ruby
multiscan has joined #ruby
sinkensabe has quit [Read error: Connection reset by peer]
jonr22 has joined #ruby
sinkensabe has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
jlast has quit [Ping timeout: 265 seconds]
ponga has quit [Quit: Leaving...]
jlast has joined #ruby
dropp has joined #ruby
adriancb has joined #ruby
plashchynski has joined #ruby
B1n4r10 has joined #ruby
digitalextremist has quit [Ping timeout: 255 seconds]
lxsameer has quit [Remote host closed the connection]
sdothum has joined #ruby
multiscan has quit [Remote host closed the connection]
multiscan has joined #ruby
ponga has joined #ruby
LBRapid has joined #ruby
jonr22 has quit [Ping timeout: 265 seconds]
_Andres has joined #ruby
juanpaucar has joined #ruby
codecop has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: ciao.]
livathin_ has joined #ruby
Takle has quit [Remote host closed the connection]
jlast has quit [Ping timeout: 256 seconds]
Timba-as has quit [Quit: Be back later ...]
adriancb has quit [Read error: Connection reset by peer]
Timba-as has joined #ruby
jww42 has joined #ruby
roshanavand1 has quit [Ping timeout: 256 seconds]
juanpaucar has quit [Ping timeout: 252 seconds]
roshanavand has joined #ruby
livathinos has quit [Ping timeout: 240 seconds]
dstarh has joined #ruby
Abhijit has joined #ruby
oki has quit [Read error: Connection reset by peer]
oki has joined #ruby
adriancb has joined #ruby
<shevy>
gr33n7007h you are drunk
adriancb has quit [Remote host closed the connection]
techsethi_ has joined #ruby
andikr has quit [Remote host closed the connection]
plashchynski has quit [Quit: plashchynski]
joonty has quit [Quit: joonty]
sigurding has joined #ruby
paradoja has quit [Ping timeout: 252 seconds]
zachrab has joined #ruby
aspiers has joined #ruby
oki has quit [Read error: Connection reset by peer]
ypasmk has joined #ruby
oki has joined #ruby
nateberkopec has quit [Quit: Leaving...]
<gr33n7007h>
shevy: nope, not yet! :)
<shevy>
now there is your problem!
nii236 has joined #ruby
lektrik has joined #ruby
<gr33n7007h>
haha
<shevy>
I actually don't take alcohol well, I get immensely tired very quickly from it
<gr33n7007h>
not much of a drinker then shevy
ypasmk has quit [Client Quit]
<shevy>
yeah
oo_ has quit [Remote host closed the connection]
<gr33n7007h>
sorts your little henries out :p
<gr33n7007h>
little henries == grey matter cells
zachrab has quit [Ping timeout: 246 seconds]
scott1 has joined #ruby
mbuf has quit [Quit: Leaving]
scripore has joined #ruby
<gr33n7007h>
>>> does drinking alcohol make you a better ruby programmer?
adriancb has quit [Remote host closed the connection]
Cust0sLim3n has joined #ruby
adriancb has joined #ruby
multiscan has quit [Ping timeout: 265 seconds]
plashchynski has quit [Quit: plashchynski]
bim has joined #ruby
juanpaucar has joined #ruby
juanpaucar has quit [Read error: Connection reset by peer]
waxjar has quit [Ping timeout: 240 seconds]
adriancb has quit [Read error: Connection reset by peer]
freerobby has quit [Quit: Leaving.]
juanpaucar has joined #ruby
adriancb has joined #ruby
Mives has joined #ruby
werelivinginthef has joined #ruby
plashchynski has joined #ruby
techsethi_ has joined #ruby
coderhs has joined #ruby
scripore has joined #ruby
iamjarvo has joined #ruby
rbennacer has joined #ruby
multisca_ has quit [Read error: Connection reset by peer]
multiscan has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
iamjarvo has joined #ruby
fantazo has quit [Quit: Verlassend]
multiscan has quit [Read error: Connection reset by peer]
bim has quit [Remote host closed the connection]
multiscan has joined #ruby
bim has joined #ruby
Altonymous has joined #ruby
RegulationD has joined #ruby
decoponio has joined #ruby
<Altonymous>
I’m running a COPY FROM STDIN command in my ruby application to import data into the PG database. This is causing the CPU to peg at 100% constantly. Does anyone know how I might better handle this case?
elfuego has joined #ruby
antgel has joined #ruby
plashchynski has quit [Quit: plashchynski]
iamjarvo has quit [Client Quit]
apeiros has quit [Ping timeout: 252 seconds]
lkba has joined #ruby
phutchins has joined #ruby
sevenseacat has quit [Remote host closed the connection]
<apeiros_>
Altonymous: insufficient information
<Altonymous>
What other information do you need?
<Fluent>
How about source code
<apeiros_>
^
RegulationD has quit [Ping timeout: 252 seconds]
top4o has quit [Quit: ChatZilla 0.9.91.1 [Firefox 36.0.1/20150305021524]]
<apeiros_>
Altonymous: also, how do you figure it's the COPY FROM STDIN part?
Mon_Ouie has quit [Ping timeout: 240 seconds]
duggiefresh has joined #ruby
iamjarvo has joined #ruby
gccostabr has joined #ruby
<Altonymous>
I have it traced with NewRelic, AppSignal, and logging. I use the pg gem and simply do “COPY widget.import_table FROM STDIN WITH (FORMAT 'csv’);” with conn.put_copy_data(data) command, it calls that command repeatedly until no records are left then calls conn.put_copy_end
iamjarvo has quit [Max SendQ exceeded]
<apeiros_>
*sob*
<apeiros_>
Altonymous: and you have no loop? you read all data at once into data?
<elfuego>
i’m setting my cookie object in a sinatra app using cookies[‘cookiename’], but i’m trying to access it via last_response.cookies, and i’m getting this error in the test undefined method `cookies' for #<Rack::MockResponse:0xaf44011>
<Altonymous>
aperos_: No it looks on the put_copy_data(data) command a record at a time
<Altonymous>
I’m trying to find you the source code right now
sambao21 has joined #ruby
iamjarvo has joined #ruby
<apeiros_>
Altonymous: hint: use tab completion for the nick name
iamjarvo has quit [Max SendQ exceeded]
<Fluent>
telnet doesn't support tab completion j/k
last_staff has quit [Quit: last_staff]
iamjarvo has joined #ruby
<Fluent>
Well not joking, but I'll stop trollin
boshhead has joined #ruby
<apeiros_>
Fluent: just because you're using a sucky telnet client :-p
<apeiros_>
Altonymous: copy_data.read( 256, buf ) # <- that's a *very* small chunk size
<apeiros_>
increase it
<apeiros_>
and it'll go more towards an IO bound problem
<apeiros_>
question remains whether you're sure it's the ruby process and not pg which peaks the CPU
rocknrollmarc has joined #ruby
DouweM has joined #ruby
<apeiros_>
and I don't get why you do a sleep 0.1 there
<Altonymous>
It’s not using the buffer stuff it’s actually reading line by line. That’s the code I started with and modified to do it record by record
<Altonymous>
That’s the sample from the pg gem
<Altonymous>
I changed the while copy_data.read( 256, buf ) to file.each_line do |line|
lkba has quit [Ping timeout: 252 seconds]
jottr has joined #ruby
<apeiros_>
Altonymous: lines are still a small chunk size
<apeiros_>
unless you've huge records…
mitchellhenke has joined #ruby
<Altonymous>
i checked and the sleep 0.1 isn’t ever getting hit.. that’s just for when the connection gets blocked
iamjarvo has quit [Client Quit]
<Altonymous>
apeiros_: about 30 columns per record.
phreakocious has quit [Ping timeout: 246 seconds]
<Altonymous>
varying size and data types
tagrudev has quit [Quit: Me = Awesome]
<apeiros_>
that's not the relevant measurement. anyway, it'll probably be far below 1KB on average.
tagrudev has joined #ruby
iamjarvo has joined #ruby
phreakocious has joined #ruby
it0a has joined #ruby
multi_io_ is now known as multi_io
bim has joined #ruby
jottr has quit [Ping timeout: 265 seconds]
iamjarvo_ has joined #ruby
zenith_ has quit [Read error: Connection reset by peer]
zenith__ has joined #ruby
davedev24_ has quit [Read error: Connection reset by peer]
iamjarvo has quit [Ping timeout: 255 seconds]
jerematic has quit [Remote host closed the connection]
davedev24_ has joined #ruby
multisca_ has joined #ruby
jottr has joined #ruby
plashchynski has joined #ruby
davedev24_ has quit [Read error: Connection reset by peer]
Olipro has quit [Ping timeout: 252 seconds]
Olipro_ is now known as Olipro
iamjarvo has joined #ruby
davedev24_ has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
rbennacer has quit [Remote host closed the connection]
iamjarvo has joined #ruby
iamjarvo_ has quit [Ping timeout: 252 seconds]
multiscan has quit [Ping timeout: 245 seconds]
drewvanstone has joined #ruby
oivoodoo has joined #ruby
drewvanstone has quit [Client Quit]
jonr22 has joined #ruby
drewvanstone has joined #ruby
B1n4r10 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
scripore has quit [Quit: Leaving]
Timba-as has quit [Read error: Connection reset by peer]
multisca_ has quit [Ping timeout: 256 seconds]
<drewvanstone>
Any recommendations of static code analysis tools? Currently using SonarQube, but it's quite slow. Have about 100 commits a day (each running through the CI pipeline), on about 15 projects, and SonarQube isn't scaling well
Soda has joined #ruby
KnowledgeOwl has quit [Remote host closed the connection]
<shevy>
certainty, I think I will just parse big case menus differently
<shevy>
though perhaps there are more keys, then I may add a new line
<shevy>
and I use the indent as clue :\ :/
Deele has quit [Ping timeout: 256 seconds]
oo_ has joined #ruby
<shevy>
the ruby variant is longer, logically, even if we exclude case - there is still a mandatory when entry, and strings must have '' or "" http://pastie.org/10016282
freerobby has joined #ruby
vozcelik has joined #ruby
<shevy>
obviously the ruby variant is more powerful because we can discern whether something is a string, or a method invocation
zenith__ has quit [Remote host closed the connection]
<apeiros_>
unshadow: I hope SafeTRest.new can take the config as a hash too? otherwise it becomes quite cumbersome to configure it e.g. from a yaml file.
Mives has quit [Remote host closed the connection]
<jhass>
is the value for BusinessLogic supposed to be json? if so I'd build a ruby hash and to_json it
<apeiros_>
I'd expect a method like file_upload/file_download to do the encoding stuff for me
rocknrollmarc has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<jhass>
docs would be nice describing which params each method takes
drewvanstone has quit [Quit: Lost terminal]
<apeiros_>
the file reading too actually
<apeiros_>
otherwise, don't call it file upload. call it base64_data_upload or whatever.
<jhass>
all your methods are basically the same, you should be able to extract the majority of the redundancy to a private method
<apeiros_>
why are all numeric values passed as strings?
<unshadow>
Wow... ok :) just a sec I'll answer one at a time, Thanks for the feedback
zachrab has quit [Ping timeout: 244 seconds]
GnuYawk has quit [Ping timeout: 255 seconds]
rocknrollmarc has quit [Remote host closed the connection]
blackmesa has quit [Quit: WeeChat 1.1.1]
rbennacer has joined #ruby
<unshadow>
shevy, I can do a block thingy instead of the attr_accesor, or to add a .new() to allow for the args to be set as a passed hash
sambao21_ has joined #ruby
perrier has quit [Remote host closed the connection]
sambao21 has quit [Read error: Connection reset by peer]
sambao21_ is now known as sambao21
perrier has joined #ruby
rocknrollmarc has joined #ruby
dys has joined #ruby
<shevy>
hmm
<shevy>
a {} to .new will be passed to initialize() ?
<apeiros_>
shevy: all arguments are
defrang has joined #ruby
<unshadow>
apeiros, Is that right ? it looks wierd to do a require safe/t/rest or a safe-t/rest .... but if thats the nameing conventions.. ill follow
<HOrangeJewce>
all the arguments!
<apeiros_>
unless you redefine new, of course
rocknrollmarc has quit [Read error: Connection reset by peer]
<apeiros_>
unshadow: consult guides.rubygems.org if you don't believe me.
livathin_ has joined #ruby
<apeiros_>
unshadow: you can do either, change your require or change your name. with SafeTRest, it'd be safe_t_rest
User458764 has joined #ruby
<unshadow>
apeiros_, sorry, I didnt say I dont belive you :) I'll check it out and fix it
<apeiros_>
since the company name seems to be SafeT, I'd say safe_t-rest would make sense, with require 'safe-t/rest' and SafeT::Rest
<unshadow>
thats sound better (looks better I mean)
Channel6 has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
livathinos has quit [Ping timeout: 250 seconds]
DaniG2k has joined #ruby
<unshadow>
apeiros_, about the encoding done at the lib, I wanted to give the user a better control over how interface with the methods, but I guess something like basic encoding is ok
silkfox has quit [Ping timeout: 265 seconds]
kaiZen- has quit [Ping timeout: 252 seconds]
<unshadow>
jhass, I'll get rid of the () around the attr_accesor
RegulationD has joined #ruby
karmatr0n has joined #ruby
livathin_ has quit [Remote host closed the connection]
plashchynski_ has quit [Read error: Connection reset by peer]
<jhass>
havenwood: n*m instead of n+m though
sigurding has joined #ruby
<havenwood>
jhass: doesn't have to sort as many chars though. guess it depends.
civim has left #ruby [#ruby]
civim has joined #ruby
<jhass>
it does not?
Xiti has quit [Quit: Xiti]
sambao21 has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
just counts the three, no need to count `text` chars not in `string`
bim has quit [Remote host closed the connection]
<havenwood>
just from the example
<jhass>
oh, that's what you mean
tvw has joined #ruby
<havenwood>
yeah, just that
_maes_ has joined #ruby
bim has joined #ruby
bim has quit [Remote host closed the connection]
Channel6 has quit [Quit: Leaving]
vtunka has joined #ruby
tkuchiki_ has quit [Remote host closed the connection]
<jhass>
well, it still has to (in the worst case) run through text each time though
vtunka has quit [Remote host closed the connection]
rippa has joined #ruby
tvon has quit [Quit: leaving]
civim has left #ruby [#ruby]
<jhass>
and that's what significant here, counting all the other letters is constant time, potentially higher constant time in the small example, granted
chinmay_dd has joined #ruby
civim has joined #ruby
civim has left #ruby [#ruby]
jenrzzz has joined #ruby
<makerop>
if I setup a variable in my spec_helper, can I use that in a context block within a test?
<makerop>
it seems that I can puts @data (the var) outside the context block, but it's nill with in a describe
<makerop>
how can I share that?
Azure has joined #ruby
<jhass>
makerop: sounds like a constant
sambao21 has quit [Client Quit]
<makerop>
touche
mengu has quit [Remote host closed the connection]
multiscan has joined #ruby
<jhass>
and you won't have trouble accessing that
<hanmac1>
havenwood: i am still looking for a count_by method ;P
<havenwood>
jhass: seems for the sample at least mine is several times faster. i'd go with that simpler code till a slow case was found.
<havenwood>
hanmac1: mmmm
civim has joined #ruby
roolo_ has joined #ruby
joast has quit [Ping timeout: 250 seconds]
kblake has quit [Ping timeout: 264 seconds]
<jhass>
havenwood: yeah, as said because yours has less constant time overhead in this small case, building the count cache doesn't pay off due to all the Ruby context switches, where as count can stay at C land while iterating over the string
roolo has quit [Ping timeout: 252 seconds]
<havenwood>
faster or bust!
* havenwood
goes in search of coffee...
<jhass>
havenwood: if you make the first parameter significantly bigger than the second, I bet yours looses
mloveless has joined #ruby
<makerop>
is there an easy array matcher in rspec, to match all elements in an array against a regex?
<jhass>
havenwood: or we shall port both to crystal and see which wins :P
Morkel has quit [Quit: Morkel]
Vile` has quit [Ping timeout: 252 seconds]
AlphaTech has joined #ruby
Beliq has joined #ruby
MatthewsFace has quit [Remote host closed the connection]
mengu has joined #ruby
Vile` has joined #ruby
Beliq has quit [Client Quit]
Beliq has joined #ruby
Takle has joined #ruby
zorak8 has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
SegFaultAX has quit [Excess Flood]
<havenwood>
jhass: aye, let's get down to brass tacks - to crystal!
bricker has joined #ruby
SegFaultAX has joined #ruby
<jhass>
meh, with the given data yours is still faster, didn't expect that :P
<jhass>
the allocation hurts too much I guess
<havenwood>
hanmac1: ^ implement #count_by in crystal-lang
<jhass>
yeah, do it!
<hanmac1>
havenwood: i currently do it in MRI
<jhass>
asterite accepts anything :P
joonty has quit [Quit: joonty]
sambao21 has joined #ruby
plashchynski has joined #ruby
<jhass>
hanmac1: with "tabtabtab" instead of "tab" yours is slower :P
<hanmac1>
jhass: so than asterite does accepts asterisk? ("*") ;P
<jhass>
havenwood: ^
<jhass>
sorry
rrrutr has joined #ruby
<jhass>
hanmac1: I guess so :P
joonty has joined #ruby
jmignault has joined #ruby
<Tomasso>
any alternatives to sinatra?
jottr has quit [Ping timeout: 256 seconds]
<jhass>
tons
<havenwood>
Tomasso: Roda is great.
<Tomasso>
something that works in the same way, not based in rack if possible..
<jhass>
Tomasso: did you ask here before about the issue?
iamjarvo has joined #ruby
dfinning_ has joined #ruby
<jhass>
are you sure the problem is in rack and not your appserver?
jimms has quit [Remote host closed the connection]
<havenwood>
That's a nice thing about Rack, just swap out the web server.
<jhass>
well, that's its entire point really
<Tomasso>
yeah.. well my problem actually seems to be the session, that is not able to store a mongo session (needs to be different mongo session for each user)
Beliq has quit [Read error: Connection reset by peer]
centrx has joined #ruby
<jhass>
that sounds like an application design problem to me tbh
pdoherty has joined #ruby
<Tomasso>
the session is from rack, with the cookie session seems to work but the value gets lost from one route call to another
<jhass>
nothing that switching the underlying libraries would solve
cjim___ has joined #ruby
tobago has quit [Remote host closed the connection]
cjim___ has quit [Client Quit]
apeiros_ has quit [Remote host closed the connection]
<jhass>
you need to have a global in process cache and just store an id for that cache in the cookie
nii236 has quit [Ping timeout: 252 seconds]
<jhass>
serializing entire ruby objects into a cookie is a very bad idea
roshanavand1 has quit [Ping timeout: 255 seconds]
<jhass>
especially if those objects hold resources like a socket connection
roshanavand has joined #ruby
KnowledgeOwl has quit [Quit: Saindo]
jlebrech has joined #ruby
RegulationD has quit [Ping timeout: 256 seconds]
<jhass>
and even that approach will break once you use a multi-process design
jimms has joined #ruby
<jhass>
so I have no idea what a mongo session really is, but maybe you can store just an identifier or something and rebuild the object from it
jottr has joined #ruby
kblake has joined #ruby
<jlebrech>
i want a gem that'll let me send to a variable to irb, i kinda did it using redis but is there something like that in the open other than binding.pry?
fgo has quit [Quit: WeeChat 1.1.1]
sambao21 has quit [Quit: Computer has gone to sleep.]
<Tomasso>
i also.. tried marshalling the whole session to a string .. and same thing.. if I did an appart process to get the sessions wouldnt i be replicating same functionality twice
<jhass>
jlebrech: what's your issue with binding.pry?
<GaryOak_>
What's the best way to set a loop interval in ruby, should I just use sleep?
<jhass>
Tomasso: sounds like you want to serialize a Mutex, which just makes no sense at all
rbennacer has quit [Remote host closed the connection]
<Tomasso>
im afraid that if I store only ids the same thing happens,, since I also tried connecting to mongo for each query, and not using the session at all and got the same issue
<jlebrech>
jhass: i'm not looking to pause execution but look back at vars i can play around with
anarang has quit [Quit: Leaving]
<jhass>
one of the reasons why I said serializing objects into a cookie is a really bad idea
<GaryOak_>
havenwood: will the clock time not match exactly or something?
<jlebrech>
jhass: oh i'll try
<Tomasso>
jhass: into cookie yes.. not good but i tried it and at least for the mongo session it worked, but when calling another route contents dissapear
sinkensabe has quit [Remote host closed the connection]
<jhass>
Tomasso: I can only repeat myself, it doesn't work because the approach is flawed
<havenwood>
GaryOak_: One thing is if you say sleep 5 min, then the thing takes ten seconds, you slowly slip forward by those ten seconds each time.
jimms has quit [Ping timeout: 240 seconds]
<GaryOak_>
ohhh ok
nerium has joined #ruby
Beliq has joined #ruby
<jhass>
Tomasso: no framework will change that
kblake has quit [Ping timeout: 265 seconds]
zorak8 has quit [Read error: Connection reset by peer]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fabrice31 has quit [Remote host closed the connection]
Xiti has joined #ruby
zorak8 has joined #ruby
<nerium>
Anyone knows if there is a way to monkey patch Socket.getaddrinfo?
<nerium>
It's currently causing my threads to freeze
hcnewsom has joined #ruby
<Tomasso>
you would implement a separate process to get the sessions concurrently >
jonr22 has joined #ruby
<Tomasso>
everytime you make a query ?
atomiccc has joined #ruby
<jlebrech>
jhass: oh, that's cool
Xiti has quit [Client Quit]
<jhass>
Tomasso: I haven't worked with Mongo yet, I have no idea what a Mongo session is, why you need one, why you need on per user, why you need to keep it across requests and how it's represented, that's however all needed to work out a sane approach
troulouliou_div2 has quit [Remote host closed the connection]
<jlebrech>
jhass: pry stops rendering correctly which is anoying
anarang has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
LiquidIn1ect is now known as LiquidInsect
rbennacer has quit [Remote host closed the connection]
<jhass>
gr33n7007h: I'd start by typing out the hash literals, that Hash[%w[ is just obfuscation to me
vlad_starkov has joined #ruby
<workmad3>
jhass: hmm... 'Mongo session' sounds, to me, like 'Store an HTTP session in mongo rater than a cookie'
<workmad3>
*rather
<centrx>
gr33n7007h, For one thing you could format it logically
<gr33n7007h>
i know it looks ugly doesn't it
<civim>
Any tips for looking at HTML in pry? I'm using awesome print, but printing nested divs would be really great.
jonr22 has quit [Ping timeout: 265 seconds]
<workmad3>
but probably not, now I've read more of the backtrace
lemur has joined #ruby
rbennacer has joined #ruby
jimms has quit [Ping timeout: 252 seconds]
rhllor has joined #ruby
bayed has joined #ruby
Asher has quit [Quit: Leaving.]
<jhass>
gr33n7007h: I just now realized the map call is on the %w and not on the Hash[ result, very confusingly formatted indeed
vlad_starkov has quit [Ping timeout: 246 seconds]
ta has joined #ruby
nerium has quit [Quit: nerium]
mloveless has quit [Ping timeout: 272 seconds]
bal has quit [Quit: bal]
ghostpl_ has quit [Remote host closed the connection]
Xiti has joined #ruby
mloveless has joined #ruby
Beliq has quit [Quit: My computer has gone to sleep. ZZZzzz…]
ghostpl_ has joined #ruby
<gr33n7007h>
jhass: I'm trying to stay within a certain amount of chars in vim
krz has quit [Quit: WeeChat 1.0.1]
maletor has joined #ruby
<jhass>
gr33n7007h: can you replace certain by a number?
<mwlang>
why do I get an array within an array with this: “404-555-1234”.scan(/([0-9]{3})[\s\.\-]?([0-9]{3})[^[0-9]]?([0-9]{4})/) => [["404", "555", "1234"]]
<gr33n7007h>
jhass: 80
tier_ has joined #ruby
<mwlang>
any time I use scan, I find myself tacking on an extra call to #flatten
lemur has quit [Remote host closed the connection]
<centrx>
gr33n7007h, That doesn't prevent you from using indentation
<mwlang>
so I’m wondering if I’m using scan incorrectly.
tus has joined #ruby
iamjarvo has joined #ruby
<gr33n7007h>
centrx: it's how vim formats it
<centrx>
gr33n7007h, no it's not, vim doesn't choose to put newlines in strange places and then not put newlines in proper places
<centrx>
gr33n7007h, Your code is designed to confuse the reader, putting functions on a newline with the same indentation level that are not at the same semantic level
<mwlang>
havenwood: does your example handle different scenarios such as 404-555-1234, 4045551234, (404) 555-1234, etc? I’m trying to always break into 3,3,4 chunks
<mwlang>
I’m not familiar with #captures, so I’ll check that out.
<gr33n7007h>
jhass: that's what i love about ruby, more than one way to do things, which one should I use? I think the latter more readable to me
coderhs has quit [Ping timeout: 256 seconds]
dc_ has quit [Read error: Connection reset by peer]
<jhass>
yeah, it points out that you're building a hash more directly
<gr33n7007h>
yep, decided each_with_object it is :)
dc_ has joined #ruby
<gr33n7007h>
jhass: many thanks
Megtastique has quit []
prasselpikachu has quit [Ping timeout: 264 seconds]
prasselpikachu has joined #ruby
arup_r has quit [Ping timeout: 256 seconds]
MatthewsFace has joined #ruby
MatthewsFace has quit [Remote host closed the connection]
MatthewsFace has joined #ruby
mistermocha has joined #ruby
<mwlang>
havenwood: I like the #match + #captures approach. That worked quite well and seems to be more readable.
mistermocha has quit [Read error: Connection reset by peer]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<survili>
hi, I need to write to a file in certain format(for 3rd party). The format is version(int), name(string), description(string). The format in which strings should be written is: length of string and then the string. I was wondering if there is some way to achieve this string format using .pack method. I couldn't figure out what pattern to pass to pack to achieve this string format. Anyone ?
rbennacer has quit [Remote host closed the connection]
mistermo_ has joined #ruby
<mwlang>
survili: what about simply: puts “#{str.size}#{str}”
<centrx>
Seems like that couldn't be the format if strings can start with numbers
hanmac1 has quit [Quit: Leaving.]
roolo has joined #ruby
<survili>
mwlang: can't do it using pack ?
antgel has quit [Ping timeout: 264 seconds]
bim has joined #ruby
gccostabr has quit [Quit: See you later!]
razieliyo has joined #ruby
razieliyo has joined #ruby
<havenwood>
mwlang: You might also look at named capture groups:
<havenwood>
mwlang: Regexp on the left and local variable auto-assigned ^.
Megtastique has joined #ruby
Megtastique has quit [Max SendQ exceeded]
<survili>
centrx: I'm trying to write everything using pack, read some tutorials and I see that people use pack/unpack to read/write structured data. Take a look at my sample https://gist.github.com/survili/81981400f022057da4ca
<mwlang>
havenwood: nice trick — maybe too confusing. I think I’m settling on this one: "(%s) %s-%s" % phone.match(/(\d{3})[^\d]?(\d{3})[^\d]?(\d{4})/).captures
Megtastique has joined #ruby
<mwlang>
its short and sweet, yet mostly readable.
sambao21 has quit [Quit: Computer has gone to sleep.]
danjordan has joined #ruby
<havenwood>
mwlang: ;)
<survili>
centrx: here I can write my string using int and then the string data using "A#{mystring.size}", but I was wondering maybe pack natively supports such strings format(len and then the data)
DaniG2k has quit [Quit: leaving]
bootstrappm has joined #ruby
<mwlang>
definitely saving all the permutations of matching to my scratchpad, though. good info to have on hand.
decoponyo has joined #ruby
<jhass>
survili: pack/unpack is for structure on the byte level, not on the character level
_hollywood has joined #ruby
mistermo_ has quit [Ping timeout: 245 seconds]
<jhass>
(well, nibble level actually)
sambao21 has joined #ruby
decoponio has quit [Ping timeout: 244 seconds]
<survili>
jhass: so the correct way for me to write it would be: [my_str.size,my_str, my_other_str.size, my_other_str].pack("vA#{my_str.size}vA#{my_other_str.size} ?
red_horned_rihno has quit [Ping timeout: 244 seconds]
<jhass>
unlikely
anarang has quit [Quit: Leaving]
robustus has quit [Ping timeout: 255 seconds]
mistermocha has joined #ruby
<makerop>
is there a good way to test methods that return data hashes?
<makerop>
ie, am i missing something, in that, each method I'll have to test the key/value pairs individually?
juanpaucar has quit []
susmus has joined #ruby
werelivinginthef has joined #ruby
<mwlang>
makerop: what do you have so far?
<jhass>
survili: actually I fail to make any sense out of your description of the format
wldcordeiro has joined #ruby
roshanavand has quit [Remote host closed the connection]
<mwlang>
you could make the hash the subject and then do several “its” checks. as in: its(“[:some_key]”) { should eq “foobar” }
scripore has quit [Quit: This computer has gone to sleep]
<mwlang>
but if you want to just check that every key is present, then: its(“keys”) { should eq [:a, :b, :c] }
<jhass>
survili: if I had to guess, "version(#{version}), description(#{description.size}#{description}) ..."
iamjarvo has quit [Max SendQ exceeded]
<survili>
jhass: for the simplicity let's say that the format is made of 3 fields, version which is a number, and two stings(can be any length). I thought writing it [version, my_str.size,my_str, my_other_str.size, my_other_str].pack("vvA#{my_str.size}vA#{my_other_str.size}. The first v is for version, second is for string length and then there is A with lenght of the string and same for second string
robustus|Off has joined #ruby
robustus|Off is now known as robustus
iamjarvo has joined #ruby
<jhass>
survili: which kind of int? which byte order?
wallerdev has joined #ruby
sigurding has quit [Quit: sigurding]
<jhass>
which kind of int with which byte order for the string lengths?
<jhass>
I think that's the missing part here
mistermocha has quit [Read error: Connection reset by peer]
<jhass>
v probably works too actually, no idea why you started interpolating the sizes as ascii characters then
<gr33n7007h>
.pack('vvAvA')
<makerop>
mwlang, I think ill use an include
ascarter has joined #ruby
<havenwood>
vvAvAvoom
<survili>
jhass: I read that 'v' is 16 bit little endian, regarding <S<AS I will read what it mean, will be glad if you could explain
<gr33n7007h>
lol
strixd_ has quit [Quit: 500]
<mwlang>
makerop: that’s what I generally use as well.
soulcake has joined #ruby
<mwlang>
esp. if some keys are not always present.
<jhass>
survili: S is 16 bit unsigned integer, < is a flag to turn it little endian instead of native endian
wottam has joined #ruby
<jhass>
so looks like same as v actually
ascarter has quit [Max SendQ exceeded]
<makerop>
yeah
gfawcettpq has quit [Ping timeout: 265 seconds]
RegulationD has joined #ruby
ascarter has joined #ruby
<mwlang>
makerop: generally, if I’m testing functionality like this, I’m writing tests against each key anyway to check that expected data’s there…that infers the key is present so a spec to check that certain keys are present isn’t needed — its just extra test code to maintain.
<makerop>
how do you test the data though?
<makerop>
since you don't really knwo what it is?
red_horned_rihno has joined #ruby
plashchynski has joined #ruby
<makerop>
ie, in this example, I'd need to testing interface_name, which can be like...anything
thumpba_ has joined #ruby
civim has joined #ruby
<mwlang>
makerop: in your test setup, you’d name it yourself, feed it to your code, get back the answer, then check that the answer matches your expectation.
RegulationD has quit [Remote host closed the connection]
robustus has quit [Ping timeout: 264 seconds]
codegate has joined #ruby
<makerop>
cool
<survili>
jhass: I ran your sample and the output for version = 1, str1 = "str1", str2 = "str2" is "\x03\x00\x04\x00s\x04\x00s". A means one character no ? don't we need A#{str1.size} to achieve what I need ?
<makerop>
I do that (via DATA)
bluOxigen has joined #ruby
<mwlang>
makerop: exactly.
<jhass>
survili: oh, that's why, * should be fine there
<mwlang>
however, instead of a constant like DATA, use lets…as in: let(:data) { whatever_DATA_is_now }
zorak8 has quit [Read error: Connection reset by peer]
sevvie has quit [Ping timeout: 255 seconds]
<bradland>
nice drilldown on some common pitfalls of benchmarking very fast operations
<survili>
jhass: I was wondering if there is some pattern I can pass to .pack that "knows" to write strings in my format(i.e. size first and then the data). but I guess there is not
wolf4ood___ has joined #ruby
piotrj has quit [Remote host closed the connection]
zorak8 has joined #ruby
<jhass>
well, I don't see any in the docs
arup_r has joined #ruby
<bradland>
yeah, i don't think pack has any references like that
<bradland>
i.e., references to total data size
codecop has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
RegulationD has joined #ruby
piotrj has joined #ruby
bluOxigen has quit [Ping timeout: 246 seconds]
deric_skibotn has joined #ruby
sevvie has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<survili>
jhass: thank you
<jhass>
survili: next time just don't include all that unnecessary baggage into your question, "Is there a directive for pack that prepends the size of string to it?" or something like that would've been much clearer :)
mog_ has joined #ruby
<survili>
jhass: lol, great way to ask my question :)
<bradland>
i'm always amazed at how hard it is to ask questions (speaking for myself here, not a passive-aggressive comment)
rbennacer has joined #ruby
Schmidt has quit [Ping timeout: 265 seconds]
piotrj has quit [Remote host closed the connection]
survili has quit [Quit: Page closed]
d10n-work has quit [Quit: Connection closed for inactivity]
<mwlang>
bradland: I think sometimes I make it harder on myself because I’m trying to construct a question that won’t solicit the obvious answers I already considered and don’t want to wade through to get to the intended answer.
yqt has joined #ruby
dANO_ has quit []
CustosLimen has quit [Ping timeout: 252 seconds]
Sawbones has joined #ruby
robustus has quit [Ping timeout: 255 seconds]
sarlalian has quit [Quit: WeeChat 0.4.2]
<jhass>
mwlang: that's simple to avoid. "I already tried to a, b, c and d. Any other options I missed?"
<jhass>
if your attempts had small enough code samples including those is good too
dfinning_ has quit [Remote host closed the connection]
dc_ has quit [Ping timeout: 245 seconds]
robustus has joined #ruby
<jhass>
since you might actually have had a non-obvious bug in one of these or something like that
Megtastique has quit []
jottr has quit [Ping timeout: 246 seconds]
SegFaultAX has quit [Excess Flood]
sigurding has joined #ruby
polysics has joined #ruby
<jhass>
the actually confusing part about survili's question was the lengthy description of its whole format (including the actually unrelated version) and then the "I couldn't figure out what to pass to pack" at the end
<jhass>
which made it sound like their question was about the (then even insufficiently described) format
sarlalian has joined #ruby
Beliq has joined #ruby
jottr has joined #ruby
SegFaultAX has joined #ruby
<jhass>
instead of about a detail to it/an optimization to the already present solution
Rollabunna has quit [Remote host closed the connection]
dh64 has joined #ruby
Takle has quit [Remote host closed the connection]
Rollabunna has joined #ruby
Dodo1 has joined #ruby
Limix has joined #ruby
kalusn has quit [Remote host closed the connection]
Pupeno_ has quit [Quit: Leaving...]
multiscan has quit [Ping timeout: 252 seconds]
kalusn has joined #ruby
nfk has quit [Quit: yawn]
Pupeno has joined #ruby
Dodo1 has left #ruby [#ruby]
zachrab has joined #ruby
kblake has joined #ruby
Dodo1 has joined #ruby
robustus has quit [Ping timeout: 264 seconds]
sevvie has quit [Ping timeout: 252 seconds]
catphish has quit [Quit: Leaving]
<Dodo1>
hello,
<Dodo1>
are there any rules about posting stuff in here?
spyderman4g63 has joined #ruby
sevvie has joined #ruby
dc_ has joined #ruby
aryaching has joined #ruby
ki0 has quit [Remote host closed the connection]
robustus has joined #ruby
craigp has joined #ruby
jlebrech has quit []
Dodo1 has left #ruby [#ruby]
kalusn has quit [Ping timeout: 256 seconds]
Dodo1 has joined #ruby
dc_ has quit [Read error: Connection reset by peer]
<centrx>
Dodo1, "stuff"?
danjordan has quit [Quit: danjordan]
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dc_ has joined #ruby
rbennacer has quit [Remote host closed the connection]
<jhass>
Dodo1: just ask, you'll be told if it was inappropriate ;)
zachrab has quit [Ping timeout: 264 seconds]
sigurding has quit [Quit: sigurding]
<Dodo1>
okay =)
<Dodo1>
I have a problem with JSON. I do get a JSON (LoadError) altough I have the JSON gem installed and require it in the file?
aspiers has quit [Ping timeout: 255 seconds]
<jhass>
Dodo1: can you post a reproducing example to gist.github.com?
iamjarvo has joined #ruby
Megtastique has joined #ruby
chthon has quit [Ping timeout: 264 seconds]
iamjarvo has quit [Max SendQ exceeded]
mary5030 has quit [Remote host closed the connection]
<shevy>
Dodo1 a minimal json file would be helpful
<shevy>
ideally with how you can reproduce that error
iamjarvo has joined #ruby
<shevy>
for me, require 'json' works
<shevy>
I have the json-1.8.1.gem
marcoecc has joined #ruby
<Dodo1>
okay. I'm trying it.
psy_ has joined #ruby
psy_ has quit [Max SendQ exceeded]
dc_ has quit [Read error: Connection reset by peer]
psy_ has joined #ruby
troulouliou_div2 has joined #ruby
jottr has quit [Ping timeout: 246 seconds]
scripore has joined #ruby
troulouliou_div2 has quit [Client Quit]
Sawbones has quit [Remote host closed the connection]
dc_ has joined #ruby
pontiki has joined #ruby
towski_ has joined #ruby
shadoi1 has joined #ruby
_djbkd has joined #ruby
oivoodoo has quit [Remote host closed the connection]
baweaver has joined #ruby
nfk has joined #ruby
ismael__ has joined #ruby
plashchynski has quit [Ping timeout: 264 seconds]
commmmodo has quit [Quit: commmmodo]
nii236 has joined #ruby
ploshy has joined #ruby
DerisiveLogic has quit [Ping timeout: 264 seconds]
plashchynski has joined #ruby
<mwlang>
I’m pulling binary data out of an LDAP field. Its a thumbnail headshot of the person. Is there a way I can tell if its JPG or PNG so I save the correct file extension?
<iamjarvo>
so if you say Person = Struct.new(:name); p = Person.new("ruby"); p.instance_variables # => []; how do structs utilize instance variables
craigp has quit [Remote host closed the connection]
joast has joined #ruby
<mwlang>
I know if I just save some file and call “file” on command-line I can get the file signature that way, but I’m hoping Ruby has a more elegant way.
tcrypt has joined #ruby
leafybasil has quit [Remote host closed the connection]
<Dodo1>
I could sort out the problem. Thank you anyway
<wallerdev>
mwlang: i dont think ruby has a built in way to do that, but you can use an image processing library
<wallerdev>
such as imagemagick
jespada has quit [Ping timeout: 244 seconds]
GGMethos has joined #ruby
civim has quit [Quit: Leaving]
psy_ has quit [Read error: Connection reset by peer]
dc_ has quit [Read error: Connection reset by peer]
jonr22 has joined #ruby
binfalse has quit [Quit: leaving]
dfinninger has quit [Client Quit]
polysics has quit [Ping timeout: 252 seconds]
aldodelgado has joined #ruby
adriancb_ has joined #ruby
juanpaucar has quit [Ping timeout: 272 seconds]
adriancb has quit [Ping timeout: 252 seconds]
dc_ has joined #ruby
nateberkopec has joined #ruby
zachrab has joined #ruby
jonr22 has quit [Ping timeout: 252 seconds]
phale has joined #ruby
freerobby has joined #ruby
PaulCapestany has quit [Quit: .]
Jackneill has joined #ruby
lordkryss has joined #ruby
_djbkd has quit [Remote host closed the connection]
ptrrr has joined #ruby
DerisiveLogic has joined #ruby
phale has left #ruby [#ruby]
dc_ has quit [Remote host closed the connection]
chinmay_dd has quit [Quit: Connection closed for inactivity]
jespada has quit [Ping timeout: 245 seconds]
dc_ has joined #ruby
DLSteve has joined #ruby
<mwlang>
thanks, guys. Got it. Since I had rmagick gem already, the most assured way worked out to this: @thumbnail = Magick::Image.from_blob(entry[:thumbnailPhoto) and then I just check @thumbnail.format for “JPEG” or “PNG”, etc.
mog_ has quit [Ping timeout: 272 seconds]
User458764 has joined #ruby
ianwessen has joined #ruby
atomi has quit [Quit: installing new notifications system bbiab]
Rephiax has joined #ruby
PaulCapestany has joined #ruby
apxm has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_djbkd has joined #ruby
banister has joined #ruby
banister has quit [Max SendQ exceeded]
Pupeno has quit [Quit: Leaving...]
SegFaultAX has quit [Excess Flood]
mistergibson has quit [Ping timeout: 246 seconds]
ianwessen has left #ruby [#ruby]
tcrypt has joined #ruby
scripore has quit [Quit: This computer has gone to sleep]
mog_ has joined #ruby
jespada has joined #ruby
Flcn has quit [Quit: Be back later ...]
dc_ has quit [Ping timeout: 272 seconds]
Spami has quit [Quit: This computer has gone to sleep]
<eval-in_>
ericwood => wrong number of arguments (1 for 0) (ArgumentError) ... (https://eval.in/298355)
scripore has quit [Client Quit]
DerisiveLogic has quit [Ping timeout: 264 seconds]
tuelz has joined #ruby
<ericwood>
see? wouldn't that be badass
Takle has joined #ruby
chrishough has joined #ruby
Pupeno has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
<tuelz>
Is there a good way to check a version of a gem inside a project? I need to support a few versions of a gem and the core classes changed their namespace between versions
<tuelz>
so I imagine Bundler.get_gem_version or something, but I can't find anything yet
<tuelz>
ericwood: was hoping there was a cleaner way, but at least now I know one way!
<ericwood>
tuelz: you talking about programmatically?
m8 has joined #ruby
DerisiveLogic has joined #ruby
<tuelz>
mwlang: it's an inhouse gem for an inhouse project that is SOA so we gemified the database setup process
<workmad3>
tuelz: you've already mentioned one way
<workmad3>
tuelz: check which top-level namespace is defined ;)
<tuelz>
workmad3: I don't think that's a real method :p
<tuelz>
jesus that makes so much more sense
<tuelz>
thanks
<workmad3>
hehe
<mwlang>
tuelz: The usual pattern I’ve seen is GemNamespace::VERSION
<mwlang>
or really, GemNamespace::version
<mwlang>
for example:: Rails::version
ghostpl_ has quit [Remote host closed the connection]
<workmad3>
tuelz: yeah, the way I said you mentioned was to check for a particular defined namespace
<tuelz>
mwlang: that would be a good idea, too
<workmad3>
tuelz: but I should really have said that you alluded to it rather than mentioned it :)
<tuelz>
workmad3: yeah that sounds simple enough
ki0 has joined #ruby
<tuelz>
brb chaging wifi
<workmad3>
tuelz: btw, if you're interested in the Gemfile.lock approach, I've had success with 'Hash[File.read("Gemfile.lock").map(&:strip).map{|line| line.split(" ", 2)}.reject{|_, v| v.nil?}.reject{|_, v| v =~ /\((=|>|~)/}.map{|g, v| [g, v[1..-2]]}]' as a one-liner to produce a gem_name => version hash
wallerdev has quit [Quit: wallerdev]
unshadow has quit [Quit: leaving]
<mwlang>
workmad3: 8-o
<workmad3>
mwlang: it's pretty, right? :D
<Senjai>
workmad3: You could just use shell utils xD
GaryOak_ has quit []
<Senjai>
cut and friends
juanpaucar has joined #ruby
<workmad3>
Senjai: I wanted the hash inside a chef deploy, kinda made sense to just use ruby capabilities
<mwlang>
workmad3: yeah, I love to read that like I love to scan ingredient lists on packaged goods.
<Senjai>
workmad3: Ah
<mwlang>
but, hey, ya can’t argue with the results ya get.
jottr has joined #ruby
ramfjord has joined #ruby
dropp has quit [Quit: leaving]
<workmad3>
mwlang: yeah... I probably should split that up into more readable lines... but I kinda like it as a one-liner :)
<workmad3>
mwlang: and that one line of ugliness let me clean up a whole host of auto-detection of system dependencies based on reading a project's Gemfile :)
baweaver has quit [Remote host closed the connection]
tuelz has quit [Ping timeout: 246 seconds]
<workmad3>
'oh hey, this project has mini_magick in its gemfile... install imagemagick system package'
dEPy has quit [Quit: (null)]
yfeldblu_ has quit [Ping timeout: 265 seconds]
<workmad3>
right, must run off
<workmad3>
hf all
Dodo1 has quit [Ping timeout: 265 seconds]
yqt has quit [Ping timeout: 240 seconds]
<Senjai>
workmad3: That actually sounds pretty cool
<Senjai>
I never thought of that
<mwlang>
workmad3: not a bad approach to gettting system dependencies installed.
<Senjai>
we could do quite a bit with that approach
atomi has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
<mwlang>
workmad3: something’s slightly off there… NoMethodError: undefined method `map' for #<String:0x007fe025428760>
doodlehaus has joined #ruby
dstarh has quit [Read error: Connection reset by peer]
mloveless has quit [Remote host closed the connection]
<mwlang>
workmad3: needs a split before that first map: Hash[File.read("Gemfile.lock").split("\n").map(&:strip).map{|line| line.split(" ", 2)}.reject{|_, v| v.nil?}.reject{|_, v| v =~ /\((=|>|~)/}.map{|g, v| [g, v[1..-2]]}]
boadie has joined #ruby
craigp has joined #ruby
mloveless has joined #ruby
postmodern has joined #ruby
thumpba_ has quit [Ping timeout: 240 seconds]
workmad3 has quit [Ping timeout: 264 seconds]
craigp has quit [Client Quit]
thumpba has joined #ruby
perrier has quit [Remote host closed the connection]
Prometheian has quit [Remote host closed the connection]
eladmeidar has joined #ruby
vlad_starkov has joined #ruby
tjk11 has joined #ruby
ghostpl_ has joined #ruby
jottr has joined #ruby
tjk11 has left #ruby [#ruby]
sambao21 has quit [Quit: Computer has gone to sleep.]
tuelz has joined #ruby
phale has joined #ruby
<phale>
why the hell does rvm want me to do /bin/bash --login?
<phale>
that's fucking stupid
oivoodoo has joined #ruby
zachrab has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
zachrab has joined #ruby
tvon has joined #ruby
tvw has quit [Remote host closed the connection]
<tuelz>
I'm calling methods defined on a variable top level namespace in a rakefile. Inside the gem I'm loading up all the files with ruby and I need to put that top level namespace in a variable if that's possible, or would it be better just to write out two seperate rake tasks and load them depending on which top level namespace exists?
tearan has joined #ruby
juanpaucar has quit [Remote host closed the connection]
<tuelz>
phale: I haven't used rvm in a couple of months, but I've never had to do that.
<phale>
tells me i need a login shell or whatever
zachrab has quit [Read error: Connection reset by peer]
<phale>
do you realize how inefficient this is in a window manager?
_blizzy_ has quit [Ping timeout: 252 seconds]
zachrab has joined #ruby
<makerop>
phale, your profile is not setup, or .bashrc etc
<tuelz>
sounds like you don't have it setup properly. Are you exporting to your PATH correctly when you open your bash shell?
<tuelz>
phale: this isn't installing to some /usr/bin or something, you have to include it in your PATH somewhere for rvm magic to work because it does a lot of weird things behind the curtains
vlad_starkov has quit [Ping timeout: 256 seconds]
GnuYawk has quit [Ping timeout: 256 seconds]
aryaching has joined #ruby
<tuelz>
alternatively if you want a ruby manager you can understand and has less features I would also recommend chruby
<tuelz>
rvm worked just fine for years for me though
mog_ has quit [Ping timeout: 255 seconds]
<phale>
that's retarded
relix has joined #ruby
<phale>
meh
<tuelz>
lol.
teddyp1cker has quit [Remote host closed the connection]
<makerop>
there are numerous tus out there on how to setup things correctly
<tuelz>
either you want the features or you don't. Nothing retarded about it
<makerop>
only takes a minute or two
<makerop>
tuts*
alexherbo2 has joined #ruby
Takle has joined #ruby
<tuelz>
at least your typo wasn't on the 'u' ;P
<phale>
meh
<phale>
i'll be programming in C now
<phale>
cya
* tuelz
hopes everyone realizes the 'i' key is beside the 'u'
zachrab has quit [Ping timeout: 272 seconds]
<tuelz>
phale: peace
<phale>
(hippy smile)
phale has left #ruby ["Leaving"]
<tuelz>
I wonder how far someone who hates reading the docs gets with C...
<makerop>
heh
<miah>
depends on which docs you're reading
<makerop>
and rvm vs make?
<makerop>
c'mon
<miah>
make vs rake more like
jgrevich has joined #ruby
<miah>
rvm isn't really comparable to make
<makerop>
true
AlexRussia has quit [Ping timeout: 265 seconds]
sambao21 has joined #ruby
<miah>
i think the problem with C is that most of the
<miah>
'good books' were written before 1990 =)
AlexRussia has joined #ruby
fryguy9 has quit [Read error: Connection reset by peer]
fryguy9 has joined #ruby
<makerop>
I still like K&r
<miah>
and also that the language will let you shoot yourself in the face, and foot multiple times
juanpaucar has quit [Remote host closed the connection]
sambao21 has quit [Client Quit]
<average>
miah: I actually tried to work on a product with this guy
<average>
miah: he was so freaked out that we spent around 2 weeks for security measures
<average>
instead of writing actual fucking code
<makerop>
you can define "writing good c"
<average>
because he was a security guy and that's how he thinks "things have to be done"
malcolmva has quit [Ping timeout: 256 seconds]
<miah>
well, it sounds more like a personal problem
<average>
security is a piece of shit, you're never going to get anything done if you think about security all the time
<miah>
like he knew more theory than had practice
<miah>
i disagree =)
sambao21 has joined #ruby
<makerop>
yeah, I disagree too
<makerop>
that's a ridiculous statement
teddyp1cker has joined #ruby
yqt has joined #ruby
<average>
no you don't understand what you're disagreeing to
<average>
let me re-state it again
<miah>
ya i dont understand
<miah>
bye
miah has left #ruby [#ruby]
<average>
i'm glad he left
<average>
anyway
<makerop>
you have to wrry about security though imo
<average>
re-stating: spent 2 weeks configuring stuff to make sure everything is "safe" instead of actually building a product. in those 2-weeks no code was written
<average>
that's such poor judgement on people thinking like that
enebo has quit [Quit: enebo]
<makerop>
it depends on the context imo
<makerop>
if it's a stupid webapp for a startup, yes, agreed
<average>
exactly
<average>
that's what it was
<average>
a stupid webapp
_djbkd has quit [Remote host closed the connection]
<makerop>
then just use rails etc, and throw something together
<makerop>
most of the security that is baked in, is transparent
plashchynski has quit [Quit: plashchynski]
miah has joined #ruby
<miah>
im coming back just for this one thing
<miah>
19:17 [average<~stefan@unaffiliated/average>] please don't come back
<atmosx>
makerop: well, both of them have well defined structures
maximski has quit [Max SendQ exceeded]
jlast has quit [Ping timeout: 256 seconds]
<makerop>
well, I feel like Im just copying stuff, rather than understanding why
phutchins has quit [Ping timeout: 245 seconds]
<atmosx>
makerop: okay
<makerop>
ie, the gem, im writing, im looking at twitter-oath
<makerop>
oauth*
<makerop>
but im not sure why it's better
maximski has joined #ruby
maximski has quit [Max SendQ exceeded]
<havenwood>
makerop: show us here?
<makerop>
yeah, ill do that tonight
<makerop>
i have to get github re-setup etc first
maximski has joined #ruby
kalusn has joined #ruby
maximski has quit [Max SendQ exceeded]
freerobby has joined #ruby
maximski has joined #ruby
sevvie has joined #ruby
jonr22 has quit [Ping timeout: 265 seconds]
zorak8 has joined #ruby
maximski has quit [Max SendQ exceeded]
<atmosx>
actually, when I wrote my first gem, it was a little bit confusing. In the 2nd gem I ever wrote, it was all clear. I mean the 'why' of the structure other popular gems had.
einarj has quit [Read error: Connection reset by peer]
einarj has joined #ruby
maximski has joined #ruby
maximski has quit [Max SendQ exceeded]
wallerdev has joined #ruby
malcolmva has quit [Ping timeout: 255 seconds]
maximski has joined #ruby
MatthewsFace has joined #ruby
red_horned_rihno has quit [Ping timeout: 252 seconds]
iamjarvo has joined #ruby
jottr has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
iamjarvo has joined #ruby
apxm has joined #ruby
ssd7 has joined #ruby
rbennacer has quit [Remote host closed the connection]
iamjarvo has quit [Max SendQ exceeded]
<atmosx>
>> b = '12/03/15'.split('/'); Date.parse(b[2],b[1],b[0])
<atmosx>
MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format.
<atmosx>
hm
_honning_ has quit [Ping timeout: 244 seconds]
SegFaultAX has quit [Excess Flood]
SegFaultAX has joined #ruby
nii236 has joined #ruby
zachrab has quit [Ping timeout: 252 seconds]
Dmr has quit [Quit: Leaving]
Takle has quit [Remote host closed the connection]
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
einarj_ has joined #ruby
smallfoot- has joined #ruby
<smallfoot->
What is the de facto way to do HTTP POST requests?
einarj has quit [Remote host closed the connection]
coderanger has left #ruby ["Bye"]
sambao21 has quit [Quit: Computer has gone to sleep.]
mengu has joined #ruby
mengu has joined #ruby
cphrmky has joined #ruby
Megtastique has quit []
naftilos76 has joined #ruby
dmr8 has joined #ruby
malcolmva has joined #ruby
sambao21 has joined #ruby
Channel6 has joined #ruby
bradleyprice has quit []
r3DKinG has quit [Remote host closed the connection]
kirun has joined #ruby
Takle has joined #ruby
bradleyprice has joined #ruby
aryaching has quit [Ping timeout: 252 seconds]
randiman has joined #ruby
<havenwood>
smallfoot-: There're a number of HTTP gems and no consensus. You could use Net::HTTP or one of its wrappers. HTTPClient and Excon are pure Ruby options. I think the HTTP gem has a particularly nice interface: https://github.com/httprb/http.rb#post-requests
ghostpl_ has quit [Remote host closed the connection]
<havenwood>
smallfoot-: Net::HTTP of course being the stdlib option.
<smallfoot->
with .NET its much simpler, you get HttpClient, and thats what you should use
bim has joined #ruby
tubuliferous has joined #ruby
<smallfoot->
havenwood, wow thats ridiculously silly many options
<havenwood>
smallfoot-: There are multiple high quality HTTP client libraries in Ruby. They vary in a number of characteristics though, and some are better for certain tasks than others.
<havenwood>
smallfoot-: Or there are options like Faraday, where you can keep the same code and swap between multiple HTTP client adapters.
polysics has joined #ruby
fryguy9 has quit [Read error: Connection reset by peer]
<smallfoot->
I see
fryguy9 has joined #ruby
<smallfoot->
Too confusing, I'll guess I'll go with some more coherent, organized and sane language with a solid standard library such as .NET or Python instead
smallfoot- has left #ruby ["Leaving"]
roolo has quit [Ping timeout: 272 seconds]
<havenwood>
smallfoot-: just use the option in the stdlib
<havenwood>
or use .NET, whatever make you happy...
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<havenwood>
More than one library? Flee!
<Obfuscate>
It's often best to retreat when outnumbered.
frem_ has joined #ruby
bim has quit [Remote host closed the connection]
GaryOak_ has quit [Remote host closed the connection]
n80 has quit [Quit: n80]
rdark has quit [Quit: leaving]
<HOrangeJewce>
back to the keep!
Jackneill has quit [Remote host closed the connection]
jlast has joined #ruby
adriancb_ is now known as adriancb
n80 has joined #ruby
cphrmky has quit [Read error: Connection reset by peer]
roolo has joined #ruby
towski_ has joined #ruby
oo_ has joined #ruby
digitalextremist has quit [Ping timeout: 256 seconds]
zorak8 has quit [Read error: Connection reset by peer]
ploshy has quit [Quit: leaving]
malcolmva has quit [Ping timeout: 252 seconds]
zorak8 has joined #ruby
average has quit [Ping timeout: 252 seconds]
bim has joined #ruby
fmcgeough has quit [Quit: fmcgeough]
_djbkd has quit [Remote host closed the connection]
roolo_ has quit [Ping timeout: 264 seconds]
jottr has quit [Ping timeout: 245 seconds]
_honning_ has joined #ruby
waxjar has joined #ruby
GambitK has joined #ruby
<GambitK>
Hello, I'm trying to find info about it and can't get info on how "self.logger.debug" works
jottr has joined #ruby
oo_ has quit [Ping timeout: 240 seconds]
sambao21 has quit [Quit: Computer has gone to sleep.]
bim has quit [Remote host closed the connection]
zenith_ has joined #ruby
graft has quit [Quit: Lost terminal]
arup_r has quit [Quit: ChatZilla 0.9.91.1 [Firefox 36.0/2015022000]]
DLSteve has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
iamjarvo has joined #ruby
<havenwood>
GambitK: Is there anything in particular you want to know about it?
morenoh149 has joined #ruby
last_staff has joined #ruby
zenith_ has quit [Remote host closed the connection]
Wolland has joined #ruby
sambao21 has joined #ruby
<GambitK>
havenwood: thanks, I'm trying to use this gem, https://github.com/csirtgadgets/rb-cif-sdk, to query a cif instance and I'm getting this error: /var/lib/gems/1.9.1/gems/cif-sdk-0.0.1/lib/cif-sdk/client.rb:23:in `_make_request': undefined method `debug' for nil:NilClass (NoMethodError)
fenzil has quit [Read error: Connection reset by peer]
maximski has joined #ruby
<GambitK>
but I get an error when I try to use the methods where self is referenced
<Phage>
I have this JSON code: https://dpaste.de/hFKC But I simply can't figure out how to get two of the objects 'title' and 'url'... I know how to parse it, just not how to extract what I want.
Megtastique has joined #ruby
<wallerdev>
obj["data"]["title"]
average has joined #ruby
malcolmva has joined #ruby
<havenwood>
GambitK: You need to set `logger = Logger.new(STDOUT)` in #initialize or however you want just have `@logger` be a Logger or at least respond to #debug.
<havenwood>
GambitK: Look at the link I just pasted ^. They parse the `params` Hash and set the key to the value. Like: {'logger' => Logger.new(STDOUT)}
<Phage>
Oh!
<havenwood>
GambitK: ^ I don't approve... but that's what they're doing. :P
<Phage>
Well... Why doesn't it pull the title and url?
_hollywood has quit [Quit: Leaving]
<wallerdev>
your format for the json is incorect
<wallerdev>
i just loaded the url and its not how you said it is
<wallerdev>
thats why
<wallerdev>
it comes back as a list of results
jmignault has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
deepu: with Array#each, Hash#[] and Kernel#system
ych4k3r has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Pupeno has quit [Quit: Leaving...]
randiman has quit [Quit: (null)]
ych4k3r has joined #ruby
<GambitK>
havenwood: it works now http://pastebin.com/ezScnB99 but I have to check because it seems that the remote path is not being received
<helpa>
Hi GambitK. We in #ruby would really appreciate it if you did not use pastebin during your time with us.
<helpa>
Pastebin is not good because it loads slowly for most, has ads which are distracting and has terrible formatting. Please use Gist (http://gist.github.com) or Pastie (http://pastie.org) instead. Thanks!
<GambitK>
helpa: thanks
duggiefresh has quit [Remote host closed the connection]
<deepu>
jhass: would you mind giving me an .each example?
duggiefresh has joined #ruby
_honning_ has quit [Ping timeout: 246 seconds]
<jhass>
deepu: not at all, just go to http://tryruby.org, it'll come soon enough
narcan has quit [Quit: -[AppDelegate installMalware]: unrecognized selector sent to instance 0x156109c0]
nucular11 has joined #ruby
GaryOak__ has quit [Remote host closed the connection]
martinbmadsen has joined #ruby
Stalkr_ has joined #ruby
baweaver has joined #ruby
<nucular11>
hey all. i'm trying to reproduce the assert_equals functionality of a test harness. i tried comparing the eval of the two params but ruby's complaining about eval'ing a string. ideas?
aghalarp has joined #ruby
plashchynski has joined #ruby
roolo has quit [Remote host closed the connection]
<bradland>
nucular11: what's the exact error message? eval'ing a string is what Kernel#eval is made to do.
<bradland>
there's probably an issue with the ruby code within your string
lordkryss has quit [Quit: Connection closed for inactivity]
adriancb has quit [Remote host closed the connection]
aghalarp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<nucular11>
thanks bradland
max96at is now known as max96at|off
dfinninger has quit [Remote host closed the connection]
duggiefresh has joined #ruby
Sawbones_ has joined #ruby
reinaldob has quit [Remote host closed the connection]
Channel6 has joined #ruby
codecop has quit [Remote host closed the connection]
atom3 has quit [Ping timeout: 276 seconds]
ascarter has quit [Ping timeout: 244 seconds]
Guest65 has quit [Ping timeout: 256 seconds]
jgrevich has quit [Ping timeout: 264 seconds]
Feyn has joined #ruby
lanemeyer has joined #ruby
buub has quit [Ping timeout: 246 seconds]
seal has joined #ruby
atom3 has joined #ruby
Musashi007 has quit [Quit: Musashi007]
reinaldob has joined #ruby
boadie has quit [Ping timeout: 246 seconds]
fryguy9 has quit [Quit: Leaving.]
juanpablo_ has quit [Quit: (null)]
Volsus has joined #ruby
juanpablo_ has joined #ruby
Takle has quit [Remote host closed the connection]
plashchynski has joined #ruby
thiagovsk has quit [Quit: Connection closed for inactivity]
duggiefresh has quit [Ping timeout: 240 seconds]
Musashi007 has joined #ruby
Musashi007 has quit [Client Quit]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
juanpablo_ has quit [Ping timeout: 255 seconds]
commmmodo has quit [Ping timeout: 250 seconds]
it0a has joined #ruby
zachrab has joined #ruby
gregf has quit [Quit: WeeChat 1.1.1]
tuelz has quit [Ping timeout: 252 seconds]
teddyp1cker has joined #ruby
Altonymous has joined #ruby
<Altonymous>
apeiros: still fighting with this import issue :(
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jonr22 has joined #ruby
<Altonymous>
tried using put_copy_data with multiple lines instead of a line at a time. Tried 10, 100, 1000 records at a time didn’t see any difference in CPU usage. Still pegged at 100%
<helpa>
Hi Altonymous. We in #ruby would really appreciate it if you did not use pastebin during your time with us.
<helpa>
Pastebin is not good because it loads slowly for most, has ads which are distracting and has terrible formatting. Please use Gist (http://gist.github.com) or Pastie (http://pastie.org) instead. Thanks!
<Senjai>
And your profile is saying put_copy_data is taking the longest here?
<Senjai>
You're doing a lot of stuff
<Senjai>
before put_copy_data is even called
<Senjai>
FOr each line
<Senjai>
And a line is less than 256 bytes
ips|malc has quit [Ping timeout: 276 seconds]
ips|malc has joined #ruby
<Senjai>
Assuming each line was 256 bytes, for 90mb, 351.5 THOUSAND calls to put_copy_data
<Altonymous>
I don’t have the old code where we did 1000 lines at a time
<Senjai>
Step 1: If you're SURE put copy data is where the time is being spent (emphasis on sure), find ways to call it less
<Altonymous>
it’s definitely on the put_copy_data() put a newrelic trace around it..
<Altonymous>
I reduced the number of times it was called when doing 1000 lines at a time and it made no difference
<Senjai>
Step 2: IF that doesnt help, FIND WHAT PUT_COPY_DATA does to take so long, which means using a real profiler, not one that stops at put_copy_data
<Senjai>
Step 3: Make decisions based on output from step 2
<Senjai>
Step 4: If put_copy_data cannot be optimized, then its a problem with the other end of the pipe
<Senjai>
Step 5: Fix the other end of the pipe, if possible
<Senjai>
Default RDBMS settings are terrible for high volume
ptrrr has quit [Quit: ptrrr]
seal has quit [Quit: Ex-Chat]
<Senjai>
Altonymous: If you've tried those, and still cant figure it out, come back and let us know
<Altonymous>
1. I’m sure. 2. I am unfamiliar with pg gem internal workings, don’t know to begin to optimize it. 3. nil. 4. The other end of the pipe has achived 30k /recs per sec not using ruby. 5. nil.
davidhq has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tuelz has joined #ruby
zz_twistedpixels is now known as twistedpixels
Zai00 has quit [Quit: Zai00]
phutchins has joined #ruby
<jhass>
Altonymous: you could start with obvious optimizations before the copy data call even happens, like combining the gsubs into one, not doing them if take_how_many is nil and possibly even combine the split and gsub into a single pass by using scan
oki has quit [Ping timeout: 255 seconds]
<Altonymous>
profiler says those lines account for less than 1sec of the runtime But I did change the gsub to column_data = line.delete("\b").tr("\r\n"," ").split("\t")
tuelz has quit [Ping timeout: 240 seconds]
<Altonymous>
will have to investigate the scan
plashchynski_ has joined #ruby
plashchynski has quit [Ping timeout: 240 seconds]
plashchynski_ is now known as plashchynski
<Altonymous>
and the take_how_many is a good point, I don’t need that line anymore, the default is always set now.
<jhass>
put_copy_data seems to run the stuff through PG::TextEncoder::CopyRow, should be worth investigating what that does
baweaver has joined #ruby
<Senjai>
Altonymous: New Relic profiler is hardly a profiler
robustus has quit [Ping timeout: 264 seconds]
<Senjai>
There are tons of things that take up time in that loop. Each line is a small amount of data
deric_skibotn has quit [Ping timeout: 256 seconds]
<Senjai>
and then you perform tons of operations on that small amount of data
<Senjai>
then pass it into the connection
<Senjai>
That will be an optimization pain point EVENTUALLY
Zai00 has joined #ruby
juanpaucar has joined #ruby
plashchynski has quit [Ping timeout: 255 seconds]
plashchynski_ has joined #ruby
<Senjai>
Altonymous: If you're unfamiliar with the pg gem workings, time to get familiar. Reading code is 70-80% of the job. Other coders aren't perfect, and they probably didnt design this tool for your usecase.